Buggy code:
protected String framework = null ; protected MapCache map = null ; protected Map < String , Boolean > loaded ; protected ArrayList < Resource . Res > res ; protected ArrayList < Resource . Res > js ; protected ArrayList < Resource . Res > css ; protected ArrayList < Resource . Res > asyncs ; protected Boolean calculated = false ; public int refs = 0 ; public static Boolean ignorePkg = false ; public static Boolean inspect = false ; public Stack < Resource . Res > stack = new Stack < Resource . Res > ( ) ; public Resource ( ) { } public Resource ( ServletRequest request ) { } public String getFramework ( ) { } public void setFramework ( String framework ) { } public Boolean contains ( String id ) { } public String add ( String id ) { } public String add ( String id , Boolean deffer ) { } public String add ( String id , Boolean deffer , String prefix ) { } public String add ( String id , Boolean deffer , String prefix , String affix ) { } public String add ( String id , Boolean deffer , String prefix , String affix , Boolean withPkg ) { if ( ! ( contains ( id ) ) ) { return id ; } JSONObject node = map . getNode ( id ) ; if ( ( node . containsKey ( "type" ) ) && ( "css" . equals ( node . getString ( "type" ) ) ) ) { deffer = false ; } if ( ( ( loaded . containsKey ( id ) ) && ( ( loaded . get ( id ) ) == deffer ) ) || ( ( deffer && ( loaded . containsKey ( id ) ) ) && ( ! ( loaded . get ( id ) ) ) ) ) { return getUri ( id , true ) ; } else if ( ( ( loaded . containsKey ( id ) ) && ( ! deffer ) ) && ( loaded . get ( id ) ) ) { remove ( id , true ) ; } Resource . Res item = new Resource . Res ( ) ; item . setId ( id ) ; if ( Resource . inspect ) { if ( ( stack . peek ( ) . getChildren ( ) ) == null ) { stack . peek ( ) . setChildren ( new ArrayList < Resource . Res > ( ) ) ; } stack . peek ( ) . getChildren ( ) . add ( item ) ; stack . add ( item ) ; } loaded . put ( id , deffer ) ; String pkg = ( ( String ) ( node . get ( "pkg" ) ) ) ; String uri = node . getString ( "uri" ) ; if ( withPkg && ( pkg != null ) ) { JSONObject pkgNode = map . getNode ( pkg , "pkg" ) ; uri = pkgNode . getString ( "uri" ) ; if ( pkgNode . containsKey ( "has" ) ) { for ( Object dep : pkgNode . getJSONArray ( "has" ) ) { loaded . put ( dep . toString ( ) , deffer ) ; if ( Resource . inspect ) { Resource . Res has = new Resource . Res ( ) ; has . setId ( dep . toString ( ) ) ; if ( ( item . getChildren ( ) ) == null ) { item . setChildren ( new ArrayList < Resource . Res > ( ) ) ; } item . getChildren ( ) . add ( has ) ; } } } } if ( node . containsKey ( "deps" ) ) { JSONArray deps = node . getJSONArray ( "deps" ) ; for ( Object dep : deps ) { this . add ( dep . toString ( ) , deffer , prefix , affix , withPkg ) ; } } if ( node . containsKey ( "extras" ) ) { JSONObject extras = node . getJSONObject ( "extras" ) ; if ( extras . containsKey ( "async" ) ) { <START_BUG> JSONArray async = node . getJSONArray ( "async" ) ; <END_BUG> for ( Object dep : async ) { this . add ( dep . toString ( ) , true , prefix , affix , withPkg ) ; } } } if ( Resource . inspect ) { stack . pop ( ) ; } String type = node . getString ( "type" ) ; if ( ( ! ( type . equals ( "js" ) ) ) && ( ! ( type . equals ( "css" ) ) ) ) { return getUri ( id , true ) ; } item . setUri ( uri ) ; item . setPrefix ( prefix ) ; item . setAffix ( affix ) ; item . setType ( type ) ; item . setAsync ( deffer ) ; res . add ( item ) ; return getUri ( id , true ) ; } public void remove ( String id , Boolean deffer ) { } public void addJS ( String id ) { } public void addJS ( String id , String prefix ) { } public void addJS ( String id , String prefix , String affix ) { } public void addJSEmbed ( String content ) { } public void addJSEmbed ( String content , String prefix ) { } public void addJSEmbed ( String content , String prefix , String affix ) { } public void addCSS ( String id ) { } public void addCSS ( String id , String prefix ) { } public void addCSS ( String id , String prefix , String affix ) { } public void addCSSEmbed ( String content ) { }

Fix:
JSONArray async = extras . getJSONArray ( "async" ) ;