Skip to content

Commit 08adf75

Browse files
hansonrhansonr
authored andcommitted
SwingJS 3.2.4.06 includes transpiler fix for try(res1,res2)
1 parent 50e01d6 commit 08adf75

File tree

6 files changed

+52
-25
lines changed

6 files changed

+52
-25
lines changed
34 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20181228223849
1+
20190102082521
34 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20181228223849
1+
20190102082521
256 KB
Binary file not shown.

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

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13568,6 +13568,7 @@ console.log("J2S._getRawDataFromServer " + J2S._serverUrl + " for " + query);
1356813568

1356913569
// Google closure compiler cannot handle Clazz.new or Clazz.super
1357013570

13571+
// BH 1/3/2019 3.2.4.06 adds ByteBuffer/CharBuffer support, proper CharSet encoding, including GBK (Standard Chinese)
1357113572
// BH 12/30/2018 3.2.4.05 adds Class.forName("[XXX")
1357213573
// BH 12/20/2018 3.2.4.05 fixes synthetic reference issue
1357313574
// BH 12/13/2018 3.2.4.05 fixes Class.js field reflection, inner anonymous class of outer class creates wrong synthetic pointer
@@ -13674,8 +13675,8 @@ window["j2s.clazzloaded"] = true;
1367413675
_debugging: false,
1367513676
_loadcore: true,
1367613677
_nooutput: 0,
13677-
_VERSION_R: "3.2.4.05",
13678-
_VERSION_T: "3.2.4.05",
13678+
_VERSION_R: "3.2.4.06",
13679+
_VERSION_T: "3.2.4.06",
1367913680
};
1368013681

1368113682
;(function(Clazz, J2S) {
@@ -18051,26 +18052,30 @@ var getChars = function(s, srcBegin,srcEnd,dst,dstBegin, asBytes){
1805118052
}
1805218053
};
1805318054

18055+
//var charset=["utf-8","utf8","us-ascii","iso-8859-1","8859_1","gb2312","gb18030"];
18056+
var charset=["utf-8","utf8","us-ascii","iso-8859-1"]; // gb* uses GBK
1805418057
sp.getBytes$=sp.getBytes$S=sp.getBytes$java_nio_charset_Charset=function(){
1805518058
var s=this;
1805618059
if(arguments.length==1){
18057-
var cs=arguments[0].toString().toLowerCase();
18058-
var charset=[
18059-
"utf-8","utf8","us-ascii","iso-8859-1","8859_1","gb2312","gb18030","gbk"
18060-
];
18061-
var existed=false;
18062-
for(var i=0;i<charset.length;i++){
18063-
if(charset[i]==cs){
18064-
existed=true;
18065-
break;
18066-
}
18067-
}
18068-
if(!existed){
18069-
throw new java.io.UnsupportedEncodingException();
18070-
}
18071-
if(cs=="utf-8"||cs=="utf8"){
18072-
s=Encoding.convert2UTF8(this);
18073-
}
18060+
var cs=arguments[0].toString().toLowerCase();
18061+
var simple=false;
18062+
for(var i=0;i<charset.length;i++){
18063+
if(charset[i]==cs){
18064+
simple=true;
18065+
break;
18066+
}
18067+
}
18068+
if(!simple){
18069+
cs = arguments[0];
18070+
if (typeof cs == "string")
18071+
cs = Clazz.loadClass("java.nio.charset.Charset").forName$S(cs);
18072+
if (!cs)
18073+
throw new java.io.UnsupportedEncodingException();
18074+
return cs.encode$S(this.toString()).toArray$();
18075+
}
18076+
if(cs=="utf-8"||cs=="utf8"){
18077+
s=Encoding.convert2UTF8(this);
18078+
}
1807418079
}
1807518080
var arrs=[];
1807618081
for(var i=0, ii=0;i<s.length;i++){
@@ -18300,12 +18305,18 @@ case 4:
1830018305
// String(byte[] ascii, int hibyte, int offset, int count)
1830118306

1830218307
var bytes=arguments[0];
18303-
var encoding=arguments[3];
18304-
if(typeof encoding != "number"){
18305-
// assumes UTF-8
18308+
var cs=arguments[3];
18309+
if(typeof cs != "number"){
1830618310
var offset=arguments[1];
1830718311
var length=arguments[2];
18308-
return Encoding.readUTF8Array(bytes, offset, length);
18312+
if (typeof cs == "string") {
18313+
if (",utf8,utf-8,utf_8,".indexOf("," + cs + ",") >= 0)
18314+
return Encoding.readUTF8Array(bytes,offset,length);
18315+
cs = Clazz.loadClass("java.nio.charset.Charset").forName$S(cs);
18316+
if (!cs)
18317+
throw new java.io.UnsupportedEncodingException();
18318+
}
18319+
return cs.decode$BA$I$I(bytes, offset, length).toString();
1830918320
}
1831018321
var count=arguments[3];
1831118322
var offset=arguments[2];
@@ -18511,6 +18522,22 @@ if (typeof c == "string")
1851118522
return (c >= 0x1c && c <= 0x20 || c >= 0x9 && c <= 0xd || c == 0x1680
1851218523
|| c >= 0x2000 && c != 0x2007 && (c <= 0x200b || c == 0x2028 || c == 0x2029 || c == 0x3000));
1851318524
}, 1);
18525+
m$(C$,"isSurrogate$C", function(c) {
18526+
c = c.charCodeAt(0);
18527+
return c >= 0xd800 && c < 0xe000;
18528+
18529+
}, 1);
18530+
m$(C$,"isHighSurrogate$C", function(c) {
18531+
c = c.charCodeAt(0);
18532+
return c >= 0xd800 && c < 0xdc00;
18533+
18534+
}, 1);
18535+
m$(C$,"isLowSurrogate$C", function(c) {
18536+
c = c.charCodeAt(0);
18537+
return c >= 0xdc00 && c < 0xe000;
18538+
18539+
}, 1);
18540+
1851418541
m$(C$,["digit$C$I","digit$I$I"],
1851518542
function(c,radix){
1851618543
var i = (typeof c == "string" ? c.charCodeAt(0) : c);

0 commit comments

Comments
 (0)