[jboss-svn-commits] JBL Code SVN: r15756 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Oct 11 11:13:08 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-10-11 11:13:08 -0400 (Thu, 11 Oct 2007)
New Revision: 15756
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
Log:
JBESB-1137, adding code for backwards compatibility, in case the we find EPRs that are still URLEncoded, which maybe coming from nodes running older versions of JBossESB
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java 2007-10-11 15:11:42 UTC (rev 15755)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java 2007-10-11 15:13:08 UTC (rev 15756)
@@ -21,7 +21,9 @@
*/
package org.jboss.internal.soa.esb.services.registry;
+import java.io.UnsupportedEncodingException;
import java.net.PasswordAuthentication;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -237,9 +239,21 @@
service.addServiceBindings(serviceBindings);
for (Iterator i=serviceBindings.iterator();i.hasNext();){
ServiceBinding serviceBinding = (ServiceBinding) i.next();
- String xml = serviceBinding.getAccessURI().trim();
+ String eprXML = serviceBinding.getAccessURI().trim();
+ // for backwards compatibility still have the decoder if
+ // unmarchalling fails
+ try {
+ EPR epr = EPRHelper.fromXMLString(eprXML);
+ } catch (UnmarshalException unme) {
+ try {
+ eprXML = URLDecoder.decode(eprXML, "UTF-8").trim();
+ } catch (UnsupportedEncodingException ue) {
+ logger.error(unme.getMessage(), unme);
+ logger.error(ue.getMessage(), ue);
+ }
+ }
String toBeDeletedEPRXml = EPRHelper.toXMLString(toBeDeletedEPR).trim();
- if (xml.equals(toBeDeletedEPRXml)) {
+ if (eprXML.equals(toBeDeletedEPRXml)) {
RegistryService rs = connection.getRegistryService();
BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
Collection<Key> serviceBindingKeys = new ArrayList<Key>();
@@ -318,8 +332,22 @@
ServiceBinding serviceBinding = (ServiceBinding) i.next();
@SuppressWarnings("unused")
String eprXML = serviceBinding.getAccessURI();
- EPR epr = EPRHelper.fromXMLString(eprXML);
- eprs.add(epr);
+ EPR epr = null;
+ //for backwards compatibility still have the decoder if
+ //unmarchalling fails
+ try {
+ epr = EPRHelper.fromXMLString(eprXML);
+ eprs.add(epr);
+ } catch (UnmarshalException unme) {
+ try {
+ eprXML = URLDecoder.decode(eprXML, "UTF-8");
+ epr = EPRHelper.fromXMLString(eprXML);
+ eprs.add(epr);
+ } catch (UnsupportedEncodingException ue) {
+ logger.error(ue.getMessage(), ue);
+ throw new UnmarshalException(ue.getMessage(), ue);
+ }
+ }
}
} catch (JAXRException je) {
throw new RegistryException(je.getLocalizedMessage(), je);
@@ -349,7 +377,19 @@
if (serviceBindings.iterator().hasNext()) {
ServiceBinding serviceBinding = (ServiceBinding) serviceBindings.iterator().next();
String eprXML = serviceBinding.getAccessURI();
- epr = EPRHelper.fromXMLString(eprXML);
+ // for backwards compatibility still have the decoder if
+ // unmarchalling fails
+ try {
+ epr = EPRHelper.fromXMLString(eprXML);
+ } catch (UnmarshalException unme) {
+ try {
+ eprXML = URLDecoder.decode(eprXML, "UTF-8");
+ epr = EPRHelper.fromXMLString(eprXML);
+ } catch (UnsupportedEncodingException ue) {
+ logger.error(ue.getMessage(), ue);
+ throw new UnmarshalException(ue.getMessage(), ue);
+ }
+ }
}
} catch (JAXRException je) {
throw new RegistryException(je.getLocalizedMessage(), je);
More information about the jboss-svn-commits
mailing list