public void buildResourcePaths ( ) { try { if ( Boolean . getBoolean ( Stapler . class . getName ( ) + ".noResourcePathCache" ) ) { resourcePaths = null ; return ; } Map < String , URL > paths = new HashMap < String , URL > ( ) ; Stack < String > q = new Stack < String > ( ) ; q . push ( "/" ) ; while ( ! q . isEmpty ( ) ) { String dir = q . pop ( ) ; Set < String > children = context . getResourcePaths ( dir ) ; if ( children != null ) { for ( String child : children ) { if ( child . endsWith ( "/" ) ) q . push ( child ) ; else { URL v = context . getResource ( child ) ; if ( v == null ) { resourcePaths = null ; return ; // this can't happen. abort with no cache } paths . put ( child , v ) ; } } } } resourcePaths = Collections . unmodifiableMap ( paths ) ; } catch ( MalformedURLException e ) { resourcePaths = null ; // abort } }
Rebuild the internal cache for static resources .