Java.st
changeset 267 105b82469d81
parent 264 44aedfcd08d1
child 270 6f21225aab53
--- a/Java.st	Sat Jan 17 20:56:15 1998 +0000
+++ b/Java.st	Fri Jan 23 16:50:52 1998 +0000
@@ -754,7 +754,7 @@
      loader codeBaseURL protocol dir file|
 
     aClass isNil ifTrue:[
-	^ nil
+        ^ nil
     ].
     package := aClass package.
 
@@ -763,98 +763,100 @@
 
     binary := aClass binaryFile.
     binary notNil ifTrue:[
-	binary := binary asFilename.
-	sourceFileName := binary withSuffix:'java'.
-	sourceFile := sourceFileName asFilename.
+        binary := binary asFilename.
+        sourceFileName := binary withSuffix:'java'.
+        sourceFile := sourceFileName asFilename.
     ] 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.
-			    ]
-			]
-		    ]
-		]
-	    ]
-	]
+        "/ 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.
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        ]
     ].
 
     sourceFile notNil ifTrue:[
-	sourceFile exists ifFalse:[
-	    sourceFileName := binary withSuffix:'jav'.
-	    sourceFile := sourceFileName asFilename.
-	    sourceFile exists ifFalse:[
-		sourceFileName := binary withSuffix:'JAV'.
-		sourceFile := sourceFileName asFilename.
-		sourceFile exists ifFalse:[
-		    sourceFileName := binary withSuffix:'JAVA'.
-		    sourceFile := sourceFileName asFilename.
-		].
-	    ].
-	].
+        sourceFile exists ifFalse:[
+            binary notNil ifTrue:[
+                sourceFileName := binary withSuffix:'jav'.
+                sourceFile := sourceFileName asFilename.
+                sourceFile exists ifFalse:[
+                    sourceFileName := binary withSuffix:'JAV'.
+                    sourceFile := sourceFileName asFilename.
+                    sourceFile exists ifFalse:[
+                        sourceFileName := binary withSuffix:'JAVA'.
+                        sourceFile := sourceFileName asFilename.
+                    ].
+                ].
+            ]
+        ].
     ].
 
     "/ special case: there were multiple classes in a single
     "/ source file.
 
     binary notNil ifTrue:[
-	binary withoutSuffix baseName ~= aClass sourceFile asFilename withoutSuffix baseName ifTrue:[
-	    'JAVA: trouble extracting fileName: ' print.
-	    binary withoutSuffix baseName print. ' vs. ' print.
-	    aClass sourceFile asFilename withoutSuffix baseName printCR.
-	].
+        binary withoutSuffix baseName ~= aClass sourceFile asFilename withoutSuffix baseName ifTrue:[
+            'JAVA: trouble extracting fileName: ' print.
+            binary withoutSuffix baseName print. ' vs. ' print.
+            aClass sourceFile asFilename withoutSuffix baseName printCR.
+        ].
     ].
 
     "/ if that fails, look in standard places
 
     (sourceFile isNil or:[sourceFile exists not]) ifTrue:[
-	sourceFileName := aClass sourceFile.
-	sourceFile := sourceFileName asFilename.
-	sourceFile exists ifFalse:[
-	    "/
-	    "/ mhmh - look for its directory
-	    "/
-	    dirName := sourceFile directoryName.
-	    fileName := sourceFile baseName.
+        sourceFileName := aClass sourceFile.
+        sourceFile := sourceFileName asFilename.
+        sourceFile exists ifFalse:[
+            "/
+            "/ mhmh - look for its directory
+            "/
+            dirName := sourceFile directoryName.
+            fileName := sourceFile baseName.
 
-	    (dirName asFilename exists 
-	    and:[(dirName asFilename construct:(package , '/' , fileName)) exists])
-	    ifFalse:[
-		(dirName asFilename exists 
-		and:[(dirName asFilename construct:(fileName)) exists])
-		ifFalse:[
-		    dirName := self findSourceDirOf:fileName inPackage:package.
+            (dirName asFilename exists 
+            and:[(dirName asFilename construct:(package , '/' , fileName)) exists])
+            ifFalse:[
+                (dirName asFilename exists 
+                and:[(dirName asFilename construct:(fileName)) exists])
+                ifFalse:[
+                    dirName := self findSourceDirOf:fileName inPackage:package.
 
     "/                [dirName isNil] whileTrue:[
     "/                    dirName := Dialog requestDirectoryName:'top directory for ' , package , '/' , fileName.
     "/                    (dirName isNil or:[dirName isEmpty]) ifTrue:[^ self].
     "/                ].
-		].
-	    ].
+                ].
+            ].
 
-	    (dirName notNil and:[dirName asFilename exists]) ifTrue:[
-		path := (dirName asFilename construct:(package , '/' , fileName)) asFilename.
-		path exists ifFalse:[
-		    path := (dirName asFilename construct:(fileName)) asFilename.
-		].
-	    ].
+            (dirName notNil and:[dirName asFilename exists]) ifTrue:[
+                path := (dirName asFilename construct:(package , '/' , fileName)) asFilename.
+                path exists ifFalse:[
+                    path := (dirName asFilename construct:(fileName)) asFilename.
+                ].
+            ].
 
-	    (path notNil and:[path exists]) ifFalse:[
-		^ nil
-	    ].
+            (path notNil and:[path exists]) ifFalse:[
+                ^ nil
+            ].
 
-	    sourceFile := path asFilename.
-	].
+            sourceFile := path asFilename.
+        ].
     ].
     ^ (sourceFile contentsOfEntireFile).
 
-    "Modified: / 13.1.1998 / 14:56:39 / cg"
+    "Modified: / 23.1.1998 / 17:50:06 / cg"
 !
 
 findSourceDirOf:fileName inPackage:aPackage
@@ -954,6 +956,6 @@
 !Java class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Java.st,v 1.49 1998/01/17 14:39:10 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Java.st,v 1.50 1998/01/23 16:50:52 cg Exp $'
 ! !
 Java initialize!