poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 48832] New: NullPointerException at org.apache.poi.hpsf.MutableSection.getSize(MutableSection.java:328)
Date Mon, 01 Mar 2010 14:44:09 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=48832

           Summary: NullPointerException at
                    org.apache.poi.hpsf.MutableSection.getSize(MutableSect
                    ion.java:328)
           Product: POI
           Version: 3.6
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: mhilpert@gmx.de


I try to add meta data via SummaryInfo:

-----------
workbook.createInformationProperties();
            final SummaryInformation si = workbook.getSummaryInformation();
            if (si != null) {
                for (final Map.Entry<String, Object> e :
summaryInfo.entrySet()) {
                    final String k = e.getKey().toLowerCase();
                    final Object o = e.getValue();
                    if (k != null && o != null) {
                        if ("author".equals(k)) {
                            si.setLastAuthor(si.getAuthor());
                            si.setAuthor(o.toString());
                        } else if ("appName".equals(k)) {
                            si.setApplicationName(o.toString());
                        } else if ("comments".equals(k)) {
                            si.setComments(o.toString());
                        } else if ("creationDate".equals(k) && o instanceof
Date) {
                            si.setCreateDateTime((Date) o);
                        } else if ("keywords".equals(k)) {
                            si.setKeywords(o.toString());
                        } else if ("keywords".equals(k)) {
                            si.setKeywords(o.toString());
                        } else if ("subject".equals(k)) {
                            si.setSubject(o.toString());
                        } else if ("title".equals(k)) {
                            si.setTitle(o.toString());
                        }
                    }//else: entry unavailable
                }//next input summaryInfo
            }//else: SummaryInformation unavailable
----------------------

but when I save the workbook (via workbook.write(fos) ), I get this NPE:

----------------
    org.apache.poi.hpsf.HPSFRuntimeException
        at org.apache.poi.hpsf.MutableSection.getSize(MutableSection.java:328)
        at
org.apache.poi.hpsf.MutablePropertySet.write(MutablePropertySet.java:230)
        at org.apache.poi.POIDocument.writePropertySet(POIDocument.java:209)
        at org.apache.poi.POIDocument.writeProperties(POIDocument.java:184)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1169)
        ...
    Caused by:
    java.lang.NullPointerException
        at org.apache.poi.hpsf.VariantSupport.write(VariantSupport.java:503)
        at org.apache.poi.hpsf.MutableProperty.write(MutableProperty.java:116)
        at org.apache.poi.hpsf.MutableSection.write(MutableSection.java:459)
        at org.apache.poi.hpsf.MutableSection.calcSize(MutableSection.java:348)
        at org.apache.poi.hpsf.MutableSection.getSize(MutableSection.java:319)
        at
org.apache.poi.hpsf.MutablePropertySet.write(MutablePropertySet.java:230)
        at org.apache.poi.POIDocument.writePropertySet(POIDocument.java:209)
        at org.apache.poi.POIDocument.writeProperties(POIDocument.java:184)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1169)
        ...
---------------------

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message