RepositoryFilenameUtils { public static String unescape( final String name ) { if ( name == null ) { throw new IllegalArgumentException(); } StringBuilder buffer = new StringBuilder( name.length() ); String str = name; int i = str.indexOf( escapeChar ); while ( i > -1 && i + 2 < str.length() ) { buffer.append( str.toCharArray(), 0, i ); int a = Character.digit( str.charAt( i + 1 ), 16 ); int b = Character.digit( str.charAt( i + 2 ), 16 ); if ( a > -1 && b > -1 ) { buffer.append( (char) ( a * 16 + b ) ); str = str.substring( i + 3 ); } else { buffer.append( escapeChar ); str = str.substring( i + 1 ); } i = str.indexOf( escapeChar ); } buffer.append( str ); return buffer.toString(); } private  RepositoryFilenameUtils(); static String normalize( final String filename ); static String normalize( final String filename, final boolean leadingSlash ); static String normalizeNoEndSeparator( final String filename ); static String concat( final String basePath, final String fullFilenameToAdd ); static String separatorsToRepository( final String path ); static int getPrefixLength( final String filename ); static int indexOfLastSeparator( final String filename ); static int indexOfExtension( final String filename ); static String getPrefix( final String filename ); static String getPath( final String filename ); static String getPathNoEndSeparator( final String filename ); static String getFullPath( final String filename ); static String getFullPathNoEndSeparator( final String filename ); static String getName( final String filename ); static String getBaseName( final String filename ); static String getExtension( final String filename ); static String removeExtension( final String filename ); static boolean equals( final String filename1, final String filename2 ); static boolean equalsNormalized( String filename1, String filename2 ); static boolean isExtension( final String filename, final String extension ); static boolean isExtension( final String filename, final String[] extensions ); static boolean isExtension( final String filename, final Collection extensions ); static boolean wildcardMatch( final String filename, final String wildcardMatcher ); static String escape( final String name, final List<Character> reservedChars ); static String unescape( final String name );  }
@Test public void testUnescape() { try { RepositoryFilenameUtils.unescape( null ); fail(); } catch ( IllegalArgumentException e ) { } assertEquals( "hello", RepositoryFilenameUtils.unescape( "hello" ) ); assertEquals( "hello", RepositoryFilenameUtils.unescape( "h%65llo" ) ); assertEquals( "hel%lo", RepositoryFilenameUtils.unescape( "hel%25lo" ) ); assertEquals( "helloン", RepositoryFilenameUtils.unescape( "helloン" ) ); }