[jira] [Updated] (PDFBOX-2173) Nullpointer when validating empty file

2014-11-06 Thread Tilman Hausherr (JIRA)

 [ 
https://issues.apache.org/jira/browse/PDFBOX-2173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tilman Hausherr updated PDFBOX-2173:

Affects Version/s: 2.0.0

 Nullpointer when validating empty file
 --

 Key: PDFBOX-2173
 URL: https://issues.apache.org/jira/browse/PDFBOX-2173
 Project: PDFBox
  Issue Type: Bug
  Components: Preflight
Affects Versions: 1.8.6, 2.0.0
Reporter: Per-Olof Widström
Priority: Minor
 Fix For: 1.8.8, 2.0.0


 I am validating a PDF and I am getting a NullpointerException when the 
 filesize is 0 bytes. I looked at the code and saw a small misstake, and 
 therefore I am reporting this. I use version 1.8.6
 {code:java|title=PreflightParser.java}
 protected void checkPdfHeader()
 {
 //[snip]
 String secondLine = reader.readLine();
 byte[] secondLineAsBytes = secondLine.getBytes(encoding.name());
 if (secondLine != null  secondLineAsBytes.length = 5)
 //[snip]
 }
 {code}
 As you can see {{secondLineAsBytes}} is checked for null value, but only 
 after being called once.
 {code}
 java.lang.NullPointerException
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.checkPdfHeader(PreflightParser.java:297)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:195)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:180)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:168)
 {code}
 h4. Workaround
 Before validating, check the filesize, if it is larger than 0. 
 h4. How to reproduce
 Try to validate with an empty file.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PDFBOX-2173) Nullpointer when validating empty file

2014-11-06 Thread Tilman Hausherr (JIRA)

 [ 
https://issues.apache.org/jira/browse/PDFBOX-2173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tilman Hausherr updated PDFBOX-2173:

Fix Version/s: 1.8.8

 Nullpointer when validating empty file
 --

 Key: PDFBOX-2173
 URL: https://issues.apache.org/jira/browse/PDFBOX-2173
 Project: PDFBox
  Issue Type: Bug
  Components: Preflight
Affects Versions: 1.8.6, 2.0.0
Reporter: Per-Olof Widström
Priority: Minor
 Fix For: 1.8.8, 2.0.0


 I am validating a PDF and I am getting a NullpointerException when the 
 filesize is 0 bytes. I looked at the code and saw a small misstake, and 
 therefore I am reporting this. I use version 1.8.6
 {code:java|title=PreflightParser.java}
 protected void checkPdfHeader()
 {
 //[snip]
 String secondLine = reader.readLine();
 byte[] secondLineAsBytes = secondLine.getBytes(encoding.name());
 if (secondLine != null  secondLineAsBytes.length = 5)
 //[snip]
 }
 {code}
 As you can see {{secondLineAsBytes}} is checked for null value, but only 
 after being called once.
 {code}
 java.lang.NullPointerException
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.checkPdfHeader(PreflightParser.java:297)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:195)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:180)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:168)
 {code}
 h4. Workaround
 Before validating, check the filesize, if it is larger than 0. 
 h4. How to reproduce
 Try to validate with an empty file.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PDFBOX-2173) Nullpointer when validating empty file

2014-07-01 Thread JIRA

 [ 
https://issues.apache.org/jira/browse/PDFBOX-2173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Per-Olof Widström updated PDFBOX-2173:
--

Description: 
I am validating a PDF and I am getting a NullpointerException when the filesize 
is 0 bytes. I looked at the code and saw a small misstake, and therefore I am 
reporting this. I use version 2.8.6

{code:java|title=PreflightParser.java}
protected void checkPdfHeader()
{
//[snip]
String secondLine = reader.readLine();
byte[] secondLineAsBytes = secondLine.getBytes(encoding.name());
if (secondLine != null  secondLineAsBytes.length = 5)
//[snip]
}
{code}

As you can see {{secondLineAsBytes}} is checked for null value, but only after 
being called once.

{code}
java.lang.NullPointerException
at 
org.apache.pdfbox.preflight.parser.PreflightParser.checkPdfHeader(PreflightParser.java:297)
at 
org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:195)
at 
org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:180)
at 
org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:168)
{code}

