ARTEMIS-2320 Assorted small code fixes, mostly from IntelliJ autofixes

This commit is contained in:
Jiri Danek 2019-03-25 14:09:25 +01:00 committed by Michael Andre Pearce
parent bd6d5ecd72
commit b33874488b
11 changed files with 17 additions and 18 deletions

View File

@ -123,7 +123,7 @@ public final class PasswordMaskingUtil {
} }
private static boolean isEncoded(String storedPassword) { private static boolean isEncoded(String storedPassword) {
return storedPassword == null || (isEncMasked(storedPassword)); return storedPassword == null || isEncMasked(storedPassword);
} }
public static HashProcessor getHashProcessor() { public static HashProcessor getHashProcessor() {
@ -164,7 +164,7 @@ public final class PasswordMaskingUtil {
try { try {
// Service load the codec, if a service is available // Service load the codec, if a service is available
for (SensitiveDataCodec<String> codec : serviceLoader) { for (SensitiveDataCodec<String> codec : serviceLoader) {
if ((codec.getClass().getCanonicalName()).equals(codecClassName)) { if (codec.getClass().getCanonicalName().equals(codecClassName)) {
return codec.getClass().newInstance(); return codec.getClass().newInstance();
} }
} }

View File

@ -49,7 +49,7 @@ public class ConcurrentAppendOnlyChunkedListTest {
final int messages = ELEMENTS; final int messages = ELEMENTS;
for (int i = 0; i < messages; i++) { for (int i = 0; i < messages; i++) {
Assert.assertEquals(i, chunkedList.size()); Assert.assertEquals(i, chunkedList.size());
chunkedList.add((i)); chunkedList.add(i);
} }
Assert.assertEquals(messages, chunkedList.size()); Assert.assertEquals(messages, chunkedList.size());
} }

View File

@ -56,9 +56,7 @@ public class InflaterReader extends InputStream {
} }
pointer = 0; pointer = 0;
} catch (DataFormatException e) { } catch (DataFormatException e) {
IOException e2 = new IOException(e.getMessage()); throw new IOException(e.getMessage(), e);
e2.initCause(e);
throw e2;
} }
} }

View File

