cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ellur, Praveen X." <praveen.el...@nscorp.com>
Subject NPE with HSSFSerializer on StyleRegion
Date Mon, 03 Apr 2006 13:15:32 GMT
Hello there,

 

I am using HSSFSerializer with out the complete Cocoon framework in my J2EE
application. It goes with out saying that I am using this to generate XLS
file out of my XML source data. 

 

I use the following driver libraries...

 

-          Poi-2.5.1.jar

-          Excalibur-xmlutil-2.1

-          Avalon-framework-api-4.3

-          Cocoon-poi-block

-          Avalon-logkit-2.1  

-          Cocoon-2.1.8

 

I was able to generate tabular data in the XLS spreadsheet. I wanted to add
some formatting, so I added some StyleRegion's. I get this Null Pointer
Exception when it is trying to parse the StyleRegion Information.  I looked
up the source code of StyleRegion.java and I think this is an issue with
Logger and has nothing to do with my GMR XML definition. 

 

Here is the Source code of EPStyleRegion.java. The line which is in bold
(getLogger().debug(""....") is the line where I get this NPE.  I saw one
user reporting the same issue a couple of weeks ago but no one has replied
to it yet (http://www.mail-archive.com/users@cocoon.apache.org/msg32799.html
<http://www.mail-archive.com/users@cocoon.apache.org/msg32799.html> ). Any
help/pointers would be appreciated.

 

public void initialize(final Attribute[] attributes,

                final ElementProcessor parent) throws IOException {

        super.initialize(attributes, parent);

 

        Region region = new Region(getStartRow(), (short)getStartCol(),

                getEndRow(), (short)getEndCol());

 

        //        if (region.getRowFrom() == 0 &&

        //            region.getColumnFrom() ==0)

        //            getLogger().debug("got 0,0");

 

        getLogger().debug("region area is " + region.getArea());

        if (region.getArea() < MAX_AREA) {

            //protect against stupid mega regions

            //of generally NOTHING and no real

            //puprose created by gnumeric

            getLogger().debug("region added");

            _style = getSheet().addStyleRegion(region); //test

        } else {

            invalid = true;

        }

        colorhash = ((EPStyles)parent).getColorHash();

    }

 

Following is the StyleRegion Info I have ...

 

<gmr:Styles>

        <gmr:StyleRegion endRow="5" endCol="5" startRow="4" startCol="4">

          <gmr:Style Format="General" Back="white" Fore="Red" hidden="0"
locked="1" indent="0" Shade="1" wraptext="0" VAlign="2" HAlign="1">

            <gmr:font strikethrough="0" underline="0" italic="0" bold="0"
unit="10">Helvetica</gmr:font>

            <gmr:styleborder>

              <gmr:top color="Black" style="1"/>

              <gmr:bottom color="Black" style="1"/>

              <gmr:left color="Black" style="1"/>

              <gmr:right color="Black" style="1"/>

              <gmr:diagonal style="0"/>

              <gmr:rev-diagonal style="0"/>

            </gmr:styleborder>

          </gmr:Style>

        </gmr:StyleRegion>

      </gmr:Styles>

 

Below is the StackTrace... 

 

java.lang.NullPointerException

    at
org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements.EPStyle
Region.initialize(EPStyleRegion.java:92)

    at
org.apache.cocoon.serialization.ElementProcessorSerializer.startElement(Elem
entProcessorSerializer.java:414)

    at
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Transforme
rIdentityImpl.java:1073)

    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)

    at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)

    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)

    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)

 

Thanks,

 

Praveen


Mime
View raw message