Skip to content

Commit

Permalink
Squash redundant string concatenations introduced by google-java-format
Browse files Browse the repository at this point in the history
Reformatting the code with google-java-format tool in change Id5f3c6de9
resulted in wrapped lines being unwrapped to the new 100 columns limit.

In cases where the wrapped line was wrapped on a string concatenation,
the resulting long line now includes redundant concatenations. See the
upstream issue [1] for an example of this.

Squash the redundant concatenations with:

  git ls-files | grep java$ | xargs sed -i '' 's/" + "//g'

(note: this also resulted in a couple of unwanted changes; those are
manually undone.)

[1] google/google-java-format#122

Change-Id: I7348413ae460c8c7a0b0c72dab0a1ae7275a2ec3
  • Loading branch information
dpursehouse committed Feb 16, 2017
1 parent 3872fcc commit 1111684
Show file tree
Hide file tree
Showing 91 changed files with 190 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static void parseAnnotation(Config cfg, GerritConfig c) {
}
} else {
throw new IllegalArgumentException(
"GerritConfig.name must be of the format" + " section.subsection.name or section.name");
"GerritConfig.name must be of the format section.subsection.name or section.name");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ public void deleteVote() throws Exception {
assertThat(msg.rcpt()).containsExactly(user.emailAddress);
assertThat(msg.body()).contains(admin.fullName + " has removed a vote on this change.\n");
assertThat(msg.body())
.contains("Removed Code-Review+1 by " + user.fullName + " <" + user.email + ">" + "\n");
.contains("Removed Code-Review+1 by " + user.fullName + " <" + user.email + ">\n");

Map<String, Short> m =
gApi.changes().id(r.getChangeId()).reviewer(user.getId().toString()).votes();
Expand Down Expand Up @@ -2140,7 +2140,7 @@ public void checkLabelsForMergedChange() throws Exception {
testRepo,
"Ignore Verified",
"rules.pl",
"submit_rule(submit(CR)) :-\n" + " gerrit:max_with_block(-2, 2, 'Code-Review', CR).");
"submit_rule(submit(CR)) :-\n gerrit:max_with_block(-2, 2, 'Code-Review', CR).");
push2.to(RefNames.REFS_CONFIG);

change = gApi.changes().id(r.getChangeId()).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public void cherryPickToSameBranchWithRebase() throws Exception {
PushOneCommit.Result r1 = createChange();

// Push another new change (change 2)
String subject = "Test change\n\n" + "Change-Id: Ideadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
String subject = "Test change\n\nChange-Id: Ideadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
PushOneCommit push =
pushFactory.create(
db, admin.getIdent(), testRepo, subject, "another_file.txt", "another content");
Expand Down Expand Up @@ -559,7 +559,7 @@ public void cherryPickMergeUsingInvalidParent() throws Exception {

exception.expect(BadRequestException.class);
exception.expectMessage(
"Cherry Pick: Parent 0 does not exist. Please" + " specify a parent in range [1, 2].");
"Cherry Pick: Parent 0 does not exist. Please specify a parent in range [1, 2].");
gApi.changes().id(mergeChangeResult.getChangeId()).current().cherryPick(cherryPickInput);
}

