Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4824317

Regression: JAXP doesn't handle relative <!ENTITY declarations.

    Details

    • Subcomponent:
    • Introduced In Build:
      1.2.2
    • Introduced In Version:
    • Resolved In Build:
      1.2.3
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      Hello,

      The following is a problem we experience in JavaServer Faces with JWSDP
      1.1. We did not experience this problem with JWSDP 1.0_01.

      I have an two XML files in a jar. Both are in the same directory. The
      first includes the second. We're using Digester to parse the first
      file. Both files are in the jsf-ri.jar:

        prompt> jar -tf jsf-ri.jar | grep xml
        [other xml files deleted from output]
        com/sun/faces/renderkit/html_basic/event-attributes.xml
        com/sun/faces/renderkit/html_basic/HtmlBasicRenderKit.xml

      Here is the relevant Digester code to parse the top file:

          private void loadProperties() {
              renderersByRendererType = new Hashtable();
              renderersByComponentType = new Hashtable();

              String fileName = "com/sun/faces/renderkit/html_basic/HtmlBasicRenderKit.xml";
              InputSource is = null;
      java.net.URL url = null;
              try {
      url = this.getClass().getClassLoader().getResource(fileName);
                  is = new InputSource(url.toExternalForm());
      is.setByteStream(this.getClass().getClassLoader().getResourceAsStream(fileName));
              } catch (Throwable t) {
                  throw new RuntimeException("Error Opening File:"+fileName);
              }
              try {
                  parse_digester.push(this);
                  parse_digester.parse(is);
              } catch (Throwable t) {
      if (null != t) {
      t.printStackTrace();
      }
                  throw new IllegalStateException(
                      "Unable to parse file:"+t.getMessage());
              }
          }

      Note that we're giving the systemId to the Constructor of the
      InputSource.

      Here are truncated versions of the files:

      ----start HtmlBasicRenderKit.xml---
      <?xml version="1.0"?>

      <!--
       Copyright 2003 Sun Microsystems, Inc. All rights reserved.
       SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
      -->

      <!DOCTYPE renderkit [
          ENTITY event-attrs SYSTEM "event-attributes.xml"
      ]>

      <renderkit>

      <!-- Component Type - Renderer Name Mappings -->

          <component>
              <type>javax.faces.component.UICommand</type>
              <renderer>
                  <type>Button</type>
                  <class>com.sun.faces.renderkit.html_basic.ButtonRenderer</class>
                  <attribute>
                      <name>title</name>
                      <display-name>Title</display-name>
                      <description>Tool Tip for this element
                      </description>
                      <type>java.lang.String</type>
                  </attribute>
                  &event-attrs;
              </renderer>
          </component>

      </renderkit>
      ----end HtmlBasicRenderKit.xml---

      ---start event-attributes.xml---
      <?xml encoding='UTF-8'?>

      <!--
       Copyright 2003 Sun Microsystems, Inc. All rights reserved.
       SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
      -->


                  <attribute>
                      <name>onfocus</name>
                      <display-name>On Focus</display-name>
                      <description>The element got the focus.</description>
                      <type>java.lang.String</type>
                  </attribute>
                  <attribute>
                      <name>onblur</name>
                      <display-name>On Blur</display-name>
                      <description>The element lost the focus.</description>
                      <type>java.lang.String</type>
                  </attribute>
      ---end event-attributes.xml

      Here is the exception we get during parsing of the first file:

      java.net.MalformedURLException: no protocol: event-attributes.xml
              at java.net.URL.<init>(URL.java:473)
              at java.net.URL.<init>(URL.java:376)
              at java.net.URL.<init>(URL.java:330)
              at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:881)
              at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:792)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1159)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1577)
              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:346)
              at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:529)
              at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:585)
              at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
              at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1142)
              at org.apache.commons.digester.Digester.parse(Digester.java:1284)
              at com.sun.faces.renderkit.html_basic.HtmlBasicRenderKit.loadProperties(HtmlBasicRenderKit.java:173)
              at com.sun.faces.renderkit.html_basic.HtmlBasicRenderKit.<init>(HtmlBasicRenderKit.java:145)
              at java.lang.Class.newInstance0(Native Method)
              at java.lang.Class.newInstance(Class.java:237)
              at com.sun.faces.renderkit.RenderKitFactoryImpl.getRenderKit(RenderKitFactoryImpl.java:141)
              at com.sun.faces.renderkit.RenderKitFactoryImpl.<init>(RenderKitFactoryImpl.java:59)
              at java.lang.Class.newInstance0(Native Method)
              at java.lang.Class.newInstance(Class.java:237)
              at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:299)
              at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:214)
              at components.renderkit.ComponentsSetupListener.contextInitialized(ComponentsSetupListener.java:97)
              at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3202)
              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3476)
              at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
              at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
              at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
              at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:257)
              at org.apache.catalina.core.StandardHost.install(StandardHost.java:773)
              at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:516)
              at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:410)
              at org.apache.catalina.startup.HostConfig.start(HostConfig.java:882)
              at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)
              at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
              at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1198)
              at org.apache.catalina.core.StandardHost.start(StandardHost.java:739)
              at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1190)
              at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
              at org.apache.catalina.core.StandardService.start(StandardService.java:499)
              at org.apache.catalina.core.StandardServer.start(StandardServer.java:2187)
              at org.apache.catalina.startup.Catalina.start(Catalina.java:504)
              at org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
              at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
              at java.lang.reflect.Method.invoke(Native Method)
              at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
              at java.lang.reflect.Method.invoke(Native Method)
              at org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)

      Can you please help us out on this?

      Thanks,

      Ed

      ###@###.### 2003-02-26
      ###@###.### 2003-02-27

        Attachments

          Activity

            People

            • Assignee:
              nbajajsunw Neeraj Bajaj (Inactive)
              Reporter:
              ejburns Ed Burns (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: