From do-not-reply at jboss.org Mon Jan 9 06:44:02 2012 Content-Type: multipart/mixed; boundary="===============1106729114574961521==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: hornetq-commits at lists.jboss.org Subject: [hornetq-commits] JBoss hornetq SVN: r12006 - in trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest: util and 1 other directory. Date: Mon, 09 Jan 2012 06:44:01 -0500 Message-ID: <201201091144.q09Bi1Ys008327@svn01.web.mwc.hst.phx2.redhat.com> --===============1106729114574961521== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/Sub= scriptionsResource.java trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/util/Http= MessageHelper.java Log: Fix findbugs warnings Modified: trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/to= pic/SubscriptionsResource.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/topic/Su= bscriptionsResource.java 2012-01-09 11:43:40 UTC (rev 12005) +++ trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/topic/Su= bscriptionsResource.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 Bill Burke * @version $Revision: 1 $ @@ -131,7 +132,8 @@ @Context UriInfo uriInfo) { = - if (timeout =3D=3D null) timeout =3D new Long(consumerTimeoutSeconds= * 1000); + if (timeout =3D=3D null) + timeout =3D Long.valueOf(consumerTimeoutSeconds * 1000); boolean deleteWhenIdle =3D !durable; // default is true if non-durab= le if (destroyWhenIdle !=3D null) deleteWhenIdle =3D destroyWhenIdle.bo= oleanValue(); = @@ -202,11 +204,11 @@ Response.ResponseBuilder builder =3D Response.created(location.bu= ild()); if (autoAck) { - SubscriptionResource.setConsumeNextLink(serviceManager.getLink= Strategy(), builder, uriInfo, uriInfo.getMatchedURIs().get(1) + "/auto-ack/= " + consumer.getId(), "-1"); + QueueConsumer.setConsumeNextLink(serviceManager.getLinkStrateg= y(), builder, uriInfo, uriInfo.getMatchedURIs().get(1) + "/auto-ack/" + con= sumer.getId(), "-1"); } else { - AcknowledgedSubscriptionResource.setAcknowledgeNextLink(servic= eManager.getLinkStrategy(), builder, uriInfo, uriInfo.getMatchedURIs().get(= 1) + "/acknowledged/" + consumer.getId(), "-1"); + AcknowledgedQueueConsumer.setAcknowledgeNextLink(serviceManage= r.getLinkStrategy(), builder, uriInfo, uriInfo.getMatchedURIs().get(1) + "/= acknowledged/" + consumer.getId(), "-1"); = } return builder.build(); @@ -425,7 +427,6 @@ if (consumer =3D=3D null) { String msg =3D "Failed to match a subscription to URL " + consume= rId; - //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/ut= il/HttpMessageHelper.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/util/Htt= pMessageHelper.java 2012-01-09 11:43:40 UTC (rev 12005) +++ trunk/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/util/Htt= pMessageHelper.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 Bill Burke * @version $Revision: 1 $ @@ -116,11 +118,12 @@ { = MultivaluedMap hdrs =3D headers.getRequestHeaders(); - for (String key : hdrs.keySet()) + for (Entry> entry : hdrs.entrySet()) { + String key =3D entry.getKey(); if (isTransferableHttpHeader(key)) { - List vals =3D hdrs.get(key); + List vals =3D entry.getValue(); String value =3D concatenateHeaderValue(vals); message.putStringProperty(HttpHeaderProperty.toPropertyName(ke= y), value); } @@ -132,21 +135,12 @@ public static String concatenateHeaderValue(List vals) { if (vals =3D=3D null) return ""; - StringBuffer val =3D null; + StringBuilder val =3D new StringBuilder(); for (String v : vals) { - if (val =3D=3D null) - { - val =3D new StringBuffer(v); - } - else - { val.append(",").append(v); - } } - String value =3D ""; - if (val !=3D null) value =3D val.toString(); - return value; + return val.toString(); } = } --===============1106729114574961521==--