Expand All @@ -580,7 +580,7 @@ public void cherryPickMergeUsingNonExistentParent() throws Exception {

exception.expect(BadRequestException.class);
exception.expectMessage(
"Cherry Pick: Parent 3 does not exist. Please" + " specify a parent in range [1, 2].");
"Cherry Pick: Parent 3 does not exist. Please specify a parent in range [1, 2].");
gApi.changes().id(mergeChangeResult.getChangeId()).current().cherryPick(cherryPickInput);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void descriptionOfFixSuggestionIsMandatory() throws Exception {
exception.expect(BadRequestException.class);
exception.expectMessage(
String.format(
"A description is required for the " + "suggested fix of the robot comment on %s",
"A description is required for the suggested fix of the robot comment on %s",
withFixRobotCommentInput.path));
addRobotComment(changeId, withFixRobotCommentInput);
}
Expand Down Expand Up @@ -256,7 +256,7 @@ public void pathOfFixReplacementIsMandatory() throws Exception {
exception.expect(BadRequestException.class);
exception.expectMessage(
String.format(
"A file path must be given for the " + "replacement of the robot comment on %s",
"A file path must be given for the replacement of the robot comment on %s",
withFixRobotCommentInput.path));
addRobotComment(changeId, withFixRobotCommentInput);
}
Expand Down Expand Up @@ -301,7 +301,7 @@ public void rangeOfFixReplacementIsMandatory() throws Exception {
exception.expect(BadRequestException.class);
exception.expectMessage(
String.format(
"A range must be given for the " + "replacement of the robot comment on %s",
"A range must be given for the replacement of the robot comment on %s",
withFixRobotCommentInput.path));
addRobotComment(changeId, withFixRobotCommentInput);
}
Expand All @@ -315,7 +315,7 @@ public void rangeOfFixReplacementNeedsToBeValid() throws Exception {
exception.expect(BadRequestException.class);
exception.expectMessage(
String.format(
"Range (13:9 - 5:10) is not " + "valid for the replacement of the robot comment on %s",
"Range (13:9 - 5:10) is not valid for the replacement of the robot comment on %s",
withFixRobotCommentInput.path));
addRobotComment(changeId, withFixRobotCommentInput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void output() throws Exception {
r1.assertOkStatus();
r1.assertChange(Change.Status.NEW, null);
r1.assertMessage(
"New changes:\n" + " " + url + id1 + " " + r1.getCommit().getShortMessage() + "\n");
"New changes:\n " + url + id1 + " " + r1.getCommit().getShortMessage() + "\n");

testRepo.reset(initialHead);
String newMsg = r1.getCommit().getShortMessage() + " v2";
Expand Down Expand Up @@ -238,7 +238,7 @@ public void pushForMasterWithNotify() throws Exception {
gApi.accounts().self().setWatchedProjects(projectsToWatch);

TestAccount user2 = accounts.user2();
String pushSpec = "refs/for/master" + "%reviewer=" + user.email + ",cc=" + user2.email;
String pushSpec = "refs/for/master%reviewer=" + user.email + ",cc=" + user2.email;

sender.clear();
PushOneCommit.Result r = pushTo(pushSpec + ",notify=" + NotifyHandling.NONE);
Expand Down Expand Up @@ -991,7 +991,7 @@ public void pushWithInvalidChangeIdWithCreateNewChangeForAllNotInTarget() throws
}

private void testpushWithInvalidChangeId() throws Exception {
createCommit(testRepo, "Message with invalid Change-Id\n" + "\n" + "Change-Id: X\n");
createCommit(testRepo, "Message with invalid Change-Id\n\nChange-Id: X\n");
pushForReviewRejected(testRepo, "invalid Change-Id line format in commit message footer");

ProjectConfig config = projectCache.checkedGet(project).getConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public void updateManySubmodules() throws Exception {
.getAdvertisedRef("refs/heads/master")
.getObjectId();

assertWithMessage("submodule subscription update " + "should have made one commit")
assertWithMessage("submodule subscription update should have made one commit")
.that(superRepo.getRepository().resolve("origin/master^"))
.isEqualTo(superPreviousId);
}
Expand Down Expand Up @@ -403,7 +403,7 @@ public void sameProjectSameBranchDifferentPaths() throws Exception {
.getAdvertisedRef("refs/heads/master")
.getObjectId();

assertWithMessage("submodule subscription update " + "should have made one commit")
assertWithMessage("submodule subscription update should have made one commit")
.that(superRepo.getRepository().resolve("origin/master^"))
.isEqualTo(superPreviousId);
}
Expand Down Expand Up @@ -450,7 +450,7 @@ public void sameProjectDifferentBranchDifferentPaths() throws Exception {
.getAdvertisedRef("refs/heads/master")
.getObjectId();

assertWithMessage("submodule subscription update " + "should have made one commit")
assertWithMessage("submodule subscription update should have made one commit")
.that(superRepo.getRepository().resolve("origin/master^"))
.isEqualTo(superPreviousId);
}
Expand Down Expand Up @@ -492,7 +492,7 @@ public void nonSubmoduleInSameTopic() throws Exception {
.getAdvertisedRef("refs/heads/master")
.getObjectId();

assertWithMessage("submodule subscription update " + "should have made one commit")
assertWithMessage("submodule subscription update should have made one commit")
.that(superRepo.getRepository().resolve("origin/master^"))
.isEqualTo(superPreviousId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void revisionActionsTwoChangesInTopic() throws Exception {
assertThat(info.label).isEqualTo("Submit whole topic");
assertThat(info.method).isEqualTo("POST");
assertThat(info.title)
.isEqualTo("This change depends on other " + "changes which are not ready");
.isEqualTo("This change depends on other changes which are not ready");
} else {
noSubmitWholeTopicAssertions(actions, 1);

Expand Down Expand Up @@ -307,7 +307,7 @@ private void noSubmitWholeTopicAssertions(Map<String, ActionInfo> actions, int n
assertThat(info.title)
.isEqualTo(
String.format(
"Submit patch set 1 and ancestors (%d changes " + "altogether) into master",
"Submit patch set 1 and ancestors (%d changes altogether) into master",
nrChanges));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void addGroupAsReviewer() throws Exception {
assertThat(result.confirm).isTrue();
assertThat(result.error)
.contains(
"has " + mediumGroupSize + " members. Do you want to add them" + " all as reviewers?");
"has " + mediumGroupSize + " members. Do you want to add them all as reviewers?");
assertThat(result.reviewers).isNull();

// Add medium group with confirmation.
Expand Down Expand Up @@ -515,7 +515,7 @@ public void reviewAndAddGroupReviewers() throws Exception {
assertThat(reviewerResult.confirm).isTrue();
assertThat(reviewerResult.error)
.contains(
"has " + mediumGroupSize + " members. Do you want to add them all" + " as reviewers?");
"has " + mediumGroupSize + " members. Do you want to add them all as reviewers?");

// No labels should have changed, and no reviewers/CCs should have been added.
c = gApi.changes().id(r.getChangeId()).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void rejectDoubleInheritance() throws Exception {
.asString();

// Append and push malformed project config
String pattern = "[access]\n" + "\tinheritFrom = " + allProjects.get() + "\n";
String pattern = "[access]\n\tinheritFrom = " + allProjects.get() + "\n";
String doubleInherit = pattern + "\tinheritFrom = " + parent.get() + "\n";
config = config.replace(pattern, doubleInherit);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void deleteVote(boolean onRevisionLevel) throws Exception {
assertThat(msg.rcpt()).containsExactly(user.emailAddress);
assertThat(msg.body()).contains(admin.fullName + " has removed a vote on this change.\n");
assertThat(msg.body())
.contains("Removed Code-Review+1 by " + user.fullName + " <" + user.email + ">" + "\n");
.contains("Removed Code-Review+1 by " + user.fullName + " <" + user.email + ">\n");

endPoint =
"/changes/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public void submitWithOpenAncestorsOnOtherBranch() throws Exception {
createChange(
repo3,
"master",
"some accompanying changes for change3a in another repo " + "tied together via topic",
"some accompanying changes for change3a in another repo tied together via topic",
"a.txt",
"1",
"a-topic-here");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private String pushTag(
commit(user.getIdent(), "subject");

boolean createTag = tagName == null;
tagName = MoreObjects.firstNonNull(tagName, "v1" + "_" + System.nanoTime());
tagName = MoreObjects.firstNonNull(tagName, "v1_" + System.nanoTime());
switch (tagType) {
case LIGHTWEIGHT:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void invalidRevision() throws Exception {
assertProblems(
ctl,
null,
problem("Invalid revision on patch set 1:" + " fooooooooooooooooooooooooooooooooooooooo"));
problem("Invalid revision on patch set 1: fooooooooooooooooooooooooooooooooooooooo"));
}

// No test for ref existing but object missing; InMemoryRepository won't let
Expand All @@ -170,7 +170,7 @@ public void patchSetObjectAndRefMissing() throws Exception {
ctl,
null,
problem("Ref missing: " + ps.getId().toRefName()),
problem("Object missing: patch set 2:" + " deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
problem("Object missing: patch set 2: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
}

@Test
Expand Down Expand Up @@ -725,7 +725,7 @@ public void expectedMergedCommitWithMismatchedChangeId() throws Exception {
testRepo
.commit()
.parent(parent)
.message(commit.getShortMessage() + "\n" + "\n" + "Change-Id: " + badId + "\n")
.message(commit.getShortMessage() + "\n\nChange-Id: " + badId + "\n")
.create();
testRepo.getRevWalk().parseBody(mergedAs);
assertThat(mergedAs.getFooterLines(FooterConstants.CHANGE_ID)).containsExactly(badId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ void prune(Cache<K, ?> mem) {
try (Statement s = c.conn.createStatement()) {
long used = 0;
try (ResultSet r =
s.executeQuery("SELECT" + " SUM(OCTET_LENGTH(k) + OCTET_LENGTH(v))" + " FROM data")) {
s.executeQuery("SELECT SUM(OCTET_LENGTH(k) + OCTET_LENGTH(v)) FROM data")) {
used = r.next() ? r.getLong(1) : 0;
}
if (used <= maxSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void setUp() {

TypeLiteral<String> keyType = new TypeLiteral<String>() {};
SqlStore<String, Boolean> store =
new SqlStore<>("jdbc:h2:mem:" + "Test_" + (++dbCnt), keyType, 1 << 20, 0);
new SqlStore<>("jdbc:h2:mem:Test_" + (++dbCnt), keyType, 1 << 20, 0);
impl = new H2CacheImpl<>(MoreExecutors.directExecutor(), store, keyType, mem);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private static boolean isValidCertification(PGPPublicKey key, PGPSignature sig,
private static String missingUserIds(Set<String> allowedUserIds) {
StringBuilder sb =
new StringBuilder(
"Key must contain a valid" + " certification for one of the following identities:\n");
"Key must contain a valid certification for one of the following identities:\n");
Iterator<String> sorted = allowedUserIds.stream().sorted().iterator();
while (sorted.hasNext()) {
sb.append(" ").append(sorted.next());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void configure() {
bindConstant().annotatedWith(EnableSignedPush.class).to(enableSignedPush);

if (configEnableSignedPush && !havePgp) {
log.info("Bouncy Castle PGP not installed; signed push verification is" + " disabled");
log.info("Bouncy Castle PGP not installed; signed push verification is disabled");
}
if (enableSignedPush) {
install(new SignedPushModule());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void noExternalIds() throws Exception {
assertProblems(
checker.check(key.getPublicKey()),
Status.BAD,
"No identities found for user; check" + " http://test/#/settings/web-identities");
"No identities found for user; check http://test/#/settings/web-identities");

checker = checkerFactory.create().setStore(store).disableTrust();
assertProblems(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void revokedKeyDueToCompromise() throws Exception {
add(validKeyWithoutExpiration());
save();

assertProblems(k, "Key is revoked (key material has been compromised):" + " test6 compromised");
assertProblems(k, "Key is revoked (key material has been compromised): test6 compromised");

PGPPublicKeyRing kr = removeRevokers(k.getPublicKeyRing());
store.add(kr);
Expand Down Expand Up @@ -227,7 +227,7 @@ public void revokedByKeyNotPresentInStore() throws Exception {
TestKey k = add(revokedCompromisedKey());
save();

assertProblems(k, "Key is revoked (key material has been compromised):" + " test6 compromised");
assertProblems(k, "Key is revoked (key material has been compromised): test6 compromised");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ public static Element parse(SafeHtml html) {
/** Convert bare http:// and https:// URLs into &lt;a href&gt; tags. */
public SafeHtml linkify() {
final String part =
"(?:" + "[a-zA-Z0-9$_+!*'%;:@=?#/~-]" + "|&(?!lt;|gt;)" + "|[.,](?!(?:\\s|$))" + ")";
"(?:[a-zA-Z0-9$_+!*'%;:@=?#/~-]|&(?!lt;|gt;)|[.,](?!(?:\\s|$)))";
return replaceAll(
"(https?://" + part + "{2,}" + "(?:[(]" + part + "*" + "[)])*" + part + "*" + ")",
"(https?://" + part + "{2,}(?:[(]" + part + "*[)])*" + part + "*)",
"<a href=\"$1\" target=\"_blank\" rel=\"nofollow\">$1</a>");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void replaceTwoLinks() {
assertThat(o).isNotSameAs(n);
assertThat(n.asString())
.isEqualTo(
"A\n" + "<a href=\"?42\">issue 42</a>\n" + "<a href=\"?9918\">issue 9918</a>\n" + "B");
"A\n<a href=\"?42\">issue 42</a>\n<a href=\"?9918\">issue 9918</a>\nB");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void preformat1() {
final SafeHtml n = o.wikify();
assertThat(o).isNotSameAs(n);
assertThat(n.asString())
.isEqualTo("<p>A</p>" + "<p>" + pre(" This is pre") + pre(" formatted") + "</p>");
.isEqualTo("<p>A</p><p>" + pre(" This is pre") + pre(" formatted") + "</p>");
}

@Test
Expand Down Expand Up @@ -72,7 +72,7 @@ public void preformat4() {
final SafeHtml n = o.wikify();
assertThat(o).isNotSameAs(n);
assertThat(n.asString())
.isEqualTo("<p>" + pre(" Q") + pre(" &lt;R&gt;") + pre(" S") + "</p>" + "<p>B</p>");
.isEqualTo("<p>" + pre(" Q") + pre(" &lt;R&gt;") + pre(" S") + "</p><p>B</p>");
}

private static SafeHtml html(String text) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private boolean succeedAuthentication(final AccountState who) {

private boolean failAuthentication(Response rsp, String username) throws IOException {
log.warn(
"Authentication failed for {}: password does not match the one" + " stored in Gerrit",
"Authentication failed for {}: password does not match the one stored in Gerrit",
username);
rsp.sendError(SC_UNAUTHORIZED);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class WebSessionManager {
if (sessionMaxAgeMillis < MINUTES.toMillis(5)) {
log.warn(
String.format(
"cache.%s.maxAge is set to %d milliseconds;" + " it should be at least 5 minutes.",
"cache.%s.maxAge is set to %d milliseconds; it should be at least 5 minutes.",
CACHE_NAME, sessionMaxAgeMillis));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void banner() {
com.google.gerrit.common.Version.getVersion());
System.err.println();
System.err.println(
"(type Ctrl-D or \"halt.\" to exit," + " \"['path/to/file.pl'].\" to load a file)");
"(type Ctrl-D or \"halt.\" to exit, \"['path/to/file.pl'].\" to load a file)");
System.err.println();
System.err.flush();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ protected List<String> getInstallPlugins() {
}
return names;
} catch (FileNotFoundException e) {
log.warn("Couldn't find distribution archive location." + " No plugin will be installed");
log.warn("Couldn't find distribution archive location. No plugin will be installed");
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private void verifyFileChecksum() {

} else if (!ui.yesno(
null /* force an answer */,
"error: SHA-1 checksum does not match\n" + "Use %s anyway", //
"error: SHA-1 checksum does not match\nUse %s anyway", //
dst.getFileName())) {
deleteDst();
throw new Die("aborted by user");
Expand Down
Loading

0 comments on commit 1111684

Please sign in to comment.