Skip to content
Browse files

SWITCHYARD-1904 Fix findbugs issues and provide exceptions

  • Loading branch information...
1 parent e177b7e commit d8826c807ab5fc48a1a03548d0bf7ea9ed4c859e @cunningt cunningt committed
Showing with 111 additions and 71 deletions.
  1. +1 −1 bean/src/main/java/org/switchyard/component/bean/Invocation.java
  2. +1 −1 bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELActivator.java
  3. +5 −5 bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELComponent.java
  4. +4 −5 bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawBPELExchangeHandler.java
  5. +5 −5 bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawServiceLocator.java
  6. +5 −3 ...amel-atom/src/main/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomBindingModel.java
  7. +10 −6 ...mel-core/src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelTimerBindingModel.java
  8. +9 −5 ...uartz/src/main/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzBindingModel.java
  9. +2 −1 camel/camel-switchyard/src/main/java/org/switchyard/component/camel/SwitchYardConsumer.java
  10. +1 −0 camel/camel-switchyard/src/main/java/org/switchyard/component/camel/SwitchYardProducer.java
  11. +5 −1 common/camel/src/main/java/org/switchyard/component/camel/common/handler/OutboundHandler.java
  12. +1 −1 common/camel/src/main/java/org/switchyard/component/camel/common/model/v1/V1BaseCamelModel.java
  13. +1 −1 ...ge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java
  14. +6 −1 common/knowledge/src/main/java/org/switchyard/component/common/knowledge/util/Listeners.java
  15. +1 −1 http/src/main/java/org/switchyard/component/http/HttpGatewayServlet.java
  16. +1 −1 http/src/main/java/org/switchyard/component/http/composer/HttpContextMapper.java
  17. +10 −2 http/src/main/java/org/switchyard/component/http/endpoint/StandaloneEndpoint.java
  18. +1 −1 http/src/main/java/org/switchyard/component/http/endpoint/StandaloneEndpointPublisher.java
  19. +8 −4 jca/src/main/java/org/switchyard/component/jca/composer/JMSMessageComposer.java
  20. +5 −1 jca/src/main/java/org/switchyard/component/jca/processor/cci/RecordHandlerFactory.java
  21. +1 −1 jca/src/main/java/org/switchyard/component/jca/processor/cci/StreamableRecord.java
  22. +1 −1 jca/src/main/java/org/switchyard/component/jca/selector/JMSOperationSelector.java
  23. +8 −2 soap/src/main/java/org/switchyard/component/soap/InboundHandler.java
  24. +0 −5 soap/src/main/java/org/switchyard/component/soap/OutboundHandler.java
  25. +1 −1 soap/src/main/java/org/switchyard/component/soap/composer/SOAPContextMapper.java
  26. +2 −3 soap/src/main/java/org/switchyard/component/soap/composer/SOAPMessageComposer.java
  27. +8 −2 test/mixins/amqp/src/main/java/org/switchyard/test/mixins/amqp/AMQPMixIn.java
  28. +3 −0 test/mixins/http/src/main/java/org/switchyard/component/test/mixins/http/HTTPMixIn.java
  29. +5 −1 test/mixins/naming/src/main/java/org/switchyard/component/test/mixins/naming/NamingMixIn.java
  30. +0 −9 tools/forge/bean/src/main/java/org/switchyard/tools/forge/bean/BeanReferencePlugin.java
