summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java29
1 files changed, 16 insertions, 13 deletions
diff --git a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
index c340572b2a..2987b1fb6c 100644
--- a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
+++ b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
@@ -160,20 +160,23 @@ public class Shell {
private String getDefaultURI(String contributionURL) {
- int lastDot = contributionURL.lastIndexOf('.');
- int lastSep = contributionURL.lastIndexOf("/");
- String uri = contributionURL;
- if (lastDot > -1 && lastSep > -1 && lastDot > lastSep) {
- uri = contributionURL.substring(lastSep+1, lastDot);
- } else {
- try {
- File f = new File(contributionURL);
- if ("classes".equals(f.getName()) && "target".equals(f.getParentFile().getName())) {
- uri = f.getParentFile().getParentFile().getName();
- }
- } catch (Exception e) {
- // ignore
+ String uri = null;
+ try {
+ File f = new File(contributionURL);
+ if ("classes".equals(f.getName()) && "target".equals(f.getParentFile().getName())) {
+ uri = f.getParentFile().getParentFile().getName();
+ } else {
+ uri = f.getName();
}
+ } catch (Exception e) {
+ // ignore
+ }
+ if (uri == null) {
+ uri = contributionURL;
+ }
+ int lastDot = uri.lastIndexOf('.');
+ if (lastDot > -1) {
+ uri = uri.substring(0, lastDot);
}
return uri;
}