Buggy code:
public class LocalMappedRoundRobinFileUrlResolver implements FileUrlResolver { private final Logger logger = LoggerFactory . getLogger ( this . getClass ( ) ) ; @ Override public URL getURL ( FileHandle file ) throws GridUnresolvableHostException { } public URL getURL ( FileHandle file , String subPath ) throws GridUnresolvableHostException { } private HashMap < String , List < String > > hostMap ; public LocalMappedRoundRobinFileUrlResolver ( Map < String , List < String > > hostMap ) { } @ Override public URL getURL ( FileGroup group ) throws GridUnresolvableHostException { } public URL getURL ( FileGroup group , String subPath ) throws GridUnresolvableHostException { Set < FileHandle > fileHandles = group . getFileHandles ( ) ; if ( ( fileHandles . size ( ) ) == 0 ) { logger . warn ( ( ( "File<seq2seq4repair_space>group<seq2seq4repair_space>" + ( group . getDescription ( ) ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>empty!" ) ) ; throw new GridUnresolvableHostException ( ) ; } else if ( ( fileHandles . size ( ) ) == 1 ) { return getURL ( fileHandles . iterator ( ) . next ( ) ) ; } Iterator < FileHandle > it = fileHandles . iterator ( ) ; FileHandle file = it . next ( ) ; if ( ! ( file . getFileURI ( ) . toString ( ) . startsWith ( "file:////" ) ) ) { String message = "unable<seq2seq4repair_space>to<seq2seq4repair_space>obtain<seq2seq4repair_space>file<seq2seq4repair_space>URL<seq2seq4repair_space>for<seq2seq4repair_space>file<seq2seq4repair_space>" + ( file . getId ( ) ) ; logger . warn ( ( "unable<seq2seq4repair_space>to<seq2seq4repair_space>obtain<seq2seq4repair_space>file<seq2seq4repair_space>URL<seq2seq4repair_space>for<seq2seq4repair_space>file<seq2seq4repair_space>" + ( file . getId ( ) ) ) ) ; throw new GridUnresolvableHostException ( ( "unable<seq2seq4repair_space>to<seq2seq4repair_space>obtain<seq2seq4repair_space>file<seq2seq4repair_space>URL<seq2seq4repair_space>for<seq2seq4repair_space>file<seq2seq4repair_space>" + ( file . getId ( ) ) ) ) ; } Matcher hostm = Pattern . compile ( "^file:////(.*?)//" ) . matcher ( file . getFileURI ( ) . toString ( ) ) ; if ( ! ( hostm . find ( ) ) ) { String message = "unable<seq2seq4repair_space>to<seq2seq4repair_space>parse<seq2seq4repair_space>file<seq2seq4repair_space>URL:<seq2seq4repair_space>" + ( file . getFileURI ( ) . toString ( ) ) ; logger . warn ( message ) ; throw new GridUnresolvableHostException ( message ) ; } String host = hostm . group ( 1 ) ; if ( ! ( hostMap . containsKey ( host ) ) ) { String message = ( "Host:<seq2seq4repair_space>" + host ) + "<seq2seq4repair_space>has<seq2seq4repair_space>not<seq2seq4repair_space>been<seq2seq4repair_space>mapped" ; logger . warn ( message ) ; throw new GridUnresolvableHostException ( message ) ; } while ( it . hasNext ( ) ) { file = it . next ( ) ; if ( ! ( file . getFileURI ( ) . toString ( ) . startsWith ( "file:////" ) ) ) { String message = "unable<seq2seq4repair_space>to<seq2seq4repair_space>obtain<seq2seq4repair_space>file<seq2seq4repair_space>URL<seq2seq4repair_space>for<seq2seq4repair_space>file<seq2seq4repair_space>" + ( file . getId ( ) ) ; logger . warn ( message ) ; throw new GridUnresolvableHostException ( message ) ; } Matcher hostm2 = Pattern . compile ( "^file:////(.*?)//" ) . matcher ( file . getFileURI ( ) . toString ( ) ) ; if ( ! ( hostm2 . find ( ) ) ) { String message = "unable<seq2seq4repair_space>to<seq2seq4repair_space>parse<seq2seq4repair_space>file<seq2seq4repair_space>URL:<seq2seq4repair_space>" + ( file . getFileURI ( ) . toString ( ) ) ; logger . warn ( message ) ; throw new GridUnresolvableHostException ( message ) ; } String host2 = hostm2 . group ( 1 ) ; if ( ! ( hostMap . containsKey ( host2 ) ) ) { String message = ( "Host:<seq2seq4repair_space>" + host2 ) + "<seq2seq4repair_space>has<seq2seq4repair_space>not<seq2seq4repair_space>been<seq2seq4repair_space>mapped" ; logger . warn ( message ) ; throw new GridUnresolvableHostException ( message ) ; } else if ( ( host2 . compareTo ( host ) ) != 0 ) { String message = ( ( ( "File<seq2seq4repair_space>group<seq2seq4repair_space>contains<seq2seq4repair_space>files<seq2seq4repair_space>from<seq2seq4repair_space>multiple<seq2seq4repair_space>host:<seq2seq4repair_space>'" + host ) + "',<seq2seq4repair_space>'" ) + host2 ) + "'<seq2seq4repair_space>and<seq2seq4repair_space>might<seq2seq4repair_space>be<seq2seq4repair_space>more." ; logger . warn ( message ) ; throw new GridUnresolvableHostException ( message ) ; } } List < String > l = hostMap . get ( host ) ; String destination = ( ( String ) ( l . get ( 0 ) ) ) ; if ( ( l . size ( ) ) > 1 ) { Collections . rotate ( l , 1 ) ; hostMap . put ( host , l ) ; } if ( ! ( destination . endsWith ( "//" ) ) ) destination += "//" ; if ( ! ( subPath . endsWith ( "//" ) ) ) subPath += "//" ; URL retval ; <START_BUG> String group_uri = ( ( ( ( destination + subPath ) + ( group . getUUID ( ) . toString ( ) ) ) + "//" ) + ( group . getDescription ( ) . replaceAll ( "\\W" , "" ) ) ) + ".zip" ; <END_BUG> try { URI uri = new URI ( group_uri ) ; retval = uri . normalize ( ) . toURL ( ) ; } catch ( URISyntaxException e ) { String message = ( "unable<seq2seq4repair_space>to<seq2seq4repair_space>coerce<seq2seq4repair_space>" + group_uri ) + "<seq2seq4repair_space>to<seq2seq4repair_space>URI" ; logger . warn ( message ) ; throw new GridUnresolvableHostException ( message ) ; } catch ( MalformedURLException e ) { String message = ( "unable<seq2seq4repair_space>to<seq2seq4repair_space>coerce<seq2seq4repair_space>" + group_uri ) + "<seq2seq4repair_space>to<seq2seq4repair_space>URL" ; logger . warn ( message ) ; throw new GridUnresolvableHostException ( message ) ; } finally { } return retval ; } }

Fix:
String group_uri = ( ( ( ( destination + subPath ) + ( group . getUUID ( ) . toString ( ) ) ) + "//" ) + ( group . getDescription ( ) . replaceAll ( "\\W" , "" ) ) ) + ".tar" ;