Java.st
changeset 546 56e1665483d2
parent 543 bbaa7c0a737e
child 548 063963638b8d
--- a/Java.st	Fri Jan 29 15:30:31 1999 +0000
+++ b/Java.st	Fri Jan 29 15:34:00 1999 +0000
@@ -1151,7 +1151,7 @@
 
 classSourceOf:aClass
     |package dirName binary sourceFileName sourceFile dirHolder fileName path
-     loader codeBaseURL protocol dir file|
+     loader codeBaseURL protocol dir file codeBaseURLIdx|
 
     aClass isNil ifTrue:[
         ^ nil
@@ -1176,14 +1176,17 @@
     ] ifFalse:[
         "/ maybe it was loaded by a java classLoader ...
         (loader := aClass classLoader) notNil ifTrue:[
-            (codeBaseURL := loader instVarNamed:'codeBaseURL') notNil ifTrue:[
-                (protocol := codeBaseURL instVarNamed:'protocol') notNil ifTrue:[
-                    (Java as_ST_String:protocol) = 'file' ifTrue:[
-                        dirName := Java as_ST_String:(codeBaseURL instVarNamed:'file').
-                        dirName asFilename exists ifTrue:[
-                            aClass sourceFile notNil ifTrue:[
-                                sourceFileName := dirName asFilename construct:aClass sourceFile.
-                                sourceFile := sourceFileName asFilename.
+            codeBaseURLIdx := loader class instVarOffsetOf:'codeBaseURL'.
+            codeBaseURLIdx notNil ifTrue:[
+                (codeBaseURL := loader instVarAt:codeBaseURLIdx) notNil ifTrue:[
+                    (protocol := codeBaseURL instVarNamed:'protocol') notNil ifTrue:[
+                        (Java as_ST_String:protocol) = 'file' ifTrue:[
+                            dirName := Java as_ST_String:(codeBaseURL instVarNamed:'file').
+                            dirName asFilename exists ifTrue:[
+                                aClass sourceFile notNil ifTrue:[
+                                    sourceFileName := dirName asFilename construct:aClass sourceFile.
+                                    sourceFile := sourceFileName asFilename.
+                                ]
                             ]
                         ]
                     ]
@@ -1266,7 +1269,7 @@
     ].
     ^ (sourceFile contentsOfEntireFile).
 
-    "Modified: / 15.10.1998 / 23:38:18 / cg"
+    "Modified: / 27.1.1999 / 20:40:30 / cg"
 !
 
 findSourceDirOf:fileName inPackage:aPackage
@@ -1346,6 +1349,6 @@
 !Java class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Java.st,v 1.90 1999/01/19 16:45:55 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Java.st,v 1.91 1999/01/29 15:34:00 cg Exp $'
 ! !
 Java initialize!