diff options
-rw-r--r-- | org.tizen.common.sign/src/org/tizen/common/sign/model/ResolverCustomResource.java | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/org.tizen.common.sign/src/org/tizen/common/sign/model/ResolverCustomResource.java b/org.tizen.common.sign/src/org/tizen/common/sign/model/ResolverCustomResource.java index cf9e895d7..c97d6f57e 100644 --- a/org.tizen.common.sign/src/org/tizen/common/sign/model/ResolverCustomResource.java +++ b/org.tizen.common.sign/src/org/tizen/common/sign/model/ResolverCustomResource.java @@ -37,6 +37,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.httpclient.util.URIUtil; import org.apache.xml.security.signature.XMLSignatureInput; import org.apache.xml.security.utils.resolver.ResourceResolverException; import org.apache.xml.security.utils.resolver.implementations.ResolverLocalFilesystem; @@ -163,7 +164,7 @@ public class ResolverCustomResource extends ResolverLocalFilesystem { InputStream is = null; try { final URL url = new URL( new URL( baseURI ), value ); - String escapedUnicode = translateUriToFilename( value ); + String escapedUnicode = URIUtil.decode( value ); if ( this.isMap.containsKey( escapedUnicode ) ) { // a mapped resource for input stream @@ -197,29 +198,4 @@ public class ResolverCustomResource extends ResolverLocalFilesystem { private InputStream openStream(URL url) throws IOException { return new ByteArrayInputStream( IOUtil.getBytes( url.openStream(), true ) ); } - - private String translateUriToFilename(String uri) { - final String SPACE_UNICODE = "%20"; - - if( uri.indexOf( SPACE_UNICODE ) > -1 ) { - int offset = 0; - int index = 0; - StringBuilder temp = new StringBuilder( uri.length() ); - - do { - index = uri.indexOf( SPACE_UNICODE, offset ); - if ( index == -1 ) { - temp.append( uri.substring( offset ) ); - } else { - temp.append( uri.substring( offset, index ) ); - temp.append( ' ' ); - offset = index + SPACE_UNICODE.length(); - } - } while( index != -1 ); - - uri = temp.toString(); - } - - return uri; - } } |