diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeDocs.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeDocs.java index 6fee4e1bc..77a45b572 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeDocs.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/docs/As3PCodeDocs.java @@ -7,7 +7,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.helpers.Cache; import com.jpexs.helpers.Helper; import com.jpexs.helpers.utf8.Utf8Helper; -import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.text.DateFormat; @@ -17,7 +16,6 @@ import java.util.Date; import java.util.HashMap; import java.util.Locale; import java.util.Map; -import java.util.Properties; import java.util.ResourceBundle; import java.util.Set; import java.util.TimeZone; @@ -33,9 +31,11 @@ import java.util.logging.Logger; public class As3PCodeDocs { private static ResourceBundle prop; + private static Map flagDescriptions = new HashMap<>(); private static Cache docsCache = Cache.getInstance(false, true, "as3DocsCache"); + private static Map nameToDef = new HashMap<>(); static final String NEWLINE = "\r\n"; @@ -273,16 +273,13 @@ public class As3PCodeDocs { return cached; } String style = ""; - try { - InputStream is = As3PCodeDocs.class.getResourceAsStream("/com/jpexs/decompiler/flash/docs/docs.css"); - if (is == null) { - Logger.getLogger(As3PCodeDocs.class.getName()).log(Level.SEVERE, "docs.css needed for documentation not found"); - } else { - style = new String(Helper.readStream(is), "UTF-8"); - } - } catch (UnsupportedEncodingException ex) { - //ignore + InputStream is = As3PCodeDocs.class.getResourceAsStream("/com/jpexs/decompiler/flash/docs/docs.css"); + if (is == null) { + Logger.getLogger(As3PCodeDocs.class.getName()).log(Level.SEVERE, "docs.css needed for documentation not found"); + } else { + style = new String(Helper.readStream(is), Utf8Helper.charset); } + docsCache.put("__style", style); return style; } @@ -293,16 +290,13 @@ public class As3PCodeDocs { return cached; } String js = ""; - try { - InputStream is = As3PCodeDocs.class.getResourceAsStream("/com/jpexs/decompiler/flash/docs/docs.js"); - if (is == null) { - Logger.getLogger(As3PCodeDocs.class.getName()).log(Level.SEVERE, "docs.js needed for documentation not found"); - } else { - js = new String(Helper.readStream(is), "UTF-8"); - } - } catch (UnsupportedEncodingException ex) { - //ignore + InputStream is = As3PCodeDocs.class.getResourceAsStream("/com/jpexs/decompiler/flash/docs/docs.js"); + if (is == null) { + Logger.getLogger(As3PCodeDocs.class.getName()).log(Level.SEVERE, "docs.js needed for documentation not found"); + } else { + js = new String(Helper.readStream(is), Utf8Helper.charset); } + docsCache.put("__js", js); return js; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java index b0b812879..34895f2bb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java @@ -23,8 +23,6 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; /** * @@ -116,7 +114,7 @@ public class EcmaScript { //TODO: logic similar to 8.12.8 return o.call("toString", new ArrayList<>()); case "Number": - //TODO: logic similar to 8.12.8 + //TODO: logic similar to 8.12.8 return o.call("valueOf", new ArrayList<>()); default: return o.toPrimitive(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java index 39c11221f..cbd871372 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableTelemetryTag.java @@ -29,8 +29,8 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.decompiler.flash.types.annotations.SWFVersion; import com.jpexs.helpers.ByteArrayRange; import com.jpexs.helpers.Helper; +import com.jpexs.helpers.utf8.Utf8Helper; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.logging.Level; @@ -109,9 +109,9 @@ public class EnableTelemetryTag extends Tag implements PasswordTag { try { md = MessageDigest.getInstance("SHA-256"); - md.update(password.getBytes("UTF-8")); + md.update(password.getBytes(Utf8Helper.charset)); return Helper.byteArrayToHex(md.digest()); - } catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) { + } catch (NoSuchAlgorithmException ex) { } return null; diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/MD5Crypt.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/MD5Crypt.java index f82ab118d..bd012aec4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/MD5Crypt.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/MD5Crypt.java @@ -16,7 +16,7 @@ */ package com.jpexs.helpers; -import java.io.UnsupportedEncodingException; +import com.jpexs.helpers.utf8.Utf8Helper; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Random; @@ -93,16 +93,9 @@ public class MD5Crypt { salt = salt.substring(0, 8); } - byte[] passwordBytes = new byte[0]; - byte[] constBytes = new byte[0]; - byte[] saltBytes = new byte[0]; - try { - passwordBytes = password.getBytes("UTF-8"); - saltBytes = salt.getBytes("UTF-8"); - constBytes = magic.getBytes("UTF-8"); - } catch (UnsupportedEncodingException ex) { - //ignore - } + byte[] passwordBytes = password.getBytes(Utf8Helper.charset); + byte[] saltBytes = salt.getBytes(Utf8Helper.charset); + byte[] constBytes = magic.getBytes(Utf8Helper.charset); MessageDigest b; try {