Author: borges
Date: 2012-01-09 06:44:01 -0500 (Mon, 09 Jan 2012)
New Revision: 12006
Modified:
trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/topic/SubscriptionsResource.java
trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/util/HttpMessageHelper.java
Log:
Fix findbugs warnings
Modified:
trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/topic/SubscriptionsResource.java
===================================================================
---
trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/topic/SubscriptionsResource.java 2012-01-09
11:43:40 UTC (rev 12005)
+++
trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/topic/SubscriptionsResource.java 2012-01-09
11:44:01 UTC (rev 12006)
@@ -1,15 +1,7 @@
package org.hornetq.rest.topic;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.client.ClientSession;
-import org.hornetq.api.core.client.ClientSessionFactory;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.rest.queue.AcknowledgedQueueConsumer;
-import org.hornetq.rest.queue.Acknowledgement;
-import org.hornetq.rest.queue.DestinationServiceManager;
-import org.hornetq.rest.queue.QueueConsumer;
-import org.hornetq.rest.util.TimeoutTask;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
@@ -24,9 +16,18 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.rest.queue.AcknowledgedQueueConsumer;
+import org.hornetq.rest.queue.Acknowledgement;
+import org.hornetq.rest.queue.DestinationServiceManager;
+import org.hornetq.rest.queue.QueueConsumer;
+import org.hornetq.rest.util.TimeoutTask;
+
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
@@ -131,7 +132,8 @@
@Context UriInfo uriInfo)
{
- if (timeout == null) timeout = new Long(consumerTimeoutSeconds * 1000);
+ if (timeout == null)
+ timeout = Long.valueOf(consumerTimeoutSeconds * 1000);
boolean deleteWhenIdle = !durable; // default is true if non-durable
if (destroyWhenIdle != null) deleteWhenIdle = destroyWhenIdle.booleanValue();
@@ -202,11 +204,11 @@
Response.ResponseBuilder builder = Response.created(location.build());
if (autoAck)
{
- SubscriptionResource.setConsumeNextLink(serviceManager.getLinkStrategy(),
builder, uriInfo, uriInfo.getMatchedURIs().get(1) + "/auto-ack/" +
consumer.getId(), "-1");
+ QueueConsumer.setConsumeNextLink(serviceManager.getLinkStrategy(), builder,
uriInfo, uriInfo.getMatchedURIs().get(1) + "/auto-ack/" + consumer.getId(),
"-1");
}
else
{
-
AcknowledgedSubscriptionResource.setAcknowledgeNextLink(serviceManager.getLinkStrategy(),
builder, uriInfo, uriInfo.getMatchedURIs().get(1) + "/acknowledged/" +
consumer.getId(), "-1");
+
AcknowledgedQueueConsumer.setAcknowledgeNextLink(serviceManager.getLinkStrategy(),
builder, uriInfo, uriInfo.getMatchedURIs().get(1) + "/acknowledged/" +
consumer.getId(), "-1");
}
return builder.build();
@@ -425,7 +427,6 @@
if (consumer == null)
{
String msg = "Failed to match a subscription to URL " + consumerId;
- //System.out.println(msg);
throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)
.entity(msg)
.type("text/plain").build());
Modified:
trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/util/HttpMessageHelper.java
===================================================================
---
trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/util/HttpMessageHelper.java 2012-01-09
11:43:40 UTC (rev 12005)
+++
trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/util/HttpMessageHelper.java 2012-01-09
11:44:01 UTC (rev 12006)
@@ -1,17 +1,19 @@
package org.hornetq.rest.util;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.client.ClientMessage;
-import org.jboss.resteasy.client.ClientRequest;
-import org.hornetq.rest.HttpHeaderProperty;
+import java.io.ByteArrayInputStream;
+import java.io.ObjectInputStream;
+import java.util.List;
+import java.util.Map.Entry;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
-import java.io.ByteArrayInputStream;
-import java.io.ObjectInputStream;
-import java.util.List;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.rest.HttpHeaderProperty;
+import org.jboss.resteasy.client.ClientRequest;
+
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
@@ -116,11 +118,12 @@
{
MultivaluedMap<String, String> hdrs = headers.getRequestHeaders();
- for (String key : hdrs.keySet())
+ for (Entry<String, List<String>> entry : hdrs.entrySet())
{
+ String key = entry.getKey();
if (isTransferableHttpHeader(key))
{
- List<String> vals = hdrs.get(key);
+ List<String> vals = entry.getValue();
String value = concatenateHeaderValue(vals);
message.putStringProperty(HttpHeaderProperty.toPropertyName(key), value);
}
@@ -132,21 +135,12 @@
public static String concatenateHeaderValue(List<String> vals)
{
if (vals == null) return "";
- StringBuffer val = null;
+ StringBuilder val = new StringBuilder();
for (String v : vals)
{
- if (val == null)
- {
- val = new StringBuffer(v);
- }
- else
- {
val.append(",").append(v);
- }
}
- String value = "";
- if (val != null) value = val.toString();
- return value;
+ return val.toString();
}
}
Show replies by date