Merge changes from topic 'coverity_scan'
* changes:
Extract ChangeModifiedException out of PatchSetInserter to its own file
Use StringBuilder instead of concatenation in SshLog
Use StringBuilder instead of concatenation in ReviewCommand
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java
index 98d99a3..baddd40 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java
@@ -43,6 +43,7 @@
import com.google.gerrit.server.notedb.ReviewerState;
import com.google.gerrit.server.patch.PatchSetInfoFactory;
import com.google.gerrit.server.project.ChangeControl;
+import com.google.gerrit.server.project.ChangeModifiedException;
import com.google.gerrit.server.project.InvalidChangeOperationException;
import com.google.gerrit.server.project.NoSuchChangeException;
import com.google.gerrit.server.ssh.NoSshInfo;
@@ -380,12 +381,4 @@
return changeMessage != null && changeMessage.getKey().getParentKey()
.equals(patchSet.getId().getParentKey());
}
-
- public class ChangeModifiedException extends InvalidChangeOperationException {
- private static final long serialVersionUID = 1L;
-
- public ChangeModifiedException(String msg) {
- super(msg);
- }
- }
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ChangeModifiedException.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ChangeModifiedException.java
new file mode 100644
index 0000000..f3ca8b6
--- /dev/null
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ChangeModifiedException.java
@@ -0,0 +1,23 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.server.project;
+
+public class ChangeModifiedException extends InvalidChangeOperationException {
+ private static final long serialVersionUID = 1L;
+
+ public ChangeModifiedException(String msg) {
+ super(msg);
+ }
+}
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshLog.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshLog.java
index e093cfb..439b8c8 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshLog.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshLog.java
@@ -268,11 +268,11 @@
}
private String extractWhat(DispatchCommand dcmd) {
- String commandName = dcmd.getCommandName();
+ StringBuilder commandName = new StringBuilder(dcmd.getCommandName());
String[] args = dcmd.getArguments();
for (int i = 1; i < args.length; i++) {
- commandName = commandName + "." + args[i];
+ commandName.append(".").append(args[i]);
}
- return commandName;
+ return commandName.toString();
}
}
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ReviewCommand.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ReviewCommand.java
index 5e33c8f..3ac72a7 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ReviewCommand.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ReviewCommand.java
@@ -340,15 +340,16 @@
}
for (LabelType type : allProjectsControl.getLabelTypes().getLabelTypes()) {
- String usage;
- usage = "score for " + type.getName() + "\n";
+ StringBuilder usage = new StringBuilder("score for ")
+ .append(type.getName())
+ .append("\n");
for (LabelValue v : type.getValues()) {
- usage += v.format() + "\n";
+ usage.append(v.format()).append("\n");
}
final String name = "--" + type.getName().toLowerCase();
- optionList.add(new ApproveOption(name, usage, type));
+ optionList.add(new ApproveOption(name, usage.toString(), type));
}
super.parseCommandLine();