提交 dccd6706 authored 作者: Jacek Ławrynowicz's avatar Jacek Ławrynowicz

performance - redundant array creation for vararg calls

上级 6e0c5af2
...@@ -98,12 +98,10 @@ public class FilePathDisk extends FilePath { ...@@ -98,12 +98,10 @@ public class FilePathDisk extends FilePath {
if (ok) { if (ok) {
return; return;
} }
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, name, newName.name);
new String[]{name, newName.name});
} }
if (newFile.exists()) { if (newFile.exists()) {
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, name, newName + " (exists)");
new String[] { name, newName + " (exists)" });
} }
for (int i = 0; i < SysProperties.MAX_FILE_RETRY; i++) { for (int i = 0; i < SysProperties.MAX_FILE_RETRY; i++) {
IOUtils.trace("rename", name + " >" + newName, null); IOUtils.trace("rename", name + " >" + newName, null);
...@@ -113,8 +111,7 @@ public class FilePathDisk extends FilePath { ...@@ -113,8 +111,7 @@ public class FilePathDisk extends FilePath {
} }
wait(i); wait(i);
} }
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, name, newName.name);
new String[]{name, newName.name});
} }
private static void wait(int i) { private static void wait(int i) {
......
...@@ -53,8 +53,7 @@ public class FilePathMem extends FilePath { ...@@ -53,8 +53,7 @@ public class FilePathMem extends FilePath {
synchronized (MEMORY_FILES) { synchronized (MEMORY_FILES) {
if (!atomicReplace && !newName.name.equals(name) && if (!atomicReplace && !newName.name.equals(name) &&
MEMORY_FILES.containsKey(newName.name)) { MEMORY_FILES.containsKey(newName.name)) {
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, name, newName + " (exists)");
new String[] { name, newName + " (exists)" });
} }
FileMemData f = getMemoryFile(); FileMemData f = getMemoryFile();
f.setName(newName.name); f.setName(newName.name);
......
...@@ -56,8 +56,7 @@ public class FilePathNioMem extends FilePath { ...@@ -56,8 +56,7 @@ public class FilePathNioMem extends FilePath {
synchronized (MEMORY_FILES) { synchronized (MEMORY_FILES) {
if (!atomicReplace && !name.equals(newName.name) && if (!atomicReplace && !name.equals(newName.name) &&
MEMORY_FILES.containsKey(newName.name)) { MEMORY_FILES.containsKey(newName.name)) {
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, name, newName + " (exists)");
new String[] { name, newName + " (exists)" });
} }
FileNioMemData f = getMemoryFile(); FileNioMemData f = getMemoryFile();
f.setName(newName.name); f.setName(newName.name);
......
...@@ -655,7 +655,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler { ...@@ -655,7 +655,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
if (supported) { if (supported) {
// Desktop.getDesktop(); // Desktop.getDesktop();
Object desktop = desktopClass.getMethod("getDesktop"). Object desktop = desktopClass.getMethod("getDesktop").
invoke(null, new Object[0]); invoke(null);
// desktop.browse(uri); // desktop.browse(uri);
desktopClass.getMethod("browse", URI.class). desktopClass.getMethod("browse", URI.class).
invoke(desktop, uri); invoke(desktop, uri);
......
...@@ -476,7 +476,7 @@ public class SourceCompiler { ...@@ -476,7 +476,7 @@ public class SourceCompiler {
Object configuration = Utils.newInstance( Object configuration = Utils.newInstance(
"org.codehaus.groovy.control.CompilerConfiguration"); "org.codehaus.groovy.control.CompilerConfiguration");
Utils.callMethod(configuration, Utils.callMethod(configuration,
"addCompilationCustomizers", new Object[] { importCustomizerArray }); "addCompilationCustomizers", importCustomizerArray);
ClassLoader parent = GroovyCompiler.class.getClassLoader(); ClassLoader parent = GroovyCompiler.class.getClassLoader();
loader = Utils.newInstance( loader = Utils.newInstance(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论