You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2015/09/22 19:56:06 UTC
[jira] [Commented] (PDFBOX-2985) Potential NPE in
PDMarkedContent#getMCID()
[ https://issues.apache.org/jira/browse/PDFBOX-2985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14903093#comment-14903093 ]
Tilman Hausherr commented on PDFBOX-2985:
-----------------------------------------
Thanks for finding this! You're right that this would bring an NPE, but I'll rather return -1. Because that is what would be returned by {{getInt(COSName.MCID)}} if the MCID doesn't exist.
> Potential NPE in PDMarkedContent#getMCID()
> ------------------------------------------
>
> Key: PDFBOX-2985
> URL: https://issues.apache.org/jira/browse/PDFBOX-2985
> Project: PDFBox
> Issue Type: Bug
> Reporter: Petr Slaby
>
> I do not have a test case, but this method in PDMarkedContent is obviously wrong:
> {noformat}
> public int getMCID()
> {
> return this.getProperties() == null ? null :
> this.getProperties().getInt(COSName.MCID);
> }
> {noformat}
> if getProperties() is null, the method tries to convert null Integer value to an int. I believe the intention was rather:
> {noformat}
> ...
> return this.getProperties() == null ? 0 :
> ...
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org