Mercurial > hg > icedtea7
view patches/boot/ecj-stringswitch.patch @ 2892:11416bb1b308 icedtea-2.7.0pre07
Bump to icedtea-2.7.0pre07.
Upstream changes:
- Bump to icedtea-2.7.0pre07
- PR2938: Fix build of 8148487 backport
- PR3102: Extend 8022594 to AixPollPort
- S4858370: JDWP: Memory Leak: GlobalRefs never deleted when processing invokeMethod command
- S4963723: Implement SHA-224
- S6414899: P11Digest should support cloning
- S6425769: Allow specifying an address to bind JMX remote connector
- S6854417: TESTBUG: java/util/regex/RegExTest.java fails intermittently
- S6953295: Move few sun.security.{util, x509, pkcs} classes used by keytool/jarsigner to another package
- S6956398: make ephemeral DH key match the length of the certificate key
- S6961123: setWMClass fails to null-terminate WM_CLASS string
- S6966259: Make PrincipalName and Realm immutable
- S7044060: Need to support NSA Suite B Cryptography algorithms
- S7060849: Eliminate pack200 build warnings
- S7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
- S7069870: Parts of the JDK erroneously rely on generic array initializers with diamond
- S7081817: test/sun/security/provider/certpath/X509CertPath/IllegalCertiticates.java failing
- S7102686: Restructure timestamp code so that jars and modules can more easily share the same code
- S7105780: Add SSLSocket client/SSLEngine server to templates directory
- S7127906: (launcher) convert the launcher regression tests to java
- S7142339: PKCS7.java is needlessly creating SHA1PRNG SecureRandom instances when timestamping is not done
- S7152582: PKCS11 tests should use the NSS libraries available in the OS
- S7167988: PKIX CertPathBuilder in reverse mode doesn't work if more than one trust anchor is specified
- S7192202: Make sure keytool prints both unknown and unparseable extensions
- S7194449: String resources for Key Tool and Policy Tool should be in their respective packages
- S7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
- S7200682: TEST_BUG: keytool/autotest.sh still has problems with libsoftokn.so
- S8002116: This JdbReadTwiceTest.sh gets an exit 1
- S8002306: (se) Selector.open fails if invoked with thread interrupt status set [win]
- S8004007: test/sun/tools/jinfo/Basic.sh fails on when runSA is set to true
- S8005226: java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java fails intermittently
- S8006935: Need to take care of long secret keys in HMAC/PRF compuation
- S8007890: [TESTBUG] JcmdWithNMTDisabled.java fails when invoked with NMT explicitly turned on
- S8009636: JARSigner including TimeStamp PolicyID (TSAPolicyID) as defined in RFC3161
- S8014097: add doPrivileged methods with limited privilege scope
- S8019341: Update CookieHttpsClientTest to use the newer framework.
- S8021191: Add isAuthorized check to limited doPrivileged methods
- S8022228: Intermittent test failures in sun/security/ssl/javax/net/ssl/NewAPIs
- S8022439: Fix lint warnings in sun.security.ec
- S8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil
- S8023546: sun/security/mscapi/ShortRSAKey1024.sh fails intermittently
- S8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
- S8028537: PPC64: Updated the JDK regression tests to run on AIX
- S8028780: JDK KRB5 module throws OutOfMemoryError when CCache is corrupt
- S8036132: Tab characters in test/com/sun/jdi files
- S8036612: [parfait] JNI exception pending in jdk/src/windows/native/sun/security/mscapi/security.cpp
- S8037557: test SessionCacheSizeTests.java timeout
- S8038837: Add support to jarsigner for specifying timestamp hash algorithm
- S8038963: com/sun/jdi tests fail because cygwin's ps sometimes misses processes
- S8039921: SHA1WithDSA with key > 1024 bits not working
- S8044419: TEST_BUG: com/sun/jdi/JdbReadTwiceTest.sh fails when run under root
- S8048030: Expectations should be consistent
- S8059054: Better URL processing
- S8059661: Test SoftReference and OOM behavior
- S8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
- S8068761: [TEST_BUG] java/nio/channels/ServerSocketChannel/AdaptServerSocket.java failed with SocketTimeoutException
- S8068842: Better JAXP data handling
- S8072753: Nondeterministic wrong answer on arithmetic
- S8072932: Test fails with java.security.AccessControlException: access denied ("java.security.SecurityPermission" "getDomainCombiner")
- S8073735: [TEST_BUG] compiler/loopopts/CountedLoopProblem.java got OOME
- S8074068: Cleanup in src/share/classes/sun/security/x509/
- S8074146: [TEST_BUG] jdb has succeded to read an unreadable file
- S8075773: jps running as root fails after the fix of JDK-8050807
- S8076339: Better handling of remote object invocation
- S8076383: Better CORBA exception handling
- S8076387: Better CORBA value handling
- S8076392: Improve IIOPInputStream consistency
- S8076413: Better JRMP message handling
- S8076506: Increment minor version of HSx for 7u91 and initialize the build number
- S8078427: More supportive home environment
- S8078440: Safer managed types
- S8078822: 8068842 fix missed one new file PrimeNumberSequenceGenerator.java
- S8079323: Serialization compatibility for Templates: need to exclude Hashtable from serialization
- S8079410: Hotspot version to share the same update and build version from JDK
- S8079718: IIOP Input Stream Hooking
- S8080541: More direct property handling
- S8080688: Service for DGC services
- S8081297: SSL Problem with Tomcat
- S8081475: SystemTap does not work when JDK is compiled with GCC 5
- S8081760: Better group dynamics
- S8086092: More palette improvements
- S8086733: Improve namespace handling
- S8087118: Remove missing package from java.security files
- S8087120: [GCC5] java.lang.StackOverflowError on Zero JVM initialization on non x86 platforms.
- S8087350: Improve array conversions
- S8098547: (tz) Support tzdata2015e
- S8103671: More objective stream classes
- S8103675: Better Binary searches
- S8129952: Ensure thread consistency
- S8130078: Document better processing
- S8130193: Improve HTTP connections
- S8130253: ObjectStreamClass.getFields too restrictive
- S8130710: Better attributes processing
- S8130735: javax.swing.TimerQueue: timer fires late when another timer starts
- S8130864: Better server identity handling
- S8130891: (bf) More direct buffering
- S8131181: Increment minor version of HSx for 7u95 and initialize the build number
- S8131291: Perfect parameter patterning
- S8132042: Preserve layout presentation
- S8132051: Better byte behavior
- S8132082: Let OracleUcrypto accept RSAPrivateKey
- S8132210: Reinforce JMX collector internals
- S8132988: Better printing dialogues
- S8133321: (tz) Support tzdata2015f
- S8133962: More general limits
- S8134297: NPE in GSSNameElement nameType check
- S8134605: Partial rework of the fix for 8081297
- S8134650: Xsl transformation gives different results in 8u66
- S8134861: XSLT: Extension func call cause exception if namespace URI contains partial package name
- S8135043: ObjectStreamClass.getField(String) too restrictive
- S8135307: CompletionFailure thrown when calling FieldDoc.type, if the field's type is missing
- S8137060: JMX memory management improvements
- S8138593: Make DSA more fair
- S8138716: (tz) Support tzdata2015g
- S8139008: Better state table management
- S8139012: Better font substitutions
- S8139017: More stable image decoding
- S8139436: sun.security.mscapi.KeyStore might load incomplete data
- S8140244: Port fix of JDK-8075773 to MacOSX
- S8140244, PR3171: Port fix of JDK-8075773 to AIX
- S8140344: add support for 3 digit update release numbers
- S8140543: Arrange font actions
- S8141213: [Parfait]Potentially blocking function GetArrayLength called in JNI critical region at line 239 of jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c in function GET_ARRAYS
- S8141229: [Parfait] Null pointer dereference in cmsstrcasecmp of cmserr.c
- S8141287: Add MD5 to jdk.certpath.disabledAlgorithms - Take 2
- S8142882: rebinding of the receiver of a DirectMethodHandle may allow a protected method to be accessed
- S8142928: [TEST_BUG] sun/security/provider/certpath/ReverseBuilder/ReverseBuild.java 8u71 failure
- S8143002: [Parfait] JNI exception pending in fontpath.c:1300
- S8143132: L10n resource file translation update
- S8143167: Better buffering of XML strings
- S8143185: Cleanup for handling proxies
- S8143941: Update splashscreen displays
- S8144313: Test SessionTimeOutTests can be timeout
- S8144430: Improve JMX connections
- S8144773: Further reduce use of MD5
- S8144955: Wrong changes were pushed with 8143942
- S8145017: Add support for 3 digit hotspot minor version numbers
- S8145446: Perfect pipe placement
- S8145551: Test failed with Crash for Improved font lookups
- S8145982: JMXInterfaceBindingTest is failing intermittently
- S8146015: JMXInterfaceBindingTest is failing intermittently for IPv6 addresses
- S8146387: Test SSLSession/SessionCacheSizeTests socket accept timed out
- S8146477: [TEST_BUG] ClientJSSEServerJSSE.java failing again
- S8146494: Better ligature substitution
- S8146498: Better device table adjustments
- S8146669: Test SessionTimeOutTests fails intermittently
- S8146967: [TEST_BUG] javax/security/auth/SubjectDomainCombiner/Optimize.java should use 4-args ProtectionDomain constructor
- S8146993: Several javax/management/remote/mandatory regression tests fail after JDK-8138811
- S8147466: Add -fno-strict-overflow to IndicRearrangementProcessor{,2}.cpp
- S8147567: InterpreterRuntime::post_field_access not updated for boolean in JDK-8132051
- S8147771: Construction of static protection domains under Javax custom policy
- S8147857: [TEST] RMIConnector logs attribute names incorrectly
- S8148446: (tz) Support tzdata2016a
- S8148475: Missing SA Bytecode updates.
- S8148487: PPC64: Better byte behavior
- S8148872: Complete name checking
- S8149170: Better byte behavior for native arguments
- S8149367: PolicyQualifierInfo/index_Ctor JCk test fails with IOE: Invalid encoding for PolicyQualifierInfo
- S8149962: Better delineation of XML processing
- S8150012: Better byte behavior for reflection
- S8150752: Share Class Data
- S8150790: 8u75 L10n resource file translation update
- S8151841: Build needs additional flags to compile with GCC 6
- S8151876: (tz) Support tzdata2016d
- S8151925: Font reference improvements
- S8152335: Improve MethodHandle consistency
- S8152479: Coded byte streams
- S8153673: [BACKOUT] JDWP: Memory Leak: GlobalRefs never deleted when processing invokeMethod command
- S8154210: Zero: Better byte behaviour
- S8154413: AArch64: Better byte behaviour
- S8155981: Bolster bytecode verification
- S8155985: Persistent Parameter Processing
- S8157077: 8u101 L10n resource file updates
- S8158571: Additional method handle validation
- S8161262: Fix jdk build with gcc 4.1.2: -fno-strict-overflow not known.
- S8162344: The API changes made by CR 7064075 need to be reverted
ChangeLog:
2016-09-24 Andrew John Hughes <gnu.andrew@member.fsf.org>
Bump to icedtea-2.7.0pre07.
* Makefile.am,
(JDK_UPDATE_VERSION): Set to 111.
(BUILD_VERSION): Set to b01.
(CORBA_CHANGESET): Update to icedtea-2.7.0pre07.
(JAXP_CHANGESET): Likewise.
(JAXWS_CHANGESET): Likewise.
(JDK_CHANGESET): Likewise.
(LANGTOOLS_CHANGESET): Likewise.
(OPENJDK_CHANGESET): Likewise.
(CORBA_SHA256SUM): Likewise.
(JAXP_SHA256SUM): Likewise.
(JAXWS_SHA256SUM): Likewise.
(JDK_SHA256SUM): Likewise.
(LANGTOOLS_SHA256SUM): Likewise.
(OPENJDK_SHA256SUM): Likewise.
* configure.ac: Bump to 2.7.0pre07.
* hotspot.map.in: Update to icedtea-2.7.0pre07.
* patches/boot/ecj-diamond.patch:
Add numerous cases in JAXP classes, along with
com.sun.java.util.jar.pack, java.security.Provider,
java.security.Security, javax.crypto.Cipher,
javax.crypto.CryptoAllPermission,
javax.crypto.CryptoPermissions,
javax.crypto.CryptoPolicyParser,
javax.crypto.JceSecurity, javax.crypto.JceSecurityManager,
javax.management.remote.rmi.RMIJRMPServerImpl,
sun.reflect.annotation.AnnotationInvocationHandler,
sun.security.krb5.Krb5ServiceLocator,
sun.security.provider.certpath.CertStoreHelper,
sun.security.provider.certpath.ssl.SSLServerCertStore,
sun.security.provider.certpath.URICertStore and
sun.security.ssl.DHCrypt
* patches/boot/ecj-multicatch.patch:
Add sun.security.krb5.PrincipalName,
java.lang.invoke.MemberName,
sun.invoke.util.VerifyAccess,
javax.crypto.EncryptedPrivateKeyInfo,
javax.crypto.SealedObject,
sun.security.provider.certpath.URICertStore,
sun.security.ssl.RSAClientKeyExchange,
sun.security.pkcs11.P11KeyStore,
sun.security.pkcs11.P11RSAKeyFactory and
sun.security.tools.keytool.Main
* patches/boot/ecj-stringswitch.patch:
Add cases in
sun.security.krb5.Config,
sun.security.provider.certpath.X509CertPath,
sun.security.ssl.HandshakeMessage,
sun.security.ssl.X509KeyManagerImpl,
sun.security.pkcs11.Config,
sun.security.pkcs11.P11Key,
sun.security.sasl.digest.DigestMD5Base,
sun.security.sasl.digest.DigestMD5Server,
sun.security.sasl.ntlm.NTLMClient,
sun.security.sasl.ntlm.NTLMServer and
sun.security.sasl.util.AbstractSaslImpl.
* patches/boot/ecj-trywithresources.patch:
Add cases in
sun.security.provider.certpath.URICertStore,
sun.security.tools.KeyStoreUtil,
sun.security.tools.keytool.Main.
author | Andrew John Hughes <gnu_andrew@member.fsf.org> |
---|---|
date | Wed, 28 Sep 2016 07:32:57 +0100 |
parents | bffa3455fa17 |
children | df0f259a2fcc |
line wrap: on
line source
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java --- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java 2016-09-21 04:56:42.479974458 +0100 @@ -350,19 +350,16 @@ if (attrCommands != null) { Attribute.Layout lkey = Attribute.keyForLookup(ctype, name); String cmd = attrCommands.get(lkey); - if (cmd != null) { - switch (cmd) { - case "pass": - String message1 = "passing attribute bitwise in " + h; - throw new Attribute.FormatException(message1, ctype, name, cmd); - case "error": - String message2 = "attribute not allowed in " + h; - throw new Attribute.FormatException(message2, ctype, name, cmd); - case "strip": - skip(length, name + " attribute in " + h); - continue; - } - } + if ("pass".equals(cmd)) { + String message1 = "passing attribute bitwise in " + h; + throw new Attribute.FormatException(message1, ctype, name, cmd); + } else if ("error".equals(cmd)) { + String message2 = "attribute not allowed in " + h; + throw new Attribute.FormatException(message2, ctype, name, cmd); + } else if ("strip".equals(cmd)) { + skip(length, name + " attribute in " + h); + continue; + } } // Find canonical instance of the requested attribute. Attribute a = Attribute.lookup(Package.attrDefs, ctype, name); diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java --- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java 2016-09-21 04:55:45.672897910 +0100 @@ -73,16 +73,14 @@ { // Non-standard, undocumented "--unpack" switch enables unpack mode. String arg0 = av.isEmpty() ? "" : av.get(0); - switch (arg0) { - case "--pack": + if ("--pack".equals(arg0)) av.remove(0); - break; - case "--unpack": - av.remove(0); - doPack = false; - doUnpack = true; - break; - } + else if ("--unpack".equals(arg0)) + { + av.remove(0); + doPack = false; + doUnpack = true; + } } // Collect engine properties here: @@ -182,21 +180,16 @@ // Deal with remaining non-engine properties: for (String opt : avProps.keySet()) { String val = avProps.get(opt); - switch (opt) { - case "--repack": - doRepack = true; - break; - case "--no-gzip": - doZip = (val == null); - break; - case "--log-file=": - logFile = val; - break; - default: - throw new InternalError(MessageFormat.format( - RESOURCE.getString(DriverResource.BAD_OPTION), - opt, avProps.get(opt))); - } + if ("--repack".equals(opt)) + doRepack = true; + else if ("--no-gzip".equals(opt)) + doZip = (val == null); + else if ("--log-file=".equals(opt)) + logFile = val; + else + throw new InternalError(MessageFormat.format( + RESOURCE.getString(DriverResource.BAD_OPTION), + opt, avProps.get(opt))); } if (logFile != null && !logFile.equals("")) { diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java --- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java 2016-09-21 04:55:45.672897910 +0100 @@ -1107,30 +1107,25 @@ // what is one of { Debug, Compile, Constant, Exceptions, InnerClasses } if (verbose > 0) Utils.log.info("Stripping "+what.toLowerCase()+" data and attributes..."); - switch (what) { - case "Debug": - strip("SourceFile"); - strip("LineNumberTable"); - strip("LocalVariableTable"); - strip("LocalVariableTypeTable"); - break; - case "Compile": - // Keep the inner classes normally. - // Although they have no effect on execution, - // the Reflection API exposes them, and JCK checks them. - // NO: // strip("InnerClasses"); - strip("Deprecated"); - strip("Synthetic"); - break; - case "Exceptions": - // Keep the exceptions normally. - // Although they have no effect on execution, - // the Reflection API exposes them, and JCK checks them. - strip("Exceptions"); - break; - case "Constant": - stripConstantFields(); - break; + if ("Debug".equals(what)) { + strip("SourceFile"); + strip("LineNumberTable"); + strip("LocalVariableTable"); + strip("LocalVariableTypeTable"); + } else if ("Compile".equals(what)) { + // Keep the inner classes normally. + // Although they have no effect on execution, + // the Reflection API exposes them, and JCK checks them. + // NO: // strip("InnerClasses"); + strip("Deprecated"); + strip("Synthetic"); + } else if ("Exceptions".equals(what)) { + // Keep the exceptions normally. + // Although they have no effect on execution, + // the Reflection API exposes them, and JCK checks them. + strip("Exceptions"); + } else if ("Constant".equals(what)) { + stripConstantFields(); } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java openjdk-boot/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java --- openjdk-boot.orig/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java 2016-09-21 04:55:45.672897910 +0100 @@ -65,17 +65,23 @@ protected NTLM(String version) throws NTLMException { if (version == null) version = "LMv2/NTLMv2"; - switch (version) { - case "LM": v = NTLM; writeLM = true; writeNTLM = false; break; - case "NTLM": v = NTLM; writeLM = false; writeNTLM = true; break; - case "LM/NTLM": v = NTLM; writeLM = writeNTLM = true; break; - case "NTLM2": v = NTLM2; writeLM = writeNTLM = true; break; - case "LMv2": v = NTLMv2; writeLM = true; writeNTLM = false; break; - case "NTLMv2": v = NTLMv2; writeLM = false; writeNTLM = true; break; - case "LMv2/NTLMv2": v = NTLMv2; writeLM = writeNTLM = true; break; - default: throw new NTLMException(NTLMException.BAD_VERSION, - "Unknown version " + version); - } + if (version.equals("LM")) + { v = NTLM; writeLM = true; writeNTLM = false; } + else if (version.equals("NTLM")) + { v = NTLM; writeLM = false; writeNTLM = true; } + else if (version.equals("LM/NTLM")) + { v = NTLM; writeLM = writeNTLM = true; } + else if (version.equals("NTLM2")) + { v = NTLM2; writeLM = writeNTLM = true; } + else if (version.equals("LMv2")) + { v = NTLMv2; writeLM = true; writeNTLM = false; } + else if (version.equals("NTLMv2")) + { v = NTLMv2; writeLM = false; writeNTLM = true; } + else if (version.equals("LMv2/NTLMv2")) + { v = NTLMv2; writeLM = writeNTLM = true; } + else + throw new NTLMException(NTLMException.BAD_VERSION, + "Unknown version " + version); try { fac = SecretKeyFactory.getInstance ("DES"); cipher = Cipher.getInstance ("DES/ECB/NoPadding"); diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java --- openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java 2016-09-21 04:55:45.672897910 +0100 @@ -328,12 +328,11 @@ Object[] appendixResult) { try { if (defc == MethodHandle.class && refKind == REF_invokeVirtual) { - switch (name) { - case "invoke": - return Invokers.genericInvokerMethod(fixMethodType(callerClass, type), appendixResult); - case "invokeExact": - return Invokers.exactInvokerMethod(fixMethodType(callerClass, type), appendixResult); - } + if ("invoke".equals(name)) { + return Invokers.genericInvokerMethod(fixMethodType(callerClass, type), appendixResult); + } else if ("invokeExact".equals(name)) { + return Invokers.exactInvokerMethod(fixMethodType(callerClass, type), appendixResult); + } } } catch (Throwable ex) { if (ex instanceof LinkageError) @@ -403,124 +402,120 @@ // this method is also called by test/sun/reflect/CallerSensitiveFinder // to validate the hand-maintained list private static boolean isCallerSensitiveMethod(Class<?> defc, String method) { - switch (method) { - case "doPrivileged": - case "doPrivilegedWithCombiner": + if ("doPrivileged".equals(method) || + "doPrivilegedWithCombiner".equals(method)) { return defc == java.security.AccessController.class; - case "checkMemberAccess": - return defc == java.lang.SecurityManager.class; - case "getUnsafe": - return defc == sun.misc.Unsafe.class; - case "lookup": - return defc == java.lang.invoke.MethodHandles.class; - case "invoke": - return defc == java.lang.reflect.Method.class; - case "get": - case "getBoolean": - case "getByte": - case "getChar": - case "getShort": - case "getInt": - case "getLong": - case "getFloat": - case "getDouble": - case "set": - case "setBoolean": - case "setByte": - case "setChar": - case "setShort": - case "setInt": - case "setLong": - case "setFloat": - case "setDouble": - return defc == java.lang.reflect.Field.class; - case "newInstance": - if (defc == java.lang.reflect.Constructor.class) return true; - if (defc == java.lang.Class.class) return true; - break; - case "getFields": - return defc == java.lang.Class.class || - defc == javax.sql.rowset.serial.SerialJavaObject.class; - case "forName": - case "getClassLoader": - case "getClasses": - case "getMethods": - case "getConstructors": - case "getDeclaredClasses": - case "getDeclaredFields": - case "getDeclaredMethods": - case "getDeclaredConstructors": - case "getField": - case "getMethod": - case "getConstructor": - case "getDeclaredField": - case "getDeclaredMethod": - case "getDeclaredConstructor": - case "getDeclaringClass": - case "getEnclosingClass": - case "getEnclosingMethod": - case "getEnclosingConstructor": - return defc == java.lang.Class.class; - case "getConnection": - case "getDriver": - case "getDrivers": - case "deregisterDriver": - return defc == java.sql.DriverManager.class; - case "newUpdater": - if (defc == java.util.concurrent.atomic.AtomicIntegerFieldUpdater.class) return true; - if (defc == java.util.concurrent.atomic.AtomicLongFieldUpdater.class) return true; - if (defc == java.util.concurrent.atomic.AtomicReferenceFieldUpdater.class) return true; - break; - case "getContextClassLoader": - return defc == java.lang.Thread.class; - case "getPackage": - case "getPackages": - return defc == java.lang.Package.class; - case "getParent": - case "getSystemClassLoader": - return defc == java.lang.ClassLoader.class; - case "load": - case "loadLibrary": - if (defc == java.lang.Runtime.class) return true; - if (defc == java.lang.System.class) return true; - break; - case "getCallerClass": - if (defc == sun.reflect.Reflection.class) return true; - if (defc == java.lang.System.class) return true; - break; - case "getCallerClassLoader": - return defc == java.lang.ClassLoader.class; - case "registerAsParallelCapable": - return defc == java.lang.ClassLoader.class; - case "getInvocationHandler": - case "getProxyClass": - case "newProxyInstance": - return defc == java.lang.reflect.Proxy.class; - case "asInterfaceInstance": - return defc == java.lang.invoke.MethodHandleProxies.class; - case "getBundle": - case "clearCache": - return defc == java.util.ResourceBundle.class; - case "getType": - return defc == java.io.ObjectStreamField.class; - case "forClass": - return defc == java.io.ObjectStreamClass.class; - case "getLogger": - return defc == java.util.logging.Logger.class; - case "getAnonymousLogger": - return defc == java.util.logging.Logger.class; - } - return false; + } else if ("checkMemberAccess".equals(method)) { + return defc == java.lang.SecurityManager.class; + } else if ("getUnsafe".equals(method)) { + return defc == sun.misc.Unsafe.class; + } else if ("lookup".equals(method)) { + return defc == java.lang.invoke.MethodHandles.class; + } else if ("invoke".equals(method)) { + return defc == java.lang.reflect.Method.class; + } else if ("get".equals(method) || + "getBoolean".equals(method) || + "getByte".equals(method) || + "getChar".equals(method) || + "getShort".equals(method) || + "getInt".equals(method) || + "getLong".equals(method) || + "getFloat".equals(method) || + "getDouble".equals(method) || + "set".equals(method) || + "setBoolean".equals(method) || + "setByte".equals(method) || + "setChar".equals(method) || + "setShort".equals(method) || + "setInt".equals(method) || + "setLong".equals(method) || + "setFloat".equals(method) || + "setDouble".equals(method)) { + return defc == java.lang.reflect.Field.class; + } else if ("newInstance".equals(method)) { + if (defc == java.lang.reflect.Constructor.class) return true; + if (defc == java.lang.Class.class) return true; + } else if ("getFields".equals(method)) { + return defc == java.lang.Class.class || + defc == javax.sql.rowset.serial.SerialJavaObject.class; + } else if ("forName".equals(method) || + "getClassLoader".equals(method) || + "getClasses".equals(method) || + "getFields".equals(method) || + "getMethods".equals(method) || + "getConstructors".equals(method) || + "getDeclaredClasses".equals(method) || + "getDeclaredFields".equals(method) || + "getDeclaredMethods".equals(method) || + "getDeclaredConstructors".equals(method) || + "getField".equals(method) || + "getMethod".equals(method) || + "getConstructor".equals(method) || + "getDeclaredField".equals(method) || + "getDeclaredMethod".equals(method) || + "getDeclaredConstructor".equals(method) || + "getDeclaringClass".equals(method) || + "getEnclosingClass".equals(method) || + "getEnclosingMethod".equals(method) || + "getEnclosingConstructor".equals(method)) { + return defc == java.lang.Class.class; + } else if ("getConnection".equals(method) || + "getDriver".equals(method) || + "getDrivers".equals(method) || + "deregisterDriver".equals(method)) { + return defc == java.sql.DriverManager.class; + } else if ("newUpdater".equals(method)) { + if (defc == java.util.concurrent.atomic.AtomicIntegerFieldUpdater.class) return true; + if (defc == java.util.concurrent.atomic.AtomicLongFieldUpdater.class) return true; + if (defc == java.util.concurrent.atomic.AtomicReferenceFieldUpdater.class) return true; + } else if ("getContextClassLoader".equals(method)) { + return defc == java.lang.Thread.class; + } else if ("getPackage".equals(method) || + "getPackages".equals(method)) { + return defc == java.lang.Package.class; + } else if ("getParent".equals(method) || + "getSystemClassLoader".equals(method)) { + return defc == java.lang.ClassLoader.class; + } else if ("load".equals(method) || + "loadLibrary".equals(method)) { + if (defc == java.lang.Runtime.class) return true; + if (defc == java.lang.System.class) return true; + } else if ("getCallerClass".equals(method)) { + if (defc == sun.reflect.Reflection.class) return true; + if (defc == java.lang.System.class) return true; + } else if ("getCallerClassLoader".equals(method)) { + return defc == java.lang.ClassLoader.class; + } else if ("registerAsParallelCapable".equals(method)) { + return defc == java.lang.ClassLoader.class; + } else if ("getProxyClass".equals(method) || + "getInvocationHandler".equals(method) || + "newProxyInstance".equals(method)) { + return defc == java.lang.reflect.Proxy.class; + } else if ("asInterfaceInstance".equals(method)) { + return defc == java.lang.invoke.MethodHandleProxies.class; + } else if ("getBundle".equals(method) || + "clearCache".equals(method)) { + return defc == java.util.ResourceBundle.class; + } else if ("getType".equals(method)) { + return defc == java.io.ObjectStreamField.class; + } else if ("forClass".equals(method)) { + return defc == java.io.ObjectStreamClass.class; + } else if ("getLogger".equals(method)) { + return defc == java.util.logging.Logger.class; + } else if ("getAnonymousLogger".equals(method)) { + return defc == java.util.logging.Logger.class; + } + return false; } private static boolean canBeCalledVirtual(MemberName mem) { assert(mem.isInvocable()); Class<?> defc = mem.getDeclaringClass(); - switch (mem.getName()) { - case "checkMemberAccess": + String memName = mem.getName(); + if ("checkMemberAccess".equals(memName)) { return canBeCalledVirtual(mem, java.lang.SecurityManager.class); - case "getContextClassLoader": + } else if ("getContextClassLoader".equals(memName)) { return canBeCalledVirtual(mem, java.lang.Thread.class); } return false; diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java --- openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java 2016-09-21 04:55:45.672897910 +0100 @@ -269,14 +269,16 @@ private static boolean isObjectMethod(Method m) { - switch (m.getName()) { - case "toString": + String name = m.getName(); + if ("toString".equals(name)) { return (m.getReturnType() == String.class && m.getParameterTypes().length == 0); - case "hashCode": + } + if ("hashCode".equals(name)) { return (m.getReturnType() == int.class && m.getParameterTypes().length == 0); - case "equals": + } + if ("equals".equals(name)) { return (m.getReturnType() == boolean.class && m.getParameterTypes().length == 1 && m.getParameterTypes()[0] == Object.class); @@ -287,12 +289,14 @@ private static Object callObjectMethod(Object self, Method m, Object[] args) { assert(isObjectMethod(m)) : m; - switch (m.getName()) { - case "toString": + String name = m.getName(); + if ("toString".equals(name)) { return self.getClass().getName() + "@" + Integer.toHexString(self.hashCode()); - case "hashCode": + } + if ("hashCode".equals(name)) { return System.identityHashCode(self); - case "equals": + } + if ("equals".equals(name)) { return (self == args[0]); } return null; diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/launcher/LauncherHelper.java openjdk-boot/jdk/src/share/classes/sun/launcher/LauncherHelper.java --- openjdk-boot.orig/jdk/src/share/classes/sun/launcher/LauncherHelper.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/launcher/LauncherHelper.java 2016-09-21 04:55:45.672897910 +0100 @@ -119,24 +119,20 @@ String optStr = (opts.length > 1 && opts[1] != null) ? opts[1].trim() : "all"; - switch (optStr) { - case "vm": + if ("vm".equals(optStr)) + printVmSettings(ostream, initialHeapSize, maxHeapSize, + stackSize, isServer); + else if ("properties".equals(optStr)) + printProperties(ostream); + else if ("locale".equals(optStr)) + printLocale(ostream); + else + { printVmSettings(ostream, initialHeapSize, maxHeapSize, - stackSize, isServer); - break; - case "properties": + stackSize, isServer); printProperties(ostream); - break; - case "locale": printLocale(ostream); - break; - default: - printVmSettings(ostream, initialHeapSize, maxHeapSize, - stackSize, isServer); - printProperties(ostream); - printLocale(ostream); - break; - } + } } /* diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java openjdk-boot/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java --- openjdk-boot.orig/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java 2016-09-21 04:55:45.672897910 +0100 @@ -65,14 +65,12 @@ if (paramTypes.length != 0) throw new AssertionError("Too many parameters for an annotation method"); - switch(member) { - case "toString": + if ("toString".equals(member)) return toStringImpl(); - case "hashCode": + if ("hashCode".equals(member)) return hashCodeImpl(); - case "annotationType": + if ("annotationType".equals(member)) return type; - } // Handle annotation member accessors Object result = memberValues.get(member); diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/krb5/Config.java openjdk-boot/jdk/src/share/classes/sun/security/krb5/Config.java --- openjdk-boot.orig/jdk/src/share/classes/sun/security/krb5/Config.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/security/krb5/Config.java 2016-09-21 04:55:45.676897844 +0100 @@ -428,14 +428,13 @@ if (s == null) { return null; } - switch (s.toLowerCase(Locale.US)) { - case "yes": case "true": + String lCase = s.toLowerCase(Locale.US); + if ("yes".equals(lCase) || "true".equals(lCase)) { return Boolean.TRUE; - case "no": case "false": + } else if ("no".equals(lCase) || "false".equals(lCase)) { return Boolean.FALSE; - default: - return null; } + return null; } /** diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java openjdk-boot/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java --- openjdk-boot.orig/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java 2016-09-21 04:55:45.672897910 +0100 @@ -228,19 +228,23 @@ GE; // ">=" static Operator of(String s) { - switch (s) { - case "==": - return EQ; - case "!=": - return NE; - case "<": - return LT; - case "<=": - return LE; - case ">": - return GT; - case ">=": - return GE; + if ("==".equals(s)) { + return EQ; + } + if ("!=".equals(s)) { + return NE; + } + if ("<".equals(s)) { + return LT; + } + if ("<=".equals(s)) { + return LE; + } + if (">".equals(s)) { + return GT; + } + if (">=".equals(s)) { + return GE; } throw new IllegalArgumentException( diff -Nru openjdk-boot.orig/jdk/src/solaris/classes/sun/security/smartcardio/PlatformPCSC.java openjdk-boot/jdk/src/solaris/classes/sun/security/smartcardio/PlatformPCSC.java --- openjdk-boot.orig/jdk/src/solaris/classes/sun/security/smartcardio/PlatformPCSC.java 2016-09-20 03:39:19.000000000 +0100 +++ openjdk-boot/jdk/src/solaris/classes/sun/security/smartcardio/PlatformPCSC.java 2016-09-21 04:55:45.676897844 +0100 @@ -101,19 +101,17 @@ k = lib.indexOf("$ARCH"); if (k != -1) { String arch = System.getProperty("os.arch"); - switch (arch) { - case "amd64": + if ("amd64".equals(arch)) { arch = "x86_64"; - break; - case "ppc": + } + if ("ppc".equals(arch)) { arch = "powerpc"; - break; - case "ppc64": + } + if ("ppc64".equals(arch)) { arch = "powerpc64"; - break; - case "ppc64le": + } + if ("ppc64le".equals(arch)) { arch = "powerpc64le"; - break; } lib = replace(k, lib, "$ARCH", arch); } diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java openjdk-boot/jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java --- openjdk-boot.orig/jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java 2016-09-22 01:48:46.637378277 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java 2016-09-22 01:50:21.179836041 +0100 @@ -153,15 +153,12 @@ throws CertificateException { super("X.509"); - switch (encoding) { - case PKIPATH_ENCODING: - certs = parsePKIPATH(is); - break; - case PKCS7_ENCODING: - certs = parsePKCS7(is); - break; - default: - throw new CertificateException("unsupported encoding"); + if (PKIPATH_ENCODING.equals(encoding)) { + certs = parsePKIPATH(is); + } else if (PKCS7_ENCODING.equals(encoding)) { + certs = parsePKCS7(is); + } else { + throw new CertificateException("unsupported encoding"); } } @@ -344,13 +341,12 @@ */ public byte[] getEncoded(String encoding) throws CertificateEncodingException { - switch (encoding) { - case PKIPATH_ENCODING: - return encodePKIPATH(); - case PKCS7_ENCODING: - return encodePKCS7(); - default: - throw new CertificateEncodingException("unsupported encoding"); + if (PKIPATH_ENCODING.equals(encoding)) { + return encodePKIPATH(); + } else if (PKCS7_ENCODING.equals(encoding)) { + return encodePKCS7(); + } else { + throw new CertificateEncodingException("unsupported encoding"); } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java openjdk-boot/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java --- openjdk-boot.orig/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java 2016-09-23 17:47:51.277522108 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java 2016-09-23 17:52:27.357088372 +0100 @@ -823,16 +823,13 @@ sig = JsseJce.getSignature( preferableSignatureAlgorithm.getAlgorithmName()); } else { - switch (algorithm) { - case "DSA": - sig = JsseJce.getSignature(JsseJce.SIGNATURE_DSA); - break; - case "RSA": - sig = RSASignature.getInstance(); - break; - default: - throw new SSLKeyException("neither an RSA or a DSA key"); - } + if ("DSA".equals(algorithm)) { + sig = JsseJce.getSignature(JsseJce.SIGNATURE_DSA); + } else if ("RSA".equals(algorithm)) { + sig = RSASignature.getInstance(); + } else { + throw new SSLKeyException("neither an RSA or a DSA key"); + } } sig.initVerify(publicKey); @@ -1112,14 +1109,13 @@ private static Signature getSignature(String keyAlgorithm) throws NoSuchAlgorithmException { - switch (keyAlgorithm) { - case "EC": - return JsseJce.getSignature(JsseJce.SIGNATURE_ECDSA); - case "RSA": - return RSASignature.getInstance(); - default: - throw new NoSuchAlgorithmException("neither an RSA or a EC key"); - } + if ("EC".equals(keyAlgorithm)) { + return JsseJce.getSignature(JsseJce.SIGNATURE_ECDSA); + } else if ("RSA".equals(keyAlgorithm)) { + return RSASignature.getInstance(); + } else { + throw new NoSuchAlgorithmException("neither an RSA or a EC key"); + } } private void updateSignature(Signature sig, byte clntNonce[], @@ -1627,17 +1623,16 @@ */ private static Signature getSignature(ProtocolVersion protocolVersion, String algorithm) throws GeneralSecurityException { - switch (algorithm) { - case "RSA": - return RSASignature.getInternalInstance(); - case "DSA": - return JsseJce.getSignature(JsseJce.SIGNATURE_RAWDSA); - case "EC": - return JsseJce.getSignature(JsseJce.SIGNATURE_RAWECDSA); - default: - throw new SignatureException("Unrecognized algorithm: " - + algorithm); - } + if ("RSA".equals(algorithm)) { + return RSASignature.getInternalInstance(); + } else if ("DSA".equals(algorithm)) { + return JsseJce.getSignature(JsseJce.SIGNATURE_RAWDSA); + } else if ("EC".equals(algorithm)) { + return JsseJce.getSignature(JsseJce.SIGNATURE_RAWECDSA); + } else { + throw new SignatureException("Unrecognized algorithm: " + + algorithm); + } } /* diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java openjdk-boot/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java --- openjdk-boot.orig/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java 2016-09-23 17:47:51.305521658 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java 2016-09-23 17:52:23.493150294 +0100 @@ -525,43 +525,38 @@ if (ku != null) { String algorithm = cert.getPublicKey().getAlgorithm(); boolean kuSignature = getBit(ku, 0); - switch (algorithm) { - case "RSA": - // require either signature bit - // or if server also allow key encipherment bit - if (kuSignature == false) { - if ((this == CLIENT) || (getBit(ku, 2) == false)) { - return CheckResult.EXTENSION_MISMATCH; - } - } - break; - case "DSA": - // require signature bit - if (kuSignature == false) { - return CheckResult.EXTENSION_MISMATCH; - } - break; - case "DH": - // require keyagreement bit - if (getBit(ku, 4) == false) { - return CheckResult.EXTENSION_MISMATCH; - } - break; - case "EC": - // require signature bit - if (kuSignature == false) { - return CheckResult.EXTENSION_MISMATCH; - } - // For servers, also require key agreement. - // This is not totally accurate as the keyAgreement bit - // is only necessary for static ECDH key exchange and - // not ephemeral ECDH. We leave it in for now until - // there are signs that this check causes problems - // for real world EC certificates. - if ((this == SERVER) && (getBit(ku, 4) == false)) { + if ("RSA".equals(algorithm)) { + // require either signature bit + // or if server also allow key encipherment bit + if (kuSignature == false) { + if ((this == CLIENT) || (getBit(ku, 2) == false)) { return CheckResult.EXTENSION_MISMATCH; } - break; + } + } else if ("DSA".equals(algorithm)) { + // require signature bit + if (kuSignature == false) { + return CheckResult.EXTENSION_MISMATCH; + } + } else if ("DH".equals(algorithm)) { + // require keyagreement bit + if (getBit(ku, 4) == false) { + return CheckResult.EXTENSION_MISMATCH; + } + } else if ("EC".equals(algorithm)) { + // require signature bit + if (kuSignature == false) { + return CheckResult.EXTENSION_MISMATCH; + } + // For servers, also require key agreement. + // This is not totally accurate as the keyAgreement bit + // is only necessary for static ECDH key exchange and + // not ephemeral ECDH. We leave it in for now until + // there are signs that this check causes problems + // for real world EC certificates. + if ((this == SERVER) && (getBit(ku, 4) == false)) { + return CheckResult.EXTENSION_MISMATCH; + } } } } catch (CertificateException e) { diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/pkcs11/Config.java openjdk-boot/jdk/src/share/classes/sun/security/pkcs11/Config.java --- openjdk-boot.orig/jdk/src/share/classes/sun/security/pkcs11/Config.java 2016-09-23 17:57:17.100442422 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/security/pkcs11/Config.java 2016-09-23 18:01:58.299928821 +0100 @@ -574,13 +574,12 @@ private boolean parseBoolean() throws IOException { String val = parseWord(); - switch (val) { - case "true": - return true; - case "false": - return false; - default: - throw excToken("Expected boolean value, read:"); + if ("true".equals(val)) { + return true; + } else if ("false".equals(val)) { + return false; + } else { + throw excToken("Expected boolean value, read:"); } } @@ -917,15 +916,14 @@ private String parseOperation() throws IOException { String op = parseWord(); - switch (op) { - case "*": - return TemplateManager.O_ANY; - case "generate": - return TemplateManager.O_GENERATE; - case "import": - return TemplateManager.O_IMPORT; - default: - throw excLine("Unknown operation " + op); + if ("*".equals(op)) { + return TemplateManager.O_ANY; + } else if ("generate".equals(op)) { + return TemplateManager.O_GENERATE; + } else if ("import".equals(op)) { + return TemplateManager.O_IMPORT; + } else { + throw excLine("Unknown operation " + op); } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/pkcs11/P11Key.java openjdk-boot/jdk/src/share/classes/sun/security/pkcs11/P11Key.java --- openjdk-boot.orig/jdk/src/share/classes/sun/security/pkcs11/P11Key.java 2016-09-23 17:57:17.108442294 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/security/pkcs11/P11Key.java 2016-09-23 18:01:58.287929014 +0100 @@ -304,22 +304,21 @@ // we assume that all components of public keys are always accessible static PublicKey publicKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { - switch (algorithm) { - case "RSA": - return new P11RSAPublicKey - (session, keyID, algorithm, keyLength, attributes); - case "DSA": - return new P11DSAPublicKey - (session, keyID, algorithm, keyLength, attributes); - case "DH": - return new P11DHPublicKey - (session, keyID, algorithm, keyLength, attributes); - case "EC": - return new P11ECPublicKey - (session, keyID, algorithm, keyLength, attributes); - default: - throw new ProviderException - ("Unknown public key algorithm " + algorithm); + if ("RSA".equals(algorithm)) { + return new P11RSAPublicKey + (session, keyID, algorithm, keyLength, attributes); + } else if ("DSA".equals(algorithm)) { + return new P11DSAPublicKey + (session, keyID, algorithm, keyLength, attributes); + } else if ("DH".equals(algorithm)) { + return new P11DHPublicKey + (session, keyID, algorithm, keyLength, attributes); + } else if ("EC".equals(algorithm)) { + return new P11ECPublicKey + (session, keyID, algorithm, keyLength, attributes); + } else { + throw new ProviderException + ("Unknown public key algorithm " + algorithm); } } @@ -334,43 +333,42 @@ return new P11PrivateKey (session, keyID, algorithm, keyLength, attributes); } else { - switch (algorithm) { - case "RSA": - // XXX better test for RSA CRT keys (single getAttributes() call) - // we need to determine whether this is a CRT key - // see if we can obtain the public exponent - // this should also be readable for sensitive/extractable keys - CK_ATTRIBUTE[] attrs2 = new CK_ATTRIBUTE[] { - new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT), - }; - boolean crtKey; - try { - session.token.p11.C_GetAttributeValue - (session.id(), keyID, attrs2); - crtKey = (attrs2[0].pValue instanceof byte[]); - } catch (PKCS11Exception e) { - // ignore, assume not available - crtKey = false; - } - if (crtKey) { - return new P11RSAPrivateKey - (session, keyID, algorithm, keyLength, attributes); - } else { - return new P11RSAPrivateNonCRTKey - (session, keyID, algorithm, keyLength, attributes); - } - case "DSA": - return new P11DSAPrivateKey - (session, keyID, algorithm, keyLength, attributes); - case "DH": - return new P11DHPrivateKey - (session, keyID, algorithm, keyLength, attributes); - case "EC": - return new P11ECPrivateKey - (session, keyID, algorithm, keyLength, attributes); - default: - throw new ProviderException - ("Unknown private key algorithm " + algorithm); + if ("RSA".equals(algorithm)) { + // XXX better test for RSA CRT keys (single getAttributes() call) + // we need to determine whether this is a CRT key + // see if we can obtain the public exponent + // this should also be readable for sensitive/extractable keys + CK_ATTRIBUTE[] attrs2 = new CK_ATTRIBUTE[] { + new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT), + }; + boolean crtKey; + try { + session.token.p11.C_GetAttributeValue + (session.id(), keyID, attrs2); + crtKey = (attrs2[0].pValue instanceof byte[]); + } catch (PKCS11Exception e) { + // ignore, assume not available + crtKey = false; + } + if (crtKey) { + return new P11RSAPrivateKey + (session, keyID, algorithm, keyLength, attributes); + } else { + return new P11RSAPrivateNonCRTKey + (session, keyID, algorithm, keyLength, attributes); + } + } else if ("DSA".equals(algorithm)) { + return new P11DSAPrivateKey + (session, keyID, algorithm, keyLength, attributes); + } else if ("DH".equals(algorithm)) { + return new P11DHPrivateKey + (session, keyID, algorithm, keyLength, attributes); + } else if ("EC".equals(algorithm)) { + return new P11ECPrivateKey + (session, keyID, algorithm, keyLength, attributes); + } else { + throw new ProviderException + ("Unknown private key algorithm " + algorithm); } } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java --- openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java 2016-09-24 00:05:03.122266846 +0100 +++ openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java 2016-09-24 00:11:08.200316405 +0100 @@ -1579,45 +1579,42 @@ KeySpec spec = null; SecretKeyFactory desFactory = SecretKeyFactory.getInstance(desStrength); - switch (desStrength) { - case "des": - spec = new DESKeySpec(subkey1, 0); - if (logger.isLoggable(Level.FINEST)) { - traceOutput(DP_CLASS_NAME, "makeDesKeys", - "DIGEST42:DES key input: ", input); - traceOutput(DP_CLASS_NAME, "makeDesKeys", - "DIGEST43:DES key parity-adjusted: ", subkey1); - traceOutput(DP_CLASS_NAME, "makeDesKeys", - "DIGEST44:DES key material: ", ((DESKeySpec)spec).getKey()); - logger.log(Level.FINEST, "DIGEST45: is parity-adjusted? {0}", - Boolean.valueOf(DESKeySpec.isParityAdjusted(subkey1, 0))); - } - break; - case "desede": - // Generate second subkey using second 7 bytes - byte[] subkey2 = addDesParity(input, 7, 7); - // Construct 24-byte encryption-decryption-encryption sequence - byte[] ede = new byte[subkey1.length*2+subkey2.length]; - System.arraycopy(subkey1, 0, ede, 0, subkey1.length); - System.arraycopy(subkey2, 0, ede, subkey1.length, subkey2.length); - System.arraycopy(subkey1, 0, ede, subkey1.length+subkey2.length, - subkey1.length); - spec = new DESedeKeySpec(ede, 0); - if (logger.isLoggable(Level.FINEST)) { - traceOutput(DP_CLASS_NAME, "makeDesKeys", - "DIGEST46:3DES key input: ", input); - traceOutput(DP_CLASS_NAME, "makeDesKeys", - "DIGEST47:3DES key ede: ", ede); - traceOutput(DP_CLASS_NAME, "makeDesKeys", - "DIGEST48:3DES key material: ", - ((DESedeKeySpec)spec).getKey()); - logger.log(Level.FINEST, "DIGEST49: is parity-adjusted? ", - Boolean.valueOf(DESedeKeySpec.isParityAdjusted(ede, 0))); - } - break; - default: - throw new IllegalArgumentException("Invalid DES strength:" + - desStrength); + if ("des".equals(desStrength)) { + spec = new DESKeySpec(subkey1, 0); + if (logger.isLoggable(Level.FINEST)) { + traceOutput(DP_CLASS_NAME, "makeDesKeys", + "DIGEST42:DES key input: ", input); + traceOutput(DP_CLASS_NAME, "makeDesKeys", + "DIGEST43:DES key parity-adjusted: ", subkey1); + traceOutput(DP_CLASS_NAME, "makeDesKeys", + "DIGEST44:DES key material: ", ((DESKeySpec)spec).getKey()); + logger.log(Level.FINEST, "DIGEST45: is parity-adjusted? {0}", + Boolean.valueOf(DESKeySpec.isParityAdjusted(subkey1, 0))); + } + } else if ("desede".equals(desStrength)) { + // Generate second subkey using second 7 bytes + byte[] subkey2 = addDesParity(input, 7, 7); + // Construct 24-byte encryption-decryption-encryption sequence + byte[] ede = new byte[subkey1.length*2+subkey2.length]; + System.arraycopy(subkey1, 0, ede, 0, subkey1.length); + System.arraycopy(subkey2, 0, ede, subkey1.length, subkey2.length); + System.arraycopy(subkey1, 0, ede, subkey1.length+subkey2.length, + subkey1.length); + spec = new DESedeKeySpec(ede, 0); + if (logger.isLoggable(Level.FINEST)) { + traceOutput(DP_CLASS_NAME, "makeDesKeys", + "DIGEST46:3DES key input: ", input); + traceOutput(DP_CLASS_NAME, "makeDesKeys", + "DIGEST47:3DES key ede: ", ede); + traceOutput(DP_CLASS_NAME, "makeDesKeys", + "DIGEST48:3DES key material: ", + ((DESedeKeySpec)spec).getKey()); + logger.log(Level.FINEST, "DIGEST49: is parity-adjusted? ", + Boolean.valueOf(DESedeKeySpec.isParityAdjusted(ede, 0))); + } + } else { + throw new IllegalArgumentException("Invalid DES strength:" + + desStrength); } return desFactory.generateSecret(spec); } diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java --- openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java 2016-09-24 00:05:03.130266715 +0100 +++ openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java 2016-09-24 00:11:08.172316862 +0100 @@ -461,23 +461,19 @@ // Check that QOP is one sent by server byte cQop; - switch (negotiatedQop) { - case "auth": - cQop = NO_PROTECTION; - break; - case "auth-int": - cQop = INTEGRITY_ONLY_PROTECTION; - integrity = true; - rawSendSize = sendMaxBufSize - 16; - break; - case "auth-conf": - cQop = PRIVACY_PROTECTION; - integrity = privacy = true; - rawSendSize = sendMaxBufSize - 26; - break; - default: - throw new SaslException("DIGEST-MD5: digest response format " + - "violation. Invalid QOP: " + negotiatedQop); + if ("auth".equals(negotiatedQop)) { + cQop = NO_PROTECTION; + } else if ("auth-int".equals(negotiatedQop)) { + cQop = INTEGRITY_ONLY_PROTECTION; + integrity = true; + rawSendSize = sendMaxBufSize - 16; + } else if ("auth-conf".equals(negotiatedQop)) { + cQop = PRIVACY_PROTECTION; + integrity = privacy = true; + rawSendSize = sendMaxBufSize - 26; + } else { + throw new SaslException("DIGEST-MD5: digest response format " + + "violation. Invalid QOP: " + negotiatedQop); } if ((cQop&allQop) == 0) { throw new SaslException("DIGEST-MD5: server does not support " + diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java --- openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java 2016-09-24 00:05:03.142266519 +0100 +++ openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java 2016-09-24 00:11:08.164316992 +0100 @@ -205,13 +205,12 @@ if (!isComplete()) { throw new IllegalStateException("authentication not complete"); } - switch (propName) { - case Sasl.QOP: - return "auth"; - case NTLM_DOMAIN: - return client.getDomain(); - default: - return null; + if (Sasl.QOP.equals(propName)) { + return "auth"; + } else if (NTLM_DOMAIN.equals(propName)) { + return client.getDomain(); + } else { + return null; } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java --- openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java 2016-09-24 00:05:03.154266324 +0100 +++ openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java 2016-09-24 00:11:08.156317122 +0100 @@ -219,13 +219,12 @@ if (!isComplete()) { throw new IllegalStateException("authentication not complete"); } - switch (propName) { - case Sasl.QOP: - return "auth"; - case NTLM_HOSTNAME: - return hostname; - default: - return null; + if (Sasl.QOP.equals(propName)) { + return "auth"; + } else if (NTLM_HOSTNAME.equals(propName)) { + return hostname; + } else { + return null; } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java --- openjdk-boot.orig/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java 2016-09-24 00:05:03.166266129 +0100 +++ openjdk-boot/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java 2016-09-24 00:11:08.152317188 +0100 @@ -155,23 +155,22 @@ if (!completed) { throw new IllegalStateException("SASL authentication not completed"); } - switch (propName) { - case Sasl.QOP: - if (privacy) { - return "auth-conf"; - } else if (integrity) { - return "auth-int"; - } else { - return "auth"; - } - case Sasl.MAX_BUFFER: - return Integer.toString(recvMaxBufSize); - case Sasl.RAW_SEND_SIZE: - return Integer.toString(rawSendSize); - case MAX_SEND_BUF: - return Integer.toString(sendMaxBufSize); - default: - return null; + if (Sasl.QOP.equals(propName)) { + if (privacy) { + return "auth-conf"; + } else if (integrity) { + return "auth-int"; + } else { + return "auth"; + } + } else if (Sasl.MAX_BUFFER.equals(propName)) { + return Integer.toString(recvMaxBufSize); + } else if (Sasl.RAW_SEND_SIZE.equals(propName)) { + return Integer.toString(rawSendSize); + } else if (MAX_SEND_BUF.equals(propName)) { + return Integer.toString(sendMaxBufSize); + } else { + return null; } }