OpenJDK / lambda / lambda / corba
changeset 498:846aaf02e516
8011986: [corba] idlj generates read/write union helper methods that throw wrong exception in some cases
Reviewed-by: lancea
author | dmeetry |
---|---|
date | Mon, 29 Apr 2013 16:51:32 +0400 |
parents | 8f0a461776a9 |
children | 1afaac54768e ed59110eecdb |
files | src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java |
diffstat | 1 files changed, 21 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java Mon Apr 29 16:44:32 2013 +0400 +++ b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java Mon Apr 29 16:51:32 2013 +0400 @@ -776,7 +776,7 @@ stream.println (indent + "if (" + disName + ')'); if (firstBranch == null) - stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); + stream.println (indent + " value._default(" + disName + ");"); else { stream.println (indent + '{'); index = readBranch (index, indent + " ", firstBranch.typedef.name (), @@ -787,7 +787,7 @@ stream.println (indent + "else"); if (secondBranch == null) - stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); + stream.println (indent + " value._default(" + disName + ");"); else { stream.println (indent + '{'); index = readBranch (index, indent + " ", secondBranch.typedef.name (), @@ -937,23 +937,25 @@ firstBranch = secondBranch; secondBranch = tmp; } - stream.println (indent + "if (" + disName + ')'); - if (firstBranch == null) - stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); - else - { - stream.println (indent + '{'); - index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream); - stream.println (indent + '}'); - } - stream.println (indent + "else"); - if (secondBranch == null) - stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); - else - { - stream.println (indent + '{'); - index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream); - stream.println (indent + '}'); + if (firstBranch != null && secondBranch != null) { + stream.println (indent + "if (" + disName + ')'); + stream.println (indent + '{'); + index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream); + stream.println (indent + '}'); + stream.println (indent + "else"); + stream.println (indent + '{'); + index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream); + stream.println (indent + '}'); + } else if (firstBranch != null) { + stream.println (indent + "if (" + disName + ')'); + stream.println (indent + '{'); + index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream); + stream.println (indent + '}'); + } else { + stream.println (indent + "if (!" + disName + ')'); + stream.println (indent + '{'); + index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream); + stream.println (indent + '}'); } } return index;