浏览代码

hack workaround for 48650

tags/Root_AspectJ5_Development
wisberg 19 年前
父节点
当前提交
8cc7315ade
共有 2 个文件被更改,包括 34 次插入14 次删除
  1. 13
    13
      util/src/org/aspectj/util/FileUtil.java
  2. 21
    1
      util/src/org/aspectj/util/LangUtil.java

+ 13
- 13
util/src/org/aspectj/util/FileUtil.java 查看文件

@@ -64,6 +64,11 @@ public class FileUtil {
&& file.getName().toLowerCase().endsWith(".class"))));
}
};
private static final boolean PERMIT_CVS;
static {
String name = FileUtil.class.getName() + ".PERMIT_CVS";
PERMIT_CVS = LangUtil.getBoolean(name, false);
}

/** @return true if file path has a zip/jar suffix */
public static boolean hasZipSuffix(File file) {
@@ -1216,24 +1221,19 @@ public class FileUtil {
return LangUtil.sleepUntil(++delayUntil);
}

// /** map name to result, removing any fromSuffix and adding any toSuffix */
// private static String map(String name, String fromSuffix, String toSuffix) {
// if (null != name) {
// if (null != fromSuffix) {
// name = name.substring(0, name.length()-fromSuffix.length());
// }
// if (null != toSuffix) {
// name = name + toSuffix;
// }
// }
// return name;
// }

private static void listFiles(final File baseDir, ArrayList result, FileFilter filter) {
File[] files = baseDir.listFiles();
// hack https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650
final boolean skipCVS = (! PERMIT_CVS && (filter == aspectjSourceFileFilter));
for (int i = 0; i < files.length; i++) {
File f = files[i];
if (f.isDirectory()) {
if (skipCVS) {
String name = f.getName().toLowerCase();
if ("cvs".equals(name) || "sccs".equals(name)) {
continue;
}
}
listFiles(f, result, filter);
} else {
if (filter.accept(f)) result.add(f);

+ 21
- 1
util/src/org/aspectj/util/LangUtil.java 查看文件

@@ -62,6 +62,7 @@ public class LangUtil {
map.put("1.2", "java.lang.ref.Reference");
map.put("1.3", "java.lang.reflect.Proxy");
map.put("1.4", "java.nio.Buffer");
map.put("1.5", "java.lang.annotation.Annotation");
VM_CLASSES = Collections.unmodifiableMap(map);
}
@@ -218,7 +219,26 @@ public class LangUtil {
}
return (String[]) result.toArray(new String[0]);
}

/**
* Get System property as boolean,
* but use default value where the system property is not set.
* @return true if value is set to true, false otherwise
*/
public static boolean getBoolean(String propertyName, boolean defaultValue) {
if (null != propertyName) {
try {
String value = System.getProperty(propertyName);
if (null != value) {
return Boolean.valueOf(value).booleanValue();
}
} catch (Throwable t) {
// default below
}
}
return defaultValue;
}

/**
* Splits <code>input</code>, removing delimiter and
* trimming any white space.

正在加载...
取消
保存