Mon, 06 May 2013 11:41:36 -0700
Merge
1.1 --- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java Thu May 02 13:34:46 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java Mon May 06 11:41:36 2013 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -258,6 +258,19 @@ 1.11 { 1.12 Vector labels = vectorizeLabels (u.branches (), true); 1.13 1.14 + if (Util.javaName(utype).equals ("boolean")) { 1.15 + stream.println( "" ) ; 1.16 + stream.println( " private void verifyDefault (boolean discriminator)" ) ; 1.17 + stream.println( " {" ) ; 1.18 + if (labels.contains ("true")) 1.19 + stream.println (" if ( discriminator )"); 1.20 + else 1.21 + stream.println (" if ( !discriminator )"); 1.22 + stream.println( " throw new org.omg.CORBA.BAD_OPERATION();" ) ; 1.23 + stream.println( " }" ) ; 1.24 + return; 1.25 + } 1.26 + 1.27 stream.println( "" ) ; 1.28 stream.println( " private void verifyDefault( " + Util.javaName(utype) + 1.29 " value )" ) ; 1.30 @@ -763,7 +776,7 @@ 1.31 stream.println (indent + "if (" + disName + ')'); 1.32 1.33 if (firstBranch == null) 1.34 - stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); 1.35 + stream.println (indent + " value._default(" + disName + ");"); 1.36 else { 1.37 stream.println (indent + '{'); 1.38 index = readBranch (index, indent + " ", firstBranch.typedef.name (), 1.39 @@ -774,7 +787,7 @@ 1.40 stream.println (indent + "else"); 1.41 1.42 if (secondBranch == null) 1.43 - stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); 1.44 + stream.println (indent + " value._default(" + disName + ");"); 1.45 else { 1.46 stream.println (indent + '{'); 1.47 index = readBranch (index, indent + " ", secondBranch.typedef.name (), 1.48 @@ -924,23 +937,25 @@ 1.49 firstBranch = secondBranch; 1.50 secondBranch = tmp; 1.51 } 1.52 - stream.println (indent + "if (" + disName + ')'); 1.53 - if (firstBranch == null) 1.54 - stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); 1.55 - else 1.56 - { 1.57 - stream.println (indent + '{'); 1.58 - index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream); 1.59 - stream.println (indent + '}'); 1.60 - } 1.61 - stream.println (indent + "else"); 1.62 - if (secondBranch == null) 1.63 - stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION ();"); 1.64 - else 1.65 - { 1.66 - stream.println (indent + '{'); 1.67 - index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream); 1.68 - stream.println (indent + '}'); 1.69 + if (firstBranch != null && secondBranch != null) { 1.70 + stream.println (indent + "if (" + disName + ')'); 1.71 + stream.println (indent + '{'); 1.72 + index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream); 1.73 + stream.println (indent + '}'); 1.74 + stream.println (indent + "else"); 1.75 + stream.println (indent + '{'); 1.76 + index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream); 1.77 + stream.println (indent + '}'); 1.78 + } else if (firstBranch != null) { 1.79 + stream.println (indent + "if (" + disName + ')'); 1.80 + stream.println (indent + '{'); 1.81 + index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream); 1.82 + stream.println (indent + '}'); 1.83 + } else { 1.84 + stream.println (indent + "if (!" + disName + ')'); 1.85 + stream.println (indent + '{'); 1.86 + index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream); 1.87 + stream.println (indent + '}'); 1.88 } 1.89 } 1.90 return index;