no Jira, clarify msg, add utility getter for private field, add javadoc comment
@@ -254,7 +254,7 @@ public class Misc {
addPathToURLs(urls, pf);
} else {
// have a segment which does not denote a jar - skip it but note that
- UIMAFramework.getLogger().warn("Skipping adding \"{}\" to URLs", p);
+ UIMAFramework.getLogger().warn("Skipping adding \"{}\" to URLs because it is not a directory or a JAR", p);
}
}
@@ -552,6 +552,19 @@ public class Misc {
}
}
+ static public int getPrivateStaticIntFieldNoInherit(Class<?> clazz, String fieldName) {
+ try {
+ Field f = clazz.getDeclaredField(fieldName);
+ f.setAccessible(true);
+ return f.getInt(null);
+ } catch (NoSuchFieldException e) {
+ return Integer.MIN_VALUE;
+ } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
static public void addAll(Collection<String> c, String ... v) {
for (String s : v) {
c.add(s);
@@ -631,6 +644,12 @@ public class Misc {
return c;
}
+ /**
+ * Get item from array list. If index is > length, expande the array, and return null
+ * @param a the list
+ * @param i the index
+ * @return the item at the index or null
+ */
public static <T> T getWithExpand(List<T> a, int i) {
while (i >= a.size()) {
a.add(null);
