pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1854932 - /pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
Date Wed, 06 Mar 2019 17:07:00 GMT
Author: tilman
Date: Wed Mar  6 17:07:00 2019
New Revision: 1854932

URL: http://svn.apache.org/viewvc?rev=1854932&view=rev
Log:
PDFBOX-3017: replace method that is deprecated in later jdk versions

Modified:
    pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java

Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java?rev=1854932&r1=1854931&r2=1854932&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
(original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
Wed Mar  6 17:07:00 2019
@@ -22,6 +22,7 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
 import java.math.BigInteger;
 import java.security.GeneralSecurityException;
 import java.security.MessageDigest;
@@ -189,16 +190,36 @@ public class AddValidationInformation
         {
             try
             {
-                result = clazz.newInstance();
+                result = clazz.getDeclaredConstructor().newInstance();
             }
-            catch (InstantiationException e)
+            catch (InstantiationException ex)
             {
-                LOG.error("Failed to create new instance of " + clazz.getCanonicalName(),
e);
+                LOG.error("Failed to create new instance of " + clazz.getCanonicalName(),
ex);
                 return null;
             }
-            catch (IllegalAccessException e)
+            catch (IllegalAccessException ex)
             {
-                LOG.error("Failed to create new instance of " + clazz.getCanonicalName(),
e);
+                LOG.error("Failed to create new instance of " + clazz.getCanonicalName(),
ex);
+                return null;
+            }
+            catch (NoSuchMethodException ex)
+            {
+                LOG.error("Failed to create new instance of " + clazz.getCanonicalName(),
ex);
+                return null;
+            }
+            catch (SecurityException ex)
+            {
+                LOG.error("Failed to create new instance of " + clazz.getCanonicalName(),
ex);
+                return null;
+            }
+            catch (IllegalArgumentException ex)
+            {
+                LOG.error("Failed to create new instance of " + clazz.getCanonicalName(),
ex);
+                return null;
+            }
+            catch (InvocationTargetException ex)
+            {
+                LOG.error("Failed to create new instance of " + clazz.getCanonicalName(),
ex);
                 return null;
             }
             result.setDirect(false);



Mime
View raw message