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

DocumentBuilder.getSecureProcessing() returns null instead of reference

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b30
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Name: inR10064 Date: 11/07/2003



        The method
             javax.xml.parsers.DocumentBuilder.getSecureProcessing()

        returns null while the DocumentBuilderFactory is set with SecureProcessing
        object and the SecureProcessingState is set to true (see the code sample below).
        The SecureProcessing object set for the Factory is expected to be returned.

        Note that null is returned also in cases when
            setSecureProcessingState(false)

        is invoked for the DocumentBuilderFactory and when SecureProcessingState isn't set.

        The bug affects new tests in JCK 1.5 (not yet integrated):
          api/javax_xml/parsers/DocumentBuilder/index.html#SecureProcessing[GetSecureProcessing004]
          api/javax_xml/parsers/DocumentBuilder/index.html#SecureProcessing[GetSecureProcessing005]
          api/javax_xml/parsers/DocumentBuilder/index.html#SecureProcessing[GetSecureProcessing006]

        The bug found in the JDK 1.5.0-beta-b26.

        --------------------------------------------------------------------------
        package tests;

        import javax.xml.SecureProcessing;
        import javax.xml.parsers.DocumentBuilder;
        import javax.xml.parsers.DocumentBuilderFactory;
        import javax.xml.parsers.ParserConfigurationException;


        public class GetSecureProcessing005 {

            public static void main(String argv[]) {
                DocumentBuilderFactory docBFactory = DocumentBuilderFactory.newInstance();

                // no SecureProcessing Object set for DocumentBuilderFactory by default
                SecureProcessing securePr = new SecureProcessing();
                docBFactory.setSecureProcessing(securePr);
                docBFactory.setSecureProcessingState(true);

                DocumentBuilder docBuilder = null;
                try {
                    docBuilder = docBFactory.newDocumentBuilder();
                } catch (ParserConfigurationException pce) {
                    System.out.println(pce.toString());
        return;
                }

                SecureProcessing getSP = docBuilder.getSecureProcessing();
                if (getSP != securePr) {
                    System.out.println("Returns "+ getSP +" instead of "+ securePr);
                } else {
                    System.out.println("OK");
                }
            }
        }


        --------------------------------------------------------------------------
        % java -showversion tests.GetSecureProcessing005
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b26)
        Java HotSpot(TM) Client VM (build 1.5.0-beta-b26, mixed mode)

        Returns null instead of javax.xml.SecureProcessing@10ef90c

        --------------------------------------------------------------------------

        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                kkawagucsunw Kohsuke Kawaguchi (Inactive)
                Reporter:
                inevsunw Inev Inev (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: