Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6765046

CertPathValidatorException(Throwable).getMessage() always returns null since b37

XMLWordPrintable

    • b41
    • generic
    • generic

      Please see the following code:
      --------------------------------------------------------
      import java.security.cert.CertPathValidatorException;

      public class CPVTest {
          public static void main(String[] args) {
              Throwable[] causes = {
               new Throwable(),
               new Throwable("message"),
      new Throwable("message", new Throwable()) };

              for (Throwable cause: causes) {
                  CertPathValidatorException cpve =
                 new CertPathValidatorException(cause);
              
                  // from CertPathValidatorException(Throwable cause) spec:
                  // The detail message is set to (cause==null ? null : cause.toString() )
                  // (which typically contains the class and detail message of cause).
                  String message = (cause == null ? null : cause.toString());
              
                  System.out.println("expected message:" + message);
                  System.out.println("getMessage():" + cpve.getMessage());
              }
          }
      }
      --------------------------------------------------------

      Since b37 it's output is:
      --------------------------------------------------------
      expected message:java.lang.Throwable
      getMessage():null
      expected message:java.lang.Throwable: message
      getMessage():null
      expected message:java.lang.Throwable: message
      getMessage():null
      --------------------------------------------------------

            mullan Sean Mullan
            dmiltsov Dmitry Miltsov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: