string concatenation in logger inspection

This commit is contained in:
Jindra Petřík
2021-01-29 08:56:18 +01:00
parent 2767f77a66
commit ef143d8ede
12 changed files with 22 additions and 21 deletions

View File

@@ -1621,7 +1621,7 @@ public final class SWF implements SWFContainerItem, Timelined {
for (ScriptPack item : packs) {
ClassPath key = item.getClassPath();
if (classPaths.contains(key)) {
logger.log(Level.SEVERE, "Duplicate pack path found (" + key + ")!");
logger.log(Level.SEVERE, "Duplicate pack path found ({0})!", key);
} else {
classPaths.add(key);
ret.add(item);

View File

@@ -507,7 +507,7 @@ public class ScriptPack extends AS3ClassTreeItem {
continue;
}
addedLines.add(line);
logger.log(Level.FINE, "Script " + path + ": Insert debugline(" + line + ") at pos " + i + " to body " + bodyIndex);
logger.log(Level.FINE, "Script {0}: Insert debugline({1}) at pos {2} to body {3}", new Object[]{path, line, i, bodyIndex});
b.insertInstruction(i + dpos, new AVM2Instruction(0, AVM2Instructions.DebugLine, new int[]{line}));
}
//remove old debug instructions

View File

@@ -2147,7 +2147,7 @@ public class AVM2Code implements Cloneable {
}
}
if (someIgnored) {
logger.log(Level.WARNING, path + ": One or more invalid jump offsets found in the code. Those instructions were ignored.");
logger.log(Level.WARNING, "{0}: One or more invalid jump offsets found in the code. Those instructions were ignored.", path);
}
removeIgnored(body);
}

View File

