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);
		}
	}
protected void unfoldModulesHelper ( Object obj , String path , String [ ] aPrefixes , Map < Integer , String > modules ) throws IOException , JSONException { final String sourceMethod = "unfoldModulesHelper" ; 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 ; unfoldModulesHelper ( jsonobj . get ( key ) , newpath , aPrefixes , modules ) ; } } else if ( obj instanceof String ) { String [ ] values = ( ( String ) obj ) . split ( "-" ) ; 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 ) : path ) ; } else { throw new BadRequestException ( ) ; } if ( isTraceLogging ) { log . exiting ( RequestedModuleNames . class . getName ( ) , sourceMethod , modules ) ; } }
Helper routine to unfold folded module names

@param obj
The folded path list of names, as a string or JSON object
@param path
The reference path
@param aPrefixes
Array of loader plugin prefixes
@param modules
Output - the list of unfolded modlue names as a sparse array implemented
using a map with integer keys
@throws IOException
@throws JSONException