You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2018/02/01 20:38:47 UTC

svn commit: r1822904 - in /uima/uimaj/trunk: uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/Jg.java

Author: schor
Date: Thu Feb  1 20:38:47 2018
New Revision: 1822904

URL: http://svn.apache.org/viewvc?rev=1822904&view=rev
Log:
[UIMA-5715] get project location avoiding leading /default/

Modified:
    uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java
    uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/Jg.java

Modified: uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java?rev=1822904&r1=1822903&r2=1822904&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java (original)
+++ uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java Thu Feb  1 20:38:47 2018
@@ -2119,7 +2119,8 @@ public class MultiPageEditor extends For
           try {
             jg.mainForCde(new MergerImpl(), new JCasGenProgressMonitor(progressMonitor),
                     jCasGenThrower, inputFile, outputDirectory, types, (CASImpl) getCurrentView(),
-                    getProject().getLocationURI().getPath(),
+                    getProject().getLocation().toString(),  // https://issues.apache.org/jira/browse/UIMA-5715
+                         // getLocationURI().getPath(),  // on linux/mars, was returning /default/project.name etc
                     limitJCasGenToProjectScope,
                     mergedTypesAddingFeatures);
           } catch (IOException e) {

Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/Jg.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/Jg.java?rev=1822904&r1=1822903&r2=1822904&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/Jg.java (original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/Jg.java Thu Feb  1 20:38:47 2018
@@ -76,6 +76,7 @@ import org.apache.uima.util.XMLizable;
 
 public class Jg {
 
+  private final static boolean IS_TRACE_LIMITED = false;
   /**
    * Interface implemeted by JCAS code generation's templates
    *
@@ -709,7 +710,7 @@ public class Jg {
    */
 
   /**
-   * return true if td is not defined in this project, of
+   * return true if td is not defined in this project, or
    *   it is defined, but is also in merged and any of the other
    *   merged urls are not defined in this project
    */
@@ -718,6 +719,9 @@ public class Jg {
     try {
       typeDefinitionUri = new URI (td.getSourceUrlString());
     } catch (URISyntaxException e) {
+      if (IS_TRACE_LIMITED) {
+        error.newError(IError.INFO, "debug isOutOfScope: got URISyntaxException, td.getSourceUrlstring: " + ((td.getSourceUrlString() == null) ? "null" : td.getSourceUrlString()), e);
+      }
       return true; // may be overkill - but if td's source can't be parsed ... likely out of project
     }
     String tdPath = typeDefinitionUri.getPath();
@@ -725,6 +729,9 @@ public class Jg {
     // Issue UIMA-4080 - If a type system resides in a JAR, then the path is null and it is
     // certainly out of scope.
     if (tdPath == null) {
+      if (IS_TRACE_LIMITED) {
+        error.newError(IError.INFO, "debug isOutOfScope: typeDefinitionUri had null path. " + typeDefinitionUri.toString(), null);
+      }
         return true;
     }
 
@@ -735,7 +742,7 @@ public class Jg {
     // as well as clients that use file-system notation (e.g. jcasgen-maven-plugin or a simple
     // invocation from the command line.
     String resolvedProjectPath;
-    if (!projectDirPath.startsWith("/")) {
+    if (!projectDirPath.startsWith("/")) { 
         resolvedProjectPath = new File(projectDirPath).getAbsoluteFile().toURI().getPath();
     }
     else {
@@ -754,6 +761,10 @@ public class Jg {
 
     boolean r = !tdPath.startsWith(resolvedProjectPath);
     if (r) {
+      if (IS_TRACE_LIMITED) {
+        error.newError(IError.INFO, "debug isOutOfScope: tdPath doesn't start with resolved ProjectPath, tdPath: "
+             + tdPath + ", resolvedProjectPath: " + resolvedProjectPath, null);
+      }
       return true;
     }
     Set<String> mergedPaths = mergedTypesAddingFeatures.get(td.getName());
@@ -767,6 +778,9 @@ public class Jg {
         }
         String tempPath = tempURI.getPath();
         if (!tempPath.startsWith(resolvedProjectPath)) {
+          if (IS_TRACE_LIMITED) {
+            error.newError(IError.INFO, "debug isOutOfScope due to mergedType adding feature", null);
+          }
           return true; 
         }
       }