[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-j-user
Subject:    Re: XMLCatalogResolver
From:       Michael Glavassevich <mrglavas () ca ! ibm ! com>
Date:       2010-01-14 17:10:00
Message-ID: OFB5932436.7ED59370-ON852576AB.005D27F8-852576AB.005E4D4B () ca ! ibm ! com
[Download RAW message or body]

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 <dick.deneer@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
[Attachment #3 (text/html)]

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



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic