diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-08 21:10:26 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-08 21:10:26 +0000 |
commit | 2a3b526e7e27cd5f9f358c2a0d8204d4804e6dba (patch) | |
tree | 34512f4b57c2c9946ca87d070f3ba2f530d48a2a /java/sca/modules | |
parent | e28a7264f7f3b0ee2331920dbbfa750a25b64a45 (diff) |
Fix the lookup issue with SUN JDKs
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@674957 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
3 files changed, 24 insertions, 7 deletions
diff --git a/java/sca/modules/host-corba-jdk/src/main/java/org/apache/tuscany/sca/host/corba/jdk/DefaultCorbaHost.java b/java/sca/modules/host-corba-jdk/src/main/java/org/apache/tuscany/sca/host/corba/jdk/DefaultCorbaHost.java index dc748b3e9f..9bba7b289e 100644 --- a/java/sca/modules/host-corba-jdk/src/main/java/org/apache/tuscany/sca/host/corba/jdk/DefaultCorbaHost.java +++ b/java/sca/modules/host-corba-jdk/src/main/java/org/apache/tuscany/sca/host/corba/jdk/DefaultCorbaHost.java @@ -163,10 +163,12 @@ public class DefaultCorbaHost implements CorbaHost { public Object lookup(String uri) throws CorbaHostException { Object result = null; try { - ORB orb = ORB.init(new String[0], null); - result = orb.string_to_object(uri); + CorbanameURL url = new CorbanameURL(uri); + ORB orb = createORB(url.getHost(), url.getPort(), false); + NamingContextExt context = getNamingContext(orb, url.getNameService()); + result = context.resolve_str(url.getName()); } catch (Exception e) { - e.printStackTrace(); + // e.printStackTrace(); handleException(e); } if (result == null) { diff --git a/java/sca/modules/host-corba-jdk/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java b/java/sca/modules/host-corba-jdk/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java index d798397636..1fa2e241f5 100644 --- a/java/sca/modules/host-corba-jdk/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java +++ b/java/sca/modules/host-corba-jdk/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java @@ -188,9 +188,10 @@ public class DefaultCorbaHostTestCase { host.lookup(getURI("NonExistingOne", LOCALHOST, DEFAULT_PORT)); fail(); } catch (CorbaHostException e) { - assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT)); + // The message is JDK-specific + // assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT)); } catch (Exception e) { - e.printStackTrace(); + // e.printStackTrace(); fail(); } @@ -199,7 +200,7 @@ public class DefaultCorbaHostTestCase { host.lookup("NonExistingOne", LOCALHOST, DEFAULT_PORT); fail(); } catch (CorbaHostException e) { - assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT)); + // assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT)); } catch (Exception e) { e.printStackTrace(); fail(); @@ -249,7 +250,7 @@ public class DefaultCorbaHostTestCase { } catch (CorbaHostException e) { // Expected } catch (Exception e) { - e.printStackTrace(); + // e.printStackTrace(); fail(e.getMessage()); } } diff --git a/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameURL.java b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameURL.java index ddfc51ca98..479e549ab6 100644 --- a/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameURL.java +++ b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameURL.java @@ -157,6 +157,20 @@ public class CorbanameURL { public List<String> getNamePath() { return namePath; } + + public String getName() { + if (namePath != null) { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < namePath.size(); i++) { + buf.append(namePath.get(i)); + if (i < namePath.size() - 1) { + buf.append("/"); + } + } + return buf.toString(); + } + return null; + } public void setNamePath(List<String> namePath) { this.namePath = namePath; |