rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
return true; }
while (--i >= 0) if (toBeFound[i] != array[i + j]) return false; return true; }
public static final boolean endsWith(char[] array, char[] toBeFound) { int i = toBeFound.length; int j = array.length - i; if (j < 0) return false; while (--i >= 0) if (toBeFound[i] != array[i + j]) return false; return true;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
public static final boolean fragmentEquals( char[] fragment, char[] name, int startIndex, boolean isCaseSensitive) {
public static final boolean fragmentEquals(char[] fragment, char[] name, int startIndex, boolean isCaseSensitive) {
public static final boolean fragmentEquals( char[] fragment, char[] name, int startIndex, boolean isCaseSensitive) { int max = fragment.length; if (name.length < max + startIndex) return false; if (isCaseSensitive) { for (int i = max; --i >= 0; ) // assumes the prefix is not larger than the name if (fragment[i] != name[i + startIndex]) return false; return true; } for (int i = max; --i >= 0; ) // assumes the prefix is not larger than the name if (Character.toLowerCase(fragment[i]) != Character.toLowerCase(name[i + startIndex])) return false; return true;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int max = fragment.length; if (name.length < max + startIndex) return false; if (isCaseSensitive) { for (int i = max; --i >= 0; ) if (fragment[i] != name[i + startIndex])
int max = fragment.length; if (name.length < max + startIndex) return false; if (isCaseSensitive) { for (int i = max; --i >= 0;) if (fragment[i] != name[i + startIndex]) return false; return true; } for (int i = max; --i >= 0;) if (Character.toLowerCase(fragment[i]) != Character .toLowerCase(name[i + startIndex]))
public static final boolean fragmentEquals( char[] fragment, char[] name, int startIndex, boolean isCaseSensitive) { int max = fragment.length; if (name.length < max + startIndex) return false; if (isCaseSensitive) { for (int i = max; --i >= 0; ) // assumes the prefix is not larger than the name if (fragment[i] != name[i + startIndex]) return false; return true; } for (int i = max; --i >= 0; ) // assumes the prefix is not larger than the name if (Character.toLowerCase(fragment[i]) != Character.toLowerCase(name[i + startIndex])) return false; return true;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
for (int i = max; --i >= 0; ) if (Character.toLowerCase(fragment[i]) != Character.toLowerCase(name[i + startIndex])) return false; return true; }
public static final boolean fragmentEquals( char[] fragment, char[] name, int startIndex, boolean isCaseSensitive) { int max = fragment.length; if (name.length < max + startIndex) return false; if (isCaseSensitive) { for (int i = max; --i >= 0; ) // assumes the prefix is not larger than the name if (fragment[i] != name[i + startIndex]) return false; return true; } for (int i = max; --i >= 0; ) // assumes the prefix is not larger than the name if (Character.toLowerCase(fragment[i]) != Character.toLowerCase(name[i + startIndex])) return false; return true;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int length = array.length; int hash = length == 0 ? 31 : array[0]; if (length < 8) { for (int i = length; --i > 0;) hash = (hash * 31) + array[i]; } else { for (int i = length - 1, last = i > 16 ? i - 16 : 0; i > last; i -= 2) hash = (hash * 31) + array[i];
int length = array.length; int hash = length == 0 ? 31 : array[0]; if (length < 8) { for (int i = length; --i > 0;) hash = (hash * 31) + array[i]; } else { for (int i = length - 1, last = i > 16 ? i - 16 : 0; i > last; i -= 2) hash = (hash * 31) + array[i]; } return hash & 0x7FFFFFFF;
public static final int hashCode(char[] array) { int length = array.length; int hash = length == 0 ? 31 : array[0]; if (length < 8) { for (int i = length; --i > 0;) hash = (hash * 31) + array[i]; } else { // 8 characters is enough to compute a decent hash code, don't waste time examining every character for (int i = length - 1, last = i > 16 ? i - 16 : 0; i > last; i -= 2) hash = (hash * 31) + array[i]; } return hash & 0x7FFFFFFF;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
return hash & 0x7FFFFFFF; }
public static final int hashCode(char[] array) { int length = array.length; int hash = length == 0 ? 31 : array[0]; if (length < 8) { for (int i = length; --i > 0;) hash = (hash * 31) + array[i]; } else { // 8 characters is enough to compute a decent hash code, don't waste time examining every character for (int i = length - 1, last = i > 16 ? i - 16 : 0; i > last; i -= 2) hash = (hash * 31) + array[i]; } return hash & 0x7FFFFFFF;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
return indexOf(toBeFound, array, 0); }
return indexOf(toBeFound, array, 0); }
public static final int indexOf(char toBeFound, char[] array) { return indexOf(toBeFound, array, 0);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
return Character.isWhitespace(c); }
return Character.isWhitespace(c); }
public static boolean isWhitespace(char c) { return Character.isWhitespace(c);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
for (int i = array.length; --i >= 0;) if (toBeFound == array[i]) return i; return -1; }
for (int i = array.length; --i >= 0;) if (toBeFound == array[i]) return i; return -1; }
public static final int lastIndexOf(char toBeFound, char[] array) { for (int i = array.length; --i >= 0;) if (toBeFound == array[i]) return i; return -1;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int pos = lastIndexOf(separator, array); if (pos < 0) return array; return subarray(array, pos + 1, array.length); }
int pos = lastIndexOf(separator, array); if (pos < 0) return array; return subarray(array, pos + 1, array.length); }
final static public char[] lastSegment(char[] array, char separator) { int pos = lastIndexOf(separator, array); if (pos < 0) return array; return subarray(array, pos + 1, array.length);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int count = 0; for (int i = 0; i < array.length; i++) if (toBeFound == array[i]) count++; return count; }
int count = 0; for (int i = 0; i < array.length; i++) if (toBeFound == array[i]) count++; return count; }
public static final int occurencesOf(char toBeFound, char[] array) { int count = 0; for (int i = 0; i < array.length; i++) if (toBeFound == array[i]) count++; return count;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
public static final boolean pathMatch( char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) {
public static final boolean pathMatch(char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) {
public static final boolean pathMatch( char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) { if (filepath == null) return false; // null name cannot match if (pattern == null) return true; // null pattern is equivalent to '*' // offsets inside pattern int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1); if (pSegmentEnd < 0) pSegmentEnd = pLength; // special case: pattern foo\ is equivalent to foo\** boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator; // offsets inside filepath int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator){ fSegmentStart = 0; } else { fSegmentStart = 1; } if (fSegmentStart != pSegmentStart) { return false; // both must start with a separator or none. } int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1); if (fSegmentEnd < 0) fSegmentEnd = fLength; // first segments while (pSegmentStart < pLength && !(pSegmentEnd == pLength && freeTrailingDoubleStar || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*'))) { if (fSegmentStart >= fLength) return false; if (!CharOperation .match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { return false; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } /* check sequence of doubleStar+segment */ int pSegmentRestart; if ((pSegmentStart >= pLength && freeTrailingDoubleStar) || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*')) { pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; } else { if (pSegmentStart >= pLength) return fSegmentStart >= fLength; // true if filepath is done too. pSegmentRestart = 0; // force fSegmentStart check } int fSegmentRestart = fSegmentStart; checkSegment : while (fSegmentStart < fLength) { if (pSegmentStart >= pLength) { if (freeTrailingDoubleStar) return true; // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } /* path segment is ending */ if (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; fSegmentRestart = fSegmentStart; if (pSegmentStart >= pLength) return true; continue checkSegment; } /* chech current path segment */ if (!CharOperation.match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } return (pSegmentRestart >= pSegmentEnd) || (fSegmentStart >= fLength && pSegmentStart >= pLength) || (pSegmentStart == pLength - 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') || (pSegmentStart == pLength && freeTrailingDoubleStar);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
if (filepath == null) return false; if (pattern == null) return true;
if (filepath == null) return false; if (pattern == null) return true;
public static final boolean pathMatch( char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) { if (filepath == null) return false; // null name cannot match if (pattern == null) return true; // null pattern is equivalent to '*' // offsets inside pattern int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1); if (pSegmentEnd < 0) pSegmentEnd = pLength; // special case: pattern foo\ is equivalent to foo\** boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator; // offsets inside filepath int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator){ fSegmentStart = 0; } else { fSegmentStart = 1; } if (fSegmentStart != pSegmentStart) { return false; // both must start with a separator or none. } int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1); if (fSegmentEnd < 0) fSegmentEnd = fLength; // first segments while (pSegmentStart < pLength && !(pSegmentEnd == pLength && freeTrailingDoubleStar || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*'))) { if (fSegmentStart >= fLength) return false; if (!CharOperation .match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { return false; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } /* check sequence of doubleStar+segment */ int pSegmentRestart; if ((pSegmentStart >= pLength && freeTrailingDoubleStar) || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*')) { pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; } else { if (pSegmentStart >= pLength) return fSegmentStart >= fLength; // true if filepath is done too. pSegmentRestart = 0; // force fSegmentStart check } int fSegmentRestart = fSegmentStart; checkSegment : while (fSegmentStart < fLength) { if (pSegmentStart >= pLength) { if (freeTrailingDoubleStar) return true; // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } /* path segment is ending */ if (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; fSegmentRestart = fSegmentStart; if (pSegmentStart >= pLength) return true; continue checkSegment; } /* chech current path segment */ if (!CharOperation.match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } return (pSegmentRestart >= pSegmentEnd) || (fSegmentStart >= fLength && pSegmentStart >= pLength) || (pSegmentStart == pLength - 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') || (pSegmentStart == pLength && freeTrailingDoubleStar);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1); if (pSegmentEnd < 0) pSegmentEnd = pLength; boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator; int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator){ fSegmentStart = 0; } else { fSegmentStart = 1; } if (fSegmentStart != pSegmentStart) { return false; } int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1); if (fSegmentEnd < 0) fSegmentEnd = fLength; while (pSegmentStart < pLength && !(pSegmentEnd == pLength && freeTrailingDoubleStar || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*'))) { if (fSegmentStart >= fLength) return false; if (!CharOperation .match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { return false; } pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1);
int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart + 1);
public static final boolean pathMatch( char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) { if (filepath == null) return false; // null name cannot match if (pattern == null) return true; // null pattern is equivalent to '*' // offsets inside pattern int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1); if (pSegmentEnd < 0) pSegmentEnd = pLength; // special case: pattern foo\ is equivalent to foo\** boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator; // offsets inside filepath int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator){ fSegmentStart = 0; } else { fSegmentStart = 1; } if (fSegmentStart != pSegmentStart) { return false; // both must start with a separator or none. } int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1); if (fSegmentEnd < 0) fSegmentEnd = fLength; // first segments while (pSegmentStart < pLength && !(pSegmentEnd == pLength && freeTrailingDoubleStar || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*'))) { if (fSegmentStart >= fLength) return false; if (!CharOperation .match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { return false; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } /* check sequence of doubleStar+segment */ int pSegmentRestart; if ((pSegmentStart >= pLength && freeTrailingDoubleStar) || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*')) { pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; } else { if (pSegmentStart >= pLength) return fSegmentStart >= fLength; // true if filepath is done too. pSegmentRestart = 0; // force fSegmentStart check } int fSegmentRestart = fSegmentStart; checkSegment : while (fSegmentStart < fLength) { if (pSegmentStart >= pLength) { if (freeTrailingDoubleStar) return true; // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } /* path segment is ending */ if (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; fSegmentRestart = fSegmentStart; if (pSegmentStart >= pLength) return true; continue checkSegment; } /* chech current path segment */ if (!CharOperation.match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } return (pSegmentRestart >= pSegmentEnd) || (fSegmentStart >= fLength && pSegmentStart >= pLength) || (pSegmentStart == pLength - 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') || (pSegmentStart == pLength && freeTrailingDoubleStar);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); if (fSegmentEnd < 0) fSegmentEnd = fLength; }
boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator;
public static final boolean pathMatch( char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) { if (filepath == null) return false; // null name cannot match if (pattern == null) return true; // null pattern is equivalent to '*' // offsets inside pattern int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1); if (pSegmentEnd < 0) pSegmentEnd = pLength; // special case: pattern foo\ is equivalent to foo\** boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator; // offsets inside filepath int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator){ fSegmentStart = 0; } else { fSegmentStart = 1; } if (fSegmentStart != pSegmentStart) { return false; // both must start with a separator or none. } int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1); if (fSegmentEnd < 0) fSegmentEnd = fLength; // first segments while (pSegmentStart < pLength && !(pSegmentEnd == pLength && freeTrailingDoubleStar || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*'))) { if (fSegmentStart >= fLength) return false; if (!CharOperation .match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { return false; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } /* check sequence of doubleStar+segment */ int pSegmentRestart; if ((pSegmentStart >= pLength && freeTrailingDoubleStar) || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*')) { pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; } else { if (pSegmentStart >= pLength) return fSegmentStart >= fLength; // true if filepath is done too. pSegmentRestart = 0; // force fSegmentStart check } int fSegmentRestart = fSegmentStart; checkSegment : while (fSegmentStart < fLength) { if (pSegmentStart >= pLength) { if (freeTrailingDoubleStar) return true; // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } /* path segment is ending */ if (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; fSegmentRestart = fSegmentStart; if (pSegmentStart >= pLength) return true; continue checkSegment; } /* chech current path segment */ if (!CharOperation.match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } return (pSegmentRestart >= pSegmentEnd) || (fSegmentStart >= fLength && pSegmentStart >= pLength) || (pSegmentStart == pLength - 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') || (pSegmentStart == pLength && freeTrailingDoubleStar);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
/* check sequence of doubleStar+segment */ int pSegmentRestart; if ((pSegmentStart >= pLength && freeTrailingDoubleStar) || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*')) { pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; } else { if (pSegmentStart >= pLength) return fSegmentStart >= fLength; pSegmentRestart = 0; } int fSegmentRestart = fSegmentStart; checkSegment : while (fSegmentStart < fLength) { if (pSegmentStart >= pLength) { if (freeTrailingDoubleStar) return true; pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment;
int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator) { fSegmentStart = 0; } else { fSegmentStart = 1;
public static final boolean pathMatch( char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) { if (filepath == null) return false; // null name cannot match if (pattern == null) return true; // null pattern is equivalent to '*' // offsets inside pattern int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1); if (pSegmentEnd < 0) pSegmentEnd = pLength; // special case: pattern foo\ is equivalent to foo\** boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator; // offsets inside filepath int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator){ fSegmentStart = 0; } else { fSegmentStart = 1; } if (fSegmentStart != pSegmentStart) { return false; // both must start with a separator or none. } int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1); if (fSegmentEnd < 0) fSegmentEnd = fLength; // first segments while (pSegmentStart < pLength && !(pSegmentEnd == pLength && freeTrailingDoubleStar || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*'))) { if (fSegmentStart >= fLength) return false; if (!CharOperation .match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { return false; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } /* check sequence of doubleStar+segment */ int pSegmentRestart; if ((pSegmentStart >= pLength && freeTrailingDoubleStar) || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*')) { pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; } else { if (pSegmentStart >= pLength) return fSegmentStart >= fLength; // true if filepath is done too. pSegmentRestart = 0; // force fSegmentStart check } int fSegmentRestart = fSegmentStart; checkSegment : while (fSegmentStart < fLength) { if (pSegmentStart >= pLength) { if (freeTrailingDoubleStar) return true; // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } /* path segment is ending */ if (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; fSegmentRestart = fSegmentStart; if (pSegmentStart >= pLength) return true; continue checkSegment; } /* chech current path segment */ if (!CharOperation.match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } return (pSegmentRestart >= pSegmentEnd) || (fSegmentStart >= fLength && pSegmentStart >= pLength) || (pSegmentStart == pLength - 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') || (pSegmentStart == pLength && freeTrailingDoubleStar);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
/* path segment is ending */ if (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; fSegmentRestart = fSegmentStart; if (pSegmentStart >= pLength) return true; continue checkSegment;
if (fSegmentStart != pSegmentStart) { return false;
public static final boolean pathMatch( char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) { if (filepath == null) return false; // null name cannot match if (pattern == null) return true; // null pattern is equivalent to '*' // offsets inside pattern int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1); if (pSegmentEnd < 0) pSegmentEnd = pLength; // special case: pattern foo\ is equivalent to foo\** boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator; // offsets inside filepath int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator){ fSegmentStart = 0; } else { fSegmentStart = 1; } if (fSegmentStart != pSegmentStart) { return false; // both must start with a separator or none. } int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1); if (fSegmentEnd < 0) fSegmentEnd = fLength; // first segments while (pSegmentStart < pLength && !(pSegmentEnd == pLength && freeTrailingDoubleStar || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*'))) { if (fSegmentStart >= fLength) return false; if (!CharOperation .match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { return false; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } /* check sequence of doubleStar+segment */ int pSegmentRestart; if ((pSegmentStart >= pLength && freeTrailingDoubleStar) || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*')) { pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; } else { if (pSegmentStart >= pLength) return fSegmentStart >= fLength; // true if filepath is done too. pSegmentRestart = 0; // force fSegmentStart check } int fSegmentRestart = fSegmentStart; checkSegment : while (fSegmentStart < fLength) { if (pSegmentStart >= pLength) { if (freeTrailingDoubleStar) return true; // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } /* path segment is ending */ if (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; fSegmentRestart = fSegmentStart; if (pSegmentStart >= pLength) return true; continue checkSegment; } /* chech current path segment */ if (!CharOperation.match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } return (pSegmentRestart >= pSegmentEnd) || (fSegmentStart >= fLength && pSegmentStart >= pLength) || (pSegmentStart == pLength - 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') || (pSegmentStart == pLength && freeTrailingDoubleStar);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
/* chech current path segment */ if (!CharOperation.match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1);
int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart + 1);
public static final boolean pathMatch( char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) { if (filepath == null) return false; // null name cannot match if (pattern == null) return true; // null pattern is equivalent to '*' // offsets inside pattern int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1); if (pSegmentEnd < 0) pSegmentEnd = pLength; // special case: pattern foo\ is equivalent to foo\** boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator; // offsets inside filepath int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator){ fSegmentStart = 0; } else { fSegmentStart = 1; } if (fSegmentStart != pSegmentStart) { return false; // both must start with a separator or none. } int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1); if (fSegmentEnd < 0) fSegmentEnd = fLength; // first segments while (pSegmentStart < pLength && !(pSegmentEnd == pLength && freeTrailingDoubleStar || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*'))) { if (fSegmentStart >= fLength) return false; if (!CharOperation .match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { return false; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } /* check sequence of doubleStar+segment */ int pSegmentRestart; if ((pSegmentStart >= pLength && freeTrailingDoubleStar) || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*')) { pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; } else { if (pSegmentStart >= pLength) return fSegmentStart >= fLength; // true if filepath is done too. pSegmentRestart = 0; // force fSegmentStart check } int fSegmentRestart = fSegmentStart; checkSegment : while (fSegmentStart < fLength) { if (pSegmentStart >= pLength) { if (freeTrailingDoubleStar) return true; // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } /* path segment is ending */ if (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; fSegmentRestart = fSegmentStart; if (pSegmentStart >= pLength) return true; continue checkSegment; } /* chech current path segment */ if (!CharOperation.match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } return (pSegmentRestart >= pSegmentEnd) || (fSegmentStart >= fLength && pSegmentStart >= pLength) || (pSegmentStart == pLength - 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') || (pSegmentStart == pLength && freeTrailingDoubleStar);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
return (pSegmentRestart >= pSegmentEnd) || (fSegmentStart >= fLength && pSegmentStart >= pLength) || (pSegmentStart == pLength - 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') || (pSegmentStart == pLength && freeTrailingDoubleStar); }
public static final boolean pathMatch( char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator) { if (filepath == null) return false; // null name cannot match if (pattern == null) return true; // null pattern is equivalent to '*' // offsets inside pattern int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0; int pLength = pattern.length; int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1); if (pSegmentEnd < 0) pSegmentEnd = pLength; // special case: pattern foo\ is equivalent to foo\** boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator; // offsets inside filepath int fSegmentStart, fLength = filepath.length; if (filepath[0] != pathSeparator){ fSegmentStart = 0; } else { fSegmentStart = 1; } if (fSegmentStart != pSegmentStart) { return false; // both must start with a separator or none. } int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1); if (fSegmentEnd < 0) fSegmentEnd = fLength; // first segments while (pSegmentStart < pLength && !(pSegmentEnd == pLength && freeTrailingDoubleStar || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*'))) { if (fSegmentStart >= fLength) return false; if (!CharOperation .match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { return false; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } /* check sequence of doubleStar+segment */ int pSegmentRestart; if ((pSegmentStart >= pLength && freeTrailingDoubleStar) || (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*')) { pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; } else { if (pSegmentStart >= pLength) return fSegmentStart >= fLength; // true if filepath is done too. pSegmentRestart = 0; // force fSegmentStart check } int fSegmentRestart = fSegmentStart; checkSegment : while (fSegmentStart < fLength) { if (pSegmentStart >= pLength) { if (freeTrailingDoubleStar) return true; // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } /* path segment is ending */ if (pSegmentEnd == pSegmentStart + 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') { pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; pSegmentRestart = pSegmentStart; fSegmentRestart = fSegmentStart; if (pSegmentStart >= pLength) return true; continue checkSegment; } /* chech current path segment */ if (!CharOperation.match( pattern, pSegmentStart, pSegmentEnd, filepath, fSegmentStart, fSegmentEnd, isCaseSensitive)) { // mismatch - restart current path segment pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart); if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentRestart = CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1); // skip separator if (fSegmentRestart < 0) { fSegmentRestart = fLength; } else { fSegmentRestart++; } fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart); if (fSegmentEnd < 0) fSegmentEnd = fLength; continue checkSegment; } // jump to next segment pSegmentEnd = CharOperation.indexOf( pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1); // skip separator if (pSegmentEnd < 0) pSegmentEnd = pLength; fSegmentEnd = CharOperation.indexOf( pathSeparator, filepath, fSegmentStart = fSegmentEnd + 1); // skip separator if (fSegmentEnd < 0) fSegmentEnd = fLength; } return (pSegmentRestart >= pSegmentEnd) || (fSegmentStart >= fLength && pSegmentStart >= pLength) || (pSegmentStart == pLength - 2 && pattern[pSegmentStart] == '*' && pattern[pSegmentStart + 1] == '*') || (pSegmentStart == pLength && freeTrailingDoubleStar);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
if (array == null) return null; int length = array.length; if (length == 0) return array; char[] result = null; int count = 0; for (int i = 0; i < length; i++) { char c = array[i]; if (c == toBeRemoved) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i); count = i;
if (array == null) return null; int length = array.length; if (length == 0) return array; char[] result = null; int count = 0; for (int i = 0; i < length; i++) { char c = array[i]; if (c == toBeRemoved) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i); count = i; } } else if (result != null) { result[count++] = c;
public static final char[] remove(char[] array, char toBeRemoved) { if (array == null) return null; int length = array.length; if (length == 0) return array; char[] result = null; int count = 0; for (int i = 0; i < length; i++) { char c = array[i]; if (c == toBeRemoved) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i); count = i; } } else if (result != null) { result[count++] = c; } } if (result == null) return array; System.arraycopy(result, 0, result = new char[count], 0, count); return result;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
} else if (result != null) { result[count++] = c;
public static final char[] remove(char[] array, char toBeRemoved) { if (array == null) return null; int length = array.length; if (length == 0) return array; char[] result = null; int count = 0; for (int i = 0; i < length; i++) { char c = array[i]; if (c == toBeRemoved) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i); count = i; } } else if (result != null) { result[count++] = c; } } if (result == null) return array; System.arraycopy(result, 0, result = new char[count], 0, count); return result;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
if (result == null) return array; System.arraycopy(result, 0, result = new char[count], 0, count); return result; }
public static final char[] remove(char[] array, char toBeRemoved) { if (array == null) return null; int length = array.length; if (length == 0) return array; char[] result = null; int count = 0; for (int i = 0; i < length; i++) { char c = array[i]; if (c == toBeRemoved) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i); count = i; } } else if (result != null) { result[count++] = c; } } if (result == null) return array; System.arraycopy(result, 0, result = new char[count], 0, count); return result;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
public static final void replace( char[] array, char toBeReplaced, char replacementChar) { if (toBeReplaced != replacementChar) { for (int i = 0, max = array.length; i < max; i++) { if (array[i] == toBeReplaced) array[i] = replacementChar;
public static final void replace(char[] array, char toBeReplaced, char replacementChar) { if (toBeReplaced != replacementChar) { for (int i = 0, max = array.length; i < max; i++) { if (array[i] == toBeReplaced) array[i] = replacementChar; }
public static final void replace( char[] array, char toBeReplaced, char replacementChar) { if (toBeReplaced != replacementChar) { for (int i = 0, max = array.length; i < max; i++) { if (array[i] == toBeReplaced) array[i] = replacementChar; } }}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
}
public static final void replace( char[] array, char toBeReplaced, char replacementChar) { if (toBeReplaced != replacementChar) { for (int i = 0, max = array.length; i < max; i++) { if (array[i] == toBeReplaced) array[i] = replacementChar; } }}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
public static final char[] replaceOnCopy( char[] array, char toBeReplaced, char replacementChar) { char[] result = null; for (int i = 0, length = array.length; i < length; i++) { char c = array[i]; if (c == toBeReplaced) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i);
public static final char[] replaceOnCopy(char[] array, char toBeReplaced, char replacementChar) { char[] result = null; for (int i = 0, length = array.length; i < length; i++) { char c = array[i]; if (c == toBeReplaced) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i); } result[i] = replacementChar; } else if (result != null) { result[i] = c;
public static final char[] replaceOnCopy( char[] array, char toBeReplaced, char replacementChar) { char[] result = null; for (int i = 0, length = array.length; i < length; i++) { char c = array[i]; if (c == toBeReplaced) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i); } result[i] = replacementChar; } else if (result != null) { result[i] = c; } } if (result == null) return array; return result;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
result[i] = replacementChar; } else if (result != null) { result[i] = c;
public static final char[] replaceOnCopy( char[] array, char toBeReplaced, char replacementChar) { char[] result = null; for (int i = 0, length = array.length; i < length; i++) { char c = array[i]; if (c == toBeReplaced) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i); } result[i] = replacementChar; } else if (result != null) { result[i] = c; } } if (result == null) return array; return result;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
if (result == null) return array; return result; }
public static final char[] replaceOnCopy( char[] array, char toBeReplaced, char replacementChar) { char[] result = null; for (int i = 0, length = array.length; i < length; i++) { char c = array[i]; if (c == toBeReplaced) { if (result == null) { result = new char[length]; System.arraycopy(array, 0, result, 0, i); } result[i] = replacementChar; } else if (result != null) { result[i] = c; } } if (result == null) return array; return result;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR;
int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR;
public static final char[][] splitAndTrimOn(char divider, char[] array) { int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR; int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { int start = last, end = i - 1; while (start < i && array[start] == ' ') start++; while (end > start && array[end] == ' ') end--; split[currentWord] = new char[end - start + 1]; System.arraycopy( array, start, split[currentWord++], 0, end - start + 1); last = i + 1; } } int start = last, end = length - 1; while (start < length && array[start] == ' ') start++; while (end > start && array[end] == ' ') end--; split[currentWord] = new char[end - start + 1]; System.arraycopy( array, start, split[currentWord++], 0, end - start + 1); return split;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { int start = last, end = i - 1; while (start < i && array[start] == ' ') start++; while (end > start && array[end] == ' ') end--; split[currentWord] = new char[end - start + 1]; System.arraycopy( array, start, split[currentWord++], 0, end - start + 1); last = i + 1;
int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { int start = last, end = i - 1; while (start < i && array[start] == ' ') start++; while (end > start && array[end] == ' ') end--; split[currentWord] = new char[end - start + 1]; System.arraycopy(array, start, split[currentWord++], 0, end - start + 1); last = i + 1; }
public static final char[][] splitAndTrimOn(char divider, char[] array) { int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR; int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { int start = last, end = i - 1; while (start < i && array[start] == ' ') start++; while (end > start && array[end] == ' ') end--; split[currentWord] = new char[end - start + 1]; System.arraycopy( array, start, split[currentWord++], 0, end - start + 1); last = i + 1; } } int start = last, end = length - 1; while (start < length && array[start] == ' ') start++; while (end > start && array[end] == ' ') end--; split[currentWord] = new char[end - start + 1]; System.arraycopy( array, start, split[currentWord++], 0, end - start + 1); return split;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int start = last, end = length - 1; while (start < length && array[start] == ' ') start++; while (end > start && array[end] == ' ') end--; split[currentWord] = new char[end - start + 1]; System.arraycopy( array, start, split[currentWord++], 0, end - start + 1); return split; }
public static final char[][] splitAndTrimOn(char divider, char[] array) { int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR; int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { int start = last, end = i - 1; while (start < i && array[start] == ' ') start++; while (end > start && array[end] == ' ') end--; split[currentWord] = new char[end - start + 1]; System.arraycopy( array, start, split[currentWord++], 0, end - start + 1); last = i + 1; } } int start = last, end = length - 1; while (start < length && array[start] == ' ') start++; while (end > start && array[end] == ' ') end--; split[currentWord] = new char[end - start + 1]; System.arraycopy( array, start, split[currentWord++], 0, end - start + 1); return split;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR;
int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR;
public static final char[][] splitOn(char divider, char[] array) { int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR; int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { split[currentWord] = new char[i - last]; System.arraycopy( array, last, split[currentWord++], 0, i - last); last = i + 1; } } split[currentWord] = new char[length - last]; System.arraycopy(array, last, split[currentWord], 0, length - last); return split;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { split[currentWord] = new char[i - last]; System.arraycopy( array, last, split[currentWord++], 0, i - last); last = i + 1;
int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { split[currentWord] = new char[i - last]; System .arraycopy(array, last, split[currentWord++], 0, i - last); last = i + 1; }
public static final char[][] splitOn(char divider, char[] array) { int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR; int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { split[currentWord] = new char[i - last]; System.arraycopy( array, last, split[currentWord++], 0, i - last); last = i + 1; } } split[currentWord] = new char[length - last]; System.arraycopy(array, last, split[currentWord], 0, length - last); return split;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
split[currentWord] = new char[length - last]; System.arraycopy(array, last, split[currentWord], 0, length - last); return split; }
public static final char[][] splitOn(char divider, char[] array) { int length = array == null ? 0 : array.length; if (length == 0) return NO_CHAR_CHAR; int wordCount = 1; for (int i = 0; i < length; i++) if (array[i] == divider) wordCount++; char[][] split = new char[wordCount][]; int last = 0, currentWord = 0; for (int i = 0; i < length; i++) { if (array[i] == divider) { split[currentWord] = new char[i - last]; System.arraycopy( array, last, split[currentWord++], 0, i - last); last = i + 1; } } split[currentWord] = new char[length - last]; System.arraycopy(array, last, split[currentWord], 0, length - last); return split;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
if (end == -1) end = array.length; if (start > end) return null; if (start < 0) return null; if (end > array.length) return null;
if (end == -1) end = array.length; if (start > end) return null; if (start < 0) return null; if (end > array.length) return null;
public static final char[][] subarray(char[][] array, int start, int end) { if (end == -1) end = array.length; if (start > end) return null; if (start < 0) return null; if (end > array.length) return null; char[][] result = new char[end - start][]; System.arraycopy(array, start, result, 0, end - start); return result;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
char[][] result = new char[end - start][]; System.arraycopy(array, start, result, 0, end - start); return result; }
char[][] result = new char[end - start][]; System.arraycopy(array, start, result, 0, end - start); return result; }
public static final char[][] subarray(char[][] array, int start, int end) { if (end == -1) end = array.length; if (start > end) return null; if (start < 0) return null; if (end > array.length) return null; char[][] result = new char[end - start][]; System.arraycopy(array, start, result, 0, end - start); return result;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
char[] result = concatWith(array, '.'); return new String(result); }
char[] result = concatWith(array, '.'); return new String(result); }
final static public String toString(char[][] array) { char[] result = concatWith(array, '.'); return new String(result);}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
if (array == null) return NO_STRINGS; int length = array.length; if (length == 0) return NO_STRINGS; String[] result = new String[length]; for (int i = 0; i < length; i++) result[i] = new String(array[i]); return result; }
if (array == null) return NO_STRINGS; int length = array.length; if (length == 0) return NO_STRINGS; String[] result = new String[length]; for (int i = 0; i < length; i++) result[i] = new String(array[i]); return result; }
final static public String[] toStrings(char[][] array) { if (array == null) return NO_STRINGS; int length = array.length; if (length == 0) return NO_STRINGS; String[] result = new String[length]; for (int i = 0; i < length; i++) result[i] = new String(array[i]); return result;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
if (chars == null) return null;
if (chars == null) return null;
final static public char[] trim(char[] chars) { if (chars == null) return null; int start = 0, length = chars.length, end = length - 1; while (start < length && chars[start] == ' ') { start++; } while (end > start && chars[end] == ' ') { end--; } if (start != 0 || end != length - 1) { return subarray(chars, start, end + 1); } return chars;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
int start = 0, length = chars.length, end = length - 1; while (start < length && chars[start] == ' ') { start++;
int start = 0, length = chars.length, end = length - 1; while (start < length && chars[start] == ' ') { start++; } while (end > start && chars[end] == ' ') { end--; } if (start != 0 || end != length - 1) { return subarray(chars, start, end + 1); } return chars;
final static public char[] trim(char[] chars) { if (chars == null) return null; int start = 0, length = chars.length, end = length - 1; while (start < length && chars[start] == ' ') { start++; } while (end > start && chars[end] == ' ') { end--; } if (start != 0 || end != length - 1) { return subarray(chars, start, end + 1); } return chars;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
while (end > start && chars[end] == ' ') { end--; } if (start != 0 || end != length - 1) { return subarray(chars, start, end + 1); } return chars; }
final static public char[] trim(char[] chars) { if (chars == null) return null; int start = 0, length = chars.length, end = length - 1; while (start < length && chars[start] == ' ') { start++; } while (end > start && chars[end] == ' ') { end--; } if (start != 0 || end != length - 1) { return subarray(chars, start, end + 1); } return chars;}
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e33c1f7b0c1f9dbe66a73370c1b98e653087c2df/CharOperation.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CharOperation.java
String userId = StringUtil.trimToZero(SessionManager.getCurrentSession().getUserEid());
String userId = StringUtil.trimToZero(SessionManager.getCurrentSessionUserId());
private String buildContextForTemplate (int index, VelocityPortlet portlet, Context context, RunData data, SessionState state) { String realmId = ""; String site_type = ""; String sortedBy = ""; String sortedAsc = ""; ParameterParser params = data.getParameters (); context.put("tlang",rb); context.put("alertMessage", state.getAttribute(STATE_MESSAGE)); // If cleanState() has removed SiteInfo, get a new instance into state SiteInfo siteInfo = new SiteInfo(); if (state.getAttribute(STATE_SITE_INFO) != null) { siteInfo = (SiteInfo) state.getAttribute(STATE_SITE_INFO); } else { state.setAttribute(STATE_SITE_INFO, siteInfo); } // Lists used in more than one template // Access List roles = new Vector(); // the hashtables for News and Web Content tools Hashtable newsTitles = new Hashtable(); Hashtable newsUrls = new Hashtable(); Hashtable wcTitles = new Hashtable(); Hashtable wcUrls = new Hashtable(); List toolRegistrationList = new Vector(); List toolRegistrationSelectedList = new Vector(); ResourceProperties siteProperties = null; // for showing site creation steps if (state.getAttribute(SITE_CREATE_TOTAL_STEPS) != null) { context.put("totalSteps", state.getAttribute(SITE_CREATE_TOTAL_STEPS)); } if (state.getAttribute(SITE_CREATE_CURRENT_STEP) != null) { context.put("step", state.getAttribute(SITE_CREATE_CURRENT_STEP)); } String hasGradSites = ServerConfigurationService.getString("withDissertation", Boolean.FALSE.toString()); Site site = getStateSite(state); switch (index) { case 0: /* buildContextForTemplate chef_site-list.vm * */ // site types List sTypes = (List) state.getAttribute(STATE_SITE_TYPES); //make sure auto-updates are enabled Hashtable views = new Hashtable(); if (SecurityService.isSuperUser()) { views.put(ALL_MY_SITES, ALL_MY_SITES); views.put(MYWORKSPACE + " sites", MYWORKSPACE); for(int sTypeIndex = 0; sTypeIndex < sTypes.size(); sTypeIndex++) { String type = (String) sTypes.get(sTypeIndex); views.put(type + " sites", type); } if (hasGradSites.equalsIgnoreCase("true")) { views.put(GRADTOOLS + " sites", GRADTOOLS); } if(state.getAttribute(STATE_VIEW_SELECTED) == null) { state.setAttribute(STATE_VIEW_SELECTED, ALL_MY_SITES); } context.put("superUser", Boolean.TRUE); } else { context.put("superUser", Boolean.FALSE); views.put(ALL_MY_SITES, ALL_MY_SITES); // if there is a GradToolsStudent choice inside boolean remove = false; if (hasGradSites.equalsIgnoreCase("true")) { try { //the Grad Tools site option is only presented to GradTools Candidates String userId = StringUtil.trimToZero(SessionManager.getCurrentSessionUserId()); //am I a grad student? if (!isGradToolsCandidate(userId)) { // not a gradstudent remove = true; } } catch(Exception e) { remove = true; } } else { // not support for dissertation sites remove=true; } //do not show this site type in views //sTypes.remove(new String(SITE_TYPE_GRADTOOLS_STUDENT)); for(int sTypeIndex = 0; sTypeIndex < sTypes.size(); sTypeIndex++) { String type = (String) sTypes.get(sTypeIndex); if(!type.equals(SITE_TYPE_GRADTOOLS_STUDENT)) { views.put(type + " "+rb.getString("java.sites"), type); } } if (!remove) { views.put(GRADTOOLS + " sites", GRADTOOLS); } //default view if(state.getAttribute(STATE_VIEW_SELECTED) == null) { state.setAttribute(STATE_VIEW_SELECTED, ALL_MY_SITES); } } context.put("views", views); if(state.getAttribute(STATE_VIEW_SELECTED) != null) { context.put("viewSelected", (String) state.getAttribute(STATE_VIEW_SELECTED)); } String search = (String) state.getAttribute(STATE_SEARCH); context.put("search_term", search); sortedBy = (String) state.getAttribute (SORTED_BY); if (sortedBy == null) { state.setAttribute(SORTED_BY, SortType.TITLE_ASC.toString()); sortedBy = SortType.TITLE_ASC.toString(); } sortedAsc = (String) state.getAttribute (SORTED_ASC); if (sortedAsc == null) { state.setAttribute(SORTED_ASC, Boolean.TRUE.toString()); sortedAsc = Boolean.TRUE.toString(); } if(sortedBy!=null) context.put ("currentSortedBy", sortedBy); if(sortedAsc!=null) context.put ("currentSortAsc", sortedAsc); String portalUrl = ServerConfigurationService.getPortalUrl(); context.put("portalUrl", portalUrl); List sites = prepPage(state); state.setAttribute(STATE_SITES, sites); context.put("sites", sites); context.put("totalPageNumber", new Integer(totalPageNumber(state))); context.put("searchString", state.getAttribute(STATE_SEARCH)); context.put("form_search", FORM_SEARCH); context.put("formPageNumber", FORM_PAGE_NUMBER); context.put("prev_page_exists", state.getAttribute(STATE_PREV_PAGE_EXISTS)); context.put("next_page_exists", state.getAttribute(STATE_NEXT_PAGE_EXISTS)); context.put("current_page", state.getAttribute(STATE_CURRENT_PAGE)); // put the service in the context (used for allow update calls on each site) context.put("service", SiteService.getInstance()); context.put("sortby_title", SortType.TITLE_ASC.toString()); context.put("sortby_type", SortType.TYPE_ASC.toString()); context.put("sortby_createdby", SortType.CREATED_BY_ASC.toString()); context.put("sortby_publish", SortType.PUBLISHED_ASC.toString()); context.put("sortby_createdon", SortType.CREATED_ON_ASC.toString()); // top menu bar Menu bar = new MenuImpl(portlet, data, (String) state.getAttribute(STATE_ACTION)); if (SiteService.allowAddSite(null)) { bar.add( new MenuEntry(rb.getString("java.new"), "doNew_site")); } bar.add( new MenuEntry(rb.getString("java.revise"), null, true, MenuItem.CHECKED_NA, "doGet_site", "sitesForm")); bar.add( new MenuEntry(rb.getString("java.delete"), null, true, MenuItem.CHECKED_NA, "doMenu_site_delete", "sitesForm")); context.put("menu", bar); // default to be no pageing context.put("paged", Boolean.FALSE); Menu bar2 = new MenuImpl(portlet, data, (String) state.getAttribute(STATE_ACTION)); // add the search commands addSearchMenus(bar2, state); context.put("menu2", bar2); pagingInfoToContext(state, context); return (String)getContext(data).get("template") + TEMPLATE[0]; case 1: /* buildContextForTemplate chef_site-type.vm * */ if (hasGradSites.equalsIgnoreCase("true")) { context.put("withDissertation", Boolean.TRUE); try { //the Grad Tools site option is only presented to UM grad students String userId = StringUtil.trimToZero(SessionManager.getCurrentSessionUserId()); //am I a UM grad student? Boolean isGradStudent = new Boolean(isGradToolsCandidate(userId)); context.put("isGradStudent", isGradStudent); //if I am a UM grad student, do I already have a Grad Tools site? boolean noGradToolsSite = true; if(hasGradToolsStudentSite(userId)) noGradToolsSite = false; context.put("noGradToolsSite", new Boolean(noGradToolsSite)); } catch(Exception e) { if(Log.isWarnEnabled()) { M_log.warn("buildContextForTemplate chef_site-type.vm " + e); } } } else { context.put("withDissertation", Boolean.FALSE); } List types = (List) state.getAttribute(STATE_SITE_TYPES); context.put("siteTypes", types); // put selected/default site type into context if (siteInfo.site_type != null && siteInfo.site_type.length() >0) { context.put("typeSelected", siteInfo.site_type); } else if (types.size() > 0) { context.put("typeSelected", types.get(0)); } List terms = CourseManagementService.getTerms(); List termsForSiteCreation = new Vector(); if (terms != null && terms.size() >0) { for (int i=0; i<terms.size();i++) { Term t = (Term) terms.get(i); if (!t.getEndTime().before(TimeService.newTime())) { // don't show those terms which have ended already termsForSiteCreation.add(t); } } } if (termsForSiteCreation.size() > 0) { context.put("termList", termsForSiteCreation); } if (state.getAttribute(STATE_TERM_SELECTED) != null) { context.put("selectedTerm", state.getAttribute(STATE_TERM_SELECTED)); } return (String)getContext(data).get("template") + TEMPLATE[1]; case 2: /* buildContextForTemplate chef_site-newSiteInformation.vm * */ context.put("siteTypes", state.getAttribute(STATE_SITE_TYPES)); String siteType = (String) state.getAttribute(STATE_SITE_TYPE); context.put("titleEditableSiteType", state.getAttribute(TITLE_EDITABLE_SITE_TYPE)); context.put("type", siteType); if (siteType.equalsIgnoreCase("course")) { context.put ("isCourseSite", Boolean.TRUE); context.put("isProjectSite", Boolean.FALSE); if (state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN) != null) { context.put ("selectedProviderCourse", state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN)); } if (state.getAttribute(STATE_MANUAL_ADD_COURSE_NUMBER) != null) { int number = ((Integer) state.getAttribute(STATE_MANUAL_ADD_COURSE_NUMBER)).intValue(); context.put ("manualAddNumber", new Integer(number - 1)); context.put ("manualAddFields", state.getAttribute(STATE_MANUAL_ADD_COURSE_FIELDS)); context.put("back", "37"); } else { context.put("back", "36"); } context.put ("skins", state.getAttribute(STATE_ICONS)); if (StringUtil.trimToNull(siteInfo.getIconUrl()) != null) { context.put("selectedIcon", siteInfo.getIconUrl()); } } else { context.put ("isCourseSite", Boolean.FALSE); if (siteType.equalsIgnoreCase("project")) { context.put("isProjectSite", Boolean.TRUE); } if (StringUtil.trimToNull(siteInfo.iconUrl) != null) { context.put(FORM_ICON_URL, siteInfo.iconUrl); } context.put ("back", "1"); } context.put (FORM_TITLE,siteInfo.title); context.put(FORM_SHORT_DESCRIPTION, siteInfo.short_description); context.put (FORM_DESCRIPTION,siteInfo.description); // defalt the site contact person to the site creator if (siteInfo.site_contact_name.equals(NULL_STRING) && siteInfo.site_contact_email.equals(NULL_STRING)) { User user = UserDirectoryService.getCurrentUser(); siteInfo.site_contact_name = user.getDisplayName(); siteInfo.site_contact_email = user.getEmail(); } context.put("form_site_contact_name", siteInfo.site_contact_name); context.put("form_site_contact_email", siteInfo.site_contact_email); // those manual inputs context.put("form_requiredFields", CourseManagementService.getCourseIdRequiredFields()); context.put("fieldValues", state.getAttribute(STATE_MANUAL_ADD_COURSE_FIELDS)); return (String)getContext(data).get("template") + TEMPLATE[2]; case 3: /* buildContextForTemplate chef_site-newSiteFeatures.vm * */ siteType = (String) state.getAttribute(STATE_SITE_TYPE); if (siteType!=null && siteType.equalsIgnoreCase("course")) { context.put ("isCourseSite", Boolean.TRUE); context.put("isProjectSite", Boolean.FALSE); } else { context.put ("isCourseSite", Boolean.FALSE); if (siteType.equalsIgnoreCase("project")) { context.put("isProjectSite", Boolean.TRUE); } } context.put("defaultTools", ServerConfigurationService.getToolsRequired(siteType)); toolRegistrationSelectedList = (List) state.getAttribute(STATE_TOOL_REGISTRATION_SELECTED_LIST); // If this is the first time through, check for tools // which should be selected by default. List defaultSelectedTools = ServerConfigurationService.getDefaultTools(siteType); if (toolRegistrationSelectedList == null) { toolRegistrationSelectedList = new Vector(defaultSelectedTools); } context.put (STATE_TOOL_REGISTRATION_SELECTED_LIST, toolRegistrationSelectedList); // String toolId's context.put (STATE_TOOL_REGISTRATION_LIST, state.getAttribute(STATE_TOOL_REGISTRATION_LIST) ); // %%% use ToolRegistrations for template list context.put("emailId", state.getAttribute(STATE_TOOL_EMAIL_ADDRESS)); context.put("serverName", ServerConfigurationService.getServerName()); // The "Home" tool checkbox needs special treatment to be selected by // default. Boolean checkHome = (Boolean)state.getAttribute(STATE_TOOL_HOME_SELECTED); if (checkHome == null) { if ((defaultSelectedTools != null) && defaultSelectedTools.contains("home")) { checkHome = Boolean.TRUE; } } context.put("check_home", checkHome); //titles for news tools context.put("newsTitles", state.getAttribute(STATE_NEWS_TITLES)); //titles for web content tools context.put("wcTitles", state.getAttribute(STATE_WEB_CONTENT_TITLES)); //urls for news tools context.put("newsUrls", state.getAttribute(STATE_NEWS_URLS)); //urls for web content tools context.put("wcUrls", state.getAttribute(STATE_WEB_CONTENT_URLS)); context.put("sites", SiteService.getSites(org.sakaiproject.site.api.SiteService.SelectionType.UPDATE, null, null, null, SortType.TITLE_ASC, null)); context.put("import", state.getAttribute(STATE_IMPORT)); context.put("importSites", state.getAttribute(STATE_IMPORT_SITES)); return (String)getContext(data).get("template") + TEMPLATE[3]; case 4: /* buildContextForTemplate chef_site-addRemoveFeatures.vm * */ context.put("SiteTitle", site.getTitle()); String type = (String) state.getAttribute(STATE_SITE_TYPE); context.put("defaultTools", ServerConfigurationService.getToolsRequired(type)); boolean myworkspace_site = false; //Put up tool lists filtered by category List siteTypes = (List) state.getAttribute(STATE_SITE_TYPES); if (siteTypes.contains(type)) { myworkspace_site = false; } if (SiteService.isUserSite(site.getId()) || (type!=null && type.equalsIgnoreCase("myworkspace"))) { myworkspace_site = true; type="myworkspace"; } context.put ("myworkspace_site", new Boolean(myworkspace_site)); context.put(STATE_TOOL_REGISTRATION_SELECTED_LIST, state.getAttribute(STATE_TOOL_REGISTRATION_SELECTED_LIST)); //titles for news tools context.put("newsTitles", state.getAttribute(STATE_NEWS_TITLES)); //titles for web content tools context.put("wcTitles", state.getAttribute(STATE_WEB_CONTENT_TITLES)); //urls for news tools context.put("newsUrls", state.getAttribute(STATE_NEWS_URLS)); //urls for web content tools context.put("wcUrls", state.getAttribute(STATE_WEB_CONTENT_URLS)); context.put (STATE_TOOL_REGISTRATION_LIST, state.getAttribute(STATE_TOOL_REGISTRATION_LIST)); context.put("check_home", state.getAttribute(STATE_TOOL_HOME_SELECTED)); //get the email alias when an Email Archive tool has been selected String channelReference = mailArchiveChannelReference(site.getId()); List aliases = AliasService.getAliases(channelReference, 1, 1); if (aliases.size() > 0) { state.setAttribute(STATE_TOOL_EMAIL_ADDRESS, ((Alias) aliases.get(0)).getId()); } else { state.removeAttribute(STATE_TOOL_EMAIL_ADDRESS); } if (state.getAttribute(STATE_TOOL_EMAIL_ADDRESS) != null) { context.put("emailId", state.getAttribute(STATE_TOOL_EMAIL_ADDRESS)); } context.put("serverName", ServerConfigurationService.getServerName()); context.put("backIndex", "12"); return (String)getContext(data).get("template") + TEMPLATE[4]; case 5: /* buildContextForTemplate chef_site-addParticipant.vm * */ context.put("title", site.getTitle()); roles = getRoles(state); context.put("roles", roles); // Note that (for now) these strings are in both sakai.properties and sitesetupgeneric.properties context.put("noEmailInIdAccountName", ServerConfigurationService.getString("noEmailInIdAccountName")); context.put("noEmailInIdAccountLabel", ServerConfigurationService.getString("noEmailInIdAccountLabel")); context.put("emailInIdAccountName", ServerConfigurationService.getString("emailInIdAccountName")); context.put("emailInIdAccountLabel", ServerConfigurationService.getString("emailInIdAccountLabel")); if(state.getAttribute("noEmailInIdAccountValue")!=null) { context.put("noEmailInIdAccountValue", (String)state.getAttribute("noEmailInIdAccountValue")); } if(state.getAttribute("emailInIdAccountValue")!=null) { context.put("emailInIdAccountValue", (String)state.getAttribute("emailInIdAccountValue")); } if(state.getAttribute("form_same_role") != null) { context.put("form_same_role", ((Boolean) state.getAttribute("form_same_role")).toString()); } else { context.put("form_same_role", Boolean.TRUE.toString()); } context.put("backIndex", "12"); return (String)getContext(data).get("template") + TEMPLATE[5]; case 6: /* buildContextForTemplate chef_site-removeParticipants.vm * */ context.put("title", site.getTitle()); realmId = SiteService.siteReference(site.getId()); try { AuthzGroup realm = AuthzGroupService.getAuthzGroup(realmId); try { List removeableList = (List) state.getAttribute(STATE_REMOVEABLE_USER_LIST); List removeableParticipants = new Vector(); for (int k = 0; k < removeableList.size(); k++) { User user = UserDirectoryService.getUser((String) removeableList.get(k)); Participant participant = new Participant(); participant.name = user.getSortName(); participant.uniqname = user.getId(); Role r = realm.getUserRole(user.getId()); if (r != null) { participant.role = r.getId(); } removeableParticipants.add(participant); } context.put("removeableList", removeableParticipants); } catch (UserNotDefinedException ee) { } } catch (GroupNotDefinedException e) { } context.put("backIndex", "18"); return (String)getContext(data).get("template") + TEMPLATE[6]; case 7: /* buildContextForTemplate chef_site-changeRoles.vm * */ context.put("same_role", state.getAttribute(STATE_CHANGEROLE_SAMEROLE)); roles = getRoles(state); context.put("roles", roles); context.put("currentRole", state.getAttribute(STATE_CHANGEROLE_SAMEROLE_ROLE)); context.put("participantSelectedList", state.getAttribute(STATE_SELECTED_PARTICIPANTS)); context.put("selectedRoles", state.getAttribute(STATE_SELECTED_PARTICIPANT_ROLES)); context.put("siteTitle", site.getTitle()); return (String)getContext(data).get("template") + TEMPLATE[7]; case 8: /* buildContextForTemplate chef_site-siteDeleteConfirm.vm * */ String site_title = NULL_STRING; String[] removals = (String[]) state.getAttribute(STATE_SITE_REMOVALS); List remove = new Vector(); String user = SessionManager.getCurrentSessionUserId(); String workspace = SiteService.getUserSiteId(user); if( removals != null && removals.length != 0 ) { for (int i = 0; i < removals.length; i++ ) { String id = (String) removals[i]; if(!(id.equals(workspace))) { try { site_title = SiteService.getSite(id).getTitle(); } catch (IdUnusedException e) { M_log.warn("SiteAction.doSite_delete_confirmed - IdUnusedException " + id); addAlert(state, rb.getString("java.sitewith")+" " + id + " "+rb.getString("java.couldnt")+" "); } if(SiteService.allowRemoveSite(id)) { try { Site removeSite = SiteService.getSite(id); remove.add(removeSite); } catch (IdUnusedException e) { M_log.warn("SiteAction.buildContextForTemplate chef_site-siteDeleteConfirm.vm: IdUnusedException"); } } else { addAlert(state, site_title + " "+rb.getString("java.couldntdel") + " "); } } else { addAlert(state, rb.getString("java.yourwork")); } } if(remove.size() == 0) { addAlert(state, rb.getString("java.click")); } } context.put("removals", remove); return (String)getContext(data).get("template") + TEMPLATE[8]; case 9: /* buildContextForTemplate chef_site-publishUnpublish.vm * */ context.put("publish", Boolean.valueOf(((SiteInfo)state.getAttribute(STATE_SITE_INFO)).getPublished())); context.put("backIndex", "12"); return (String)getContext(data).get("template") + TEMPLATE[9]; case 10: /* buildContextForTemplate chef_site-newSiteConfirm.vm * */ siteInfo = (SiteInfo)state.getAttribute(STATE_SITE_INFO); siteType = (String) state.getAttribute(STATE_SITE_TYPE); if (siteType.equalsIgnoreCase("course")) { context.put ("isCourseSite", Boolean.TRUE); context.put ("isProjectSite", Boolean.FALSE); if (state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN) != null) { context.put ("selectedProviderCourse", state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN)); } if (state.getAttribute(STATE_MANUAL_ADD_COURSE_NUMBER) != null) { int number = ((Integer) state.getAttribute(STATE_MANUAL_ADD_COURSE_NUMBER)).intValue(); context.put ("manualAddNumber", new Integer(number - 1)); context.put ("manualAddFields", state.getAttribute(STATE_MANUAL_ADD_COURSE_FIELDS)); } context.put ("skins", state.getAttribute(STATE_ICONS)); if (StringUtil.trimToNull(siteInfo.getIconUrl()) != null) { context.put("selectedIcon", siteInfo.getIconUrl()); } } else { context.put ("isCourseSite", Boolean.FALSE); if (siteType!=null && siteType.equalsIgnoreCase("project")) { context.put("isProjectSite", Boolean.TRUE); } if (StringUtil.trimToNull(siteInfo.iconUrl) != null) { context.put("iconUrl", siteInfo.iconUrl); } } context.put("title", siteInfo.title); context.put("description", siteInfo.description); context.put("short_description", siteInfo.short_description); context.put("siteContactName", siteInfo.site_contact_name); context.put("siteContactEmail", siteInfo.site_contact_email); siteType = (String) state.getAttribute(STATE_SITE_TYPE); toolRegistrationSelectedList = (List) state.getAttribute(STATE_TOOL_REGISTRATION_SELECTED_LIST); context.put (STATE_TOOL_REGISTRATION_SELECTED_LIST, toolRegistrationSelectedList); // String toolId's context.put (STATE_TOOL_REGISTRATION_LIST, state.getAttribute(STATE_TOOL_REGISTRATION_LIST)); // %%% use Tool context.put("check_home", state.getAttribute(STATE_TOOL_HOME_SELECTED)); context.put("emailId", state.getAttribute(STATE_TOOL_EMAIL_ADDRESS)); context.put("serverName", ServerConfigurationService.getServerName()); context.put("include", new Boolean(siteInfo.include)); context.put("published", new Boolean(siteInfo.published)); context.put("joinable", new Boolean(siteInfo.joinable)); context.put("joinerRole", siteInfo.joinerRole); context.put("newsTitles", (Hashtable) state.getAttribute(STATE_NEWS_TITLES)); context.put("wcTitles", (Hashtable) state.getAttribute(STATE_WEB_CONTENT_TITLES)); // back to edit access page context.put("back", "18"); context.put("importSiteTools", state.getAttribute(STATE_IMPORT_SITE_TOOL)); context.put("siteService", SiteService.getInstance()); // those manual inputs context.put("form_requiredFields", CourseManagementService.getCourseIdRequiredFields()); context.put("fieldValues", state.getAttribute(STATE_MANUAL_ADD_COURSE_FIELDS)); return (String)getContext(data).get("template") + TEMPLATE[10]; case 11: /* buildContextForTemplate chef_site-newSitePublishUnpublish.vm * */ return (String)getContext(data).get("template") + TEMPLATE[11]; case 12: /* buildContextForTemplate chef_site-siteInfo-list.vm * */ context.put("userDirectoryService", UserDirectoryService.getInstance()); try { siteProperties = site.getProperties(); siteType = site.getType(); if (siteType != null) { state.setAttribute(STATE_SITE_TYPE, siteType); } boolean isMyWorkspace = false; if (SiteService.isUserSite(site.getId())) { if (SiteService.getSiteUserId(site.getId()).equals(SessionManager.getCurrentSessionUserId())) { isMyWorkspace = true; context.put("siteUserId", SiteService.getSiteUserId(site.getId())); } } context.put("isMyWorkspace", Boolean.valueOf(isMyWorkspace)); String siteId = site.getId(); if (state.getAttribute(STATE_ICONS)!= null) { List skins = (List)state.getAttribute(STATE_ICONS); for (int i = 0; i < skins.size(); i++) { Icon s = (Icon)skins.get(i); if(!StringUtil.different(s.getUrl(), site.getIconUrl())) { context.put("siteUnit", s.getName()); break; } } } context.put("siteIcon", site.getIconUrl()); context.put("siteTitle", site.getTitle()); context.put("siteDescription", site.getDescription()); context.put("siteJoinable", new Boolean(site.isJoinable())); if(site.isPublished()) { context.put("published", Boolean.TRUE); } else { context.put("published", Boolean.FALSE); context.put("owner", site.getCreatedBy().getSortName()); } Time creationTime = site.getCreatedTime(); if (creationTime != null) { context.put("siteCreationDate", creationTime.toStringLocalFull()); } boolean allowUpdateSite = SiteService.allowUpdateSite(siteId); context.put("allowUpdate", Boolean.valueOf(allowUpdateSite)); boolean allowUpdateGroupMembership = SiteService.allowUpdateGroupMembership(siteId); context.put("allowUpdateGroupMembership", Boolean.valueOf(allowUpdateGroupMembership)); boolean allowUpdateSiteMembership = SiteService.allowUpdateSiteMembership(siteId); context.put("allowUpdateSiteMembership", Boolean.valueOf(allowUpdateSiteMembership)); if (allowUpdateSite) { // top menu bar Menu b = new MenuImpl(portlet, data, (String) state.getAttribute(STATE_ACTION)); if (!isMyWorkspace) { b.add( new MenuEntry(rb.getString("java.editsite"), "doMenu_edit_site_info")); } b.add( new MenuEntry(rb.getString("java.edittools"), "doMenu_edit_site_tools")); if (!isMyWorkspace && (ServerConfigurationService.getString("wsetup.group.support") == "" || ServerConfigurationService.getString("wsetup.group.support").equalsIgnoreCase(Boolean.TRUE.toString()))) { // show the group toolbar unless configured to not support group b.add( new MenuEntry(rb.getString("java.group"), "doMenu_group")); } if (!isMyWorkspace) { List gradToolsSiteTypes = (List) state.getAttribute(GRADTOOLS_SITE_TYPES); boolean isGradToolSite = false; if (siteType != null && gradToolsSiteTypes.contains(siteType)) { isGradToolSite = true; } if (siteType == null || siteType != null && !isGradToolSite) { // hide site access for GRADTOOLS type of sites b.add( new MenuEntry(rb.getString("java.siteaccess"), "doMenu_edit_site_access")); } b.add( new MenuEntry(rb.getString("java.addp"), "doMenu_siteInfo_addParticipant")); if (siteType != null && siteType.equals("course")) { b.add( new MenuEntry(rb.getString("java.editc"), "doMenu_siteInfo_editClass")); } if (siteType == null || siteType != null && !isGradToolSite) { // hide site duplicate and import for GRADTOOLS type of sites b.add( new MenuEntry(rb.getString("java.duplicate"), "doMenu_siteInfo_duplicate")); List updatableSites = SiteService.getSites(org.sakaiproject.site.api.SiteService.SelectionType.UPDATE, null, null, null, SortType.TITLE_ASC, null); // import link should be visible even if only one site if (updatableSites.size() > 0) { b.add( new MenuEntry(rb.getString("java.import"), "doMenu_siteInfo_import")); // a configuration param for showing/hiding import from file choice String importFromFile = ServerConfigurationService.getString("site.setup.import.file", Boolean.TRUE.toString()); if (importFromFile.equalsIgnoreCase("true")) { //htripath: June 4th added as per Kris and changed desc of above b.add(new MenuEntry(rb.getString("java.importFile"), "doAttachmentsMtrlFrmFile")); } } } } context.put("menu", b); } if (allowUpdateGroupMembership) { // show Manage Groups menu Menu b = new MenuImpl(portlet, data, (String) state.getAttribute(STATE_ACTION)); if (!isMyWorkspace && (ServerConfigurationService.getString("wsetup.group.support") == "" || ServerConfigurationService.getString("wsetup.group.support").equalsIgnoreCase(Boolean.TRUE.toString()))) { // show the group toolbar unless configured to not support group b.add( new MenuEntry(rb.getString("java.group"), "doMenu_group")); } context.put("menu", b); } if (allowUpdateSiteMembership) { // show add participant menu Menu b = new MenuImpl(portlet, data, (String) state.getAttribute(STATE_ACTION)); if (!isMyWorkspace) { // show the Add Participant menu b.add( new MenuEntry(rb.getString("java.addp"), "doMenu_siteInfo_addParticipant")); } context.put("menu", b); } if (((String) state.getAttribute(STATE_SITE_MODE)).equalsIgnoreCase(SITE_MODE_SITESETUP)) { // editing from worksite setup tool context.put("fromWSetup", Boolean.TRUE); if (state.getAttribute(STATE_PREV_SITE) != null) { context.put("prevSite", state.getAttribute(STATE_PREV_SITE)); } if (state.getAttribute(STATE_NEXT_SITE) != null) { context.put("nextSite", state.getAttribute(STATE_NEXT_SITE)); } } else { context.put("fromWSetup", Boolean.FALSE); } //allow view roster? boolean allowViewRoster = SiteService.allowViewRoster(siteId); if (allowViewRoster) { context.put("viewRoster", Boolean.TRUE); } else { context.put("viewRoster", Boolean.FALSE); } //set participant list if (allowUpdateSite || allowViewRoster || allowUpdateSiteMembership) { List participants = new Vector(); participants = getParticipantList(state); sortedBy = (String) state.getAttribute (SORTED_BY); sortedAsc = (String) state.getAttribute (SORTED_ASC); if(sortedBy==null) { state.setAttribute(SORTED_BY, SORTED_BY_PARTICIPANT_NAME); sortedBy = SORTED_BY_PARTICIPANT_NAME; } if (sortedAsc==null) { state.setAttribute(SORTED_ASC, SORTED_ASC); sortedAsc = SORTED_ASC; } if(sortedBy!=null) context.put ("currentSortedBy", sortedBy); if(sortedAsc!=null) context.put ("currentSortAsc", sortedAsc); Iterator sortedParticipants = null; if (sortedBy != null) { sortedParticipants = new SortedIterator (participants.iterator (), new SiteComparator (sortedBy, sortedAsc)); participants.clear(); while (sortedParticipants.hasNext()) { participants.add(sortedParticipants.next()); } } context.put("participantListSize", new Integer(participants.size())); context.put("participantList", prepPage(state)); pagingInfoToContext(state, context); } context.put("include", Boolean.valueOf(site.isPubView())); // site contact information String contactName = siteProperties.getProperty(PROP_SITE_CONTACT_NAME); String contactEmail = siteProperties.getProperty(PROP_SITE_CONTACT_EMAIL); if (contactName == null && contactEmail == null) { User u = site.getCreatedBy(); String email = u.getEmail(); if (email != null) { contactEmail = u.getEmail(); } contactName = u.getDisplayName(); } if (contactName != null) { context.put("contactName", contactName); } if (contactEmail != null) { context.put("contactEmail", contactEmail); } if (siteType != null && siteType.equalsIgnoreCase("course")) { context.put("isCourseSite", Boolean.TRUE); List providerCourseList = getProviderCourseList(StringUtil.trimToNull(getExternalRealmId(state))); if (providerCourseList != null) { state.setAttribute(SITE_PROVIDER_COURSE_LIST, providerCourseList); context.put("providerCourseList", providerCourseList); } String manualCourseListString = site.getProperties().getProperty(PROP_SITE_REQUEST_COURSE); if (manualCourseListString != null) { List manualCourseList = new Vector(); if (manualCourseListString.indexOf("+") != -1) { manualCourseList = new ArrayList(Arrays.asList(manualCourseListString.split("\\+"))); } else { manualCourseList.add(manualCourseListString); } state.setAttribute(SITE_MANUAL_COURSE_LIST, manualCourseList); context.put("manualCourseList", manualCourseList); } context.put("term", siteProperties.getProperty(PROP_SITE_TERM)); } else { context.put("isCourseSite", Boolean.FALSE); } } catch (Exception e) { M_log.warn(this + " site info list: " + e.toString()); } roles = getRoles(state); context.put("roles", roles); // will have the choice to active/inactive user or not String activeInactiveUser = ServerConfigurationService.getString("activeInactiveUser", Boolean.FALSE.toString()); if (activeInactiveUser.equalsIgnoreCase("true")) { context.put("activeInactiveUser", Boolean.TRUE); // put realm object into context realmId = SiteService.siteReference(site.getId()); try { context.put("realm", AuthzGroupService.getAuthzGroup(realmId)); } catch (GroupNotDefinedException e) { M_log.warn(this + " IdUnusedException " + realmId); } } else { context.put("activeInactiveUser", Boolean.FALSE); } context.put("groupsWithMember", site.getGroupsWithMember(UserDirectoryService.getCurrentUser().getId())); return (String)getContext(data).get("template") + TEMPLATE[12]; case 13: /* buildContextForTemplate chef_site-siteInfo-editInfo.vm * */ siteProperties = site.getProperties(); context.put("title", state.getAttribute(FORM_SITEINFO_TITLE)); context.put("titleEditableSiteType", state.getAttribute(TITLE_EDITABLE_SITE_TYPE)); context.put("type", site.getType()); siteType = (String) state.getAttribute(STATE_SITE_TYPE); if (siteType != null && siteType.equalsIgnoreCase("course")) { context.put("isCourseSite", Boolean.TRUE); context.put("skins", state.getAttribute(STATE_ICONS)); if (state.getAttribute(FORM_SITEINFO_SKIN) != null) { context.put("selectedIcon",state.getAttribute(FORM_SITEINFO_SKIN)); } else if (site.getIconUrl() != null) { context.put("selectedIcon",site.getIconUrl()); } terms = CourseManagementService.getTerms(); if (terms != null && terms.size() >0) { context.put("termList", terms); } if (state.getAttribute(FORM_SITEINFO_TERM) == null) { String currentTerm = site.getProperties().getProperty(PROP_SITE_TERM); if (currentTerm != null) { state.setAttribute(FORM_SITEINFO_TERM, currentTerm); } } if (state.getAttribute(FORM_SITEINFO_TERM) != null) { context.put("selectedTerm", state.getAttribute(FORM_SITEINFO_TERM)); } } else { context.put("isCourseSite", Boolean.FALSE); if (state.getAttribute(FORM_SITEINFO_ICON_URL) == null && StringUtil.trimToNull(site.getIconUrl()) != null) { state.setAttribute(FORM_SITEINFO_ICON_URL, site.getIconUrl()); } if (state.getAttribute(FORM_SITEINFO_ICON_URL) != null) { context.put("iconUrl", state.getAttribute(FORM_SITEINFO_ICON_URL)); } } context.put("description", state.getAttribute(FORM_SITEINFO_DESCRIPTION)); context.put("short_description", state.getAttribute(FORM_SITEINFO_SHORT_DESCRIPTION)); context.put("form_site_contact_name", state.getAttribute(FORM_SITEINFO_CONTACT_NAME)); context.put("form_site_contact_email", state.getAttribute(FORM_SITEINFO_CONTACT_EMAIL)); //Display of appearance icon/url list with course site based on // "disable.course.site.skin.selection" value set with sakai.properties file. if ((ServerConfigurationService.getString("disable.course.site.skin.selection")).equals("true")){ context.put("disableCourseSelection", Boolean.TRUE); } return (String)getContext(data).get("template") + TEMPLATE[13]; case 14: /* buildContextForTemplate chef_site-siteInfo-editInfoConfirm.vm * */ siteProperties = site.getProperties(); siteType = (String)state.getAttribute(STATE_SITE_TYPE); if (siteType != null && siteType.equalsIgnoreCase("course")) { context.put("isCourseSite", Boolean.TRUE); context.put("siteTerm", state.getAttribute(FORM_SITEINFO_TERM)); } else { context.put("isCourseSite", Boolean.FALSE); } context.put("oTitle", site.getTitle()); context.put("title", state.getAttribute(FORM_SITEINFO_TITLE)); context.put("description", state.getAttribute(FORM_SITEINFO_DESCRIPTION)); context.put("oDescription", site.getDescription()); context.put("short_description", state.getAttribute(FORM_SITEINFO_SHORT_DESCRIPTION)); context.put("oShort_description", site.getShortDescription()); context.put("skin", state.getAttribute(FORM_SITEINFO_SKIN)); context.put("oSkin", site.getIconUrl()); context.put("skins", state.getAttribute(STATE_ICONS)); context.put("oIcon", site.getIconUrl()); context.put("icon", state.getAttribute(FORM_SITEINFO_ICON_URL)); context.put("include", state.getAttribute(FORM_SITEINFO_INCLUDE)); context.put("oInclude", Boolean.valueOf(site.isPubView())); context.put("name", state.getAttribute(FORM_SITEINFO_CONTACT_NAME)); context.put("oName", siteProperties.getProperty(PROP_SITE_CONTACT_NAME)); context.put("email", state.getAttribute(FORM_SITEINFO_CONTACT_EMAIL)); context.put("oEmail", siteProperties.getProperty(PROP_SITE_CONTACT_EMAIL)); return (String)getContext(data).get("template") + TEMPLATE[14]; case 15: /* buildContextForTemplate chef_site-addRemoveFeatureConfirm.vm * */ context.put("title", site.getTitle()); site_type = (String)state.getAttribute(STATE_SITE_TYPE); myworkspace_site = false; if (SiteService.isUserSite(site.getId())) { if (SiteService.getSiteUserId(site.getId()).equals(SessionManager.getCurrentSessionUserId())) { myworkspace_site = true; site_type = "myworkspace"; } } context.put (STATE_TOOL_REGISTRATION_LIST, state.getAttribute(STATE_TOOL_REGISTRATION_LIST)); context.put("check_home", state.getAttribute(STATE_TOOL_HOME_SELECTED)); context.put("selectedTools", orderToolIds(state, (String) state.getAttribute(STATE_SITE_TYPE), (List) state.getAttribute(STATE_TOOL_REGISTRATION_SELECTED_LIST))); context.put("oldSelectedTools", state.getAttribute(STATE_TOOL_REGISTRATION_OLD_SELECTED_LIST)); context.put("oldSelectedHome", state.getAttribute(STATE_TOOL_REGISTRATION_OLD_SELECTED_HOME)); context.put("continueIndex", "12"); if (state.getAttribute(STATE_TOOL_EMAIL_ADDRESS) != null) { context.put("emailId", state.getAttribute(STATE_TOOL_EMAIL_ADDRESS)); } context.put("serverName", ServerConfigurationService.getServerName()); context.put("newsTitles", (Hashtable) state.getAttribute(STATE_NEWS_TITLES)); context.put("wcTitles", (Hashtable) state.getAttribute(STATE_WEB_CONTENT_TITLES)); if (fromENWModifyView(state)) { context.put("back", "26"); } else { context.put("back", "4"); } return (String)getContext(data).get("template") + TEMPLATE[15]; case 16: /* buildContextForTemplate chef_site-publishUnpublish-sendEmail.vm * */ context.put("title", site.getTitle()); context.put("willNotify", state.getAttribute(FORM_WILL_NOTIFY)); return (String)getContext(data).get("template") + TEMPLATE[16]; case 17: /* buildContextForTemplate chef_site-publishUnpublish-confirm.vm * */ context.put("title", site.getTitle()); context.put("continueIndex", "12"); SiteInfo sInfo = (SiteInfo) state.getAttribute(STATE_SITE_INFO); if (sInfo.getPublished()) { context.put("publish", Boolean.TRUE); context.put("backIndex", "16"); } else { context.put("publish", Boolean.FALSE); context.put("backIndex", "9"); } context.put("willNotify", state.getAttribute(FORM_WILL_NOTIFY)); return (String)getContext(data).get("template") + TEMPLATE[17]; case 18: /* buildContextForTemplate chef_siteInfo-editAccess.vm * */ List publicChangeableSiteTypes = (List) state.getAttribute(STATE_PUBLIC_CHANGEABLE_SITE_TYPES); List unJoinableSiteTypes = (List) state.getAttribute(STATE_DISABLE_JOINABLE_SITE_TYPE); if (site != null) { //editing existing site context.put("site", site); siteType = state.getAttribute(STATE_SITE_TYPE)!=null?(String)state.getAttribute(STATE_SITE_TYPE):null; if ( siteType != null && publicChangeableSiteTypes.contains(siteType)) { context.put ("publicChangeable", Boolean.TRUE); } else { context.put("publicChangeable", Boolean.FALSE); } context.put("include", Boolean.valueOf(site.isPubView())); if ( siteType != null && !unJoinableSiteTypes.contains(siteType)) { // site can be set as joinable context.put("disableJoinable", Boolean.FALSE); if (state.getAttribute(STATE_JOINABLE) == null) { state.setAttribute(STATE_JOINABLE, Boolean.valueOf(site.isJoinable())); } if (state.getAttribute(STATE_JOINERROLE) == null || state.getAttribute(STATE_JOINABLE) != null && ((Boolean) state.getAttribute(STATE_JOINABLE)).booleanValue()) { state.setAttribute(STATE_JOINERROLE, site.getJoinerRole()); } if (state.getAttribute(STATE_JOINABLE) != null) { context.put("joinable", state.getAttribute(STATE_JOINABLE)); } if (state.getAttribute(STATE_JOINERROLE) != null) { context.put("joinerRole", state.getAttribute(STATE_JOINERROLE)); } } else { //site cannot be set as joinable context.put("disableJoinable", Boolean.TRUE); } context.put("roles", getRoles(state)); context.put("back", "12"); } else { siteInfo = (SiteInfo) state.getAttribute(STATE_SITE_INFO); if ( siteInfo.site_type != null && publicChangeableSiteTypes.contains(siteInfo.site_type)) { context.put ("publicChangeable", Boolean.TRUE); } else { context.put("publicChangeable", Boolean.FALSE); } context.put("include", Boolean.valueOf(siteInfo.getInclude())); context.put("published", Boolean.valueOf(siteInfo.getPublished())); if ( siteInfo.site_type != null && !unJoinableSiteTypes.contains(siteInfo.site_type)) { // site can be set as joinable context.put("disableJoinable", Boolean.FALSE); context.put("joinable", Boolean.valueOf(siteInfo.joinable)); context.put("joinerRole", siteInfo.joinerRole); } else { // site cannot be set as joinable context.put("disableJoinable", Boolean.TRUE); } // use the type's template, if defined String realmTemplate = "!site.template"; if (siteInfo.site_type != null) { realmTemplate = realmTemplate + "." + siteInfo.site_type; } try { AuthzGroup r = AuthzGroupService.getAuthzGroup(realmTemplate); context.put("roles", r.getRoles()); } catch (GroupNotDefinedException e) { try { AuthzGroup rr = AuthzGroupService.getAuthzGroup("!site.template"); context.put("roles", rr.getRoles()); } catch (GroupNotDefinedException ee) { } } // new site, go to confirmation page context.put("continue", "10"); if (fromENWModifyView(state)) { context.put("back", "26"); } else if (state.getAttribute(STATE_IMPORT) != null) { context.put("back", "27"); } else { context.put("back", "3"); } siteType = (String) state.getAttribute(STATE_SITE_TYPE); if (siteType!=null && siteType.equalsIgnoreCase("course")) { context.put ("isCourseSite", Boolean.TRUE); context.put("isProjectSite", Boolean.FALSE); } else { context.put ("isCourseSite", Boolean.FALSE); if (siteType.equalsIgnoreCase("project")) { context.put("isProjectSite", Boolean.TRUE); } } } return (String)getContext(data).get("template") + TEMPLATE[18]; case 19: /* buildContextForTemplate chef_site-addParticipant-sameRole.vm * */ context.put("title", site.getTitle()); context.put("roles", getRoles(state)); context.put("participantList", state.getAttribute(STATE_ADD_PARTICIPANTS)); context.put("form_selectedRole", state.getAttribute("form_selectedRole")); return (String)getContext(data).get("template") + TEMPLATE[19]; case 20: /* buildContextForTemplate chef_site-addParticipant-differentRole.vm * */ context.put("title", site.getTitle()); context.put("roles", getRoles(state)); context.put("selectedRoles", state.getAttribute(STATE_SELECTED_PARTICIPANT_ROLES)); context.put("participantList", state.getAttribute(STATE_ADD_PARTICIPANTS)); return (String)getContext(data).get("template") + TEMPLATE[20]; case 21: /* buildContextForTemplate chef_site-addParticipant-notification.vm * */ context.put("title", site.getTitle()); if (state.getAttribute("form_selectedNotify") == null) { state.setAttribute("form_selectedNotify", Boolean.FALSE); } context.put("notify", state.getAttribute("form_selectedNotify")); boolean same_role = state.getAttribute("form_same_role")==null?true:((Boolean) state.getAttribute("form_same_role")).booleanValue(); if (same_role) { context.put("backIndex", "19"); } else { context.put("backIndex", "20"); } return (String)getContext(data).get("template") + TEMPLATE[21]; case 22: /* buildContextForTemplate chef_site-addParticipant-confirm.vm * */ context.put("title", site.getTitle()); context.put("participants", state.getAttribute(STATE_ADD_PARTICIPANTS)); context.put("notify", state.getAttribute("form_selectedNotify")); context.put("roles", getRoles(state)); context.put("same_role", state.getAttribute("form_same_role")); context.put("selectedRoles", state.getAttribute(STATE_SELECTED_PARTICIPANT_ROLES)); context.put("selectedRole", state.getAttribute("form_selectedRole")); return (String)getContext(data).get("template") + TEMPLATE[22]; case 23: /* buildContextForTemplate chef_siteInfo-editAccess-globalAccess.vm * */ context.put("title", site.getTitle()); context.put("roles", getRoles(state)); if (state.getAttribute("form_joinable") == null) { state.setAttribute("form_joinable", new Boolean(site.isJoinable())); } context.put("form_joinable", state.getAttribute("form_joinable")); if (state.getAttribute("form_joinerRole") == null) { state.setAttribute("form_joinerRole", site.getJoinerRole()); } context.put("form_joinerRole", state.getAttribute("form_joinerRole")); return (String)getContext(data).get("template") + TEMPLATE[23]; case 24: /* buildContextForTemplate chef_siteInfo-editAccess-globalAccess-confirm.vm * */ context.put("title", site.getTitle()); context.put("form_joinable", state.getAttribute("form_joinable")); context.put("form_joinerRole", state.getAttribute("form_joinerRole")); return (String)getContext(data).get("template") + TEMPLATE[24]; case 25: /* buildContextForTemplate chef_changeRoles-confirm.vm * */ Boolean sameRole = (Boolean) state.getAttribute(STATE_CHANGEROLE_SAMEROLE); context.put("sameRole", sameRole); if (sameRole.booleanValue()) { // same role context.put("currentRole", state.getAttribute(STATE_CHANGEROLE_SAMEROLE_ROLE)); } else { context.put("selectedRoles", state.getAttribute(STATE_SELECTED_PARTICIPANT_ROLES)); } roles = getRoles(state); context.put("roles", roles); context.put("participantSelectedList", state.getAttribute(STATE_SELECTED_PARTICIPANTS)); if (state.getAttribute(STATE_SELECTED_PARTICIPANT_ROLES) != null) { context.put("selectedRoles", state.getAttribute(STATE_SELECTED_PARTICIPANT_ROLES)); } context.put("siteTitle", site.getTitle()); return (String)getContext(data).get("template") + TEMPLATE[25]; case 26: /* buildContextForTemplate chef_site-modifyENW.vm * */ site_type = (String) state.getAttribute(STATE_SITE_TYPE); boolean existingSite = site != null? true:false; if (existingSite) { // revising a existing site's tool context.put("existingSite", Boolean.TRUE); context.put("back", "4"); context.put("continue", "15"); context.put("function", "eventSubmit_doAdd_remove_features"); } else { // new site context.put("existingSite", Boolean.FALSE); context.put("function", "eventSubmit_doAdd_features"); if (state.getAttribute(STATE_IMPORT) != null) { context.put("back", "27"); } else { // new site, go to edit access page context.put("back", "3"); } context.put("continue", "18"); } context.put (STATE_TOOL_REGISTRATION_LIST, state.getAttribute(STATE_TOOL_REGISTRATION_LIST)); toolRegistrationSelectedList = (List) state.getAttribute(STATE_TOOL_REGISTRATION_SELECTED_LIST); context.put (STATE_TOOL_REGISTRATION_SELECTED_LIST, toolRegistrationSelectedList); // String toolId's String emailId = (String) state.getAttribute(STATE_TOOL_EMAIL_ADDRESS); if (emailId != null) { context.put("emailId", emailId); } //titles for news tools newsTitles = (Hashtable) state.getAttribute(STATE_NEWS_TITLES); if (newsTitles == null) { newsTitles = new Hashtable(); newsTitles.put("sakai.news", NEWS_DEFAULT_TITLE); state.setAttribute(STATE_NEWS_TITLES, newsTitles); } context.put("newsTitles", newsTitles); //urls for news tools newsUrls = (Hashtable) state.getAttribute(STATE_NEWS_URLS); if (newsUrls == null) { newsUrls = new Hashtable(); newsUrls.put("sakai.news", NEWS_DEFAULT_URL); state.setAttribute(STATE_NEWS_URLS, newsUrls); } context.put("newsUrls", newsUrls); // titles for web content tools wcTitles = (Hashtable) state.getAttribute(STATE_WEB_CONTENT_TITLES); if (wcTitles == null) { wcTitles = new Hashtable(); wcTitles.put("sakai.iframe", WEB_CONTENT_DEFAULT_TITLE); state.setAttribute(STATE_WEB_CONTENT_TITLES, wcTitles); } context.put("wcTitles", wcTitles); //URLs for web content tools wcUrls = (Hashtable) state.getAttribute(STATE_WEB_CONTENT_URLS); if (wcUrls == null) { wcUrls = new Hashtable(); wcUrls.put("sakai.iframe", WEB_CONTENT_DEFAULT_URL); state.setAttribute(STATE_WEB_CONTENT_URLS, wcUrls); } context.put("wcUrls", wcUrls); context.put("serverName", ServerConfigurationService.getServerName()); context.put("oldSelectedTools", state.getAttribute(STATE_TOOL_REGISTRATION_OLD_SELECTED_LIST)); return (String)getContext(data).get("template") + TEMPLATE[26]; case 27: /* buildContextForTemplate chef_site-importSites.vm * */ existingSite = site != null? true:false; site_type = (String) state.getAttribute(STATE_SITE_TYPE); if (existingSite) { // revising a existing site's tool context.put("continue", "12"); context.put("back", "28"); context.put("totalSteps", "2"); context.put("step", "2"); context.put("currentSite", site); } else { // new site, go to edit access page context.put("back", "3"); if (fromENWModifyView(state)) { context.put("continue", "26"); } else { context.put("continue", "18"); } } context.put (STATE_TOOL_REGISTRATION_LIST, state.getAttribute(STATE_TOOL_REGISTRATION_LIST)); context.put ("selectedTools", orderToolIds(state, site_type, (List) state.getAttribute(STATE_TOOL_REGISTRATION_SELECTED_LIST))); // String toolId's context.put("importSites", state.getAttribute(STATE_IMPORT_SITES)); context.put("importSitesTools", state.getAttribute(STATE_IMPORT_SITE_TOOL)); context.put("check_home", state.getAttribute(STATE_TOOL_HOME_SELECTED)); context.put("importSupportedTools", importTools()); return (String)getContext(data).get("template") + TEMPLATE[27]; case 28: /* buildContextForTemplate chef_siteinfo-import.vm * */ context.put("currentSite", site); context.put("importSiteList", state.getAttribute(STATE_IMPORT_SITES)); context.put("sites", SiteService.getSites(org.sakaiproject.site.api.SiteService.SelectionType.UPDATE, null, null, null, SortType.TITLE_ASC, null)); return (String)getContext(data).get("template") + TEMPLATE[28]; case 29: /* buildContextForTemplate chef_siteinfo-duplicate.vm * */ context.put("siteTitle", site.getTitle()); String sType = site.getType(); if (sType != null && sType.equals("course")) { context.put("isCourseSite", Boolean.TRUE); } else { context.put("isCourseSite", Boolean.FALSE); } if (state.getAttribute(SITE_DUPLICATED) == null) { context.put("siteDuplicated", Boolean.FALSE); } else { context.put("siteDuplicated", Boolean.TRUE); context.put("duplicatedName", state.getAttribute(SITE_DUPLICATED_NAME)); } return (String)getContext(data).get("template") + TEMPLATE[29]; case 30: /* *buildContextForTemplate chef_site-sitemanage-search.vm */ List newTypes = new Vector(); if (state.getAttribute(NO_SHOW_SEARCH_TYPE) != null) { String noType = state.getAttribute(NO_SHOW_SEARCH_TYPE).toString(); List oldTypes = SiteService.getSiteTypes(); for (int i = 0; i < oldTypes.size(); i++) { siteType = oldTypes.get(i).toString(); if ((siteType.indexOf(noType)) == -1) { newTypes.add(siteType); } } } else { newTypes = SiteService.getSiteTypes(); } // remove the "myworkspace" type for (Iterator i = newTypes.iterator(); i.hasNext();) { String t = (String) i.next(); if ("myworkspace".equalsIgnoreCase(t)) { i.remove(); } } context.put("siteTypes", newTypes); terms = CourseManagementService.getTerms(); String termSearchSiteType = (String)state.getAttribute(SEARCH_TERM_SITE_TYPE); if (termSearchSiteType != null) { context.put("termSearchSiteType", termSearchSiteType); context.put("terms", terms); } return (String)getContext(data).get("template") + TEMPLATE[30]; case 31: /* * buildContextForTemplate chef_site-sitemanage-list.vm */ Integer newPageSize = (Integer) state.getAttribute("inter_size"); if (newPageSize != null) { context.put("pagesize", newPageSize); state.setAttribute(STATE_PAGESIZE, newPageSize); } else { state.setAttribute(STATE_PAGESIZE, new Integer(DEFAULT_PAGE_SIZE)); context.put("pagesize", new Integer(DEFAULT_PAGE_SIZE)); } // put the service in the context (used for allow update calls on each site) context.put("service", SiteService.getInstance()); // prepare the paging of realms sites = prepPage(state); context.put("sites", sites); pagingInfoToContext(state, context); bar = new MenuImpl(); if (SiteService.allowAddSite("")) { bar.add( new MenuEntry(rb.getString("java.newsite"), "doNew") ); } if (bar.size() > 0) { context.put(Menu.CONTEXT_MENU, bar); } Vector siteItems = new Vector(); for (int i = 0; i < sites.size(); i++) { SiteItem siteItem = new SiteItem(); site = (Site)sites.get(i); siteItem.setSite(site); siteType = site.getType(); if (siteType != null && siteType.equalsIgnoreCase("course")) { realmId = SiteService.siteReference(site.getId()); String rv = null; try { AuthzGroup realm = AuthzGroupService.getAuthzGroup(realmId); rv = realm.getProviderGroupId(); } catch (GroupNotDefinedException e) { M_log.warn("SiteAction.getExternalRealmId, site realm not found"); } List providerCourseList = getProviderCourseList(StringUtil.trimToNull(rv)); if (providerCourseList != null) { siteItem.setProviderCourseList(providerCourseList); } } siteItems.add(siteItem); } context.put("siteItems", siteItems); context.put("termProp", (String)state.getAttribute(SEARCH_TERM_PROP)); context.put("searchText", (String)state.getAttribute(STATE_SEARCH)); context.put("siteType", (String)state.getAttribute(STATE_SEARCH_SITE_TYPE)); context.put("termSelection", (String)state.getAttribute(STATE_TERM_SELECTION)); context.put("termSearchSiteType", (String)state.getAttribute(SEARCH_TERM_SITE_TYPE)); return (String)getContext(data).get("template") + TEMPLATE[31]; case 32: /* * buildContextForTemplate chef_site-sitemanage-participants.vm */ String siteId = (String) state.getAttribute("siteId"); try { site = SiteService.getSite(siteId); context.put("site", site); bar = new MenuImpl(); bar.add( new MenuEntry(rb.getString("java.addp"), null, true, MenuItem.CHECKED_NA, "doMenu_sitemanage_addParticipant", "site-form") ); context.put(Menu.CONTEXT_MENU, bar); // for paging newPageSize = (Integer) state.getAttribute("inter_size"); if (newPageSize != null) { context.put("pagesize", newPageSize); state.setAttribute(STATE_PAGESIZE, newPageSize); } else { state.setAttribute(STATE_PAGESIZE, new Integer(DEFAULT_PAGE_SIZE)); context.put("pagesize", new Integer(DEFAULT_PAGE_SIZE)); } // put the service in the context (used for allow update calls on each site) context.put("service", SiteService.getInstance()); // prepare the paging of realms List participants = prepPage(state); context.put("participants", participants); pagingInfoToContext(state, context); roles = getRoles(state); context.put("roles", roles); // will have the choice to active/inactive user or not activeInactiveUser = ServerConfigurationService.getString("activeInactiveUser", Boolean.FALSE.toString()); if (activeInactiveUser.equalsIgnoreCase("true")) { context.put("activeInactiveUser", Boolean.TRUE); // put realm object into context realmId = SiteService.siteReference(site.getId()); try { context.put("realm", AuthzGroupService.getAuthzGroup(realmId)); } catch (GroupNotDefinedException e) { M_log.warn(this + " IdUnusedException " + realmId); } } else { context.put("activeInactiveUser", Boolean.FALSE); } boolean allowUpdateSite = SiteService.allowUpdateSite(siteId); if (allowUpdateSite) { context.put("allowUpdate", Boolean.TRUE); } else { context.put("allowUpate", Boolean.FALSE); } return (String)getContext(data).get("template") + TEMPLATE[32]; } catch(IdUnusedException e) { return (String)getContext(data).get("template") + TEMPLATE[31]; } case 33: /* * buildContextForTemplate chef_site-sitemanage-addParticipant.vm */ // Note that (for now) these strings are in both sakai.properties and sitesetupgeneric.properties context.put("noEmailInIdAccountName", ServerConfigurationService.getString("noEmailInIdAccountName")); context.put("noEmailInIdAccountLabel", ServerConfigurationService.getString("noEmailInIdAccountLabel")); context.put("emailInIdAccountName", ServerConfigurationService.getString("emailInIdAccountName")); context.put("emailInIdAccountLabel", ServerConfigurationService.getString("emailInIdAccountLabel")); try { site = SiteService.getSite(state.getAttribute("siteId").toString()); context.put("title", site.getTitle()); roles = getRoles(state); context.put("roles", roles); if(state.getAttribute("noEmailInIdAccountValue")!=null) { context.put("noEmailInIdAccountValue", (String)state.getAttribute("noEmailInIdAccountValue")); } if(state.getAttribute("emailInIdAccountValue")!=null) { context.put("emailInIdAccountValue", (String)state.getAttribute("emailInIdAccountValue")); } if(state.getAttribute("form_same_role") != null) { context.put("form_same_role", ((Boolean) state.getAttribute("form_same_role")).toString()); } else { context.put("form_same_role", Boolean.TRUE.toString()); } context.put("backIndex", "32"); return (String)getContext(data).get("template") + TEMPLATE[33]; } catch(Exception e) { return (String)getContext(data).get("template") + TEMPLATE[32]; } case 34: /* * buildContextForTemplate chef_site-sitemanage-sameRole.vm */ context.put("title", site.getTitle()); context.put("roles", getRoles(state)); context.put("participantList", state.getAttribute(STATE_ADD_PARTICIPANTS)); context.put("form_selectedRole", state.getAttribute("form_selectedRole")); return (String)getContext(data).get("template") + TEMPLATE[34]; case 35: /* * buildContextForTemplate chef_site-sitemanage-differentRoles.vm */ context.put("title", site.getTitle()); context.put("roles", getRoles(state)); context.put("selectedRoles", state.getAttribute(STATE_SELECTED_PARTICIPANT_ROLES)); context.put("participantList", state.getAttribute(STATE_ADD_PARTICIPANTS)); return (String)getContext(data).get("template") + TEMPLATE[35]; case 36: /* * buildContextForTemplate chef_site-newSiteCourse.vm */ if (site != null) { context.put("site", site); context.put("siteTitle", site.getTitle()); terms = CourseManagementService.getTerms(); if (terms != null && terms.size() >0) { context.put("termList", terms); } List providerCourseList = (List) state.getAttribute(SITE_PROVIDER_COURSE_LIST); context.put("providerCourseList", providerCourseList); context.put("manualCourseList", state.getAttribute(SITE_MANUAL_COURSE_LIST)); Term t = (Term) state.getAttribute(STATE_TERM_SELECTED); context.put ("term", t); if (t != null) { String userId = StringUtil.trimToZero(SessionManager.getCurrentSession().getUserEid()); List courses = CourseManagementService.getInstructorCourses(userId, t.getYear(), t.getTerm()); if (courses != null && courses.size() > 0) { Vector notIncludedCourse = new Vector(); // remove included sites for (Iterator i = courses.iterator(); i.hasNext(); ) { Course c = (Course) i.next(); if (!providerCourseList.contains(c.getId())) { notIncludedCourse.add(c); } } state.setAttribute(STATE_TERM_COURSE_LIST, notIncludedCourse); } else { state.removeAttribute(STATE_TERM_COURSE_LIST); } } // step number used in UI state.setAttribute(SITE_CREATE_CURRENT_STEP, new Integer("1")); } else { if (state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN) != null) { context.put ("selectedProviderCourse", state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN)); } if(state.getAttribute(STATE_MANUAL_ADD_COURSE_NUMBER) != null) { context.put("selectedManualCourse", Boolean.TRUE); } context.put ("term", (Term) state.getAttribute(STATE_TERM_SELECTED)); } if (((String) state.getAttribute(STATE_SITE_MODE)).equalsIgnoreCase(SITE_MODE_SITESETUP)) { context.put("backIndex", "1"); } else if (((String) state.getAttribute(STATE_SITE_MODE)).equalsIgnoreCase(SITE_MODE_SITEINFO)) { context.put("backIndex", ""); } context.put("termCourseList", (List) state.getAttribute(STATE_TERM_COURSE_LIST)); return (String)getContext(data).get("template") + TEMPLATE[36]; case 37: /* * buildContextForTemplate chef_site-newSiteCourseManual.vm */ if (site != null) { context.put("site", site); context.put("siteTitle", site.getTitle()); coursesIntoContext(state, context, site); } buildInstructorSectionsList(state, params, context); context.put("form_requiredFields", CourseManagementService.getCourseIdRequiredFields()); context.put("form_requiredFieldsSizes", CourseManagementService.getCourseIdRequiredFieldsSizes()); context.put("form_additional", siteInfo.additional); context.put("form_title", siteInfo.title); context.put("form_description", siteInfo.description); context.put("noEmailInIdAccountName", ServerConfigurationService.getString("noEmailInIdAccountName", "")); context.put("value_uniqname", state.getAttribute(STATE_SITE_QUEST_UNIQNAME)); int number = 1; if (state.getAttribute(STATE_MANUAL_ADD_COURSE_NUMBER) != null) { number = ((Integer) state.getAttribute(STATE_MANUAL_ADD_COURSE_NUMBER)).intValue(); context.put("currentNumber", new Integer(number)); } context.put("currentNumber", new Integer(number)); context.put("listSize", new Integer(number-1)); context.put("fieldValues", state.getAttribute(STATE_MANUAL_ADD_COURSE_FIELDS)); if (state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN) != null) { List l = (List) state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN); context.put ("selectedProviderCourse", l); context.put("size", new Integer(l.size()-1)); } if (site != null) { context.put("back", "36"); } else { if (state.getAttribute(STATE_AUTO_ADD) != null) { context.put("autoAdd", Boolean.TRUE); context.put("back", "36"); } else { context.put("back", "1"); } } context.put("isFutureTerm", state.getAttribute(STATE_FUTURE_TERM_SELECTED)); context.put("weeksAhead", ServerConfigurationService.getString("roster.available.weeks.before.term.start", "0")); return (String)getContext(data).get("template") + TEMPLATE[37]; case 38: /* * buildContextForTemplate chef_site-sitemanage-editInfo.vm */ bar = new MenuImpl(portlet, data, (String) state.getAttribute(STATE_ACTION)); if (state.getAttribute("siteId") != null) { if (SiteService.allowRemoveSite(state.getAttribute("siteId").toString())) { bar.add( new MenuEntry(rb.getString("java.delete"), null, true, MenuItem.CHECKED_NA, "doSitemanage_site_delete", "site-form")); } } bar.add( new MenuEntry(rb.getString("java.saveas"), null, true, MenuItem.CHECKED_NA, "doSitemanage_saveas_request", "site-form") ); context.put("menu", bar); context.put("title", state.getAttribute(FORM_SITEINFO_TITLE)); types = SiteService.getSiteTypes(); context.put("types", types); context.put("siteType", state.getAttribute("siteType")); if (SecurityService.isSuperUser()) { context.put("isSuperUser", Boolean.TRUE); } else { context.put("isSuperUser", Boolean.FALSE); } context.put("description", state.getAttribute(FORM_SITEINFO_DESCRIPTION)); context.put("short_description", state.getAttribute(FORM_SITEINFO_SHORT_DESCRIPTION)); context.put("skins", state.getAttribute("skins")); context.put("skin", state.getAttribute(FORM_SITEINFO_SKIN)); context.put("iconUrl", state.getAttribute("siteIconUrl")); context.put("include", state.getAttribute(FORM_SITEINFO_INCLUDE)); context.put("form_site_contact_name", state.getAttribute(FORM_SITEINFO_CONTACT_NAME)); context.put("form_site_contact_email", state.getAttribute(FORM_SITEINFO_CONTACT_EMAIL)); if (state.getAttribute(STATE_SITE_SIZE_DEFAULT_SELECT) == null) { context.put("default_size_selected", Boolean.TRUE); } else { context.put("default_size_selected", state.getAttribute(STATE_SITE_SIZE_DEFAULT_SELECT)); } return (String)getContext(data).get("template") + TEMPLATE[38]; case 39: /* * buildContextForTemplate chef_site-sitemanage-editInfo.vm */ context.put("site", site); context.put("include", Boolean.valueOf(site.isPubView())); context.put("roles", getRoles(state)); return (String)getContext(data).get("template") + TEMPLATE[39]; case 40: /* * buildContextForTemplate chef_site-sitemanage-siteDeleteConfirmation.vm */ String id = (String) state.getAttribute("siteId"); site_title = NULL_STRING; user = SessionManager.getCurrentSessionUserId(); workspace = SiteService.getUserSiteId(user); boolean removeable = true; if(!(id.equals(workspace))) { try { site_title = SiteService.getSite(id).getTitle(); } catch (IdUnusedException e) { M_log.warn("SiteAction.doSitemanage_delete_confirmed - IdUnusedException " + id); addAlert(state, rb.getString("java.sitewith")+" " + id + " "+ rb.getString("java.couldnt")+" "); } if(SiteService.allowRemoveSite(id)) { try { SiteService.getSite(id); } catch (IdUnusedException e) { M_log.warn("SiteAction.buildContextForTemplate chef_site-sitemanage-siteDeleteConfirm.vm: IdUnusedException"); } } else { removeable = false; addAlert(state, site_title + " "+rb.getString("java.couldntdel")+" "); } } else { removeable = false; addAlert(state, rb.getString("java.yourwork")); } if(!removeable) { addAlert(state, rb.getString("java.click")); } context.put("removeable", new Boolean(removeable)); return (String)getContext(data).get("template") + TEMPLATE[40]; case 41: /* * buildContextForTemplate chef_site-sitemanage-site-saveas.vm */ context.put("site", site); return (String)getContext(data).get("template") + TEMPLATE[41]; case 42: /* buildContextForTemplate chef_site-gradtoolsConfirm.vm * */ siteInfo = (SiteInfo)state.getAttribute(STATE_SITE_INFO); context.put("title", siteInfo.title); context.put("description", siteInfo.description); context.put("short_description", siteInfo.short_description); toolRegistrationList = (Vector) state.getAttribute(STATE_PROJECT_TOOL_LIST); toolRegistrationSelectedList = (List) state.getAttribute(STATE_TOOL_REGISTRATION_SELECTED_LIST); context.put (STATE_TOOL_REGISTRATION_SELECTED_LIST, toolRegistrationSelectedList); // String toolId's context.put (STATE_TOOL_REGISTRATION_LIST, toolRegistrationList ); // %%% use Tool context.put("check_home", state.getAttribute(STATE_TOOL_HOME_SELECTED)); context.put("emailId", state.getAttribute(STATE_TOOL_EMAIL_ADDRESS)); context.put("serverName", ServerConfigurationService.getServerName()); context.put("include", new Boolean(siteInfo.include)); return (String)getContext(data).get("template") + TEMPLATE[42]; case 43: /* buildContextForTemplate chef_siteInfo-editClass.vm * */ bar = new MenuImpl(portlet, data, (String) state.getAttribute(STATE_ACTION)); if (SiteService.allowAddSite(null)) { bar.add( new MenuEntry(rb.getString("java.addclasses"), "doMenu_siteInfo_addClass")); } context.put("menu", bar); context.put("siteTitle", site.getTitle()); coursesIntoContext(state, context, site); return (String)getContext(data).get("template") + TEMPLATE[43]; case 44: /* buildContextForTemplate chef_siteInfo-addCourseConfirm.vm * */ context.put("siteTitle", site.getTitle()); coursesIntoContext(state, context, site); context.put("providerAddCourses", state.getAttribute(STATE_ADD_CLASS_PROVIDER_CHOSEN)); if (state.getAttribute(STATE_MANUAL_ADD_COURSE_NUMBER) != null) { int addNumber = ((Integer) state.getAttribute(STATE_MANUAL_ADD_COURSE_NUMBER)).intValue() -1; context.put("manualAddNumber", new Integer(addNumber)); context.put("requestFields", state.getAttribute(STATE_MANUAL_ADD_COURSE_FIELDS)); context.put("backIndex", "37"); } else { context.put("backIndex", "36"); } //those manual inputs context.put("form_requiredFields", CourseManagementService.getCourseIdRequiredFields()); context.put("fieldValues", state.getAttribute(STATE_MANUAL_ADD_COURSE_FIELDS)); return (String)getContext(data).get("template") + TEMPLATE[44]; //htripath - import materials from classic case 45: /* buildContextForTemplate chef_siteInfo-importMtrlMaster.vm * */ return (String)getContext(data).get("template") + TEMPLATE[45]; case 46: /* buildContextForTemplate chef_siteInfo-importMtrlCopy.vm * */ // this is for list display in listbox context.put("allZipSites", state.getAttribute(ALL_ZIP_IMPORT_SITES)); context.put("finalZipSites", state.getAttribute(FINAL_ZIP_IMPORT_SITES)); //zip file //context.put("zipreffile",state.getAttribute(CLASSIC_ZIP_FILE_NAME)); return (String)getContext(data).get("template") + TEMPLATE[46]; case 47: /* buildContextForTemplate chef_siteInfo-importMtrlCopyConfirm.vm * */ context.put("finalZipSites", state.getAttribute(FINAL_ZIP_IMPORT_SITES)); return (String)getContext(data).get("template") + TEMPLATE[47]; case 48: /* buildContextForTemplate chef_siteInfo-importMtrlCopyConfirm.vm * */ context.put("finalZipSites", state.getAttribute(FINAL_ZIP_IMPORT_SITES)); return (String)getContext(data).get("template") + TEMPLATE[48]; case 49: /* buildContextForTemplate chef_siteInfo-group.vm * */ context.put("site", site); bar = new MenuImpl(portlet, data, (String) state.getAttribute(STATE_ACTION)); if (SiteService.allowUpdateSite(site.getId()) || SiteService.allowUpdateGroupMembership(site.getId())) { bar.add( new MenuEntry(rb.getString("java.new"), "doGroup_new")); } context.put("menu", bar); // the group list sortedBy = (String) state.getAttribute (SORTED_BY); sortedAsc = (String) state.getAttribute (SORTED_ASC); if(sortedBy!=null) context.put ("currentSortedBy", sortedBy); if(sortedAsc!=null) context.put ("currentSortAsc", sortedAsc); // only show groups created by WSetup tool itself Collection groups = (Collection) site.getGroups(); List groupsByWSetup = new Vector(); for(Iterator gIterator = groups.iterator(); gIterator.hasNext();) { Group gNext = (Group) gIterator.next(); String gProp = gNext.getProperties().getProperty(GROUP_PROP_WSETUP_CREATED); if (gProp != null && gProp.equals(Boolean.TRUE.toString())) { groupsByWSetup.add(gNext); } } if (sortedBy != null && sortedAsc != null) { context.put("groups", new SortedIterator (groupsByWSetup.iterator (), new SiteComparator (sortedBy, sortedAsc))); } return (String)getContext(data).get("template") + TEMPLATE[49]; case 50: /* buildContextForTemplate chef_siteInfo-groupedit.vm * */ Group g = getStateGroup(state); if (g != null) { context.put("group", g); context.put("newgroup", Boolean.FALSE); } else { context.put("newgroup", Boolean.TRUE); } if (state.getAttribute(STATE_GROUP_TITLE) != null) { context.put("title", state.getAttribute(STATE_GROUP_TITLE)); } if (state.getAttribute(STATE_GROUP_DESCRIPTION) != null) { context.put("description", state.getAttribute(STATE_GROUP_DESCRIPTION)); } Iterator siteMembers = new SortedIterator (getParticipantList(state).iterator (), new SiteComparator (SORTED_BY_PARTICIPANT_NAME, Boolean.TRUE.toString())); if (siteMembers != null && siteMembers.hasNext()) { context.put("generalMembers", siteMembers); } Set groupMembersSet = (Set) state.getAttribute(STATE_GROUP_MEMBERS); if (state.getAttribute(STATE_GROUP_MEMBERS) != null) { context.put("groupMembers", new SortedIterator(groupMembersSet.iterator(), new SiteComparator (SORTED_BY_MEMBER_NAME, Boolean.TRUE.toString()))); } context.put("groupMembersClone", groupMembersSet); context.put("userDirectoryService", UserDirectoryService.getInstance()); return (String)getContext(data).get("template") + TEMPLATE[50]; case 51: /* buildContextForTemplate chef_siteInfo-groupDeleteConfirm.vm * */ context.put("site", site); context.put("removeGroupIds", new ArrayList(Arrays.asList((String[])state.getAttribute(STATE_GROUP_REMOVE)))); return (String)getContext(data).get("template") + TEMPLATE[51]; } // should never be reached return (String)getContext(data).get("template") + TEMPLATE[0]; } // buildContextForTemplate
54846 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54846/3d5ba9e02e38bfd2f675ea6403d67ba2ecac02d6/SiteAction.java/clean/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java
Asserts.notReached(message.toString());
assert false : message.toString(); return null;
protected IRubyObject invokeMethod(IRubyObject recv, Object[] methodArgs) { if (isRestArgs) { methodArgs = packageRestArgumentsForReflection(methodArgs); } try { return invokeMethod0(recv, methodArgs); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof RaiseException) { throw (RaiseException) e.getTargetException(); } else if (e.getTargetException() instanceof JumpException) { throw (JumpException) e.getTargetException(); } else if (e.getTargetException() instanceof ThreadKill) { // allow it to bubble up throw (ThreadKill) e.getTargetException(); } else if (e.getTargetException() instanceof Exception) { recv.getRuntime().getJavaSupport().handleNativeException(e.getTargetException()); return recv.getRuntime().getNil(); } else { throw (Error) e.getTargetException(); } } catch (IllegalAccessException e) { StringBuffer message = new StringBuffer(); message.append(e.getMessage()); message.append(':'); message.append(" methodName=").append(methodName); message.append(" recv=").append(recv.toString()); message.append(" type=").append(type.getName()); message.append(" methodArgs=["); for (int i = 0; i < methodArgs.length; i++) { message.append(methodArgs[i]); message.append(' '); } message.append(']'); Asserts.notReached(message.toString()); } catch (final IllegalArgumentException e) { throw new RaiseException(recv.getRuntime(), "TypeError", e.getMessage()); } throw new AssertError("[BUG] Run again with Asserts.ENABLE_ASSERT=true"); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b72a2862ae5b2f01f9a767ef2ce248fd785857c4/AbstractCallback.java/buggy/src/org/jruby/runtime/callback/AbstractCallback.java
throw new AssertError("[BUG] Run again with Asserts.ENABLE_ASSERT=true");
protected IRubyObject invokeMethod(IRubyObject recv, Object[] methodArgs) { if (isRestArgs) { methodArgs = packageRestArgumentsForReflection(methodArgs); } try { return invokeMethod0(recv, methodArgs); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof RaiseException) { throw (RaiseException) e.getTargetException(); } else if (e.getTargetException() instanceof JumpException) { throw (JumpException) e.getTargetException(); } else if (e.getTargetException() instanceof ThreadKill) { // allow it to bubble up throw (ThreadKill) e.getTargetException(); } else if (e.getTargetException() instanceof Exception) { recv.getRuntime().getJavaSupport().handleNativeException(e.getTargetException()); return recv.getRuntime().getNil(); } else { throw (Error) e.getTargetException(); } } catch (IllegalAccessException e) { StringBuffer message = new StringBuffer(); message.append(e.getMessage()); message.append(':'); message.append(" methodName=").append(methodName); message.append(" recv=").append(recv.toString()); message.append(" type=").append(type.getName()); message.append(" methodArgs=["); for (int i = 0; i < methodArgs.length; i++) { message.append(methodArgs[i]); message.append(' '); } message.append(']'); Asserts.notReached(message.toString()); } catch (final IllegalArgumentException e) { throw new RaiseException(recv.getRuntime(), "TypeError", e.getMessage()); } throw new AssertError("[BUG] Run again with Asserts.ENABLE_ASSERT=true"); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b72a2862ae5b2f01f9a767ef2ce248fd785857c4/AbstractCallback.java/buggy/src/org/jruby/runtime/callback/AbstractCallback.java
public Box calculateBoxes(int avail_width, TableBox box, Context c, Table table) { box.width = avail_width; box.height = 100; box.x = 5; box.y = 5; // create a dummy prev row RowBox prev_row = new RowBox(0,0,0,0); int max_width = 0; // loop throw the rows CellGrid grid = table.getCellGrid(); for(int y=0; y<grid.getHeight(); y++) { // create a new row box for this row RowBox row_box = new RowBox(0,0,0,0); //row_box.node = row.node; box.rows.add(row_box); int row_height = 0; int column_count = 0; // loop through the cells for(int x=0; x<grid.getWidth(); x++) { //u.p("x = " + x); //u.p("grid width = " + grid.getWidth()); if(grid.isReal(x,y)) { //u.p("it's real"); Cell cell = grid.getCell(x,y); // create a new cell box for this cell CellBox cell_box = new CellBox(0,0,10,10); cell.cb = cell_box; cell_box.rb = row_box; // set the x coord based on the current column cell_box.x = table.calcColumnX(column_count); // set the width //u.p("column count = " + column_count + " col span = " + cell.col_span); cell_box.width = table.calcColumnWidth(column_count, cell.col_span); cell_box.node = cell.node; // do the internal layout // save the old extents and create new with smaller width Rectangle oe = c.getExtents(); c.setExtents(new Rectangle(c.getExtents().x,c.getExtents().y, cell_box.width, 100)); // do child layout Layout layout = LayoutFactory.getLayout(cell.node); Box cell_contents = layout.layout(c,(Element)cell_box.node); cell_box.sub_box = cell_contents; cell_box.height = cell_box.sub_box.height; column_count += cell.col_span; // restore old extents c.setExtents(oe); // y is relative to the rowbox so it's just 0 cell_box.y = 0; // add the cell to the row row_box.cells.add(cell_box); // if this is a non row spanning cell then // adjust the row height to fit this cell if(cell.row_span == 1) { if(cell_box.height > row_box.height) { row_box.height = cell_box.height; } } row_box.width += cell_box.width; } else { //u.p("it's virtual"); Cell cell = grid.getCell(x,y); // create a virtual cell box for this cell CellBox cell_box = CellBox.createVirtual(cell.cb); // skip doing layout row_box.cells.add(cell_box); // skip adjusting the row height for now // set row height based on real cell contents // set row width based on real cell contents } //u.p("looping"); } //u.p("loop done"); // move the row to the right y position row_height = 0; row_box.y = prev_row.y + prev_row.height; prev_row = row_box; // adjust the max width if(row_box.width > max_width) { max_width = row_box.width; } // adjust the height of each cell in this row to be the height of // the row for(int k=0; k<row_box.cells.size(); k++) { CellBox cb = (CellBox)row_box.cells.get(k); if(cb.isReal()) { cb.height = row_box.height; cb.sub_box.height = row_box.height; } else { // adjusting height based on virtual //u.p("adjusting height based on virtual"); CellBox real = cb.getReal(); //u.p("the real cb = " + real); RowBox orig_row = real.rb; //u.p("orig row = " + orig_row); RowBox cur_row = row_box; //u.p("cur row = " + cur_row); real.height = cur_row.y - orig_row.y + cur_row.height; real.sub_box.height = real.height; //u.p("now real = " + real); } //u.p("cell = " + cb); } } box.height = prev_row.y + prev_row.height; box.width = max_width; return box; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/e8e0eb314a46ddb6d7381b336fded7fb403ce0f5/TableLayout2.java/clean/src/java/org/joshy/html/TableLayout2.java
public Box calculateBoxes(int avail_width, TableBox box, Context c, Table table) { box.width = avail_width; box.height = 100; box.x = 5; box.y = 5; // create a dummy prev row RowBox prev_row = new RowBox(0,0,0,0); int max_width = 0; // loop throw the rows CellGrid grid = table.getCellGrid(); for(int y=0; y<grid.getHeight(); y++) { // create a new row box for this row RowBox row_box = new RowBox(0,0,0,0); //row_box.node = row.node; box.rows.add(row_box); int row_height = 0; int column_count = 0; // loop through the cells for(int x=0; x<grid.getWidth(); x++) { //u.p("x = " + x); //u.p("grid width = " + grid.getWidth()); if(grid.isReal(x,y)) { //u.p("it's real"); Cell cell = grid.getCell(x,y); // create a new cell box for this cell CellBox cell_box = new CellBox(0,0,10,10); cell.cb = cell_box; cell_box.rb = row_box; // set the x coord based on the current column cell_box.x = table.calcColumnX(column_count); // set the width //u.p("column count = " + column_count + " col span = " + cell.col_span); cell_box.width = table.calcColumnWidth(column_count, cell.col_span); cell_box.node = cell.node; // do the internal layout // save the old extents and create new with smaller width Rectangle oe = c.getExtents(); c.setExtents(new Rectangle(c.getExtents().x,c.getExtents().y, cell_box.width, 100)); // do child layout Layout layout = LayoutFactory.getLayout(cell.node); Box cell_contents = layout.layout(c,(Element)cell_box.node); cell_box.sub_box = cell_contents; cell_box.height = cell_box.sub_box.height; column_count += cell.col_span; // restore old extents c.setExtents(oe); // y is relative to the rowbox so it's just 0 cell_box.y = 0; // add the cell to the row row_box.cells.add(cell_box); // if this is a non row spanning cell then // adjust the row height to fit this cell if(cell.row_span == 1) { if(cell_box.height > row_box.height) { row_box.height = cell_box.height; } } row_box.width += cell_box.width; } else { //u.p("it's virtual"); Cell cell = grid.getCell(x,y); // create a virtual cell box for this cell CellBox cell_box = CellBox.createVirtual(cell.cb); // skip doing layout row_box.cells.add(cell_box); // skip adjusting the row height for now // set row height based on real cell contents // set row width based on real cell contents } //u.p("looping"); } //u.p("loop done"); // move the row to the right y position row_height = 0; row_box.y = prev_row.y + prev_row.height; prev_row = row_box; // adjust the max width if(row_box.width > max_width) { max_width = row_box.width; } // adjust the height of each cell in this row to be the height of // the row for(int k=0; k<row_box.cells.size(); k++) { CellBox cb = (CellBox)row_box.cells.get(k); if(cb.isReal()) { cb.height = row_box.height; cb.sub_box.height = row_box.height; } else { // adjusting height based on virtual //u.p("adjusting height based on virtual"); CellBox real = cb.getReal(); //u.p("the real cb = " + real); RowBox orig_row = real.rb; //u.p("orig row = " + orig_row); RowBox cur_row = row_box; //u.p("cur row = " + cur_row); real.height = cur_row.y - orig_row.y + cur_row.height; real.sub_box.height = real.height; //u.p("now real = " + real); } //u.p("cell = " + cb); } } box.height = prev_row.y + prev_row.height; box.width = max_width; return box; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/e8e0eb314a46ddb6d7381b336fded7fb403ce0f5/TableLayout2.java/clean/src/java/org/joshy/html/TableLayout2.java
Rectangle oe = c.getExtents(); c.setExtents(new Rectangle(c.getExtents().x,c.getExtents().y, cell_box.width, 100)); Layout layout = LayoutFactory.getLayout(cell.node); Box cell_contents = layout.layout(c,(Element)cell_box.node); cell_box.sub_box = cell_contents; cell_box.height = cell_box.sub_box.height; column_count += cell.col_span; c.setExtents(oe);
Rectangle oe = c.getExtents(); c.setExtents(new Rectangle(c.getExtents().x,c.getExtents().y, cell_box.width, 100)); Layout layout = LayoutFactory.getLayout(cell.node); c.setSubBlock(true); Box cell_contents = layout.layout(c,(Element)cell_box.node); c.setSubBlock(false); cell_box.sub_box = cell_contents; cell_box.height = cell_box.sub_box.height; column_count += cell.col_span; c.setExtents(oe);
public Box calculateBoxes(int avail_width, TableBox box, Context c, Table table) { box.width = avail_width; box.height = 100; box.x = 5; box.y = 5; // create a dummy prev row RowBox prev_row = new RowBox(0,0,0,0); int max_width = 0; // loop throw the rows CellGrid grid = table.getCellGrid(); for(int y=0; y<grid.getHeight(); y++) { // create a new row box for this row RowBox row_box = new RowBox(0,0,0,0); //row_box.node = row.node; box.rows.add(row_box); int row_height = 0; int column_count = 0; // loop through the cells for(int x=0; x<grid.getWidth(); x++) { //u.p("x = " + x); //u.p("grid width = " + grid.getWidth()); if(grid.isReal(x,y)) { //u.p("it's real"); Cell cell = grid.getCell(x,y); // create a new cell box for this cell CellBox cell_box = new CellBox(0,0,10,10); cell.cb = cell_box; cell_box.rb = row_box; // set the x coord based on the current column cell_box.x = table.calcColumnX(column_count); // set the width //u.p("column count = " + column_count + " col span = " + cell.col_span); cell_box.width = table.calcColumnWidth(column_count, cell.col_span); cell_box.node = cell.node; // do the internal layout // save the old extents and create new with smaller width Rectangle oe = c.getExtents(); c.setExtents(new Rectangle(c.getExtents().x,c.getExtents().y, cell_box.width, 100)); // do child layout Layout layout = LayoutFactory.getLayout(cell.node); Box cell_contents = layout.layout(c,(Element)cell_box.node); cell_box.sub_box = cell_contents; cell_box.height = cell_box.sub_box.height; column_count += cell.col_span; // restore old extents c.setExtents(oe); // y is relative to the rowbox so it's just 0 cell_box.y = 0; // add the cell to the row row_box.cells.add(cell_box); // if this is a non row spanning cell then // adjust the row height to fit this cell if(cell.row_span == 1) { if(cell_box.height > row_box.height) { row_box.height = cell_box.height; } } row_box.width += cell_box.width; } else { //u.p("it's virtual"); Cell cell = grid.getCell(x,y); // create a virtual cell box for this cell CellBox cell_box = CellBox.createVirtual(cell.cb); // skip doing layout row_box.cells.add(cell_box); // skip adjusting the row height for now // set row height based on real cell contents // set row width based on real cell contents } //u.p("looping"); } //u.p("loop done"); // move the row to the right y position row_height = 0; row_box.y = prev_row.y + prev_row.height; prev_row = row_box; // adjust the max width if(row_box.width > max_width) { max_width = row_box.width; } // adjust the height of each cell in this row to be the height of // the row for(int k=0; k<row_box.cells.size(); k++) { CellBox cb = (CellBox)row_box.cells.get(k); if(cb.isReal()) { cb.height = row_box.height; cb.sub_box.height = row_box.height; } else { // adjusting height based on virtual //u.p("adjusting height based on virtual"); CellBox real = cb.getReal(); //u.p("the real cb = " + real); RowBox orig_row = real.rb; //u.p("orig row = " + orig_row); RowBox cur_row = row_box; //u.p("cur row = " + cur_row); real.height = cur_row.y - orig_row.y + cur_row.height; real.sub_box.height = real.height; //u.p("now real = " + real); } //u.p("cell = " + cb); } } box.height = prev_row.y + prev_row.height; box.width = max_width; return box; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/e8e0eb314a46ddb6d7381b336fded7fb403ce0f5/TableLayout2.java/clean/src/java/org/joshy/html/TableLayout2.java
public Box calculateBoxes(int avail_width, TableBox box, Context c, Table table) { box.width = avail_width; box.height = 100; box.x = 5; box.y = 5; // create a dummy prev row RowBox prev_row = new RowBox(0,0,0,0); int max_width = 0; // loop throw the rows CellGrid grid = table.getCellGrid(); for(int y=0; y<grid.getHeight(); y++) { // create a new row box for this row RowBox row_box = new RowBox(0,0,0,0); //row_box.node = row.node; box.rows.add(row_box); int row_height = 0; int column_count = 0; // loop through the cells for(int x=0; x<grid.getWidth(); x++) { //u.p("x = " + x); //u.p("grid width = " + grid.getWidth()); if(grid.isReal(x,y)) { //u.p("it's real"); Cell cell = grid.getCell(x,y); // create a new cell box for this cell CellBox cell_box = new CellBox(0,0,10,10); cell.cb = cell_box; cell_box.rb = row_box; // set the x coord based on the current column cell_box.x = table.calcColumnX(column_count); // set the width //u.p("column count = " + column_count + " col span = " + cell.col_span); cell_box.width = table.calcColumnWidth(column_count, cell.col_span); cell_box.node = cell.node; // do the internal layout // save the old extents and create new with smaller width Rectangle oe = c.getExtents(); c.setExtents(new Rectangle(c.getExtents().x,c.getExtents().y, cell_box.width, 100)); // do child layout Layout layout = LayoutFactory.getLayout(cell.node); Box cell_contents = layout.layout(c,(Element)cell_box.node); cell_box.sub_box = cell_contents; cell_box.height = cell_box.sub_box.height; column_count += cell.col_span; // restore old extents c.setExtents(oe); // y is relative to the rowbox so it's just 0 cell_box.y = 0; // add the cell to the row row_box.cells.add(cell_box); // if this is a non row spanning cell then // adjust the row height to fit this cell if(cell.row_span == 1) { if(cell_box.height > row_box.height) { row_box.height = cell_box.height; } } row_box.width += cell_box.width; } else { //u.p("it's virtual"); Cell cell = grid.getCell(x,y); // create a virtual cell box for this cell CellBox cell_box = CellBox.createVirtual(cell.cb); // skip doing layout row_box.cells.add(cell_box); // skip adjusting the row height for now // set row height based on real cell contents // set row width based on real cell contents } //u.p("looping"); } //u.p("loop done"); // move the row to the right y position row_height = 0; row_box.y = prev_row.y + prev_row.height; prev_row = row_box; // adjust the max width if(row_box.width > max_width) { max_width = row_box.width; } // adjust the height of each cell in this row to be the height of // the row for(int k=0; k<row_box.cells.size(); k++) { CellBox cb = (CellBox)row_box.cells.get(k); if(cb.isReal()) { cb.height = row_box.height; cb.sub_box.height = row_box.height; } else { // adjusting height based on virtual //u.p("adjusting height based on virtual"); CellBox real = cb.getReal(); //u.p("the real cb = " + real); RowBox orig_row = real.rb; //u.p("orig row = " + orig_row); RowBox cur_row = row_box; //u.p("cur row = " + cur_row); real.height = cur_row.y - orig_row.y + cur_row.height; real.sub_box.height = real.height; //u.p("now real = " + real); } //u.p("cell = " + cb); } } box.height = prev_row.y + prev_row.height; box.width = max_width; return box; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/e8e0eb314a46ddb6d7381b336fded7fb403ce0f5/TableLayout2.java/clean/src/java/org/joshy/html/TableLayout2.java
try {
public Box layout(Context c, Element elem) { try { //u.p("\n====\nLayout"); // create the table box TableBox table_box = (TableBox)createBox(c, elem); // set up the border spacing float border_spacing = c.css.getFloatProperty(elem, "border-spacing"); table_box.spacing = new Point((int)border_spacing, (int)border_spacing); // set up the width int fixed_width = c.getExtents().width; if (c.css.hasProperty(elem, "width", false)) { fixed_width = (int)c.css.getFloatProperty(elem, "width", false); } int orig_fixed_width = fixed_width; //subtract off the margin, border, and padding fixed_width -= table_box.margin.left + table_box.border.left + table_box.padding.left + table_box.spacing.x + table_box.padding.right + table_box.border.right + table_box.margin.right; // create the table Table table = new Table(); table.addTable(elem); //calculate the widths table.calculateWidths(fixed_width, c); //pull out the boxes Box bx = calculateBoxes(fixed_width, table_box, c, table); bx.width += table_box.margin.left + table_box.border.left + table_box.padding.left + table_box.margin.right + table_box.border.right + table_box.padding.right; bx.height += table_box.margin.top + table_box.border.top + table_box.padding.top + table_box.margin.bottom + table_box.border.bottom + table_box.padding.bottom; //bx.width return bx; } catch (Exception ex) { u.p(ex); return null; } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/e8e0eb314a46ddb6d7381b336fded7fb403ce0f5/TableLayout2.java/clean/src/java/org/joshy/html/TableLayout2.java
public Box layout(Context c, Element elem) { try { //u.p("\n====\nLayout"); // create the table box TableBox table_box = (TableBox)createBox(c, elem); // set up the border spacing float border_spacing = c.css.getFloatProperty(elem, "border-spacing"); table_box.spacing = new Point((int)border_spacing, (int)border_spacing); // set up the width int fixed_width = c.getExtents().width; if (c.css.hasProperty(elem, "width", false)) { fixed_width = (int)c.css.getFloatProperty(elem, "width", false); } int orig_fixed_width = fixed_width; //subtract off the margin, border, and padding fixed_width -= table_box.margin.left + table_box.border.left + table_box.padding.left + table_box.spacing.x + table_box.padding.right + table_box.border.right + table_box.margin.right; // create the table Table table = new Table(); table.addTable(elem); //calculate the widths table.calculateWidths(fixed_width, c); //pull out the boxes Box bx = calculateBoxes(fixed_width, table_box, c, table); bx.width += table_box.margin.left + table_box.border.left + table_box.padding.left + table_box.margin.right + table_box.border.right + table_box.padding.right; bx.height += table_box.margin.top + table_box.border.top + table_box.padding.top + table_box.margin.bottom + table_box.border.bottom + table_box.padding.bottom; //bx.width return bx; } catch (Exception ex) { u.p(ex); return null; } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/e8e0eb314a46ddb6d7381b336fded7fb403ce0f5/TableLayout2.java/clean/src/java/org/joshy/html/TableLayout2.java
fixed_width = (int)c.css.getFloatProperty(elem, "width", false);
fixed_width = (int)c.css.getFloatProperty(elem, "width", c.getExtents().width, false);
public Box layout(Context c, Element elem) { try { //u.p("\n====\nLayout"); // create the table box TableBox table_box = (TableBox)createBox(c, elem); // set up the border spacing float border_spacing = c.css.getFloatProperty(elem, "border-spacing"); table_box.spacing = new Point((int)border_spacing, (int)border_spacing); // set up the width int fixed_width = c.getExtents().width; if (c.css.hasProperty(elem, "width", false)) { fixed_width = (int)c.css.getFloatProperty(elem, "width", false); } int orig_fixed_width = fixed_width; //subtract off the margin, border, and padding fixed_width -= table_box.margin.left + table_box.border.left + table_box.padding.left + table_box.spacing.x + table_box.padding.right + table_box.border.right + table_box.margin.right; // create the table Table table = new Table(); table.addTable(elem); //calculate the widths table.calculateWidths(fixed_width, c); //pull out the boxes Box bx = calculateBoxes(fixed_width, table_box, c, table); bx.width += table_box.margin.left + table_box.border.left + table_box.padding.left + table_box.margin.right + table_box.border.right + table_box.padding.right; bx.height += table_box.margin.top + table_box.border.top + table_box.padding.top + table_box.margin.bottom + table_box.border.bottom + table_box.padding.bottom; //bx.width return bx; } catch (Exception ex) { u.p(ex); return null; } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/e8e0eb314a46ddb6d7381b336fded7fb403ce0f5/TableLayout2.java/clean/src/java/org/joshy/html/TableLayout2.java
} catch (Exception ex) { u.p(ex); return null; }
public Box layout(Context c, Element elem) { try { //u.p("\n====\nLayout"); // create the table box TableBox table_box = (TableBox)createBox(c, elem); // set up the border spacing float border_spacing = c.css.getFloatProperty(elem, "border-spacing"); table_box.spacing = new Point((int)border_spacing, (int)border_spacing); // set up the width int fixed_width = c.getExtents().width; if (c.css.hasProperty(elem, "width", false)) { fixed_width = (int)c.css.getFloatProperty(elem, "width", false); } int orig_fixed_width = fixed_width; //subtract off the margin, border, and padding fixed_width -= table_box.margin.left + table_box.border.left + table_box.padding.left + table_box.spacing.x + table_box.padding.right + table_box.border.right + table_box.margin.right; // create the table Table table = new Table(); table.addTable(elem); //calculate the widths table.calculateWidths(fixed_width, c); //pull out the boxes Box bx = calculateBoxes(fixed_width, table_box, c, table); bx.width += table_box.margin.left + table_box.border.left + table_box.padding.left + table_box.margin.right + table_box.border.right + table_box.padding.right; bx.height += table_box.margin.top + table_box.border.top + table_box.padding.top + table_box.margin.bottom + table_box.border.bottom + table_box.padding.bottom; //bx.width return bx; } catch (Exception ex) { u.p(ex); return null; } }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/e8e0eb314a46ddb6d7381b336fded7fb403ce0f5/TableLayout2.java/clean/src/java/org/joshy/html/TableLayout2.java
public RubyObject length() {
public RubyFixnum length() {
public RubyObject length() { long size = 0; if (begin.funcall(">", end).isTrue()) { return new RubyFixnum(getRuby(), 0); } if (begin instanceof RubyFixnum && end instanceof RubyFixnum) { size = ((RubyNumeric) end).getLongValue() - ((RubyNumeric) begin).getLongValue(); if (!isExclusive) { size++; } } return new RubyFixnum(getRuby(), size); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/4e4c0a90262b62b83d3fc5717371745bcc928c2b/RubyRange.java/clean/org/jruby/RubyRange.java
!oldCategoryId.equals(parentCategoryId)) {
!oldCategoryId.equals(parentCategoryId) && !parentCategoryId.equals(MBCategory.DEFAULT_PARENT_CATEGORY_ID)) {
public MBCategory updateCategory( String categoryId, String parentCategoryId, String name, String description, boolean mergeWithParentCategory) throws PortalException, SystemException { // Category MBCategory category = MBCategoryUtil.findByPrimaryKey(categoryId); String oldCategoryId = category.getParentCategoryId(); parentCategoryId = getParentCategoryId(category, parentCategoryId); validate(name); category.setModifiedDate(new Date()); category.setParentCategoryId(parentCategoryId); category.setName(name); category.setDescription(description); MBCategoryUtil.update(category); // Merge categories if (mergeWithParentCategory && !oldCategoryId.equals(parentCategoryId)) { mergeCategories(category, parentCategoryId); } return category; }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/8cf89411535659bb65ce6cbae0d4905bc73401b9/MBCategoryLocalServiceImpl.java/buggy/portal-ejb/src/com/liferay/portlet/messageboards/service/impl/MBCategoryLocalServiceImpl.java
public static void breakText(Context c, InlineTextBox inline, InlineBox prev_align, int avail, int max, Font font) {
public static void breakText(Context c, InlineTextBox inline, InlineBox prev_align, int avail, Font font) {
public static void breakText(Context c, InlineTextBox inline, InlineBox prev_align, int avail, int max, Font font) { boolean db = false; if (db) { Uu.p("========================="); Uu.p("breaking: " + inline); //Uu.p("breaking : '" + inline.getSubstring() + "'"); //Uu.p("avail = " + avail); //Uu.p("max = " + max); //Uu.p("prev align = " + prev_align); } //inline.setFont(font); // ====== handle nowrap if (inline.whitespace == IdentValue.NOWRAP) { return; } //check if we should break on the next newline if (inline.whitespace == IdentValue.PRE || inline.whitespace == IdentValue.PRE_WRAP || inline.whitespace == IdentValue.PRE_LINE) { // Uu.p("doing a pre line"); int n = inline.getSubstring().indexOf(WhitespaceStripper.EOL); // Uu.p("got eol at: " + n); if (n > -1) { inline.end_index = inline.start_index + n + 1; inline.break_after = true; } } //check if we may wrap if (inline.whitespace == IdentValue.PRE) { return; } //check if it all fits on this line if (FontUtil.len(c, inline.getSubstring(), font) <= avail) { return; } //all newlines are already taken care of //text too long to fit on this line, we may wrap //just find a space that works String currentString = inline.getSubstring(); int n = currentString.length(); int possibleWrap; do { possibleWrap = n; n = currentString.lastIndexOf(WhitespaceStripper.SPACE, possibleWrap - 1); } while (n > 0 && FontUtil.len(c, currentString.substring(0, n), font) > avail); // (0 is a boundary condition when the first was a space) if (n <= 0) {//unbreakable string inline.setSubstring(inline.start_index, inline.start_index + possibleWrap);//the best we can do if (prev_align != null && !prev_align.break_after) { inline.break_before = true; }//else {//I think this else should be here? inline.break_after = true; //} } else {//found a place to wrap inline.setSubstring(inline.start_index, inline.start_index + n); inline.break_after = true; } return; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/Breaker.java/clean/src/java/org/xhtmlrenderer/layout/inline/Breaker.java
if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) {
try { if (selResource.equals(Group.class.getName())) { GroupPermission.check( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS); } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1];
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); String ownerId = Layout.getOwnerId(themeDisplay.getPlid()); String groupId = Layout.getGroupId(ownerId); String portletResource = ParamUtil.getString(req, "portletResource"); String modelResource = ParamUtil.getString(req, "modelResource"); String resourcePrimKey = ParamUtil.getString(req, "resourcePrimKey"); String selResource = portletResource; if (Validator.isNotNull(modelResource)) { selResource = modelResource; } if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1]; layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains( permissionChecker, resourcePrimKey, user.getOrganization().getOrganizationId(), user.getLocation().getOrganizationId(), ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } Portlet portlet = PortletServiceUtil.getPortletById( themeDisplay.getCompanyId(), portletResource); ServletContext ctx = (ServletContext)req.getAttribute(WebKeys.CTX); res.setTitle( PortalUtil.getPortletTitle(portlet, ctx, themeDisplay.getLocale())); return mapping.findForward( getForward(req, "portlet.portlet_configuration.edit_permissions")); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
SessionErrors.add(req, PrincipalException.class.getName());
layoutGroupId = StringUtil.replace(layoutGroupId, "}", "");
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); String ownerId = Layout.getOwnerId(themeDisplay.getPlid()); String groupId = Layout.getGroupId(ownerId); String portletResource = ParamUtil.getString(req, "portletResource"); String modelResource = ParamUtil.getString(req, "modelResource"); String resourcePrimKey = ParamUtil.getString(req, "resourcePrimKey"); String selResource = portletResource; if (Validator.isNotNull(modelResource)) { selResource = modelResource; } if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1]; layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains( permissionChecker, resourcePrimKey, user.getOrganization().getOrganizationId(), user.getLocation().getOrganizationId(), ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } Portlet portlet = PortletServiceUtil.getPortletById( themeDisplay.getCompanyId(), portletResource); ServletContext ctx = (ServletContext)req.getAttribute(WebKeys.CTX); res.setTitle( PortalUtil.getPortletTitle(portlet, ctx, themeDisplay.getLocale())); return mapping.findForward( getForward(req, "portlet.portlet_configuration.edit_permissions")); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
setForward(req, "portlet.portlet_configuration.error");
GroupPermission.check( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS);
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); String ownerId = Layout.getOwnerId(themeDisplay.getPlid()); String groupId = Layout.getGroupId(ownerId); String portletResource = ParamUtil.getString(req, "portletResource"); String modelResource = ParamUtil.getString(req, "modelResource"); String resourcePrimKey = ParamUtil.getString(req, "resourcePrimKey"); String selResource = portletResource; if (Validator.isNotNull(modelResource)) { selResource = modelResource; } if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1]; layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains( permissionChecker, resourcePrimKey, user.getOrganization().getOrganizationId(), user.getLocation().getOrganizationId(), ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } Portlet portlet = PortletServiceUtil.getPortletById( themeDisplay.getCompanyId(), portletResource); ServletContext ctx = (ServletContext)req.getAttribute(WebKeys.CTX); res.setTitle( PortalUtil.getPortletTitle(portlet, ctx, themeDisplay.getLocale())); return mapping.findForward( getForward(req, "portlet.portlet_configuration.edit_permissions")); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
} else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1];
else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey);
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); String ownerId = Layout.getOwnerId(themeDisplay.getPlid()); String groupId = Layout.getGroupId(ownerId); String portletResource = ParamUtil.getString(req, "portletResource"); String modelResource = ParamUtil.getString(req, "modelResource"); String resourcePrimKey = ParamUtil.getString(req, "resourcePrimKey"); String selResource = portletResource; if (Validator.isNotNull(modelResource)) { selResource = modelResource; } if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1]; layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains( permissionChecker, resourcePrimKey, user.getOrganization().getOrganizationId(), user.getLocation().getOrganizationId(), ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } Portlet portlet = PortletServiceUtil.getPortletById( themeDisplay.getCompanyId(), portletResource); ServletContext ctx = (ServletContext)req.getAttribute(WebKeys.CTX); res.setTitle( PortalUtil.getPortletTitle(portlet, ctx, themeDisplay.getLocale())); return mapping.findForward( getForward(req, "portlet.portlet_configuration.edit_permissions")); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains(
UserPermission.check(
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); String ownerId = Layout.getOwnerId(themeDisplay.getPlid()); String groupId = Layout.getGroupId(ownerId); String portletResource = ParamUtil.getString(req, "portletResource"); String modelResource = ParamUtil.getString(req, "modelResource"); String resourcePrimKey = ParamUtil.getString(req, "resourcePrimKey"); String selResource = portletResource; if (Validator.isNotNull(modelResource)) { selResource = modelResource; } if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1]; layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains( permissionChecker, resourcePrimKey, user.getOrganization().getOrganizationId(), user.getLocation().getOrganizationId(), ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } Portlet portlet = PortletServiceUtil.getPortletById( themeDisplay.getCompanyId(), portletResource); ServletContext ctx = (ServletContext)req.getAttribute(WebKeys.CTX); res.setTitle( PortalUtil.getPortletTitle(portlet, ctx, themeDisplay.getLocale())); return mapping.findForward( getForward(req, "portlet.portlet_configuration.edit_permissions")); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
ActionKeys.PERMISSIONS)) {
ActionKeys.PERMISSIONS); } else if (resourcePrimKey.startsWith(ownerId)) { if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.CONFIGURATION)) {
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); String ownerId = Layout.getOwnerId(themeDisplay.getPlid()); String groupId = Layout.getGroupId(ownerId); String portletResource = ParamUtil.getString(req, "portletResource"); String modelResource = ParamUtil.getString(req, "modelResource"); String resourcePrimKey = ParamUtil.getString(req, "resourcePrimKey"); String selResource = portletResource; if (Validator.isNotNull(modelResource)) { selResource = modelResource; } if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1]; layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains( permissionChecker, resourcePrimKey, user.getOrganization().getOrganizationId(), user.getLocation().getOrganizationId(), ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } Portlet portlet = PortletServiceUtil.getPortletById( themeDisplay.getCompanyId(), portletResource); ServletContext ctx = (ServletContext)req.getAttribute(WebKeys.CTX); res.setTitle( PortalUtil.getPortletTitle(portlet, ctx, themeDisplay.getLocale())); return mapping.findForward( getForward(req, "portlet.portlet_configuration.edit_permissions")); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
SessionErrors.add(req, PrincipalException.class.getName());
throw new PrincipalException(); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) {
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); String ownerId = Layout.getOwnerId(themeDisplay.getPlid()); String groupId = Layout.getGroupId(ownerId); String portletResource = ParamUtil.getString(req, "portletResource"); String modelResource = ParamUtil.getString(req, "modelResource"); String resourcePrimKey = ParamUtil.getString(req, "resourcePrimKey"); String selResource = portletResource; if (Validator.isNotNull(modelResource)) { selResource = modelResource; } if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1]; layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains( permissionChecker, resourcePrimKey, user.getOrganization().getOrganizationId(), user.getLocation().getOrganizationId(), ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } Portlet portlet = PortletServiceUtil.getPortletById( themeDisplay.getCompanyId(), portletResource); ServletContext ctx = (ServletContext)req.getAttribute(WebKeys.CTX); res.setTitle( PortalUtil.getPortletTitle(portlet, ctx, themeDisplay.getLocale())); return mapping.findForward( getForward(req, "portlet.portlet_configuration.edit_permissions")); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
setForward(req, "portlet.portlet_configuration.error");
throw new PrincipalException();
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); String ownerId = Layout.getOwnerId(themeDisplay.getPlid()); String groupId = Layout.getGroupId(ownerId); String portletResource = ParamUtil.getString(req, "portletResource"); String modelResource = ParamUtil.getString(req, "modelResource"); String resourcePrimKey = ParamUtil.getString(req, "resourcePrimKey"); String selResource = portletResource; if (Validator.isNotNull(modelResource)) { selResource = modelResource; } if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1]; layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains( permissionChecker, resourcePrimKey, user.getOrganization().getOrganizationId(), user.getLocation().getOrganizationId(), ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } Portlet portlet = PortletServiceUtil.getPortletById( themeDisplay.getCompanyId(), portletResource); ServletContext ctx = (ServletContext)req.getAttribute(WebKeys.CTX); res.setTitle( PortalUtil.getPortletTitle(portlet, ctx, themeDisplay.getLocale())); return mapping.findForward( getForward(req, "portlet.portlet_configuration.edit_permissions")); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) {
catch (PrincipalException pe) {
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); String ownerId = Layout.getOwnerId(themeDisplay.getPlid()); String groupId = Layout.getGroupId(ownerId); String portletResource = ParamUtil.getString(req, "portletResource"); String modelResource = ParamUtil.getString(req, "modelResource"); String resourcePrimKey = ParamUtil.getString(req, "resourcePrimKey"); String selResource = portletResource; if (Validator.isNotNull(modelResource)) { selResource = modelResource; } if (selResource.equals(Group.class.getName())) { if (!GroupPermission.contains( permissionChecker, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(Layout.class.getName())) { String layoutGroupId = StringUtil.split(resourcePrimKey, ".")[1]; layoutGroupId = StringUtil.replace(layoutGroupId, "}", ""); if (!GroupPermission.contains( permissionChecker, layoutGroupId, ActionKeys.MANAGE_LAYOUTS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (selResource.equals(User.class.getName())) { User user = UserLocalServiceUtil.getUserById(resourcePrimKey); if (!UserPermission.contains( permissionChecker, resourcePrimKey, user.getOrganization().getOrganizationId(), user.getLocation().getOrganizationId(), ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } } else if (!permissionChecker.hasPermission( groupId, selResource, resourcePrimKey, ActionKeys.PERMISSIONS)) { SessionErrors.add(req, PrincipalException.class.getName()); setForward(req, "portlet.portlet_configuration.error"); } Portlet portlet = PortletServiceUtil.getPortletById( themeDisplay.getCompanyId(), portletResource); ServletContext ctx = (ServletContext)req.getAttribute(WebKeys.CTX); res.setTitle( PortalUtil.getPortletTitle(portlet, ctx, themeDisplay.getLocale())); return mapping.findForward( getForward(req, "portlet.portlet_configuration.edit_permissions")); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
if (!Layout.isPrivateLayout(layout.getOwnerId())) { Resource resource = ResourceLocalServiceUtil.getResource(resourceId); if (resource.getPrimKey().startsWith(layout.getOwnerId())) { LayoutCacheUtil.clearCache(layout.getCompanyId()); } }
protected void updateGroupPermissions(ActionRequest req) throws Exception { Layout layout = (Layout)req.getAttribute(WebKeys.LAYOUT); String resourceId = ParamUtil.getString(req, "resourceId"); String groupId = ParamUtil.getString(req, "groupId"); String[] actionIds = StringUtil.split( ParamUtil.getString(req, "groupIdActionIds")); PermissionServiceUtil.setGroupPermissions( groupId, actionIds, resourceId); }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/be53c72e9aee71309f1997c632f2d99246fa10e8/EditPermissionsAction.java/buggy/portal-ejb/src/com/liferay/portlet/portletconfiguration/action/EditPermissionsAction.java
Object target = new Object() { public int commandProc(int nextHandler, int theEvent, int userData) { if (OS.GetEventKind(theEvent) == OS.kEventProcessCommand) { HICommand command = new HICommand(); OS.GetEventParameter(theEvent, OS.kEventParamDirectObject, OS.typeHICommand, null, HICommand.sizeof, null, command); switch (command.commandID) { case kHICommandPreferences: return runAction("preferences"); case kHICommandAbout: return runAction("about"); default: break; } } return OS.eventNotHandledErr; } };
Object target = new Target();
private void hookApplicationMenu(Display display) { // Callback target Object target = new Object() { public int commandProc(int nextHandler, int theEvent, int userData) { if (OS.GetEventKind(theEvent) == OS.kEventProcessCommand) { HICommand command = new HICommand(); OS.GetEventParameter(theEvent, OS.kEventParamDirectObject, OS.typeHICommand, null, HICommand.sizeof, null, command); switch (command.commandID) { case kHICommandPreferences: return runAction("preferences"); //$NON-NLS-1$ case kHICommandAbout: return runAction("about"); //$NON-NLS-1$ default: break; } } return OS.eventNotHandledErr; } }; final Callback commandCallback = new Callback(target, "commandProc", 3); //$NON-NLS-1$ int commandProc = commandCallback.getAddress(); if (commandProc == 0) { commandCallback.dispose(); return; // give up } // Install event handler for commands int[] mask = new int[] { OS.kEventClassCommand, OS.kEventProcessCommand }; OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc, mask.length / 2, mask, 0, null); // create About Eclipse menu command int[] outMenu = new int[1]; short[] outIndex = new short[1]; if (OS.GetIndMenuItemWithCommandID(0, kHICommandPreferences, 1, outMenu, outIndex) == OS.noErr && outMenu[0] != 0) { int menu = outMenu[0]; int l = fAboutActionName.length(); char buffer[] = new char[l]; fAboutActionName.getChars(0, l, buffer, 0); int str = OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault, buffer, l); OS.InsertMenuItemTextWithCFString(menu, str, (short) 0, 0, kHICommandAbout); OS.CFRelease(str); // add separator between About & Preferences OS.InsertMenuItemTextWithCFString(menu, 0, (short) 1, OS.kMenuItemAttrSeparator, 0); // enable pref menu OS.EnableMenuCommand(menu, kHICommandPreferences); // disable services menu OS.DisableMenuCommand(menu, kHICommandServices); } // schedule disposal of callback object display.disposeExec(new Runnable() { public void run() { commandCallback.dispose(); } }); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/5c98aa0e8cc435294e5feea074dd69afb3623667/CarbonUIEnhancer.java/clean/bundles/org.eclipse.ui.carbon/src/org/eclipse/ui/carbon/CarbonUIEnhancer.java
Object target = new Object() { public int toolbarProc (int nextHandler, int theEvent, int userData) { int eventKind = OS.GetEventKind (theEvent); if (eventKind != OS.kEventWindowToolbarSwitchMode) return OS.eventNotHandledErr; int [] theWindow = new int [1]; OS.GetEventParameter (theEvent, OS.kEventParamDirectObject, OS.typeWindowRef, null, 4, null, theWindow); int [] theRoot = new int [1]; OS.GetRootControl (theWindow [0], theRoot); Widget widget = Display.getCurrent().findWidget(theRoot [0]); if (!(widget instanceof Shell)) { return OS.eventNotHandledErr; } Shell shell = (Shell) widget; IWorkbenchWindow[] windows = PlatformUI.getWorkbench() .getWorkbenchWindows(); for (int i = 0; i < windows.length; i++) { if (windows[i].getShell() == shell) { return runAction("toggleCoolbar"); } } return OS.eventNotHandledErr; } };
Object target = new Target();
protected void hookToolbarButtonCallback() { Object target = new Object() { public int toolbarProc (int nextHandler, int theEvent, int userData) { int eventKind = OS.GetEventKind (theEvent); if (eventKind != OS.kEventWindowToolbarSwitchMode) return OS.eventNotHandledErr; int [] theWindow = new int [1]; OS.GetEventParameter (theEvent, OS.kEventParamDirectObject, OS.typeWindowRef, null, 4, null, theWindow); int [] theRoot = new int [1]; OS.GetRootControl (theWindow [0], theRoot); Widget widget = Display.getCurrent().findWidget(theRoot [0]); if (!(widget instanceof Shell)) { return OS.eventNotHandledErr; } Shell shell = (Shell) widget; IWorkbenchWindow[] windows = PlatformUI.getWorkbench() .getWorkbenchWindows(); for (int i = 0; i < windows.length; i++) { if (windows[i].getShell() == shell) { return runAction("toggleCoolbar"); //$NON-NLS-1$ } } return OS.eventNotHandledErr; } }; final Callback commandCallback = new Callback(target, "toolbarProc", 3); //$NON-NLS-1$ int commandProc = commandCallback.getAddress(); if (commandProc == 0) { commandCallback.dispose(); return; // give up } int[] mask = new int[] { OS.kEventClassWindow, OS.kEventWindowToolbarSwitchMode }; OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc, mask.length / 2, mask, 0, null); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/5c98aa0e8cc435294e5feea074dd69afb3623667/CarbonUIEnhancer.java/clean/bundles/org.eclipse.ui.carbon/src/org/eclipse/ui/carbon/CarbonUIEnhancer.java
return (int) (RubyNumeric.fix2long(obj1) - RubyNumeric.fix2long(obj2));
long diff = RubyNumeric.fix2long(obj1) - RubyNumeric.fix2long(obj2); return diff < 0 ? -1 : diff > 0 ? 1 : 0;
public int compare(Object o1, Object o2) { IRubyObject obj1 = (IRubyObject) o1; IRubyObject obj2 = (IRubyObject) o2; if (o1 instanceof RubyFixnum && o2 instanceof RubyFixnum) { return (int) (RubyNumeric.fix2long(obj1) - RubyNumeric.fix2long(obj2)); } if (o1 instanceof RubyString && o2 instanceof RubyString) { return RubyNumeric.fix2int(((RubyString) o1).op_cmp((IRubyObject) o2)); } return RubyNumeric.fix2int(obj1.callMethod("<=>", obj2)); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/557d5a8d0dd3f2232933ecc9d751daf23bf85d5b/RubyArray.java/buggy/src/org/jruby/RubyArray.java
if (dataTracker.isNew() || dataTracker.isModified()) { session = openSession(); if (dataTracker.isNew()) { DataTracker dataTrackerModel = new DataTracker(); dataTrackerModel.setDataTrackerId(dataTracker.getDataTrackerId()); dataTrackerModel.setCompanyId(dataTracker.getCompanyId()); dataTrackerModel.setCreatedOn(dataTracker.getCreatedOn()); dataTrackerModel.setCreatedByUserId(dataTracker.getCreatedByUserId()); dataTrackerModel.setCreatedByUserName(dataTracker.getCreatedByUserName()); dataTrackerModel.setUpdatedOn(dataTracker.getUpdatedOn()); dataTrackerModel.setUpdatedBy(dataTracker.getUpdatedBy()); dataTrackerModel.setClassName(dataTracker.getClassName()); dataTrackerModel.setClassPK(dataTracker.getClassPK()); dataTrackerModel.setActive(dataTracker.getActive()); session.save(dataTrackerModel); session.flush(); } else { DataTracker dataTrackerModel = (DataTracker)session.get(DataTracker.class, dataTracker.getPrimaryKey()); if (dataTrackerModel != null) { dataTrackerModel.setCompanyId(dataTracker.getCompanyId()); dataTrackerModel.setCreatedOn(dataTracker.getCreatedOn()); dataTrackerModel.setCreatedByUserId(dataTracker.getCreatedByUserId()); dataTrackerModel.setCreatedByUserName(dataTracker.getCreatedByUserName()); dataTrackerModel.setUpdatedOn(dataTracker.getUpdatedOn()); dataTrackerModel.setUpdatedBy(dataTracker.getUpdatedBy()); dataTrackerModel.setClassName(dataTracker.getClassName()); dataTrackerModel.setClassPK(dataTracker.getClassPK()); dataTrackerModel.setActive(dataTracker.getActive()); session.flush(); } else { dataTrackerModel = new DataTracker(); dataTrackerModel.setDataTrackerId(dataTracker.getDataTrackerId()); dataTrackerModel.setCompanyId(dataTracker.getCompanyId()); dataTrackerModel.setCreatedOn(dataTracker.getCreatedOn()); dataTrackerModel.setCreatedByUserId(dataTracker.getCreatedByUserId()); dataTrackerModel.setCreatedByUserName(dataTracker.getCreatedByUserName()); dataTrackerModel.setUpdatedOn(dataTracker.getUpdatedOn()); dataTrackerModel.setUpdatedBy(dataTracker.getUpdatedBy()); dataTrackerModel.setClassName(dataTracker.getClassName()); dataTrackerModel.setClassPK(dataTracker.getClassPK()); dataTrackerModel.setActive(dataTracker.getActive()); session.save(dataTrackerModel); session.flush(); } } dataTracker.setNew(false); dataTracker.setModified(false); }
session = openSession(); session.saveOrUpdate(dataTracker); session.flush(); dataTracker.setNew(false);
public com.liferay.portal.model.DataTracker update( com.liferay.portal.model.DataTracker dataTracker) throws SystemException { Session session = null; try { if (dataTracker.isNew() || dataTracker.isModified()) { session = openSession(); if (dataTracker.isNew()) { DataTracker dataTrackerModel = new DataTracker(); dataTrackerModel.setDataTrackerId(dataTracker.getDataTrackerId()); dataTrackerModel.setCompanyId(dataTracker.getCompanyId()); dataTrackerModel.setCreatedOn(dataTracker.getCreatedOn()); dataTrackerModel.setCreatedByUserId(dataTracker.getCreatedByUserId()); dataTrackerModel.setCreatedByUserName(dataTracker.getCreatedByUserName()); dataTrackerModel.setUpdatedOn(dataTracker.getUpdatedOn()); dataTrackerModel.setUpdatedBy(dataTracker.getUpdatedBy()); dataTrackerModel.setClassName(dataTracker.getClassName()); dataTrackerModel.setClassPK(dataTracker.getClassPK()); dataTrackerModel.setActive(dataTracker.getActive()); session.save(dataTrackerModel); session.flush(); } else { DataTracker dataTrackerModel = (DataTracker)session.get(DataTracker.class, dataTracker.getPrimaryKey()); if (dataTrackerModel != null) { dataTrackerModel.setCompanyId(dataTracker.getCompanyId()); dataTrackerModel.setCreatedOn(dataTracker.getCreatedOn()); dataTrackerModel.setCreatedByUserId(dataTracker.getCreatedByUserId()); dataTrackerModel.setCreatedByUserName(dataTracker.getCreatedByUserName()); dataTrackerModel.setUpdatedOn(dataTracker.getUpdatedOn()); dataTrackerModel.setUpdatedBy(dataTracker.getUpdatedBy()); dataTrackerModel.setClassName(dataTracker.getClassName()); dataTrackerModel.setClassPK(dataTracker.getClassPK()); dataTrackerModel.setActive(dataTracker.getActive()); session.flush(); } else { dataTrackerModel = new DataTracker(); dataTrackerModel.setDataTrackerId(dataTracker.getDataTrackerId()); dataTrackerModel.setCompanyId(dataTracker.getCompanyId()); dataTrackerModel.setCreatedOn(dataTracker.getCreatedOn()); dataTrackerModel.setCreatedByUserId(dataTracker.getCreatedByUserId()); dataTrackerModel.setCreatedByUserName(dataTracker.getCreatedByUserName()); dataTrackerModel.setUpdatedOn(dataTracker.getUpdatedOn()); dataTrackerModel.setUpdatedBy(dataTracker.getUpdatedBy()); dataTrackerModel.setClassName(dataTracker.getClassName()); dataTrackerModel.setClassPK(dataTracker.getClassPK()); dataTrackerModel.setActive(dataTracker.getActive()); session.save(dataTrackerModel); session.flush(); } } dataTracker.setNew(false); dataTracker.setModified(false); } return dataTracker; } catch (HibernateException he) { throw new SystemException(he); } finally { closeSession(session); } }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/DataTrackerPersistence.java/clean/portal-ejb/src/com/liferay/portal/service/persistence/DataTrackerPersistence.java
runtime.getClasses().getIoClass());
runtime.getClass("IO"));
public BasicSocketMetaClass(Ruby runtime) { super("BasicSocket", RubyBasicSocket.class, runtime.getClasses().getIoClass()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/ca6b16e996ea9af83ce593594b9c69b9364a9924/BasicSocketMetaClass.java/buggy/src/org/jruby/runtime/builtin/meta/BasicSocketMetaClass.java
if (extents.width == 0 && extents.height == 0) { extents = new Rectangle(0, 0, 1, 1); }
protected LayoutContext newLayoutContext(Graphics2D g) { XRLog.layout(Level.FINEST, "new context begin"); getSharedContext().setCanvas(this); Rectangle extents = getScreenExtents(); XRLog.layout(Level.FINEST, "new context end"); LayoutContext result = getSharedContext().newLayoutContextInstance(extents); result.setGraphics(g.getDeviceConfiguration().createCompatibleImage(1, 1).createGraphics()); if (result.isPrint()) { PageBox first = Layer.createPageBox(result, "first"); extents = new Rectangle(0, 0, first.getContentWidth(result), first.getContentHeight(result)); result.setExtents(extents); } return result; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/ed328f65908386641e6e47c92a62593beded8848/RootPanel.java/clean/src/java/org/xhtmlrenderer/swing/RootPanel.java
animationStartJob = new WorkbenchJob(ProgressMessages .getString("AnimationManager.AnimationStart")) { /* * (non-Javadoc) * * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) */ public IStatus runInUIThread(IProgressMonitor monitor) { if(monitor.isCanceled()) return Status.CANCEL_STATUS; animationProcessor.animationStarted(); return Status.OK_STATUS; } }; animationStartJob.setSystem(true); animationDoneJob = new WorkbenchJob(ProgressMessages.getString("AnimationManager.DoneJobName")) { /* * (non-Javadoc) * * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) */ public IStatus runInUIThread(IProgressMonitor monitor) { if(monitor.isCanceled()) return Status.CANCEL_STATUS; animationProcessor.animationFinished(); return Status.OK_STATUS; } }; animationDoneJob.setSystem(true);
AnimationManager() { animationProcessor = new ProgressAnimationProcessor(this); listener = getProgressListener(); ProgressManager.getInstance().addListener(listener); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3254473f6b332db5406f3cf7bc91aa2eaff67397/AnimationManager.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java
animationProcessor.animationStarted();
if(monitor.isCanceled()) return Status.CANCEL_STATUS; animationProcessor.animationFinished();
public IStatus runInUIThread(IProgressMonitor monitor) { animationProcessor.animationStarted(); return Status.OK_STATUS; }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3254473f6b332db5406f3cf7bc91aa2eaff67397/AnimationManager.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java
UIJob animationDoneJob = new WorkbenchJob(ProgressMessages.getString("AnimationManager.DoneJobName")) { /* * (non-Javadoc) * * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) */ public IStatus runInUIThread(IProgressMonitor monitor) { animationProcessor.animationFinished(); return Status.OK_STATUS; } }; animationDoneJob.setSystem(true);
animationStartJob.cancel();
private void animationFinished() { UIJob animationDoneJob = new WorkbenchJob(ProgressMessages.getString("AnimationManager.DoneJobName")) { //$NON-NLS-1$ /* * (non-Javadoc) * * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) */ public IStatus runInUIThread(IProgressMonitor monitor) { animationProcessor.animationFinished(); return Status.OK_STATUS; } }; animationDoneJob.setSystem(true); animationDoneJob.schedule(); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3254473f6b332db5406f3cf7bc91aa2eaff67397/AnimationManager.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java
WorkbenchJob animationStartJob = new WorkbenchJob(ProgressMessages .getString("AnimationManager.AnimationStart")) { /* * (non-Javadoc) * * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) */ public IStatus runInUIThread(IProgressMonitor monitor) { animationProcessor.animationStarted(); return Status.OK_STATUS; } }; animationStartJob.setSystem(true);
animationDoneJob.cancel();
private void animationStarted() { WorkbenchJob animationStartJob = new WorkbenchJob(ProgressMessages .getString("AnimationManager.AnimationStart")) {//$NON-NLS-1$ /* * (non-Javadoc) * * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) */ public IStatus runInUIThread(IProgressMonitor monitor) { animationProcessor.animationStarted(); return Status.OK_STATUS; } }; animationStartJob.setSystem(true); animationStartJob.schedule(); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3254473f6b332db5406f3cf7bc91aa2eaff67397/AnimationManager.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java
public FCallNode(ISourcePosition position, String name, IListNode argsNode) {
public FCallNode(ISourcePosition position, String name, INode argsNode) {
public FCallNode(ISourcePosition position, String name, IListNode argsNode) { super(position); this.name = name.intern(); this.argsNode = argsNode; if (! (argsNode instanceof ArrayNode)) { if (argsNode != null) { System.out.println("" + argsNode.getClass()); } } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/f5c9a1ebd775712f2dc086acfce1a14a123ec632/FCallNode.java/buggy/src/org/jruby/ast/FCallNode.java
if (! (argsNode instanceof ArrayNode)) { if (argsNode != null) { System.out.println("" + argsNode.getClass()); } }
public FCallNode(ISourcePosition position, String name, IListNode argsNode) { super(position); this.name = name.intern(); this.argsNode = argsNode; if (! (argsNode instanceof ArrayNode)) { if (argsNode != null) { System.out.println("" + argsNode.getClass()); } } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/f5c9a1ebd775712f2dc086acfce1a14a123ec632/FCallNode.java/buggy/src/org/jruby/ast/FCallNode.java
public IListNode getArgsNode() {
public INode getArgsNode() {
public IListNode getArgsNode() { return argsNode; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/f5c9a1ebd775712f2dc086acfce1a14a123ec632/FCallNode.java/buggy/src/org/jruby/ast/FCallNode.java
Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(
IDEWorkbenchPlugin.getDefault().getLog().log(
private boolean updateNatures() { // define the operation to update natures WorkspaceModifyOperation op = new WorkspaceModifyOperation() { protected void execute(IProgressMonitor monitor) throws CoreException { try { IProjectDescription description = project.getDescription(); String[] oldIds = description.getNatureIds(); ArrayList newIds = new ArrayList(oldIds.length); for (int i = 0; i < oldIds.length; i++) { boolean keepNature = true; for (int j = 0; j < natureIds.length; j++) { if (natureIds[j].equals(oldIds[i])) { keepNature = false; break; } } if (keepNature) newIds.add(oldIds[i]); } String[] results = new String[newIds.size()]; newIds.toArray(results); description.setNatureIds(results); project.setDescription(description, monitor); } finally { monitor.done(); } } }; // run the update nature operation try { getContainer().run(true, true, op); } catch (InterruptedException e) { return false; } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof CoreException) { ErrorDialog.openError(getShell(), IDEWorkbenchMessages.RemoveCapabilityWizard_errorMessage, null, // no special message ((CoreException) t).getStatus()); } else { // Unexpected runtime exceptions and errors may still occur. Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log( new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, t .toString(), t)); MessageDialog .openError( getShell(), IDEWorkbenchMessages.RemoveCapabilityWizard_errorMessage, NLS.bind(IDEWorkbenchMessages.RemoveCapabilityWizard_internalError, t.getMessage())); } return false; } return true; }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/b44617ebe568f7f4382cb371e3d1a291dd46bd17/RemoveCapabilityWizard.java/clean/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/RemoveCapabilityWizard.java
Context.PROVIDER_URL, LDAPUtil.getFullProviderURL(baseProviderURL, baseDN));
Context.PROVIDER_URL, LDAPUtil.getFullProviderURL(baseProviderURL, baseDN));
protected int authenticate( String companyId, String emailAddress, String userId, String password) throws Exception { boolean enabled = PrefsPropsUtil.getBoolean( companyId, PropsUtil.AUTH_IMPL_LDAP_ENABLED); if (!enabled) { if (_log.isDebugEnabled()) { _log.debug("Authenticator is not enabled"); } return SUCCESS; } if (_log.isDebugEnabled()) { _log.debug("Authenticator is enabled"); } Properties env = new Properties(); String baseProviderURL = PrefsPropsUtil.getString( companyId, PropsUtil.AUTH_IMPL_LDAP_BASE_PROVIDER_URL); String baseDN = PrefsPropsUtil.getString( companyId, PropsUtil.AUTH_IMPL_LDAP_BASE_DN); env.put( Context.INITIAL_CONTEXT_FACTORY, PrefsPropsUtil.getString( companyId, PropsUtil.AUTH_IMPL_LDAP_FACTORY_INITIAL)); env.put( Context.PROVIDER_URL, LDAPUtil.getFullProviderURL(baseProviderURL, baseDN)); env.put( Context.SECURITY_PRINCIPAL, PrefsPropsUtil.getString( companyId, PropsUtil.AUTH_IMPL_LDAP_SECURITY_PRINCIPAL)); env.put( Context.SECURITY_CREDENTIALS, PrefsPropsUtil.getString( companyId, PropsUtil.AUTH_IMPL_LDAP_SECURITY_CREDENTIALS)); if (_log.isDebugEnabled()) { StringWriter sw = new StringWriter(); env.list(new PrintWriter(sw)); _log.debug(sw.getBuffer().toString()); } LdapContext ctx = null; try { ctx = new InitialLdapContext(env, null); } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug("Failed to bind to the LDAP server"); } return SUCCESS; } String filter = PrefsPropsUtil.getString( companyId, PropsUtil.AUTH_IMPL_LDAP_SEARCH_FILTER); if (_log.isDebugEnabled()) { _log.debug("Search filter before transformation " + filter); } filter = StringUtil.replace( filter, new String[] { "@company_id@", "@email_address@", "@user_id@" }, new String[] { companyId, emailAddress, userId }); if (_log.isDebugEnabled()) { _log.debug("Search filter after transformation " + filter); } try { SearchControls cons = new SearchControls( SearchControls.SUBTREE_SCOPE, 1, 0, null, false, false); NamingEnumeration enu = ctx.search(StringPool.BLANK, filter, cons); if (enu.hasMore()) { if (_log.isDebugEnabled()) { _log.debug("Search filter returned at least one result"); } Binding binding = (Binding)enu.next(); Attributes attrs = ctx.getAttributes(binding.getName()); Properties userMappings = PropertiesUtil.load( PrefsPropsUtil.getString( companyId, PropsUtil.AUTH_IMPL_LDAP_USER_MAPPINGS)); if (_log.isDebugEnabled()) { StringWriter sw = new StringWriter(); userMappings.list(new PrintWriter(sw)); _log.debug(sw.getBuffer().toString()); } String creatorUserId = null; boolean autoUserId = false; if (Validator.isNull(userId)) { userId = LDAPUtil.getAttributeValue( attrs, userMappings.getProperty("userId")); } boolean autoPassword = false; String password1 = password; String password2 = password; boolean passwordReset = false; if (Validator.isNull(emailAddress)) { emailAddress = LDAPUtil.getAttributeValue( attrs, userMappings.getProperty("emailAddress")); } Locale locale = Locale.US; String firstName = LDAPUtil.getAttributeValue( attrs, userMappings.getProperty("firstName")); String middleName = LDAPUtil.getAttributeValue( attrs, userMappings.getProperty("middleName")); String lastName = LDAPUtil.getAttributeValue( attrs, userMappings.getProperty("lastName")); if (Validator.isNull(firstName) || Validator.isNull(lastName)) { String fullName = LDAPUtil.getAttributeValue( attrs, userMappings.getProperty("fullName")); String[] names = LDAPUtil.splitFullName(fullName); firstName = names[0]; middleName = names[1]; lastName = names[2]; } String nickName = null; String prefixId = null; String suffixId = null; boolean male = true; int birthdayMonth = Calendar.JANUARY; int birthdayDay = 1; int birthdayYear = 1970; String jobTitle = LDAPUtil.getAttributeValue( attrs, userMappings.getProperty("jobTitle")); String organizationId = null; String locationId = null; boolean sendEmail = false; // Check passwords by either doing a comparison between the // passwords or by binding to the LDAP server Attribute userPassword = attrs.get("userPassword"); if (userPassword != null) { String ldapPassword = new String((byte[])userPassword.get()); String encryptedPassword = password; String algorithm = PrefsPropsUtil.getString( companyId, PropsUtil.AUTH_IMPL_LDAP_PASSWORD_ENCRYPTION_ALGORITHM); if (Validator.isNotNull(algorithm)) { encryptedPassword = "{" + algorithm + "}" + Encryptor.digest(algorithm, password); } if (!ldapPassword.equals(encryptedPassword)) { _log.error( "LDAP password " + ldapPassword + " does not match with given password " + encryptedPassword + " for user id " + userId); return authenticateRequired(companyId, userId, emailAddress); } } else { try { env.put(Context.SECURITY_PRINCIPAL, userId); env.put(Context.SECURITY_CREDENTIALS, password); ctx = new InitialLdapContext(env, null); } catch (Exception e) { _log.error( "Failed to bind to the LDAP server with " + userId + " " + password, e); return authenticateRequired(companyId, userId, emailAddress); } } // Make sure the user has a portal account LDAPImportUtil.addOrUpdateUser( creatorUserId, companyId, autoUserId, userId, autoPassword, password1, password2, passwordReset, emailAddress, locale, firstName, middleName, lastName, nickName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, organizationId, locationId, sendEmail, true, false); } else { if (_log.isDebugEnabled()) { _log.debug("Search filter did not return any results"); } return authenticateRequired(companyId, userId, emailAddress); } } catch (Exception e) { _log.warn("Problem accessing LDAP server"); return authenticateRequired(companyId, userId, emailAddress); } return SUCCESS; }
57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/7801af04630465ed9f23d98718b807c01c3cbc96/LDAPAuth.java/clean/portal-ejb/src/com/liferay/portal/security/auth/LDAPAuth.java
System.out.println("pulling from here: " + e.getAttribute("src"));
JComponent addComponent(Context c, Element e) { JComponent cc = (JComponent) components.get(e); if (cc != null) { return cc; } if (e.getNodeName().equals("input")) { String type = e.getAttribute("type"); if (type == null || type.equals("")) { type = "button"; } String label = e.getAttribute("value"); if (label == null || label.equals("")) { if (type.equals("reset")) { label = "Reset";//TODO: this text should be from properties } if (type.equals("submit")) { label = "Submit"; } } if (type.equals("button") || type.equals("reset") || type.equals("submit")) { JButton button = new JButton(); button.setText(label); cc = button; } else if (type.equals("image")) { JButton jb = new JButton(); Image im = null; if (e.hasAttribute("src")) { im = c.getCtx().getUac().getImage(e.getAttribute("src")); } if (im == null) { jb = new JButton("Image unreachable. " + e.getAttribute("alt")); } else { ImageIcon ii = new ImageIcon(im, e.getAttribute("alt")); jb = new JButton(ii); } jb.setBorder(BorderFactory.createEmptyBorder()); cc = jb; } else if (type.equals("checkbox")) { JCheckBox checkbox = new JCheckBox(); checkbox.setText(""); checkbox.setOpaque(false); if (e.hasAttribute("checked") && e.getAttribute("checked").equals("checked")) { checkbox.setSelected(true); } cc = checkbox; } else if (type.equals("password")) { JPasswordField pw = new JPasswordField(); if (e.hasAttribute("size")) { pw.setColumns(Integer.parseInt(e.getAttribute("size"))); } else { pw.setColumns(15); } if (e.hasAttribute("maxlength")) { final int maxlength = Integer.parseInt(e.getAttribute("maxlength")); pw.setDocument(new PlainDocument() { public void insertString(int offset, String str, AttributeSet attr) throws BadLocationException { if (str == null) { return; } if ((getLength() + str.length()) <= maxlength) { super.insertString(offset, str, attr); } } }); } cc = pw; } else if (type.equals("radio")) { JRadioButton radio = new JRadioButton(); radio.setText(""); radio.setOpaque(false); if (e.hasAttribute("checked") && e.getAttribute("checked").equals("checked")) { radio.setSelected(true); } cc = radio; } else if (type.equals("text")) { JTextField text = new JTextField(); if (e.hasAttribute("value")) { text.setText(e.getAttribute("value")); } if (e.hasAttribute("size")) { text.setColumns(Integer.parseInt(e.getAttribute("size"))); } else { text.setColumns(15); } if (e.hasAttribute("maxlength")) { final int maxlength = Integer.parseInt(e.getAttribute("maxlength")); text.setDocument(new PlainDocument() { public void insertString(int offset, String str, AttributeSet attr) throws BadLocationException { if (str == null) { return; } if ((getLength() + str.length()) <= maxlength) { super.insertString(offset, str, attr); } } }); } if (e.hasAttribute("readonly") && e.getAttribute("readonly").equals("readonly")) { text.setEditable(false); } cc = text; } else if (type.equals("text")) { JTextField text = new JTextField(); if (e.hasAttribute("value")) { text.setText(e.getAttribute("value")); } cc = null;//don't return it components.put(e, text); } else if (type.equals("hidden")) { // TODO: hidden form fields. } else { XRLog.layout("unknown input type " + type); } if (type.equals("submit") || type.equals("image")) { ((JButton) cc).addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { submit((JComponent) evt.getSource()); } }); } } else if (e.getNodeName().equals("textarea")) { int rows = 4; int cols = 10; if (e.hasAttribute("rows")) { rows = Integer.parseInt(e.getAttribute("rows")); } if (e.hasAttribute("cols")) { cols = Integer.parseInt(e.getAttribute("cols")); } JTextArea ta = new JTextArea(rows, cols); JScrollPane sp = new JScrollPane(ta); sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); if (e.getFirstChild() != null) { //Uu.p("setting text to: " + elem.getFirstChild().getNodeValue()); ta.setText(e.getFirstChild().getNodeValue()); } cc = sp; } else if (e.getNodeName().equals("select")) { JComboBox select = new JComboBox(); select.setEditable(false);//cannot edit it in HTML NodeList options = e.getElementsByTagName("option"); int selected = -1; for (int i = 0; i < options.getLength(); i++) { Element value = (Element) options.item(i); String svalue = value.getFirstChild().getNodeValue(); select.addItem(svalue); if (value.hasAttribute("selected") && value.getAttribute("selected").equals("selected")) { selected = i; } } if (selected != -1) { select.setSelectedIndex(selected); } cc = select; } if (cc != null) {//was a form object cc.setSize(cc.getPreferredSize()); if (e.hasAttribute("disabled") && e.getAttribute("disabled").equals("disabled")) { cc.setEnabled(false); } components.put(e, cc); } return cc; }
57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/700deda900763fb4334d7a41940a307a33287ba5/XhtmlForm.java/clean/src/java/org/xhtmlrenderer/simple/extend/XhtmlForm.java
public WorkspaceOperationsTests() { super();
public WorkspaceOperationsTests(String name) { super(name);
public WorkspaceOperationsTests() { super(); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
private void execute(IUndoableOperation operation)
private void execute(AbstractWorkspaceOperation operation)
private void execute(IUndoableOperation operation) throws ExecutionException { assertTrue("Operation can be executed", operation.canExecute()); assertTrue("Execution should be OK status", history.execute(operation, getMonitor(), null).equals(Status.OK_STATUS)); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
assertTrue("Execution should be OK status", history.execute(operation, getMonitor(), null).equals(Status.OK_STATUS));
IStatus status = history.execute(operation, getMonitor(), null); assertTrue("Execution should be OK status", status.isOK());
private void execute(IUndoableOperation operation) throws ExecutionException { assertTrue("Operation can be executed", operation.canExecute()); assertTrue("Execution should be OK status", history.execute(operation, getMonitor(), null).equals(Status.OK_STATUS)); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
assertTrue("Redo should be OK status", history.redo(context, getMonitor(), null).equals(Status.OK_STATUS));
IStatus status = history.redo(context, getMonitor(), null); assertTrue("Redo should be OK status", status.isOK());
private void redo() throws ExecutionException { assertTrue("Operation can be redone", history.canRedo(context)); assertTrue("Redo should be OK status", history.redo(context, getMonitor(), null).equals(Status.OK_STATUS)); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
new IFile[] { testFile1, testFile2, testFile3 },
new IFile[] { emptyTestFile, testFileWithContent, testLinkedFile },
public void testCreateMarkerUndoInvalid() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getUpdatedMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); IMarker[] markers = op.getMarkers(); markers[1].delete(); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. op.computeUndoableStatus(null); assertFalse("Undo should be invalid, marker no longer exists", op .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
public void testCreateMarkerUndoInvalid() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getUpdatedMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); IMarker[] markers = op.getMarkers(); markers[1].delete(); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. op.computeUndoableStatus(null); assertFalse("Undo should be invalid, marker no longer exists", op .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
new IFile[] { testFile1, testFile2, testFile3 },
new IFile[] { emptyTestFile, testFileWithContent, testLinkedFile },
public void testCreateMarkerUndoInvalid2() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getUpdatedMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); testFile1.delete(true, getMonitor()); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. op.computeUndoableStatus(null); assertFalse("Undo should be invalid, resource no longer exists", op .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
testFile1.delete(true, getMonitor());
emptyTestFile.delete(true, getMonitor());
public void testCreateMarkerUndoInvalid2() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getUpdatedMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); testFile1.delete(true, getMonitor()); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. op.computeUndoableStatus(null); assertFalse("Undo should be invalid, resource no longer exists", op .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
public void testCreateMarkerUndoInvalid2() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getUpdatedMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); testFile1.delete(true, getMonitor()); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. op.computeUndoableStatus(null); assertFalse("Undo should be invalid, resource no longer exists", op .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Marker Types Test");
new IFile[] { emptyTestFile, testFileWithContent, testLinkedFile }, "Create Multiple Marker Types Test");
public void testCreateMultipleMarkerTypesUndoRedo() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getUpdatedMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Marker Types Test"); execute(op); IMarker[] markers = op.getMarkers(); validateCreatedMarkers(3, markers, attrs, types); undo(); for (int i = 0; i < markers.length; i++) { IMarker createdMarker = markers[i]; assertFalse("Marker should no longer exist", createdMarker.exists()); } redo(); markers = op.getMarkers(); validateCreatedMarkers(3, markers, attrs, types); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
attrs, new IFile[] { testFile1, testFile2, testFile3 },
attrs, new IFile[] { emptyTestFile, testFileWithContent, testLinkedFile },
public void testCreateMultipleMarkersSingleTypeUndoRedo() throws ExecutionException, CoreException { String[] types = new String[] { CUSTOM_TYPE, CUSTOM_TYPE, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getUpdatedMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(CUSTOM_TYPE, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Single Type Test"); execute(op); IMarker[] markers = op.getMarkers(); validateCreatedMarkers(3, markers, attrs, types); undo(); for (int i = 0; i < markers.length; i++) { IMarker createdMarker = markers[i]; assertFalse("Marker should no longer exist", createdMarker.exists()); } redo(); markers = op.getMarkers(); validateCreatedMarkers(3, markers, attrs, types); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
IMarker.BOOKMARK, getInitialMarkerAttributes(), testFile1,
IMarker.BOOKMARK, getInitialMarkerAttributes(), emptyTestFile,
public void testCreateSingleMarkerUndoRedo() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK }; Map[] attrs = new Map[] { getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation( IMarker.BOOKMARK, getInitialMarkerAttributes(), testFile1, "Create Single Marker Test"); execute(op); IMarker[] markers = op.getMarkers(); validateCreatedMarkers(1, markers, attrs, types); undo(); assertFalse("Marker should no longer exist", markers[0].exists()); redo(); markers = op.getMarkers(); validateCreatedMarkers(1, markers, attrs, types); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
new IFile[] { testFile1, testFile2, testFile3 },
new IFile[] { emptyTestFile, testFileWithContent, testLinkedFile },
public void testDeleteMarkersUndoRedo() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getUpdatedMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); IMarker[] markers = op.getMarkers(); DeleteMarkersOperation deleteOp = new DeleteMarkersOperation(markers, "Delete Markers Test"); execute(deleteOp); for (int i = 0; i < markers.length; i++) { IMarker createdMarker = markers[i]; assertFalse("Marker should no longer exist", createdMarker.exists()); } undo(); markers = deleteOp.getMarkers(); validateCreatedMarkers(3, markers, attrs, types); redo(); for (int i = 0; i < markers.length; i++) { IMarker createdMarker = markers[i]; assertFalse("Marker should no longer exist", createdMarker.exists()); } }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
new IFile[] { testFile1, testFile2, testFile3 },
new IFile[] { emptyTestFile, testFileWithContent, testLinkedFile },
public void testUpdateAndMergeMultipleMarkerUndoRedo() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getInitialMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); UpdateMarkersOperation updateOp = new UpdateMarkersOperation(op .getMarkers(), getUpdatedMarkerAttributes(), "Update and Merge Multiple Markers", true); execute(updateOp); validateCreatedMarkers(3, updateOp.getMarkers(), new Map[] { mergedUpdatedAttributes, mergedUpdatedAttributes, mergedUpdatedAttributes }, types); undo(); validateCreatedMarkers(3, updateOp.getMarkers(), attrs, types); redo(); validateCreatedMarkers(3, updateOp.getMarkers(), new Map[] { mergedUpdatedAttributes, mergedUpdatedAttributes, mergedUpdatedAttributes }, types); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
IMarker.BOOKMARK, getInitialMarkerAttributes(), testFile1,
IMarker.BOOKMARK, getInitialMarkerAttributes(), testLinkedFile,
public void testUpdateAndMergeSingleMarkerUndoRedo() throws ExecutionException, CoreException { CreateMarkersOperation op = new CreateMarkersOperation( IMarker.BOOKMARK, getInitialMarkerAttributes(), testFile1, "Create Marker Test"); execute(op); UpdateMarkersOperation updateOp = new UpdateMarkersOperation(op .getMarkers()[0], getUpdatedMarkerAttributes(), "Update And Merge Single Marker", true); execute(updateOp); validateCreatedMarkers(1, updateOp.getMarkers(), new Map[] { mergedUpdatedAttributes }, new String[] { IMarker.BOOKMARK }); undo(); validateCreatedMarkers(1, updateOp.getMarkers(), new Map[] { getInitialMarkerAttributes() }, new String[] { IMarker.BOOKMARK }); redo(); validateCreatedMarkers(1, updateOp.getMarkers(), new Map[] { mergedUpdatedAttributes }, new String[] { IMarker.BOOKMARK }); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
new IFile[] { testFile1, testFile2, testFile3 },
new IFile[] { emptyTestFile, testFileWithContent, testLinkedFile },
public void testUpdateMarkersInvalid() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getInitialMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); UpdateMarkersOperation updateOp = new UpdateMarkersOperation(op .getMarkers(), getUpdatedMarkerAttributes(), "Update and Merge Multiple Markers", true); execute(updateOp); IMarker[] markers = updateOp.getMarkers(); markers[0].delete(); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. updateOp.computeUndoableStatus(null); assertFalse("Undo should be invalid, marker no longer exists", updateOp .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
public void testUpdateMarkersInvalid() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getInitialMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); UpdateMarkersOperation updateOp = new UpdateMarkersOperation(op .getMarkers(), getUpdatedMarkerAttributes(), "Update and Merge Multiple Markers", true); execute(updateOp); IMarker[] markers = updateOp.getMarkers(); markers[0].delete(); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. updateOp.computeUndoableStatus(null); assertFalse("Undo should be invalid, marker no longer exists", updateOp .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
new IFile[] { testFile1, testFile2, testFile3 },
new IFile[] { emptyTestFile, testFileWithContent, testLinkedFile },
public void testUpdateMarkersInvalid2() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getInitialMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); UpdateMarkersOperation updateOp = new UpdateMarkersOperation(op .getMarkers(), getUpdatedMarkerAttributes(), "Update and Merge Multiple Markers", true); execute(updateOp); testFile3.delete(true, getMonitor()); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. updateOp.computeUndoableStatus(null); assertFalse("Undo should be invalid, marker no longer exists", updateOp .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
testFile3.delete(true, getMonitor());
testFileWithContent.delete(true, getMonitor());
public void testUpdateMarkersInvalid2() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getInitialMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); UpdateMarkersOperation updateOp = new UpdateMarkersOperation(op .getMarkers(), getUpdatedMarkerAttributes(), "Update and Merge Multiple Markers", true); execute(updateOp); testFile3.delete(true, getMonitor()); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. updateOp.computeUndoableStatus(null); assertFalse("Undo should be invalid, marker no longer exists", updateOp .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java
public void testUpdateMarkersInvalid2() throws ExecutionException, CoreException { String[] types = new String[] { IMarker.BOOKMARK, IMarker.TASK, CUSTOM_TYPE }; Map[] attrs = new Map[] { getInitialMarkerAttributes(), getInitialMarkerAttributes(), getInitialMarkerAttributes() }; CreateMarkersOperation op = new CreateMarkersOperation(types, attrs, new IFile[] { testFile1, testFile2, testFile3 }, "Create Multiple Markers Same Type Test"); execute(op); UpdateMarkersOperation updateOp = new UpdateMarkersOperation(op .getMarkers(), getUpdatedMarkerAttributes(), "Update and Merge Multiple Markers", true); execute(updateOp); testFile3.delete(true, getMonitor()); // Must compute status first because we don't perform expensive // validations in canUndo(). However we should remember the validity // once we've computed the status. updateOp.computeUndoableStatus(null); assertFalse("Undo should be invalid, marker no longer exists", updateOp .canUndo()); }
57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/3de75189b6b769855f0fc9efca2440b7173c759e/WorkspaceOperationsTests.java/buggy/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/operations/WorkspaceOperationsTests.java