Skip to content

Commit

Permalink
ARTEMIS-5234 make style for parentheses consistent
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jbertram authored and gemmellr committed Jan 9, 2025
1 parent 3bac04a commit bf1b3b7
Show file tree
Hide file tree
Showing 61 changed files with 129 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ public boolean containsEitherOf(final char c, final char d) {
final byte highd = (byte) (d >> 8 & 0xFF); // high byte

for (int i = 0; i + 1 < data.length; i += 2) {
if ( data[i] == lowc && data[i + 1] == highc ||
data[i] == lowd && data[i + 1] == highd ) {
if (data[i] == lowc && data[i + 1] == highc ||
data[i] == lowd && data[i + 1] == highd) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public short readShort() {

@Override
public ActiveMQBuffer readSlice(final int length) {
if ( isPooled ) {
if (isPooled) {
ByteBuf fromBuffer = buffer.readSlice(length);
ByteBuf newNettyBuffer = Unpooled.buffer(fromBuffer.capacity());
int read = fromBuffer.readerIndex();
Expand Down Expand Up @@ -530,7 +530,7 @@ public ByteBuffer toByteBuffer(final int index, final int length) {

@Override
public void release() {
if ( this.isPooled ) {
if (this.isPooled) {
buffer.release();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testClearAndToString() throws Exception {
});
}
for (int i = 0; i < 10; i++) {
executorService.submit( () -> {
executorService.submit(() -> {
try {
countDownLatch.await();
for (int k = 0; k < 1000; k++) {
Expand Down Expand Up @@ -107,7 +107,7 @@ public void testGetPropertyNamesClearAndToString() throws Exception {
});
}
for (int i = 0; i < 10; i++) {
executorService.submit( () -> {
executorService.submit(() -> {
try {
countDownLatch.await();
for (int k = 0; k < 1000; k++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ protected static ByteBuf copyMessageBuffer(ByteBuf buffer, int skipBytes) {
buffer.readerIndex(PACKET_HEADERS_SIZE);

newNettyBuffer.writeBytes(buffer, buffer.readableBytes() - skipBytes);
buffer.setIndex( read, writ );
newNettyBuffer.setIndex( 0, writ - PACKET_HEADERS_SIZE - skipBytes);
buffer.setIndex(read, writ);
newNettyBuffer.setIndex(0, writ - PACKET_HEADERS_SIZE - skipBytes);

return newNettyBuffer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
@XmlAccessorType(XmlAccessType.FIELD)
public class AuthorisationDTO {

@XmlElementRef( required = false)
@XmlElementRef(required = false)
@Deprecated(forRemoval = true)
WhiteListDTO whitelist;

@XmlElementRef( required = false )
@XmlElementRef(required = false)
AllowListDTO allowList;

@XmlElementRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public void testValues() {
binding.setExcludedTLSProtocols("TLSv1,TLSv1.1");
assertArrayEquals(new String[] {"TLSv1", "TLSv1.1"}, binding.getExcludedTLSProtocols());

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void setProtocolManagerFactoryStr(final String protocolManagerFactoryStr)
if (protocolManagerFactoryStr != null && !protocolManagerFactoryStr.trim().isEmpty() &&
!protocolManagerFactoryStr.equals("undefined")) {
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
ClientProtocolManagerFactory protocolManagerFactory = (ClientProtocolManagerFactory) ClassloadingUtil.newInstanceFromClassLoader(ActiveMQConnectionFactory.class, protocolManagerFactoryStr, ClientProtocolManagerFactory.class );
ClientProtocolManagerFactory protocolManagerFactory = (ClientProtocolManagerFactory) ClassloadingUtil.newInstanceFromClassLoader(ActiveMQConnectionFactory.class, protocolManagerFactoryStr, ClientProtocolManagerFactory.class);
serverLocator.setProtocolManagerFactory(protocolManagerFactory);
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ public void appendUpdateRecordTransactional(final long txID,
final byte recordType,
final Persister persister,
final Object record) throws Exception {
if ( logger.isTraceEnabled() ) {
if (logger.isTraceEnabled()) {
logger.trace("scheduling appendUpdateRecordTransactional::txID={}, id={}, userRecordType={}, record = {}",
txID, id, recordType, record);
}
Expand All @@ -1326,18 +1326,18 @@ public void appendUpdateRecordTransactional(final long txID,
try {
tx.checkErrorCondition();

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

if (logger.isTraceEnabled()) {
logger.trace("appendUpdateRecordTransactional::txID={}, id={}, userRecordType={}, record = {}, usedFile = {}",
txID, id, recordType, record, usedFile );
txID, id, recordType, record, usedFile);
}

tx.addPositive( usedFile, id, updateRecordTX.getEncodeSize(), false);
} catch (Throwable e ) {
logger.error("Exception during appendUpdateRecordTransactional:", e );
setErrorCondition(null, tx, e );
tx.addPositive(usedFile, id, updateRecordTX.getEncodeSize(), false);
} catch (Throwable e) {
logger.error("Exception during appendUpdateRecordTransactional:", e);
setErrorCondition(null, tx, e);
} finally {
journalLock.readLock().unlock();
}
Expand Down Expand Up @@ -2729,7 +2729,7 @@ private void flushExecutor(Executor executor) throws InterruptedException {
try {
executor.execute(latch::countDown);
latch.await(10, TimeUnit.SECONDS);
} catch (RejectedExecutionException ignored ) {
} catch (RejectedExecutionException ignored) {
// this is fine
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
writerOutput.println(" }");
writerOutput.println();

writerOutput.println(" public " + simpleClassName + "(Logger logger ) {");
writerOutput.println(" public " + simpleClassName + "(Logger logger) {");
writerOutput.println(" this.logger = logger;");
writerOutput.println(" }");
writerOutput.println();
Expand Down Expand Up @@ -533,7 +533,7 @@ private static void verifyIdNotRetiredOrProcessedPreviously(final LogBundle bund
}

Integer nextId = Collections.max(activeIDs) + 1;
while (isRetiredID(bundleAnnotation, nextId) ) {
while (isRetiredID(bundleAnnotation, nextId)) {
nextId++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ private void tryRestartFederationConsumerForAddress(AMQPFederationAddressEntry e

@Override
public void onComplete(AMQPFederationConsumer context) {
logger.trace("Restarted federation consumer after new demand added." );
logger.trace("Restarted federation consumer after new demand added.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected void actualDelivery(Message message, Delivery delivery, DeliveryAnnota
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
federation.signalError(
new ActiveMQAMQPInternalErrorException("Error while processing incoming control message: " + e.getMessage() ));
new ActiveMQAMQPInternalErrorException("Error while processing incoming control message: " + e.getMessage()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void afterAddAddress(AddressInfo addressInfo, boolean reload) throws Acti
} catch (Exception e) {
logger.warn("error on send of address added event: {}", e.getMessage());
federation.signalError(
new ActiveMQAMQPInternalErrorException("Error while processing address added: " + e.getMessage() ));
new ActiveMQAMQPInternalErrorException("Error while processing address added: " + e.getMessage()));
}
}
});
Expand All @@ -232,7 +232,7 @@ public void afterAddBinding(Binding binding) throws ActiveMQException {
// Likely the connection failed if we get here.
logger.warn("Error on send of queue added event: {}", e.getMessage());
federation.signalError(
new ActiveMQAMQPInternalErrorException("Error while processing queue added: " + e.getMessage() ));
new ActiveMQAMQPInternalErrorException("Error while processing queue added: " + e.getMessage()));
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected void actualDelivery(Message message, Delivery delivery, DeliveryAnnota
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
federation.signalError(
new ActiveMQAMQPInternalErrorException("Error while processing incoming event message: " + e.getMessage() ));
new ActiveMQAMQPInternalErrorException("Error while processing incoming event message: " + e.getMessage()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private void tryRestartFederationConsumerForQueue(AMQPFederationQueueEntry entry

@Override
public void onComplete(AMQPFederationConsumer context) {
logger.trace("Restarted federation consumer after new demand added." );
logger.trace("Restarted federation consumer after new demand added.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public String getRemoteMirrorId() {
}

public static String getRemoteMirrorID(Link link) {
if ( link != null && link.getRemoteProperties() != null && link.getRemoteProperties().containsKey(AMQPMirrorControllerSource.BROKER_ID)) {
if (link != null && link.getRemoteProperties() != null && link.getRemoteProperties().containsKey(AMQPMirrorControllerSource.BROKER_ID)) {
return (String)link.getRemoteProperties().get(AMQPMirrorControllerSource.BROKER_ID);
} else {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public Message readBytes(Delivery delivery) throws Exception {
// Advance mark so read bytes can be discarded and we can start from this
// location next time.
pendingRecvBuffer.markReaderIndex();
} catch (ActiveMQException ex ) {
} catch (ActiveMQException ex) {
throw ex;
} catch (Exception e) {
// We expect exceptions from proton when only partial section are received within
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public Consumer init(ProtonServerSenderContext senderContext) throws Exception {
}

private static Number extractConsumerPriority(Map<String, String> addressParameters) {
if (addressParameters != null && !addressParameters.isEmpty() ) {
if (addressParameters != null && !addressParameters.isEmpty()) {
final String priorityString = addressParameters.remove(QueueConfiguration.CONSUMER_PRIORITY);
if (priorityString != null) {
return Integer.valueOf(priorityString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private static boolean isAddressFull(final Exception e) {

private static boolean outcomeSupported(final Source source, final Symbol outcome) {
if (source != null && source.getOutcomes() != null) {
return Arrays.asList(( source).getOutcomes()).contains(outcome);
return Arrays.asList((source).getOutcomes()).contains(outcome);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ private void testGetMemoryEstimateWithDecodedApplicationProperties(boolean paged
@Test
public void testDecodeMultiThreaded() throws Exception {
MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
protonMessage.setHeader( new Header());
protonMessage.setHeader(new Header());
Properties properties = new Properties();
properties.setTo("someNiceLocal");
protonMessage.setProperties(properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ public ActiveMQDestination virtualTopicConsumerToFQQN(final ActiveMQDestination
}
fqqn.append(paths[i]);
}
mappedDestination = new ActiveMQQueue(fqqn.toString() + ( virtualTopicConfig.selectorAware ? "?" + SELECTOR_AWARE_OPTION + "=true" : "" ));
mappedDestination = new ActiveMQQueue(fqqn.toString() + (virtualTopicConfig.selectorAware ? "?" + SELECTOR_AWARE_OPTION + "=true" : ""));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public void setAcknowledgeMode(final String value) {

try {
this.acknowledgeMode = ActiveMQActivationValidationUtils.validateAcknowledgeMode(value);
} catch ( IllegalArgumentException e ) {
} catch (IllegalArgumentException e) {
ActiveMQRALogger.LOGGER.invalidAcknowledgementMode(value);
throw e;
}
Expand Down Expand Up @@ -583,7 +583,7 @@ public Integer getMaxSession() {
public void setMaxSession(final Integer value) {
logger.trace("setMaxSession({})", value);

if ( value < 1 ) {
if (value < 1) {
maxSession = 1;
ActiveMQRALogger.LOGGER.invalidNumberOfMaxSession(value, maxSession);
} else
Expand Down
20 changes: 10 additions & 10 deletions artemis-selector/src/main/javacc/HyphenatedParser.jj
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class HyphenatedParser {
return (BooleanExpression) value;
}
if (value instanceof PropertyExpression) {
return UnaryExpression.createBooleanCast( value );
return UnaryExpression.createBooleanCast(value);
}
throw new ParseException("Expression will not result in a boolean value: " + value);
}
Expand Down Expand Up @@ -298,13 +298,13 @@ Expression comparisonExpression() :
t = stringLitteral()
{
list = new ArrayList();
list.add( t );
list.add(t);
}
(
","
t = stringLitteral()
{
list.add( t );
list.add(t);
}

)*
Expand All @@ -319,13 +319,13 @@ Expression comparisonExpression() :
t = stringLitteral()
{
list = new ArrayList();
list.add( t );
list.add(t);
}
(
","
t = stringLitteral()
{
list.add( t );
list.add(t);
}

)*
Expand Down Expand Up @@ -415,17 +415,17 @@ Expression unaryExpr() :
|
<NOT> left=unaryExpr()
{
left = UnaryExpression.createNOT( asBooleanExpression(left) );
left = UnaryExpression.createNOT(asBooleanExpression(left));
}
|
<XPATH> s=stringLitteral()
{
left = UnaryExpression.createXPath( s );
left = UnaryExpression.createXPath(s);
}
|
<XQUERY> s=stringLitteral()
{
left = UnaryExpression.createXQuery( s );
left = UnaryExpression.createXQuery(s);
}
|
left = primaryExpr()
Expand Down Expand Up @@ -535,9 +535,9 @@ String stringLitteral() :
{
// Decode the sting value.
String image = t.image;
for( int i=1; i < image.length()-1; i++ ) {
for(int i=1; i < image.length()-1; i++) {
char c = image.charAt(i);
if( c == '\'' )
if(c == '\'')
i++;
rc.append(c);
}
Expand Down
Loading

0 comments on commit bf1b3b7

Please sign in to comment.