This commit is contained in:
Michael Andre Pearce 2019-01-18 08:53:15 +00:00
commit 5c47e71d4f
4 changed files with 6 additions and 5 deletions

View File

@ -342,7 +342,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl
byte high = (byte) (delim >> 8 & 0xFF); // high byte
int lasPos = 0;
for (int i = 0; i < data.length; i += 2) {
for (int i = 0; i + 1 < data.length; i += 2) {
if (data[i] == low && data[i + 1] == high) {
byte[] bytes = new byte[i - lasPos];
System.arraycopy(data, lasPos, bytes, 0, bytes.length);
@ -439,7 +439,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl
final byte low = (byte) (c & 0xFF); // low byte
final byte high = (byte) (c >> 8 & 0xFF); // high byte
for (int i = 0; i < data.length; i += 2) {
for (int i = 0; i + 1 < data.length; i += 2) {
if (data[i] == low && data[i + 1] == high) {
return true;
}

View File

@ -58,7 +58,7 @@ public class ActiveMQJMSContext implements JMSContext {
private volatile Message lastMessagesWaitingAck;
private final ActiveMQConnectionForContext connection;
private Session session;
private volatile Session session;
private boolean autoStart = ActiveMQJMSContext.DEFAULT_AUTO_START;
private MessageProducer innerProducer;
private boolean xa;
@ -91,6 +91,7 @@ public class ActiveMQJMSContext implements JMSContext {
}
public Session getSession() {
checkSession();
return session;
}

View File

@ -345,7 +345,7 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
Charset charset = StandardCharsets.UTF_8;
String content = new String(Files.readAllBytes(original), charset);
for (int i = 0; i < replacePairs.length; i += 2) {
for (int i = 0; i + 1 < replacePairs.length; i += 2) {
content = content.replaceAll(replacePairs[i], replacePairs[i + 1]);
}
Files.write(target, content.getBytes(charset));

View File

@ -37,7 +37,7 @@ public enum QueueStatus {
}
public static QueueStatus fromID(short id) {
if (id < 0 || id > values.length) {
if (id < 0 || id >= values.length) {
return null;
} else {
return values[id];