From bef5f0ae675418416a268efd218d9a6a045946d4 Mon Sep 17 00:00:00 2001 From: Honfika Date: Thu, 7 Nov 2013 00:26:49 +0100 Subject: [PATCH] cleanup with "Inspect and Transform" --- .../browsers/cache/chrome/ChromeCache.java | 2 +- trunk/src/com/jpexs/decompiler/flash/SWF.java | 119 +++---- .../decompiler/flash/SWFInputStream.java | 2 +- .../decompiler/flash/SWFOutputStream.java | 6 +- .../com/jpexs/decompiler/flash/TagNode.java | 2 +- .../com/jpexs/decompiler/flash/abc/ABC.java | 14 +- .../decompiler/flash/abc/ABCInputStream.java | 10 +- .../decompiler/flash/abc/ABCOutputStream.java | 12 +- .../jpexs/decompiler/flash/abc/ClassPath.java | 2 +- .../decompiler/flash/abc/ScriptPack.java | 2 +- .../avm2/instructions/AVM2Instruction.java | 2 +- .../instructions/other/SetPropertyIns.java | 2 +- .../avm2/instructions/types/ConvertBIns.java | 2 +- .../abc/avm2/model/FullMultinameAVM2Item.java | 2 +- .../abc/avm2/model/NewFunctionAVM2Item.java | 2 +- .../methodinfo_parser/MethodInfoParser.java | 8 +- .../flash/abc/types/InstanceInfo.java | 4 +- .../decompiler/flash/abc/types/Multiname.java | 2 +- .../decompiler/flash/abc/types/Namespace.java | 2 +- .../flash/abc/types/traits/Trait.java | 8 +- .../flash/abc/types/traits/TraitClass.java | 28 +- .../flash/abc/types/traits/Traits.java | 2 +- .../jpexs/decompiler/flash/action/Action.java | 2 +- .../decompiler/flash/action/ActionGraph.java | 2 +- .../flash/action/ActionListReader.java | 21 +- .../action/model/FunctionActionItem.java | 4 +- .../parser/script/ActionScriptLexer.java | 2 +- .../flash/action/swf3/ActionGetURL.java | 6 +- .../flash/action/swf4/RegisterNumber.java | 4 +- .../console/CommandLineArgumentParser.java | 69 ++-- .../decompiler/flash/ecma/EcmaScript.java | 4 +- .../decompiler/flash/gui/ImagePanel.java | 2 +- .../flash/gui/LoadFromCacheFrame.java | 6 +- .../com/jpexs/decompiler/flash/gui/Main.java | 10 +- .../jpexs/decompiler/flash/gui/MainFrame.java | 20 +- .../decompiler/flash/gui/abc/ABCPanel.java | 2 +- .../flash/gui/abc/ClassesListTree.java | 2 +- .../flash/gui/abc/ClassesListTreeModel.java | 2 +- .../flash/gui/abc/NewTraitDialog.java | 4 +- .../flash/gui/abc/TraitsListModel.java | 2 +- .../flash/gui/action/ActionPanel.java | 122 +++---- .../flash/gui/player/PlayerControls.java | 6 +- .../flash/gui/proxy/ProxyFrame.java | 2 +- .../flash/tags/DefineBitsLossless2Tag.java | 2 +- .../flash/tags/DefineBitsLosslessTag.java | 2 +- .../flash/tags/DefineEditTextTag.java | 300 ++++++++++-------- .../decompiler/flash/tags/DefineText2Tag.java | 213 +++++++------ .../decompiler/flash/tags/DefineTextTag.java | 228 ++++++------- .../flash/tags/DoInitActionTag.java | 4 +- .../flash/tags/base/CharacterIdTag.java | 4 +- .../decompiler/flash/tags/base/FontTag.java | 4 +- .../flash/tags/gfx/DefineCompactedFont.java | 2 +- .../flash/types/filters/Filtering.java | 5 +- .../flash/types/gfx/ContourType.java | 4 +- .../decompiler/flash/types/gfx/EdgeType.java | 1 - .../flash/types/gfx/GFxInputStream.java | 12 +- .../flash/types/shaperecords/SHAPERECORD.java | 4 +- .../decompiler/flash/xfl/XFLConverter.java | 173 +++++----- .../jpexs/decompiler/graph/ExportMode.java | 5 +- trunk/src/com/jpexs/helpers/Helper.java | 21 +- trunk/src/com/jpexs/process/Process.java | 1 - trunk/src/com/jpexs/process/ProcessTools.java | 1 - .../process/win32/Win32ProcessTools.java | 4 +- .../sun/jna/platform/win32/Advapi32Util.java | 10 +- .../com/sun/jna/platform/win32/BaseTSD.java | 2 +- .../com/sun/jna/platform/win32/WinDef.java | 22 +- .../src/com/sun/jna/platform/win32/WinNT.java | 2 +- .../com/sun/jna/platform/win32/WinReg.java | 2 +- .../flash/generators/AS2Generator.java | 2 +- 69 files changed, 821 insertions(+), 738 deletions(-) diff --git a/trunk/src/com/jpexs/browsers/cache/chrome/ChromeCache.java b/trunk/src/com/jpexs/browsers/cache/chrome/ChromeCache.java index aa7a096a0..acf225885 100644 --- a/trunk/src/com/jpexs/browsers/cache/chrome/ChromeCache.java +++ b/trunk/src/com/jpexs/browsers/cache/chrome/ChromeCache.java @@ -56,7 +56,7 @@ public class ChromeCache implements CacheImplementation { for (EntryStore en : entries) { if (en.state == EntryStore.ENTRY_NORMAL) { String key = en.getKey(); - if (key != null && !key.trim().equals("")) { + if (key != null && !key.trim().isEmpty()) { ret.add(en); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 5eafd49d8..7c4c23512 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -141,7 +141,7 @@ import javax.imageio.ImageIO; * * @author JPEXS */ -public class SWF { +public final class SWF { /** * Default version of SWF file format @@ -479,52 +479,56 @@ public class SWF { byte[] hdr = new byte[3]; fis.read(hdr); String shdr = new String(hdr, "utf-8"); - if (shdr.equals("CWS")) { - int version = fis.read(); - SWFInputStream sis = new SWFInputStream(fis, version, 4); - long fileSize = sis.readUI32(); - SWFOutputStream sos = new SWFOutputStream(fos, version); - sos.write("FWS".getBytes("utf-8")); - sos.writeUI8(version); - sos.writeUI32(fileSize); - InflaterInputStream iis = new InflaterInputStream(fis); - int i; - while ((i = iis.read()) != -1) { - fos.write(i); - } - - fis.close(); - fos.close(); - } else if (shdr.equals("ZWS")) { - int version = fis.read(); - SWFInputStream sis = new SWFInputStream(fis, version, 4); - long fileSize = sis.readUI32(); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - sis.readUI32(); //outSize - int propertiesSize = 5; - byte[] lzmaProperties = new byte[propertiesSize]; - if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) { - throw new IOException("LZMA:input .lzma file is too short"); - } - SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder(); - if (!decoder.SetDecoderProperties(lzmaProperties)) { - throw new IOException("LZMA:Incorrect stream properties"); - } - - if (!decoder.Code(sis, baos, fileSize - 8)) { - throw new IOException("LZMA:Error in data stream"); - } - try (SWFOutputStream sos = new SWFOutputStream(fos, version)) { - sos.write("FWS".getBytes("utf-8")); - sos.write(version); - sos.writeUI32(fileSize); - sos.write(baos.toByteArray()); - } - fis.close(); - fos.close(); - } else { - return false; + switch (shdr) { + case "CWS": + { + int version = fis.read(); + SWFInputStream sis = new SWFInputStream(fis, version, 4); + long fileSize = sis.readUI32(); + SWFOutputStream sos = new SWFOutputStream(fos, version); + sos.write("FWS".getBytes("utf-8")); + sos.writeUI8(version); + sos.writeUI32(fileSize); + InflaterInputStream iis = new InflaterInputStream(fis); + int i; + while ((i = iis.read()) != -1) { + fos.write(i); + } + fis.close(); + fos.close(); + break; + } + case "ZWS": + { + int version = fis.read(); + SWFInputStream sis = new SWFInputStream(fis, version, 4); + long fileSize = sis.readUI32(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + sis.readUI32(); + int propertiesSize = 5; + byte[] lzmaProperties = new byte[propertiesSize]; + if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) { + throw new IOException("LZMA:input .lzma file is too short"); + } + SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder(); + if (!decoder.SetDecoderProperties(lzmaProperties)) { + throw new IOException("LZMA:Incorrect stream properties"); + } + if (!decoder.Code(sis, baos, fileSize - 8)) { + throw new IOException("LZMA:Error in data stream"); + } + try (SWFOutputStream sos = new SWFOutputStream(fos, version)) { + sos.write("FWS".getBytes("utf-8")); + sos.write(version); + sos.writeUI32(fileSize); + sos.write(baos.toByteArray()); + } + fis.close(); + fos.close(); + break; + } + default: + return false; } } catch (FileNotFoundException ex) { return false; @@ -842,7 +846,7 @@ public class SWF { expName = ""; } if (expName.contains(".")) { - expName = expName.substring(expName.lastIndexOf(".") + 1); + expName = expName.substring(expName.lastIndexOf('.') + 1); } if ((ct.getClass().getName() + "_" + expName).compareTo(addNode.tag.getClass().getName() + "_" + pathParts[pos]) > 0) { break; @@ -1023,7 +1027,7 @@ public class SWF { private static void writeLE(OutputStream os, long val, int size) throws IOException { for (int i = 0; i < size; i++) { os.write((int) (val & 0xff)); - val = val >> 8; + val >>= 8; } } @@ -1528,17 +1532,17 @@ public class SWF { } if (allVariableNamesStr.contains(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue loopfoo; } if (isReserved(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue; } if (deobfuscated.containsValue(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue; } } while (exists); @@ -1856,13 +1860,13 @@ public class SWF { String pkg = null; String name = ""; if (n.contains(".")) { - pkg = n.substring(0, n.lastIndexOf(".")); - name = n.substring(n.lastIndexOf(".") + 1); + pkg = n.substring(0, n.lastIndexOf('.')); + name = n.substring(n.lastIndexOf('.') + 1); } else { name = n; } boolean changed = false; - if ((pkg != null) && (!pkg.equals(""))) { + if ((pkg != null) && (!pkg.isEmpty())) { String changedPkg = deobfuscatePackage(pkg, renameType, selected); if (changedPkg != null) { changed = true; @@ -2092,7 +2096,7 @@ public class SWF { informListeners("rename", "function " + fc + "/" + allFunctions.size()); if (fun instanceof ActionDefineFunction) { ActionDefineFunction f = (ActionDefineFunction) fun; - if (f.functionName.equals("")) { //anonymous function, leave as is + if (f.functionName.isEmpty()) { //anonymous function, leave as is continue; } String changed = deobfuscateName(f.functionName, false, "function", renameType, selected); @@ -2103,7 +2107,7 @@ public class SWF { } if (fun instanceof ActionDefineFunction2) { ActionDefineFunction2 f = (ActionDefineFunction2) fun; - if (f.functionName.equals("")) { //anonymous function, leave as is + if (f.functionName.isEmpty()) { //anonymous function, leave as is continue; } String changed = deobfuscateName(f.functionName, false, "function", renameType, selected); @@ -2524,7 +2528,6 @@ public class SWF { f++; } } - return; } public void removeTagFromTimeline(Tag toRemove, List timeline) { diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index f07d642a9..a163a31b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -471,7 +471,7 @@ public class SWFInputStream extends InputStream { } for (int bit = 0; bit < nBits; bit++) { int nb = (tempByte >> (7 - bitPos)) & 1; - ret = ret + (nb << (nBits - 1 - bit)); + ret += (nb << (nBits - 1 - bit)); bitPos++; if (bitPos == 8) { bitPos = 0; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java index a13c16192..2f0f84e05 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFOutputStream.java @@ -236,7 +236,7 @@ public class SWFOutputStream extends OutputStream { int sign = bits >> 31; int exponent = (bits >> 22) & 0xff; int mantisa = bits & 0x3FFFFF; - mantisa = mantisa >> 13; + mantisa >>= 13; writeUI16((sign << 15) + (exponent << 10) + mantisa); } @@ -248,7 +248,7 @@ public class SWFOutputStream extends OutputStream { */ public void writeEncodedU32(long value) throws IOException { boolean loop = true; - value = value & 0xFFFFFFFF; + value &= 0xFFFFFFFF; do { int ret = (int) (value & 0x7F); if (value < 0x80) { @@ -258,7 +258,7 @@ public class SWFOutputStream extends OutputStream { ret += 0x80; } write(ret); - value = value >> 7; + value >>= 7; } while (loop); } diff --git a/trunk/src/com/jpexs/decompiler/flash/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/TagNode.java index ac3384e32..2e77ef927 100644 --- a/trunk/src/com/jpexs/decompiler/flash/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/TagNode.java @@ -277,7 +277,7 @@ public class TagNode { File dir = new File(outdir); List ret = new ArrayList<>(); if (!outdir.endsWith(File.separator)) { - outdir = outdir + File.separator; + outdir += File.separator; } List existingNames = new ArrayList<>(); for (TagNode node : nodeList) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index 109a934ee..80fba2add 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -274,10 +274,10 @@ public class ABC { String pkg = ""; String name = fullname; if (fullname.contains(".")) { - pkg = fullname.substring(0, fullname.lastIndexOf(".")); - name = fullname.substring(fullname.lastIndexOf(".") + 1); + pkg = fullname.substring(0, fullname.lastIndexOf('.')); + name = fullname.substring(fullname.lastIndexOf('.') + 1); } - if (!pkg.equals("")) { + if (!pkg.isEmpty()) { int pkgStrIndex = constants.getStringId(pkg, true); pkgStrIndex = deobfuscatePackageName(stringUsageTypes, stringUsages, namesMap, pkgStrIndex, renameType); pkg = constants.constant_string[pkgStrIndex]; @@ -286,7 +286,7 @@ public class ABC { nameStrIndex = deobfuscateName(stringUsageTypes, stringUsages, namespaceUsages, namesMap, nameStrIndex, true, renameType); name = constants.constant_string[nameStrIndex]; String fullChanged = ""; - if (!pkg.equals("")) { + if (!pkg.isEmpty()) { fullChanged = pkg + "."; } fullChanged += name; @@ -823,18 +823,18 @@ public class ABC { for (int i = 1; i < constants.constant_string.length; i++) { if (constants.constant_string[i].equals(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue loopfoo; } } if (isReserved(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue; } if (deobfuscated.containsValue(ret)) { exists = true; - rndSize = rndSize + 1; + rndSize += 1; continue; } } while (exists); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java index c4a985adc..8b76d9fd9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java @@ -109,8 +109,8 @@ public class ABCInputStream extends InputStream { do { i = read(); nextByte = (i >> 7) == 1; - i = i & 0x7f; - ret = ret + (i << bytePos); + i &= 0x7f; + ret += (i << bytePos); byteCount++; bytePos += 7; } while (nextByte); @@ -125,7 +125,7 @@ public class ABCInputStream extends InputStream { int ret = (read()) + (read() << 8) + (read() << 16); if ((ret >> 23) == 1) { - ret = ret | 0xff000000; + ret |= 0xff000000; } return ret; @@ -144,8 +144,8 @@ public class ABCInputStream extends InputStream { do { i = read(); nextByte = (i >> 7) == 1; - i = i & 0x7f; - ret = ret + (i << bytePos); + i &= 0x7f; + ret += (i << bytePos); byteCount++; bytePos += 7; if (bytePos == 35) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java index c928c85a9..cfda6c601 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java @@ -60,7 +60,7 @@ public class ABCOutputStream extends OutputStream { public void writeU32(long value) throws IOException { boolean loop = true; - value = value & 0xFFFFFFFF; + value &= 0xFFFFFFFF; do { int ret = (int) (value & 0x7F); if (value < 0x80) { @@ -70,17 +70,17 @@ public class ABCOutputStream extends OutputStream { ret += 0x80; } write(ret); - value = value >> 7; + value >>= 7; } while (loop); } public void writeS24(long value) throws IOException { int ret = (int) (value & 0xff); write(ret); - value = value >> 8; + value >>= 8; ret = (int) (value & 0xff); write(ret); - value = value >> 8; + value >>= 8; ret = (int) (value & 0xff); write(ret); } @@ -107,13 +107,13 @@ public class ABCOutputStream extends OutputStream { } if (bitcount == 35) { - ret = ret & 0xf; + ret &= 0xf; } write(ret); if (bitcount == 35) { break; } - value = value >> 7; + value >>= 7; } while (loop); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ClassPath.java b/trunk/src/com/jpexs/decompiler/flash/abc/ClassPath.java index 5ae2f7f19..7d1b8c737 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ClassPath.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ClassPath.java @@ -34,7 +34,7 @@ public class ClassPath { @Override public String toString() { - return (packageStr == null || packageStr.equals("")) ? className : packageStr + "." + className; + return (packageStr == null || packageStr.isEmpty()) ? className : packageStr + "." + className; } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 1372a67fc..bf4edbadb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -99,7 +99,7 @@ public class ScriptPack { return packageName.equals("") ? scriptName : packageName + "." + scriptName; }*/ private static String makeDirPath(String packageName) { - if (packageName.equals("")) { + if (packageName.isEmpty()) { return ""; } String[] pathParts; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index 5762a2b96..ee9767126 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -254,7 +254,7 @@ public class AVM2Instruction implements Serializable, GraphSourceItem { if (ignored) { return " ;ignored"; } - if ((comment == null) || comment.equals("")) { + if ((comment == null) || comment.isEmpty()) { return ""; } return " ;" + comment; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java index f278df007..86a8212bc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java @@ -123,7 +123,7 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns int multinameIndex = ins.operands[0]; String multiname = resolveMultinameNoPop(0, stack, abc.constants, multinameIndex, ins, fullyQualifiedNames); GraphTargetItem obj = stack.get(1 + resolvedCount(abc.constants, multinameIndex)); //pod vrcholem - if ((!obj.toString().equals(""))) { + if ((!obj.toString().isEmpty())) { multiname = "." + multiname; } return obj + multiname; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java index 360e5869e..826bf5c00 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java @@ -45,7 +45,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver } else if (value instanceof Long) { bval = ((Long) value).longValue() != 0; } else if (value instanceof String) { - bval = !((String) value).equals(""); + bval = !((String) value).isEmpty(); } else { bval = true; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java index 18fec9854..9a9d4a9b0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java @@ -72,7 +72,7 @@ public class FullMultinameAVM2Item extends AVM2Item { cns = ns.getName(constants); } } - return cname.equals("XML") && cns.equals(""); + return cname.equals("XML") && cns.isEmpty(); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java index 7f9000c13..f108b346c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java @@ -62,7 +62,7 @@ public class NewFunctionAVM2Item extends AVM2Item { @Override protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) { MethodBody body = abc.findBody(methodIndex); - writer.append("function" + (!functionName.equals("") ? " " + functionName : "")); + writer.append("function" + (!functionName.isEmpty() ? " " + functionName : "")); writer.startMethod(methodIndex); writer.appendNoHilight("("); methodInfo[methodIndex].getParamStr(writer, constants, body, abc, fullyQualifiedNames); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java index cbe8de8b3..9ad2487d7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java @@ -56,7 +56,7 @@ public class MethodInfoParser { nstype = nstype + symbValue.type + ":"; } } while (symbValue.type >= 8 && symbValue.type <= 13); - if ((!nstype.equals("")) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) { + if ((!nstype.isEmpty()) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) { throw new ParseException("Namespace expected", lexer.yyline()); } int id = 0; @@ -95,7 +95,7 @@ public class MethodInfoParser { value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_StaticProtectedNs); } else if (nstype.equals("8:")) { value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_PrivateNs); - } else if (nstype.equals("")) { + } else if (nstype.isEmpty()) { value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_Namespace); } else { throw new ParseException("Invalid type of namespace", lexer.yyline()); @@ -194,7 +194,7 @@ public class MethodInfoParser { nstype = nstype + symbValue.type + ":"; } } while (symbValue.type >= 8 && symbValue.type <= 13); - if ((!nstype.equals("")) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) { + if ((!nstype.isEmpty()) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) { throw new ParseException("Namespace expected", lexer.yyline()); } int id = 0; @@ -233,7 +233,7 @@ public class MethodInfoParser { optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_StaticProtectedNs)); } else if (nstype.equals("8:")) { optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_PrivateNs)); - } else if (nstype.equals("")) { + } else if (nstype.isEmpty()) { optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_Namespace)); } else { throw new ParseException("Invalid type of namespace", lexer.yyline()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java index 63ffe7ea7..cc0096ba0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java @@ -72,7 +72,7 @@ public class InstanceInfo { String modifiers; Namespace ns = abc.constants.constant_multiname[name_index].getNamespace(abc.constants); modifiers = ns.getPrefix(abc); - if (!modifiers.equals("")) { + if (!modifiers.isEmpty()) { modifiers += " "; } @@ -80,7 +80,7 @@ public class InstanceInfo { modifiers += "final "; } if (isDynamic()) { - modifiers = modifiers + "dynamic "; + modifiers += "dynamic "; } String objType = "class "; if (isInterface()) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java index 4153a3cc0..8fa58538c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java @@ -257,7 +257,7 @@ public class Multiname { Namespace ns = getNamespace(constants); if (ns != null) { String nsname = ns.getName(constants); - if (!nsname.equals("")) { + if (!nsname.isEmpty()) { ret += nsname + "."; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java index 172a1cf60..08de189c9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java @@ -81,7 +81,7 @@ public class Namespace { public String getNameWithKind(ConstantPool constants) { String kindStr = getKindStr(); String nameStr = constants.constant_string[name_index]; - return kindStr + (nameStr.equals("") ? "" : " " + nameStr); + return kindStr + (nameStr.isEmpty() ? "" : " " + nameStr); } public String getPrefix(ABC abc) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java index dabc290d2..262862f42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java @@ -63,9 +63,9 @@ public abstract class Trait implements Serializable { break; } if (nsname.contains(".")) { - nsname = nsname.substring(nsname.lastIndexOf(".") + 1); + nsname = nsname.substring(nsname.lastIndexOf('.') + 1); } - if (!nsname.equals("")) { + if (!nsname.isEmpty()) { break; } } @@ -77,7 +77,7 @@ public abstract class Trait implements Serializable { } - if ((!nsname.equals("")) && (!nsname.equals("-"))) { + if ((!nsname.isEmpty()) && (!nsname.equals("-"))) { } else { if (ns != null) { if (ns.kind == Namespace.KIND_NAMESPACE) { @@ -86,7 +86,7 @@ public abstract class Trait implements Serializable { } } - if ((!nsname.contains(":")) && (!nsname.equals(""))) { + if ((!nsname.contains(":")) && (!nsname.isEmpty())) { ret += " " + nsname; } if (ns != null) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index 2c4a1cc39..fe8e128b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -70,7 +70,7 @@ public class TraitClass extends Trait implements TraitWithSlot { private boolean parseUsagesFromNS(List abcTags, ABC abc, List imports, List uses, int namespace_index, String ignorePackage, String name) { Namespace ns = abc.constants.constant_namespace[namespace_index]; - if (name.equals("")) { + if (name.isEmpty()) { name = "*"; } String newimport = ns.getName(abc.constants); @@ -87,7 +87,7 @@ public class TraitClass extends Trait implements TraitWithSlot { if (newname.equals("-")) { return true; } - if (!newname.equals("")) { + if (!newname.isEmpty()) { newimport = newname; break; } @@ -96,7 +96,7 @@ public class TraitClass extends Trait implements TraitWithSlot { newimport = oldimport; newimport += "." + name; } - if (newimport.equals("")) { + if (newimport.isEmpty()) { newimport = null; } if (newimport != null) { @@ -110,11 +110,11 @@ public class TraitClass extends Trait implements TraitWithSlot { } String pkg = ""; if (newimport.contains(".")) { - pkg = newimport.substring(0, newimport.lastIndexOf(".")); + pkg = newimport.substring(0, newimport.lastIndexOf('.')); } String usname = newimport; if (usname.contains(".")) { - usname = usname.substring(usname.lastIndexOf(".") + 1); + usname = usname.substring(usname.lastIndexOf('.') + 1); } if (ns.kind == Namespace.KIND_PACKAGE) { if (!pkg.equals(ignorePackage)) { @@ -140,7 +140,7 @@ public class TraitClass extends Trait implements TraitWithSlot { private void parseImportsUsagesFromNS(List abcTags, ABC abc, List imports, List uses, int namespace_index, String ignorePackage, String name) { Namespace ns = abc.constants.constant_namespace[namespace_index]; - if (name.equals("")) { + if (name.isEmpty()) { name = "*"; } String newimport = ns.getName(abc.constants); @@ -158,7 +158,7 @@ public class TraitClass extends Trait implements TraitWithSlot { return; } if (!imports.contains(newimport)) { - String pkg = newimport.substring(0, newimport.lastIndexOf(".")); + String pkg = newimport.substring(0, newimport.lastIndexOf('.')); if (!pkg.equals(ignorePackage)) { imports.add(newimport); } @@ -348,8 +348,8 @@ public class TraitClass extends Trait implements TraitWithSlot { String pkg = ""; String name = spath; if (spath.contains(".")) { - pkg = spath.substring(0, spath.lastIndexOf(".")); - name = spath.substring(spath.lastIndexOf(".") + 1); + pkg = spath.substring(0, spath.lastIndexOf('.')); + name = spath.substring(spath.lastIndexOf('.') + 1); } if (pkg.equals(packageName)) { namesInThisPackage.add(name); @@ -371,10 +371,10 @@ public class TraitClass extends Trait implements TraitWithSlot { String name = ipath; String pkg = ""; if (name.contains(".")) { - pkg = name.substring(0, name.lastIndexOf(".")); - name = name.substring(name.lastIndexOf(".") + 1); + pkg = name.substring(0, name.lastIndexOf('.')); + name = name.substring(name.lastIndexOf('.') + 1); } - if (importnames.contains(name) || ((!pkg.equals("")) && isBuiltInClass(name))) { + if (importnames.contains(name) || ((!pkg.isEmpty()) && isBuiltInClass(name))) { fullyQualifiedNames.add(name); } else { importnames.add(name); @@ -397,8 +397,8 @@ public class TraitClass extends Trait implements TraitWithSlot { for (int i = 0; i < imports.size(); i++) { String imp = imports.get(i); - String pkg = imp.substring(0, imp.lastIndexOf(".")); - String name = imp.substring(imp.lastIndexOf(".") + 1); + String pkg = imp.substring(0, imp.lastIndexOf('.')); + String name = imp.substring(imp.lastIndexOf('.') + 1); if (name.equals("*")) { continue; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java index 657cb4590..14e6f31c2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Traits.java @@ -128,7 +128,7 @@ public class Traits implements Serializable { int h = t; if (classIndex != -1) { if (!isStatic) { - h = h + abc.class_info[classIndex].static_traits.traits.length; + h += abc.class_info[classIndex].static_traits.traits.length; } } if (trait instanceof TraitClass) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 68879f3a4..2e91b7a9f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -123,7 +123,7 @@ public class Action implements GraphSourceItem { "_ymouse" }; public static final List propertyNamesList = Arrays.asList(propertyNames); - private static Logger logger = Logger.getLogger(Action.class.getName()); + private static final Logger logger = Logger.getLogger(Action.class.getName()); /** * Constructor diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java index c9a9f54c2..99d52b1eb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -120,7 +120,7 @@ public class ActionGraph extends Graph { GraphTargetItem it = list.get(t); if (it instanceof SetTargetActionItem) { SetTargetActionItem st = (SetTargetActionItem) it; - if (st.target.equals("")) { + if (st.target.isEmpty()) { if (targetStart > -1) { targetEnd = t; break; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 21f47d2d0..3319c7c75 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -627,7 +627,7 @@ public class ActionListReader { } } - ip = ip + actionLengthWithHeader; + ip += actionLengthWithHeader; if (a.isExit()) { break; @@ -731,13 +731,16 @@ public class ActionListReader { System.out.print("newip " + nip + ", "); System.out.print("Action: jump(j),ignore(i),compute(c)?"); String next = sc.next(); - if (next.equals("j")) { - newip = pos + aif.getJumpOffset(); - pos = newip; - - } else if (next.equals("i")) { - } else if (next.equals("c")) { - goaif = true; + switch (next) { + case "j": + newip = pos + aif.getJumpOffset(); + pos = newip; + break; + case "i": + break; + case "c": + goaif = true; + break; } } else if (top.isCompileTime() && (!top.hasSideEffect())) { ((ActionIf) a).compileTime = true; @@ -843,7 +846,7 @@ public class ActionListReader { if (newip > -1) { ip = newip; } else { - ip = ip + info; + ip += info; } pos = ip; if (goaif) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java index 0f5e7820c..e33217774 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java @@ -81,7 +81,7 @@ public class FunctionActionItem extends ActionItem { if (calculatedFunctionName != null) { writer.append(" "); calculatedFunctionName.toStringNoQuotes(writer, localData); - } else if (!functionName.equals("")) { + } else if (!functionName.isEmpty()) { writer.append(" "); writer.append(functionName); } @@ -91,7 +91,7 @@ public class FunctionActionItem extends ActionItem { writer.append(", "); } String pname = paramNames.get(p); - if (pname == null || pname.equals("")) { + if (pname == null || pname.isEmpty()) { pname = new RegisterNumber(regStart + p).translate(); } writer.append(pname); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java index 5d1972620..96655f55f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptLexer.java @@ -1413,7 +1413,7 @@ public final class ActionScriptLexer { String s = yytext(); s = s.substring(1, s.length() - 1); if (s.contains(" ")) { - s = s.substring(0, s.indexOf(" ")); + s = s.substring(0, s.indexOf(' ')); } xmlTagName = s; string.append(yytext()); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java index ec5bfaebd..1fcec7ff8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java @@ -82,7 +82,7 @@ public class ActionGetURL extends Action { @Override public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { String fsCommandPrefix = "FSCommand:"; - if (urlString.startsWith(fsCommandPrefix) && targetString.equals("")) { + if (urlString.startsWith(fsCommandPrefix) && targetString.isEmpty()) { String command = urlString.substring(fsCommandPrefix.length()); output.add(new FSCommandActionItem(this, command)); return; @@ -91,7 +91,7 @@ public class ActionGetURL extends Action { if (targetString.startsWith(levelPrefix)) { try { int num = Integer.valueOf(targetString.substring(levelPrefix.length())); - if (urlString.equals("")) { + if (urlString.isEmpty()) { output.add(new UnLoadMovieNumActionItem(this, new DirectValueActionItem((Long) (long) (int) num))); } else { DirectValueActionItem urlStringDi = new DirectValueActionItem(null, 0, urlString, new ArrayList()); @@ -103,7 +103,7 @@ public class ActionGetURL extends Action { } - if (urlString.equals("")) { + if (urlString.isEmpty()) { DirectValueActionItem targetStringDi = new DirectValueActionItem(null, 0, targetString, new ArrayList()); output.add(new UnLoadMovieActionItem(this, targetStringDi)); } else { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java index 258be8d07..308592ac5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/RegisterNumber.java @@ -51,7 +51,7 @@ public class RegisterNumber implements Serializable { @Override public String toString() { - if (name == null || name.trim().equals("")) { + if (name == null || name.trim().isEmpty()) { return toStringNoName(); } return name; @@ -62,7 +62,7 @@ public class RegisterNumber implements Serializable { } public String translate() { - if (name == null || name.trim().equals("")) { + if (name == null || name.trim().isEmpty()) { return "_loc" + number + "_"; } return name; diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 5d5f01c18..755c35dbd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -116,31 +116,39 @@ public class CommandLineArgumentParser { AbortRetryIgnoreHandler handler = null; String nextParam; + OUTER: while (true) { nextParam = args.remove(); - if (nextParam.equals("-config")) { - parseConfig(args); - if (args.isEmpty()) { - Main.saveConfig(); - System.out.println("Configuration saved"); - return null; - } - } else if (nextParam.equals("-onerror")) { - handler = parseOnError(args); - } else if (nextParam.equals("-timeout")) { - parseTimeout(args); - } else if (nextParam.equals("-affinity")) { - parseAffinity(args); - } else if (nextParam.equals("-priority")) { - parsePriority(args); - } else if (nextParam.equals("-verbose")) { - traceLevel = Level.FINE; - } else if (nextParam.equals("-debug")) { - Configuration.debugMode = true; - } else { - break; + switch (nextParam) { + case "-config": + parseConfig(args); + if (args.isEmpty()) { + Main.saveConfig(); + System.out.println("Configuration saved"); + return null; + } + break; + case "-onerror": + handler = parseOnError(args); + break; + case "-timeout": + parseTimeout(args); + break; + case "-affinity": + parseAffinity(args); + break; + case "-priority": + parsePriority(args); + break; + case "-verbose": + traceLevel = Level.FINE; + break; + case "-debug": + Configuration.debugMode = true; + break; + default: + break OUTER; } - if (args.isEmpty()) { return null; } @@ -237,14 +245,15 @@ public class CommandLineArgumentParser { } private static ExportMode strToExportFormat(String exportFormatStr) { - if (exportFormatStr.equals("pcode")) { - return ExportMode.PCODE; - } else if (exportFormatStr.equals("pcodehex")) { - return ExportMode.PCODEWITHHEX; - } else if (exportFormatStr.equals("hex")) { - return ExportMode.HEX; - } else { - return ExportMode.SOURCE; + switch (exportFormatStr) { + case "pcode": + return ExportMode.PCODE; + case "pcodehex": + return ExportMode.PCODEWITHHEX; + case "hex": + return ExportMode.HEX; + default: + return ExportMode.SOURCE; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java b/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java index da24e3b16..00a8a5226 100644 --- a/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java +++ b/trunk/src/com/jpexs/decompiler/flash/ecma/EcmaScript.java @@ -269,7 +269,7 @@ public class EcmaScript { } if (o instanceof String) { String s = (String) o; - return !s.equals(""); + return !s.isEmpty(); } return true; //other Object } @@ -289,7 +289,7 @@ public class EcmaScript { return 0L; } Long posInt = (long) (double) (Math.signum(n) * Math.floor(Math.abs(n))); - posInt = posInt % (1 << 32); + posInt %= (1 << 32); return posInt; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index abb19226a..b1862bf58 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -36,7 +36,7 @@ import javax.swing.JColorChooser; import javax.swing.JLabel; import javax.swing.JPanel; -public class ImagePanel extends JPanel implements ActionListener, FlashDisplay { +public final class ImagePanel extends JPanel implements ActionListener, FlashDisplay { public JLabel label = new JLabel(); public DrawableTag drawable; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java index 5118616ed..6e1cdbe51 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java @@ -197,7 +197,7 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener { String search = searchField.getText(); List filtered = new ArrayList<>(); for (CacheEntry en : entries) { - if (search.equals("") || en.getRequestURL().contains(search)) { + if (search.isEmpty() || en.getRequestURL().contains(search)) { filtered.add(en); } } @@ -208,11 +208,11 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener { String ret = en.getRequestURL(); //Strip parameters if (ret.contains("?")) { - ret = ret.substring(0, ret.indexOf("?")); + ret = ret.substring(0, ret.indexOf('?')); } //Strip path if (ret.contains("/")) { - ret = ret.substring(ret.lastIndexOf("/") + 1); + ret = ret.substring(ret.lastIndexOf('/') + 1); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 8328f955c..03babe603 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -993,8 +993,8 @@ public class Main { } } else { if (s.contains("=")) { - String key = s.substring(0, s.indexOf("=")); - String val = s.substring(s.indexOf("=") + 1); + String key = s.substring(0, s.indexOf('=')); + String val = s.substring(s.indexOf('=') + 1); if ("updateSystem".equals(header)) { if (key.equals("majorVersion")) { updateMajor = Integer.parseInt(val); @@ -1029,8 +1029,8 @@ public class Main { ver.updateLink = val; } if (key.equals("change[]")) { - String changeType = val.substring(0, val.indexOf("|")); - String change = val.substring(val.indexOf("|") + 1); + String changeType = val.substring(0, val.indexOf('|')); + String change = val.substring(val.indexOf('|') + 1); if (!ver.changes.containsKey(changeType)) { ver.changes.put(changeType, new ArrayList()); } @@ -1041,7 +1041,7 @@ public class Main { } } } - if (s.equals("")) { + if (s.isEmpty()) { start = true; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index bef3a05a3..08c525a11 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -231,7 +231,7 @@ import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationM * * @author Jindra */ -public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSelectionListener, Freed { +public final class MainFrame extends AppRibbonFrame implements ActionListener, TreeSelectionListener, Freed { private SWF swf; public ABCPanel abcPanel; @@ -340,7 +340,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel } public void setWorkStatus(String s, Runnable cancelCallback) { - if (s.equals("")) { + if (s.isEmpty()) { loadingPanel.setVisible(false); } else { loadingPanel.setVisible(true); @@ -573,10 +573,10 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel int state = 0; if (maximizedHorizontal) { - state = state | JFrame.MAXIMIZED_HORIZ; + state |= JFrame.MAXIMIZED_HORIZ; } if (maximizedVertical) { - state = state | JFrame.MAXIMIZED_VERT; + state |= JFrame.MAXIMIZED_VERT; } setExtendedState(state); @@ -914,9 +914,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel files.clear(); File[] fs = ftemp.listFiles(); - for (File f : fs) { - files.add(f); - } + files.addAll(Arrays.asList(fs)); Main.stopWork(); } catch (IOException ex) { @@ -2188,7 +2186,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel ret.addAll(swf.exportTexts(handler, selFile + File.separator + "texts", texts, isFormatted)); ret.addAll(swf.exportMovies(handler, selFile + File.separator + "movies", movies)); ret.addAll(swf.exportSounds(handler, selFile + File.separator + "sounds", sounds, isMp3OrWav, isMp3OrWav)); - ret.addAll(swf.exportBinaryData(handler, selFile + File.separator + "binaryData", binaryData)); + ret.addAll(SWF.exportBinaryData(handler, selFile + File.separator + "binaryData", binaryData)); if (abcPanel != null) { for (int i = 0; i < tlsList.size(); i++) { ScriptPack tls = tlsList.get(i); @@ -2406,7 +2404,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel searchDialog.setVisible(true); if (searchDialog.result) { final String txt = searchDialog.searchField.getText(); - if (!txt.equals("")) { + if (!txt.isEmpty()) { if (abcPanel != null) { (new Thread() { @Override @@ -3241,8 +3239,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel mat.translateX = mat.translateX + width / 2 - r.getWidth() / 2; mat.translateY = mat.translateY + height / 2 - r.getHeight() / 2; } else { - mat.translateX = mat.translateX + width / 2; - mat.translateY = mat.translateY + height / 2; + mat.translateX += width / 2; + mat.translateY += height / 2; } sos2.writeTag(new PlaceObject2Tag(null, false, false, false, false, false, true, false, true, depth, chid, mat, null, 0, null, 0, null)); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 6b5e7704e..04d3a40d3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -109,7 +109,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr public JLabel scriptNameLabel; public boolean search(String txt, boolean ignoreCase, boolean regexp) { - if ((txt != null) && (!txt.equals(""))) { + if ((txt != null) && (!txt.isEmpty())) { searchIgnoreCase = ignoreCase; searchRegexp = regexp; ClassesListTreeModel clModel = (ClassesListTreeModel) classTree.getModel(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTree.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTree.java index bebd73295..0b06cbe8e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTree.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTree.java @@ -35,7 +35,7 @@ import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -public class ClassesListTree extends JTree implements TreeSelectionListener { +public final class ClassesListTree extends JTree implements TreeSelectionListener { private List abcList; public List> treeList; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java index 159e976b7..580eadc2b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java @@ -91,7 +91,7 @@ public class ClassesListTreeModel implements TreeModel { public ClassesListTreeModel(List> list, String filter) { for (MyEntry item : list) { if (filter != null) { - if (!filter.equals("")) { + if (!filter.isEmpty()) { if (!item.key.toString().contains(filter)) { continue; } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java index f26bda0d7..2a47798df 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java @@ -101,7 +101,7 @@ public class NewTraitDialog extends AppDialog implements ActionListener { for (int i = 0; i < accessStrings.length; i++) { String pref = Namespace.kindToPrefix(modifiers[i]); String name = Namespace.kindToStr(modifiers[i]); - accessStrings[i] = (pref.equals("") ? "" : pref + " ") + "(" + name + ")"; + accessStrings[i] = (pref.isEmpty() ? "" : pref + " ") + "(" + name + ")"; } @@ -162,7 +162,7 @@ public class NewTraitDialog extends AppDialog implements ActionListener { public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { case "OK": - if (nameField.getText().trim().equals("")) { + if (nameField.getText().trim().isEmpty()) { View.showMessageDialog(null, translate("error.name"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); return; } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListModel.java index 71f7f0f5a..1464ee86d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/TraitsListModel.java @@ -25,7 +25,7 @@ import java.util.List; import javax.swing.ListModel; import javax.swing.event.ListDataListener; -public class TraitsListModel implements ListModel { +public final class TraitsListModel implements ListModel { private List items; private List abcTags; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index e02018c7a..af8c4f48d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -53,14 +53,12 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Scanner; import java.util.concurrent.Callable; import java.util.concurrent.FutureTask; import java.util.logging.Level; @@ -208,10 +206,10 @@ public class ActionPanel extends JPanel implements ActionListener { } public boolean search(String txt, boolean ignoreCase, boolean regexp) { - if ((txt != null) && (!txt.equals(""))) { + if ((txt != null) && (!txt.isEmpty())) { searchIgnoreCase = ignoreCase; searchRegexp = regexp; - List list = Main.swf.createASTagList(Main.swf.tags, null); + List list = SWF.createASTagList(Main.swf.tags, null); Map asms = getASMs("", list); found = new ArrayList<>(); Pattern pat = null; @@ -293,7 +291,7 @@ public class ActionPanel extends JPanel implements ActionListener { public void setHex(ExportMode exportMode) { if (exportMode != ExportMode.HEX) { - if (exportMode == exportMode.PCODE) { + if (exportMode == ExportMode.PCODE) { if (srcNoHex == null) { srcNoHex = getHilightedText(exportMode); } @@ -702,63 +700,73 @@ public class ActionPanel extends JPanel implements ActionListener { foundPos = (foundPos + 1) % found.size(); updateSearchPos(); } - if (e.getActionCommand().equals("GRAPH")) { - if (lastCode != null) { - try { - GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap(), new HashMap(), new HashMap(), SWF.DEFAULT_VERSION), ""); - gf.setVisible(true); - } catch (InterruptedException ex) { - Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex); + switch (e.getActionCommand()) { + case "GRAPH": + if (lastCode != null) { + try { + GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap(), new HashMap(), new HashMap(), SWF.DEFAULT_VERSION), ""); + gf.setVisible(true); + } catch (InterruptedException ex) { + Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex); + } } - } - } else if (e.getActionCommand().equals("EDITACTION")) { - setEditMode(true); - } else if (e.getActionCommand().equals("HEX") || e.getActionCommand().equals("HEXONLY")) { - if (e.getActionCommand().equals("HEX")) { - hexOnlyButton.setSelected(false); - } else { - hexButton.setSelected(false); - } - setHex(getExportMode()); - } else if (e.getActionCommand().equals("CANCELACTION")) { - setEditMode(false); - setHex(getExportMode()); - } else if (e.getActionCommand().equals("SAVEACTION")) { - try { - String text = editor.getText(); - if (text.trim().startsWith("#hexdata")) { - src.setActionBytes(Helper.getBytesFromHexaText(text)); + break; + case "EDITACTION": + setEditMode(true); + break; + case "HEX": + case "HEXONLY": + if (e.getActionCommand().equals("HEX")) { + hexOnlyButton.setSelected(false); } else { - src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION); + hexButton.setSelected(false); } - setSource(this.src, false); - View.showMessageDialog(this, AppStrings.translate("message.action.saved")); - saveButton.setVisible(false); - cancelButton.setVisible(false); - editButton.setVisible(true); - editor.setEditable(false); - editMode = false; - } catch (IOException ex) { - } catch (ParseException ex) { - View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); - } - } else if (e.getActionCommand().equals("EDITDECOMPILED")) { - setDecompiledEditMode(true); - } else if (e.getActionCommand().equals("CANCELDECOMPILED")) { - setDecompiledEditMode(false); - } else if (e.getActionCommand().equals("SAVEDECOMPILED")) { - try { - ActionScriptParser par = new ActionScriptParser(); - src.setActions(par.actionsFromString(decompiledEditor.getText()), SWF.DEFAULT_VERSION); - setSource(this.src, false); - View.showMessageDialog(this, AppStrings.translate("message.action.saved")); + setHex(getExportMode()); + break; + case "CANCELACTION": + setEditMode(false); + setHex(getExportMode()); + break; + case "SAVEACTION": + try { + String text = editor.getText(); + if (text.trim().startsWith("#hexdata")) { + src.setActionBytes(Helper.getBytesFromHexaText(text)); + } else { + src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION); + } + setSource(this.src, false); + View.showMessageDialog(this, AppStrings.translate("message.action.saved")); + saveButton.setVisible(false); + cancelButton.setVisible(false); + editButton.setVisible(true); + editor.setEditable(false); + editMode = false; + } catch (IOException ex) { + } catch (ParseException ex) { + View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); + } + break; + case "EDITDECOMPILED": + setDecompiledEditMode(true); + break; + case "CANCELDECOMPILED": setDecompiledEditMode(false); - } catch (IOException ex) { - Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex); - } catch (ParseException ex) { - View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); - } + break; + case "SAVEDECOMPILED": + try { + ActionScriptParser par = new ActionScriptParser(); + src.setActions(par.actionsFromString(decompiledEditor.getText()), SWF.DEFAULT_VERSION); + setSource(this.src, false); + View.showMessageDialog(this, AppStrings.translate("message.action.saved")); + setDecompiledEditMode(false); + } catch (IOException ex) { + Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex); + } catch (ParseException ex) { + View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); + } + break; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java b/trunk/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java index 7e9e362ca..8387dc468 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java @@ -102,11 +102,11 @@ public class PlayerControls extends JPanel implements ActionListener { private String formatMs(long ms) { long s = ms / 1000; - ms = ms % 1000; + ms %= 1000; long m = s / 60; - s = s % 60; + s %= 60; long h = m / 60; - m = m % 60; + m %= 60; return "" + (h > 0 ? h + ":" : "") + pad(m) + ":" + pad(s) + "." + pad(ms / 10); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java index 2fd00569b..bb3a31bab 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java @@ -330,7 +330,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe public void catched(String contentType, String url, InputStream data) { boolean swfOnly = false; if (contentType.contains(";")) { - contentType = contentType.substring(0, contentType.indexOf(";")); + contentType = contentType.substring(0, contentType.indexOf(';')); } if ((!sniffSWFCheckBox.isSelected()) && (contentType.equals("application/x-shockwave-flash"))) { return; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java index 5c2af0c99..a8f135702 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLossless2Tag.java @@ -66,7 +66,7 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag { int a = (argb >> 24) & 0xff; int r = (argb >> 16) & 0xff; int g = (argb >> 8) & 0xff; - int b = (argb >> 0) & 0xff; + int b = (argb) & 0xff; r = r * a / 255; g = g * a / 255; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java index 837548d06..cadabc045 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsLosslessTag.java @@ -66,7 +66,7 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag { //int a = (argb >> 24) & 0xff; int r = (argb >> 16) & 0xff; int g = (argb >> 8) & 0xff; - int b = (argb >> 0) & 0xff; + int b = (argb) & 0xff; bitmapData.bitmapPixelDataPix24[pos] = new PIX24(); bitmapData.bitmapPixelDataPix24[pos].red = r; bitmapData.bitmapPixelDataPix24[pos].green = g; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 2e24adb5c..26f8ce7e5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -112,7 +112,7 @@ public class DefineEditTextTag extends TextTag { continue; } if (!intag) { - outp = outp + inp.charAt(i); + outp += inp.charAt(i); } } return outp; @@ -154,8 +154,8 @@ public class DefineEditTextTag extends TextTag { + (hasFontClass ? "fontclass " + fontClass + "\r\n" : "") + (hasMaxLength ? "maxlength " + maxLength + "\r\n" : "") + "align " + alignValues[align] + "\r\n" + (hasLayout ? "leftmargin " + leftMargin + "\r\nrightmargin " + rightMargin + "\r\nindent " + indent + "\r\nleading " + leading + "\r\n" : "") - + (!variableName.equals("") ? "variablename " + variableName + "\r\n" : ""); - ret = ret + "]"; + + (!variableName.isEmpty() ? "variablename " + variableName + "\r\n" : ""); + ret += "]"; if (hasText) { ret += initialText.replace("\\", "\\\\").replace("[", "\\[").replace("]", "\\]"); } @@ -196,140 +196,170 @@ public class DefineEditTextTag extends TextTag { case PARAMETER: String paramName = (String) s.values[0]; String paramValue = (String) s.values[1]; - if (paramName.equals("xmin")) { - try { - bounds.Xmin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmin value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymin")) { - try { - bounds.Ymin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymin value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmax")) { - try { - bounds.Xmax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmax value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymax")) { - try { - bounds.Ymax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymax value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("wordwrap")) { - if (paramValue.equals("1")) { - wordWrap = true; - } - } else if (paramName.equals("multiline")) { - if (paramValue.equals("1")) { - multiline = true; - } - } else if (paramName.equals("password")) { - if (paramValue.equals("1")) { - password = true; - } - } else if (paramName.equals("readonly")) { - if (paramValue.equals("1")) { - readOnly = true; - } - } else if (paramName.equals("autosize")) { - if (paramValue.equals("1")) { - autoSize = true; - } - } else if (paramName.equals("noselect")) { - if (paramValue.equals("1")) { - noSelect = true; - } - } else if (paramName.equals("border")) { - if (paramValue.equals("1")) { - border = true; - } - } else if (paramName.equals("wasstatic")) { - if (paramValue.equals("1")) { - wasStatic = true; - } - } else if (paramName.equals("html")) { - if (paramValue.equals("1")) { - html = true; - } - } else if (paramName.equals("useoutlines")) { - if (paramValue.equals("1")) { - useOutlines = true; - } - } else if (paramName.equals("font")) { - try { - fontId = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid font value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("fontclass")) { - fontClass = paramValue; - } else if (paramName.equals("height")) { - try { - fontHeight = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid height value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("color")) { - Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue); - if (m.matches()) { - textColor = new RGBA(Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16), Integer.parseInt(m.group(4), 16), Integer.parseInt(m.group(1), 16)); - } else { - throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline()); - } - } else if (paramName.equals("maxlength")) { - try { - maxLength = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid maxLength value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("align")) { - if (paramValue.equals("left")) { - align = 0; - } else if (paramValue.equals("right")) { - align = 1; - } else if (paramValue.equals("center")) { - align = 2; - } else if (paramValue.equals("justify")) { - align = 3; - } else { - throw new ParseException("Invalid align value. Expected one of: left,right,center or justify.", lexer.yyline()); - } - - } else if (paramName.equals("leftmargin")) { - try { - leftMargin = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid leftmargin value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("rightmargin")) { - try { - rightMargin = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid rightmargin value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("indent")) { - try { - indent = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid indent value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("leading")) { - try { - leading = Integer.parseInt(paramValue); - } catch (NumberFormatException ne) { - throw new ParseException("Invalid leading value. Number expected.", lexer.yyline()); - } - } else if (paramName.equals("variablename")) { - variableName = paramValue; - } else { - throw new ParseException("Unrecognized parameter name", lexer.yyline()); + switch (paramName) { + case "xmin": + try { + bounds.Xmin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmin value. Number expected.", lexer.yyline()); } break; + case "ymin": + try { + bounds.Ymin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymin value. Number expected.", lexer.yyline()); + } + break; + case "xmax": + try { + bounds.Xmax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmax value. Number expected.", lexer.yyline()); + } + break; + case "ymax": + try { + bounds.Ymax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymax value. Number expected.", lexer.yyline()); + } + break; + case "wordwrap": + if (paramValue.equals("1")) { + wordWrap = true; + } + break; + case "multiline": + if (paramValue.equals("1")) { + multiline = true; + } + break; + case "password": + if (paramValue.equals("1")) { + password = true; + } + break; + case "readonly": + if (paramValue.equals("1")) { + readOnly = true; + } + break; + case "autosize": + if (paramValue.equals("1")) { + autoSize = true; + } + break; + case "noselect": + if (paramValue.equals("1")) { + noSelect = true; + } + break; + case "border": + if (paramValue.equals("1")) { + border = true; + } + break; + case "wasstatic": + if (paramValue.equals("1")) { + wasStatic = true; + } + break; + case "html": + if (paramValue.equals("1")) { + html = true; + } + break; + case "useoutlines": + if (paramValue.equals("1")) { + useOutlines = true; + } + break; + case "font": + try { + fontId = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid font value. Number expected.", lexer.yyline()); + } + break; + case "fontclass": + fontClass = paramValue; + break; + case "height": + try { + fontHeight = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid height value. Number expected.", lexer.yyline()); + } + break; + case "color": + Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue); + if (m.matches()) { + textColor = new RGBA(Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16), Integer.parseInt(m.group(4), 16), Integer.parseInt(m.group(1), 16)); + } else { + throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline()); + } + break; + case "maxlength": + try { + maxLength = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid maxLength value. Number expected.", lexer.yyline()); + } + break; + case "align": + switch (paramValue) { + case "left": + align = 0; + break; + case "right": + align = 1; + break; + case "center": + align = 2; + break; + case "justify": + align = 3; + break; + default: + throw new ParseException("Invalid align value. Expected one of: left,right,center or justify.", lexer.yyline()); + } + break; + case "leftmargin": + try { + leftMargin = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid leftmargin value. Number expected.", lexer.yyline()); + } + break; + case "rightmargin": + try { + rightMargin = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid rightmargin value. Number expected.", lexer.yyline()); + } + break; + case "indent": + try { + indent = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid indent value. Number expected.", lexer.yyline()); + } + break; + case "leading": + try { + leading = Integer.parseInt(paramValue); + } catch (NumberFormatException ne) { + throw new ParseException("Invalid leading value. Number expected.", lexer.yyline()); + } + break; + case "variablename": + variableName = paramValue; + break; + default: + throw new ParseException("Unrecognized parameter name", lexer.yyline()); + } + break; case TEXT: text += (String) s.values[0]; break; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 533a2686d..39a5a1c1f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -96,7 +96,7 @@ public class DefineText2Tag extends TextTag implements DrawableTag { } } if (rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) { - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret += "\r\n"; } } @@ -189,112 +189,125 @@ public class DefineText2Tag extends TextTag implements DrawableTag { throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline()); } } - if (paramName.equals("font")) { - try { - fontId = Integer.parseInt(paramValue); + switch (paramName) { + case "font": + try { + fontId = Integer.parseInt(paramValue); - for (Tag t : tags) { - if (t instanceof FontTag) { - if (((FontTag) t).getFontId() == fontId) { - font = (FontTag) t; - break; - } + for (Tag t : tags) { + if (t instanceof FontTag) { + if (((FontTag) t).getFontId() == fontId) { + font = (FontTag) t; + break; } } - if (font == null) { - throw new ParseException("Font not found", lexer.yyline()); - } - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid font id - number expected.", lexer.yyline()); } - } else if (paramName.equals("height")) { - try { - textHeight = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid font height - number expected.", lexer.yyline()); - } - } else if (paramName.equals("x")) { - - try { - x = Integer.parseInt(paramValue); - currentX = x; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid x position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("y")) { - - try { - y = Integer.parseInt(paramValue); - currentY = y; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid y position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmin")) { - try { - textBounds.Xmin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmin position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmax")) { - try { - textBounds.Xmax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmax position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymin")) { - try { - textBounds.Ymin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymin position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymax")) { - try { - textBounds.Ymax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymax position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("scalex")) { - try { - textMatrix.scaleX = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("scaley")) { - try { - textMatrix.scaleY = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("rotateskew0")) { - try { - textMatrix.rotateSkew0 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("rotateskew1")) { - try { - textMatrix.rotateSkew1 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("translatex")) { - try { - textMatrix.translateX = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("translatey")) { - try { - textMatrix.translateY = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatey value - number expected.", lexer.yyline()); + if (font == null) { + throw new ParseException("Font not found", lexer.yyline()); } + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid font id - number expected.", lexer.yyline()); } break; + case "height": + try { + textHeight = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid font height - number expected.", lexer.yyline()); + } + break; + case "x": + try { + x = Integer.parseInt(paramValue); + currentX = x; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid x position - number expected.", lexer.yyline()); + } + break; + case "y": + try { + y = Integer.parseInt(paramValue); + currentY = y; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid y position - number expected.", lexer.yyline()); + } + break; + case "xmin": + try { + textBounds.Xmin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmin position - number expected.", lexer.yyline()); + } + break; + case "xmax": + try { + textBounds.Xmax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmax position - number expected.", lexer.yyline()); + } + break; + case "ymin": + try { + textBounds.Ymin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymin position - number expected.", lexer.yyline()); + } + break; + case "ymax": + try { + textBounds.Ymax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymax position - number expected.", lexer.yyline()); + } + break; + case "scalex": + try { + textMatrix.scaleX = Integer.parseInt(paramValue); + textMatrix.hasScale = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); + } + break; + case "scaley": + try { + textMatrix.scaleY = Integer.parseInt(paramValue); + textMatrix.hasScale = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); + } + break; + case "rotateskew0": + try { + textMatrix.rotateSkew0 = Integer.parseInt(paramValue); + textMatrix.hasRotate = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline()); + } + break; + case "rotateskew1": + try { + textMatrix.rotateSkew1 = Integer.parseInt(paramValue); + textMatrix.hasRotate = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline()); + } + break; + case "translatex": + try { + textMatrix.translateX = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid translatex value - number expected.", lexer.yyline()); + } + break; + case "translatey": + try { + textMatrix.translateY = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid translatey value - number expected.", lexer.yyline()); + } + break; + } + break; case TEXT: if (font == null) { throw new ParseException("Font not defined", lexer.yyline()); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index 3fa21cb56..dca4cae55 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -96,7 +96,7 @@ public class DefineTextTag extends TextTag implements DrawableTag { } } if (rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) { - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret += "\r\n"; } } @@ -181,119 +181,133 @@ public class DefineTextTag extends TextTag implements DrawableTag { case PARAMETER: String paramName = (String) s.values[0]; String paramValue = (String) s.values[1]; - if (paramName.equals("color")) { - Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue); - if (m.matches()) { - color = new RGB(Integer.parseInt(m.group(1), 16), Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16)); - } else { - throw new ParseException("Invalid color. Valid format is #rrggbb.", lexer.yyline()); - } - } else if (paramName.equals("font")) { - try { - fontId = Integer.parseInt(paramValue); + switch (paramName) { + case "color": + Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue); + if (m.matches()) { + color = new RGB(Integer.parseInt(m.group(1), 16), Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16)); + } else { + throw new ParseException("Invalid color. Valid format is #rrggbb.", lexer.yyline()); + } + break; + case "font": + try { + fontId = Integer.parseInt(paramValue); - for (Tag t : tags) { - if (t instanceof FontTag) { - if (((FontTag) t).getFontId() == fontId) { - font = (FontTag) t; - break; - } + for (Tag t : tags) { + if (t instanceof FontTag) { + if (((FontTag) t).getFontId() == fontId) { + font = (FontTag) t; + break; } } - if (font == null) { - throw new ParseException("Font not found", lexer.yyline()); - } - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid font id - number expected.", lexer.yyline()); } - } else if (paramName.equals("height")) { - try { - textHeight = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid font height - number expected.", lexer.yyline()); - } - } else if (paramName.equals("x")) { - - try { - x = Integer.parseInt(paramValue); - currentX = x; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid x position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("y")) { - - try { - y = Integer.parseInt(paramValue); - currentY = y; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid y position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmin")) { - try { - textBounds.Xmin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmin position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("xmax")) { - try { - textBounds.Xmax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid xmax position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymin")) { - try { - textBounds.Ymin = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymin position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("ymax")) { - try { - textBounds.Ymax = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid ymax position - number expected.", lexer.yyline()); - } - } else if (paramName.equals("scalex")) { - try { - textMatrix.scaleX = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("scaley")) { - try { - textMatrix.scaleY = Integer.parseInt(paramValue); - textMatrix.hasScale = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("rotateskew0")) { - try { - textMatrix.rotateSkew0 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("rotateskew1")) { - try { - textMatrix.rotateSkew1 = Integer.parseInt(paramValue); - textMatrix.hasRotate = true; - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("translatex")) { - try { - textMatrix.translateX = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatex value - number expected.", lexer.yyline()); - } - } else if (paramName.equals("translatey")) { - try { - textMatrix.translateY = Integer.parseInt(paramValue); - } catch (NumberFormatException nfe) { - throw new ParseException("Invalid translatey value - number expected.", lexer.yyline()); + if (font == null) { + throw new ParseException("Font not found", lexer.yyline()); } + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid font id - number expected.", lexer.yyline()); } break; + case "height": + try { + textHeight = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid font height - number expected.", lexer.yyline()); + } + break; + case "x": + try { + x = Integer.parseInt(paramValue); + currentX = x; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid x position - number expected.", lexer.yyline()); + } + break; + case "y": + try { + y = Integer.parseInt(paramValue); + currentY = y; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid y position - number expected.", lexer.yyline()); + } + break; + case "xmin": + try { + textBounds.Xmin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmin position - number expected.", lexer.yyline()); + } + break; + case "xmax": + try { + textBounds.Xmax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid xmax position - number expected.", lexer.yyline()); + } + break; + case "ymin": + try { + textBounds.Ymin = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymin position - number expected.", lexer.yyline()); + } + break; + case "ymax": + try { + textBounds.Ymax = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid ymax position - number expected.", lexer.yyline()); + } + break; + case "scalex": + try { + textMatrix.scaleX = Integer.parseInt(paramValue); + textMatrix.hasScale = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); + } + break; + case "scaley": + try { + textMatrix.scaleY = Integer.parseInt(paramValue); + textMatrix.hasScale = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid scalex value - number expected.", lexer.yyline()); + } + break; + case "rotateskew0": + try { + textMatrix.rotateSkew0 = Integer.parseInt(paramValue); + textMatrix.hasRotate = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline()); + } + break; + case "rotateskew1": + try { + textMatrix.rotateSkew1 = Integer.parseInt(paramValue); + textMatrix.hasRotate = true; + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline()); + } + break; + case "translatex": + try { + textMatrix.translateX = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid translatex value - number expected.", lexer.yyline()); + } + break; + case "translatey": + try { + textMatrix.translateY = Integer.parseInt(paramValue); + } catch (NumberFormatException nfe) { + throw new ParseException("Invalid translatey value - number expected.", lexer.yyline()); + } + break; + } + break; case TEXT: if (font == null) { throw new ParseException("Font not defined", lexer.yyline()); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index 161b9236c..c938f1a5d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -176,7 +176,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { @Override public String getExportFileName(List tags) { String expName = getExportName(); - if ((expName == null) || expName.equals("")) { + if ((expName == null) || expName.isEmpty()) { return super.toString(); } String[] pathParts; @@ -191,7 +191,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource { @Override public String toString() { String expName = getExportName(); - if ((expName == null) || expName.equals("")) { + if ((expName == null) || expName.isEmpty()) { return super.toString(); } String[] pathParts; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java index 51e224dc8..c04b90713 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/CharacterIdTag.java @@ -66,11 +66,11 @@ public abstract class CharacterIdTag extends Tag { @Override public String getExportFileName(List tags) { - return super.getName(tags) + "_" + getCharacterId() + (((exportName != null) && (!exportName.equals(""))) ? "_" + exportName : ""); + return super.getName(tags) + "_" + getCharacterId() + (((exportName != null) && (!exportName.isEmpty())) ? "_" + exportName : ""); } public String getCharacterExportFileName() { - return getCharacterId() + (((exportName != null) && (!exportName.equals(""))) ? "_" + exportName : ""); + return getCharacterId() + (((exportName != null) && (!exportName.isEmpty())) ? "_" + exportName : ""); } public String getExportName() { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java index 860c5e848..6a8b63e61 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -163,7 +163,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable return fontName; } if (fontName.contains("_")) { - String beforeUnderscore = fontName.substring(0, fontName.indexOf("_")); + String beforeUnderscore = fontName.substring(0, fontName.indexOf('_')); if (fontNames.contains(beforeUnderscore)) { return beforeUnderscore; } @@ -176,7 +176,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable return fontName; } if (fontName.contains("_")) { - String beforeUnderscore = fontName.substring(0, fontName.indexOf("_")); + String beforeUnderscore = fontName.substring(0, fontName.indexOf('_')); if (fontNames.contains(beforeUnderscore)) { return beforeUnderscore; } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java index f51e2dea0..e49e13ec4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java @@ -65,7 +65,7 @@ import javax.swing.JPanel; * * @author JPEXS */ -public class DefineCompactedFont extends FontTag implements DrawableTag { +public final class DefineCompactedFont extends FontTag implements DrawableTag { public static final int ID = 1005; public int fontId; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java b/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java index f535c3610..c0cc6aea3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/filters/Filtering.java @@ -96,10 +96,7 @@ public class Filtering { } } } - - for (int x = 0; x < w; x++) { - pixels[index + x] = newColors[x]; - } + System.arraycopy(newColors, 0, pixels, index, w); index += w; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java b/trunk/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java index 1e97e4176..03f379707 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java @@ -74,12 +74,12 @@ public class ContourType { moveToY = sis.readSI15(); long numEdgesRef = sis.readUI30(); isReference = (numEdgesRef & 1) == 1; - numEdgesRef = numEdgesRef >> 1; + numEdgesRef >>= 1; long oldPos = sis.getPos(); if (isReference) { sis.setPos(numEdgesRef); numEdgesRef = sis.readUI30(); - numEdgesRef = numEdgesRef >> 1; + numEdgesRef >>= 1; } edges = new EdgeType[(int) numEdgesRef]; diff --git a/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java b/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java index b327e5d86..07d78431d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java @@ -455,7 +455,6 @@ public class EdgeType { sos.writeUI8((((ax >> 14) & m5) | (ay << 5))); sos.writeUI8(((ay >> 3))); sos.writeUI8(((ay >> 11))); - return; } } } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java b/trunk/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java index 165e7f899..4540bdef5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java @@ -88,18 +88,18 @@ public class GFxInputStream extends InputStream { return v; case 1: - t = t >> 2; + t >>= 2; v = t | (readUI8() << 6); return v; case 2: - t = t >> 2; - t = t | (readUI8() << 6); + t >>= 2; + t |= (readUI8() << 6); v = t | (readUI8() << 14); return v; } - t = t >> 2; - t = t | (readUI8() << 6); - t = t | (readUI8() << 14); + t >>= 2; + t |= (readUI8() << 6); + t |= (readUI8() << 14); v = t | (readUI8() << 22); return v; } diff --git a/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java b/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java index 03185ee64..19ba5a0dd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java +++ b/trunk/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java @@ -857,8 +857,8 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali maxh = r.getHeight(); } } - maxw = maxw / 20; - maxh = maxh / 20; + maxw /= 20; + maxh /= 20; int cols = (int) Math.ceil(Math.sqrt(shapes.size())); diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 8c2e3e2e6..58d44346f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -711,7 +711,7 @@ public class XFLConverter { edges.clear(); fillsStr += ""; strokesStr += ""; - if (!currentLayer.equals("")) { + if (!currentLayer.isEmpty()) { currentLayer += ""; currentLayer += ""; currentLayer += ""; @@ -1301,10 +1301,14 @@ public class XFLConverter { String symbolFile = "bitmap" + symbol.getCharacterId() + "." + imageTag.getImageFormat(); files.put(symbolFile, baos.toByteArray()); String mediaLinkStr = " 0) { @@ -1912,7 +1916,7 @@ public class XFLConverter { frame++; } } - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret = "" + "" + ret @@ -1936,7 +1940,7 @@ public class XFLConverter { } if (t instanceof ShowFrameTag) { - if (frameLabel.equals("")) { + if (frameLabel.isEmpty()) { duration++; } else { if (duration > 0) { @@ -1967,7 +1971,7 @@ public class XFLConverter { frame++; } } - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret = "" + "" + ret @@ -2015,7 +2019,7 @@ public class XFLConverter { } ret += convertFrame(false, characters, tags, lastSoundStreamHead, lastStartSound, frame, duration, "", ""); } - if (!ret.equals("")) { + if (!ret.isEmpty()) { ret = "" + "" + ret + "" + ""; @@ -2100,7 +2104,7 @@ public class XFLConverter { layerPrev += ">"; String layerAfter = ""; String cf = convertFrames(layerPrev, layerAfter, oneInstanceShapes, tags, timelineTags, characters, d); - if (cf.equals("")) { + if (cf.isEmpty()) { index--; } ret += cf; @@ -2395,7 +2399,7 @@ public class XFLConverter { if (det.hasMaxLength) { ret += " maxCharacters=\"" + det.maxLength + "\""; } - if (!det.variableName.equals("")) { + if (!det.variableName.isEmpty()) { ret += " variableName=\"" + det.variableName + "\""; } ret += ">"; @@ -2520,7 +2524,7 @@ public class XFLConverter { File f = new File(baseName); baseName = f.getName(); if (baseName.contains(".")) { - baseName = baseName.substring(0, baseName.lastIndexOf(".")); + baseName = baseName.substring(0, baseName.lastIndexOf('.')); } final HashMap files = new HashMap<>(); final HashMap datfiles = new HashMap<>(); @@ -2586,7 +2590,7 @@ public class XFLConverter { } String expDir = ""; if (expPath.contains(".")) { - expDir = expPath.substring(0, expPath.lastIndexOf(".")); + expDir = expPath.substring(0, expPath.lastIndexOf('.')); expDir = expDir.replace(".", File.separator); } expPath = expPath.replace(".", File.separator); @@ -3121,75 +3125,82 @@ public class XFLConverter { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - if (qName.equals("a")) { - String href = attributes.getValue("href"); - if (href != null) { - url = href; - } - String t = attributes.getValue("target"); - if (t != null) { - target = t; - } - } else if (qName.equals("b")) { - bold = true; - } else if (qName.equals("i")) { - italic = true; - } else if (qName.equals("u")) { - underline = true; - } else if (qName.equals("li")) { - li = true; - } else if (qName.equals("p")) { - String a = attributes.getValue("align"); - if (a != null) { - alignment = a; - } - if (!result.equals("")) { - putText("\r\n"); - } - } else if (qName.equals("font")) { - //kerning ? - String ls = attributes.getValue("letterSpacing"); - if (ls != null) { - letterSpacing = Double.parseDouble(ls); - } - String s = attributes.getValue("size"); - if (s != null) { - size = Integer.parseInt(s); - } - String c = attributes.getValue("color"); - if (c != null) { - color = c; - } - String f = attributes.getValue("face"); - if (f != null) { - for (Tag t : tags) { - if (t instanceof FontTag) { - FontTag ft = (FontTag) t; - String fontName = null; - if (f.equals(ft.getFontName(tags))) { - for (Tag u : tags) { - if (u instanceof DefineFontNameTag) { - if (((DefineFontNameTag) u).fontId == ft.getFontId()) { - fontName = ((DefineFontNameTag) u).fontName; + switch (qName) { + case "a": + String href = attributes.getValue("href"); + if (href != null) { + url = href; + } + String t = attributes.getValue("target"); + if (t != null) { + target = t; + } + break; + case "b": + bold = true; + break; + case "i": + italic = true; + break; + case "u": + underline = true; + break; + case "li": + li = true; + break; + case "p": + String a = attributes.getValue("align"); + if (a != null) { + alignment = a; + } + if (!result.isEmpty()) { + putText("\r\n"); + } + break; + case "font": + //kerning ? + String ls = attributes.getValue("letterSpacing"); + if (ls != null) { + letterSpacing = Double.parseDouble(ls); + } + String s = attributes.getValue("size"); + if (s != null) { + size = Integer.parseInt(s); + } + String c = attributes.getValue("color"); + if (c != null) { + color = c; + } + String f = attributes.getValue("face"); + if (f != null) { + for (Tag tag : tags) { + if (tag instanceof FontTag) { + FontTag ft = (FontTag) tag; + String fontName = null; + if (f.equals(ft.getFontName(tags))) { + for (Tag u : tags) { + if (u instanceof DefineFontNameTag) { + if (((DefineFontNameTag) u).fontId == ft.getFontId()) { + fontName = ((DefineFontNameTag) u).fontName; + } } } + if (fontName == null) { + fontName = ft.getFontName(tags); + } + String installedFont; + if ((installedFont = FontTag.isFontInstalled(fontName)) != null) { + fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName(); + } else { + fontFace = fontName; + } + break; } - if (fontName == null) { - fontName = ft.getFontName(tags); - } - String installedFont; - if ((installedFont = FontTag.isFontInstalled(fontName)) != null) { - fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName(); - } else { - fontFace = fontName; - } - break; } } } - } + break; } - //textformat,tab,br } @Override @@ -3268,7 +3279,7 @@ public class XFLConverter { @Override public void endDocument() { - if (this.result.equals("")) { + if (this.result.isEmpty()) { putText(""); } } diff --git a/trunk/src/com/jpexs/decompiler/graph/ExportMode.java b/trunk/src/com/jpexs/decompiler/graph/ExportMode.java index 1c8850156..07293f1ca 100644 --- a/trunk/src/com/jpexs/decompiler/graph/ExportMode.java +++ b/trunk/src/com/jpexs/decompiler/graph/ExportMode.java @@ -32,8 +32,9 @@ public enum ExportMode { private static final Map lookup = new HashMap<>(); static { - for(ExportMode s : EnumSet.allOf(ExportMode.class)) - lookup.put(s.getCode(), s); + for(ExportMode s : EnumSet.allOf(ExportMode.class)) { + lookup.put(s.getCode(), s); + } } private int code; diff --git a/trunk/src/com/jpexs/helpers/Helper.java b/trunk/src/com/jpexs/helpers/Helper.java index 5d1c84edf..2e50e2288 100644 --- a/trunk/src/com/jpexs/helpers/Helper.java +++ b/trunk/src/com/jpexs/helpers/Helper.java @@ -34,6 +34,7 @@ import java.io.ObjectOutputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Arrays; import java.util.BitSet; import java.util.Collection; import java.util.List; @@ -72,7 +73,7 @@ public class Helper { if (i > 0) { s += ","; } - s = s + array[i]; + s += array[i]; } s += "]"; return s; @@ -90,7 +91,7 @@ public class Helper { if (i > 0) { s += " "; } - s = s + padZeros(Integer.toHexString(array[i] & 0xff), 2); + s += padZeros(Integer.toHexString(array[i] & 0xff), 2); } s += "]"; return s; @@ -353,9 +354,7 @@ public class Helper { public static List toList(Object... rest) { List ret = new ArrayList<>(); - for (Object o : rest) { - ret.add(o); - } + ret.addAll(Arrays.asList(rest)); return ret; } @@ -483,7 +482,7 @@ public class Helper { str = Pattern.compile("\\." + Pattern.quote(inv) + "\\.", Pattern.CASE_INSENSITIVE).matcher(str).replaceAll("._" + inv + "."); } str = str.substring(1, str.length() - 1); //remove dots - if (str.equals("")) { + if (str.isEmpty()) { str = "unnamed"; } return str; @@ -527,11 +526,11 @@ public class Helper { public static String formatTimeSec(long timeMs) { long timeS = timeMs / 1000; - timeMs = timeMs % 1000; + timeMs %= 1000; long timeM = timeS / 60; - timeS = timeS % 60; + timeS %= 60; long timeH = timeM / 60; - timeM = timeM % 60; + timeM %= 60; String timeStr = ""; if (timeH > 0) { timeStr += Helper.padZeros(timeH, 2) + ":"; @@ -548,9 +547,9 @@ public class Helper { public static String formatTimeToText(int timeS) { long timeM = timeS / 60; - timeS = timeS % 60; + timeS %= 60; long timeH = timeM / 60; - timeM = timeM % 60; + timeM %= 60; String timeStr = ""; if (timeH > 0) { diff --git a/trunk/src/com/jpexs/process/Process.java b/trunk/src/com/jpexs/process/Process.java index c57d51294..255dc15d5 100644 --- a/trunk/src/com/jpexs/process/Process.java +++ b/trunk/src/com/jpexs/process/Process.java @@ -17,7 +17,6 @@ package com.jpexs.process; import com.jpexs.helpers.ProgressListener; -import com.jpexs.process.Process; import java.awt.image.BufferedImage; import java.io.InputStream; import java.util.Map; diff --git a/trunk/src/com/jpexs/process/ProcessTools.java b/trunk/src/com/jpexs/process/ProcessTools.java index 0dc6aacf8..07d1452b4 100644 --- a/trunk/src/com/jpexs/process/ProcessTools.java +++ b/trunk/src/com/jpexs/process/ProcessTools.java @@ -16,7 +16,6 @@ */ package com.jpexs.process; -import com.jpexs.process.Process; import com.jpexs.process.win32.Win32ProcessTools; import com.sun.jna.Platform; import java.util.List; diff --git a/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java b/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java index 75ff7f240..d50aa25fd 100644 --- a/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java +++ b/trunk/src/com/jpexs/process/win32/Win32ProcessTools.java @@ -200,7 +200,7 @@ public class Win32ProcessTools extends ProcessTools { int rgb = Gdi32.INSTANCE.GetPixel(hdcMem, x, y).intValue(); int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; - int b = (rgb >> 0) & 0xff; + int b = (rgb) & 0xff; rgb = (b << 16) + (g << 8) + r; ret.setRGB(x, y, rgb); } @@ -226,7 +226,7 @@ public class Win32ProcessTools extends ProcessTools { int rgb = image.getRGB(x, y); int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; - int b = (rgb >> 0) & 0xff; + int b = (rgb) & 0xff; r = r * alpha / 255; g = g * alpha / 255; b = b * alpha / 255; diff --git a/trunk/src/com/sun/jna/platform/win32/Advapi32Util.java b/trunk/src/com/sun/jna/platform/win32/Advapi32Util.java index f4fc27151..54a9845bc 100644 --- a/trunk/src/com/sun/jna/platform/win32/Advapi32Util.java +++ b/trunk/src/com/sun/jna/platform/win32/Advapi32Util.java @@ -253,7 +253,7 @@ public abstract class Advapi32Util { offset += Native.WCHAR_SIZE; result.add(s); } - return result.toArray(new String[0]); + return result.toArray(new String[result.size()]); } finally { rc = Advapi32.INSTANCE.RegCloseKey(phkKey.getValue()); if (rc != W32Errors.ERROR_SUCCESS) { @@ -700,7 +700,7 @@ public abstract class Advapi32Util { } keys.add(Native.toString(name)); } - return keys.toArray(new String[0]); + return keys.toArray(new String[keys.size()]); } /** @@ -784,7 +784,7 @@ public abstract class Advapi32Util { offset += Native.WCHAR_SIZE; result.add(s); } - keyValues.put(nameString, result.toArray(new String[0])); + keyValues.put(nameString, result.toArray(new String[result.size()])); break; } default: @@ -830,7 +830,7 @@ public abstract class Advapi32Util { StringBuilder out = new StringBuilder(); for (Entry entry : environment.entrySet()) { if (entry.getValue() != null) { - out.append(entry.getKey() + "=" + entry.getValue() + "\0"); + out.append(entry.getKey()).append("=").append(entry.getValue()).append("\0"); } } return out.toString() + "\0"; @@ -975,7 +975,7 @@ public abstract class Advapi32Util { offset += Native.WCHAR_SIZE; count--; } - _strings = strings.toArray(new String[0]); + _strings = strings.toArray(new String[strings.size()]); } } } diff --git a/trunk/src/com/sun/jna/platform/win32/BaseTSD.java b/trunk/src/com/sun/jna/platform/win32/BaseTSD.java index df2a9c7b5..c6d65229f 100644 --- a/trunk/src/com/sun/jna/platform/win32/BaseTSD.java +++ b/trunk/src/com/sun/jna/platform/win32/BaseTSD.java @@ -79,7 +79,7 @@ public interface BaseTSD extends StdCallLibrary { /** * PULONG_PTR */ - public static class ULONG_PTRByReference extends ByReference { + public static final class ULONG_PTRByReference extends ByReference { public ULONG_PTRByReference() { this(new ULONG_PTR(0)); diff --git a/trunk/src/com/sun/jna/platform/win32/WinDef.java b/trunk/src/com/sun/jna/platform/win32/WinDef.java index 5b1e61af7..f20cab86e 100644 --- a/trunk/src/com/sun/jna/platform/win32/WinDef.java +++ b/trunk/src/com/sun/jna/platform/win32/WinDef.java @@ -61,7 +61,7 @@ public interface WinDef extends StdCallLibrary { } } - public class WORDbyReference extends ByReference { + public static final class WORDbyReference extends ByReference { public WORDbyReference() { this(new WORD(0)); @@ -123,7 +123,7 @@ public interface WinDef extends StdCallLibrary { } } - public class DWORDbyReference extends ByReference { + public static final class DWORDbyReference extends ByReference { public DWORDbyReference() { this(new DWORD(0)); @@ -156,7 +156,7 @@ public interface WinDef extends StdCallLibrary { } } - public class LONGbyReference extends ByReference { + public static final class LONGbyReference extends ByReference { public LONGbyReference() { this(new LONG(0)); @@ -189,7 +189,7 @@ public interface WinDef extends StdCallLibrary { } } - public class LONGLONGbyReference extends ByReference { + public static final class LONGLONGbyReference extends ByReference { public LONGLONGbyReference() { this(new LONGLONG(0)); @@ -658,7 +658,7 @@ public interface WinDef extends StdCallLibrary { } } - public class ULONGbyReference extends ByReference { + public static final class ULONGbyReference extends ByReference { public ULONGbyReference() { this(new ULONG(0)); @@ -691,7 +691,7 @@ public interface WinDef extends StdCallLibrary { } } - public class ULONGLONGbyReference extends ByReference { + public static final class ULONGLONGbyReference extends ByReference { public ULONGLONGbyReference() { this(new ULONGLONG(0)); @@ -899,7 +899,7 @@ public interface WinDef extends StdCallLibrary { } } - public class USHORTbyReference extends ByReference { + public static final class USHORTbyReference extends ByReference { public USHORTbyReference() { this(new USHORT(0)); @@ -967,7 +967,7 @@ public interface WinDef extends StdCallLibrary { } } - public class UINTbyReference extends ByReference { + public static final class UINTbyReference extends ByReference { public UINTbyReference() { this(new UINT(0)); @@ -1009,7 +1009,7 @@ public interface WinDef extends StdCallLibrary { } } - public static class SCODEbyReference extends ByReference { + public static final class SCODEbyReference extends ByReference { public SCODEbyReference() { this(new SCODE(0)); @@ -1053,7 +1053,7 @@ public interface WinDef extends StdCallLibrary { } } - public static class BOOLbyReference extends ByReference { + public static final class BOOLbyReference extends ByReference { public BOOLbyReference() { this(new BOOL(0)); @@ -1110,7 +1110,7 @@ public interface WinDef extends StdCallLibrary { } } - public static class CHARbyReference extends ByReference { + public static final class CHARbyReference extends ByReference { public CHARbyReference() { this(new CHAR(0)); diff --git a/trunk/src/com/sun/jna/platform/win32/WinNT.java b/trunk/src/com/sun/jna/platform/win32/WinNT.java index 362444c8b..ddc9597e7 100644 --- a/trunk/src/com/sun/jna/platform/win32/WinNT.java +++ b/trunk/src/com/sun/jna/platform/win32/WinNT.java @@ -808,7 +808,7 @@ public interface WinNT extends WinError, WinDef, WinBase, BaseTSD { /** * LPHANDLE */ - public static class HANDLEByReference extends ByReference { + public static final class HANDLEByReference extends ByReference { public HANDLEByReference() { this(null); diff --git a/trunk/src/com/sun/jna/platform/win32/WinReg.java b/trunk/src/com/sun/jna/platform/win32/WinReg.java index cd93e6dca..5cefc0b41 100644 --- a/trunk/src/com/sun/jna/platform/win32/WinReg.java +++ b/trunk/src/com/sun/jna/platform/win32/WinReg.java @@ -40,7 +40,7 @@ public interface WinReg extends StdCallLibrary { } } - public static class HKEYByReference extends ByReference { + public static final class HKEYByReference extends ByReference { public HKEYByReference() { this(null); diff --git a/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java b/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java index 1f714991a..52aed3b36 100644 --- a/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java +++ b/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java @@ -38,7 +38,7 @@ public class AS2Generator { HilightedTextWriter writer = new HilightedTextWriter(false); Action.actionsToSource(doa, doa.getActions(swf.version), swf.version, "", writer); String src = writer.toString(); - if (src.trim().equals("")) { + if (src.trim().isEmpty()) { doa = null; continue; }