You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2019/11/25 19:49:08 UTC
svn commit: r1870420 -
/pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
Author: tilman
Date: Mon Nov 25 19:49:08 2019
New Revision: 1870420
URL: http://svn.apache.org/viewvc?rev=1870420&view=rev
Log:
PDFBOX-3017: don't return null (which will go NPE) when the type of the element is wrong or could not be created, throw exception instead
Modified:
pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
Modified: pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java?rev=1870420&r1=1870419&r2=1870420&view=diff
==============================================================================
--- pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java (original)
+++ pdfbox/branches/issue45/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java Mon Nov 25 19:49:08 2019
@@ -199,33 +199,27 @@ public class AddValidationInformation
}
catch (InstantiationException ex)
{
- LOG.error("Failed to create new instance of " + clazz.getCanonicalName(), ex);
- return null;
+ throw new IOException("Failed to create new instance of " + clazz.getCanonicalName(), ex);
}
catch (IllegalAccessException ex)
{
- LOG.error("Failed to create new instance of " + clazz.getCanonicalName(), ex);
- return null;
+ throw new IOException("Failed to create new instance of " + clazz.getCanonicalName(), ex);
}
catch (NoSuchMethodException ex)
{
- LOG.error("Failed to create new instance of " + clazz.getCanonicalName(), ex);
- return null;
+ throw new IOException("Failed to create new instance of " + clazz.getCanonicalName(), ex);
}
catch (SecurityException ex)
{
- LOG.error("Failed to create new instance of " + clazz.getCanonicalName(), ex);
- return null;
+ throw new IOException("Failed to create new instance of " + clazz.getCanonicalName(), ex);
}
catch (IllegalArgumentException ex)
{
- LOG.error("Failed to create new instance of " + clazz.getCanonicalName(), ex);
- return null;
+ throw new IOException("Failed to create new instance of " + clazz.getCanonicalName(), ex);
}
catch (InvocationTargetException ex)
{
- LOG.error("Failed to create new instance of " + clazz.getCanonicalName(), ex);
- return null;
+ throw new IOException("Failed to create new instance of " + clazz.getCanonicalName(), ex);
}
result.setDirect(false);
parent.setItem(COSName.getPDFName(name), result);