[Geoserver-devel] Hard to inspect stack traces after translators transaction support

Hi,
today I was looking at the following stack trace:

aused by: javax.xml.transform.TransformerException: java.lang.RuntimeException: Unexpected error occurred during describe coverage xml encoding
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:732)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:336)
at org.geotools.xml.transform.TransformerBase$Task.run(TransformerBase.java:300)
at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:133)
at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:112)
at org.geoserver.wcs.response.Wcs10DescribeCoverageResponse.write(Wcs10DescribeCoverageResponse.java:35)
… 78 more
Caused by: java.lang.RuntimeException: Unexpected error occurred during describe coverage xml encoding
at org.geoserver.wcs.response.Wcs10DescribeCoverageTransformer$WCS100DescribeCoverageTranslator.encode(Wcs10DescribeCoverageTransformer.java:201)
at org.geotools.xml.transform.TransformerBase$XMLReaderSupport.parse(TransformerBase.java:940)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:654)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:723)
… 83 more
Caused by: java.lang.NullPointerException
at com.sun.org.apache.xml.internal.serializer.ToStream.writeAttrString(ToStream.java:1962)
at com.sun.org.apache.xml.internal.serializer.ToStream.processAttributes(ToStream.java:1942)
at com.sun.org.apache.xml.internal.serializer.ToStream.endElement(ToStream.java:2031)
at com.sun.org.apache.xml.internal.serializer.ToUnknownStream.endElement(ToUnknownStream.java:848)
at org.geotools.xml.transform.TransformerBase$TranslatorSupport._end(TransformerBase.java:770)
at org.geotools.xml.transform.TransformerBase$TranslatorSupport.access$300(TransformerBase.java:433)
at org.geotools.xml.transform.TransformerBase$TranslatorSupport$End.commit(TransformerBase.java:517)
at org.geotools.xml.transform.TransformerBase$TranslatorSupport.commit(TransformerBase.java:665)
at org.geoserver.wcs.response.Wcs10DescribeCoverageTransformer$WCS100DescribeCoverageTranslator.encode(Wcs10DescribeCoverageTransformer.java:196)
… 86 more

The above stack trace is not very informative, because the commands were recorded and
it’s not visiable which one generated the NPE.

How to make this easier to debug? I guess the commit method should catch the command that
was recorded and dump it along with the exception with as much information as possible
in order to at least see what the code was trying to write.

Cheers
Andrea


Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

I can provide a patch to make it behave that way. But before I do, what about just making the null-check explicit in the various XML methods in the transformer? That way the offending method call still shows up in the actual stack trace.


David Winslow
OpenGeo - http://opengeo.org/

On Fri, Jun 1, 2012 at 12:41 PM, Andrea Aime <andrea.aime@anonymised.com.1268…> wrote:

Hi,
today I was looking at the following stack trace:

aused by: javax.xml.transform.TransformerException: java.lang.RuntimeException: Unexpected error occurred during describe coverage xml encoding
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:732)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:336)
at org.geotools.xml.transform.TransformerBase$Task.run(TransformerBase.java:300)
at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:133)
at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:112)
at org.geoserver.wcs.response.Wcs10DescribeCoverageResponse.write(Wcs10DescribeCoverageResponse.java:35)
… 78 more
Caused by: java.lang.RuntimeException: Unexpected error occurred during describe coverage xml encoding
at org.geoserver.wcs.response.Wcs10DescribeCoverageTransformer$WCS100DescribeCoverageTranslator.encode(Wcs10DescribeCoverageTransformer.java:201)
at org.geotools.xml.transform.TransformerBase$XMLReaderSupport.parse(TransformerBase.java:940)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:654)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:723)
… 83 more
Caused by: java.lang.NullPointerException
at com.sun.org.apache.xml.internal.serializer.ToStream.writeAttrString(ToStream.java:1962)
at com.sun.org.apache.xml.internal.serializer.ToStream.processAttributes(ToStream.java:1942)
at com.sun.org.apache.xml.internal.serializer.ToStream.endElement(ToStream.java:2031)
at com.sun.org.apache.xml.internal.serializer.ToUnknownStream.endElement(ToUnknownStream.java:848)
at org.geotools.xml.transform.TransformerBase$TranslatorSupport._end(TransformerBase.java:770)
at org.geotools.xml.transform.TransformerBase$TranslatorSupport.access$300(TransformerBase.java:433)
at org.geotools.xml.transform.TransformerBase$TranslatorSupport$End.commit(TransformerBase.java:517)
at org.geotools.xml.transform.TransformerBase$TranslatorSupport.commit(TransformerBase.java:665)
at org.geoserver.wcs.response.Wcs10DescribeCoverageTransformer$WCS100DescribeCoverageTranslator.encode(Wcs10DescribeCoverageTransformer.java:196)
… 86 more

The above stack trace is not very informative, because the commands were recorded and
it’s not visiable which one generated the NPE.

How to make this easier to debug? I guess the commit method should catch the command that
was recorded and dump it along with the exception with as much information as possible
in order to at least see what the code was trying to write.

Cheers
Andrea


Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf


Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

On Fri, Jun 1, 2012 at 7:35 PM, David Winslow <dwinslow@anonymised.com> wrote:

I can provide a patch to make it behave that way. But before I do, what about just making the null-check explicit in the various XML methods in the transformer? That way the offending method call still shows up in the actual stack trace.

Yep, having both would be ideal I guess

Cheers
Andrea


Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

I have attached the patch to a ticket in GeoTools: http://jira.codehaus.org/browse/GEOT-4167

You weren’t on IRC when I checked just now but please commit if it’s what you had in mind. Or I can do it if that’s easier.


David Winslow
OpenGeo - http://opengeo.org/

On Sat, Jun 2, 2012 at 3:12 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Fri, Jun 1, 2012 at 7:35 PM, David Winslow <dwinslow@anonymised.com> wrote:

I can provide a patch to make it behave that way. But before I do, what about just making the null-check explicit in the various XML methods in the transformer? That way the offending method call still shows up in the actual stack trace.

Yep, having both would be ideal I guess

Cheers

Andrea


Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf