Issue 2233: Helper "narrow" exception clarification (java-rtf) Source: (, ) Nature: Uncategorized Issue Severity: Summary: Summary: Referring to 23_java-2_3base.pdf, section 23.11.1, page 23-26, second paragraph, "The IDL exception CORBA::BAD_PARAM is thrown if the narrow fails." This statement can be interpreted in two different ways. Does it mean that BAD_PARAM is thrown no matter what goes wrong in the narrow call, or that BAD_PARAM is thrown only when the parameter doesn"t support the interface being narrowed to? Resolution: The latter. A different exception shall be raised to indicate other errors. Revised Text: In Section 23.12.1 Basics: Replace the last sentence of the 3rd paragraph: The IDL exception CORBA::BAD_PARAM is thrown if the narrow fails. with: The IDL exception CORBA::BAD_PARAM shall be thrown if the narrow fails because the object reference does not support the requested type. A different system exception shall be raised to indicate other kinds of errors. Trying to narrow a null will always succeed with a return value of null. Actions taken: Close, incorporate text Actions taken: December 1, 1998: received issue June 4, 1999: closed issue Discussion: End of Annotations:===== To: java-rtf@omg.org Subject: Helper "narrow" exception clarification From: Rochat Date: Thu, 10 Sep 1998 14:48:21 -0500 (CDT) Cc: mcheng@austin.ibm.com (Michael Cheng), leou@us.ibm.com (Leo Uzcategui) Referring to 23_java-2_3base.pdf, section 23.11.1, page 23-26, second paragraph, "The IDL exception CORBA::BAD_PARAM is thrown if the narrow fails." This statement can be interpreted in two different ways. Does it mean that BAD_PARAM is thrown no matter what goes wrong in the narrow call, or that BAD_PARAM is thrown only when the parameter doesn't support the interface being narrowed to? For example, what should happen if a non-IDL exception occurs, such as getting a java.lang.OutOfMemory when trying to new up a stub? If it is intended that BAD_PARAM be thrown whenever any kind of exception occurs, then I propose that the description be changed to allow other runtime exceptions to be thrown so that significant information is not lost. The difference in implementations is: 1) Throw BAD_PARAM no matter what... public static Foo narrow (org.omg.CORBA.Object obj) { try { // if can't narrow throw BAD_PARAM } catch (Exception e) { throw new BAD_PARAM(); } } 2) throw BAD_PARAM only when the parameter doesn't support the requested interface: public static Foo narrow (org.omg.CORBA.Object obj) { // if can't narrow throw BAD_PARAM } (2) Allows any other IDL System exception or Java Error or RuntimeException to be thrown without modification. Proposed rewording: "If the parameter does not support the narrowed interface, the IDL exception BAD_PARAM is thrown. If some other problem like communications failure or the failure to create a stub for the narrowed object occurs, the corresponding IDL system exception or Java exception is thrown." NOTE: There may be some CORBA "architectural purity" consideration that requires that Java methods in the Java binding throw only IDL exceptions. If this is the case, the specification should to say that non-IDL Java Exceptions (but not Java Errors) are mapped to CORBA::UNKNOWN. 3) In this case, the implementation would be: public static Foo narrow (org.omg.CORBA.Object obj) { try { // if can't narrow throw BAD_PARAM } catch (org.omg.CORBA.SystemException c) { throw c; } catch (java.lang.Exception e) { throw new org.omg.CORBA.UNKNOWN(); } } Since your're never supposed to catch Java Errors (like java.lang.OutOfMemoryException), they can't be mapped to IDL exceptions. ------------------------------- Kim Rochat Component Broker Connector E-Mail: krochat@austin.ibm.com Phone: (512) 823-8792 Tie Line: 793-8792 Return-Path: From: leou@us.ibm.com X-Lotus-FromDomain: IBMUS To: Juergen Boldt cc: krochat@us.ibm.com Date: Thu, 3 Dec 1998 09:55:20 -0600 Subject: Re: issue 2233 -- java RTF issue Content-Disposition: inline Hi Juergen, I would be helpful to the RTF if the issue description in the issues archive included the rest of the comments initially sent to the RTF mail list, it includes suggested clarifying text. It's pasted below. Thanks, Leo For example, what should happen if a non-IDL exception occurs, such as getting a java.lang.OutOfMemory when trying to new up a stub? If it is intended that BAD_PARAM be thrown whenever any kind of exception occurs, then I propose that the description be changed to allow other runtime exceptions to be thrown so that significant information is not lost. The difference in implementations is: 1) Throw BAD_PARAM no matter what... public static Foo narrow (org.omg.CORBA.Object obj) { try { // if can't narrow throw BAD_PARAM } catch (Exception e) { throw new BAD_PARAM(); } } 2) throw BAD_PARAM only when the parameter doesn't support the requested interface: public static Foo narrow (org.omg.CORBA.Object obj) { // if can't narrow throw BAD_PARAM } (2) Allows any other IDL System exception or Java Error or RuntimeException to be thrown without modification. Proposed rewording: "If the parameter does not support the narrowed interface, the IDL exception BAD_PARAM is thrown. If some other problem like communications failure or the failure to create a stub for the narrowed object occurs, the corresponding IDL system exception or Java exception is thrown." NOTE: There may be some CORBA "architectural purity" consideration that requires that Java methods in the Java binding throw only IDL exceptions. If this is the case, the specification should to say that non-IDL Java Exceptions (but not Java Errors) are mapped to CORBA::UNKNOWN. 3) In this case, the implementation would be: public static Foo narrow (org.omg.CORBA.Object obj) { try { // if can't narrow throw BAD_PARAM } catch (org.omg.CORBA.SystemException c) { throw c; } catch (java.lang.Exception e) { throw new org.omg.CORBA.UNKNOWN(); } } Since your're never supposed to catch Java Errors (like java.lang.OutOfMemoryException), they can't be mapped to IDL exceptions. ---------------------------------------------------- Leo Uzcategui, IBM Corp. 11400 Burnet Rd, Austin, TX 78758 (512) 823-9573, Fax: (512) 838-1032 leou@us.ibm.com ---------------------------------------------------- Juergen Boldt on 12/01/98 03:54:22 PM To: issues@omg.org, java-rtf@omg.org cc: (bcc: Leo Uzcategui/Austin/IBM) Subject: issue 2233 -- java RTF issue This is issue # 2233 Helper "narrow" exception clarification >Referring to 23_java-2_3base.pdf, section 23.11.1, page 23-26, second >paragraph, "The IDL exception CORBA::BAD_PARAM is thrown if the narrow >fails." > >This statement can be interpreted in two different ways. Does it mean that >BAD_PARAM is thrown no matter what goes wrong in the narrow call, or that >BAD_PARAM is thrown only when the parameter doesn't support the interface >being narrowed to? > > ================================================================ Juergen Boldt Senior Member of Technical Staff Object Management Group Tel. +1-508-820 4300 ext. 132 Framingham Corporate Center Fax: +1-508-820 4303 492 Old Connecticut Path Email: juergen@omg.org Framingham, MA 01701 ================================================================