Buggy code:
class ResourceHandler implements ManagementHttpHandler { private static final String EXPIRES_HEADER = "Expires" ; private static final String LAST_MODIFIED_HEADER = "Last-Modified" ; private static final String GMT = "GMT" ; private static final String CACHE_CONTROL_HEADER = "Cache-Control" ; private static final String CONTENT_LENGTH_HEADER = "Content-Length" ; private static Map < String , String > contentTypeMapping = new ConcurrentHashMap < String , String > ( ) ; private static final String FORMAT_STRING = "EEE,<seq2seq4repair_space>dd<seq2seq4repair_space>MMM<seq2seq4repair_space>yyyy<seq2seq4repair_space>HH:mm:ss<seq2seq4repair_space>z" ; private final String context ; private final String defaultResource ; private final ClassLoader loader ; private final String lastModified ; private long lastExpiryDate = 0 ; private String lastExpiryHeader = null ; private final Map < String , ResourceHandler . ResourceHandle > buffer = new ConcurrentHashMap < String , ResourceHandler . ResourceHandle > ( ) ; public ResourceHandler ( final String context , final String defaultResource , final ClassLoader loader ) { } String getDefaultUrl ( ) { } protected String getContext ( ) { } public void handle ( HttpExchange http ) throws IOException { final URI uri = http . getRequestURI ( ) ; final String requestMethod = http . getRequestMethod ( ) ; if ( ! ( Constants . GET . equals ( requestMethod ) ) ) { http . sendResponseHeaders ( Constants . METHOD_NOT_ALLOWED , ( - 1 ) ) ; return ; } String path = uri . getPath ( ) ; String resource = path . substring ( context . length ( ) , path . length ( ) ) ; if ( resource . startsWith ( "//" ) ) resource = resource . substring ( 1 ) ; if ( resource . equals ( "" ) ) { Headers responseHeaders = http . getResponseHeaders ( ) ; responseHeaders . add ( Constants . LOCATION , getDefaultUrl ( ) ) ; http . sendResponseHeaders ( Constants . MOVED_PERMENANTLY , 0 ) ; http . close ( ) ; return ; } else <START_BUG> if ( ( resource . indexOf ( "." ) ) == ( - 1 ) ) { <END_BUG> respond404 ( http ) ; } if ( resource . startsWith ( "META-INF" ) ) { http . sendResponseHeaders ( Constants . FORBIDDEN , 0 ) ; http . close ( ) ; return ; } ResourceHandler . ResourceHandle handle = getResourceHandle ( resource ) ; if ( ( handle . getInputStream ( ) ) != null ) { InputStream inputStream = handle . getInputStream ( ) ; final Headers responseHeaders = http . getResponseHeaders ( ) ; responseHeaders . add ( Constants . CONTENT_TYPE , resolveContentType ( path ) ) ; if ( ! ( skipCache ( resource ) ) ) { if ( ( System . currentTimeMillis ( ) ) > ( lastExpiryDate ) ) { lastExpiryDate = ResourceHandler . calculateExpiryDate ( ) ; lastExpiryHeader = ResourceHandler . createDateFormat ( ) . format ( new Date ( lastExpiryDate ) ) ; } responseHeaders . add ( ResourceHandler . CACHE_CONTROL_HEADER , "private,<seq2seq4repair_space>max-age=2678400,<seq2seq4repair_space>must-revalidate" ) ; responseHeaders . add ( ResourceHandler . EXPIRES_HEADER , lastExpiryHeader ) ; } responseHeaders . add ( ResourceHandler . LAST_MODIFIED_HEADER , lastModified ) ; responseHeaders . add ( ResourceHandler . CONTENT_LENGTH_HEADER , String . valueOf ( handle . getSize ( ) ) ) ; http . sendResponseHeaders ( Constants . OK , 0 ) ; OutputStream outputStream = http . getResponseBody ( ) ; ResourceHandler . fastChannelCopy ( inputStream , outputStream ) ; outputStream . flush ( ) ; ResourceHandler . safeClose ( outputStream ) ; ResourceHandler . safeClose ( inputStream ) ; } else { respond404 ( http ) ; } } private ResourceHandler . ResourceHandle getResourceHandle ( String resource ) { } private static DateFormat createDateFormat ( ) { } private static long calculateExpiryDate ( ) { } public static void fastChannelCopy ( final InputStream in , final OutputStream out ) throws IOException { } private static void safeClose ( Closeable close ) { } private String resolveContentType ( String resource ) { } private void respond404 ( HttpExchange http ) throws IOException { } private ClassLoader getLoader ( ) { } public void start ( HttpServer httpServer , SecurityRealm securityRealm ) { } public void stop ( HttpServer httpServer ) { } protected static ClassLoader getClassLoader ( final String module , final String slot ) throws ModuleLoadException { } protected boolean skipCache ( String resource ) { } class ResourceHandle { private final byte [ ] content ; ResourceHandle ( byte [ ] content ) { } public int getSize ( ) { } public InputStream getInputStream ( ) { } } }

Fix:
if ( ! ( resource . contains ( "." ) ) ) {