Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] importer Exception
[CDO] importer Exception [message #1007597] Wed, 06 February 2013 16:51 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi,

See the exception when importing an xml file exported by CDO.
Does CDO produce XML it can not import later on?

here is a snippet of the produced XML:

<feature name="message" value="Could not locate identifier for metric STP_SCPKTSNT. For identifiers:  - NODE: arnstp01 - FUNCTION: &lt;=�����, Failed on :  - FUNCTION: &lt;=�����"/>


That's bizar encoding, this value.

This is the code which writes this feature:

final StringBuilder sb = new StringBuilder();
		sb.append("Could not locate networkElement for metric "
				+ metric.getName());
		sb.append("Using identifiers: ");
		for (final IComponentLocator.IdentifierDescriptor idValue : identifierValues) {
			sb.append(" - " + idValue.getKind().getObjectKind().getName()
					+ ": " + idValue.getValue());
		}


Anything unusual?

org.xml.sax.SAXParseException: Character reference "&#1" is an invalid XML character.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanCharReferenceValue(XMLScanner.java:1298)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:851)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:1547)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1320)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
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 com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
at org.eclipse.emf.cdo.server.CDOServerImporter$XML.importAll(CDOServerImporter.java:329)
at org.eclipse.emf.cdo.server.CDOServerImporter.importRepository(CDOServerImporter.java:111)
at org.eclipse.emf.cdo.internal.server.bundle.CDOCommandProvider.importXML(CDOCommandProvider.java:230)
at org.eclipse.emf.cdo.internal.server.bundle.CDOCommandProvider._cdo(CDOCommandProvider.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:209)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:155)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:140)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:104)
at java.lang.Thread.run(Thread.java:662)
Re: [CDO] importer Exception [message #1007641 is a reply to message #1007597] Wed, 06 February 2013 20:47 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5588
Registered: July 2009
Senior Member
Am 06.02.2013 17:51, schrieb Christophe Bouhier:
> Hi,
> See the exception when importing an xml file exported by CDO. Does CDO produce XML it can not import later on?
That's not the goal :P

> here is a snippet of the produced XML:
> <feature name="message" value="Could not locate identifier for metric STP_SCPKTSNT. For identifiers: - NODE: arnstp01
> - FUNCTION: <=�����, Failed on : - FUNCTION: <=�����"/>
Hm, is "<" allowed in attribute values?

> That's bizar encoding, this value.
> This is the code which writes this feature:
> final StringBuilder sb = new StringBuilder();
> sb.append("Could not locate networkElement for metric "
> + metric.getName());
> sb.append("Using identifiers: ");
> for (final IComponentLocator.IdentifierDescriptor idValue : identifierValues) {
> sb.append(" - " + idValue.getKind().getObjectKind().getName()
> + ": " + idValue.getValue());
> }

I checked that the exporter uses this to output the XML:

SAXTransformerFactory factory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
xmlHandler = factory.newTransformerHandler();

So, all needed conversion and escaping should be done there. I'm not an expert in XML or SAX. Maybe Ed has an idea...

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> Anything unusual?
> org.xml.sax.SAXParseException: Character reference "&#1" is an invalid XML character.
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
> at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
> at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
> at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
> at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanCharReferenceValue(XMLScanner.java:1298)
> at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:851)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:1547)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1320)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
> 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 com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
> at org.eclipse.emf.cdo.server.CDOServerImporter$XML.importAll(CDOServerImporter.java:329)
> at org.eclipse.emf.cdo.server.CDOServerImporter.importRepository(CDOServerImporter.java:111)
> at org.eclipse.emf.cdo.internal.server.bundle.CDOCommandProvider.importXML(CDOCommandProvider.java:230)
> at org.eclipse.emf.cdo.internal.server.bundle.CDOCommandProvider._cdo(CDOCommandProvider.java:110)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:209)
> at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:155)
> at org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:140)
> at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:104)
> at java.lang.Thread.run(Thread.java:662)
Re: [CDO] importer Exception [message #1007644 is a reply to message #1007597] Wed, 06 February 2013 21:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4187
Registered: July 2009
Senior Member
Hi

On 06/02/2013 16:51, Christophe Bouhier wrote:
>
> <feature name="message" value="Could not locate identifier for metric
> STP_SCPKTSNT. For identifiers: - NODE: arnstp01 - FUNCTION:
> <=�����, Failed on : - FUNCTION: <=�����"/>
>
>
> That's bizar encoding, this value.
It looks like a very normal non 8-bit to 8-bit character coding mismatch.

You created a Java string, but what did you do with it then?

Regards

Ed Willink
Re: [CDO] importer Exception [message #1007665 is a reply to message #1007641] Wed, 06 February 2013 22:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26283
Registered: July 2009
Senior Member
XML 1.0 does not allow as many characters as does XML 1.1 so maybe
specifying OPTION_XML_VERSION as 1.1 will allow the characters you've
included. Note that even XML 1.1 doesn't allow &#0;. I'd definitely
expect any < in the string to be encoded as &lt;...

On 06/02/2013 9:47 PM, Eike Stepper wrote:
> Am 06.02.2013 17:51, schrieb Christophe Bouhier:
>> Hi,
>> See the exception when importing an xml file exported by CDO. Does
>> CDO produce XML it can not import later on?
> That's not the goal :P
>
>> here is a snippet of the produced XML:
>> <feature name="message" value="Could not locate identifier for metric
>> STP_SCPKTSNT. For identifiers: - NODE: arnstp01 - FUNCTION:
>> <=�����, Failed on : - FUNCTION: <=�����"/>
> Hm, is "<" allowed in attribute values?
>
>> That's bizar encoding, this value.
>> This is the code which writes this feature:
>> final StringBuilder sb = new StringBuilder();
>> sb.append("Could not locate networkElement for metric "
>> + metric.getName());
>> sb.append("Using identifiers: ");
>> for (final IComponentLocator.IdentifierDescriptor idValue :
>> identifierValues) {
>> sb.append(" - " +
>> idValue.getKind().getObjectKind().getName()
>> + ": " + idValue.getValue());
>> }
>
> I checked that the exporter uses this to output the XML:
>
> SAXTransformerFactory factory =
> (SAXTransformerFactory)SAXTransformerFactory.newInstance();
> xmlHandler = factory.newTransformerHandler();
>
> So, all needed conversion and escaping should be done there. I'm not
> an expert in XML or SAX. Maybe Ed has an idea...
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>> Anything unusual?
>> org.xml.sax.SAXParseException: Character reference "&#1" is an
>> invalid XML character.
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLScanner.scanCharReferenceValue(XMLScanner.java:1298)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:851)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:1547)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1320)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
>> 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
>> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
>> at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
>> at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
>> at
>> org.eclipse.emf.cdo.server.CDOServerImporter$XML.importAll(CDOServerImporter.java:329)
>> at
>> org.eclipse.emf.cdo.server.CDOServerImporter.importRepository(CDOServerImporter.java:111)
>> at
>> org.eclipse.emf.cdo.internal.server.bundle.CDOCommandProvider.importXML(CDOCommandProvider.java:230)
>> at
>> org.eclipse.emf.cdo.internal.server.bundle.CDOCommandProvider._cdo(CDOCommandProvider.java:110)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:209)
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:155)
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:140)
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:104)
>> at java.lang.Thread.run(Thread.java:662)
>
Re: [CDO] importer Exception [message #1007708 is a reply to message #1007665] Thu, 07 February 2013 08:35 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Thanks,

The snippet of XML, is also decoded by the forum! The '<' is not the problem. In my snippet it's a "&lt;"
The problem occurs on this character "" (As you see in the exception). It's indeed an invalid XML 1.0 control character.

I submitted this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=400182

Cheers Christophe






Previous Topic:[CDO] NPE exporting from CDO
Next Topic:[Teneo] EntityInterfaceNameStrategy not setting Enumerations as expected
Goto Forum:
  


Current Time: Sat Dec 20 01:36:15 GMT 2014

Powered by FUDForum. Page generated in 0.04131 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software