Skip to content

Commit bb05504

Browse files
committed
j2sApplet default file save as application/octet-stream, not text/plain
1 parent 9394e5b commit bb05504

File tree

10 files changed

+15
-10
lines changed

10 files changed

+15
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20210907013612
1+
20210921142110
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20210907013612
1+
20210921142110
99 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/image/BufferedImage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ public ColorModel getColorModel() {
913913
* @return the <code>WriteableRaster</code> of this <code>BufferedImage</code> .
914914
*/
915915
public WritableRaster getRaster() {
916+
// ok, but raster.getDataBuffer().getData() is going to require a flush();
916917
return raster;
917918
}
918919

sources/net.sf.j2s.java.core/src/javajs/async/Assets.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,11 @@ private static InputStream getAssetStream(String path, boolean zipOnly) {
406406
if (url == null && !zipOnly) {
407407
url = Assets.class.getClassLoader().getResource(path);
408408
}
409-
InputStream is = null;
410409
try {
411-
is = url.openStream();
410+
return (url == null ? null : url.openStream());
412411
} catch (Throwable t) {
413412
}
414-
return is;
413+
return null;
415414
}
416415
/**
417416
* Determine the path to an asset. If not found in a zip file asset, return the

sources/net.sf.j2s.java.core/src/swingjs/api/js/HTML5Video.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,15 @@ public Void apply(Object jsevent) {
253253
* Remove action listener
254254
*
255255
* @param jsvideo the HTML5 video element
256-
* @param listeners an array of event/listener pairs created by
256+
* @param listeners an array of event/listener epairs created by
257257
* addActionListener
258258
*/
259259
public static void removeActionListener(HTML5Video jsvideo, Object[] listeners) {
260260
if (listeners == null) {
261261
for (int i = 0; i < eventTypes.length; i++) {
262262
jsvideo.removeEventListener(eventTypes[i]);
263263
}
264+
return;
264265
}
265266

266267
for (int i = 0; i < listeners.length; i += 2) {

sources/net.sf.j2s.java.core/src/test/JalviewJSTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
*/
5858
public class JalviewJSTest extends JPanel implements MenuListener, ItemListener {
5959

60+
// TODO:
61+
// removeall and then restart
6062
public static final int SHIFT_DOWN_MASK;
6163
public static final int ALT_DOWN_MASK;
6264
public static final int SHORTCUT_MASK;

sources/net.sf.j2s.java.core/srcjs/js/j2sApplet.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
22

3+
// BH 2021.09.22 default file save as application/octet-stream, not text/plain
34
// BH 2020.12.31 full 64-bit long
45
// BH 2020.12.09 touch fixes for fdown and fdrag (j2sSlider)
56
// BH 2020.12.03 note that relay is disabled using J2S.addDirectDatabaseCall(".")
@@ -1267,7 +1268,7 @@ if (database == "_" && J2S._serverUrl.indexOf("//your.server.here/") >= 0) {
12671268
// Asynchronous output generated using an anchor tag
12681269
var a = document.createElement("a");
12691270
a.href = "data:" + mimetype + ";base64," + data;
1270-
a.type = mimetype || (mimetype = "text/plain;charset=utf-8");
1271+
a.type = mimetype || (mimetype = "application/octet-stream");//was "text/plain;charset=utf-8");
12711272
a.download = filename;
12721273
a.target = "_blank";
12731274
$("body").append(a);

sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2390,7 +2390,7 @@ _Loader.setClasspathFor = function(clazzes) {
23902390
if (!(clazzes instanceof Array))
23912391
clazzes = [clazzes];
23922392
for (var i = clazzes.length; --i >= 0;) {
2393-
path = clazzes[i];
2393+
var path = clazzes[i];
23942394
var jar = _Loader.getJ2SLibBase() + path.split(".")[0]+".js";
23952395
path = path.replace(/\//g,".");
23962396
classpathMap["#" + path] = jar;

sources/net.sf.j2s.java.core/srcjs/swingjs2.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10671,6 +10671,7 @@ return jQuery;
1067110671
})(jQuery,document,"click mousemove mouseup touchmove touchend", "outjsmol");
1067210672
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
1067310673

10674+
// BH 2021.09.22 default file save as application/octet-stream, not text/plain
1067410675
// BH 2020.12.31 full 64-bit long
1067510676
// BH 2020.12.09 touch fixes for fdown and fdrag (j2sSlider)
1067610677
// BH 2020.12.03 note that relay is disabled using J2S.addDirectDatabaseCall(".")
@@ -11938,7 +11939,7 @@ if (database == "_" && J2S._serverUrl.indexOf("//your.server.here/") >= 0) {
1193811939
// Asynchronous output generated using an anchor tag
1193911940
var a = document.createElement("a");
1194011941
a.href = "data:" + mimetype + ";base64," + data;
11941-
a.type = mimetype || (mimetype = "text/plain;charset=utf-8");
11942+
a.type = mimetype || (mimetype = "application/octet-stream");//was "text/plain;charset=utf-8");
1194211943
a.download = filename;
1194311944
a.target = "_blank";
1194411945
$("body").append(a);
@@ -16405,7 +16406,7 @@ _Loader.setClasspathFor = function(clazzes) {
1640516406
if (!(clazzes instanceof Array))
1640616407
clazzes = [clazzes];
1640716408
for (var i = clazzes.length; --i >= 0;) {
16408-
path = clazzes[i];
16409+
var path = clazzes[i];
1640916410
var jar = _Loader.getJ2SLibBase() + path.split(".")[0]+".js";
1641016411
path = path.replace(/\//g,".");
1641116412
classpathMap["#" + path] = jar;

0 commit comments

Comments
 (0)