8141690: JDK-8133151 change to MakeJavaSecurity.java is not complete
Reviewed-by: mullan
This commit is contained in:
parent
8fc9b58a4e
commit
c804d98306
@ -89,7 +89,7 @@ public class MakeJavaSecurity {
|
||||
}
|
||||
|
||||
// Filter out platform-unrelated ones. We only support
|
||||
// #ifdef, #ifndef, and #endif.
|
||||
// #ifdef, #ifndef, #else, and #endif. Nesting not supported (yet).
|
||||
int mode = 0; // 0: out of block, 1: in match, 2: in non-match
|
||||
Iterator<String> iter = lines.iterator();
|
||||
while (iter.hasNext()) {
|
||||
@ -105,7 +105,17 @@ public class MakeJavaSecurity {
|
||||
}
|
||||
iter.remove();
|
||||
} else if (line.startsWith("#ifndef ")) {
|
||||
mode = line.endsWith(args[2])?2:1;
|
||||
if (line.indexOf('-') > 0) {
|
||||
mode = line.endsWith(args[2]+"-"+args[3]) ? 2 : 1;
|
||||
} else {
|
||||
mode = line.endsWith(args[2]) ? 2 : 1;
|
||||
}
|
||||
iter.remove();
|
||||
} else if (line.startsWith("#else")) {
|
||||
if (mode == 0) {
|
||||
throw new IllegalStateException("#else not in #if block");
|
||||
}
|
||||
mode = 3 - mode;
|
||||
iter.remove();
|
||||
} else {
|
||||
if (mode == 2) iter.remove();
|
||||
@ -150,7 +160,7 @@ public class MakeJavaSecurity {
|
||||
List<String> args) throws IOException {
|
||||
// parse property until EOL, not including line breaks
|
||||
boolean first = true;
|
||||
while (!line.isEmpty()) {
|
||||
while (line != null && !line.isEmpty()) {
|
||||
if (!line.startsWith("#")) {
|
||||
if (!line.endsWith(",\\") ||
|
||||
(!first && line.contains("="))) {
|
||||
@ -169,6 +179,8 @@ public class MakeJavaSecurity {
|
||||
lines.add(String.format("%"+numSpaces+"s", "") + arg + ",\\");
|
||||
}
|
||||
}
|
||||
lines.add(line);
|
||||
if (line != null) {
|
||||
lines.add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
22
jdk/test/jdk/security/JavaDotSecurity/final_java_security
Normal file
22
jdk/test/jdk/security/JavaDotSecurity/final_java_security
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# This is my own security properties file.
|
||||
#
|
||||
|
||||
foo.1=1
|
||||
foo.2=4
|
||||
foo.3=5
|
||||
foo.4=6a
|
||||
foo.5=8
|
||||
foo.6=9a
|
||||
foo.7=10
|
||||
foo.8=12
|
||||
|
||||
package.access=sun.,\
|
||||
solaris.,\
|
||||
one.more,\
|
||||
two.more
|
||||
|
||||
package.definition=sun.,\
|
||||
solaris.,\
|
||||
one.more,\
|
||||
two.more,\
|
52
jdk/test/jdk/security/JavaDotSecurity/ifdefs.sh
Normal file
52
jdk/test/jdk/security/JavaDotSecurity/ifdefs.sh
Normal file
@ -0,0 +1,52 @@
|
||||
#
|
||||
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
# @test
|
||||
# @bug 8141690
|
||||
# @summary MakeJavaSecurity.java functions
|
||||
|
||||
if [ "${TESTSRC}" = "" ] ; then
|
||||
TESTSRC="."
|
||||
fi
|
||||
|
||||
if [ "${TESTJAVA}" = "" ] ; then
|
||||
JAVAC_CMD=`which javac`
|
||||
TESTJAVA=`dirname $JAVAC_CMD`/..
|
||||
COMPILEJAVA=${TESTJAVA}
|
||||
fi
|
||||
|
||||
JAVAC="${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS}"
|
||||
JAVA="${TESTJAVA}/bin/java ${TESTVMOPTS}"
|
||||
TOOLSRC="${TESTSRC}/../../../../make/src/classes/build/tools/makejavasecurity/MakeJavaSecurity.java"
|
||||
TOOLNAME=build.tools.makejavasecurity.MakeJavaSecurity
|
||||
|
||||
if [ ! -f $TOOLSRC ]; then
|
||||
echo "Cannot find $TOOLSRC. Maybe not all code repos are available"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
$JAVAC -d . $TOOLSRC
|
||||
$JAVA $TOOLNAME $TESTSRC/raw_java_security outfile solaris sparc $TESTSRC/more_restricted
|
||||
|
||||
# On Windows, line end could be different. -b is a cross-platform option.
|
||||
diff -b outfile $TESTSRC/final_java_security
|
2
jdk/test/jdk/security/JavaDotSecurity/more_restricted
Normal file
2
jdk/test/jdk/security/JavaDotSecurity/more_restricted
Normal file
@ -0,0 +1,2 @@
|
||||
one.more
|
||||
two.more
|
62
jdk/test/jdk/security/JavaDotSecurity/raw_java_security
Normal file
62
jdk/test/jdk/security/JavaDotSecurity/raw_java_security
Normal file
@ -0,0 +1,62 @@
|
||||
#
|
||||
# This is my own security properties file.
|
||||
#
|
||||
|
||||
#ifdef solaris
|
||||
foo.tbd=1
|
||||
#else
|
||||
foo.tbd=1a
|
||||
#endif
|
||||
#ifndef solaris
|
||||
foo.tbd=2
|
||||
#endif
|
||||
#ifdef mac
|
||||
foo.tbd=3
|
||||
#endif
|
||||
#ifndef mac
|
||||
foo.tbd=4
|
||||
#endif
|
||||
#ifdef solaris-sparc
|
||||
foo.tbd=5
|
||||
#endif
|
||||
#ifndef solaris-sparc
|
||||
foo.tbd=6
|
||||
#else
|
||||
foo.tbd=6a
|
||||
#endif
|
||||
#ifdef solaris-x64
|
||||
foo.tbd=7
|
||||
#endif
|
||||
#ifndef solaris-x64
|
||||
foo.tbd=8
|
||||
#endif
|
||||
#ifdef macosx-sparc
|
||||
foo.tbd=9
|
||||
#else
|
||||
foo.tbd=9a
|
||||
#endif
|
||||
#ifndef macosx-sparc
|
||||
foo.tbd=10
|
||||
#endif
|
||||
#ifdef macosx-x64
|
||||
foo.tbd=11
|
||||
#endif
|
||||
#ifndef macosx-x64
|
||||
foo.tbd=12
|
||||
#endif
|
||||
|
||||
package.access=sun.,\
|
||||
#ifdef solaris
|
||||
solaris.,\
|
||||
#endif
|
||||
#ifdef macosx
|
||||
apple.,\
|
||||
#endif
|
||||
|
||||
package.definition=sun.,\
|
||||
#ifdef solaris
|
||||
solaris.,\
|
||||
#endif
|
||||
#ifdef macosx
|
||||
apple.,\
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user