@@ -90,6 +90,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -189,7 +190,7 @@ public class AVM2Graph extends Graph {
}
public Map<Integer, Set<Integer>> calculateLocalRegsUsage(Set<Integer> ignoredSwitches, String path, Set<GraphPart> allParts) {
logger.fine("--- " + path + " ---");
logger.log(Level.FINE, "--- {0} ---", path);
Map<Integer, Set<Integer>> setLocalPosToGetLocalPos = new TreeMap<>();
Map<GraphPart, Map<Integer, List<Integer>>> partUnresolvedRegisterToGetLocalPos = new HashMap<>();
Map<GraphPart, Map<Integer, Integer>> partRegisterToLastSetLocalPos = new HashMap<>();
@@ -258,10 +259,10 @@ public class AVM2Graph extends Graph {
for (int setLocalPos : setLocalPosToGetLocalPos.keySet()) {
AVM2Instruction ins = avm2code.code.get(setLocalPos);
int regId = ((SetLocalTypeIns) ins.definition).getRegisterId(ins);
logger.fine("set local reg " + regId + " at pos " + (setLocalPos + 1));
logger.log(Level.FINE, "set local reg {0} at pos {1}{2}", new Object[]{regId, setLocalPos, 1});
for (int getLocalPos : setLocalPosToGetLocalPos.get(setLocalPos)) {
logger.fine("- usage at pos " + (getLocalPos + 1));
logger.log(Level.FINE, "- usage at pos {0}{1}", new Object[]{getLocalPos, 1});
}
}
return setLocalPosToGetLocalPos;

View File

@@ -134,7 +134,7 @@ public class ActionIf extends Action {
int jmp = code.adr2pos(targetAddress);
int after = code.adr2pos(getAddress() + length);
if (jmp == -1) {
Logger.getLogger(ActionIf.class.getName()).log(Level.SEVERE, "Invalid IF jump to ofs" + Helper.formatAddress(targetAddress));
Logger.getLogger(ActionIf.class.getName()).log(Level.SEVERE, "Invalid IF jump to ofs{0}", Helper.formatAddress(targetAddress));
ret.add(after);
} else {
ret.add(jmp);

View File

@@ -12,7 +12,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library. */
package com.jpexs.decompiler.flash.action.swf4;
import com.jpexs.decompiler.flash.SWFInputStream;
@@ -125,7 +125,7 @@ public class ActionJump extends Action {
if (ofs == -1) {
int length = getBytesLength();
ofs = code.adr2pos(getAddress() + length);
ofs = code.adr2pos(getAddress() + length);
Logger.getLogger(ActionJump.class.getName()).log(Level.SEVERE, "Invalid jump to ofs{0} from ofs{1}", new Object[]{Helper.formatAddress(targetAddress), Helper.formatAddress(getAddress())});
}
ret.add(ofs);
return ret;

View File

@@ -12,7 +12,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library. */
package com.jpexs.decompiler.flash.exporters.script;
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
@@ -117,7 +117,7 @@ public class AS2ScriptExporter {
try {
executor.shutdown();
if (!executor.awaitTermination(Configuration.exportTimeout.get(), TimeUnit.SECONDS)) {
if (!executor.awaitTermination(Configuration.exportTimeout.get(), TimeUnit.SECONDS)) {
logger.log(Level.SEVERE, "{0} ActionScript export limit reached", Helper.formatTimeToText(Configuration.exportTimeout.get()));
}
} catch (InterruptedException ex) {
} finally {

View File

@@ -430,7 +430,7 @@ public class AS3ScriptExporter {
try {
executor.shutdown();
if (!executor.awaitTermination(Configuration.exportTimeout.get(), TimeUnit.SECONDS)) {
logger.log(Level.SEVERE, Helper.formatTimeToText(Configuration.exportTimeout.get()) + " ActionScript export limit reached");
logger.log(Level.SEVERE, "{0} ActionScript export limit reached", Helper.formatTimeToText(Configuration.exportTimeout.get()));
}
} catch (InterruptedException ex) {
} finally {

View File

@@ -12,7 +12,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library. */
package com.jpexs.decompiler.flash.tags.base;
import com.jpexs.decompiler.flash.SWF;
@@ -267,7 +267,7 @@ public abstract class TextTag extends DrawableTag {
}
textHeight = rec.textHeight;
if (font == null) {
if (font == null) {
Logger.getLogger(TextTag.class.getName()).log(Level.SEVERE, "Font with id={0} was not found.", rec.fontId);
continue;
}

View File

@@ -265,7 +265,7 @@ public class DebuggerHandler implements DebugConnectionListener {
public boolean addBreakPoint(String scriptName, int line) {
synchronized (this) {
Logger.getLogger(DebuggerHandler.class
.getName()).log(Level.FINE, "adding bp " + scriptName + ":" + line);
.getName()).log(Level.FINE, "adding bp {0}:{1}", new Object[]{scriptName, line});
if (isBreakpointToRemove(scriptName, line)) {
toRemoveBPointMap.get(scriptName).remove(line);
if (toRemoveBPointMap.get(scriptName).isEmpty()) {
@@ -275,12 +275,12 @@ public class DebuggerHandler implements DebugConnectionListener {
}
if (isBreakpointConfirmed(scriptName, line)) {
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "bp " + scriptName + ":" + line + " already confirmed");
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "bp {0}:{1} already confirmed", new Object[]{scriptName, line});
return true;
}
if (isBreakpointInvalid(scriptName, line)) {
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "bp " + scriptName + ":" + line + " already invalid");
Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "bp {0}:{1} already invalid", new Object[]{scriptName, line});
return false;
}
if (!toAddBPointMap.containsKey(scriptName)) {
@@ -289,7 +289,7 @@ public class DebuggerHandler implements DebugConnectionListener {
toAddBPointMap.get(scriptName).add(line);
Logger
.getLogger(DebuggerHandler.class
.getName()).log(Level.FINE, "bp " + scriptName + ":" + line + " added to todo");
.getName()).log(Level.FINE, "bp {0}:{1} added to todo", new Object[]{scriptName, line});
}
try {
sendBreakPoints(false);

View File

@@ -2224,14 +2224,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
@Override
public boolean handle(TextTag textTag) {
String msg = translate("error.text.import");
logger.log(Level.SEVERE, msg + getTextTagInfo(textTag));
logger.log(Level.SEVERE, "{0}{1}", new Object[]{msg, getTextTagInfo(textTag)});
return View.showConfirmDialog(MainPanel.this, msg, translate("error"), JOptionPane.OK_CANCEL_OPTION, showAgainImportError, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION;
}
@Override
public boolean handle(TextTag textTag, String message, long line) {
String msg = translate("error.text.invalid.continue").replace("%text%", message).replace("%line%", Long.toString(line));
logger.log(Level.SEVERE, msg + getTextTagInfo(textTag));
logger.log(Level.SEVERE, "{0}{1}", new Object[]{msg, getTextTagInfo(textTag)});
return View.showConfirmDialog(MainPanel.this, msg, translate("error"), JOptionPane.OK_CANCEL_OPTION, showAgainInvalidText, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION;
}
});

View File

@@ -73,7 +73,7 @@ public class Win32ProcessTools extends ProcessTools {
mbi = new MEMORY_BASIC_INFORMATION();
BaseTSD.SIZE_T t = Kernel32.INSTANCE.VirtualQueryEx(hOtherProcess, lpMem, mbi, new BaseTSD.SIZE_T(mbi.size()));
if (t.longValue() == 0) {
Logger.getLogger(Win32ProcessTools.class.getName()).log(Level.SEVERE, "Cannot get page ranges. Last error:" + Kernel32.INSTANCE.GetLastError());
Logger.getLogger(Win32ProcessTools.class.getName()).log(Level.SEVERE, "Cannot get page ranges. Last error:{0}", Kernel32.INSTANCE.GetLastError());
break;
}
ret.add(mbi);