*** empty log message ***
authortm
Tue, 17 Jun 2003 15:47:51 +0200
changeset 1249 71aae2f2fbba
parent 1248 2d0493cd8d3c
child 1250 e69088cf58fc
*** empty log message ***
URI.st
--- a/URI.st	Mon Jun 16 11:27:22 2003 +0200
+++ b/URI.st	Tue Jun 17 15:47:51 2003 +0200
@@ -13,15 +13,33 @@
 fromString:aString
     "create an URI from a given String"
 
-    |i scheme rest|
+    ^ self fromString:aString onError:[self error:'conversion error'].
+
+
+"
+    self fromString:''
+"
+!
+
+fromString:aString onError:exceptionBlock
+    "create an URI from a given String"
+
 
-    i := aString indexOf:$:.
-    i == 0 ifTrue:[
-        self error:'missing scheme in URI'
-    ].
-    scheme := aString copyFrom:1 to:i-1.
-    rest := aString copyFrom:i+1.
-    ^ (self classForScheme:scheme) scheme:scheme fromString:rest
+    ^ [ 
+        |i scheme rest|
+
+        i := aString indexOf:$:.
+        i == 0 ifTrue:[ exceptionBlock value ] ifFalse:[
+            scheme := aString copyFrom:1 to:i-1.
+            rest := aString copyFrom:i+1.
+            (self classForScheme:scheme) scheme:scheme fromString:rest
+        ].
+    ] on:Error do:exceptionBlock
+
+
+"
+    self fromString:'' onError:nil  
+"
 ! !
 
 !URI class methodsFor:'accessing'!
@@ -37,6 +55,10 @@
         schemes := cls schemes.
         schemes size ~~ 0 and:[schemes includes:s]
     ] ifNone:[HierarchicalURI]
+
+"
+    self classForScheme:'file'
+"
 !
 
 schemes
@@ -179,5 +201,5 @@
 !URI class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/URI.st,v 1.1 2002-01-17 14:25:48 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/URI.st,v 1.2 2003-06-17 13:47:51 tm Exp $'
 ! !