protected void unfoldModulesHelper ( Object obj , String path , String [ ] aPrefixes , Map < Integer , String > modules ) throws IOException , JSONException { final String sourceMethod = "unfoldModulesHelper" ; //$NON-NLS-1$ if ( isTraceLogging ) { log . entering ( RequestedModuleNames . class . getName ( ) , sourceMethod , new Object [ ] { obj , path , aPrefixes != null ? Arrays . asList ( aPrefixes ) : null , modules } ) ; } if ( obj instanceof JSONObject ) { JSONObject jsonobj = ( JSONObject ) obj ; Iterator < ? > it = jsonobj . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String key = ( String ) it . next ( ) ; String newpath = path + "/" + key ; //$NON-NLS-1$ unfoldModulesHelper ( jsonobj . get ( key ) , newpath , aPrefixes , modules ) ; } } else if ( obj instanceof String ) { String [ ] values = ( ( String ) obj ) . split ( "-" ) ; //$NON-NLS-1$ int idx = Integer . parseInt ( values [ 0 ] ) ; if ( modules . get ( idx ) != null ) { throw new BadRequestException ( ) ; } modules . put ( idx , values . length > 1 ? ( ( aPrefixes != null ? aPrefixes [ Integer . parseInt ( values [ 1 ] ) ] : values [ 1 ] ) + "!" + path ) : //$NON-NLS-1$ path ) ; } else { throw new BadRequestException ( ) ; } if ( isTraceLogging ) { log . exiting ( RequestedModuleNames . class . getName ( ) , sourceMethod , modules ) ; } }
Helper routine to unfold folded module names