h4. Workaround
Before validating, check the filesize, if it is larger than 0. 

h4. How to reproduce
Try to validate with an empty file.




  was:

I am validating a PDF and I am getting a NullpointerException when the filesize 
is 0 bytes. I looked at the code and saw a small misstake, and therefore I am 
reporting this. I use version 2.8.6

{code:java|title=PreflightParser.java}
protected void checkPdfHeader()
{
//[snip]
String secondLine = reader.readLine();
byte[] secondLineAsBytes = secondLine.getBytes(encoding.name());
if (secondLine != null  secondLineAsBytes.length = 5)
//[snip]
}
{code}

As you can see {{secondLineAsBytes}} is checked for null value, but only after 
being called once.

{code}
java.lang.NullPointerException
at 
org.apache.pdfbox.preflight.parser.PreflightParser.checkPdfHeader(PreflightParser.java:297)
at 
org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:195)
at 
org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:180)
at 
org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:168)
{code}

h4. Workaround
Before validating, check the filesize, if it is larger than 0. 

h4. How to reproduce
Try to validate with an empty file.




   Priority: Minor  (was: Major)

 Nullpointer when validating empty file
 --

 Key: PDFBOX-2173
 URL: https://issues.apache.org/jira/browse/PDFBOX-2173
 Project: PDFBox
  Issue Type: Bug
  Components: Preflight
Reporter: Per-Olof Widström
Priority: Minor

 I am validating a PDF and I am getting a NullpointerException when the 
 filesize is 0 bytes. I looked at the code and saw a small misstake, and 
 therefore I am reporting this. I use version 2.8.6
 {code:java|title=PreflightParser.java}
 protected void checkPdfHeader()
 {
 //[snip]
 String secondLine = reader.readLine();
 byte[] secondLineAsBytes = secondLine.getBytes(encoding.name());
 if (secondLine != null  secondLineAsBytes.length = 5)
 //[snip]
 }
 {code}
 As you can see {{secondLineAsBytes}} is checked for null value, but only 
 after being called once.
 {code}
 java.lang.NullPointerException
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.checkPdfHeader(PreflightParser.java:297)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:195)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:180)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:168)
 {code}
 h4. Workaround
 Before validating, check the filesize, if it is larger than 0. 
 h4. How to reproduce
 Try to validate with an empty file.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Updated] (PDFBOX-2173) Nullpointer when validating empty file

2014-07-01 Thread John Hewson (JIRA)

 [ 
https://issues.apache.org/jira/browse/PDFBOX-2173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Hewson updated PDFBOX-2173:


Affects Version/s: 1.8.6

 Nullpointer when validating empty file
 --

 Key: PDFBOX-2173
 URL: https://issues.apache.org/jira/browse/PDFBOX-2173
 Project: PDFBox
  Issue Type: Bug
  Components: Preflight
Affects Versions: 1.8.6
Reporter: Per-Olof Widström
Priority: Minor

 I am validating a PDF and I am getting a NullpointerException when the 
 filesize is 0 bytes. I looked at the code and saw a small misstake, and 
 therefore I am reporting this. I use version 1.8.6
 {code:java|title=PreflightParser.java}
 protected void checkPdfHeader()
 {
 //[snip]
 String secondLine = reader.readLine();
 byte[] secondLineAsBytes = secondLine.getBytes(encoding.name());
 if (secondLine != null  secondLineAsBytes.length = 5)
 //[snip]
 }
 {code}
 As you can see {{secondLineAsBytes}} is checked for null value, but only 
 after being called once.
 {code}
 java.lang.NullPointerException
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.checkPdfHeader(PreflightParser.java:297)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:195)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:180)
   at 
 org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:168)
 {code}
 h4. Workaround
 Before validating, check the filesize, if it is larger than 0. 
 h4. How to reproduce
 Try to validate with an empty file.



--
This message was sent by Atlassian JIRA
(v6.2#6252)