[
https://issues.apache.org/jira/browse/PDFBOX-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16387687#comment-16387687
]
Maruan Sahyoun commented on PDFBOX-4122:
----------------------------------------
This will involve changes to other methods too as one of these will protect
against passing null - in some cases we will get an NPE anyway - but checking
upfront makes more sense. The second commit is done only to please Sonar. If
you pass null it will already fail earlier:
{code}
Exception in thread "main" java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:363)
at
org.apache.pdfbox.pdfwriter.COSWriter.getObjectKey(COSWriter.java:905)
at
org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:511)
at COSWriterTest.main(COSWriterTest.java:15)
{code}
I'll open a new ticket if you are fine for that.
> Resolve potential NPEs flagged by Sonar
> ---------------------------------------
>
> Key: PDFBOX-4122
> URL: https://issues.apache.org/jira/browse/PDFBOX-4122
> Project: PDFBox
> Issue Type: Sub-task
> Affects Versions: 3.0.0 PDFBox
> Reporter: Maruan Sahyoun
> Assignee: Maruan Sahyoun
> Priority: Major
> Fix For: 3.0.0 PDFBox
>
>
> We have many potential NPEs resolved by now but there are still some flagged
> by Sonar
> https://builds.apache.org/analysis/component_issues?id=org.apache.pdfbox%3Apdfbox-reactor#resolved=false|types=BUG|severities=BLOCKER.
> Although it's very unlikely that we hit them in practice e.g. as this would
> mean a very corrupt font file I'll try to resolve these debug logging the
> condition and returning in that case.
> [~tilman] [~lehmi] please comment/revert if you are not happy with the
> approach.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]