Skip to content

Commit 8922156

Browse files
author
jossonsmith
committed
Fixed bugs on Class#getResourceAsStream
1 parent 93b7c69 commit 8922156

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

  • sources/net.sf.j2s.java.core/j2score

sources/net.sf.j2s.java.core/j2score/Class.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,14 +1440,19 @@ Clazz.innerFunctions = {
14401440
is = new java.io.InputStream ();
14411441
} else {
14421442
is = new Object ();
1443+
is.__CLASS_NAME__ = "java.io.InputStream";
14431444
is.close = function () {};
14441445
}
14451446
is.read = function () { return 0; };
14461447
name = name.replace (/\\/g, '/');
14471448
if (name.indexOf ('/') == 0) {
14481449
is.url = name.substring (1);
14491450
} else {
1450-
var baseFolder = window.binaryFolder;
1451+
var baseFolder = null;
1452+
var bins = Clazz.binaryFolders;
1453+
if (bins != null && bins.length != 0) {
1454+
baseFolder = bins[0];
1455+
}
14511456
if (baseFolder == null || baseFolder.length == 0) {
14521457
baseFolder = "bin/";
14531458
}
@@ -1577,3 +1582,8 @@ Clazz.decorateAsType = function (clazzFun, qClazzName, clazzParent,
15771582
};
15781583

15791584
Clazz.declarePackage ("java.lang");
1585+
Clazz.declarePackage ("java.lang.ref");
1586+
Clazz.declarePackage ("java.lang.ref.reflect");
1587+
Clazz.declarePackage ("java.lang.reflect");
1588+
Clazz.declarePackage ("java.io");
1589+
Clazz.declarePackage ("java.util");

0 commit comments

Comments
 (0)