Skip to content
Browse files

Fix some findbugs warnings.

  • Loading branch information...
1 parent c2d9d1f commit 45590b7d1414c86113a665d5a5d0988887616711 Francisco Borges committed Nov 16, 2012
View
37 ...in/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java
@@ -13,6 +13,8 @@
package org.hornetq.core.protocol.core.impl.wireformat;
+import java.util.Arrays;
+
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.JournalLoadInformation;
import org.hornetq.core.protocol.core.impl.PacketImpl;
@@ -25,16 +27,9 @@
*/
public class ReplicationCompareDataMessage extends PacketImpl
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
private JournalLoadInformation[] journalInformation;
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
public ReplicationCompareDataMessage(final JournalLoadInformation[] journalInformation)
{
super(PacketImpl.REPLICATION_COMPARE_DATA);
@@ -83,11 +78,27 @@ public void decodeRest(final HornetQBuffer buffer)
return journalInformation;
}
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + Arrays.hashCode(journalInformation);
+ return result;
+ }
- // Inner classes -------------------------------------------------
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ReplicationCompareDataMessage other = (ReplicationCompareDataMessage)obj;
+ if (!Arrays.equals(journalInformation, other.journalInformation))
+ return false;
+ return true;
+ }
}
View
62 .../main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java
@@ -13,6 +13,8 @@
package org.hornetq.core.protocol.core.impl.wireformat;
+import java.util.Arrays;
+
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.EncodingSupport;
import org.hornetq.core.protocol.core.impl.PacketImpl;
@@ -27,10 +29,6 @@
public class ReplicationDeleteTXMessage extends PacketImpl
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
private long txId;
private long id;
@@ -42,10 +40,6 @@
private byte[] recordData;
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
public ReplicationDeleteTXMessage()
{
super(PacketImpl.REPLICATION_DELETE_TX);
@@ -63,8 +57,6 @@ public ReplicationDeleteTXMessage(final byte journalID,
this.encodingData = encodingData;
}
- // Public --------------------------------------------------------
-
@Override
public void encodeRest(final HornetQBuffer buffer)
{
@@ -81,8 +73,8 @@ public void decodeRest(final HornetQBuffer buffer)
journalID = buffer.readByte();
txId = buffer.readLong();
id = buffer.readLong();
- int size = buffer.readInt();
- recordData = new byte[size];
+ int size1 = buffer.readInt();
+ recordData = new byte[size1];
buffer.readBytes(recordData);
}
@@ -115,12 +107,44 @@ public byte getJournalID()
return recordData;
}
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((encodingData == null) ? 0 : encodingData.hashCode());
+ result = prime * result + (int)(id ^ (id >>> 32));
+ result = prime * result + journalID;
+ result = prime * result + Arrays.hashCode(recordData);
+ result = prime * result + (int)(txId ^ (txId >>> 32));
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ReplicationDeleteTXMessage other = (ReplicationDeleteTXMessage)obj;
+ if (encodingData == null)
+ {
+ if (other.encodingData != null)
+ return false;
+ }
+ else if (!encodingData.equals(other.encodingData))
+ return false;
+ if (id != other.id)
+ return false;
+ if (journalID != other.journalID)
+ return false;
+ if (!Arrays.equals(recordData, other.recordData))
+ return false;
+ if (txId != other.txId)
+ return false;
+ return true;
+ }
}
View
39 ...a/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeginMessage.java
@@ -26,16 +26,8 @@
public class ReplicationLargeMessageBeginMessage extends PacketImpl
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
long messageId;
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
public ReplicationLargeMessageBeginMessage(final long messageId)
{
this();
@@ -47,8 +39,6 @@ public ReplicationLargeMessageBeginMessage()
super(PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN);
}
- // Public --------------------------------------------------------
-
@Override
public void encodeRest(final HornetQBuffer buffer)
{
@@ -69,12 +59,27 @@ public long getMessageId()
return messageId;
}
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + (int)(messageId ^ (messageId >>> 32));
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ReplicationLargeMessageBeginMessage other = (ReplicationLargeMessageBeginMessage)obj;
+ if (messageId != other.messageId)
+ return false;
+ return true;
+ }
}
View
38 ...ava/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageEndMessage.java
@@ -25,16 +25,9 @@
*/
public class ReplicationLargeMessageEndMessage extends PacketImpl
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
long messageId;
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
public ReplicationLargeMessageEndMessage()
{
super(PacketImpl.REPLICATION_LARGE_MESSAGE_END);
@@ -46,8 +39,6 @@ public ReplicationLargeMessageEndMessage(final long messageId)
this.messageId = messageId;
}
- // Public --------------------------------------------------------
-
@Override
public void encodeRest(final HornetQBuffer buffer)
{
@@ -68,12 +59,27 @@ public long getMessageId()
return messageId;
}
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + (int)(messageId ^ (messageId >>> 32));
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ReplicationLargeMessageEndMessage other = (ReplicationLargeMessageEndMessage)obj;
+ if (messageId != other.messageId)
+ return false;
+ return true;
+ }
}
View
32 ...main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java
@@ -78,4 +78,36 @@ public PagedMessage getPagedMessage()
return pagedMessage;
}
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + pageNumber;
+ result = prime * result + ((pagedMessage == null) ? 0 : pagedMessage.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ReplicationPageWriteMessage other = (ReplicationPageWriteMessage)obj;
+ if (pageNumber != other.pageNumber)
+ return false;
+ if (pagedMessage == null)
+ {
+ if (other.pagedMessage != null)
+ return false;
+ }
+ else if (!pagedMessage.equals(other.pagedMessage))
+ return false;
+ return true;
+ }
+
}
View
7 ...etq-server/src/main/java/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
@@ -13,6 +13,7 @@
package org.hornetq.core.settings.impl;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -265,10 +266,12 @@ private void onChange()
}
/**
- * compares to matches to see which one is more specific
+ * Compares to matches to see which one is more specific.
*/
- private static class MatchComparator implements Comparator<String>
+ private static class MatchComparator implements Comparator<String>, Serializable
{
+ private static final long serialVersionUID = -6182535107518999740L;
+
public int compare(final String o1, final String o2)
{
if (o1.contains(Match.WILDCARD) && !o2.contains(Match.WILDCARD))

0 comments on commit 45590b7

Please sign in to comment.
Something went wrong with that request. Please try again.