src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java

Print this page




2172                         break;
2173                     }
2174                 default:
2175                     throw wrapper.illegalUnionDiscriminatorType() ;
2176                 }
2177 
2178                 // using the value of the tag, find out the type of the value
2179                 // following.
2180 
2181                 int labelIndex;
2182                 for (labelIndex = 0; labelIndex < _unionLabels.length; labelIndex++) {
2183                     // use equality over anys
2184                     if (tagValue.equal(_unionLabels[labelIndex])) {
2185                         _memberTypes[labelIndex].copy(src, dst);
2186                         break;
2187                     }
2188                 }
2189 
2190                 if (labelIndex == _unionLabels.length) {
2191                     // check if label has not been found
2192                     if (_defaultIndex == -1)
2193                         // throw exception if default was not expected
2194                         throw wrapper.unexpectedUnionDefault() ;
2195                     else
2196                         // must be of the default branch type
2197                         _memberTypes[_defaultIndex].copy(src, dst);
2198                 }
2199                 break;
2200             }
2201 
2202         case TCKind._tk_enum:
2203             dst.write_long(src.read_long());
2204             break;
2205 
2206         case TCKind._tk_sequence:
2207             // get the length of the sequence
2208             int seqLength = src.read_long();
2209 
2210             // check for sequence bound violated
2211             if ((_length != 0) && (seqLength > _length))
2212                 throw wrapper.badSequenceBounds( new Integer(seqLength),
2213                     new Integer(_length) ) ;
2214 
2215             // write the length of the sequence




2172                         break;
2173                     }
2174                 default:
2175                     throw wrapper.illegalUnionDiscriminatorType() ;
2176                 }
2177 
2178                 // using the value of the tag, find out the type of the value
2179                 // following.
2180 
2181                 int labelIndex;
2182                 for (labelIndex = 0; labelIndex < _unionLabels.length; labelIndex++) {
2183                     // use equality over anys
2184                     if (tagValue.equal(_unionLabels[labelIndex])) {
2185                         _memberTypes[labelIndex].copy(src, dst);
2186                         break;
2187                     }
2188                 }
2189 
2190                 if (labelIndex == _unionLabels.length) {
2191                     // check if label has not been found
2192                     if (_defaultIndex != -1)



2193                         // must be of the default branch type
2194                         _memberTypes[_defaultIndex].copy(src, dst);
2195                 }
2196                 break;
2197             }
2198 
2199         case TCKind._tk_enum:
2200             dst.write_long(src.read_long());
2201             break;
2202 
2203         case TCKind._tk_sequence:
2204             // get the length of the sequence
2205             int seqLength = src.read_long();
2206 
2207             // check for sequence bound violated
2208             if ((_length != 0) && (seqLength > _length))
2209                 throw wrapper.badSequenceBounds( new Integer(seqLength),
2210                     new Integer(_length) ) ;
2211 
2212             // write the length of the sequence