You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xmlgraphics.apache.org by bu...@apache.org on 2011/04/07 20:18:59 UTC
DO NOT REPLY [Bug 51039] New: Crash of due to a
NumberFormatException in XMPSchemaAdapter (problem of GMT parsing)
https://issues.apache.org/bugzilla/show_bug.cgi?id=51039
Summary: Crash of due to a NumberFormatException in
XMPSchemaAdapter (problem of GMT parsing)
Product: XMLGraphicsCommons
Version: 1.4
Platform: PC
OS/Version: Linux
Status: NEW
Severity: blocker
Priority: P2
Component: XMP
AssignedTo: general@xmlgraphics.apache.org
ReportedBy: f.barbera@hotmail.fr
Hi there !
I think there is an issue in the method formatISO8601Date of the class
org.apache.xmlgraphics.xmp.XMPSchemaAdapter
When you have a negative GMT indication and when the negative number is less or
equal to -10 then there is a problem.
The piece of code:
if (zoneOffsetHours > 0) {
sb.append('+');
} else {
sb.append('-');
}
if (zoneOffsetHours < 10) {
sb.append('0');
}
If I have zoneOffsetHours = -10 I will have zoneOffsetHours < 10 true (-10 <
10) so I will have sb concatenated with “-010” and not with “-10”.
The result is : 2011-04-07T08:12:11-010:00
I think we should have 2011-04-07T08:12:11-10:00 (no zero before the -10).
It causes a NumberFormatException in my case, if I use FOP. the error is in the
parseISO8601Date method of the same class :
The line that crashes is the following :
offset += Integer.parseInt(timeZonePart.substring(4, 6));
The result of timeZonePart.substring(4, 6) is :0 and not 00 as it should be.
Exception in thread "main" java.lang.NumberFormatException: For input string:
":0"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at
org.apache.xmlgraphics.xmp.XMPSchemaAdapter.parseISO8601Date(XMPSchemaAdapter.java:236)
at
org.apache.xmlgraphics.xmp.XMPSchemaAdapter.getDateValue(XMPSchemaAdapter.java:282)
at
org.apache.xmlgraphics.xmp.schemas.XMPBasicAdapter.getMetadataDate(XMPBasicAdapter.java:170)
at
org.apache.fop.render.intermediate.IFRenderer.createDefaultDocumentMetadata(IFRenderer.java:549)
at
org.apache.fop.render.intermediate.IFRenderer.startPageSequence(IFRenderer.java:500)
at
org.apache.fop.area.RenderPagesModel.startPageSequence(RenderPagesModel.java:89)
at
org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:98)
at
org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)
at
org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)
at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)
at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
at
org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
at
com.micropol.micronix.engine.tools.pdf.PdfCreator.convertFO2PDF(PdfCreator.java:95)
at
com.micropol.micronix.engine.tools.pdf.PdfCreator.main(PdfCreator.java:121)
As a result, each part of the word that has a GMT -10,-11,-12,-13 (Tonga)
cannot use FOP 1.0. It is the case for many Pacific islands (I'm in French
Polynesia).
I think that the good test would be :
if (Math.abs(zoneOffsetHours) < 10) {
sb.append('0');
}
--
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: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org
DO NOT REPLY [Bug 51039] Crash of due to a NumberFormatException in
XMPSchemaAdapter (problem of GMT parsing)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51039
--- Comment #1 from Florian Barbera Vila Bollain <f....@hotmail.fr> 2011-04-19 22:30:10 EDT ---
Created an attachment (id=26909)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26909)
I propose a patch. I tested it in our soft. It seems to be OK.
I just replace :
if (zoneOffsetHours < 10) {
sb.append('0');
}
By
if (Math.abs(zoneOffsetHours) < 10) {
sb.append('0');
}
--
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: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org
DO NOT REPLY [Bug 51039] [PATCH] Crash of due to a
NumberFormatException in XMPSchemaAdapter (problem of GMT parsing)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51039
Jeremias Maerki <je...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |PatchAvailable
Status|NEW |RESOLVED
Resolution| |FIXED
Summary|Crash of due to a |[PATCH] Crash of due to a
|NumberFormatException in |NumberFormatException in
|XMPSchemaAdapter (problem |XMPSchemaAdapter (problem
|of GMT parsing) |of GMT parsing)
--- Comment #2 from Jeremias Maerki <je...@apache.org> 2011-04-22 05:31:48 EDT ---
Patch applied: http://svn.apache.org/viewvc?rev=1095897&view=rev
Thanks a lot!
--
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: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org
DO NOT REPLY [Bug 51039] Crash of due to a NumberFormatException in
XMPSchemaAdapter (problem of GMT parsing)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51039
Florian Barbera Vila Bollain <f....@hotmail.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |f.barbera@hotmail.fr
--
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: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org