Skip to content

Commit bf1b3b7

Browse files
jbertramgemmellr
authored andcommitted
ARTEMIS-5234 make style for parentheses consistent
This commit enforces a consistent style for parentheses, namely that there is no padding. Futhermore, it updates all the code that violates this styling so that the code is styled consistently across the entire code-base.
1 parent 3bac04a commit bf1b3b7

File tree

61 files changed

+129
-126
lines changed

Some content is hidden

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

61 files changed

+129
-126
lines changed

artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,8 @@ public boolean containsEitherOf(final char c, final char d) {
566566
final byte highd = (byte) (d >> 8 & 0xFF); // high byte
567567

568568
for (int i = 0; i + 1 < data.length; i += 2) {
569-
if ( data[i] == lowc && data[i + 1] == highc ||
570-
data[i] == lowd && data[i + 1] == highd ) {
569+
if (data[i] == lowc && data[i + 1] == highc ||
570+
data[i] == lowd && data[i + 1] == highd) {
571571
return true;
572572
}
573573
}

artemis-commons/src/main/java/org/apache/activemq/artemis/core/buffers/impl/ChannelBufferWrapper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public short readShort() {
392392

393393
@Override
394394
public ActiveMQBuffer readSlice(final int length) {
395-
if ( isPooled ) {
395+
if (isPooled) {
396396
ByteBuf fromBuffer = buffer.readSlice(length);
397397
ByteBuf newNettyBuffer = Unpooled.buffer(fromBuffer.capacity());
398398
int read = fromBuffer.readerIndex();
@@ -530,7 +530,7 @@ public ByteBuffer toByteBuffer(final int index, final int length) {
530530

531531
@Override
532532
public void release() {
533-
if ( this.isPooled ) {
533+
if (this.isPooled) {
534534
buffer.release();
535535
}
536536
}

artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConcurrencyTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void testClearAndToString() throws Exception {
5757
});
5858
}
5959
for (int i = 0; i < 10; i++) {
60-
executorService.submit( () -> {
60+
executorService.submit(() -> {
6161
try {
6262
countDownLatch.await();
6363
for (int k = 0; k < 1000; k++) {
@@ -107,7 +107,7 @@ public void testGetPropertyNamesClearAndToString() throws Exception {
107107
});
108108
}
109109
for (int i = 0; i < 10; i++) {
110-
executorService.submit( () -> {
110+
executorService.submit(() -> {
111111
try {
112112
countDownLatch.await();
113113
for (int k = 0; k < 1000; k++) {

artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ protected static ByteBuf copyMessageBuffer(ByteBuf buffer, int skipBytes) {
399399
buffer.readerIndex(PACKET_HEADERS_SIZE);
400400

401401
newNettyBuffer.writeBytes(buffer, buffer.readableBytes() - skipBytes);
402-
buffer.setIndex( read, writ );
403-
newNettyBuffer.setIndex( 0, writ - PACKET_HEADERS_SIZE - skipBytes);
402+
buffer.setIndex(read, writ);
403+
newNettyBuffer.setIndex(0, writ - PACKET_HEADERS_SIZE - skipBytes);
404404

405405
return newNettyBuffer;
406406
}

artemis-dto/src/main/java/org/apache/activemq/artemis/dto/AuthorisationDTO.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
@XmlAccessorType(XmlAccessType.FIELD)
2727
public class AuthorisationDTO {
2828

29-
@XmlElementRef( required = false)
29+
@XmlElementRef(required = false)
3030
@Deprecated(forRemoval = true)
3131
WhiteListDTO whitelist;
3232

33-
@XmlElementRef( required = false )
33+
@XmlElementRef(required = false)
3434
AllowListDTO allowList;
3535

3636
@XmlElementRef

artemis-dto/src/test/java/org/apache/activemq/artemis/dto/test/BindingDTOTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public void testValues() {
4444
binding.setExcludedTLSProtocols("TLSv1,TLSv1.1");
4545
assertArrayEquals(new String[] {"TLSv1", "TLSv1.1"}, binding.getExcludedTLSProtocols());
4646

47-
binding.setIncludedCipherSuites( "^SSL_.*$");
47+
binding.setIncludedCipherSuites("^SSL_.*$");
4848
assertArrayEquals(new String[] {"^SSL_.*$"}, binding.getIncludedCipherSuites());
4949

50-
binding.setExcludedCipherSuites( "^.*_(MD5|SHA|SHA1)$,^TLS_RSA_.*$,^.*_NULL_.*$,^.*_anon_.*$");
50+
binding.setExcludedCipherSuites("^.*_(MD5|SHA|SHA1)$,^TLS_RSA_.*$,^.*_NULL_.*$,^.*_anon_.*$");
5151
assertArrayEquals(new String[] {"^.*_(MD5|SHA|SHA1)$", "^TLS_RSA_.*$", "^.*_NULL_.*$", "^.*_anon_.*$"}, binding.getExcludedCipherSuites());
5252
}
5353

artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void setProtocolManagerFactoryStr(final String protocolManagerFactoryStr)
156156
if (protocolManagerFactoryStr != null && !protocolManagerFactoryStr.trim().isEmpty() &&
157157
!protocolManagerFactoryStr.equals("undefined")) {
158158
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
159-
ClientProtocolManagerFactory protocolManagerFactory = (ClientProtocolManagerFactory) ClassloadingUtil.newInstanceFromClassLoader(ActiveMQConnectionFactory.class, protocolManagerFactoryStr, ClientProtocolManagerFactory.class );
159+
ClientProtocolManagerFactory protocolManagerFactory = (ClientProtocolManagerFactory) ClassloadingUtil.newInstanceFromClassLoader(ActiveMQConnectionFactory.class, protocolManagerFactoryStr, ClientProtocolManagerFactory.class);
160160
serverLocator.setProtocolManagerFactory(protocolManagerFactory);
161161
return null;
162162
});

artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ public void appendUpdateRecordTransactional(final long txID,
13101310
final byte recordType,
13111311
final Persister persister,
13121312
final Object record) throws Exception {
1313-
if ( logger.isTraceEnabled() ) {
1313+
if (logger.isTraceEnabled()) {
13141314
logger.trace("scheduling appendUpdateRecordTransactional::txID={}, id={}, userRecordType={}, record = {}",
13151315
txID, id, recordType, record);
13161316
}
@@ -1326,18 +1326,18 @@ public void appendUpdateRecordTransactional(final long txID,
13261326
try {
13271327
tx.checkErrorCondition();
13281328

1329-
JournalInternalRecord updateRecordTX = new JournalAddRecordTX( false, txID, id, recordType, persister, record );
1330-
JournalFile usedFile = appendRecord( updateRecordTX, false, false, tx, null );
1329+
JournalInternalRecord updateRecordTX = new JournalAddRecordTX(false, txID, id, recordType, persister, record);
1330+
JournalFile usedFile = appendRecord(updateRecordTX, false, false, tx, null);
13311331

13321332
if (logger.isTraceEnabled()) {
13331333
logger.trace("appendUpdateRecordTransactional::txID={}, id={}, userRecordType={}, record = {}, usedFile = {}",
1334-
txID, id, recordType, record, usedFile );
1334+
txID, id, recordType, record, usedFile);
13351335
}
13361336

1337-
tx.addPositive( usedFile, id, updateRecordTX.getEncodeSize(), false);
1338-
} catch (Throwable e ) {
1339-
logger.error("Exception during appendUpdateRecordTransactional:", e );
1340-
setErrorCondition(null, tx, e );
1337+
tx.addPositive(usedFile, id, updateRecordTX.getEncodeSize(), false);
1338+
} catch (Throwable e) {
1339+
logger.error("Exception during appendUpdateRecordTransactional:", e);
1340+
setErrorCondition(null, tx, e);
13411341
} finally {
13421342
journalLock.readLock().unlock();
13431343
}
@@ -2729,7 +2729,7 @@ private void flushExecutor(Executor executor) throws InterruptedException {
27292729
try {
27302730
executor.execute(latch::countDown);
27312731
latch.await(10, TimeUnit.SECONDS);
2732-
} catch (RejectedExecutionException ignored ) {
2732+
} catch (RejectedExecutionException ignored) {
27332733
// this is fine
27342734
}
27352735
}

artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/processor/LogAnnotationProcessor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
133133
writerOutput.println(" }");
134134
writerOutput.println();
135135

136-
writerOutput.println(" public " + simpleClassName + "(Logger logger ) {");
136+
writerOutput.println(" public " + simpleClassName + "(Logger logger) {");
137137
writerOutput.println(" this.logger = logger;");
138138
writerOutput.println(" }");
139139
writerOutput.println();
@@ -533,7 +533,7 @@ private static void verifyIdNotRetiredOrProcessedPreviously(final LogBundle bund
533533
}
534534

535535
Integer nextId = Collections.max(activeIDs) + 1;
536-
while (isRetiredID(bundleAnnotation, nextId) ) {
536+
while (isRetiredID(bundleAnnotation, nextId)) {
537537
nextId++;
538538
}
539539

artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/federation/AMQPFederationAddressPolicyManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ private void tryRestartFederationConsumerForAddress(AMQPFederationAddressEntry e
458458

459459
@Override
460460
public void onComplete(AMQPFederationConsumer context) {
461-
logger.trace("Restarted federation consumer after new demand added." );
461+
logger.trace("Restarted federation consumer after new demand added.");
462462
}
463463

464464
@Override

artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/federation/AMQPFederationCommandProcessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected void actualDelivery(Message message, Delivery delivery, DeliveryAnnota
148148
} catch (Throwable e) {
149149
logger.warn(e.getMessage(), e);
150150
federation.signalError(
151-
new ActiveMQAMQPInternalErrorException("Error while processing incoming control message: " + e.getMessage() ));
151+
new ActiveMQAMQPInternalErrorException("Error while processing incoming control message: " + e.getMessage()));
152152
}
153153
}
154154

artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/federation/AMQPFederationEventDispatcher.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public void afterAddAddress(AddressInfo addressInfo, boolean reload) throws Acti
209209
} catch (Exception e) {
210210
logger.warn("error on send of address added event: {}", e.getMessage());
211211
federation.signalError(
212-
new ActiveMQAMQPInternalErrorException("Error while processing address added: " + e.getMessage() ));
212+
new ActiveMQAMQPInternalErrorException("Error while processing address added: " + e.getMessage()));
213213
}
214214
}
215215
});
@@ -232,7 +232,7 @@ public void afterAddBinding(Binding binding) throws ActiveMQException {
232232
// Likely the connection failed if we get here.
233233
logger.warn("Error on send of queue added event: {}", e.getMessage());
234234
federation.signalError(
235-
new ActiveMQAMQPInternalErrorException("Error while processing queue added: " + e.getMessage() ));
235+
new ActiveMQAMQPInternalErrorException("Error while processing queue added: " + e.getMessage()));
236236
}
237237
}
238238
});

artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/federation/AMQPFederationEventProcessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected void actualDelivery(Message message, Delivery delivery, DeliveryAnnota
155155
} catch (Throwable e) {
156156
logger.warn(e.getMessage(), e);
157157
federation.signalError(
158-
new ActiveMQAMQPInternalErrorException("Error while processing incoming event message: " + e.getMessage() ));
158+
new ActiveMQAMQPInternalErrorException("Error while processing incoming event message: " + e.getMessage()));
159159
}
160160
}
161161

artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/federation/AMQPFederationQueuePolicyManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ private void tryRestartFederationConsumerForQueue(AMQPFederationQueueEntry entry
290290

291291
@Override
292292
public void onComplete(AMQPFederationConsumer context) {
293-
logger.trace("Restarted federation consumer after new demand added." );
293+
logger.trace("Restarted federation consumer after new demand added.");
294294
}
295295

296296
@Override

artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/BasicMirrorController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public String getRemoteMirrorId() {
4242
}
4343

4444
public static String getRemoteMirrorID(Link link) {
45-
if ( link != null && link.getRemoteProperties() != null && link.getRemoteProperties().containsKey(AMQPMirrorControllerSource.BROKER_ID)) {
45+
if (link != null && link.getRemoteProperties() != null && link.getRemoteProperties().containsKey(AMQPMirrorControllerSource.BROKER_ID)) {
4646
return (String)link.getRemoteProperties().get(AMQPMirrorControllerSource.BROKER_ID);
4747
} else {
4848
return null;

artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPTunneledCoreLargeMessageReader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public Message readBytes(Delivery delivery) throws Exception {
177177
// Advance mark so read bytes can be discarded and we can start from this
178178
// location next time.
179179
pendingRecvBuffer.markReaderIndex();
180-
} catch (ActiveMQException ex ) {
180+
} catch (ActiveMQException ex) {
181181
throw ex;
182182
} catch (Exception e) {
183183
// We expect exceptions from proton when only partial section are received within

artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/DefaultSenderController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public Consumer init(ProtonServerSenderContext senderContext) throws Exception {
436436
}
437437

438438
private static Number extractConsumerPriority(Map<String, String> addressParameters) {
439-
if (addressParameters != null && !addressParameters.isEmpty() ) {
439+
if (addressParameters != null && !addressParameters.isEmpty()) {
440440
final String priorityString = addressParameters.remove(QueueConfiguration.CONSUMER_PRIORITY);
441441
if (priorityString != null) {
442442
return Integer.valueOf(priorityString);

artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ private static boolean isAddressFull(final Exception e) {
303303

304304
private static boolean outcomeSupported(final Source source, final Symbol outcome) {
305305
if (source != null && source.getOutcomes() != null) {
306-
return Arrays.asList(( source).getOutcomes()).contains(outcome);
306+
return Arrays.asList((source).getOutcomes()).contains(outcome);
307307
}
308308
return false;
309309
}

artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessageTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ private void testGetMemoryEstimateWithDecodedApplicationProperties(boolean paged
346346
@Test
347347
public void testDecodeMultiThreaded() throws Exception {
348348
MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
349-
protonMessage.setHeader( new Header());
349+
protonMessage.setHeader(new Header());
350350
Properties properties = new Properties();
351351
properties.setTo("someNiceLocal");
352352
protonMessage.setProperties(properties);

artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ public ActiveMQDestination virtualTopicConsumerToFQQN(final ActiveMQDestination
780780
}
781781
fqqn.append(paths[i]);
782782
}
783-
mappedDestination = new ActiveMQQueue(fqqn.toString() + ( virtualTopicConfig.selectorAware ? "?" + SELECTOR_AWARE_OPTION + "=true" : "" ));
783+
mappedDestination = new ActiveMQQueue(fqqn.toString() + (virtualTopicConfig.selectorAware ? "?" + SELECTOR_AWARE_OPTION + "=true" : ""));
784784
break;
785785
}
786786
}

artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ public void setAcknowledgeMode(final String value) {
382382

383383
try {
384384
this.acknowledgeMode = ActiveMQActivationValidationUtils.validateAcknowledgeMode(value);
385-
} catch ( IllegalArgumentException e ) {
385+
} catch (IllegalArgumentException e) {
386386
ActiveMQRALogger.LOGGER.invalidAcknowledgementMode(value);
387387
throw e;
388388
}
@@ -583,7 +583,7 @@ public Integer getMaxSession() {
583583
public void setMaxSession(final Integer value) {
584584
logger.trace("setMaxSession({})", value);
585585

586-
if ( value < 1 ) {
586+
if (value < 1) {
587587
maxSession = 1;
588588
ActiveMQRALogger.LOGGER.invalidNumberOfMaxSession(value, maxSession);
589589
} else

artemis-selector/src/main/javacc/HyphenatedParser.jj

+10-10
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class HyphenatedParser {
6565
return (BooleanExpression) value;
6666
}
6767
if (value instanceof PropertyExpression) {
68-
return UnaryExpression.createBooleanCast( value );
68+
return UnaryExpression.createBooleanCast(value);
6969
}
7070
throw new ParseException("Expression will not result in a boolean value: " + value);
7171
}
@@ -298,13 +298,13 @@ Expression comparisonExpression() :
298298
t = stringLitteral()
299299
{
300300
list = new ArrayList();
301-
list.add( t );
301+
list.add(t);
302302
}
303303
(
304304
","
305305
t = stringLitteral()
306306
{
307-
list.add( t );
307+
list.add(t);
308308
}
309309

310310
)*
@@ -319,13 +319,13 @@ Expression comparisonExpression() :
319319
t = stringLitteral()
320320
{
321321
list = new ArrayList();
322-
list.add( t );
322+
list.add(t);
323323
}
324324
(
325325
","
326326
t = stringLitteral()
327327
{
328-
list.add( t );
328+
list.add(t);
329329
}
330330

331331
)*
@@ -415,17 +415,17 @@ Expression unaryExpr() :
415415
|
416416
<NOT> left=unaryExpr()
417417
{
418-
left = UnaryExpression.createNOT( asBooleanExpression(left) );
418+
left = UnaryExpression.createNOT(asBooleanExpression(left));
419419
}
420420
|
421421
<XPATH> s=stringLitteral()
422422
{
423-
left = UnaryExpression.createXPath( s );
423+
left = UnaryExpression.createXPath(s);
424424
}
425425
|
426426
<XQUERY> s=stringLitteral()
427427
{
428-
left = UnaryExpression.createXQuery( s );
428+
left = UnaryExpression.createXQuery(s);
429429
}
430430
|
431431
left = primaryExpr()
@@ -535,9 +535,9 @@ String stringLitteral() :
535535
{
536536
// Decode the sting value.
537537
String image = t.image;
538-
for( int i=1; i < image.length()-1; i++ ) {
538+
for(int i=1; i < image.length()-1; i++) {
539539
char c = image.charAt(i);
540-
if( c == '\'' )
540+
if(c == '\'')
541541
i++;
542542
rc.append(c);
543543
}

0 commit comments

Comments
 (0)