private ExceptionDefImpl addException ( ExceptionAnalysis ea ) throws RMIIIOPViolationException , IRConstructionException { ExceptionDefImpl eDef ; Class cls = ea . getCls ( ) ; // Lookup: Has it already been added? eDef = ( ExceptionDefImpl ) exceptionMap . get ( cls ) ; if ( eDef != null ) return eDef ; // Yes, just return it. // 1.3.7.1: map to value ValueDefImpl vDef = addValue ( ea ) ; // 1.3.7.2: map to exception ModuleDefImpl m = ensurePackageExists ( cls . getPackage ( ) . getName ( ) ) ; String base = cls . getName ( ) ; base = base . substring ( base . lastIndexOf ( ' ' ) + 1 ) ; if ( base . endsWith ( "Exception" ) ) base = base . substring ( 0 , base . length ( ) - 9 ) ; base = Util . javaToIDLName ( base + "Ex" ) ; StructMember [ ] members = new StructMember [ 1 ] ; members [ 0 ] = new StructMember ( "value" , vDef . type ( ) , null /*ignored*/ ) ; TypeCode typeCode = orb . create_exception_tc ( ea . getExceptionRepositoryId ( ) , base , members ) ; eDef = new ExceptionDefImpl ( ea . getExceptionRepositoryId ( ) , base , "1.0" , typeCode , vDef , m , impl ) ; m . add ( base , eDef ) ; exceptionMap . put ( cls , eDef ) ; // Remember we mapped this. return eDef ; }
Add an exception type .