Skip to content

Commit 9a1f926

Browse files
authored
Ensure spaces after double points in messages (#12986)
Regex: - (throw.*):" \+ - (return.*):" \+ - ([a-z]+):" \+ - ([a-z1-9]+[a-z1-9]+):" \+ + $1: " +
1 parent a10dd81 commit 9a1f926

File tree

89 files changed

+164
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+164
-152
lines changed

game-app/game-core/src/main/java/games/strategy/engine/chat/ChatController.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private IChatChannel getChatBroadcaster() {
107107
@Override
108108
public Collection<ChatParticipant> joinChat() {
109109
final INode node = MessageContext.getSender();
110-
log.info("Chatter:" + node + " is joining chat:" + chatName);
110+
log.info("Chatter: " + node + " is joining chat: " + chatName);
111111
final Tag tag = Tag.NONE;
112112
synchronized (mutex) {
113113
final PlayerChatId id = PlayerChatId.newId();
@@ -156,6 +156,6 @@ private void leaveChatInternal(final INode node) {
156156
chatters.remove(node);
157157
}
158158
getChatBroadcaster().speakerRemoved(node.getPlayerName());
159-
log.info("Chatter:" + node + " has left chat:" + chatName);
159+
log.info("Chatter: " + node + " has left chat: " + chatName);
160160
}
161161
}

game-app/game-core/src/main/java/games/strategy/engine/data/BombingUnitDamageChange.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ public Change invert() {
4848

4949
@Override
5050
public String toString() {
51-
return "Bombing unit damage change. Hits:" + hits + " undoHits:" + undoHits;
51+
return "Bombing unit damage change. Hits: " + hits + " undoHits: " + undoHits;
5252
}
5353
}

game-app/game-core/src/main/java/games/strategy/engine/data/GameData.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public UnitHolder getUnitHolder(final String name, final String type) {
255255
case UnitHolder.TERRITORY:
256256
return map.getTerritory(name);
257257
default:
258-
throw new IllegalStateException("Invalid type:" + type);
258+
throw new IllegalStateException("Invalid type: " + type);
259259
}
260260
}
261261

game-app/game-core/src/main/java/games/strategy/engine/data/GameObjectStreamData.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public GameObjectStreamData(final Named named) {
3535
} else if (named instanceof ProductionFrontier) {
3636
type = GameType.PRODUCTIONFRONTIER;
3737
} else {
38-
throw new IllegalArgumentException("Wrong type:" + named);
38+
throw new IllegalArgumentException("Wrong type: " + named);
3939
}
4040
}
4141

game-app/game-core/src/main/java/games/strategy/engine/data/GamePlayer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public boolean isNull() {
5454
@Getter
5555
private String whoAmI =
5656
// @TODO why : separation, no_one also used in ServerSetupPanel; create constant
57-
"null:" + "no_one";
57+
"null: " + "no_one";
5858

5959
private TechAttachment techAttachment;
6060

@@ -124,7 +124,7 @@ public boolean isNull() {
124124

125125
@Override
126126
public String toString() {
127-
return "PlayerId named:" + getName();
127+
return "PlayerId named: " + getName();
128128
}
129129

130130
@Override

game-app/game-core/src/main/java/games/strategy/engine/data/MoveDescription.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ private static boolean collectionsAreEqual(final Collection<Unit> a, final Colle
7878

7979
@Override
8080
public String toString() {
81-
return "Move message route:" + route + " units:" + getUnits();
81+
return "Move message route: " + route + " units: " + getUnits();
8282
}
8383
}

game-app/game-core/src/main/java/games/strategy/engine/data/ProductionFrontier.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ public ProductionFrontier(
3030

3131
public void addRule(final ProductionRule rule) {
3232
if (rules.contains(rule)) {
33-
throw new IllegalStateException("Rule already added:" + rule);
33+
throw new IllegalStateException("Rule already added: " + rule);
3434
}
3535
rules.add(rule);
3636
cachedRules = null;
3737
}
3838

3939
public void removeRule(final ProductionRule rule) {
4040
if (!rules.contains(rule)) {
41-
throw new IllegalStateException("Rule not present:" + rule);
41+
throw new IllegalStateException("Rule not present: " + rule);
4242
}
4343
rules.remove(rule);
4444
cachedRules = null;

game-app/game-core/src/main/java/games/strategy/engine/data/RelationshipTracker.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public Relationship(final RelationshipType relationshipType, final int roundValu
265265

266266
@Override
267267
public String toString() {
268-
return roundCreated + ":" + relationshipType;
268+
return roundCreated + ": " + relationshipType;
269269
}
270270
}
271271
}

game-app/game-core/src/main/java/games/strategy/engine/data/RepairFrontier.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public RepairFrontier(final String name, final GameData data, final List<RepairR
2828

2929
public void addRule(final RepairRule rule) {
3030
if (rules.contains(rule)) {
31-
throw new IllegalStateException("Rule already added:" + rule);
31+
throw new IllegalStateException("Rule already added: " + rule);
3232
}
3333
rules.add(rule);
3434
cachedRules = null;

game-app/game-core/src/main/java/games/strategy/engine/data/ResourceCollection.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public int getQuantity(final String name) {
8484
try (GameData.Unlocker ignored = getData().acquireReadLock()) {
8585
final Resource resource = getData().getResourceList().getResource(name);
8686
if (resource == null) {
87-
throw new IllegalArgumentException("No resource named:" + name);
87+
throw new IllegalArgumentException("No resource named: " + name);
8888
}
8989
return getQuantity(resource);
9090
}

game-app/game-core/src/main/java/games/strategy/engine/data/Route.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ private void add(final Territory territory) {
8585
if (r1.numberOfSteps() == 0) {
8686
if (!r1.getStart().equals(r2.getStart())) {
8787
throw new IllegalArgumentException(
88-
"Cannot join, r1 doesnt end where r2 starts. r1:" + r1 + " r2:" + r2);
88+
"Cannot join, r1 doesnt end where r2 starts. r1: " + r1 + " r2: " + r2);
8989
}
9090
} else {
9191
if (!r1.getEnd().equals(r2.getStart())) {
9292
throw new IllegalArgumentException(
93-
"Cannot join, r1 doesnt end where r2 starts. r1:" + r1 + " r2:" + r2);
93+
"Cannot join, r1 doesnt end where r2 starts. r1: " + r1 + " r2: " + r2);
9494
}
9595
}
9696
final Collection<Territory> c1 = new ArrayList<>(r1.steps);

game-app/game-core/src/main/java/games/strategy/engine/data/Rule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public interface Rule {
2929
default void addResult(final NamedAttachable obj, final int quantity) {
3030
if (!(obj instanceof UnitType) && !(obj instanceof Resource)) {
3131
throw new IllegalArgumentException(
32-
"results must be units or resources, not:" + obj.getClass().getName());
32+
"results must be units or resources, not: " + obj.getClass().getName());
3333
}
3434

3535
getResults().put(obj, quantity);

game-app/game-core/src/main/java/games/strategy/engine/data/TechnologyFrontier.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void addAdvance(final List<TechAdvance> list) {
5050

5151
public void removeAdvance(final TechAdvance t) {
5252
if (!techs.contains(t)) {
53-
throw new IllegalStateException("Advance not present:" + t);
53+
throw new IllegalStateException("Advance not present: " + t);
5454
}
5555
techs.remove(t);
5656
getData().getTechTracker().clearCache();

game-app/game-core/src/main/java/games/strategy/engine/data/UnitCollection.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public Collection<Unit> getUnits(final UnitType type, final int maxUnits) {
8484
return new ArrayList<>();
8585
}
8686
if (maxUnits < 0) {
87-
throw new IllegalArgumentException("value must be positive. Instead its:" + maxUnits);
87+
throw new IllegalArgumentException("value must be positive. Instead its: " + maxUnits);
8888
}
8989
final Collection<Unit> units = new ArrayList<>();
9090
for (final Unit current : this.units) {

game-app/game-core/src/main/java/games/strategy/engine/data/changefactory/AddUnits.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ private Collection<Unit> buildUnitsWithOwner(final GameState data) {
8383

8484
@Override
8585
public String toString() {
86-
return "Add unit change. Add to:" + name + " units:" + units;
86+
return "Add unit change. Add to: " + name + " units: " + units;
8787
}
8888
}

game-app/game-core/src/main/java/games/strategy/engine/data/changefactory/RemoveUnits.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ protected void perform(final GameState data) {
6363

6464
@Override
6565
public String toString() {
66-
return "Remove unit change. Remove from:" + name + " units:" + units;
66+
return "Remove unit change. Remove from: " + name + " units: " + units;
6767
}
6868
}

game-app/game-core/src/main/java/games/strategy/engine/framework/ClientGame.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public void shutDown() {
166166
final Player gp = this.gamePlayers.get(player);
167167
if (gp == null) {
168168
throw new IllegalStateException(
169-
"Game player not found. Player:" + player + " on:" + messengers.getLocalNode());
169+
"Game player not found. Player: " + player + " on: " + messengers.getLocalNode());
170170
}
171171
gp.start(stepName);
172172
};

game-app/game-core/src/main/java/games/strategy/engine/framework/VerifiedRandomNumbers.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public VerifiedRandomNumbers(final String annotation, final int[] values) {
1919

2020
@Override
2121
public String toString() {
22-
return "Rolled :" + MyFormatter.asDice(values) + " for " + annotation;
22+
return "Rolled : " + MyFormatter.asDice(values) + " for " + annotation;
2323
}
2424
}

game-app/game-core/src/main/java/games/strategy/engine/framework/message/PlayerListing.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public PlayerListing(
105105

106106
@Override
107107
public String toString() {
108-
return "PlayerListingMessage:" + playerToNodeListing;
108+
return "PlayerListingMessage: " + playerToNodeListing;
109109
}
110110

111111
public Map<String, PlayerTypes.Type> getLocalPlayerTypeMap(final PlayerTypes playerTypes) {

game-app/game-core/src/main/java/games/strategy/engine/message/RemoteMethodCall.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private static String[] classesToString(final Class<?>[] classes, final Object[]
106106

107107
@Override
108108
public String toString() {
109-
return "Remote method call, method name:" + methodName + " remote name:" + remoteName;
109+
return "Remote method call, method name: " + methodName + " remote name: " + remoteName;
110110
}
111111

112112
@Override

game-app/game-core/src/main/java/games/strategy/engine/message/RemoteName.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ public RemoteName(final String name, final Class<?> clazz) {
2323

2424
@Override
2525
public String toString() {
26-
return name + ":" + clazz.getSimpleName();
26+
return name + ": " + clazz.getSimpleName();
2727
}
2828
}

game-app/game-core/src/main/java/games/strategy/engine/message/UnifiedMessengerHub.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private void invoke(final HubInvoke hubInvoke, final Collection<INode> remote, f
127127
if (hubInvoke.needReturnValues) {
128128
if (remote.size() != 1) {
129129
throw new IllegalStateException(
130-
"Too many nodes:" + remote + " for remote name " + hubInvoke.call);
130+
"Too many nodes: " + remote + " for remote name " + hubInvoke.call);
131131
}
132132
final InvocationInProgress invocationInProgress =
133133
new InvocationInProgress(CollectionUtils.getAny(remote), hubInvoke, from);

game-app/game-core/src/main/java/games/strategy/engine/message/unifiedmessenger/EndPoint.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public boolean hasSingleImplementor() {
9292
*/
9393
boolean removeImplementor(final Object implementor) {
9494
if (!implementors.remove(implementor)) {
95-
throw new IllegalStateException("Not removed, impl:" + implementor + " have " + implementors);
95+
throw new IllegalStateException(
96+
"Not removed, impl: " + implementor + " have " + implementors);
9697
}
9798
return implementors.isEmpty();
9899
}
@@ -138,7 +139,7 @@ private RemoteMethodCallResults invokeSingle(
138139
} catch (final InvocationTargetException e) {
139140
return new RemoteMethodCallResults(e.getTargetException());
140141
} catch (final IllegalAccessException | IllegalArgumentException e) {
141-
log.error("error in call:" + call, e);
142+
log.error("error in call: " + call, e);
142143
return new RemoteMethodCallResults(e);
143144
} finally {
144145
MessageContext.setSenderNodeForThread(null);
@@ -147,6 +148,11 @@ private RemoteMethodCallResults invokeSingle(
147148

148149
@Override
149150
public String toString() {
150-
return "Name:" + name + " singleThreaded:" + singleThreaded + " implementors:" + implementors;
151+
return "Name: "
152+
+ name
153+
+ " singleThreaded: "
154+
+ singleThreaded
155+
+ " implementors: "
156+
+ implementors;
151157
}
152158
}

game-app/game-core/src/main/java/games/strategy/engine/message/unifiedmessenger/HasEndPointImplementor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public HasEndPointImplementor(final String endPointName) {
1313

1414
@Override
1515
public String toString() {
16-
return this.getClass().getName() + ":" + endPointName;
16+
return this.getClass().getName() + ": " + endPointName;
1717
}
1818
}

game-app/game-core/src/main/java/games/strategy/engine/message/unifiedmessenger/InvocationResults.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public InvocationResults(final RemoteMethodCallResults results, final UUID metho
2727

2828
@Override
2929
public String toString() {
30-
return "Invocation results for method id:" + methodCallId + " results:" + results;
30+
return "Invocation results for method id: " + methodCallId + " results: " + results;
3131
}
3232

3333
@Override

game-app/game-core/src/main/java/games/strategy/engine/message/unifiedmessenger/UnifiedMessenger.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public RemoteMethodCallResults invokeAndWait(
105105
+ remoteCall.getRemoteName());
106106
}
107107
if (results.size() > 1) {
108-
throw new IllegalStateException("Too many implementors, got back:" + results);
108+
throw new IllegalStateException("Too many implementors, got back: " + results);
109109
}
110110
return results.get(0);
111111
}
@@ -208,7 +208,7 @@ public void removeImplementor(final String name, final Object implementor) {
208208
synchronized (endPointMutex) {
209209
final EndPoint endPoint = localEndPoints.get(name);
210210
if (endPoint == null) {
211-
throw new IllegalStateException("No end point for:" + name);
211+
throw new IllegalStateException("No end point for: " + name);
212212
}
213213
final boolean noneLeft = endPoint.removeImplementor(implementor);
214214
if (noneLeft) {
@@ -350,11 +350,11 @@ private void processMessage(final EndPoint local, final SpokeInvoke invoke, fina
350350

351351
private void assertIsServer(final INode from) {
352352
Preconditions.checkState(
353-
from.equals(messenger.getServerNode()), "Not from server! Instead from:" + from);
353+
from.equals(messenger.getServerNode()), "Not from server! Instead from: " + from);
354354
}
355355

356356
@Override
357357
public String toString() {
358-
return "Server:" + messenger.isServer() + " EndPoints:" + localEndPoints;
358+
return "Server: " + messenger.isServer() + " EndPoints: " + localEndPoints;
359359
}
360360
}

game-app/game-core/src/main/java/games/strategy/engine/random/CryptoRandomSource.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public int getRandom(final int max, final String annotation) {
8989
@Override
9090
public int[] getRandom(final int max, final int count, final String annotation) {
9191
if (count <= 0) {
92-
throw new IllegalArgumentException("Invalid count:" + count);
92+
throw new IllegalArgumentException("Invalid count: " + count);
9393
}
9494
final Vault vault = game.getVault();
9595
// generate numbers locally, and put them in the vault

game-app/game-core/src/main/java/games/strategy/engine/random/PbemDiceRoller.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private void rollInSeparateThread() {
217217
waitForWindowToBecomeVisible();
218218

219219
appendText(subjectMessage + "\n");
220-
appendText("Contacting " + diceServer.getDisplayName() + "\n");
220+
appendText("Contacting " + diceServer.getDisplayName() + "\n");
221221
try {
222222
final String text = diceServer.postRequest(sides, count, subjectMessage, gameId);
223223
if (text.isEmpty()) {
@@ -226,7 +226,7 @@ private void rollInSeparateThread() {
226226
notifyError();
227227
}
228228
if (!test) {
229-
appendText("Contacted :" + text + "\n");
229+
appendText("Contacted: " + text + "\n");
230230
}
231231
diceRoll = diceServer.getDice(text, count);
232232
appendText("Success!");

game-app/game-core/src/main/java/games/strategy/engine/vault/Vault.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void addLockedValue(final VaultId id, final byte[] data) {
6060
return;
6161
}
6262
if (unverifiedValues.putIfAbsent(id, data) != null) {
63-
throw new IllegalStateException("duplicate values for id:" + id);
63+
throw new IllegalStateException("duplicate values for id: " + id);
6464
}
6565
synchronized (waitForLock) {
6666
waitForLock.notifyAll();
@@ -105,7 +105,7 @@ public void unlock(final VaultId id, final byte[] secretKeyBytes) {
105105
final byte[] data = new byte[decrypted.length - KNOWN_VAL.length];
106106
System.arraycopy(decrypted, KNOWN_VAL.length, data, 0, data.length);
107107
if (verifiedValues.putIfAbsent(id, data) != null) {
108-
throw new IllegalStateException("duplicate values for id:" + id);
108+
throw new IllegalStateException("duplicate values for id: " + id);
109109
}
110110
synchronized (waitForLock) {
111111
waitForLock.notifyAll();
@@ -126,7 +126,7 @@ public Vault(final IChannelMessenger channelMessenger) {
126126
secretKeyFactory = SecretKeyFactory.getInstance(ALGORITHM);
127127
keyGen = KeyGenerator.getInstance(ALGORITHM);
128128
} catch (final NoSuchAlgorithmException e) {
129-
throw new IllegalStateException("Nothing known about algorithm:" + ALGORITHM, e);
129+
throw new IllegalStateException("Nothing known about algorithm: " + ALGORITHM, e);
130130
}
131131
}
132132

@@ -169,7 +169,7 @@ public VaultId lock(final byte[] data) {
169169
final VaultId id = new VaultId(channelMessenger.getLocalNode());
170170
final SecretKey key = keyGen.generateKey();
171171
if (secretKeys.putIfAbsent(id, key) != null) {
172-
throw new IllegalStateException("duplicate id:" + id);
172+
throw new IllegalStateException("duplicate id: " + id);
173173
}
174174
// we already know it, so might as well keep it
175175
verifiedValues.put(id, data);
@@ -238,7 +238,7 @@ public byte[] get(final VaultId id) throws NotUnlockedException {
238238
} else if (unverifiedValues.containsKey(id)) {
239239
throw new NotUnlockedException();
240240
} else {
241-
throw new IllegalStateException("Nothing known about id:" + id);
241+
throw new IllegalStateException("Nothing known about id: " + id);
242242
}
243243
}
244244

game-app/game-core/src/main/java/games/strategy/engine/vault/VaultId.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ INode getGeneratedOn() {
2929

3030
@Override
3131
public String toString() {
32-
return "VaultId generated on:" + generatedOn + " id:" + uniqueId;
32+
return "VaultId generated on: " + generatedOn + " id: " + uniqueId;
3333
}
3434
}

0 commit comments

Comments
 (0)