You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2011/03/28 15:50:15 UTC
svn commit: r1086233 -
/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/UriUtils.java
Author: schor
Date: Mon Mar 28 13:50:15 2011
New Revision: 1086233
URL: http://svn.apache.org/viewvc?rev=1086233&view=rev
Log:
[UIMA-2097] fix URI handling with quoted otherwise illegal chars - add create method that mimics URI.create in converting checked exception to unchecked exception.
Modified:
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/UriUtils.java
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/UriUtils.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/UriUtils.java?rev=1086233&r1=1086232&r2=1086233&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/UriUtils.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/UriUtils.java Mon Mar 28 13:50:15 2011
@@ -64,4 +64,20 @@ public class UriUtils {
public static URI quote(URL u) throws URISyntaxException {
return quote(u.toString());
}
+
+ /**
+ * Create a URI from a String, with proper quoting.
+ * Already quoted things in the input string are not re-quoted.
+ * Mimic exception treatment of URI.create
+ * @param u
+ * @return URI with proper quoting
+ */
+
+ public static URI create(String s) {
+ try {
+ return quote(s);
+ } catch (URISyntaxException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
}