tracker issue : CF-4126733

select a category, or use search below
(searches all categories and all time range)
Title:

Sanitize throws a NPE

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Raymond Camden / Raymond Camden (Raymond Camden)

Created: 03/09/2016

Components: Document Management, PDF manipulation

Versions: 2016

Failure Type: Unspecified

Found In Build/Fixed In Build: Alpha_v12 / 2016

Priority/Frequency: Normal / Unknown

Locale/System: English / Mac All

Vote Count: 1

Related Bugs:
3991547 - Similar to	CT Gibson


Using this code:

<cfscript>
	
cfpdf(action="sanitize", source="../ColdFusion_Raijin_WhatIsNew.pdf",destination=expandPath("./sanitized.pdf"));
	
</cfscript>

Done

I get:

The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values.
 
The error occurred in /Applications/ColdFusionRaijin/cfusion/wwwroot/cf12tests/pdf_sanitize.cfm: line 3
1 : <cfscript>
2 : 	
3 : cfpdf(action="sanitize", source="../ColdFusion_Raijin_WhatIsNew.pdf",destination=expandPath("./sanitized.pdf"));
4 : 	
5 : </cfscript>

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4126733

External Customer Info:
External Company: Broadchoice
External Customer Name: Raymond Camden
External Customer Email: raymondcamden@gmail.com
External Test Config:

Attachments:

Comments:

Adding BUG AUDIT TRAIL ********action: updated fieldName: Priority newValue: 2 oldValue: 3 oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-16 03:10:21.0 action: updated fieldName: Severity newValue: 2 oldValue: 3 oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-16 03:10:21.0 action: updated fieldName: Reason newValue: ThirdParty oldValue: ThirdParty oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2015-09-23 18:15:24.0 action: updated fieldName: Date Deferred newValue: 2015-09-23 11:15:24.0 oldValue: Blank oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2015-09-23 18:15:24.0 action: updated fieldName: Status newValue: Deferred oldValue: Withdrawn oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2015-09-23 18:15:24.0 action: updated fieldName: Reason newValue: ThirdParty oldValue: ThirdParty oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2015-09-23 17:19:52.0 action: updated fieldName: State newValue: Closed oldValue: Open oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2015-09-23 17:19:52.0 action: updated fieldName: Owner newValue: Blank oldValue: suchsing oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2015-09-23 17:19:52.0 action: updated fieldName: Closed By newValue: nimsharm oldValue: Blank oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2015-09-23 17:19:52.0 action: updated fieldName: Date Closed newValue: 2015-09-23 10:19:52.0 oldValue: Blank oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2015-09-23 17:19:52.0 action: updated fieldName: Status newValue: Withdrawn oldValue: ToTrack oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2015-09-23 17:19:52.0 action: updated fieldName: Status newValue: ToTrack oldValue: ToTest oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-09-23 15:08:29.0 action: updated fieldName: Reason newValue: ThirdParty oldValue: ThirdParty oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-09-23 15:08:29.0 action: updated fieldName: Owner newValue: suchsing oldValue: vadiraja oprid: vadiraja recordName: RQ_DEFECT timpestamp: 2015-09-23 13:20:15.0 action: updated fieldName: Reason newValue: ThirdParty oldValue: Blank oprid: vadiraja recordName: RQ_DEFECT timpestamp: 2015-09-23 13:20:15.0 action: updated fieldName: Status newValue: ToTest oldValue: ToFix oprid: vadiraja recordName: RQ_DEFECT timpestamp: 2015-09-23 13:20:15.0 action: bulk updated fieldName: QE Assigned newValue: suchsing oldValue: poojain oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-09-19 05:31:47.0 action: updated fieldName: Priority newValue: 3 oldValue: 0 oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-09-08 09:53:55.0 action: added fieldName: Vote Type newValue: BETA oldValue: Blank oprid: prerelease recordName: AD_DEFECT_VOTE timpestamp: 2015-09-06 09:56:50.0 action: updated fieldName: Fix By Milestone newValue: Beta oldValue: Blank oprid: poojain recordName: RQ_DEFECT timpestamp: 2015-07-14 05:03:15.0 action: updated fieldName: Fix By Product Milestone newValue: Beta oldValue: Blank oprid: poojain recordName: RQ_DEFECT timpestamp: 2015-07-14 05:03:15.0 action: updated fieldName: Reason newValue: Blank oldValue: Blank oprid: poojain recordName: RQ_DEFECT timpestamp: 2015-07-14 04:59:17.0 action: updated fieldName: Owner newValue: vadiraja oldValue: poojain oprid: poojain recordName: RQ_DEFECT timpestamp: 2015-07-14 04:59:17.0 action: updated fieldName: Status newValue: ToFix oldValue: Unverified oprid: poojain recordName: RQ_DEFECT timpestamp: 2015-07-14 04:59:17.0 action: updated fieldName: Dev Assigned newValue: vadiraja oldValue: uogra oprid: poojain recordName: RQ_DEFECT timpestamp: 2015-07-14 04:59:17.0 action: updated fieldName: QE Assigned newValue: poojain oldValue: Blank oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-07-13 12:54:29.0 action: updated fieldName: Owner newValue: poojain oldValue: vmannebo oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-07-13 12:54:29.0
Comment by CFwatson U.
3357 | March 09, 2016 04:50:56 AM GMT
+1 - If <img> breaks action="sanitize", then remove action="sanitize" b/c it's not fit.
Vote by External U.
3359 | March 09, 2016 04:50:59 AM GMT
Added By: PreRelease User User Name:Aaron Neff Note Added: sanitize="" seems to support all HTML, except images. For images, it: 1) throws java.lang.NullPointerException if the image exists and PDF was generated by cfdocument or cfhtmltopdf 2) throws java.lang.NullPointerException if the image does not exist and the PDF was generated by cfhtmltopdf Also: 3) cfdocument throws coldfusion.document.DocumentProcessor$TimeOutException if image's source is an empty string (cfhtmltopdf doesn't throw this error) Repro: index.cfm --------- <cfscript> cfsetting(requesttimeout=300); theHTML='<img src="http://wwwimages.adobe.com/content/dam/Adobe/images/shared/product-totems/80x80/totem-coldfusion-11-80x80.png.adimg.mw.80.png">'; //theHTML='<img src="http://www.domain.com/image.jpg">'; //theHTML='<img src="">'; try {cfdocument(format="pdf", name="myPDF") {writeOutput(theHTML);}; cfpdf(action="sanitize", source="myPDF");} catch(any e) {writeOutput('first=' & e.type & '[' & e.message & ']<br>');} try {cfhtmltopdf(name="myPDF") {writeOutput(theHTML);}; cfpdf(action="sanitize", source="myPDF");} catch(any e) {writeOutput('second=' & e.type & '[' & e.message & ']<br>');} try {cfdocument(format="pdf", filename=expandPath("./myPDF.pdf"), overwrite=true) {writeOutput(theHTML);}; cfpdf(action="sanitize", source=expandPath("./myPDF.pdf"), overwrite=true);} catch(any e) {writeOutput('third=' & e.type & '[' & e.message & ']<br>');} try {cfhtmltopdf(destination=expandPath("./myPDF.pdf"), overwrite=true) {writeOutput(theHTML);}; cfpdf(action="sanitize", source=expandPath("./myPDF.pdf"), overwrite=true);} catch(any e) {writeOutput('fourth=' & e.type & '[' & e.message & ']<br>');} </cfscript> Steps: 1) Run index.cfm and see: ---------------------- first=java.lang.NullPointerException[] second=java.lang.NullPointerException[] third=java.lang.NullPointerException[] fourth=java.lang.NullPointerException[] ---------------------- 2) Run index.cfm w/ theHTML='<img src="http://www.domain.com/image.jpg">'; and see: ---------------------- second=java.lang.NullPointerException[] fourth=java.lang.NullPointerException[] ---------------------- 3) Run index.cfm w/ theHTML='<img src="">'; and see: ---------------------- first=Application[The content of this document process takes more than 60000 milliseconds to process.] third=Application[The content of this document process takes more than 60000 milliseconds to process.] ---------------------- 4) Run index.cfm w/ theHTML="foo"; or theHTML="<div>"; (or any other HTML) and see no error. Date Added :2015-09-11 05:27:52.0 Added By: PreRelease User User Name:Aaron Neff Note Added: Please disregard my "9/6/2015 2:56:50 AM" comment b/c source="aPDFVariableName" already works. Date Added :2015-09-11 03:53:55.0 Added By: PreRelease User User Name:Aaron Neff Note Added: Just noting a bit more of the error, in case we need to refer back to it later: java.lang.NullPointerException at com.adobe.internal.io.stream.IO.copy(IO.java:69) at com.adobe.internal.pdftoolkit.core.cos.CosStream.writeOut(CosStream.java:1170) at com.adobe.internal.pdftoolkit.core.cos.CosObjectInfo.writeIndirectObject(CosObjectInfo.java:366) at com.adobe.internal.pdftoolkit.core.cos.CosDocument.writeIndirectObjects(CosDocument.java:2538) at com.adobe.internal.pdftoolkit.core.cos.CosDocument.linearSave(CosDocument.java:2233) at com.adobe.internal.pdftoolkit.core.cos.CosDocument.save(CosDocument.java:1227) at com.adobe.internal.pdftoolkit.pdf.document.PDFDocument.saveLinear(PDFDocument.java:1109) at com.adobe.internal.pdftoolkit.pdf.document.PDFDocument.doSave(PDFDocument.java:913) at com.adobe.internal.pdftoolkit.pdf.document.PDFDocument.save(PDFDocument.java:852) at com.adobe.internal.pdftoolkit.services.sanitization.SanitizationService.sanitizeDocument(SanitizationService.java:106) at coldfusion.pdf.PDFDocOperation.sanitize(PDFDocOperation.java:1141) at coldfusion.tagext.lang.PDFTag.doEndTag(PDFTag.java:1778) Date Added :2015-09-06 09:55:35.0 Added By: PreRelease User User Name:Raymond Camden Note Added: Entered Bug. Date Added :2015-07-13 12:30:57.0
Comment by CFwatson U.
3358 | March 09, 2016 04:51:00 AM GMT