@ -37,7 +37,7 @@ public class SharedEventLoopGroupTest {
Thread t1 = new Thread(new Runnable() { Thread t1 = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
sharedEventLoopGroup1.set(SharedEventLoopGroup.getInstance((threadFactory -> customNioEventLoopGroup))); sharedEventLoopGroup1.set(SharedEventLoopGroup.getInstance(threadFactory -> customNioEventLoopGroup));
customNioEventLoopGroup.setCyclicBarrier(barrier); customNioEventLoopGroup.setCyclicBarrier(barrier);
sharedEventLoopGroup1.get().shutdownGracefully(); sharedEventLoopGroup1.get().shutdownGracefully();
customNioEventLoopGroup.setCyclicBarrier(null); customNioEventLoopGroup.setCyclicBarrier(null);
@ -51,7 +51,7 @@ public class SharedEventLoopGroupTest {
public void run() { public void run() {
try { try {
barrier.await(); barrier.await();
sharedEventLoopGroup2.set(SharedEventLoopGroup.getInstance((threadFactory -> new NioEventLoopGroup(2, threadFactory)))); sharedEventLoopGroup2.set(SharedEventLoopGroup.getInstance(threadFactory -> new NioEventLoopGroup(2, threadFactory)));
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} catch (BrokenBarrierException e) { } catch (BrokenBarrierException e) {

View File

@ -82,7 +82,7 @@ rect.graphbox.frame {
path.link { path.link {
fill: none; fill: none;
stroke: #666; stroke: #666;
stroke-width: 1.5px; b stroke-width: 1.5px;
} }
marker.broker { marker.broker {

View File

@ -212,7 +212,7 @@ public class ConnectionFactoryURITest {
populateConnectorParams(props3, allowableConnectorKeys, sb); populateConnectorParams(props3, allowableConnectorKeys, sb);
sb.append(")?ha=true&clientID=myID"); sb.append(")?ha=true&clientID=myID");
ActiveMQConnectionFactory factory = parser.newObject(parser.expandURI((sb.toString())), null); ActiveMQConnectionFactory factory = parser.newObject(parser.expandURI(sb.toString()), null);
TransportConfiguration[] staticConnectors = factory.getStaticConnectors(); TransportConfiguration[] staticConnectors = factory.getStaticConnectors();
Assert.assertEquals(3, staticConnectors.length); Assert.assertEquals(3, staticConnectors.length);

View File

@ -2,7 +2,6 @@
<html> <html>
<head> <head>
<!-- $Id: package.html 71554 2008-04-01 13:25:40Z adrian@jboss.org $ --> <!-- $Id: package.html 71554 2008-04-01 13:25:40Z adrian@jboss.org $ -->
<!--
<!-- <!--
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with

View File

@ -14,7 +14,8 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
import httplib, urlparse import httplib
import urlparse
conn = httplib.HTTPConnection("localhost:8080") conn = httplib.HTTPConnection("localhost:8080")
conn.request("HEAD", "/queues/orders") conn.request("HEAD", "/queues/orders")
@ -25,7 +26,7 @@ conn.close()
createParsed = urlparse.urlparse(createLink) createParsed = urlparse.urlparse(createLink)
conn = httplib.HTTPConnection(createParsed.netloc) conn = httplib.HTTPConnection(createParsed.netloc)
headers = {'Content-Type' : 'application/xml'} headers = {'Content-Type': 'application/xml'}
xml = """<?xml version="1.0"?> xml = """<?xml version="1.0"?>
<order> <order>
<name>Bill</name> <name>Bill</name>

View File

@ -14,7 +14,8 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
import httplib, urlparse import httplib
import urlparse
conn = httplib.HTTPConnection("localhost:8080") conn = httplib.HTTPConnection("localhost:8080")
conn.request("HEAD", "/queues/orders") conn.request("HEAD", "/queues/orders")
@ -29,7 +30,7 @@ session = res.getheader("Location")
print consumeLink print consumeLink
conn.close() conn.close()
headers = {"Accept-Wait" : "3", "Accept" : "application/xml"} headers = {"Accept-Wait": "3", "Accept": "application/xml"}
try: try:
print "Waiting..." print "Waiting..."
@ -49,7 +50,7 @@ try:
else: else:
raise Exception('failed') raise Exception('failed')
finally: finally:
if session != None: if session is not None:
print "deleting activemq session..." print "deleting activemq session..."
createParsed = urlparse.urlparse(session) createParsed = urlparse.urlparse(session)
conn = httplib.HTTPConnection(createParsed.netloc) conn = httplib.HTTPConnection(createParsed.netloc)

View File

@ -250,7 +250,7 @@ public class IdGenerator {
*/ */
protected static String getLocalHostName() throws UnknownHostException { protected static String getLocalHostName() throws UnknownHostException {
try { try {
return (InetAddress.getLocalHost()).getHostName(); return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException uhe) { } catch (UnknownHostException uhe) {
String host = uhe.getMessage(); // host = "hostname: hostname" String host = uhe.getMessage(); // host = "hostname: hostname"
if (host != null) { if (host != null) {

View File

@ -180,7 +180,7 @@ public class TokenBucketLimiterImplTest extends ActiveMQTestBase {
if (lastRun != 0) { if (lastRun != 0) {
int consumed = tmpValue - lastRun; int consumed = tmpValue - lastRun;
double calculatedRate = consumed * window * 1000 / ((System.currentTimeMillis() - lastTime)); double calculatedRate = consumed * window * 1000 / (System.currentTimeMillis() - lastTime);
if (calculatedRate > rate * error) { if (calculatedRate > rate * error) {
System.out.println("got more than " + rate + " tokens / second"); System.out.println("got more than " + rate + " tokens / second");