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

[J2SE 1.5] Rdn generates incorrect attributes sometimes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 5.0, 5.0u1
    • core-libs
    • b39
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Class javax.naming.ldap.Rdn generates invalid Attributes object, when containing two RdnEntry 'ies with same type.
      I.e. "cn=commonName1+cn=commonName2".
      Instead of generating Attributes with one BasicAttribute("cn") with two string values ("commonName1","commonName2") it generates Attributes with one BasicAttribute("cn") which also has one value of type BasicAttribute("cn"), and this nested element has two mentioned strings.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      new Rdn("cn = commonName1 + cn = commonName2").toAttributes().toString()


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      {cn=cn: commonName1, commonName2}

      ACTUAL -
      {cn=cn: cn: commonName1, commonName2}


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      This is JUnit test fragment:

        public void testRdnToAttributes() throws InvalidNameException {
          Rdn rdnCnSn = new Rdn("cn = commonName1 + sn = surName2");
          assertEquals("cn=commonName1+sn=surName2", rdnCnSn.toString()); //correct
          assertEquals("{sn=sn: surName2, cn=cn: commonName1}", rdnCnSn.toAttributes().toString()); //correct
          
          Rdn rdnCnCn = new Rdn("cn = commonName1 + cn = commonName2");
          assertEquals("cn=commonName1+cn=commonName2", rdnCnCn.toString()); //correct
          assertEquals("{cn=cn: commonName1, commonName2}", rdnCnCn.toAttributes().toString()); // fail
        }

      ---------- END SOURCE ----------
      ###@###.### 2005-03-23 19:15:36 GMT

            jhangalsunw Jayalaxmi Hangal (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: