Bug 49386 - Null creation date in PPTX file causes NPE
Summary: Null creation date in PPTX file causes NPE
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: 3.6-FINAL
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-03 18:01 UTC by rick cameron
Modified: 2010-06-04 08:02 UTC (History)
1 user (show)



Attachments
PPTX showing NPE (16.72 KB, application/vnd.openxmlformats-officedocument.presentationml.presentation)
2010-06-03 18:01 UTC, rick cameron
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rick cameron 2010-06-03 18:01:32 UTC
Created attachment 25525 [details]
PPTX showing NPE

When Tika tried to read metadata from a PPTX that has a null creation date, an NPE occurs in PackagePropertiesPart.getDateValue. 

	private String getDateValue(Nullable<Date> d) {
		if (d == null) {
			return "";
		}
		SimpleDateFormat df = new SimpleDateFormat(
				"yyyy-MM-dd'T'HH:mm:ss'Z'");
		return df.format(d.getValue());
	}

Although the code checks whether d is null, it appears that d.getValue() returns null, and an NPE is thrown in SimpleDateFormat.format:

Caused by: java.lang.NullPointerException
	at java.util.Calendar.setTime(Calendar.java:1075)
	at java.text.SimpleDateFormat.format(SimpleDateFormat.java:876)
	at java.text.SimpleDateFormat.format(SimpleDateFormat.java:869)
	at java.text.DateFormat.format(DateFormat.java:316)
	at org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart.getDateValue(PackagePropertiesPart.java:587)
Comment 1 Nick Burch 2010-06-04 08:02:53 UTC
Fixed in r951384.