-
Bug
-
Resolution: Fixed
-
P3
-
6
-
1.4
-
x86
-
windows_xp
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2185509 | 7 | Joe Wang | P3 | Closed | Fixed | m05 |
JDK-2182526 | 6u18 | Joe Wang | P3 | Resolved | Fixed | b02 |
FULL PRODUCT VERSION :
1.6.0_02
ADDITIONAL OS VERSION INFORMATION :
Seen on different windows version, one of them being:
Microsoft Windows 2000 [versie 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
See the code below. It is a fragment that is used to dynamically build a menu bar depending on the contents of an XML file. The code runs fine when using JRE 1.6.0_01 but gives a javax.xml.stream.XMLStreamException when running in JRE 1.6.0_02. The exception occurs in the line where xer.hasNext() is called (see attached code). The details of the exception are: " ParseError at [row,col]:[1,39]: Message: expected start or end tag". The location mentioned is the character just after the end of the "<?xml version='1.0' encoding='UTF-8'?>" declaration in our XML file. The XML file has a rather simple structure; we do not use any DTD or XML schema.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try the attached code on a file like this:
<?xml version='1.0' encoding='UTF-8'?>
<menubar>
<menu>
<id>file</id>
<item>
<id>exit</id>
<method>doExit 0</method>
<type>all</type>
</item>
</menu>
<menu>
<id>edit</id>
<item>
<id>prefs</id>
<method>showPrefsWindow 0</method>
<type>all</type>
</item>
</menu>
</menubar>
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The file is parsed.
ACTUAL -
Exception occurs.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,39]
Message: expected start or end tag
at com.sun.xml.internal.stream.XMLEventReaderImpl.nextTag(Unknown Source)
at com.koopmanint.util.LisMenuBar.<init>(LisMenuBar.java:51)
at com.koopmanint.lis.LisMainWindow.getMainMenuBar(LisMainWindow.java:245)
at com.koopmanint.lis.LisMainWindow.initialize(LisMainWindow.java:137)
at com.koopmanint.lis.LisMainWindow.<init>(LisMainWindow.java:117)2007-10-02
at com.koopmanint.lis.LisMainWindow.getInstance(LisMainWindow.java:127)
at com.koopmanint.lis.LisMain.createAndShowGUI(LisMain.java:97)
at com.koopmanint.lis.LisMain.access$2(LisMain.java:95)
at com.koopmanint.lis.LisMain$1.run(LisMain.java:157)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
XMLInputFactory xif = XMLInputFactoryImpl.newInstance();
XMLEventReader xer = null;
try {
xer = xif.createXMLEventReader(xif.createXMLStreamReader(new FileInputStream(xmlFile)));
} catch (FileNotFoundException e) {
log.error("Error while reading XML: " + e.getClass().getName() + " " + e.getMessage());
} catch (XMLStreamException e) {
log.error("Error while reading XML: " + e.getClass().getName() + " " + e.getMessage());
}
try {
while (xer.hasNext()) {
XMLEvent event = xer.nextTag();
while (event.isEndElement() && !event.isEndDocument()) {
event = xer.nextTag();
}
if (event.asStartElement().getName().equals(new QName("menu"))) {
this.add(addMenu("app.menu", xer, event, al));
}
if (event.isEndDocument()) {
break;
}
}
} catch (XMLStreamException e) {
log.warn("Exception while reading " + xmlFile + ": " + e.getClass().getName() + " " + e.getMessage());
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use older JRE (1.6.0_01). This means automatic updates have to be disabled for all our users, which is not desireable.
Release Regression From : 6u1
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
1.6.0_02
ADDITIONAL OS VERSION INFORMATION :
Seen on different windows version, one of them being:
Microsoft Windows 2000 [versie 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
See the code below. It is a fragment that is used to dynamically build a menu bar depending on the contents of an XML file. The code runs fine when using JRE 1.6.0_01 but gives a javax.xml.stream.XMLStreamException when running in JRE 1.6.0_02. The exception occurs in the line where xer.hasNext() is called (see attached code). The details of the exception are: " ParseError at [row,col]:[1,39]: Message: expected start or end tag". The location mentioned is the character just after the end of the "<?xml version='1.0' encoding='UTF-8'?>" declaration in our XML file. The XML file has a rather simple structure; we do not use any DTD or XML schema.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try the attached code on a file like this:
<?xml version='1.0' encoding='UTF-8'?>
<menubar>
<menu>
<id>file</id>
<item>
<id>exit</id>
<method>doExit 0</method>
<type>all</type>
</item>
</menu>
<menu>
<id>edit</id>
<item>
<id>prefs</id>
<method>showPrefsWindow 0</method>
<type>all</type>
</item>
</menu>
</menubar>
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The file is parsed.
ACTUAL -
Exception occurs.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,39]
Message: expected start or end tag
at com.sun.xml.internal.stream.XMLEventReaderImpl.nextTag(Unknown Source)
at com.koopmanint.util.LisMenuBar.<init>(LisMenuBar.java:51)
at com.koopmanint.lis.LisMainWindow.getMainMenuBar(LisMainWindow.java:245)
at com.koopmanint.lis.LisMainWindow.initialize(LisMainWindow.java:137)
at com.koopmanint.lis.LisMainWindow.<init>(LisMainWindow.java:117)2007-10-02
at com.koopmanint.lis.LisMainWindow.getInstance(LisMainWindow.java:127)
at com.koopmanint.lis.LisMain.createAndShowGUI(LisMain.java:97)
at com.koopmanint.lis.LisMain.access$2(LisMain.java:95)
at com.koopmanint.lis.LisMain$1.run(LisMain.java:157)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
XMLInputFactory xif = XMLInputFactoryImpl.newInstance();
XMLEventReader xer = null;
try {
xer = xif.createXMLEventReader(xif.createXMLStreamReader(new FileInputStream(xmlFile)));
} catch (FileNotFoundException e) {
log.error("Error while reading XML: " + e.getClass().getName() + " " + e.getMessage());
} catch (XMLStreamException e) {
log.error("Error while reading XML: " + e.getClass().getName() + " " + e.getMessage());
}
try {
while (xer.hasNext()) {
XMLEvent event = xer.nextTag();
while (event.isEndElement() && !event.isEndDocument()) {
event = xer.nextTag();
}
if (event.asStartElement().getName().equals(new QName("menu"))) {
this.add(addMenu("app.menu", xer, event, al));
}
if (event.isEndDocument()) {
break;
}
}
} catch (XMLStreamException e) {
log.warn("Exception while reading " + xmlFile + ": " + e.getClass().getName() + " " + e.getMessage());
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use older JRE (1.6.0_01). This means automatic updates have to be disabled for all our users, which is not desireable.
Release Regression From : 6u1
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- backported by
-
JDK-2182526 sjsxp issue 42: Same code runs fine on 1.6.0_01 but gives XMLStreamException on 1.6.0_02
-
- Resolved
-
-
JDK-2185509 sjsxp issue 42: Same code runs fine on 1.6.0_01 but gives XMLStreamException on 1.6.0_02
-
- Closed
-