View
2 bean/src/main/java/org/switchyard/component/bean/Invocation.java
@@ -104,7 +104,7 @@ private void assertTypesMatch() throws BeanComponentException {
}
} else {
if (_args.length > 1) {
- throw BeanMessages.MESSAGES.beanServiceOperationSupportsSingle(operationName(), new String("" + _args.length));
+ throw BeanMessages.MESSAGES.beanServiceOperationSupportsSingle(operationName(), Integer.toString(_args.length));
}
if (_args[0] != null) {
View
2 bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELActivator.java
@@ -83,7 +83,7 @@ public ServiceHandler activateService(QName serviceName, ComponentModel config)
}
}
- if (service.getInterface() == null) {
+ if ((service == null) || (service.getInterface() == null)) {
throw BPELMessages.MESSAGES.interfaceNotDefinedForComponentWithBPELImplementation();
}
View
10 bpel/src/main/java/org/switchyard/component/bpel/deploy/BPELComponent.java
@@ -34,7 +34,7 @@
private static final Logger LOG = Logger.getLogger(BPELComponent.class);
- private static BPELEngine _engine=null;
+ private static BPELEngine _engine = null;
private static java.util.Properties _config=null;
private static RiftsawServiceLocator _locator=new RiftsawServiceLocator();
private static boolean _initialized=false;
@@ -145,15 +145,15 @@ public void destroy() {
super.destroy();
BPELLogger.ROOT_LOGGER.destroyBPELComponent();
-
if (_engine != null) {
try {
- _engine.close();
- _engine = null;
+ synchronized (_engine) {
+ _engine.close();
+ _engine = null;
+ }
} catch (Exception e) {
BPELLogger.ROOT_LOGGER.failedToCloseBPELEngine(e);
}
-
}
}
View
9 bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawBPELExchangeHandler.java
@@ -18,7 +18,6 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
@@ -288,10 +287,10 @@ public void handleMessage(final Exchange exchange) throws HandlerException {
reply.setContent(WSDLHelper.unwrapMessagePart(response));
// Set header parts for a response message
- Set<String> keys = headers.keySet(); // headers are set by invoke method !!!
- for (String key : keys) {
- exchange.getContext(reply).setProperty(key, headers.get(key)).addLabels(EndpointLabel.SOAP.label());
- }
+ for (Map.Entry<String, Object> e : headers.entrySet()) {
+ exchange.getContext(reply).setProperty(e.getKey(),
+ headers.get(e.getKey())).addLabels(EndpointLabel.SOAP.label());
+ }
exchange.send(reply);
}
View
10 bpel/src/main/java/org/switchyard/component/bpel/riftsaw/RiftsawServiceLocator.java
@@ -15,7 +15,6 @@
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPFault;
@@ -254,11 +253,12 @@ public Element invoke(String operationName, Element mesg,
Message req = exchange.createMessage();
req.setContent(node);
if (headers != null) {
- Set<String> keys = headers.keySet();
- for (String key : keys) {
- exchange.getContext(req).setProperty(key,headers.get(key)).addLabels(EndpointLabel.SOAP.label());
+
+ for (Map.Entry<String, Object> e : headers.entrySet()) {
+ exchange.getContext(req).setProperty(e.getKey(), headers.get(e.getKey())).addLabels(EndpointLabel.SOAP.label());
+
}
-
+
// Clear the headers in preparation for response headers
headers.clear();
}
View
8 ...m/src/main/java/org/switchyard/component/camel/atom/model/v1/V1CamelAtomBindingModel.java
@@ -52,7 +52,7 @@
private CamelScheduledPollConsumer _consume;
// Used for dateTime fields
- private static DateFormat _dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+ private static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
/**
* Create a new AtomBindingModel.
@@ -92,12 +92,14 @@ public V1CamelAtomBindingModel setFeedURI(URI uri) {
@Override
public Date getLastUpdate() {
- return getDateConfig(LAST_UPDATE, _dateFormat);
+ final DateFormat lastUpdateDateFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(LAST_UPDATE, lastUpdateDateFormat);
}
@Override
public V1CamelAtomBindingModel setLastUpdate(Date date) {
- setConfig(LAST_UPDATE, _dateFormat.format(date));
+ final DateFormat lastUpdateDateFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ setConfig(LAST_UPDATE, lastUpdateDateFormat.format(date));
return this;
}
View
16 .../src/main/java/org/switchyard/component/camel/core/model/v1/V1CamelTimerBindingModel.java
@@ -36,7 +36,12 @@
* Camel endpoint type.
*/
public static final String TIMER = "timer";
-
+
+ /**
+ * Date format string.
+ */
+ public static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
+
/**
* Camel endpoint configuration values.
*/
@@ -48,9 +53,6 @@
private static final String FIXED_RATE = "fixedRate";
private static final String DAEMON = "daemon";
- // Used for dateTime fields
- private static DateFormat _dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
-
/**
* Create a new CamelTimerBindingModel.
* @param namespace namespace
@@ -83,12 +85,14 @@ public V1CamelTimerBindingModel setTimerName(String name) {
@Override
public Date getTime() {
- return getDateConfig(TIME, _dateFormat);
+ final DateFormat dateConfigFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(TIME, dateConfigFormat);
}
@Override
public V1CamelTimerBindingModel setTime(Date time) {
- return setConfig(TIME, _dateFormat.format(time));
+ final DateFormat timeDateFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return setConfig(TIME, timeDateFormat.format(time));
}
@Override
View
14 ...c/main/java/org/switchyard/component/camel/quartz/model/v1/V1CamelQuartzBindingModel.java
@@ -42,7 +42,7 @@
private static final String TIMEZONE = "trigger.timeZone";
// Used for dateTime fields
- private static DateFormat _dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+ private static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
/**
* Create a new CamelQuartzBindingModel.
@@ -96,22 +96,26 @@ public V1CamelQuartzBindingModel setStateful(Boolean stateful) {
@Override
public Date getStartTime() {
- return getDateConfig(START_TIME, _dateFormat);
+ DateFormat startTimeFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(START_TIME, startTimeFormat);
}
@Override
public V1CamelQuartzBindingModel setStartTime(Date startTime) {
- return setConfig(START_TIME, _dateFormat.format(startTime));
+ DateFormat startTimeForamt = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return setConfig(START_TIME, startTimeForamt.format(startTime));
}
@Override
public Date getEndTime() {
- return getDateConfig(END_TIME, _dateFormat);
+ DateFormat endTimeFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return getDateConfig(END_TIME, endTimeFormat);
}
@Override
public V1CamelQuartzBindingModel setEndTime(Date endTime) {
- return setConfig(END_TIME, _dateFormat.format(endTime));
+ DateFormat endTimeFormat = new SimpleDateFormat(DATE_FORMAT_STRING);
+ return setConfig(END_TIME, endTimeFormat.format(endTime));
}
@Override
View
3 camel/camel-switchyard/src/main/java/org/switchyard/component/camel/SwitchYardConsumer.java
@@ -116,7 +116,8 @@ public void handleMessage(final Exchange switchyardExchange) throws HandlerExcep
} else if (camelFault instanceof Throwable) {
throw new HandlerException(Throwable.class.cast(camelFault));
} else {
- throw SwitchYardCamelComponentMessages.MESSAGES.camelExchangeFailedWithoutException(camelFault.toString());
+ String faultMessage = (camelFault == null) ? null : camelFault.toString();
+ throw SwitchYardCamelComponentMessages.MESSAGES.camelExchangeFailedWithoutException(faultMessage);
}
}
} else {
View
1 camel/camel-switchyard/src/main/java/org/switchyard/component/camel/SwitchYardProducer.java
@@ -185,6 +185,7 @@ private Exchange createSwitchyardExchange(final org.apache.camel.Exchange camelE
String opName = lookupOperationNameFor(camelExchange, serviceRef);
CamelResponseHandler handler = new CamelResponseHandler(camelExchange, serviceRef, messageComposer);
+
if (opName != null) {
return serviceRef.createExchange(opName, handler);
} else {
View
6 ...on/camel/src/main/java/org/switchyard/component/camel/common/handler/OutboundHandler.java
@@ -183,7 +183,11 @@ private void handleInOut(final Exchange switchyardExchange) throws HandlerExcept
} else if (camelFault instanceof Throwable) {
throw new HandlerException(Throwable.class.cast(camelFault));
} else {
- throw CommonCamelMessages.MESSAGES.camelExchangeFailedWithoutAnException(camelFault.toString());
+ if (camelFault == null) {
+ throw CommonCamelMessages.MESSAGES.camelExchangeFailedWithoutAnException("");
+ } else {
+ throw CommonCamelMessages.MESSAGES.camelExchangeFailedWithoutAnException(camelFault.toString());
+ }
}
}
}
View
2 .../camel/src/main/java/org/switchyard/component/camel/common/model/v1/V1BaseCamelModel.java
@@ -48,7 +48,7 @@ protected final Integer getIntegerConfig(String configName) {
protected final Boolean getBooleanConfig(String configName) {
String value = getConfig(configName);
- return value != null ? Boolean.valueOf(value) : null;
+ return value != null ? Boolean.valueOf(value) : Boolean.FALSE;
}
protected final Long getLongConfig(String configName) {
View
2 ...ain/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java
@@ -288,7 +288,7 @@ protected Boolean getBoolean(Exchange exchange, Message message, String name) {
} else if (value instanceof String) {
return Boolean.valueOf(((String)value).trim());
}
- return null;
+ return false;
}
/**
View
7 common/knowledge/src/main/java/org/switchyard/component/common/knowledge/util/Listeners.java
@@ -16,6 +16,7 @@
import java.lang.reflect.Constructor;
import java.util.EventListener;
+import org.jboss.logging.Logger;
import org.kie.api.event.KieRuntimeEventManager;
import org.kie.api.event.kiebase.KieBaseEventListener;
import org.kie.api.event.process.ProcessEventListener;
@@ -41,7 +42,8 @@
*/
@SuppressWarnings("deprecation")
public final class Listeners {
-
+ private static final Logger LOG = Logger.getLogger(Listeners.class);
+
private static final Class<?>[][] PARMAMETER_TYPES = new Class<?>[][]{
new Class<?>[]{KieRuntimeEventManager.class}, // current (kie)
new Class<?>[]{KieRuntime.class}, // current (kie)
@@ -96,6 +98,9 @@ private static void registerListener(Class<? extends EventListener> listenerClas
} else if (parameterTypes.length == 1) {
// automatic registration
listener = Construction.construct(listenerClass, parameterTypes, new Object[]{manager});
+ if (listener == null) {
+ LOG.debug("Attempt to register listener returned null");
+ }
}
} catch (Throwable t) {
throw CommonKnowledgeMessages.MESSAGES.couldNotInstantiateListenerClass(listenerClass.getName());
View
2 http/src/main/java/org/switchyard/component/http/HttpGatewayServlet.java
@@ -155,7 +155,7 @@ public void handle(HttpServletRequest request, HttpServletResponse response) thr
response.setStatus(httpResponse.getStatus());
httpResponse.writeBodyToStream(response.getOutputStream());
} else {
- if ((httpResponse != null) && (httpResponse.getStatus() != null)) {
+ if (httpResponse.getStatus() != null) {
response.setStatus(httpResponse.getStatus());
} else {
// Consider it as a One-Way MEP
View
2 http/src/main/java/org/switchyard/component/http/composer/HttpContextMapper.java
@@ -82,7 +82,7 @@ public void mapTo(Context context, HttpBindingData target) throws Exception {
if (HTTP_RESPONSE_STATUS.equalsIgnoreCase(name) && (target instanceof HttpResponseBindingData)) {
HttpResponseBindingData response = (HttpResponseBindingData)target;
if (value instanceof String) {
- response.setStatus(Integer.valueOf((String) value).intValue());
+ response.setStatus(Integer.parseInt((String) value));
} else if (value instanceof Integer) {
response.setStatus((Integer) value);
}
View
12 http/src/main/java/org/switchyard/component/http/endpoint/StandaloneEndpoint.java
@@ -32,16 +32,24 @@
*/
public StandaloneEndpoint(final HttpContext context) {
_httpContext = context;
- _contextCount++;
+ incrementContextCount();
}
+ private synchronized void incrementContextCount() {
+ _contextCount++;
+ }
+
+ private synchronized void decrementContextCount() {
+ _contextCount--;
+ }
+
/**
* {@inheritDoc}
*/
public void stop() {
if (_httpContext != null) {
_httpContext.getServer().removeContext(_httpContext);
- _contextCount--;
+ decrementContextCount();
}
}
}
View
2 http/src/main/java/org/switchyard/component/http/endpoint/StandaloneEndpointPublisher.java
@@ -119,7 +119,7 @@ public void handle(HttpExchange exchange) {
exchange.sendResponseHeaders(httpResponse.getStatus(), httpResponse.getBodyBytes().available());
httpResponse.writeBodyToStream(exchange.getResponseBody());
} else {
- if ((httpResponse != null) && (httpResponse.getStatus() != null)) {
+ if (httpResponse.getStatus() != null) {
exchange.sendResponseHeaders(httpResponse.getStatus(), 0);
} else {
exchange.sendResponseHeaders(HttpServletResponse.SC_ACCEPTED, 0);
View
12 jca/src/main/java/org/switchyard/component/jca/composer/JMSMessageComposer.java
@@ -17,7 +17,9 @@
import java.io.Serializable;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import javax.jms.BytesMessage;
import javax.jms.MapMessage;
@@ -50,7 +52,7 @@
if (jmsMessage instanceof BytesMessage) {
BytesMessage sourceBytes = BytesMessage.class.cast(jmsMessage);
if (sourceBytes.getBodyLength() > Integer.MAX_VALUE) {
- throw JCAMessages.MESSAGES.theSizeOfMessageContentExceedsBytesThatIsNotSupportedByThisMessageComposer(new String("" + Integer.MAX_VALUE));
+ throw JCAMessages.MESSAGES.theSizeOfMessageContentExceedsBytesThatIsNotSupportedByThisMessageComposer("" + Integer.MAX_VALUE);
}
byte[] bytearr = new byte[(int)sourceBytes.getBodyLength()];
sourceBytes.readBytes(bytearr);
@@ -128,9 +130,11 @@ public JMSBindingData decompose(Exchange exchange, JMSBindingData target) throws
} else if (jmsMessage instanceof MapMessage) {
MapMessage msg = MapMessage.class.cast(jmsMessage);
Map<?,?> map = syMessage.getContent(Map.class);
- for (Object key : map.keySet()) {
- msg.setObject(key.toString(), map.get(key));
- }
+ Iterator entries = (Iterator)map.entrySet().iterator();
+ while (entries.hasNext()) {
+ Entry<?,?> entry = (Entry<?, ?>) entries.next();
+ msg.setObject((String) entry.getKey(), entry.getValue());
+ }
}
return target;
}
View
6 jca/src/main/java/org/switchyard/component/jca/processor/cci/RecordHandlerFactory.java
@@ -49,8 +49,12 @@ private RecordHandlerFactory() {
try {
Class<?> clazz = loader.loadClass(RecordHandlerFactory.class.getPackage().getName() + "." + recordType.getSimpleName() + "RecordHandler");
return (RecordHandler<?>)clazz.newInstance();
- } catch (Exception e) {
+ } catch (ClassNotFoundException e) {
throw JCAMessages.MESSAGES.recordTypeIsNotSupported(recordType.getName());
+ } catch (InstantiationException e) {
+ throw JCAMessages.MESSAGES.recordTypeIsNotSupported(recordType.getName());
+ } catch (IllegalAccessException iae) {
+ throw JCAMessages.MESSAGES.recordTypeIsNotSupported(recordType.getName());
}
}
}
View
2 jca/src/main/java/org/switchyard/component/jca/processor/cci/StreamableRecord.java
@@ -70,7 +70,7 @@ public void write(OutputStream out) throws IOException {
@Override
public Object clone() throws CloneNotSupportedException {
- StreamableRecord clone = new StreamableRecord();
+ StreamableRecord clone = (StreamableRecord) super.clone();
clone._recordName = _recordName;
clone._recordShortDescription = _recordShortDescription;
if (_bytes != null) {
View
2 jca/src/main/java/org/switchyard/component/jca/selector/JMSOperationSelector.java
@@ -63,7 +63,7 @@ protected String extractString(JMSBindingData binding) throws Exception {
} else if (content instanceof BytesMessage) {
BytesMessage sourceBytes = BytesMessage.class.cast(content);
if (sourceBytes.getBodyLength() > Integer.MAX_VALUE) {
- throw JCAMessages.MESSAGES.theSizeOfMessageContentExceedsBytesThatIsNotSupportedByThisOperationSelector(new String("" + Integer.MAX_VALUE));
+ throw JCAMessages.MESSAGES.theSizeOfMessageContentExceedsBytesThatIsNotSupportedByThisOperationSelector("" + Integer.MAX_VALUE);
}
byte[] bytearr = new byte[(int)sourceBytes.getBodyLength()];
sourceBytes.readBytes(bytearr);
View
10 soap/src/main/java/org/switchyard/component/soap/InboundHandler.java
@@ -395,8 +395,14 @@ private void assertComposedMessageOK(Message soapMessage, Operation operation) t
expectedPayloadType = new QName(_targetNamespace, operation.getName());
}
- String expectedNS = expectedPayloadType.getNamespaceURI();
- String expectedLN = expectedPayloadType.getLocalPart();
+ String expectedNS = null;
+ String expectedLN = null;
+
+ if (expectedPayloadType != null) {
+ expectedNS = expectedPayloadType.getNamespaceURI();
+ expectedLN = expectedPayloadType.getLocalPart();
+
+ }
if (!_documentStyle) {
expectedLN = operation.getName();
}
View
5 soap/src/main/java/org/switchyard/component/soap/OutboundHandler.java
@@ -240,7 +240,6 @@ public void handleMessage(final Exchange exchange) throws HandlerException {
SOAPMessage request;
Boolean oneWay = false;
- Boolean replyToSet = false;
String action = null;
try {
request = _messageComposer.decompose(exchange, new SOAPBindingData(SOAPUtil.createMessage(_bindingId))).getSOAPMessage();
@@ -253,10 +252,6 @@ public void handleMessage(final Exchange exchange) throws HandlerException {
Context context = exchange.getContext();
_dispatcher.getRequestContext().put(SOAPUtil.SWITCHYARD_CONTEXT, context);
// It is a one way if a replyto address is set
- if ((exchange.getContext().getPropertyValue(SOAPUtil.WSA_REPLYTO_STR) != null)
- || (exchange.getContext().getPropertyValue(SOAPUtil.WSA_REPLYTO_STR.toLowerCase()) != null)) {
- replyToSet = true;
- }
String toAddress = SOAPUtil.getToAddress(exchange.getContext());
if (toAddress != null) {
_dispatcher.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, toAddress);
View
2 soap/src/main/java/org/switchyard/component/soap/composer/SOAPContextMapper.java
@@ -166,7 +166,7 @@ public void mapTo(Context context, SOAPBindingData target) throws Exception {
} else if (matches(name) || property.hasLabel(EndpointLabel.HTTP.label())) {
if (HTTP_RESPONSE_STATUS.equalsIgnoreCase(name)) {
if (value instanceof String) {
- target.setStatus(Integer.valueOf((String) value).intValue());
+ target.setStatus(Integer.parseInt((String) value));
} else if (value instanceof Integer) {
target.setStatus((Integer) value);
}
View
5 soap/src/main/java/org/switchyard/component/soap/composer/SOAPMessageComposer.java
@@ -80,7 +80,6 @@
public Message compose(SOAPBindingData source, Exchange exchange) throws Exception {
final SOAPMessage soapMessage = source.getSOAPMessage();
final Message message = exchange.createMessage();
- final Boolean input = exchange.getPhase() == null;
getContextMapper().mapFrom(source, exchange.getContext(message));
final SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
@@ -187,8 +186,8 @@ public Message compose(SOAPBindingData source, Exchange exchange) throws Excepti
throw (SOAPException) ex;
}
throw new SOAPException(ex);
- }
-
+ }
+
return message;
}
View
10 test/mixins/amqp/src/main/java/org/switchyard/test/mixins/amqp/AMQPMixIn.java
@@ -14,6 +14,7 @@
package org.switchyard.test.mixins.amqp;
import java.io.File;
+import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
@@ -95,8 +96,13 @@
*/
public AMQPMixIn() throws Exception {
_properties = new Properties();
- _properties.load(this.getClass().getResourceAsStream(AMQP_PROPERTIES_FILE));
- _qpidConnectionFactory = _properties.getProperty(AMQP_PROPS_QPID_CONNECTIONFACTORY);
+ InputStream is = this.getClass().getResourceAsStream(AMQP_PROPERTIES_FILE);
+ try {
+ _properties.load(is);
+ _qpidConnectionFactory = _properties.getProperty(AMQP_PROPS_QPID_CONNECTIONFACTORY);
+ } finally {
+ is.close();
+ }
if (_qpidConnectionFactory == null) {
throw new SwitchYardException("No connection factory configured. Please set "+ AMQP_PROPS_QPID_CONNECTIONFACTORY
+ " in the "+AMQP_PROPERTIES_FILE+" file found in the class path of your application");
View
3 test/mixins/http/src/main/java/org/switchyard/component/test/mixins/http/HTTPMixIn.java
@@ -317,6 +317,9 @@ public String postResource(String endpointURL, String requestResource) {
try {
HttpResponse httpResponse = postResourceAndGetMethod(endpointURL, requestResource);
int status = httpResponse.getStatusLine().getStatusCode();
+ if (_logger.isDebugEnabled()) {
+ _logger.debug("Response returned status code " + status);
+ }
response = EntityUtils.toString(httpResponse.getEntity());
} catch (IOException ioe) {
_logger.error("Unable to get response", ioe);
View
6 .../mixins/naming/src/main/java/org/switchyard/component/test/mixins/naming/NamingMixIn.java
@@ -38,7 +38,7 @@
/**
* Instance of context shared with children classes.
*/
- private static InitialContext initialContext;
+ private static InitialContext initialContext = null;
@Override
public void initialize() {
@@ -59,6 +59,10 @@ public Context getContext(String identifier) {
}
});
+ setInitialContext();
+ }
+
+ private synchronized void setInitialContext() {
if (initialContext == null) {
try {
initialContext = new InitialContext();
View
9 tools/forge/bean/src/main/java/org/switchyard/tools/forge/bean/BeanReferencePlugin.java
@@ -25,7 +25,6 @@
import org.jboss.forge.project.facets.JavaSourceFacet;
import org.jboss.forge.project.facets.MetadataFacet;
import org.jboss.forge.resources.java.JavaResource;
-import org.jboss.forge.shell.PromptType;
import org.jboss.forge.shell.Shell;
import org.jboss.forge.shell.ShellColor;
import org.jboss.forge.shell.plugins.Alias;
@@ -82,14 +81,6 @@ public void newReference(
final String referenceBeanName,
final PipeOut out)
throws java.io.IOException {
-
- String pkgName = _project.getFacet(MetadataFacet.class).getTopLevelPackage();
-
- if (pkgName == null) {
- pkgName = _shell.promptCommon(
- "Java package for service interface and implementation:",
- PromptType.JAVA_PACKAGE);
- }
final MetadataFacet meta = _project.getFacet(MetadataFacet.class);
final JavaSourceFacet java = _project.getFacet(JavaSourceFacet.class);

0 comments on commit d8826c8

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