JBoss hornetq SVN: r11991 - trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-06 08:03:50 -0500 (Fri, 06 Jan 2012)
New Revision: 11991
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java
Log:
Make executor transient, as class is serializable
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java 2012-01-06 13:03:36 UTC (rev 11990)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java 2012-01-06 13:03:50 UTC (rev 11991)
@@ -41,7 +41,7 @@
private static final Logger log = Logger.getLogger(Topology.class);
- private Executor executor = null;
+ private transient Executor executor = null;
/**
* Used to debug operations.
12 years, 8 months
JBoss hornetq SVN: r11990 - trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-06 08:03:36 -0500 (Fri, 06 Jan 2012)
New Revision: 11990
Modified:
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/TimedBuffer.java
Log:
Remove spurious null check
Modified: trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/TimedBuffer.java
===================================================================
--- trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/TimedBuffer.java 2012-01-06 13:03:20 UTC (rev 11989)
+++ trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/TimedBuffer.java 2012-01-06 13:03:36 UTC (rev 11990)
@@ -293,7 +293,7 @@
flush(false);
}
- /**
+ /**
* force means the Journal is moving to a new file. Any pending write need to be done immediately
* or data could be lost
* */
@@ -323,10 +323,7 @@
bufferToFlush.put(buffer.toByteBuffer().array(), 0, pos);
- if (bufferToFlush != null)
- {
- bufferObserver.flushBuffer(bufferToFlush, pendingSync, callbacks);
- }
+ bufferObserver.flushBuffer(bufferToFlush, pendingSync, callbacks);
if (spinning)
{
12 years, 8 months
JBoss hornetq SVN: r11989 - trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-06 08:03:20 -0500 (Fri, 06 Jan 2012)
New Revision: 11989
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java
Log:
Spelling in javadoc
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java 2012-01-06 13:03:06 UTC (rev 11988)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java 2012-01-06 13:03:20 UTC (rev 11989)
@@ -43,13 +43,13 @@
private Executor executor = null;
- /** Used to debug operations.
- *
- * Someone may argue this is not needed. But it's impossible to debg anything related to topology without knowing what node
- * or what object missed a Topology update.
- *
- * Hence I added some information to locate debugging here.
- * */
+ /**
+ * Used to debug operations.
+ * <p>
+ * Someone may argue this is not needed. But it's impossible to debug anything related to
+ * topology without knowing what node or what object missed a Topology update. Hence I added some
+ * information to locate debugging here.
+ */
private volatile Object owner;
/**
12 years, 8 months
JBoss hornetq SVN: r11988 - trunk/etc.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-06 08:03:06 -0500 (Fri, 06 Jan 2012)
New Revision: 11988
Modified:
trunk/etc/findbugs-exclude.xml
Log:
Exclude findbugs warning on GC, as (specific) usage is valid.
Modified: trunk/etc/findbugs-exclude.xml
===================================================================
--- trunk/etc/findbugs-exclude.xml 2012-01-06 12:43:36 UTC (rev 11987)
+++ trunk/etc/findbugs-exclude.xml 2012-01-06 13:03:06 UTC (rev 11988)
@@ -31,5 +31,11 @@
<Method name="getDoubleProperty"/>
</Or>
<Bug pattern="NP_NULL_PARAM_DEREF_NONVIRTUAL"/>
-</Match>
+ </Match>
+
+ <Match>
+ <!-- Code is meant to measure memory usage, so calling Garbage Collection is normal. -->
+ <Class name="org.hornetq.utils.MemorySize"/>
+ <bug pattern="DM_GC"/>
+ </Match>
</FindBugsFilter>
12 years, 8 months
JBoss hornetq SVN: r11987 - tags/HornetQ_2_2_10_EAP_BUILD2/src/config/common.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2012-01-06 07:43:36 -0500 (Fri, 06 Jan 2012)
New Revision: 11987
Modified:
tags/HornetQ_2_2_10_EAP_BUILD2/src/config/common/hornetq-version.properties
Log:
version change
Modified: tags/HornetQ_2_2_10_EAP_BUILD2/src/config/common/hornetq-version.properties
===================================================================
--- tags/HornetQ_2_2_10_EAP_BUILD2/src/config/common/hornetq-version.properties 2012-01-06 12:41:02 UTC (rev 11986)
+++ tags/HornetQ_2_2_10_EAP_BUILD2/src/config/common/hornetq-version.properties 2012-01-06 12:43:36 UTC (rev 11987)
@@ -1,4 +1,4 @@
-hornetq.version.versionName=HQ_2_2_10_EAP_GA
+hornetq.version.versionName=HQ_2_2_10_EAP_GA_BUILD2
hornetq.version.majorVersion=2
hornetq.version.minorVersion=2
hornetq.version.microVersion=10
12 years, 8 months
JBoss hornetq SVN: r11986 - tags.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2012-01-06 07:41:02 -0500 (Fri, 06 Jan 2012)
New Revision: 11986
Added:
tags/HornetQ_2_2_10_EAP_BUILD2/
Log:
Retagging build
12 years, 8 months
JBoss hornetq SVN: r11985 - trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v11.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-06 07:15:07 -0500 (Fri, 06 Jan 2012)
New Revision: 11985
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v11/StompFrameHandlerV11.java
Log:
Fix waitTime comparison (which used waitTime1 twice instead of using waitTime2).
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v11/StompFrameHandlerV11.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v11/StompFrameHandlerV11.java 2012-01-06 12:10:51 UTC (rev 11984)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v11/StompFrameHandlerV11.java 2012-01-06 12:15:07 UTC (rev 11985)
@@ -28,15 +28,15 @@
import org.hornetq.core.protocol.stomp.VersionedStompFrameHandler;
/**
- *
+ *
* @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
*/
public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements FrameEventListener
{
private static final Logger log = Logger.getLogger(StompFrameHandlerV11.class);
-
+
private static final char ESC_CHAR = '\\';
-
+
private HeartBeater heartBeater;
public StompFrameHandlerV11(StompConnection connection)
@@ -130,12 +130,12 @@
{
throw new HornetQStompException("Incorrect heartbeat header " + heartBeatHeader);
}
-
+
//client ping
long minPingInterval = Long.valueOf(params[0]);
//client receive ping
long minAcceptInterval = Long.valueOf(params[1]);
-
+
if ((minPingInterval != 0) || (minAcceptInterval != 0))
{
heartBeater = new HeartBeater(minPingInterval, minAcceptInterval);
@@ -177,7 +177,7 @@
response = new HornetQStompException("Must specify the subscription's id").getFrame();
return response;
}
-
+
try
{
connection.unsubscribe(subscriptionID);
@@ -193,7 +193,7 @@
public StompFrame onAck(StompFrame request)
{
StompFrame response = null;
-
+
String messageID = request.getHeader(Stomp.Headers.Ack.MESSAGE_ID);
String txID = request.getHeader(Stomp.Headers.TRANSACTION);
String subscriptionID = request.getHeader(Stomp.Headers.Ack.SUBSCRIPTION);
@@ -202,13 +202,13 @@
{
log.warn("Transactional acknowledgement is not supported");
}
-
+
if (subscriptionID == null)
{
response = new HornetQStompException("subscription header is required").getFrame();
return response;
}
-
+
try
{
connection.acknowledge(messageID, subscriptionID);
@@ -247,7 +247,7 @@
//kick off the pinger
startHeartBeat();
}
-
+
if (reply.needsDisconnect())
{
connection.disconnect();
@@ -261,7 +261,7 @@
}
}
}
-
+
private void startHeartBeat()
{
if (heartBeater != null)
@@ -269,25 +269,25 @@
heartBeater.start();
}
}
-
+
public StompFrame createPingFrame() throws UnsupportedEncodingException
{
StompFrame frame = new StompFrame(Stomp.Commands.STOMP);
frame.setPing(true);
return frame;
}
-
- //server heart beat
- //algorithm:
- //(a) server ping: if server hasn't sent any frame within serverPing
- //interval, send a ping.
+
+ //server heart beat
+ //algorithm:
+ //(a) server ping: if server hasn't sent any frame within serverPing
+ //interval, send a ping.
//(b) accept ping: if server hasn't received any frame within
// 2*serverAcceptPing, disconnect!
private class HeartBeater extends Thread
{
final int MIN_SERVER_PING = 500;
final int MIN_CLIENT_PING = 500;
-
+
long serverPing = 0;
long serverAcceptPing = 0;
volatile boolean shutdown = false;
@@ -301,13 +301,13 @@
{
serverAcceptPing = clientPing > MIN_CLIENT_PING ? clientPing : MIN_CLIENT_PING;
}
-
+
if (clientAcceptPing != 0)
{
serverPing = clientAcceptPing > MIN_SERVER_PING ? clientAcceptPing : MIN_SERVER_PING;
}
}
-
+
public synchronized void shutdown()
{
shutdown = true;
@@ -336,14 +336,14 @@
{
log.error("Cannot create ping frame due to encoding problem.", e1);
}
-
+
synchronized (this)
{
while (!shutdown)
{
long dur1 = 0;
long dur2 = 0;
-
+
if (serverPing != 0)
{
dur1 = System.currentTimeMillis() - lastPingTime.get();
@@ -358,7 +358,7 @@
if (serverAcceptPing != 0)
{
dur2 = System.currentTimeMillis() - lastAccepted.get();
-
+
if (dur2 > (2 * serverAcceptPing))
{
connection.disconnect();
@@ -366,25 +366,25 @@
break;
}
}
-
+
long waitTime1 = 0;
long waitTime2 = 0;
-
+
if (serverPing > 0)
{
waitTime1 = serverPing - dur1;
}
-
+
if (serverAcceptPing > 0)
{
waitTime2 = serverAcceptPing * 2 - dur2;
}
-
+
long waitTime = 10l;
-
- if ((waitTime1 > 0) && (waitTime1 > 0))
+
+ if ((waitTime1 > 0) && (waitTime2 > 0))
{
- waitTime = waitTime1 < waitTime2 ? waitTime1 : waitTime2;
+ waitTime = Math.min(waitTime1, waitTime2);
}
else if (waitTime1 > 0)
{
@@ -394,7 +394,7 @@
{
waitTime = waitTime2;
}
-
+
try
{
this.wait(waitTime);
@@ -426,7 +426,7 @@
{
return new StompFrameV11(command);
}
-
+
//all frame except CONNECT are decoded here.
@Override
public StompFrame decode(StompDecoder decoder, final HornetQBuffer buffer) throws HornetQStompException
@@ -441,11 +441,11 @@
buffer.readBytes(decoder.workingBuffer, decoder.data, readable);
decoder.data += readable;
-
+
if (decoder.command == null)
{
int offset = 0;
-
+
//check for ping
while (decoder.workingBuffer[offset] == StompDecoder.NEW_LINE)
{
@@ -466,7 +466,7 @@
return null;
}
}
-
+
if (decoder.data < 4)
{
// Need at least four bytes to identify the command
@@ -527,7 +527,7 @@
decoder.command = StompDecoder.COMMAND_COMMIT;
}
/**** added by meddy, 27 april 2011, handle header parser for reply to websocket protocol ****/
- else if (decoder.workingBuffer[offset+7] == StompDecoder.E)
+ else if (decoder.workingBuffer[offset+7] == StompDecoder.E)
{
if (!decoder.tryIncrement(offset + StompDecoder.COMMAND_CONNECTED_LENGTH + 1))
{
@@ -535,7 +535,7 @@
}
// CONNECTED
- decoder.command = StompDecoder.COMMAND_CONNECTED;
+ decoder.command = StompDecoder.COMMAND_CONNECTED;
}
/**** end ****/
else
@@ -680,8 +680,8 @@
// Now the headers
boolean isEscaping = false;
- SimpleBytes holder = new SimpleBytes(1024);
-
+ SimpleBytes holder = new SimpleBytes(1024);
+
outer: while (true)
{
byte b = decoder.workingBuffer[decoder.pos++];
@@ -724,7 +724,7 @@
{
throw new HornetQStompException("Encoding exception", e);
}
-
+
holder.reset();
decoder.inHeaderName = false;
@@ -772,14 +772,14 @@
throw new HornetQStompException("Encoding exception.", e);
}
holder.reset();
-
+
decoder.headers.put(decoder.headerName, headerValue);
if (decoder.headerName.equals(StompDecoder.CONTENT_LENGTH_HEADER_NAME))
{
decoder.contentLength = Integer.parseInt(headerValue);
}
-
+
if (decoder.headerName.equals(StompDecoder.CONTENT_TYPE_HEADER_NAME))
{
decoder.contentType = headerValue;
@@ -800,7 +800,7 @@
decoder.whiteSpaceOnly = false;
decoder.headerValueWhitespace = false;
-
+
holder.append(b);
}
}
@@ -814,7 +814,7 @@
}
// Now the body
-
+
byte[] content = null;
if (decoder.contentLength != -1)
@@ -830,7 +830,7 @@
System.arraycopy(decoder.workingBuffer, decoder.pos, content, 0, decoder.contentLength);
decoder.pos += decoder.contentLength;
-
+
//drain all the rest
if (decoder.bodyStart == -1)
{
@@ -867,7 +867,7 @@
}
}
}
-
+
if (content != null)
{
if (decoder.data > decoder.pos)
@@ -894,5 +894,5 @@
return null;
}
}
-
+
}
12 years, 8 months
JBoss hornetq SVN: r11984 - trunk/hornetq-core/src/main/java/org/hornetq/utils/json.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-06 07:10:51 -0500 (Fri, 06 Jan 2012)
New Revision: 11984
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/utils/json/JSONObject.java
Log:
Don't rely on JSONObject.NULL's violation of Object.equals(null) contract for the String representation.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/utils/json/JSONObject.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/utils/json/JSONObject.java 2012-01-06 12:10:36 UTC (rev 11983)
+++ trunk/hornetq-core/src/main/java/org/hornetq/utils/json/JSONObject.java 2012-01-06 12:10:51 UTC (rev 11984)
@@ -36,52 +36,49 @@
import java.util.TreeSet;
/**
- * A JSONObject is an unordered collection of name/value pairs. Its
- * external form is a string wrapped in curly braces with colons between the
- * names and values, and commas between the values and names. The internal form
- * is an object having <code>get</code> and <code>opt</code> methods for
- * accessing the values by name, and <code>put</code> methods for adding or
- * replacing values by name. The values can be any of these types:
- * <code>Boolean</code>, <code>JSONArray</code>, <code>JSONObject</code>,
- * <code>Number</code>, <code>String</code>, or the <code>JSONObject.NULL</code>
- * object. A JSONObject constructor can be used to convert an external form
- * JSON text into an internal form whose values can be retrieved with the
- * <code>get</code> and <code>opt</code> methods, or to convert values into a
- * JSON text using the <code>put</code> and <code>toString</code> methods.
- * A <code>get</code> method returns a value if one can be found, and throws an
- * exception if one cannot be found. An <code>opt</code> method returns a
- * default value instead of throwing an exception, and so is useful for
- * obtaining optional values.
+ * A JSONObject is an unordered collection of name/value pairs.
* <p>
- * The generic <code>get()</code> and <code>opt()</code> methods return an
- * object, which you can cast or query for type. There are also typed
- * <code>get</code> and <code>opt</code> methods that do type checking and type
- * coercion for you.
+ * Its external form is a string wrapped in curly braces with colons between the names and values,
+ * and commas between the values and names. The internal form is an object having <code>get</code>
+ * and <code>opt</code> methods for accessing the values by name, and <code>put</code> methods for
+ * adding or replacing values by name.
* <p>
- * The <code>put</code> methods adds values to an object. For example, <pre>
- * myString = new JSONObject().put("JSON", "Hello, World!").toString();</pre>
+ * The values can be any of these types: <code>Boolean</code>, <code>JSONArray</code>,
+ * <code>JSONObject</code>, <code>Number</code>, <code>String</code>, or the
+ * <code>JSONObject.NULL</code> object. A JSONObject constructor can be used to convert an external
+ * form JSON text into an internal form whose values can be retrieved with the <code>get</code> and
+ * <code>opt</code> methods, or to convert values into a JSON text using the <code>put</code> and
+ * <code>toString</code> methods. A <code>get</code> method returns a value if one can be found, and
+ * throws an exception if one cannot be found. An <code>opt</code> method returns a default value
+ * instead of throwing an exception, and so is useful for obtaining optional values.
+ * <p>
+ * The generic <code>get()</code> and <code>opt()</code> methods return an object, which you can
+ * cast or query for type. There are also typed <code>get</code> and <code>opt</code> methods that
+ * do type checking and type coercion for you.
+ * <p>
+ * The <code>put</code> methods adds values to an object. For example,
+ *
+ * <pre>
+ * myString = new JSONObject().put("JSON", "Hello, World!").toString();
+ * </pre>
+ *
* produces the string <code>{"JSON": "Hello, World"}</code>.
* <p>
- * The texts produced by the <code>toString</code> methods strictly conform to
- * the JSON syntax rules.
- * The constructors are more forgiving in the texts they will accept:
+ * The texts produced by the <code>toString</code> methods strictly conform to the JSON syntax
+ * rules. The constructors are more forgiving in the texts they will accept:
* <ul>
- * <li>An extra <code>,</code> <small>(comma)</small> may appear just
- * before the closing brace.</li>
- * <li>Strings may be quoted with <code>'</code> <small>(single
- * quote)</small>.</li>
- * <li>Strings do not need to be quoted at all if they do not begin with a quote
- * or single quote, and if they do not contain leading or trailing spaces,
- * and if they do not contain any of these characters:
- * <code>{ } [ ] / \ : , = ; #</code> and if they do not look like numbers
- * and if they are not the reserved words <code>true</code>,
- * <code>false</code>, or <code>null</code>.</li>
- * <li>Keys can be followed by <code>=</code> or <code>=></code> as well as
- * by <code>:</code>.</li>
- * <li>Values can be followed by <code>;</code> <small>(semicolon)</small> as
- * well as by <code>,</code> <small>(comma)</small>.</li>
- * <li>Numbers may have the <code>0-</code> <small>(octal)</small> or
- * <code>0x-</code> <small>(hex)</small> prefix.</li>
+ * <li>An extra <code>,</code> <small>(comma)</small> may appear just before the closing brace.
+ * </li>
+ * <li>Strings may be quoted with <code>'</code> <small>(single quote)</small>.</li>
+ * <li>Strings do not need to be quoted at all if they do not begin with a quote or single quote,
+ * and if they do not contain leading or trailing spaces, and if they do not contain any of these
+ * characters: <code>{ } [ ] / \ : , = ; #</code> and if they do not look like numbers and if they
+ * are not the reserved words <code>true</code>, <code>false</code>, or <code>null</code>.</li>
+ * <li>Keys can be followed by <code>=</code> or <code>=></code> as well as by <code>:</code>.</li>
+ * <li>Values can be followed by <code>;</code> <small>(semicolon)</small> as well as by
+ * <code>,</code> <small>(comma)</small>.</li>
+ * <li>Numbers may have the <code>0-</code> <small>(octal)</small> or <code>0x-</code>
+ * <small>(hex)</small> prefix.</li>
* </ul>
* @author JSON.org
* @version 2009-03-06
@@ -1568,7 +1565,7 @@
*/
static String valueToString(final Object value) throws JSONException
{
- if (value == null || value.equals(null))
+ if (value == null || JSONObject.NULL == value)
{
return "null";
}
@@ -1628,7 +1625,7 @@
*/
static String valueToString(final Object value, final int indentFactor, final int indent) throws JSONException
{
- if (value == null || value.equals(null))
+ if (value == null || JSONObject.NULL == value)
{
return "null";
}
12 years, 8 months
JBoss hornetq SVN: r11983 - in trunk: hornetq-core/src/test/java/org/hornetq/core/config/impl and 1 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-06 07:10:36 -0500 (Fri, 06 Jan 2012)
New Revision: 11983
Added:
trunk/hornetq-core/src/test/java/org/hornetq/core/config/impl/ValidatorsTest.java
Removed:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/config/impl/ValidatorsTest.java
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/config/impl/Validators.java
Log:
Fix logic by grouping checks correctly, thus avoiding an NPE.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/config/impl/Validators.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/config/impl/Validators.java 2012-01-06 11:35:50 UTC (rev 11982)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/config/impl/Validators.java 2012-01-06 12:10:36 UTC (rev 11983)
@@ -69,7 +69,7 @@
public void validate(final String name, final Object value)
{
Number val = (Number)value;
- if (val != null && val.intValue() < 0 || val.intValue() > 100)
+ if (val == null || (val.intValue() < 0 || val.intValue() > 100))
{
throw new IllegalArgumentException(String.format("%s must be a valid percentual value between 0 and 100 (actual value: %s)",
name,
Copied: trunk/hornetq-core/src/test/java/org/hornetq/core/config/impl/ValidatorsTest.java (from rev 11982, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/config/impl/ValidatorsTest.java)
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/core/config/impl/ValidatorsTest.java (rev 0)
+++ trunk/hornetq-core/src/test/java/org/hornetq/core/config/impl/ValidatorsTest.java 2012-01-06 12:10:36 UTC (rev 11983)
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.config.impl;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.hornetq.core.server.JournalType;
+import org.hornetq.tests.util.RandomUtil;
+
+/**
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ */
+public class ValidatorsTest extends TestCase
+{
+
+ private static void success(final Validators.Validator validator, final Object value)
+ {
+ validator.validate(RandomUtil.randomString(), value);
+ }
+
+ private static void failure(final Validators.Validator validator, final Object value)
+ {
+ try
+ {
+ validator.validate(RandomUtil.randomString(), value);
+ Assert.fail(validator + " must not validate " + value);
+ }
+ catch (IllegalArgumentException e)
+ {
+
+ }
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testGE_ZERO() throws Exception
+ {
+ ValidatorsTest.failure(Validators.GE_ZERO, -1);
+ ValidatorsTest.success(Validators.GE_ZERO, 0);
+ ValidatorsTest.success(Validators.GE_ZERO, 0.1);
+ ValidatorsTest.success(Validators.GE_ZERO, 1);
+ }
+
+ public void testGT_ZERO() throws Exception
+ {
+ ValidatorsTest.failure(Validators.GT_ZERO, -1);
+ ValidatorsTest.failure(Validators.GT_ZERO, 0);
+ ValidatorsTest.success(Validators.GT_ZERO, 0.1);
+ ValidatorsTest.success(Validators.GT_ZERO, 1);
+ }
+
+ public void testMINUS_ONE_OR_GE_ZERO() throws Exception
+ {
+ ValidatorsTest.failure(Validators.MINUS_ONE_OR_GE_ZERO, -2);
+ ValidatorsTest.success(Validators.MINUS_ONE_OR_GE_ZERO, -1);
+ ValidatorsTest.success(Validators.MINUS_ONE_OR_GE_ZERO, 0);
+ ValidatorsTest.success(Validators.MINUS_ONE_OR_GE_ZERO, 0.1);
+ ValidatorsTest.success(Validators.MINUS_ONE_OR_GE_ZERO, 1);
+ }
+
+ public void testMINUS_ONE_OR_GT_ZERO() throws Exception
+ {
+ ValidatorsTest.failure(Validators.MINUS_ONE_OR_GT_ZERO, -2);
+ ValidatorsTest.success(Validators.MINUS_ONE_OR_GT_ZERO, -1);
+ ValidatorsTest.failure(Validators.MINUS_ONE_OR_GT_ZERO, 0);
+ ValidatorsTest.success(Validators.MINUS_ONE_OR_GT_ZERO, 0.1);
+ ValidatorsTest.success(Validators.MINUS_ONE_OR_GT_ZERO, 1);
+ }
+
+ public void testNO_CHECK() throws Exception
+ {
+ ValidatorsTest.success(Validators.NO_CHECK, -1);
+ ValidatorsTest.success(Validators.NO_CHECK, null);
+ ValidatorsTest.success(Validators.NO_CHECK, "");
+ ValidatorsTest.success(Validators.NO_CHECK, true);
+ ValidatorsTest.success(Validators.NO_CHECK, false);
+ }
+
+ public void testNOT_NULL_OR_EMPTY() throws Exception
+ {
+ ValidatorsTest.failure(Validators.NOT_NULL_OR_EMPTY, null);
+ ValidatorsTest.failure(Validators.NOT_NULL_OR_EMPTY, "");
+ ValidatorsTest.success(Validators.NOT_NULL_OR_EMPTY, RandomUtil.randomString());
+ }
+
+ public void testJOURNAL_TYPE() throws Exception
+ {
+ for (JournalType type : JournalType.values())
+ {
+ ValidatorsTest.success(Validators.JOURNAL_TYPE, type.toString());
+ }
+ ValidatorsTest.failure(Validators.JOURNAL_TYPE, null);
+ ValidatorsTest.failure(Validators.JOURNAL_TYPE, "");
+ ValidatorsTest.failure(Validators.JOURNAL_TYPE, RandomUtil.randomString());
+ }
+
+ public void testPERCENTAGE()
+ {
+ ValidatorsTest.success(Validators.PERCENTAGE, 99);
+ ValidatorsTest.success(Validators.PERCENTAGE, 100);
+ ValidatorsTest.success(Validators.PERCENTAGE, 0);
+ ValidatorsTest.failure(Validators.PERCENTAGE, -1);
+ ValidatorsTest.failure(Validators.PERCENTAGE, 101);
+ ValidatorsTest.failure(Validators.PERCENTAGE, null);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/config/impl/ValidatorsTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/config/impl/ValidatorsTest.java 2012-01-06 11:35:50 UTC (rev 11982)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/config/impl/ValidatorsTest.java 2012-01-06 12:10:36 UTC (rev 11983)
@@ -1,130 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.tests.unit.core.config.impl;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.hornetq.core.config.impl.Validators;
-import org.hornetq.core.server.JournalType;
-import org.hornetq.tests.util.RandomUtil;
-
-/**
- * A ValidatorsTest
- *
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
- *
- */
-public class ValidatorsTest extends TestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- private static void success(final Validators.Validator validator, final Object value)
- {
- validator.validate(RandomUtil.randomString(), value);
- }
-
- private static void failure(final Validators.Validator validator, final Object value)
- {
- try
- {
- validator.validate(RandomUtil.randomString(), value);
- Assert.fail(validator + " must not validate " + value);
- }
- catch (IllegalArgumentException e)
- {
-
- }
- }
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testGE_ZERO() throws Exception
- {
- ValidatorsTest.failure(Validators.GE_ZERO, -1);
- ValidatorsTest.success(Validators.GE_ZERO, 0);
- ValidatorsTest.success(Validators.GE_ZERO, 0.1);
- ValidatorsTest.success(Validators.GE_ZERO, 1);
- }
-
- public void testGT_ZERO() throws Exception
- {
- ValidatorsTest.failure(Validators.GT_ZERO, -1);
- ValidatorsTest.failure(Validators.GT_ZERO, 0);
- ValidatorsTest.success(Validators.GT_ZERO, 0.1);
- ValidatorsTest.success(Validators.GT_ZERO, 1);
- }
-
- public void testMINUS_ONE_OR_GE_ZERO() throws Exception
- {
- ValidatorsTest.failure(Validators.MINUS_ONE_OR_GE_ZERO, -2);
- ValidatorsTest.success(Validators.MINUS_ONE_OR_GE_ZERO, -1);
- ValidatorsTest.success(Validators.MINUS_ONE_OR_GE_ZERO, 0);
- ValidatorsTest.success(Validators.MINUS_ONE_OR_GE_ZERO, 0.1);
- ValidatorsTest.success(Validators.MINUS_ONE_OR_GE_ZERO, 1);
- }
-
- public void testMINUS_ONE_OR_GT_ZERO() throws Exception
- {
- ValidatorsTest.failure(Validators.MINUS_ONE_OR_GT_ZERO, -2);
- ValidatorsTest.success(Validators.MINUS_ONE_OR_GT_ZERO, -1);
- ValidatorsTest.failure(Validators.MINUS_ONE_OR_GT_ZERO, 0);
- ValidatorsTest.success(Validators.MINUS_ONE_OR_GT_ZERO, 0.1);
- ValidatorsTest.success(Validators.MINUS_ONE_OR_GT_ZERO, 1);
- }
-
- public void testNO_CHECK() throws Exception
- {
- ValidatorsTest.success(Validators.NO_CHECK, -1);
- ValidatorsTest.success(Validators.NO_CHECK, null);
- ValidatorsTest.success(Validators.NO_CHECK, "");
- ValidatorsTest.success(Validators.NO_CHECK, true);
- ValidatorsTest.success(Validators.NO_CHECK, false);
- }
-
- public void testNOT_NULL_OR_EMPTY() throws Exception
- {
- ValidatorsTest.failure(Validators.NOT_NULL_OR_EMPTY, null);
- ValidatorsTest.failure(Validators.NOT_NULL_OR_EMPTY, "");
- ValidatorsTest.success(Validators.NOT_NULL_OR_EMPTY, RandomUtil.randomString());
- }
-
- public void testJOURNAL_TYPE() throws Exception
- {
- for (JournalType type : JournalType.values())
- {
- ValidatorsTest.success(Validators.JOURNAL_TYPE, type.toString());
- }
- ValidatorsTest.failure(Validators.JOURNAL_TYPE, null);
- ValidatorsTest.failure(Validators.JOURNAL_TYPE, "");
- ValidatorsTest.failure(Validators.JOURNAL_TYPE, RandomUtil.randomString());
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
12 years, 8 months
JBoss hornetq SVN: r11982 - in trunk: etc and 15 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2012-01-06 06:35:50 -0500 (Fri, 06 Jan 2012)
New Revision: 11982
Added:
trunk/etc/findbugs-exclude.xml
Modified:
trunk/etc/checkstyle.xml
trunk/hornetq-commons/src/main/java/org/hornetq/api/core/SimpleString.java
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/FilterImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/messagecounter/MessageCounter.java
trunk/hornetq-core/src/main/java/org/hornetq/core/messagecounter/impl/MessageCounterHelper.java
trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PagingStoreImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/HornetQStompException.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompDecoder.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompFrame.java
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/HttpAcceptorHandler.java
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyConnector.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerInfo.java
trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/ResourceManagerImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/utils/json/JSONArray.java
trunk/hornetq-jms/src/main/java/org/hornetq/api/jms/HornetQJMSClient.java
trunk/pom.xml
trunk/tests/concurrent-tests/src/test/java/org/hornetq/tests/concurrent/stomp/ConcurrentStompTest.java
Log:
Address several Findbugs reports, and add an excludes filter-file
Modified: trunk/etc/checkstyle.xml
===================================================================
--- trunk/etc/checkstyle.xml 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/etc/checkstyle.xml 2012-01-06 11:35:50 UTC (rev 11982)
@@ -26,7 +26,9 @@
<module name="RedundantModifier"/>
<!-- Checks for blocks. You know, those {}'s -->
- <!-- <module name="LeftCurly"/> -->
+ <module name="LeftCurly">
+ <property name="option" value="nl"/>>
+ </module>
<!-- Checks for common coding problems -->
<!-- Disabled until http://sourceforge.net/tracker/?func=detail&aid=2843447&group_id=29721&at... is fixed-->
Added: trunk/etc/findbugs-exclude.xml
===================================================================
--- trunk/etc/findbugs-exclude.xml (rev 0)
+++ trunk/etc/findbugs-exclude.xml 2012-01-06 11:35:50 UTC (rev 11982)
@@ -0,0 +1,35 @@
+<FindBugsFilter>
+
+ <Match>
+ <!-- Having str restored to null is fine for our purposes -->
+ <Class name="org.hornetq.api.core.SimpleString"/>
+ <Field name="str"/>
+ <Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
+ </Match>
+
+ <Match>
+ <!-- The whole point of SimpleString is to expose this data without any performance penalty -->
+ <Class name="org.hornetq.api.core.SimpleString"/>
+ <method name="getData"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+
+ <Match>
+ <!-- As per Java Messaging Specification 3.5.4:
+
+ "
+ Attempting to read a null value as a Java primitive type must be treated
+ as calling the primitive’s corresponding valueOf(String) conversion method
+ with a null value.
+ "
+
+ so methods are passed null arguments to trigger the exact same exceptions.
+ -->
+ <Class name="org.hornetq.utils.TypedProperties"/>
+ <Or>
+ <Method name="getFloatProperty"/>
+ <Method name="getDoubleProperty"/>
+ </Or>
+ <Bug pattern="NP_NULL_PARAM_DEREF_NONVIRTUAL"/>
+</Match>
+</FindBugsFilter>
Modified: trunk/hornetq-commons/src/main/java/org/hornetq/api/core/SimpleString.java
===================================================================
--- trunk/hornetq-commons/src/main/java/org/hornetq/api/core/SimpleString.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-commons/src/main/java/org/hornetq/api/core/SimpleString.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -29,7 +29,7 @@
*
*/
-public class SimpleString implements CharSequence, Serializable, Comparable<SimpleString>
+public final class SimpleString implements CharSequence, Serializable, Comparable<SimpleString>
{
private static final long serialVersionUID = 4204223851422244307L;
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -1316,7 +1316,7 @@
}
@Override
- public void finalize() throws Throwable
+ protected void finalize() throws Throwable
{
if (!closed && finalizeCheck)
{
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -1667,7 +1667,7 @@
}
@Override
- public void finalize() throws Throwable
+ protected void finalize() throws Throwable
{
if (state != STATE.CLOSED && finalizeCheck)
{
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/FilterImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/FilterImpl.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/FilterImpl.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -25,14 +25,14 @@
/**
* This class implements a HornetQ filter
-*
+*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
-*
+*
* HornetQ filters have the same syntax as JMS 1.1 selectors, but the identifiers are different.
-*
+*
* Valid identifiers that can be used are:
-*
+*
* HQPriority - the priority of the message
* HQTimestamp - the timestamp of the message
* HQDurable - "DURABLE" or "NON_DURABLE"
@@ -40,16 +40,16 @@
* HQSize - the encoded size of the full message in bytes
* HQUserID - the user specified ID string (if any)
* Any other identifers that appear in a filter expression represent header values for the message
-*
+*
* String values must be set as <code>SimpleString</code>, not <code>java.lang.String</code> (see JBMESSAGING-1307).
* Derived from JBoss MQ version by
-*
+*
* @author <a href="mailto:Norbert.Lataille@m4x.org">Norbert Lataille</a>
* @author <a href="mailto:jplindfo@helsinki.fi">Juha Lindfors</a>
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
* @author <a href="mailto:Scott.Stark@jboss.org">Scott Stark</a>
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
-*
+*
* @version $Revision: 3569 $
*
* $Id: Selector.java 3569 2008-01-15 21:14:04Z timfox $
@@ -174,9 +174,6 @@
}
}
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
@Override
public int hashCode()
{
@@ -186,9 +183,6 @@
return result;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj)
{
@@ -209,9 +203,6 @@
return true;
}
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
@Override
public String toString()
{
@@ -229,7 +220,7 @@
}
else if (FilterConstants.HORNETQ_PRIORITY.equals(fieldName))
{
- return new Integer(msg.getPriority());
+ return Integer.valueOf(msg.getPriority());
}
else if (FilterConstants.HORNETQ_TIMESTAMP.equals(fieldName))
{
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/messagecounter/MessageCounter.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/messagecounter/MessageCounter.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/messagecounter/MessageCounter.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -31,9 +31,9 @@
/**
* This class stores message count informations for a given queue
- *
+ *
* At intervals this class samples the queue for message count data
- *
+ *
* Note that the underlying queue *does not* update statistics every time a message
* is added since that would reall slow things down, instead we *sample* the queues at
* regular intervals - this means we are less intrusive on the queue
@@ -114,8 +114,8 @@
setHistoryLimit(daycountmax);
}
-
- private Runnable onTimeExecutor = new Runnable()
+
+ private final Runnable onTimeExecutor = new Runnable()
{
public void run()
{
@@ -124,7 +124,7 @@
long newMessagesAdded = latestMessagesAdded - lastMessagesAdded;
countTotal += newMessagesAdded;
-
+
lastMessagesAdded = latestMessagesAdded;
if (newMessagesAdded > 0)
@@ -137,7 +137,7 @@
// update message history
updateHistory(newMessagesAdded);
-
+
}
};
@@ -150,7 +150,7 @@
{
// Actor approach here: Instead of having the Counter locking the queue, we will use the Queue's executor
// instead of possibly making an lock on the queue.
- // This way the scheduled Threads will be free to keep doing their pings in case the server is busy with paging or
+ // This way the scheduled Threads will be free to keep doing their pings in case the server is busy with paging or
// any other deliveries
serverQueue.getExecutor().execute(onTimeExecutor);
}
@@ -301,8 +301,8 @@
/**
* Get message counter history data as string in format
- *
- * "day count\n
+ *
+ * "day count\n
* Date 1, hour counter 0, hour counter 1, ..., hour counter 23\n
* Date 2, hour counter 0, hour counter 1, ..., hour counter 23\n
* .....
@@ -313,7 +313,7 @@
*/
public String getHistoryAsString()
{
- String ret = "";
+ StringBuilder ret = new StringBuilder();
// ensure history counters are up to date
updateHistory(0);
@@ -322,18 +322,18 @@
synchronized (dayCounters)
{
// first line: history day count
- ret += dayCounters.size() + "\n";
+ ret.append(dayCounters.size() + "\n");
// following lines: day counter data
for (int i = 0; i < dayCounters.size(); i++)
{
DayCounter counter = dayCounters.get(i);
- ret += counter.getDayCounterAsString() + "\n";
+ ret.append(counter.getDayCounterAsString() + "\n");
}
}
- return ret;
+ return ret.toString();
}
@Override
@@ -359,7 +359,7 @@
/**
* Update message counter history
- *
+ *
* @param newMessages number of new messages to add to the latest day counter
*/
private void updateHistory(final long newMessages)
@@ -437,7 +437,7 @@
/**
* Internal day counter class for one day hour based counter history
*/
- public static class DayCounter
+ public static final class DayCounter
{
static final int HOURS = 24;
@@ -500,7 +500,7 @@
}
/**
- * Update day counter hour array elements
+ * Update day counter hour array elements
*
* @param newMessages number of new messages since the counter was last updated.
*/
@@ -539,7 +539,7 @@
}
/**
- * Finalize day counter hour array elements
+ * Finalize day counter hour array elements
*/
void finalizeDayCounter()
{
@@ -568,25 +568,24 @@
}
/**
- * Return day counter data as string with format
- * "Date, hour counter 0, hour counter 1, ..., hour counter 23"
- *
- * @return String day counter data
+ * Return day counter data as string with format<br/>
+ * "Date, hour counter 0, hour counter 1, ..., hour counter 23".
+ * @return String day counter data
*/
String getDayCounterAsString()
{
// first element day counter date
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
- String strData = dateFormat.format(date.getTime());
+ StringBuilder strData = new StringBuilder(dateFormat.format(date.getTime()));
// append 24 comma separated hour counter values
for (int i = 0; i < DayCounter.HOURS; i++)
{
- strData += "," + counters[i];
+ strData.append("," + counters[i]);
}
- return strData;
+ return strData.toString();
}
}
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/messagecounter/impl/MessageCounterHelper.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/messagecounter/impl/MessageCounterHelper.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/messagecounter/impl/MessageCounterHelper.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -61,7 +61,8 @@
return null;
}
- String ret = "<table class=\"hornetq-message-counter\">\n" + "<tr>"
+ String ret0 =
+ "<table class=\"hornetq-message-counter\">\n" + "<tr>"
+ "<th>Type</th>"
+ "<th>Name</th>"
+ "<th>Subscription</th>"
@@ -72,8 +73,8 @@
+ "<th>DepthDelta</th>"
+ "<th>Last Add</th>"
+ "<th>Last Update</th>"
- + "</tr>\n";
-
+ + "</tr>\n";
+ StringBuilder ret = new StringBuilder(ret0);
for (int i = 0; i < counters.length; i++)
{
MessageCounter counter = counters[i];
@@ -88,25 +89,25 @@
{
durableStr = Boolean.toString(counter.isDestinationDurable());
}
- ret += "<tr bgcolor=\"#" + (i % 2 == 0 ? "FFFFFF" : "F0F0F0") + "\">";
+ ret.append("<tr bgcolor=\"#" + (i % 2 == 0 ? "FFFFFF" : "F0F0F0") + "\">");
- ret += "<td>" + type + "</td>";
- ret += "<td>" + counter.getDestinationName() + "</td>";
- ret += "<td>" + subscription + "</td>";
- ret += "<td>" + durableStr + "</td>";
- ret += "<td>" + counter.getCount() + "</td>";
- ret += "<td>" + MessageCounterHelper.prettify(counter.getCountDelta()) + "</td>";
- ret += "<td>" + MessageCounterHelper.prettify(counter.getMessageCount()) + "</td>";
- ret += "<td>" + MessageCounterHelper.prettify(counter.getMessageCountDelta()) + "</td>";
- ret += "<td>" + MessageCounterHelper.asDate(counter.getLastAddedMessageTime()) + "</td>";
- ret += "<td>" + MessageCounterHelper.asDate(counter.getLastUpdate()) + "</td>";
+ ret.append("<td>" + type + "</td>");
+ ret.append("<td>" + counter.getDestinationName() + "</td>");
+ ret.append("<td>" + subscription + "</td>");
+ ret.append("<td>" + durableStr + "</td>");
+ ret.append("<td>" + counter.getCount() + "</td>");
+ ret.append("<td>" + MessageCounterHelper.prettify(counter.getCountDelta()) + "</td>");
+ ret.append("<td>" + MessageCounterHelper.prettify(counter.getMessageCount()) + "</td>");
+ ret.append("<td>" + MessageCounterHelper.prettify(counter.getMessageCountDelta()) + "</td>");
+ ret.append("<td>" + MessageCounterHelper.asDate(counter.getLastAddedMessageTime()) + "</td>");
+ ret.append("<td>" + MessageCounterHelper.asDate(counter.getLastUpdate()) + "</td>");
- ret += "</tr>\n";
+ ret.append("</tr>\n");
}
- ret += "</table>\n";
+ ret.append("</table>\n");
- return ret;
+ return ret.toString();
}
public static String listMessageCounterHistoryAsHTML(final MessageCounter[] counters)
@@ -116,36 +117,36 @@
return null;
}
- String ret = "<ul>\n";
+ StringBuilder ret = new StringBuilder("<ul>\n");
for (MessageCounter counter : counters)
{
- ret += "<li>\n";
- ret += " <ul>\n";
+ ret.append("<li>\n");
+ ret.append(" <ul>\n");
- ret += " <li>";
+ ret.append(" <li>");
// destination name
- ret += (counter.isDestinationTopic() ? "Topic '" : "Queue '") + counter.getDestinationName() + "'";
- ret += "</li>\n";
+ ret.append((counter.isDestinationTopic() ? "Topic '" : "Queue '") + counter.getDestinationName() + "'");
+ ret.append("</li>\n");
if (counter.getDestinationSubscription() != null)
{
- ret += " <li>";
- ret += "Subscription '" + counter.getDestinationSubscription() + "'";
- ret += "</li>\n";
+ ret.append(" <li>");
+ ret.append("Subscription '" + counter.getDestinationSubscription() + "'");
+ ret.append("</li>\n");
}
- ret += " <li>";
+ ret.append(" <li>");
// table header
- ret += "<table class=\"hornetq-message-counter-history\">\n";
- ret += "<tr><th>Date</th>";
+ ret.append("<table class=\"hornetq-message-counter-history\">\n");
+ ret.append("<tr><th>Date</th>");
for (int j = 0; j < 24; j++)
{
- ret += "<th>" + j + "</th>";
+ ret.append("<th>" + j + "</th>");
}
- ret += "<th>Total</th></tr>\n";
+ ret.append("<th>Total</th></tr>\n");
// get history data as CSV string
StringTokenizer tokens = new StringTokenizer(counter.getHistoryAsString(), ",\n");
@@ -156,10 +157,10 @@
for (int j = 0; j < days; j++)
{
// next day counter row
- ret += "<tr bgcolor=\"#" + (j % 2 == 0 ? "FFFFFF" : "F0F0F0") + "\">";
+ ret.append("<tr bgcolor=\"#" + (j % 2 == 0 ? "FFFFFF" : "F0F0F0") + "\">");
// date
- ret += "<td>" + tokens.nextToken() + "</td>";
+ ret.append("<td>" + tokens.nextToken() + "</td>");
// 24 hour counters
int total = 0;
@@ -170,27 +171,27 @@
if (value == -1)
{
- ret += "<td></td>";
+ ret.append("<td></td>");
}
else
{
- ret += "<td>" + value + "</td>";
+ ret.append("<td>" + value + "</td>");
total += value;
}
}
- ret += "<td>" + total + "</td></tr>\n";
+ ret.append("<td>" + total + "</td></tr>\n");
}
- ret += "</table></li>\n";
- ret += " </ul>\n";
- ret += "</li>\n";
+ ret.append("</table></li>\n");
+ ret.append(" </ul>\n");
+ ret.append("</li>\n");
}
- ret += "</ul>\n";
+ ret.append("</ul>\n");
- return ret;
+ return ret.toString();
}
private static String prettify(final long value)
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PagingStoreImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PagingStoreImpl.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PagingStoreImpl.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -918,8 +918,7 @@
installPageTransaction(tx, listCtx);
tx.setWaitBeforeCommit(true);
}
- else
- if (sync && tx == null)
+ else if (sync)
{
sync();
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -3258,7 +3258,7 @@
}
- private class FinishPageMessageOperation implements TransactionOperation
+ private static class FinishPageMessageOperation implements TransactionOperation
{
public void afterCommit(final Transaction tx)
@@ -3332,27 +3332,21 @@
long value;
- /* (non-Javadoc)
- * @see org.hornetq.core.journal.EncodingSupport#getEncodeSize()
- */
+ @Override
public int getEncodeSize()
{
return DataConstants.SIZE_LONG * 2;
}
- /* (non-Javadoc)
- * @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
- */
+ @Override
public void encode(HornetQBuffer buffer)
{
buffer.writeLong(queueID);
buffer.writeLong(value);
}
- /* (non-Javadoc)
- * @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
- */
- public void decode(HornetQBuffer buffer)
+ @Override
+ public void decode(HornetQBuffer buffer)
{
queueID = buffer.readLong();
value = buffer.readLong();
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -228,16 +228,12 @@
// The recordID could be negative if the duplicateCache is configured to not persist,
// -1 would mean null on this case
id.setB(recordID >= 0 ? recordID : null);
-
- holder.pos = pos;
}
else
{
id = new Pair<ByteArrayHolder, Long>(holder, recordID >= 0 ? recordID : null);
ids.add(id);
-
- holder.pos = pos;
}
if (pos++ == cacheSize - 1)
@@ -314,8 +310,6 @@
int hash;
- int pos;
-
@Override
public boolean equals(final Object other)
{
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/HornetQStompException.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/HornetQStompException.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/HornetQStompException.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -17,18 +17,18 @@
import java.util.List;
/**
- *
+ *
* @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
*/
public class HornetQStompException extends Exception {
private static final long serialVersionUID = -274452327574950068L;
-
- private List<Header> headers = new ArrayList<Header>(10);
+
+ private final List<Header> headers = new ArrayList<Header>(10);
private String body;
private VersionedStompFrameHandler handler;
private boolean disconnect;
-
+
public HornetQStompException(StompConnection connection, String msg)
{
super(msg);
@@ -38,13 +38,13 @@
{
super(msg);
}
-
+
public HornetQStompException(String msg, Throwable t)
{
super(msg, t);
this.body = t.getMessage();
}
-
+
public HornetQStompException(Throwable t)
{
super(t);
@@ -54,7 +54,7 @@
{
headers.add(new Header(header, value));
}
-
+
public void setBody(String body)
{
this.body = body;
@@ -91,11 +91,11 @@
return frame;
}
- private class Header
+ private static final class Header
{
- public String key;
- public String val;
-
+ public final String key;
+ public final String val;
+
public Header(String key, String val)
{
this.key = key;
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompDecoder.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompDecoder.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompDecoder.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -17,7 +17,6 @@
import java.util.Map;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
/**
* A StompDecoder
@@ -28,8 +27,6 @@
*/
public class StompDecoder
{
- private static final Logger log = Logger.getLogger(StompDecoder.class);
-
public static final boolean TRIM_LEADING_HEADER_VALUE_WHITESPACE = true;
public static final String COMMAND_ABORT = "ABORT";
@@ -80,7 +77,7 @@
public static final String COMMAND_CONNECTED = "CONNECTED";
public static final int COMMAND_CONNECTED_LENGTH = COMMAND_CONNECTED.length();
-
+
public static final String COMMAND_MESSAGE = "MESSAGE";
public static final int COMMAND_MESSAGE_LENGTH = COMMAND_MESSAGE.length();
@@ -109,13 +106,13 @@
public static final byte M = (byte)'M';
public static final byte S = (byte)'S';
-
+
public static final byte R = (byte)'R';
public static final byte U = (byte)'U';
public static final byte N = (byte)'N';
-
+
public static final byte LN = (byte)'n';
public static final byte HEADER_SEPARATOR = (byte)':';
@@ -128,7 +125,7 @@
public static final String CONTENT_TYPE_HEADER_NAME = "content-type";
- public static String CONTENT_LENGTH_HEADER_NAME = "content-length";
+ public static final String CONTENT_LENGTH_HEADER_NAME = "content-length";
public byte[] workingBuffer = new byte[1024];
@@ -153,11 +150,11 @@
public boolean whiteSpaceOnly;
public int contentLength;
-
+
public String contentType;
public int bodyStart;
-
+
public StompConnection connection;
public StompDecoder(StompConnection stompConnection)
@@ -182,7 +179,7 @@
* followed by an empty line
* followed by an optional message body
* terminated with a null character
- *
+ *
* Note: to support both 1.0 and 1.1, we just assemble a
* standard StompFrame and let the versioned handler to do more
* spec specific job (like trimming, escaping etc).
@@ -194,10 +191,10 @@
VersionedStompFrameHandler handler = connection.getFrameHandler();
return handler.decode(this, buffer);
}
-
+
return defaultDecode(buffer);
}
-
+
public StompFrame defaultDecode(final HornetQBuffer buffer) throws HornetQStompException
{
@@ -291,7 +288,7 @@
command = COMMAND_COMMIT;
}
/**** added by meddy, 27 april 2011, handle header parser for reply to websocket protocol ****/
- else if (workingBuffer[offset+7]==E)
+ else if (workingBuffer[offset+7]==E)
{
if (!tryIncrement(offset + COMMAND_CONNECTED_LENGTH + 1))
{
@@ -299,7 +296,7 @@
}
// CONNECTED
- command = COMMAND_CONNECTED;
+ command = COMMAND_CONNECTED;
}
/**** end ****/
else
@@ -384,7 +381,7 @@
}
// SEND
- command = COMMAND_STOMP;
+ command = COMMAND_STOMP;
}
else
{
@@ -569,7 +566,7 @@
}
}
}
-
+
if (content != null)
{
if (data > pos)
@@ -594,7 +591,7 @@
else
{
return null;
- }
+ }
}
public void throwInvalid() throws HornetQStompException
@@ -607,7 +604,7 @@
pos = 0;
command = null;
-
+
headers = new HashMap<String, String>();
this.headerBytesCopyStart = -1;
@@ -625,7 +622,7 @@
contentLength = -1;
contentType = null;
-
+
bodyStart = -1;
}
@@ -659,11 +656,11 @@
for (int i = 0; i < data; i++)
{
char b = (char)bytes[i];
-
+
if (b < 33 || b > 136)
{
//Unreadable characters
-
+
str.append(bytes[i]);
}
else
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompFrame.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompFrame.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompFrame.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -18,6 +18,7 @@
package org.hornetq.core.protocol.stomp;
import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -31,7 +32,7 @@
*
* @author <a href="http://hiramchirino.com">chirino</a>
* @author Tim Fox
- *
+ *
*/
public class StompFrame
{
@@ -46,17 +47,17 @@
protected Map<String, String> headers;
protected String body;
-
+
protected byte[] bytesBody;
protected HornetQBuffer buffer = null;
protected int size;
-
+
protected boolean disconnect;
-
+
protected boolean isPing;
-
+
public StompFrame(String command)
{
this(command, false);
@@ -94,31 +95,32 @@
@Override
public String toString()
{
- return "StompFrame[command=" + command + ", headers=" + headers + ", content= " + this.body + " bytes " + this.bytesBody;
+ return "StompFrame[command=" + command + ", headers=" + headers + ", content= " + this.body + " bytes " +
+ Arrays.toString(bytesBody);
}
public String asString()
{
- String out = command + '\n';
+ StringBuilder out = new StringBuilder(command + '\n');
for (Entry<String, String> header : headers.entrySet())
{
- out += header.getKey() + ": " + header.getValue() + '\n';
+ out.append(header.getKey() + ": " + header.getValue() + '\n');
}
- out += '\n';
- out += body;
- return out;
+ out.append('\n');
+ out.append(body);
+ return out.toString();
}
-
+
public boolean isPing()
{
return isPing;
}
-
+
public void setPing(boolean ping)
{
isPing = ping;
}
-
+
public HornetQBuffer toHornetQBuffer() throws Exception
{
if (buffer == null)
@@ -173,17 +175,17 @@
{
headers.put(key, val);
}
-
+
public Map<String, String> getHeadersMap()
{
return headers;
}
-
+
public static class Header
{
public String key;
public String val;
-
+
public Header(String key, String val)
{
this.key = key;
@@ -199,11 +201,11 @@
{
return escape(val);
}
-
+
public static String escape(String str)
{
int len = str.length();
-
+
char[] buffer = new char[2*len];
int iBuffer = 0;
for (int i = 0; i < len; i++)
@@ -230,10 +232,10 @@
}
iBuffer++;
}
-
+
char[] total = new char[iBuffer];
System.arraycopy(buffer, 0, total, 0, iBuffer);
-
+
return new String(total);
}
}
@@ -260,7 +262,7 @@
}
return body;
}
-
+
//Since 1.1, there is a content-type header that needs to take care of
public byte[] getBodyAsBytes() throws UnsupportedEncodingException
{
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/HttpAcceptorHandler.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/HttpAcceptorHandler.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/HttpAcceptorHandler.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -131,7 +131,7 @@
/**
* this is prompted to delivery when a response is available in the response queue.
*/
- class ResponseRunner implements Runnable
+ final class ResponseRunner implements Runnable
{
private final ChannelBuffer buffer;
@@ -211,8 +211,8 @@
}
}
-
-
+
+
public void shutdown()
{
executor.shutdown();
@@ -228,7 +228,7 @@
/**
* a holder class so we know what time the request first arrived
*/
- private class ResponseHolder
+ private static final class ResponseHolder
{
final HttpResponse response;
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyConnector.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyConnector.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyConnector.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -524,7 +524,7 @@
// Inner classes -------------------------------------------------
- private final class HornetQClientChannelHandler extends HornetQChannelHandler
+ private static final class HornetQClientChannelHandler extends HornetQChannelHandler
{
HornetQClientChannelHandler(final ChannelGroup group,
final BufferHandler handler,
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerInfo.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerInfo.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerInfo.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -61,47 +61,39 @@
double availableMemoryPercent = 100.0 * availableMemory / maxMemory;
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
- String info = "\n**** Server Dump ****\n";
- info += String.format("date: %s\n", new Date());
- info += String.format("free memory: %s\n", SizeFormatterUtil.sizeof(freeMemory));
- info += String.format("max memory: %s\n", SizeFormatterUtil.sizeof(maxMemory));
- info += String.format("total memory: %s\n", SizeFormatterUtil.sizeof(totalMemory));
- info += String.format("available memory: %.2f%%\n", availableMemoryPercent);
- info += appendPagingInfos();
- info += String.format("# of thread: %d\n", threadMXBean.getThreadCount());
- info += String.format("# of conns: %d\n", server.getConnectionCount());
- info += "********************\n";
- return info;
+ StringBuilder info = new StringBuilder("\n**** Server Dump ****\n");
+ info.append(String.format("date: %s\n", new Date()));
+ info.append(String.format("free memory: %s\n", SizeFormatterUtil.sizeof(freeMemory)));
+ info.append(String.format("max memory: %s\n", SizeFormatterUtil.sizeof(maxMemory)));
+ info.append(String.format("total memory: %s\n", SizeFormatterUtil.sizeof(totalMemory)));
+ info.append(String.format("available memory: %.2f%%\n", availableMemoryPercent));
+ info.append(appendPagingInfos());
+ info.append(String.format("# of thread: %d\n", threadMXBean.getThreadCount()));
+ info.append(String.format("# of conns: %d\n", server.getConnectionCount()));
+ info.append("********************\n");
+ return info.toString();
}
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
private String appendPagingInfos()
{
- String info = "";
-
+ StringBuilder info = new StringBuilder();
+
for (SimpleString storeName : pagingManager.getStoreNames())
{
PagingStore pageStore;
try
{
pageStore = pagingManager.getPageStore(storeName);
- info += String.format("\t%s: %s\n",
+ info.append(String.format("\t%s: %s\n",
storeName,
- SizeFormatterUtil.sizeof(pageStore.getPageSizeBytes() * pageStore.getNumberOfPages()));
+ SizeFormatterUtil.sizeof(pageStore.getPageSizeBytes() *
+ pageStore.getNumberOfPages())));
}
catch (Exception e)
{
- info += String.format("\t%s: %s\n", storeName, e.getMessage());
+ info.append(String.format("\t%s: %s\n", storeName, e.getMessage()));
}
}
- return info;
+ return info.toString();
}
-
- // Inner classes -------------------------------------------------
-
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/ResourceManagerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/ResourceManagerImpl.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/ResourceManagerImpl.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -251,7 +251,7 @@
}
- private class HeuristicCompletionHolder
+ private static final class HeuristicCompletionHolder
{
public final boolean isCommit;
Modified: trunk/hornetq-core/src/main/java/org/hornetq/utils/json/JSONArray.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/utils/json/JSONArray.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-core/src/main/java/org/hornetq/utils/json/JSONArray.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -150,7 +150,7 @@
case ')':
if (q != c)
{
- throw x.syntaxError("Expected a '" + new Character(q) + "'");
+ throw x.syntaxError("Expected a '" + Character.valueOf(q) + "'");
}
return;
default:
@@ -183,7 +183,7 @@
/**
* Construct a JSONArray from a collection of beans.
* The collection should have Java Beans.
- *
+ *
* @throws JSONException If not an array.
*/
@@ -236,7 +236,7 @@
/**
* Construct a JSONArray from an array with a bean.
* The array should have Java Beans.
- *
+ *
* @throws JSONException If not an array.
*/
public JSONArray(final Object array, final boolean includeSuperClass) throws JSONException
@@ -688,7 +688,7 @@
*/
public JSONArray put(final int value)
{
- put(new Integer(value));
+ put(Integer.valueOf(value));
return this;
}
@@ -700,7 +700,7 @@
*/
public JSONArray put(final long value)
{
- put(new Long(value));
+ put(Long.valueOf(value));
return this;
}
@@ -786,7 +786,7 @@
*/
public JSONArray put(final int index, final int value) throws JSONException
{
- put(index, new Integer(value));
+ put(index, Integer.valueOf(value));
return this;
}
@@ -801,7 +801,7 @@
*/
public JSONArray put(final int index, final long value) throws JSONException
{
- put(index, new Long(value));
+ put(index, Long.valueOf(value));
return this;
}
@@ -910,19 +910,17 @@
}
catch (Exception e)
{
- return null;
+ return "";
}
}
/**
- * Make a prettyprinted JSON text of this JSONArray.
- * Warning: This method assumes that the data structure is acyclical.
- * @param indentFactor The number of spaces to add to each level of
- * indentation.
- * @return a printable, displayable, transmittable
- * representation of the object, beginning
- * with <code>[</code> <small>(left bracket)</small> and ending
- * with <code>]</code> <small>(right bracket)</small>.
+ * Make a pretty-printed JSON text of this JSONArray. Warning: This method assumes that the data
+ * structure is acyclical.
+ * @param indentFactor The number of spaces to add to each level of indentation.
+ * @return a printable, displayable, transmittable representation of the object, beginning with
+ * <code>[</code> <small>(left bracket)</small> and ending with <code>]</code>
+ * <small>(right bracket)</small>.
* @throws JSONException
*/
public String toString(final int indentFactor) throws JSONException
@@ -931,13 +929,11 @@
}
/**
- * Make a prettyprinted JSON text of this JSONArray.
- * Warning: This method assumes that the data structure is acyclical.
- * @param indentFactor The number of spaces to add to each level of
- * indentation.
+ * Make a pretty-printed JSON text of this JSONArray. Warning: This method assumes that the data
+ * structure is acyclical.
+ * @param indentFactor The number of spaces to add to each level of indentation.
* @param indent The indention of the top level.
- * @return a printable, displayable, transmittable
- * representation of the array.
+ * @return a printable, displayable, transmittable representation of the array.
* @throws JSONException
*/
String toString(final int indentFactor, final int indent) throws JSONException
Modified: trunk/hornetq-jms/src/main/java/org/hornetq/api/jms/HornetQJMSClient.java
===================================================================
--- trunk/hornetq-jms/src/main/java/org/hornetq/api/jms/HornetQJMSClient.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/hornetq-jms/src/main/java/org/hornetq/api/jms/HornetQJMSClient.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -17,7 +17,6 @@
import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.core.logging.Logger;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.client.HornetQJMSConnectionFactory;
@@ -34,14 +33,18 @@
*/
public class HornetQJMSClient
{
- private static final Logger log = Logger.getLogger(HornetQJMSClient.class);
/**
- * Create a HornetQConnectionFactory which will receive cluster topology updates from the cluster as servers leave or join and new backups are appointed or removed.
- * The discoveryAddress and discoveryPort parameters in this method are used to listen for UDP broadcasts which contain connection information for members of the cluster.
- * The broadcasted connection information is simply used to make an initial connection to the cluster, once that connection is made, up to date
- * cluster topology information is downloaded and automatically updated whenever the cluster topology changes. If the topology includes backup servers
- * that information is also propagated to the client so that it can know which server to failover onto in case of live server failure.
+ * Creates a HornetQConnectionFactory that receives cluster topology updates from the cluster as
+ * servers leave or join and new backups are appointed or removed.
+ * <p>
+ * The discoveryAddress and discoveryPort parameters in this method are used to listen for UDP
+ * broadcasts which contain connection information for members of the cluster. The broadcasted
+ * connection information is simply used to make an initial connection to the cluster, once that
+ * connection is made, up to date cluster topology information is downloaded and automatically
+ * updated whenever the cluster topology changes. If the topology includes backup servers that
+ * information is also propagated to the client so that it can know which server to failover onto
+ * in case of live server failure.
* @param discoveryAddress The UDP group address to listen for updates
* @param discoveryPort the UDP port to listen for updates
* @return the HornetQConnectionFactory
@@ -73,15 +76,15 @@
{
factory = new HornetQXATopicConnectionFactory(true, groupConfiguration);
}
-
+
return factory;
}
/**
* Create a HornetQConnectionFactory which creates session factories from a set of live servers, no HA backup information is propagated to the client
- *
+ *
* The UDP address and port are used to listen for live servers in the cluster
- *
+ *
* @param discoveryAddress The UDP group address to listen for updates
* @param discoveryPort the UDP port to listen for updates
* @return the HornetQConnectionFactory
@@ -113,10 +116,10 @@
{
factory = new HornetQXATopicConnectionFactory(false, groupConfiguration);
}
-
+
return factory;
}
-
+
/**
* Create a HornetQConnectionFactory which will receive cluster topology updates from the cluster as servers leave or join and new backups are appointed or removed.
* The initial list of servers supplied in this method is simply to make an initial connection to the cluster, once that connection is made, up to date
@@ -153,14 +156,14 @@
{
factory = new HornetQXATopicConnectionFactory(true, initialServers);
}
-
+
return factory;
}
/**
* Create a HornetQConnectionFactory which creates session factories using a static list of transportConfigurations, the HornetQConnectionFactory is not updated automatically
* as the cluster topology changes, and no HA backup information is propagated to the client
- *
+ *
* @param transportConfigurations
* @return the HornetQConnectionFactory
*/
@@ -191,10 +194,10 @@
{
factory = new HornetQXATopicConnectionFactory(false, transportConfigurations);
}
-
+
return factory;
}
-
+
/**
* Creates a client-side representation of a JMS Topic.
*
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/pom.xml 2012-01-06 11:35:50 UTC (rev 11982)
@@ -562,6 +562,7 @@
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.3</version>
<configuration>
+ <excludeFilterFile>${user.dir}/etc/findbugs-exclude.xml</excludeFilterFile>
<findbugsXmlOutput>true</findbugsXmlOutput>
<xmlOutput>true</xmlOutput>
<effort>Max</effort>
@@ -621,6 +622,7 @@
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.3</version>
<configuration>
+ <excludeFilterFile>${user.dir}/etc/findbugs-exclude.xml</excludeFilterFile>
<xmlOutput>true</xmlOutput>
<effort>Max</effort>
</configuration>
Modified: trunk/tests/concurrent-tests/src/test/java/org/hornetq/tests/concurrent/stomp/ConcurrentStompTest.java
===================================================================
--- trunk/tests/concurrent-tests/src/test/java/org/hornetq/tests/concurrent/stomp/ConcurrentStompTest.java 2012-01-05 18:24:11 UTC (rev 11981)
+++ trunk/tests/concurrent-tests/src/test/java/org/hornetq/tests/concurrent/stomp/ConcurrentStompTest.java 2012-01-06 11:35:50 UTC (rev 11982)
@@ -27,7 +27,6 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.CoreQueueConfiguration;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.stomp.Stomp;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
@@ -39,8 +38,6 @@
public class ConcurrentStompTest extends UnitTestCase
{
- private static final transient Logger log = Logger.getLogger(ConcurrentStompTest.class);
-
private final int port = 61613;
private Socket stompSocket;
12 years, 8 months