uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörn Kottmann <kottm...@gmail.com>
Subject Re: Eclipse launch support for AEs
Date Thu, 07 Apr 2011 08:29:45 GMT
Hello,

good catch, the code needs to make an absolute input file path
relative to the input folder path.

As pointed out replaceFirst should not be used. Instead I am using now
startWith to ensure that the input file path really starts with the 
input folder path,
and substring to remove the input folder path from the input file path.

if (inputFilePath.startsWith(inputDirectory.getPath())) {
   relativeInputFilePath = 
inputFilePath.substring(inputDirectory.getPath().length());
}

and finally
new File(outputFolder.getPath(), relativeInputFilePath)
to produce the output file.

Jörn

On 4/6/11 11:48 PM, Marshall Schor wrote:
> Hi -
>
> I ran this in debugging mode and stopped in the RemoteLauncher code.
>
> Line 191-192 is failing to do the right thing.
>
> It's constructing the output path, by first getting the inputFile.getPath()
> which in my instance is:
>
> D:\mavenAlign\uimaj-trunk-data\uimaj-examples\src\main\data\Apache_UIMA.txt
>
> and then trying to replace the first part of it:
>
> D:\mavenAlign\uimaj-trunk-data\uimaj-examples\src\main\data
>
> with the the output folder name (outputFolder.getName() - just returns the last
> part of the path - the final segment of the name, in my case "lout".
>
> The result of this code:
>
> outputFilePath.replaceFirst(inputDirectory.getName(),
>                outputFolder.getName());
>
> is
>
> D:\mavenAlign\uimaj-trunk-lout\uimaj-examples\src\main\data\Apache_UIMA.txt
>
> I think this is because the "replaceFirst" method takes as its first string, a
> "regular expression", not a literal string....  and the backslash is "special".
>
> Would probably be good to scan our code for use of "replaceFirst" to see if all
> uses are treating the first argument as a regular expression :-)
>
> Maven Javadocs plugin has this same kind of problem -see
> http://jira.codehaus.org/browse/MJAVADOC-312
>
> -Marshall
>

Mime
View raw message