[jboss-svn-commits] JBL Code SVN: r38116 - labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/filter.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jun 6 23:46:34 EDT 2012
Author: tcunning
Date: 2012-06-06 23:46:32 -0400 (Wed, 06 Jun 2012)
New Revision: 38116
Modified:
labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/ServiceRouteFilter.java
Log:
JBESB-3815
Fix ClassCastException by adding a cast to ConfigTree and add address of server to the route.
Modified: labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/ServiceRouteFilter.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/ServiceRouteFilter.java 2012-05-31 14:18:19 UTC (rev 38115)
+++ labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/ServiceRouteFilter.java 2012-06-07 03:46:32 UTC (rev 38116)
@@ -23,6 +23,8 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.Map;
import org.jboss.soa.esb.common.Environment;
@@ -36,29 +38,41 @@
import org.xml.sax.SAXException;
public class ServiceRouteFilter extends InputOutputFilter {
+ private String address = "127.0.0.1";
+
private void startRoute(Message message, String serviceCategory, String serviceName) {
+ try {
+ address = InetAddress.getLocalHost().getHostName();
+ } catch (final UnknownHostException uhe) {
+ }
+
String route = (String) message.getContext().getContext(Environment.MESSAGE_SERVICE_ROUTE);
if (route == null) {
message.getContext().setContext(Environment.MESSAGE_SERVICE_ROUTE,
- serviceCategory + ":" + serviceName);
+ address + ":" + serviceCategory + ":" + serviceName);
} else {
message.getContext().removeContext(Environment.MESSAGE_SERVICE_ROUTE);
message.getContext().setContext(Environment.MESSAGE_SERVICE_ROUTE,
- route + ", " + serviceCategory + ":" + serviceName + " started");
+ route + ", " + address + ":" + serviceCategory + ":" + serviceName + " started");
}
}
private void endRoute(Message message, String serviceCategory, String serviceName) {
+ try {
+ address = InetAddress.getLocalHost().getHostName();
+ } catch (final UnknownHostException uhe) {
+ }
+
String route = (String) message.getContext().getContext(Environment.MESSAGE_SERVICE_ROUTE);
if (route == null) {
message.getContext().setContext(Environment.MESSAGE_SERVICE_ROUTE,
- serviceCategory + ":" + serviceName);
+ address + ":" + serviceCategory + ":" + serviceName);
} else {
message.getContext().removeContext(Environment.MESSAGE_SERVICE_ROUTE);
message.getContext().setContext(Environment.MESSAGE_SERVICE_ROUTE,
- route + ", " + serviceCategory + ":" + serviceName + " ended");
+ route + ", " + address + ":" + serviceCategory + ":" + serviceName + " ended");
}
}
@@ -72,13 +86,17 @@
ConfigTree config = null;
if (params != null) {
- String gatewayConfig = (String) params.get(Environment.GATEWAY_CONFIG);
- try {
- config = ConfigTree.fromInputStream(new ByteArrayInputStream(gatewayConfig.getBytes()));
- } catch (SAXException e) {
- throw new CourierException(e);
- } catch (IOException e) {
- throw new CourierException(e);
+ if (params.get(Environment.GATEWAY_CONFIG) instanceof ConfigTree) {
+ config = (ConfigTree) params.get(Environment.GATEWAY_CONFIG);
+ } else {
+ String gatewayConfig = (String) params.get(Environment.GATEWAY_CONFIG);
+ try {
+ config = ConfigTree.fromInputStream(new ByteArrayInputStream(gatewayConfig.getBytes()));
+ } catch (SAXException e) {
+ throw new CourierException(e);
+ } catch (IOException e) {
+ throw new CourierException(e);
+ }
}
}
@@ -111,13 +129,17 @@
ConfigTree config = null;
if (params != null) {
- String gatewayConfig = (String) params.get(Environment.GATEWAY_CONFIG);
- try {
- config = ConfigTree.fromInputStream(new ByteArrayInputStream(gatewayConfig.getBytes()));
- } catch (SAXException e) {
- throw new CourierException(e);
- } catch (IOException e) {
- throw new CourierException(e);
+ if (params.get(Environment.GATEWAY_CONFIG) instanceof ConfigTree) {
+ config = (ConfigTree) params.get(Environment.GATEWAY_CONFIG);
+ } else {
+ String gatewayConfig = (String) params.get(Environment.GATEWAY_CONFIG);
+ try {
+ config = ConfigTree.fromInputStream(new ByteArrayInputStream(gatewayConfig.getBytes()));
+ } catch (SAXException e) {
+ throw new CourierException(e);
+ } catch (IOException e) {
+ throw new CourierException(e);
+ }
}
}
More information about the jboss-svn-commits
mailing list