Java Mailing List Archive

http://www.gg3721.com/

Home » eclipse-plugin-dev.groovy »

[groovy-eclipse-plugin-dev] An internal error occurred during: "Match Job".

Ray Tayek

2009-03-03


Author LoginPost Reply
for input striing: "(true,true"

this happens in one of the following lines:

if(pair.first&&!pair.second) onlyInNew<<file
if(!pair.first&&pair.second) onlyInOld<<file

in the code blow. sorry for the large example, my vision is
icurrently impaired.

this works fine from the command line using 1.6 but fails in eclipse
using a recent plugin.

thanks


class Pair<T, S> {
Pair(T f, S s) { first = f; second = s;
}
String toString() {
return "(" + first.toString() + ", " + second.toString() + ")";
}
T first;
S second;
}

class GDiff {
GDiff(final File newPath,final File oldPath) { this.newPath=newPath;
this.oldPath=oldPath
appName=newPath.toString().split(quotedFileSeparator).asType(List.class).reverse()[0]
println "app name: ${appName}"
assert
appName==oldPath.toString().split(quotedFileSeparator).asType(List.class).reverse()[0]
newPath.eachFileRecurse {
final File key=new File(it.toString()-newPath-fileSeparator)
if(map[key])
map[key].first=true
else map[key]=new Pair<Boolean,Boolean>(true,false)
}
oldPath.eachFileRecurse {
final File key=new File(it.toString()-oldPath-fileSeparator)
if(map[key])
map[key].second=true
else map[key]=new Pair<Boolean,Boolean>(false,true)
}
println map
System.out.flush()
map.each {File file,Pair<Boolean,Boolean> pair->
if(pair.first&&!pair.second) onlyInNew<<file
if(!pair.first&&pair.second) onlyInOld<<file
}
println onlyInNew
println onlyInOld
}
void run() {

}
static String encode(String arg) {
char[] source = arg.toCharArray();
char[] target = new char[source.length * 2]; // worst case we have to
int target_index = 0;
for (char c : source) {
for (char r : reserved) {
if (c == r) {
target[target_index++] = '\\';
break;
}
}
target[target_index++] = c;
}
return new String(target, 0, target_index);
}
final String appName
final File newPath,oldPath
final SortedMap<File, Pair<Boolean, Boolean>> map = new TreeMap<File,
Pair<Boolean, Boolean>>();
final SortedSet<File> onlyInNew=new TreeSet<File>(),onlyInOld=new
TreeSet<File>()
private static final char[] reserved = '$()*+-.?[\\]^{|}'.toCharArray();
static final fileSeparator=System.getProperty("file.separator")
static final String quotedFileSeparator=GDiff.encode(fileSeparator);
}
File newPath=new File("d:/home/ray/grailsapps/hubbub")
File oldPath=new File("hubbub")
GDiff gDiff=new GDiff(newPath,oldPath)
gDiff.run()



---
vice-chair http://ocjug.org/



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.