This closes #734

This commit is contained in:
Clebert Suconic 2016-08-25 14:22:32 -04:00
commit 0a8c118a14
69 changed files with 145 additions and 215 deletions

View File

@ -106,16 +106,16 @@ public abstract class URISchema<T, P> {
Map<String, String> rc = new HashMap<>();
if (uri != null && !uri.isEmpty()) {
String[] parameters = uri.split("&");
for (int i = 0; i < parameters.length; i++) {
int p = parameters[i].indexOf("=");
for (String parameter : parameters) {
int p = parameter.indexOf("=");
if (p >= 0) {
String name = BeanSupport.decodeURI(parameters[i].substring(0, p));
String value = BeanSupport.decodeURI(parameters[i].substring(p + 1));
String name = BeanSupport.decodeURI(parameter.substring(0, p));
String value = BeanSupport.decodeURI(parameter.substring(p + 1));
rc.put(name, value);
}
else {
if (!parameters[i].trim().isEmpty()) {
rc.put(parameters[i], null);
if (!parameter.trim().isEmpty()) {
rc.put(parameter, null);
}
}
}

View File

@ -135,15 +135,15 @@ public class URISupport {
private static void parseParameters(Map<String, String> rc,
String[] parameters) throws UnsupportedEncodingException {
for (int i = 0; i < parameters.length; i++) {
int p = parameters[i].indexOf("=");
for (String parameter : parameters) {
int p = parameter.indexOf("=");
if (p >= 0) {
String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
String name = URLDecoder.decode(parameter.substring(0, p), "UTF-8");
String value = URLDecoder.decode(parameter.substring(p + 1), "UTF-8");
rc.put(name, value);
}
else {
rc.put(parameters[i], null);
rc.put(parameter, null);
}
}
}

View File

@ -67,8 +67,8 @@ public class SSLSupport {
public static String parseArrayIntoCommandSeparatedList(String[] suites) {
StringBuilder supportedSuites = new StringBuilder();
for (int i = 0; i < suites.length; i++) {
supportedSuites.append(suites[i]);
for (String suite : suites) {
supportedSuites.append(suite);
supportedSuites.append(", ");
}

View File

@ -105,7 +105,7 @@ public interface RemotingConnection extends BufferHandler {
/**
* set the failure listeners.
* <p>
* These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.
* These will be called in the event of the connection being closed. Any previously added listeners will be removed.
*
* @param listeners the listeners to add.
*/

View File

@ -65,8 +65,8 @@ public class SecurityFormatter {
return list;
}
String[] values = commaSeparatedString.split(",");
for (int i = 0; i < values.length; i++) {
list.add(values[i].trim());
for (String value : values) {
list.add(value.trim());
}
return list;
}

View File

@ -366,8 +366,8 @@ public final class XMLUtil {
for (int i = 0; i < nl.getLength(); i++) {
Node n = nl.item(i);
short type = n.getNodeType();
for (int j = 0; j < typesToFilter.length; j++) {
if (typesToFilter[j] == type) {
for (short typeToFilter : typesToFilter) {
if (typeToFilter == type) {
continue outer;
}
}

View File

@ -60,10 +60,10 @@ public class CompressionUtilTest extends Assert {
}
byte[] output = new byte[30];
Deflater compresser = new Deflater();
compresser.setInput(input);
compresser.finish();
int compressedDataLength = compresser.deflate(output);
Deflater compressor = new Deflater();
compressor.setInput(input);
compressor.finish();
int compressedDataLength = compressor.deflate(output);
compareByteArray(allCompressed, output, compressedDataLength);
}
@ -97,10 +97,10 @@ public class CompressionUtilTest extends Assert {
}
byte[] output = new byte[30];
Deflater compresser = new Deflater();
compresser.setInput(input);
compresser.finish();
int compressedDataLength = compresser.deflate(output);
Deflater compressor = new Deflater();
compressor.setInput(input);
compressor.finish();
int compressedDataLength = compressor.deflate(output);
compareByteArray(allCompressed, output, compressedDataLength);
}
@ -110,10 +110,10 @@ public class CompressionUtilTest extends Assert {
String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
byte[] input = inputString.getBytes(StandardCharsets.UTF_8);
byte[] output = new byte[30];
Deflater compresser = new Deflater();
compresser.setInput(input);
compresser.finish();
int compressedDataLength = compresser.deflate(output);
Deflater compressor = new Deflater();
compressor.setInput(input);
compressor.finish();
int compressedDataLength = compressor.deflate(output);
byte[] zipBytes = new byte[compressedDataLength];
@ -146,10 +146,10 @@ public class CompressionUtilTest extends Assert {
String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
byte[] input = inputString.getBytes(StandardCharsets.UTF_8);
byte[] output = new byte[30];
Deflater compresser = new Deflater();
compresser.setInput(input);
compresser.finish();
int compressedDataLength = compresser.deflate(output);
Deflater compressor = new Deflater();
compressor.setInput(input);
compressor.finish();
int compressedDataLength = compressor.deflate(output);
byte[] zipBytes = new byte[compressedDataLength];

View File

@ -79,7 +79,7 @@ public class XmlUtil {
return decode(clazz, configuration, null, null);
}
/** We offer parameters for artemisInstance and artemisHoms as they could be coming from the CLI or Maven Plugin */
/** We offer parameters for artemisInstance and artemisHome as they could be coming from the CLI or Maven Plugin */
public static <T> T decode(Class<T> clazz, File configuration, String artemisHome, String artemisInstance) throws Exception {
JAXBContext jaxbContext = JAXBContext.newInstance("org.apache.activemq.artemis.dto");

View File

@ -70,8 +70,9 @@ public class JDBCUtils {
try (ResultSet rs = connection.getMetaData().getTables(null, null, tableName, null)) {
if (rs != null && !rs.next()) {
logger.tracef("Table %s did not exist, creating it with SQL=%s", tableName, sql);
Statement statement = connection.createStatement();
statement.executeUpdate(sql);
try (Statement statement = connection.createStatement()) {
statement.executeUpdate(sql);
}
}
}
connection.commit();

View File

@ -294,8 +294,9 @@ public class JDBCSequentialFileFactoryDriver extends AbstractJDBCDriver {
public synchronized void destroy() throws SQLException {
try {
connection.setAutoCommit(false);
Statement statement = connection.createStatement();
statement.executeUpdate(sqlProvider.getDropFileTableSQL());
try (Statement statement = connection.createStatement()) {
statement.executeUpdate(sqlProvider.getDropFileTableSQL());
}
connection.commit();
}
catch (SQLException e) {

View File

@ -378,7 +378,8 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
}
@Override
public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) {
@SuppressWarnings("unchecked")
public boolean isBodyAssignableTo(Class c) {
return c.isAssignableFrom(byte[].class);
}

View File

@ -154,18 +154,22 @@ public class ActiveMQConnectionFactory implements ConnectionFactoryOptions, Exte
}
}
@Override
public String getDeserializationBlackList() {
return deserializationBlackList;
}
@Override
public void setDeserializationBlackList(String blackList) {
this.deserializationBlackList = blackList;
}
@Override
public String getDeserializationWhiteList() {
return deserializationWhiteList;
}
@Override
public void setDeserializationWhiteList(String whiteList) {
this.deserializationWhiteList = whiteList;
}

View File

@ -384,7 +384,8 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
}
@Override
public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) {
@SuppressWarnings("unchecked")
public boolean isBodyAssignableTo(Class c) {
if (hasNoBody()) {
return true;
}

View File

@ -609,7 +609,6 @@ public class ActiveMQMessage implements javax.jms.Message {
return val;
}
@SuppressWarnings("rawtypes")
@Override
public Enumeration getPropertyNames() throws JMSException {
return Collections.enumeration(MessageUtil.getPropertyNames(message));
@ -771,7 +770,7 @@ public class ActiveMQMessage implements javax.jms.Message {
}
@Override
public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) {
public boolean isBodyAssignableTo(Class c) {
/**
* From the specs:
* <p>

View File

@ -176,7 +176,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess
}
@Override
public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) {
public boolean isBodyAssignableTo(Class c) {
if (data == null) // we have no body
return true;
try {

View File

@ -394,7 +394,6 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
return message.getBodyBuffer();
}
@SuppressWarnings("rawtypes")
@Override
public boolean isBodyAssignableTo(Class c) {
return false;

View File

@ -120,7 +120,8 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage
}
@Override
public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) {
@SuppressWarnings("unchecked")
public boolean isBodyAssignableTo(ctiClass c) {
if (text == null)
return true;
return c.isAssignableFrom(java.lang.String.class);

View File

@ -1602,11 +1602,8 @@ public final class JMSBridgeImpl implements JMSBridge {
msg.clearProperties();
if (oldProps != null) {
Iterator<Entry<String, Object>> oldPropsIter = oldProps.entrySet().iterator();
while (oldPropsIter.hasNext()) {
Entry<String, Object> entry = oldPropsIter.next();
for (Entry<String, Object> entry : oldProps.entrySet()) {
String propName = entry.getKey();
Object val = entry.getValue();

View File

@ -1764,8 +1764,10 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
ActiveMQServerLogger.LOGGER.reloadingConfiguration("jms");
InputStream input = url.openStream();
Reader reader = new InputStreamReader(input);
String xml = XMLUtil.readerToString(reader);
String xml;
try (Reader reader = new InputStreamReader(input)) {
xml = XMLUtil.readerToString(reader);
}
xml = XMLUtil.replaceSystemProps(xml);
Element e = XMLUtil.stringToElement(xml);

View File

@ -140,9 +140,7 @@ final class MappedByteBufferCache implements AutoCloseable {
public void closeAndResize(long length) {
if (!closed) {
//TO_FIX: unmap in this way is not portable BUT required on Windows that can't resize a memmory mapped file!
final int mappedBuffers = this.byteBuffers.size();
for (int i = 0; i < mappedBuffers; i++) {
final WeakReference<MappedByteBuffer> mbbRef = byteBuffers.get(i);
for (final WeakReference<MappedByteBuffer> mbbRef : this.byteBuffers) {
if (mbbRef != null) {
final MappedByteBuffer mbb = mbbRef.get();
if (mbb != null) {
@ -204,9 +202,7 @@ final class MappedByteBufferCache implements AutoCloseable {
public void close() {
if (!closed) {
//TO_FIX: unmap in this way is not portable BUT required on Windows that can't resize a memory mapped file!
final int mappedBuffers = this.byteBuffers.size();
for (int i = 0; i < mappedBuffers; i++) {
final WeakReference<MappedByteBuffer> mbbRef = byteBuffers.get(i);
for (final WeakReference<MappedByteBuffer> mbbRef : this.byteBuffers) {
if (mbbRef != null) {
final MappedByteBuffer mbb = mbbRef.get();
if (mbb != null) {
@ -237,4 +233,4 @@ final class MappedByteBufferCache implements AutoCloseable {
closed = true;
}
}
}
}

View File

@ -48,7 +48,7 @@ struct io_control {
pthread_mutex_t pollLock;
// a resuable pool of iocb
// a reusable pool of iocb
struct iocb ** iocb;
int queueSize;
int iocbPut;

View File

@ -81,7 +81,6 @@ public class ActiveMQJMSVendor implements JMSVendor {
}
@Override
@SuppressWarnings("deprecation")
public Destination createDestination(String name) {
return new ServerDestination(name);
}

View File

@ -22,7 +22,7 @@ import javax.jms.JMSException;
import javax.jms.Queue;
/**
* This is just here to avoid all the client checks we ned with valid JMS destinations, protocol convertors don't need to
* This is just here to avoid all the client checks we need with valid JMS destinations, protocol convertors don't need to
* adhere to the jms. semantics.
*/
public class ServerDestination extends ActiveMQDestination implements Queue {

View File

@ -25,7 +25,6 @@ import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@ -477,7 +476,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
if (context.isReconnect() || (context.isNetworkConnection())) {
// once implemented ARTEMIS-194, we need to set the storedSequenceID here somehow
// We have different semantics on Artemis Journal, but we could adapt something for this
// TBD during the implemetnation of ARTEMIS-194
// TBD during the implementation of ARTEMIS-194
result.setLastStoredSequenceId(0);
}
SessionState ss = state.getSessionState(id.getParentId());
@ -764,9 +763,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
}
public void addSessions(Set<SessionId> sessionSet) {
Iterator<SessionId> iter = sessionSet.iterator();
while (iter.hasNext()) {
SessionId sid = iter.next();
for (SessionId sid : sessionSet) {
addSession(getState().getSessionState(sid).getInfo(), true);
}
}
@ -805,10 +802,9 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
}
else {
Bindings bindings = server.getPostOffice().getBindingsForAddress(OpenWireUtil.toCoreAddress(dest));
Iterator<Binding> iterator = bindings.getBindings().iterator();
while (iterator.hasNext()) {
Queue b = (Queue) iterator.next().getBindable();
for (Binding binding : bindings.getBindings()) {
Queue b = (Queue) binding.getBindable();
if (b.getConsumerCount() > 0) {
throw new Exception("Destination still has an active subscription: " + dest.getPhysicalName());
}

View File

@ -24,7 +24,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@ -353,10 +352,7 @@ public class OpenWireMessageConverter implements MessageConverter {
//unmarshall properties to core so selector will work
Map<String, Object> props = messageSend.getProperties();
//Map<String, Object> props = MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(propBytes)));
Iterator<Entry<String, Object>> iterEntries = props.entrySet().iterator();
while (iterEntries.hasNext()) {
Entry<String, Object> ent = iterEntries.next();
for (Entry<String, Object> ent : props.entrySet()) {
Object value = ent.getValue();
try {
coreMessage.putObjectProperty(ent.getKey(), value);
@ -394,9 +390,7 @@ public class OpenWireMessageConverter implements MessageConverter {
}
private static void loadMapIntoProperties(TypedProperties props, Map<String, Object> map) {
Iterator<Entry<String, Object>> iter = map.entrySet().iterator();
while (iter.hasNext()) {
Entry<String, Object> entry = iter.next();
for (Entry<String, Object> entry : map.entrySet()) {
SimpleString key = new SimpleString(entry.getKey());
Object value = entry.getValue();
if (value instanceof UTF8Buffer) {

View File

@ -343,9 +343,7 @@ public class StompSession implements SessionCallback {
}
boolean containsSubscription(String subscriptionID) {
Iterator<Entry<Long, StompSubscription>> iterator = subscriptions.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Long, StompSubscription> entry = iterator.next();
for (Entry<Long, StompSubscription> entry : subscriptions.entrySet()) {
StompSubscription sub = entry.getValue();
if (sub.getID().equals(subscriptionID)) {
return true;

View File

@ -27,7 +27,6 @@ import javax.resource.spi.ResourceAdapterAssociation;
import javax.security.auth.Subject;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@ -184,7 +183,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti
* @throws ResourceException Thrown if the managed connection can not be found
*/
@Override
public ManagedConnection matchManagedConnections(@SuppressWarnings("rawtypes") final Set connectionSet,
public ManagedConnection matchManagedConnections(final Set connectionSet,
final Subject subject,
final ConnectionRequestInfo cxRequestInfo) throws ResourceException {
if (ActiveMQRAManagedConnectionFactory.trace) {
@ -203,11 +202,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti
ActiveMQRALogger.LOGGER.trace("Looking for connection matching credentials: " + credential);
}
Iterator<?> connections = connectionSet.iterator();
while (connections.hasNext()) {
Object obj = connections.next();
for (Object obj : connectionSet) {
if (obj instanceof ActiveMQRAManagedConnection) {
ActiveMQRAManagedConnection mc = (ActiveMQRAManagedConnection) obj;
ManagedConnectionFactory mcf = mc.getManagedConnectionFactory();

View File

@ -181,7 +181,6 @@ public class ActiveMQRAMapMessage extends ActiveMQRAMessage implements MapMessag
* @throws JMSException Thrown if an error occurs
*/
@Override
@SuppressWarnings("rawtypes")
public Enumeration getMapNames() throws JMSException {
if (ActiveMQRAMapMessage.trace) {
ActiveMQRALogger.LOGGER.trace("getMapNames()");

View File

@ -384,7 +384,6 @@ public class ActiveMQRAMessage implements Message {
* @throws JMSException Thrown if an error occurs
*/
@Override
@SuppressWarnings("rawtypes")
public Enumeration getPropertyNames() throws JMSException {
if (ActiveMQRAMessage.trace) {
ActiveMQRALogger.LOGGER.trace("getPropertyNames()");
@ -776,7 +775,7 @@ public class ActiveMQRAMessage implements Message {
}
@Override
public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) throws JMSException {
public boolean isBodyAssignableTo(Class c) throws JMSException {
if (ActiveMQRAMessage.trace) {
ActiveMQRALogger.LOGGER.trace("isBodyAssignableTo(" + c + ")");
}

View File

@ -28,7 +28,6 @@ import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import org.apache.activemq.artemis.ra.ConnectionFactoryProperties;
@ -722,9 +721,9 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
if (propsNotSet.size() > 0) {
StringBuffer b = new StringBuffer();
b.append("Invalid settings:");
for (Iterator<String> iter = errorMessages.iterator(); iter.hasNext(); ) {
for (String errorMessage : errorMessages) {
b.append(" ");
b.append(iter.next());
b.append(errorMessage);
}
InvalidPropertyException e = new InvalidPropertyException(b.toString());
final PropertyDescriptor[] descriptors = propsNotSet.toArray(new PropertyDescriptor[propsNotSet.size()]);

View File

@ -24,7 +24,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
/**
* implements reliable "create", "create-next" pattern defined by REST-* Messaging specificaiton
* implements reliable "create", "create-next" pattern defined by REST-* Messaging specification
*/
public class PostMessageNoDups extends PostMessage {
@ -37,4 +37,4 @@ public class PostMessageNoDups extends PostMessage {
res.location(uriInfo.getAbsolutePathBuilder().path(id).build());
return res.build();
}
}
}

View File

@ -19,7 +19,6 @@ package org.apache.activemq.artemis.selector.filter;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
/**
@ -98,8 +97,7 @@ public abstract class UnaryExpression implements Expression {
answer.append(" ( ");
int count = 0;
for (Iterator<Object> i = inList.iterator(); i.hasNext(); ) {
Object o = i.next();
for (Object o : inList) {
if (count != 0) {
answer.append(", ");
}

View File

@ -382,8 +382,8 @@ public final class ClusterConnectionConfiguration implements Serializable {
List<TransportConfiguration> list = new LinkedList<>();
for (int i = 0; i < members.length; i++) {
list.addAll(connectorTransportConfigurationParser.newObject(members[i], null));
for (URI member : members) {
list.addAll(connectorTransportConfigurationParser.newObject(member, null));
}
return list.toArray(new TransportConfiguration[list.size()]);

View File

@ -1332,15 +1332,13 @@ public class ConfigurationImpl implements Configuration, Serializable {
@Override
public String debugConnectors() {
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
for (Map.Entry<String, TransportConfiguration> connector : getConnectorConfigurations().entrySet()) {
writer.println("Connector::" + connector.getKey() + " value = " + connector.getValue());
try (PrintWriter writer = new PrintWriter(stringWriter)) {
for (Map.Entry<String, TransportConfiguration> connector : getConnectorConfigurations().entrySet()) {
writer.println("Connector::" + connector.getKey() + " value = " + connector.getValue());
}
}
writer.close();
return stringWriter.toString();
}

View File

@ -25,7 +25,6 @@ import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -47,14 +46,10 @@ public class SecurityConfiguration extends Configuration {
}
public SecurityConfiguration(Map<String, String> users, Map<String, List<String>> roles) {
Iterator<Map.Entry<String, String>> iter = users.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, String> entry = iter.next();
for (Map.Entry<String, String> entry : users.entrySet()) {
addUser(entry.getKey(), entry.getValue());
}
Iterator<Map.Entry<String, List<String>>> iter1 = roles.entrySet().iterator();
while (iter1.hasNext()) {
Map.Entry<String, List<String>> entry = iter1.next();
for (Map.Entry<String, List<String>> entry : roles.entrySet()) {
for (String role : entry.getValue()) {
addRole(entry.getKey(), role);
}

View File

@ -288,9 +288,7 @@ public class MessageCounter {
ret.append(dayCounters.size() + "\n");
// following lines: day counter data
for (int i = 0; i < dayCounters.size(); i++) {
DayCounter counter = dayCounters.get(i);
for (DayCounter counter : dayCounters) {
ret.append(counter.getDayCounterAsString() + "\n");
}
}

View File

@ -18,7 +18,6 @@ package org.apache.activemq.artemis.core.messagecounter.impl;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Future;
@ -141,11 +140,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager {
@Override
public void resetAllCounters() {
synchronized (messageCounters) {
Iterator<MessageCounter> iter = messageCounters.values().iterator();
while (iter.hasNext()) {
MessageCounter counter = iter.next();
for (MessageCounter counter : messageCounters.values()) {
counter.resetCounter();
}
}
@ -154,11 +149,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager {
@Override
public void resetAllCounterHistories() {
synchronized (messageCounters) {
Iterator<MessageCounter> iter = messageCounters.values().iterator();
while (iter.hasNext()) {
MessageCounter counter = iter.next();
for (MessageCounter counter : messageCounters.values()) {
counter.resetHistory();
}
}
@ -177,11 +168,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager {
}
synchronized (messageCounters) {
Iterator<MessageCounter> iter = messageCounters.values().iterator();
while (iter.hasNext()) {
MessageCounter counter = iter.next();
for (MessageCounter counter : messageCounters.values()) {
counter.onTimer();
}
}

View File

@ -27,7 +27,7 @@ import org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournal
import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
/**
* Message is used to sync {@link org.apache.activemq.artemis.core.journal.SequentialFile}s to a backup server. The {@link FileType} controls
* Message is used to sync {@link org.apache.activemq.artemis.core.io.SequentialFile}s to a backup server. The {@link FileType} controls
* which extra information is sent.
*/
public final class ReplicationSyncFileMessage extends PacketImpl {

View File

@ -26,7 +26,6 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -513,9 +512,7 @@ public class NettyAcceptor extends AbstractAcceptor {
if (!future.isSuccess()) {
ActiveMQServerLogger.LOGGER.nettyChannelGroupError();
Iterator<Channel> iterator = future.group().iterator();
while (iterator.hasNext()) {
Channel channel = iterator.next();
for (Channel channel : future.group()) {
if (channel.isActive()) {
ActiveMQServerLogger.LOGGER.nettyChannelStillOpen(channel, channel.remoteAddress());
}
@ -573,9 +570,7 @@ public class NettyAcceptor extends AbstractAcceptor {
ChannelGroupFuture future = serverChannelGroup.close().awaitUninterruptibly();
if (!future.isSuccess()) {
ActiveMQServerLogger.LOGGER.nettyChannelGroupBindError();
Iterator<Channel> iterator = future.group().iterator();
while (iterator.hasNext()) {
Channel channel = iterator.next();
for (Channel channel : future.group()) {
if (channel.isActive()) {
ActiveMQServerLogger.LOGGER.nettyChannelStillBound(channel, channel.remoteAddress());
}

View File

@ -295,12 +295,12 @@ public class ClusterConnectionBridge extends BridgeImpl {
List<String> excludes = new ArrayList<>();
// Split the list into addresses to match and addresses to exclude.
for (int i = 0; i < list.length; i++) {
if (list[i].startsWith("!")) {
excludes.add(list[i].substring(1, list[i].length()));
for (String s : list) {
if (s.startsWith("!")) {
excludes.add(s.substring(1, s.length()));
}
else {
includes.add(list[i]);
includes.add(s);
}
}

View File

@ -381,6 +381,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
this.serviceRegistry = serviceRegistry == null ? new ServiceRegistryImpl() : serviceRegistry;
}
@Override
public ReloadManager getReloadManager() {
return reloadManager;
}

View File

@ -615,7 +615,7 @@ public class QueueImpl implements Queue {
}
if (logger.isTraceEnabled()) {
logger.trace("Force delivery deliverying async");
logger.trace("Force delivery delivering async");
}
deliverAsync();
@ -3045,4 +3045,3 @@ public class QueueImpl implements Queue {
}
}
}

View File

@ -304,7 +304,7 @@ public class SharedNothingLiveActivation extends LiveActivation {
NodeManager nodeManagerInUse = activeMQServer.getNodeManager();
if (nodeManagerInUse != null) {
//todo does this actually make any difference, we only set a different flag in the lock file which replication doesnt use
//todo does this actually make any difference, we only set a different flag in the lock file which replication doesn't use
if (permanently) {
nodeManagerInUse.crashLiveServer();
}

View File

@ -56,7 +56,7 @@ public interface ProtocolManager<P extends BaseInterceptor> {
MessageConverter getConverter();
/** If this protocols accepts connectoins without an initial handshake.
* If true this protocol will be the failback case no other conenctions are made.
* If true this protocol will be the failback case no other connections are made.
* New designed protocols should always require a handshake. This is only useful for legacy protocols. */
boolean acceptsNoHandshake();

View File

@ -41,8 +41,7 @@ public class JaasCallbackHandler implements CallbackHandler {
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
Callback callback = callbacks[i];
for (Callback callback : callbacks) {
if (callback instanceof PasswordCallback) {
PasswordCallback passwordCallback = (PasswordCallback) callback;
if (password == null) {

View File

@ -274,8 +274,8 @@ public class LDAPLoginModule implements LoginModule {
if (logger.isDebugEnabled()) {
logger.debug("Roles " + roles + " for user " + username);
}
for (int i = 0; i < roles.size(); i++) {
groups.add(new RolePrincipal(roles.get(i)));
for (String role : roles) {
groups.add(new RolePrincipal(role));
}
}
else {
@ -488,15 +488,15 @@ public class LDAPLoginModule implements LoginModule {
}
private String getLDAPPropertyValue(String propertyName) {
for (int i = 0; i < config.length; i++)
if (config[i].getPropertyName().equals(propertyName))
return config[i].getPropertyValue();
for (LDAPLoginProperty conf : config)
if (conf.getPropertyName().equals(propertyName))
return conf.getPropertyValue();
return null;
}
private boolean isLoginPropertySet(String propertyName) {
for (int i = 0; i < config.length; i++) {
if (config[i].getPropertyName().equals(propertyName) && (config[i].getPropertyValue() != null && !"".equals(config[i].getPropertyValue())))
for (LDAPLoginProperty conf : config) {
if (conf.getPropertyName().equals(propertyName) && (conf.getPropertyValue() != null && !"".equals(conf.getPropertyValue())))
return true;
}
return false;

View File

@ -2103,30 +2103,14 @@ public abstract class ActiveMQTestBase extends Assert {
}
}
else {
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(from));
out = new BufferedOutputStream(new FileOutputStream(to));
try (InputStream in = new BufferedInputStream(new FileInputStream(from));
OutputStream out = new BufferedOutputStream(new FileOutputStream(to))) {
int b;
while ((b = in.read()) != -1) {
out.write(b);
}
}
finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}

View File

@ -49,7 +49,7 @@ imported properly. To (re)import the "tests" Maven profile in an existing proje
* Open the Maven Projects Tool Window: View -> Tool Windows -> Maven Projects
* Select the "profiles" drop down
* Unselect then reselect the checkbox next to "tests".
* Click on the "Reimport all maven projects" button in the top left hand corner of the window. (It looks like a ciruclar
* Click on the "Reimport all maven projects" button in the top left hand corner of the window. (It looks like a circular
blue arrow.
* Wait for IDEA to reload and try running a JUnit test again. The option to run should now be present.
@ -94,4 +94,4 @@ Importing all ActiveMQ Artemis subprojects will create _too many_ projects in Ec
and _Project Explorer_ views. One way to address that is to use
[Eclipse's Working Sets](http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcworkset.htm)
feature. A good introduction to it can be found at a
[Dzone article on Eclipse Working Sets](http://eclipse.dzone.com/articles/categorise-projects-package).
[Dzone article on Eclipse Working Sets](http://eclipse.dzone.com/articles/categorise-projects-package).

View File

@ -35,7 +35,7 @@ Shown are the required params for the connector service and are:
- `master-secret`. The secret of your mobile application in AeroGear.
As well as these required paramaters there are the following optional
As well as these required parameters there are the following optional
parameters
- `ttl`. The time to live for the message once AeroGear receives it.

View File

@ -64,7 +64,7 @@ Shown are the required params for the connector service:
- `queue`. The name of the Apache ActiveMQ Artemis queue to fetch message from.
As well as these required paramaters there are the following optional
As well as these required parameters there are the following optional
parameters
- `host`. The host name on which the vertx target container is

View File

@ -103,7 +103,7 @@ public class HAPolicyAutoBackupExample {
System.out.println("Got message: " + message0.getText() + " from node 0");
}
// Step 14.close the consumer so it doesnt get any messages
// Step 14.close the consumer so it doesn't get any messages
consumer1.close();
// Step 15.now kill server1, messages will be scaled down to server0

View File

@ -88,7 +88,7 @@ public abstract class PerfBase {
boolean drainQueue = Boolean.valueOf(props.getProperty("drain-queue"));
String destinationName = props.getProperty("destination-name");
int throttleRate = Integer.valueOf(props.getProperty("throttle-rate"));
boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowlege"));
boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowledge"));
boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id"));
boolean disableTimestamp = Boolean.valueOf(props.getProperty("disable-message-timestamp"));
String clientLibrary = props.getProperty("client-library", "core");

View File

@ -69,7 +69,7 @@ public class SoakBase {
String destinationLookup = props.getProperty("destination-lookup");
String connectionFactoryLookup = props.getProperty("connection-factory-lookup");
int throttleRate = Integer.valueOf(props.getProperty("throttle-rate"));
boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowlege"));
boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowledge"));
boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id"));
boolean disableTimestamp = Boolean.valueOf(props.getProperty("disable-message-timestamp"));

View File

@ -57,7 +57,7 @@ public interface ActiveMQAeroGearLogger extends BasicLogger {
void reply404();
@LogMessage(level = Logger.Level.WARN)
@Message(id = 232005, value = "removing aerogear connector as unexpected respone {0} returned", format = Message.Format.MESSAGE_FORMAT)
@Message(id = 232005, value = "removing aerogear connector as unexpected response {0} returned", format = Message.Format.MESSAGE_FORMAT)
void replyUnknown(int status);
@LogMessage(level = Logger.Level.WARN)

View File

@ -198,7 +198,7 @@
<dependencyManagement>
<dependencies>
<!-- ## Test Dependenices ## Note: Junit is required in certain module tests. We should control versions from here. -->
<!-- ## Test Dependencies ## Note: Junit is required in certain module tests. We should control versions from here. -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -108,7 +108,6 @@ public class TcpTransportFactory extends TransportFactory {
}
@Override
@SuppressWarnings("rawtypes")
public Transport compositeConfigure(Transport transport, WireFormat format, Map options) {
TcpTransport tcpTransport = transport.narrow(TcpTransport.class);

View File

@ -128,7 +128,7 @@ public abstract class EmbeddedBrokerTestSupport extends CombinationTestSupport {
/**
* Factory method to create a new {@link Destination}
*
* @return newly created Destinaiton
* @return newly created Destination
*/
protected ActiveMQDestination createDestination() {
return createDestination(getDestinationString());

View File

@ -69,7 +69,7 @@ public class OptimizedAckTest extends TestSupport {
Binding binding = broker.getServer().getPostOffice().getBinding(new SimpleString("jms.queue.test"));
final QueueImpl coreQueue = (QueueImpl) binding.getBindable();
assertTrue("deliverying count is 10", Wait.waitFor(new Wait.Condition() {
assertTrue("delivering count is 10", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return 10 == coreQueue.getDeliveringCount();

View File

@ -85,7 +85,7 @@ public class SecurityJMXTest extends TestCase {
Connection c = new ActiveMQConnectionFactory("vm://localhost").createConnection("system", "manager");
c.start();
// browser consumer will force expriation check on addConsumer
// browser consumer will force expiration check on addConsumer
QueueBrowser browser = c.createSession(false, Session.AUTO_ACKNOWLEDGE).createBrowser(new ActiveMQQueue("TEST.Q"));
assertTrue("no message in the q", !browser.getEnumeration().hasMoreElements());

View File

@ -875,7 +875,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
try {
consumerSession.commit();
Assert.fail("expected transaciton rolledback ex");
Assert.fail("expected transaction rolledback ex");
}
catch (TransactionRolledBackException expected) {
}

View File

@ -312,7 +312,7 @@ public class NonBlockingConsumerRedeliveryTest {
count = 0;
}
catch (JMSException e) {
LOG.warn("Caught an unexcepted exception: " + e.getMessage());
LOG.warn("Caught an unexpected exception: " + e.getMessage());
}
}
else {
@ -321,7 +321,7 @@ public class NonBlockingConsumerRedeliveryTest {
session.commit();
}
catch (JMSException e) {
LOG.warn("Caught an unexcepted exception: " + e.getMessage());
LOG.warn("Caught an unexpected exception: " + e.getMessage());
}
}
}
@ -388,7 +388,7 @@ public class NonBlockingConsumerRedeliveryTest {
session.rollback();
}
catch (JMSException e) {
LOG.warn("Caught an unexcepted exception: " + e.getMessage());
LOG.warn("Caught an unexpected exception: " + e.getMessage());
}
}
});

View File

@ -36,7 +36,7 @@ public class StartAndStopBrokerTest extends TestCase {
// have persistence messages as a default
System.setProperty("activemq.persistenceAdapter", "org.apache.activemq.store.vm.VMPersistenceAdapter");
// configuration of container and all protocolls
// configuration of container and all protocols
BrokerService broker = createBroker();
// start a client

View File

@ -95,7 +95,7 @@ public class AmqpSender extends AmqpAbstractResource<Sender> {
* Create a new sender instance using the given Target when creating the link.
*
* @param session The parent session that created the session.
* @param address The address that this sender produces to.
* @param target The target that this sender produces to.
* @param senderId The unique ID assigned to this sender.
*/
public AmqpSender(AmqpSession session, Target target, String senderId) {

View File

@ -47,7 +47,6 @@ public class AmqpTransactionContext {
/**
* Begins a new transaction scoped to the target session.
*
* @param txId The transaction Id to use for this new transaction.
* @throws Exception if an error occurs while starting the transaction.
*/
public void begin() throws Exception {

View File

@ -61,8 +61,8 @@ public class CramMD5Mechanism extends AbstractMechanism {
StringBuffer hash = new StringBuffer(getUsername());
hash.append(' ');
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(0xFF & bytes[i]);
for (byte b : bytes) {
String hex = Integer.toHexString(0xFF & b);
if (hex.length() == 1) {
hash.append('0');
}

View File

@ -78,7 +78,7 @@ public interface Mechanism extends Comparable<Mechanism> {
*
* @param username The user name given.
*/
void setUsername(String value);
void setUsername(String username);
/**
* Returns the configured user name value for this Mechanism.
@ -91,9 +91,9 @@ public interface Mechanism extends Comparable<Mechanism> {
* Sets the password value for this Mechanism. The Mechanism can ignore this
* value if it does not utilize a password in it's authentication processing.
*
* @param username The user name given.
* @param password The password given.
*/
void setPassword(String value);
void setPassword(String password);
/**
* Returns the configured password value for this Mechanism.

View File

@ -172,15 +172,15 @@ public class PropertyUtil {
if (queryString != null && !queryString.isEmpty()) {
Map<String, String> rc = new HashMap<>();
String[] parameters = queryString.split("&");
for (int i = 0; i < parameters.length; i++) {
int p = parameters[i].indexOf("=");
for (String parameter : parameters) {
int p = parameter.indexOf("=");
if (p >= 0) {
String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
String name = URLDecoder.decode(parameter.substring(0, p), "UTF-8");
String value = URLDecoder.decode(parameter.substring(p + 1), "UTF-8");
rc.put(name, value);
}
else {
rc.put(parameters[i], null);
rc.put(parameter, null);
}
}
return rc;
@ -352,8 +352,7 @@ public class PropertyUtil {
Object[] NULL_ARG = {};
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
if (propertyDescriptors != null) {
for (int i = 0; i < propertyDescriptors.length; i++) {
PropertyDescriptor pd = propertyDescriptors[i];
for (PropertyDescriptor pd : propertyDescriptors) {
if (pd.getReadMethod() != null && !pd.getName().equals("class") && !pd.getName().equals("properties") && !pd.getName().equals("reference")) {
Object value = pd.getReadMethod().invoke(object, NULL_ARG);
if (value != null) {
@ -365,7 +364,7 @@ public class PropertyUtil {
}
else {
Map<String, String> inner = getProperties(value);
for (Map.Entry<String, String> entry : inner.entrySet()) {
for (Entry<String, String> entry : inner.entrySet()) {
properties.put(pd.getName() + "." + entry.getKey(), entry.getValue());
}
}
@ -389,8 +388,7 @@ public class PropertyUtil {
BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
if (propertyDescriptors != null) {
for (int i = 0; i < propertyDescriptors.length; i++) {
PropertyDescriptor pd = propertyDescriptors[i];
for (PropertyDescriptor pd : propertyDescriptors) {
if (pd.getReadMethod() != null && pd.getName().equals(name)) {
return pd.getReadMethod().invoke(object);
}
@ -497,8 +495,7 @@ public class PropertyUtil {
// Build the method name.
name = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
Method[] methods = clazz.getMethods();
for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
for (Method method : methods) {
Class<?>[] params = method.getParameterTypes();
if (method.getName().equals(name) && params.length == 1) {
return method;

View File

@ -53,7 +53,7 @@ public interface Server extends Remote {
void kill() throws Exception;
/**
* When kill is called you are actually schedulling the server to be killed in few milliseconds.
* When kill is called you are actually scheduling the server to be killed in few milliseconds.
* There are certain cases where we need to assure the server was really killed.
* For that we have this simple ping we can use to verify if the server still alive or not.
*/

View File

@ -26,7 +26,7 @@ import org.objectweb.jtests.jms.framework.PubSubTestCase;
/**
* Test topic-specific connection features.
*
* Test setting of client ID which is relevant only for Durable Subscribtion
* Test setting of client ID which is relevant only for Durable Subscription
*/
public class TopicConnectionTest extends PubSubTestCase {