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

SecureProcessing: limits can be set to 0 or negative

XMLWordPrintable

    • b36
    • generic
    • generic
    • Verified

        Name: inR10064 Date: 12/30/2003


        Methods
           javax.xml.SecureProcessing.setEntityExpansionLimit(int limit)
           javax.xml.SecureProcessing.setMaxOccurNodeLimit(int limit)

        do not throw IllegalArgumentException when the limit is set to 0 or negative value.
        The IllegalArgumentException should be thrown according to the javadoc. See the
        sample code and log provided below.

        The bug affects new tests in JCK 1.5 (not yet integrated):
          api/javax_xml/SecureProcessing/index.html#EntityExpansionLimit[SetEEL_101]
          api/javax_xml/SecureProcessing/index.html#EntityExpansionLimit[SetEEL_102]
          api/javax_xml/SecureProcessing/index.html#EntityExpansionLimit[SetEEL_151]
          api/javax_xml/SecureProcessing/index.html#EntityExpansionLimit[SetEEL_152]
          api/javax_xml/SecureProcessing/index.html#MaxOccurNodeLimit[SetMNL_101]
          api/javax_xml/SecureProcessing/index.html#MaxOccurNodeLimit[SetMNL_102]
          api/javax_xml/SecureProcessing/index.html#MaxOccurNodeLimit[SetMNL_151]
          api/javax_xml/SecureProcessing/index.html#MaxOccurNodeLimit[SetMNL_152]

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

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

        import javax.xml.SecureProcessing;

        public class IAE001 {
            public static void main(String argv[]) {
                SecureProcessing securePr = new SecureProcessing();
                try {
                    securePr.setEntityExpansionLimit(0);
                    System.out.println("Fail: "+ securePr.getEntityExpansionLimit());
                } catch (IllegalArgumentException e) {
                    System.out.println("OK: "+ e);
                }
                try {
                    securePr.setEntityExpansionLimit(-10);
                    System.out.println("Fail: "+ securePr.getEntityExpansionLimit());
                } catch (IllegalArgumentException e) {
                    System.out.println("OK: "+ e);
                }
                try {
                    securePr.setMaxOccurNodeLimit(0);
                    System.out.println("Fail: "+ securePr.getMaxOccurNodeLimit());
                } catch (IllegalArgumentException e) {
                    System.out.println("OK: "+ e);
                }
                try {
                    securePr.setMaxOccurNodeLimit(-20);
                    System.out.println("Fail: "+ securePr.getMaxOccurNodeLimit());
                } catch (IllegalArgumentException e) {
                    System.out.println("OK: "+ e);
                }
            }
        }
        --------------------------------------------------------------------------
        % java -showversion tests.IAE001
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32)
        Java HotSpot(TM) Server VM (build 1.5.0-beta-b32, mixed mode)

        Fail: 0
        Fail: -10
        Fail: 0
        Fail: -20

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

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

              jsuttorsunw Jeff Suttor (Inactive)
              inevsunw Inev Inev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: