Bug 49386

Summary: Null creation date in PPTX file causes NPE
Product: POI Reporter: rick cameron <rick.cameron>
Component: HSLFAssignee: POI Developers List <dev>
Severity: normal CC: rick.cameron
Priority: P2    
Version: 3.6-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Attachments: PPTX showing NPE

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(
		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.