RFR: 8051959: Add decorator options for java.security.debug output [v2]
Sean Coffey
coffeys at openjdk.org
Thu Mar 14 17:15:40 UTC 2024
On Wed, 13 Mar 2024 19:30:40 GMT, Sean Mullan <mullan at openjdk.org> wrote:
>> Sean Coffey has updated the pull request incrementally with one additional commit since the last revision:
>>
>> use default hex output
>
> src/java.base/share/classes/sun/security/util/Debug.java line 75:
>
>> 73: if (args.equals("help")) {
>> 74: Help();
>> 75: } else if (args.contains("all")) {
>
> Suggest adding a comment explaining why you need to treat `all` specially here.
good point - will update in next commit
> src/java.base/share/classes/sun/security/util/Debug.java line 126:
>
>> 124: System.err.println("+thread can be appended to any of above options to print");
>> 125: System.err.println(" thread information for that debug option");
>> 126: System.err.println();
>
> Would it be more reasonable to place these lines after line 113 ("x509") which are the main options?
yes - can do.
> src/java.base/share/classes/sun/security/util/Debug.java line 181:
>
>> 179: d.printDateTime = getConfigInfo(option, "+timestamp");
>> 180: if (d.printDateTime && !dateTimeFormatInitialized) {
>> 181: // trigger loading of Locale service impl now to avoid
>
> You may want to try the test case added in JDK-8280890 with debugging enabled to make sure you don't get a similar recursion issue.
interesting - I did add `-Djava,security.debug=all ` to the internals of that test and see issues.
However - they're issues that exist even without my patch. I need to take a closer look. `sun.util.locale.provider.LocaleServiceProviderPool` doesn't like to be invoked too early. That's a concern - maybe it should be able to handle such scenarios and return a simple/default Locale provider.
Caused by: java.lang.IllegalStateException: getSystemClassLoader cannot be called during the system class loader instantiation
at java.lang.ClassLoader.getSystemClassLoader([java.base at 23-ea](mailto:java.base at 23-ea)/ClassLoader.java:1952)
at java.lang.ClassLoader.getSystemResources([java.base at 23-ea](mailto:java.base at 23-ea)/ClassLoader.java:1723)
at java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass([java.base at 23-ea](mailto:java.base at 23-ea)/ServiceLoader.java:1189)
at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService([java.base at 23-ea](mailto:java.base at 23-ea)/ServiceLoader.java:1224)
at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext([java.base at 23-ea](mailto:java.base at 23-ea)/ServiceLoader.java:1269)
at java.util.ServiceLoader$2.hasNext([java.base at 23-ea](mailto:java.base at 23-ea)/ServiceLoader.java:1305)
at java.util.ServiceLoader$3.hasNext([java.base at 23-ea](mailto:java.base at 23-ea)/ServiceLoader.java:1387)
at sun.util.cldr.CLDRLocaleProviderAdapter.lambda$new$0([java.base at 23-ea](mailto:java.base at 23-ea)/CLDRLocaleProviderAdapter.java:84)
at java.security.AccessController.doPrivileged([java.base at 23-ea](mailto:java.base at 23-ea)/AccessController.java:571)
at sun.util.cldr.CLDRLocaleProviderAdapter.<init>([java.base at 23-ea](mailto:java.base at 23-ea)/CLDRLocaleProviderAdapter.java:83)
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance([java.base at 23-ea](mailto:java.base at 23-ea)/DirectConstructorHandleAccessor.java:62)
at java.lang.reflect.Constructor.newInstanceWithCaller([java.base at 23-ea](mailto:java.base at 23-ea)/Constructor.java:502)
at java.lang.reflect.Constructor.newInstance([java.base at 23-ea](mailto:java.base at 23-ea)/Constructor.java:486)
at sun.util.locale.provider.LocaleProviderAdapter.forType([java.base at 23-ea](mailto:java.base at 23-ea)/LocaleProviderAdapter.java:182)
at sun.util.locale.provider.LocaleServiceProviderPool.findProviders([java.base at 23-ea](mailto:java.base at 23-ea)/LocaleServiceProviderPool.java:311)
at sun.util.locale.provider.LocaleServiceProviderPool.getLocalizedObjectImpl([java.base at 23-ea](mailto:java.base at 23-ea)/LocaleServiceProviderPool.java:283)
at sun.util.locale.provider.LocaleServiceProviderPool.getLocalizedObject([java.base at 23-ea](mailto:java.base at 23-ea)/LocaleServiceProviderPool.java:245)
at sun.util.locale.provider.TimeZoneNameUtility.retrieveDisplayNamesImpl([java.base at 23-ea](mailto:java.base at 23-ea)/TimeZoneNameUtility.java:197)
at sun.util.locale.provider.TimeZoneNameUtility.retrieveDisplayName([java.base at 23-ea](mailto:java.base at 23-ea)/TimeZoneNameUtility.java:150)
at java.util.TimeZone.getDisplayName([java.base at 23-ea](mailto:java.base at 23-ea)/TimeZone.java:430)
at java.util.Date.toString([java.base at 23-ea](mailto:java.base at 23-ea)/Date.java:1045)
at java.lang.String.valueOf([java.base at 23-ea](mailto:java.base at 23-ea)/String.java:4509)
at java.lang.StringBuilder.append([java.base at 23-ea](mailto:java.base at 23-ea)/StringBuilder.java:173)
at sun.security.x509.CertificateValidity.toString([java.base at 23-ea](mailto:java.base at 23-ea)/CertificateValidity.java:118)
at java.lang.String.valueOf([java.base at 23-ea](mailto:java.base at 23-ea)/String.java:4509)
at java.lang.StringBuilder.append([java.base at 23-ea](mailto:java.base at 23-ea)/StringBuilder.java:173)
at sun.security.x509.X509CertInfo.toString([java.base at 23-ea](mailto:java.base at 23-ea)/X509CertInfo.java:221)
at java.lang.String.valueOf([java.base at 23-ea](mailto:java.base at 23-ea)/String.java:4509)
at java.lang.StringBuilder.append([java.base at 23-ea](mailto:java.base at 23-ea)/StringBuilder.java:173)
at sun.security.x509.X509CertImpl.toString([java.base at 23-ea](mailto:java.base at 23-ea)/X509CertImpl.java:560)
at java.lang.String.valueOf([java.base at 23-ea](mailto:java.base at 23-ea)/String.java:4509)
at java.lang.StringBuilder.append([java.base at 23-ea](mailto:java.base at 23-ea)/StringBuilder.java:173)
at sun.security.util.SignatureFileVerifier.getSigners([java.base at 23-ea](mailto:java.base at 23-ea)/SignatureFileVerifier.java:742)
at sun.security.util.SignatureFileVerifier.processImpl([java.base at 23-ea](mailto:java.base at 23-ea)/SignatureFileVerifier.java:312)
at sun.security.util.SignatureFileVerifier.process([java.base at 23-ea](mailto:java.base at 23-ea)/SignatureFileVerifier.java:281)
at java.util.jar.JarVerifier.processEntry([java.base at 23-ea](mailto:java.base at 23-ea)/JarVerifier.java:320)
at java.util.jar.JarVerifier.update([java.base at 23-ea](mailto:java.base at 23-ea)/JarVerifier.java:232)
at java.util.jar.JarFile.initializeVerifier([java.base at 23-ea](mailto:java.base at 23-ea)/JarFile.java:760)
at java.util.jar.JarFile.getInputStream([java.base at 23-ea](mailto:java.base at 23-ea)/JarFile.java:858)
at jdk.internal.loader.URLClassPath$JarLoader$2.getInputStream([java.base at 23-ea](mailto:java.base at 23-ea)/URLClassPath.java:837)
at jdk.internal.loader.Resource.cachedInputStream([java.base at 23-ea](mailto:java.base at 23-ea)/Resource.java:77)
at jdk.internal.loader.Resource.getByteBuffer([java.base at 23-ea](mailto:java.base at 23-ea)/Resource.java:163)
at jdk.internal.loader.BuiltinClassLoader.defineClass([java.base at 23-ea](mailto:java.base at 23-ea)/BuiltinClassLoader.java:853)
at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull([java.base at 23-ea](mailto:java.base at 23-ea)/BuiltinClassLoader.java:760)
at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull([java.base at 23-ea](mailto:java.base at 23-ea)/BuiltinClassLoader.java:681)
at jdk.internal.loader.BuiltinClassLoader.loadClass([java.base at 23-ea](mailto:java.base at 23-ea)/BuiltinClassLoader.java:639)
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass([java.base at 23-ea](mailto:java.base at 23-ea)/ClassLoaders.java:188)
at java.lang.ClassLoader.loadClass([java.base at 23-ea](mailto:java.base at 23-ea)/ClassLoader.java:528)
at java.lang.Class.forName0([java.base at 23-ea](mailto:java.base at 23-ea)/Native Method)
at java.lang.Class.forName([java.base at 23-ea](mailto:java.base at 23-ea)/Class.java:578)
at java.lang.Class.forName([java.base at 23-ea](mailto:java.base at 23-ea)/Class.java:557)
at java.lang.ClassLoader.initSystemClassLoader([java.base at 23-ea](mailto:java.base at 23-ea)/ClassLoader.java:1997)
at java.lang.System.initPhase3([java.base at 23-ea](mailto:java.base at 23-ea)/System.java:2338)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18084#discussion_r1525239333
PR Review Comment: https://git.openjdk.org/jdk/pull/18084#discussion_r1525239399
PR Review Comment: https://git.openjdk.org/jdk/pull/18084#discussion_r1525239458
More information about the security-dev
mailing list