You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Dick Deneer <di...@donkeydevelopment.com> on 2010/01/14 11:56:37 UTC

XMLCatalogResolver

I have a strange problem using an XMLCatalogResolver.
I am using a catalog with relative paths like po.xsd. If I run the  
program with java 1.6 everything goes well.
But when I am running in Mac OS X with java 1.5, the program hangs  
somewhere in the parsing.
It has something to do with the opening of the URL inputstream. In  
java 1.5 it is using a URL in the form of file://Applications/..
This is not a valid URL. In java 1.6 the URL is file://// 
Applications/.. and the problem does not occur.  I will try to find  
out some more details and then will  submit a example program with  
this behaviour.  But maybe someone recognizes this problem already  
and give me some hints.
I using xerces version 2.9.1.

Regards
Dick Deneer


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: XMLCatalogResolver

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Whatever is causing it to "hang" is within the JDK's java.net
implementation. Not something that Xerces has any control over. If you're
able to adjust the timeout settings for the JVM I'd suggest trying that.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Dick Deneer <di...@donkeydevelopment.com> wrote on 01/14/2010
11:54:03 AM:

> Sorry I made one mistake:
> URL location = new URL("file://Applications/po.xsd")
> does  not throw an exception.
> I throws an exception only when you create a File from it:
> location = new URL("file://Applications/po.xsd");
> File f = new File(location.toURI())
> Exception in thread "main" java.lang.IllegalArgumentException: URI
> has an authority component
> at java.io.File.<init>(File.java:340)
> at SaxParser2.main(SaxParser2.java:174)
>
> and when u use it in a connect.getInputStream it throws  a
> java.net.UnknownHostException
> So still I wonder why it hangs in the XMLEntityManager.
> Maybe it has something to do with timeoutsettings.
>
> Dick Deneer
>
> Op 14 jan 2010, om 16:54 heeft Dick Deneer het volgende geschreven:
>
> I got a little bit further.
> My entittyresolver gives back a XMLInputSource witj the following
properties:
> fBaseSystemId = "file:///Users/dickdeneer/Documents/workspace/
> Tester/xml/po.xml"
> fSystemId=fSystemId "file://Applications/po.xsd"
>
> It turns out that the programs hangs for about 1 minute in the statement
> stream = connect.getInputStream();
> And because this is happening for the complete document this code is
> called many times.
>
> Stacktrace:
>
> XMLEntityManager.setupCurrentEntity(String, XMLInputSource, boolean,
> boolean) line: 962
> XMLVersionDetector.determineDocVersion(XMLInputSource) line: 143
> SchemaParsingConfig.parse(boolean) line: 551
> SchemaParsingConfig.parse(XMLInputSource) line: 654
> SchemaDOMParser.parse(XMLInputSource) line: 523
> XSDHandler.getSchemaDocument(String, XMLInputSource, boolean, short,
> Element) line: 1800
> XSDHandler.parseSchema(XMLInputSource, XSDDescription, Hashtable) line:
521
> XMLSchemaLoader.loadSchema(XSDDescription, XMLInputSource,
> Hashtable) line: 554
> XMLSchemaValidator.findSchemaGrammar(short, String, QName, QName,
> XMLAttributes) line: 2526
> XMLSchemaValidator.handleStartElement(QName, XMLAttributes,
> Augmentations) line: 1814
> XMLSchemaValidator.startElement(QName, XMLAttributes, Augmentations)line:
724
> DOMNormalizer.normalizeNode(Node) line: 400
> DOMNormalizer.normalizeDocument(CoreDocumentImpl,
> DOMConfigurationImpl) line: 247
> PSVIDocumentImpl(CoreDocumentImpl).normalizeDocument() line: 1147
> DomHandler.validateXML() line: 929
> DomHandler.validate() line: 469
> DocumentModel.validateXML(boolean) line: 579
> XMLSource.validateXML() line: 874
> ValidateAction.actionPerformed(ActionEvent) line: 147
> JToggleButton(AbstractButton).fireActionPerformed(ActionEvent) line: 1882
> AbstractButton$Handler.actionPerformed(ActionEvent) line: 2202
> JToggleButton$ToggleButtonModel
> (DefaultButtonModel).fireActionPerformed(ActionEvent) line: 420
> JToggleButton$ToggleButtonModel.setPressed(boolean) line: 269
> CUIAquaButton$CUIAquaButtonListener
> (BasicButtonListener).mouseReleased(MouseEvent) line: 236
> AWTEventMulticaster.mouseReleased(MouseEvent) line: 231
> JToggleButton(Component).processMouseEvent(MouseEvent) line: 5602
> JToggleButton(JComponent).processMouseEvent(MouseEvent) line: 3129
> JToggleButton(Component).processEvent(AWTEvent) line: 5367
> JToggleButton(Container).processEvent(AWTEvent) line: 2010
> JToggleButton(Component).dispatchEventImpl(AWTEvent) line: 4068
> JToggleButton(Container).dispatchEventImpl(AWTEvent) line: 2068
> JToggleButton(Component).dispatchEvent(AWTEvent) line: 3903
> LightweightDispatcher.retargetMouseEvent(Component, int, MouseEvent)
> line: 4256
> LightweightDispatcher.processMouseEvent(MouseEvent) line: 3936
> LightweightDispatcher.dispatchEvent(AWTEvent) line: 3866
> Frame(Container).dispatchEventImpl(AWTEvent) line: 2054
> Frame(Window).dispatchEventImpl(AWTEvent) line: 1801
> Frame(Component).dispatchEvent(AWTEvent) line: 3903
> MyEventQueue(EventQueue).dispatchEvent(AWTEvent) line: 463
> MyEventQueue.dispatchEvent(AWTEvent) line: 26
> EventDispatchThread.pumpOneEventForHierarchy(int, Component) line: 269
> EventDispatchThread.pumpEventsForHierarchy(int, Conditional,
> Component) line: 190
> EventDispatchThread.pumpEvents(int, Conditional) line: 184
> EventDispatchThread.pumpEvents(Conditional) line: 176
> EventDispatchThread.run() line: 110
>
> This is the relevant coding:
>   public String setupCurrentEntity(String name, XMLInputSource
xmlInputSource,
>                 boolean literal, boolean isExternal)
>             throws IOException, XNIException {
>         // get information
>
>         final String publicId = xmlInputSource.getPublicId();
>         String literalSystemId = xmlInputSource.getSystemId(););
>         String baseSystemId = xmlInputSource.getBaseSystemId();;
>         String encoding = xmlInputSource.getEncoding();
>         final boolean encodingExternallySpecified = (encoding != null);
>         Boolean isBigEndian = null;
>         fTempByteBuffer = null;
>
>         // create reader
>         InputStream stream = null;;
>         Reader reader = xmlInputSource.getCharacterStream();
>         // First chance checking strict URI
>         String expandedSystemId = expandSystemId(literalSystemId,
> baseSystemId, fStrictURI);
>         if (baseSystemId == null) {
>             baseSystemId = expandedSystemId;
>         }
>         if (reader == null) {
>             stream = xmlInputSource.getByteStream();
>             if (stream == null) {
>                 URL location = new URL(expandedSystemId); ==>
> file://Applications/po.xsd
>                 URLConnection connect = location.openConnection();
>                 if (!(connect instanceof HttpURLConnection)) {
>                     stream = connect.getInputStream();   ==> here it
> hangs for a very long time
>
> But I do not understand why the  URL location = new URL("file://
> Applications/po.xsd") does not throw a MalformedURLException URL
exception.
> Because that happens when I try it in a small testprogram.
>
> Regards,
> Dick Deneer
>
> Op 14 jan 2010, om 11:56 heeft Dick Deneer het volgende geschreven:
>
> I have a strange problem using an XMLCatalogResolver.
> I am using a catalog with relative paths like po.xsd. If I run the
> program with java 1.6 everything goes well.
> But when I am running in Mac OS X with java 1.5, the program hangs
> somewhere in the parsing.
> It has something to do with the opening of the URL inputstream. In
> java 1.5 it is using a URL in the form of file://Applications/..
> This is not a valid URL. In java 1.6 the URL is file:////Applications/
> .. and the problem does not occur.  I will try to find out some more
> details and then will  submit a example program with this behaviour.
> But maybe someone recognizes this problem already and give me some hints.
> I using xerces version 2.9.1.
>
> Regards
> Dick Deneer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Re: XMLCatalogResolver

Posted by Dick Deneer <di...@donkeydevelopment.com>.
Sorry I made one mistake:
> URL location = new URL("file://Applications/po.xsd")
does  not throw an exception.
I throws an exception only when you create a File from it:
location = new URL("file://Applications/po.xsd");
File f = new File(location.toURI())
Exception in thread "main" java.lang.IllegalArgumentException: URI has  
an authority component
	at java.io.File.<init>(File.java:340)
	at SaxParser2.main(SaxParser2.java:174)

and when u use it in a connect.getInputStream it throws  a  
java.net.UnknownHostException
So still I wonder why it hangs in the XMLEntityManager.
Maybe it has something to do with timeoutsettings.

Dick Deneer





Op 14 jan 2010, om 16:54 heeft Dick Deneer het volgende geschreven:

> I got a little bit further.
> My entittyresolver gives back a XMLInputSource witj the following  
> properties:
> fBaseSystemId =	"file:///Users/dickdeneer/Documents/workspace/Tester/xml/po.xml 
> "
> fSystemId=fSystemId	"file://Applications/po.xsd"
>
>
>
> It turns out that the programs hangs for about 1 minute in the  
> statement  stream = connect.getInputStream();
> And because this is happening for the complete document this code is  
> called many times.
>
>
> Stacktrace:
>
> XMLEntityManager.setupCurrentEntity(String, XMLInputSource, boolean,  
> boolean) line: 962	
> XMLVersionDetector.determineDocVersion(XMLInputSource) line: 143	
> SchemaParsingConfig.parse(boolean) line: 551	
> SchemaParsingConfig.parse(XMLInputSource) line: 654	
> SchemaDOMParser.parse(XMLInputSource) line: 523	
> XSDHandler.getSchemaDocument(String, XMLInputSource, boolean, short,  
> Element) line: 1800	
> XSDHandler.parseSchema(XMLInputSource, XSDDescription, Hashtable)  
> line: 521	
> XMLSchemaLoader.loadSchema(XSDDescription, XMLInputSource,  
> Hashtable) line: 554	
> XMLSchemaValidator.findSchemaGrammar(short, String, QName, QName,  
> XMLAttributes) line: 2526	
> XMLSchemaValidator.handleStartElement(QName, XMLAttributes,  
> Augmentations) line: 1814	
> XMLSchemaValidator.startElement(QName, XMLAttributes, Augmentations)  
> line: 724	
> DOMNormalizer.normalizeNode(Node) line: 400	
> DOMNormalizer.normalizeDocument(CoreDocumentImpl,  
> DOMConfigurationImpl) line: 247	
> PSVIDocumentImpl(CoreDocumentImpl).normalizeDocument() line: 1147	
> DomHandler.validateXML() line: 929	
> DomHandler.validate() line: 469	
> DocumentModel.validateXML(boolean) line: 579	
> XMLSource.validateXML() line: 874	
> ValidateAction.actionPerformed(ActionEvent) line: 147	
> JToggleButton(AbstractButton).fireActionPerformed(ActionEvent) line:  
> 1882	
> AbstractButton$Handler.actionPerformed(ActionEvent) line: 2202	
> JToggleButton 
> $ 
> ToggleButtonModel 
> (DefaultButtonModel).fireActionPerformed(ActionEvent) line: 420	
> JToggleButton$ToggleButtonModel.setPressed(boolean) line: 269	
> CUIAquaButton 
> $ 
> CUIAquaButtonListener(BasicButtonListener).mouseReleased(MouseEvent)  
> line: 236	
> AWTEventMulticaster.mouseReleased(MouseEvent) line: 231	
> JToggleButton(Component).processMouseEvent(MouseEvent) line: 5602	
> JToggleButton(JComponent).processMouseEvent(MouseEvent) line: 3129	
> JToggleButton(Component).processEvent(AWTEvent) line: 5367	
> JToggleButton(Container).processEvent(AWTEvent) line: 2010	
> JToggleButton(Component).dispatchEventImpl(AWTEvent) line: 4068	
> JToggleButton(Container).dispatchEventImpl(AWTEvent) line: 2068	
> JToggleButton(Component).dispatchEvent(AWTEvent) line: 3903	
> LightweightDispatcher.retargetMouseEvent(Component, int, MouseEvent)  
> line: 4256	
> LightweightDispatcher.processMouseEvent(MouseEvent) line: 3936	
> LightweightDispatcher.dispatchEvent(AWTEvent) line: 3866	
> Frame(Container).dispatchEventImpl(AWTEvent) line: 2054	
> Frame(Window).dispatchEventImpl(AWTEvent) line: 1801	
> Frame(Component).dispatchEvent(AWTEvent) line: 3903	
> MyEventQueue(EventQueue).dispatchEvent(AWTEvent) line: 463	
> MyEventQueue.dispatchEvent(AWTEvent) line: 26	
> EventDispatchThread.pumpOneEventForHierarchy(int, Component) line:  
> 269	
> EventDispatchThread.pumpEventsForHierarchy(int, Conditional,  
> Component) line: 190	
> EventDispatchThread.pumpEvents(int, Conditional) line: 184	
> EventDispatchThread.pumpEvents(Conditional) line: 176	
> EventDispatchThread.run() line: 110	
>
> This is the relevant coding:
>   public String setupCurrentEntity(String name, XMLInputSource  
> xmlInputSource,
>                 boolean literal, boolean isExternal)
>             throws IOException, XNIException {
>         // get information
>
>         final String publicId = xmlInputSource.getPublicId();
>         String literalSystemId = xmlInputSource.getSystemId();
>         String baseSystemId = xmlInputSource.getBaseSystemId();
>         String encoding = xmlInputSource.getEncoding();
>         final boolean encodingExternallySpecified = (encoding !=  
> null);
>         Boolean isBigEndian = null;
>         fTempByteBuffer = null;
>
>         // create reader
>         InputStream stream = null;
>         Reader reader = xmlInputSource.getCharacterStream();
>         // First chance checking strict URI
>         String expandedSystemId = expandSystemId(literalSystemId,  
> baseSystemId, fStrictURI);
>         if (baseSystemId == null) {
>             baseSystemId = expandedSystemId;
>         }
>         if (reader == null) {
>             stream = xmlInputSource.getByteStream();
>             if (stream == null) {
>                 URL location = new URL(expandedSystemId); ==> file://Applications/po.xsd
>                 URLConnection connect = location.openConnection();
>                 if (!(connect instanceof HttpURLConnection)) {
>                     stream = connect.getInputStream();   ==> here it  
> hangs for a very long time
>
> But I do not understand why the  URL location = new URL("file://Applications/po.xsd 
> ") does not throw a MalformedURLException URL exception.
> Because that happens when I try it in a small testprogram.
>
> Regards,
> Dick Deneer
> 	
>
>
> Op 14 jan 2010, om 11:56 heeft Dick Deneer het volgende geschreven:
>
>> I have a strange problem using an XMLCatalogResolver.
>> I am using a catalog with relative paths like po.xsd. If I run the  
>> program with java 1.6 everything goes well.
>> But when I am running in Mac OS X with java 1.5, the program hangs  
>> somewhere in the parsing.
>> It has something to do with the opening of the URL inputstream. In  
>> java 1.5 it is using a URL in the form of file://Applications/..
>> This is not a valid URL. In java 1.6 the URL is file:////Applications/ 
>> .. and the problem does not occur.  I will try to find out some  
>> more details and then will  submit a example program with this  
>> behaviour.  But maybe someone recognizes this problem already and  
>> give me some hints.
>> I using xerces version 2.9.1.
>>
>> Regards
>> Dick Deneer
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: j-users-help@xerces.apache.org
>>
>


Re: XMLCatalogResolver

Posted by Dick Deneer <di...@donkeydevelopment.com>.
I got a little bit further.
My entittyresolver gives back a XMLInputSource witj the following  
properties:
fBaseSystemId =	"file:///Users/dickdeneer/Documents/workspace/Tester/xml/po.xml 
"
fSystemId=fSystemId	"file://Applications/po.xsd"



It turns out that the programs hangs for about 1 minute in the  
statement  stream = connect.getInputStream();
And because this is happening for the complete document this code is  
called many times.


Stacktrace:

XMLEntityManager.setupCurrentEntity(String, XMLInputSource, boolean,  
boolean) line: 962	
XMLVersionDetector.determineDocVersion(XMLInputSource) line: 143	
SchemaParsingConfig.parse(boolean) line: 551	
SchemaParsingConfig.parse(XMLInputSource) line: 654	
SchemaDOMParser.parse(XMLInputSource) line: 523	
XSDHandler.getSchemaDocument(String, XMLInputSource, boolean, short,  
Element) line: 1800	
XSDHandler.parseSchema(XMLInputSource, XSDDescription, Hashtable)  
line: 521	
XMLSchemaLoader.loadSchema(XSDDescription, XMLInputSource, Hashtable)  
line: 554	
XMLSchemaValidator.findSchemaGrammar(short, String, QName, QName,  
XMLAttributes) line: 2526	
XMLSchemaValidator.handleStartElement(QName, XMLAttributes,  
Augmentations) line: 1814	
XMLSchemaValidator.startElement(QName, XMLAttributes, Augmentations)  
line: 724	
DOMNormalizer.normalizeNode(Node) line: 400	
DOMNormalizer.normalizeDocument(CoreDocumentImpl,  
DOMConfigurationImpl) line: 247	
PSVIDocumentImpl(CoreDocumentImpl).normalizeDocument() line: 1147	
DomHandler.validateXML() line: 929	
DomHandler.validate() line: 469	
DocumentModel.validateXML(boolean) line: 579	
XMLSource.validateXML() line: 874	
ValidateAction.actionPerformed(ActionEvent) line: 147	
JToggleButton(AbstractButton).fireActionPerformed(ActionEvent) line:  
1882	
AbstractButton$Handler.actionPerformed(ActionEvent) line: 2202	
JToggleButton 
$ 
ToggleButtonModel(DefaultButtonModel).fireActionPerformed(ActionEvent)  
line: 420	
JToggleButton$ToggleButtonModel.setPressed(boolean) line: 269	
CUIAquaButton 
$CUIAquaButtonListener(BasicButtonListener).mouseReleased(MouseEvent)  
line: 236	
AWTEventMulticaster.mouseReleased(MouseEvent) line: 231	
JToggleButton(Component).processMouseEvent(MouseEvent) line: 5602	
JToggleButton(JComponent).processMouseEvent(MouseEvent) line: 3129	
JToggleButton(Component).processEvent(AWTEvent) line: 5367	
JToggleButton(Container).processEvent(AWTEvent) line: 2010	
JToggleButton(Component).dispatchEventImpl(AWTEvent) line: 4068	
JToggleButton(Container).dispatchEventImpl(AWTEvent) line: 2068	
JToggleButton(Component).dispatchEvent(AWTEvent) line: 3903	
LightweightDispatcher.retargetMouseEvent(Component, int, MouseEvent)  
line: 4256	
LightweightDispatcher.processMouseEvent(MouseEvent) line: 3936	
LightweightDispatcher.dispatchEvent(AWTEvent) line: 3866	
Frame(Container).dispatchEventImpl(AWTEvent) line: 2054	
Frame(Window).dispatchEventImpl(AWTEvent) line: 1801	
Frame(Component).dispatchEvent(AWTEvent) line: 3903	
MyEventQueue(EventQueue).dispatchEvent(AWTEvent) line: 463	
MyEventQueue.dispatchEvent(AWTEvent) line: 26	
EventDispatchThread.pumpOneEventForHierarchy(int, Component) line: 269	
EventDispatchThread.pumpEventsForHierarchy(int, Conditional,  
Component) line: 190	
EventDispatchThread.pumpEvents(int, Conditional) line: 184	
EventDispatchThread.pumpEvents(Conditional) line: 176	
EventDispatchThread.run() line: 110	

This is the relevant coding:
   public String setupCurrentEntity(String name, XMLInputSource  
xmlInputSource,
                 boolean literal, boolean isExternal)
             throws IOException, XNIException {
         // get information

         final String publicId = xmlInputSource.getPublicId();
         String literalSystemId = xmlInputSource.getSystemId();
         String baseSystemId = xmlInputSource.getBaseSystemId();
         String encoding = xmlInputSource.getEncoding();
         final boolean encodingExternallySpecified = (encoding != null);
         Boolean isBigEndian = null;
         fTempByteBuffer = null;

         // create reader
         InputStream stream = null;
         Reader reader = xmlInputSource.getCharacterStream();
         // First chance checking strict URI
         String expandedSystemId = expandSystemId(literalSystemId,  
baseSystemId, fStrictURI);
         if (baseSystemId == null) {
             baseSystemId = expandedSystemId;
         }
         if (reader == null) {
             stream = xmlInputSource.getByteStream();
             if (stream == null) {
                 URL location = new URL(expandedSystemId); ==> file://Applications/po.xsd
                 URLConnection connect = location.openConnection();
                 if (!(connect instanceof HttpURLConnection)) {
                     stream = connect.getInputStream();   ==> here it  
hangs for a very long time

But I do not understand why the  URL location = new URL("file://Applications/po.xsd 
") does not throw a MalformedURLException URL exception.
Because that happens when I try it in a small testprogram.

Regards,
Dick Deneer
	


Op 14 jan 2010, om 11:56 heeft Dick Deneer het volgende geschreven:

> I have a strange problem using an XMLCatalogResolver.
> I am using a catalog with relative paths like po.xsd. If I run the  
> program with java 1.6 everything goes well.
> But when I am running in Mac OS X with java 1.5, the program hangs  
> somewhere in the parsing.
> It has something to do with the opening of the URL inputstream. In  
> java 1.5 it is using a URL in the form of file://Applications/..
> This is not a valid URL. In java 1.6 the URL is file://// 
> Applications/.. and the problem does not occur.  I will try to find  
> out some more details and then will  submit a example program with  
> this behaviour.  But maybe someone recognizes this problem already  
> and give me some hints.
> I using xerces version 2.9.1.
>
> Regards
> Dick Deneer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>