JDK-4906555 : Exception thrown while instantiating PagedResultsResponseControl
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.naming
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2003-08-14
  • Updated: 2003-09-10
  • Resolved: 2003-09-10
Related Reports
Relates :  
Description
After the migration of few LDAP controls (Bug id -4634457) from LDAP booster pack to java extenstion packages, following instantiations are throwing exception.

  1. new PagedResultsResponseControl(PagedResultsResponseControl.OID,
     				Control.CRITICAL, emptyBerString)

      	Exception : 

	com.sun.jndi.ldap.Ber$DecodeException: Insufficient data
		at com.sun.jndi.ldap.BerDecoder.parseByte(BerDecoder.java:120)
		at com.sun.jndi.ldap.BerDecoder.parseSeq(BerDecoder.java:94)
		at javax.naming.ldap.PagedResultsResponseControl.<init> 						(PagedResultsResponseControl.java:86)
		at BindControlObjects.run(BindControlObjects.java:95)
		at TestUtils.runTest(TestUtils.java:61)
		at TestUtils.runTest(TestUtils.java:44)
		at BindControlObjects.main(BindControlObjects.java:61)
	
   
   2. new SortResponseControl(SortResponseControl.OID,
		    Control.CRITICAL, emptyBerString)

     	Exception : 

	com.sun.jndi.ldap.Ber$DecodeException: Insufficient data
		at com.sun.jndi.ldap.BerDecoder.parseByte(BerDecoder.java:120)
		at com.sun.jndi.ldap.BerDecoder.parseSeq(BerDecoder.java:94)
		at javax.naming.ldap.SortResponseControl.<init> 								(SortResponseControl.java:105)
		at BindControlObjects.run(BindControlObjects.java:95)
		at TestUtils.runTest(TestUtils.java:61)
		at TestUtils.runTest(TestUtils.java:44)
		at BindControlObjects.main(BindControlObjects.java:61)

Comments
EVALUATION The test case (<jndi_ws>/testjndi/ldap/tests/NONBLITS/ObjectTets/BindControlObjects.java) tries to instantiate PagedResultsResponseControl class by passing an empty byte array as the value for ASN.1 BER encoded value, which is not valid. new PagedResultsResponseControl(PagedResultsResponseControl.OID, Control.CRITICAL, emptyBerString) In a valid scenario, the LDAP service provider instantiate this by passing appropriate value and the client can retrieve the response controls by calling ctx.getResponseControls() and type casting it into the appropriate controls. Same explanation holds good for SortResponseControl too. This is one of the change happened in XXXResponseControl classes when migrated from com.sun.jndi.ldap.ctl package to javax.naming.ldap. Earlier it used to accept empty byte array as the value for ASN.1 BER encoded value but not anymore (after migration). So, the corresponding test case needs to be updated in order to avoid its failure.
02-09-2004

WORK AROUND Use the same controls available in LDAP Booster pack
02-09-2004

PUBLIC COMMENTS This is not a bug.
02-09-2004