Skip to content

Commit 2c8a27e

Browse files
committed
JSTempFile uses JSUtil.setFileBytesStatic; getHtmlApplet returns Object
1 parent a6430e1 commit 2c8a27e

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

sources/net.sf.j2s.java.core/src/swingjs/JSTempFile.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,12 @@ public void cacheBytes() {
2828
}
2929

3030
public boolean setBytes(Object isOrBytes) {
31-
if (isOrBytes instanceof InputStream) {
32-
秘bytes = /**
33-
* @j2sNative (isOrBytes.$in.$in || isOrBytes.$in).buf ||
34-
*/
35-
null;
36-
} else if (isOrBytes instanceof byte[]) {
37-
秘bytes = /**
38-
* @j2sNative isOrBytes ||
39-
*/
40-
null;
41-
} else {
42-
秘bytes = null;
31+
boolean ok = JSUtil.setFileBytesStatic((File) this, isOrBytes);
32+
if (ok) {
33+
String path = getAbsolutePath();
34+
JSUtil.cacheFileData(path, 秘bytes);
4335
}
44-
return 秘bytes != null;
36+
return ok;
4537
}
4638

4739

sources/net.sf.j2s.java.core/src/swingjs/JSToolkit.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,7 @@ public static void setIsDispatchThread(boolean b) {
477477
* @return
478478
*/
479479
public static HTML5Applet getHTML5Applet(Component c) {
480-
ThreadGroup g = (c == null ? Thread.currentThread().getThreadGroup() : c.getAppContext().getThreadGroup());
481-
return ((JSThreadGroup) g).getHtmlApplet();
480+
return JSUtil.getHTML5Applet(c);
482481
}
483482

484483
public static void taintUI(Component c) {

0 commit comments

Comments
 (0)