JDK-4233980 : Error in getResource methods of BeanContextSupport
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 1999-04-29
  • Updated: 2002-04-27
  • Resolved: 2002-04-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.1 hopperFixed
Related Reports
Relates :  
Description
Name dk106046 Date: Dec-10-2001

Suggested fix submitted from IBM.  Looking to get the fix into next cycle for 1.4.
=============================================================================

Name: vi73552			Date: 04/29/99


The getResourceAsStream and getResource method in
BeanContextSupport both implement a check whether
the BeanContextChild (bcc) making the request is contained 
in the context or not. This is done by calling the containsValue
method of the HashMap which contains the children and
passing bcc as the argument.
But the HashMap only contains instances of BCSChild as
values, so this will always fail resulting in an
IllegalArgumentException.
(Review ID: 57016) 

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: hopper FIXED IN: hopper INTEGRATED IN: hopper
14-06-2004

SUGGESTED FIX **Workaround: The workaround is to overrise the behaviour of the getResrouce and getResourceAsStream functions of the BeanContextSupport, in the user code. ** Suggested Fix Compare: (<)T:\cn130-20010925\src\classes\sov\java\beans\beancontext\BeanContextSupport.java (42346l bytes) with: (>)E:\cn130-userlvl\src\classes\sov\java\beans\beancontext\BeanContextSupport.java (42582l bytes) 366a366 > 650,651c651,654 < synchronized(children) { < isChild = children.containsValue(bcc); --- > > synchronized(children) { > //isChild = children.containsValue(bcc); //ibm@38181 > isChild = children.containsKey(bcc); //ibm@38181 676c679,680 < isChild = children.containsValue(bcc); --- > //isChild = children.containsValue(bcc); //ibm@38181 > isChild = children.containsKey(bcc); //ibm@38181 **Test Case and Failure Data: import java.beans.beancontext.*; import java.io.*; public class Example1 { private static BeanContextSupport context = new BeanContextSupport(); // The BeanContext private static BeanContextChildSupport bean = new BeanContextChildSupport(); // The JavaBean private static String fname = "Readme.txt"; public static void main(String[] args) { // Add the bean to the context System.out.println("Adding bean to context..."); context.add(bean); report(); } private static void report() { try { InputStream s = context.getResourceAsStream(fname,bean); } catch (Exception e) { System.out.println("Exception:"+e); } } } **How root cause of failure was determined IllegalArgumentException ("not a valid child") is thrown.
11-06-2004

EVALUATION It's too late to get this fix into 1.4.0 but we can try to get it into 1.4.1 ###@###.### 2002-01-14
14-01-2002