From fbef106efa9eb3b54279007c6b0fb74df4b1e91a Mon Sep 17 00:00:00 2001
From: rovo89
Date: Mon, 6 May 2013 22:51:30 +0200
Subject: [PATCH 01/90] Add a function to make SharedPreferences world-readable
---
src/de/robv/android/xposed/XSharedPreferences.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/de/robv/android/xposed/XSharedPreferences.java b/src/de/robv/android/xposed/XSharedPreferences.java
index aa80a411..b0508a0f 100644
--- a/src/de/robv/android/xposed/XSharedPreferences.java
+++ b/src/de/robv/android/xposed/XSharedPreferences.java
@@ -43,6 +43,13 @@ public XSharedPreferences(String packageName, String prefFileName) {
startLoadFromDisk();
}
+ public boolean makeWorldReadable() {
+ if (!mFile.exists()) // just in case - the file should never be created if it doesn'e exist
+ return false;
+
+ return mFile.setReadable(true, false);
+ }
+
private void startLoadFromDisk() {
synchronized (this) {
mLoaded = false;
From b411f285000f900f5b8fba9fa09ece5b7ab21a1d Mon Sep 17 00:00:00 2001
From: Fiouz
Date: Sat, 1 Jun 2013 12:08:09 +0200
Subject: [PATCH 02/90] Disable hooks if instrumentation is detected
Detect instrumentation at application binding.
New static flag in XposedBridge which acts as a "kill switch" for
user installed mods - that flag is enabled when instrumentation is
detected.
---
src/de/robv/android/xposed/XposedBridge.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/de/robv/android/xposed/XposedBridge.java b/src/de/robv/android/xposed/XposedBridge.java
index 9ced3d4f..80974355 100644
--- a/src/de/robv/android/xposed/XposedBridge.java
+++ b/src/de/robv/android/xposed/XposedBridge.java
@@ -33,6 +33,7 @@
import android.app.ActivityThread;
import android.app.AndroidAppHelper;
import android.app.LoadedApk;
+import android.content.ComponentName;
import android.content.pm.ApplicationInfo;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
@@ -57,6 +58,7 @@ public final class XposedBridge {
private static PrintWriter logWriter = null;
// log for initialization of a few mods is about 500 bytes, so 2*20 kB (2*~350 lines) should be enough
private static final int MAX_LOGFILE_SIZE = 20*1024;
+ private static boolean disableHooks = false;
private static final Object[] EMPTY_ARRAY = new Object[0];
public static final ClassLoader BOOTCLASSLOADER = ClassLoader.getSystemClassLoader();
@@ -125,6 +127,12 @@ private static void initXbridgeZygote() throws Exception {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
ActivityThread activityThread = (ActivityThread) param.thisObject;
ApplicationInfo appInfo = (ApplicationInfo) getObjectField(param.args[0], "appInfo");
+ ComponentName instrumentationName = (ComponentName) getObjectField(param.args[0], "instrumentationName");
+ if (instrumentationName != null) {
+ XposedBridge.log("Instrumentation detected, disabling framework for " + appInfo.packageName);
+ disableHooks = true;
+ return;
+ }
CompatibilityInfo compatInfo = (CompatibilityInfo) getObjectField(param.args[0], "compatInfo");
if (appInfo.sourceDir == null)
return;
@@ -403,6 +411,14 @@ public static Set hookAllConstructors(Class> hookClass,
*/
@SuppressWarnings("unchecked")
private static Object handleHookedMethod(Member method, Object thisObject, Object[] args) throws Throwable {
+ if (disableHooks) {
+ try {
+ return invokeOriginalMethod(method, thisObject, args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
TreeSet callbacks;
synchronized (hookedMethodCallbacks) {
callbacks = hookedMethodCallbacks.get(method);
From 70134b2d8e4e2ecdb4b1f9d4a496aa2268c69be3 Mon Sep 17 00:00:00 2001
From: rovo89
Date: Sat, 24 Aug 2013 20:18:59 +0200
Subject: [PATCH 03/90] don't trigger layout inflation callback if errors
occured
---
src/android/content/res/XResources.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/android/content/res/XResources.java b/src/android/content/res/XResources.java
index 9551ac81..b864a4b2 100644
--- a/src/android/content/res/XResources.java
+++ b/src/android/content/res/XResources.java
@@ -120,6 +120,9 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
findAndHookMethod(LayoutInflater.class, "inflate", XmlPullParser.class, ViewGroup.class, boolean.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
+ if (param.hasThrowable())
+ return;
+
XMLInstanceDetails details;
synchronized (xmlInstanceDetails) {
details = xmlInstanceDetails.get(param.args[0]);
From 5dbb3b3a289ebcdffdaa3989127cebc8ee740e63 Mon Sep 17 00:00:00 2001
From: rovo89
Date: Sat, 24 Aug 2013 20:21:10 +0200
Subject: [PATCH 04/90] fix double scaling in compatibility mode
---
src/android/content/res/XResources.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/android/content/res/XResources.java b/src/android/content/res/XResources.java
index b864a4b2..9660ba66 100644
--- a/src/android/content/res/XResources.java
+++ b/src/android/content/res/XResources.java
@@ -2,6 +2,7 @@
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import static de.robv.android.xposed.XposedHelpers.getObjectField;
+import static de.robv.android.xposed.XposedHelpers.setObjectField;
import java.io.File;
import java.util.HashMap;
@@ -45,7 +46,8 @@ public class XResources extends Resources {
public XResources(Resources parent, String resDir) {
super(parent.getAssets(), null, null, null);
this.resDir = resDir;
- updateConfiguration(parent.getConfiguration(), parent.getDisplayMetrics(), parent.getCompatibilityInfo());
+ updateConfiguration(parent.getConfiguration(), parent.getDisplayMetrics());
+ setObjectField(this, "mCompatibilityInfo", getObjectField(parent, "mCompatibilityInfo"));
}
/** Framework only, don't call this from your module! */
From e62fa7f78189ec14dce814c3cd456cdef7dd3ad6 Mon Sep 17 00:00:00 2001
From: rovo89
Date: Sat, 24 Aug 2013 20:29:43 +0200
Subject: [PATCH 05/90] fix replacing colors that are used as drawables
---
src/android/content/res/XResources.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/android/content/res/XResources.java b/src/android/content/res/XResources.java
index 9660ba66..f2d8cba8 100644
--- a/src/android/content/res/XResources.java
+++ b/src/android/content/res/XResources.java
@@ -12,6 +12,7 @@
import org.xmlpull.v1.XmlPullParser;
import android.graphics.Movie;
+import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.SparseArray;
import android.util.TypedValue;
@@ -349,6 +350,8 @@ public Drawable getDrawable(int id) throws NotFoundException {
if (result != null)
return result;
} catch (Throwable t) { XposedBridge.log(t); }
+ } else if (replacement instanceof Integer) {
+ return new ColorDrawable((Integer) replacement);
} else if (replacement instanceof XResForwarder) {
Resources repRes = ((XResForwarder) replacement).getResources();
int repId = ((XResForwarder) replacement).getId();
@@ -366,6 +369,8 @@ public Drawable getDrawableForDensity(int id, int density) throws NotFoundExcept
if (result != null)
return result;
} catch (Throwable t) { XposedBridge.log(t); }
+ } else if (replacement instanceof Integer) {
+ return new ColorDrawable((Integer) replacement);
} else if (replacement instanceof XResForwarder) {
Resources repRes = ((XResForwarder) replacement).getResources();
int repId = ((XResForwarder) replacement).getId();
@@ -735,6 +740,8 @@ public Drawable getDrawable(int index) {
if (result != null)
return result;
} catch (Throwable t) { XposedBridge.log(t); }
+ } else if (replacement instanceof Integer) {
+ return new ColorDrawable((Integer) replacement);
} else if (replacement instanceof XResForwarder) {
Resources repRes = ((XResForwarder) replacement).getResources();
int repId = ((XResForwarder) replacement).getId();
From 096e6b7e8050771d76c0864e1fccdcbe9ef516a9 Mon Sep 17 00:00:00 2001
From: rovo89
Date: Sat, 24 Aug 2013 20:57:29 +0200
Subject: [PATCH 06/90] callMethod() helper now also works for inherited
methods
Previously it didn't work for methods from the superclass that weren't
overridden (and thus not present in getDeclaredMethods()). Now
findMethodBestMatch() also checks getMethods(), so it should behave like
a normal compiler/VM.
Don't use findMethodBestMatch() for hooking methods unless you like
surprises!
---
src/de/robv/android/xposed/XposedHelpers.java | 26 ++++++++++---------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/de/robv/android/xposed/XposedHelpers.java b/src/de/robv/android/xposed/XposedHelpers.java
index 1696feca..11b8cc10 100644
--- a/src/de/robv/android/xposed/XposedHelpers.java
+++ b/src/de/robv/android/xposed/XposedHelpers.java
@@ -214,18 +214,20 @@ public static Method findMethodBestMatch(Class> clazz, String methodName, Clas
} catch (NoSuchMethodError ignored) {}
Method bestMatch = null;
- Method[] methods = clazz.getDeclaredMethods();
- for (Method method : methods) {
- // compare name and parameters
- if (method.getName().equals(methodName) && ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) {
- // get accessible version of method
- if (bestMatch == null || MemberUtils.compareParameterTypes(
- method.getParameterTypes(),
- bestMatch.getParameterTypes(),
- parameterTypes) < 0) {
- bestMatch = method;
- }
- }
+ for (int i = 0; i < 2; i++) {
+ Method[] methods = (i == 0) ? clazz.getDeclaredMethods() : clazz.getMethods();
+ for (Method method : methods) {
+ // compare name and parameters
+ if (method.getName().equals(methodName) && ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) {
+ // get accessible version of method
+ if (bestMatch == null || MemberUtils.compareParameterTypes(
+ method.getParameterTypes(),
+ bestMatch.getParameterTypes(),
+ parameterTypes) < 0) {
+ bestMatch = method;
+ }
+ }
+ }
}
if (bestMatch != null) {
From 5384966637c695a1172f004bc5cdd1fb45604ba9 Mon Sep 17 00:00:00 2001
From: Francisco Ferreira
Date: Sat, 15 Jun 2013 21:34:39 +0200
Subject: [PATCH 07/90] returnConstant() with priority wasn't using it
---
src/de/robv/android/xposed/XC_MethodReplacement.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/de/robv/android/xposed/XC_MethodReplacement.java b/src/de/robv/android/xposed/XC_MethodReplacement.java
index 23219b44..ffaa5bb9 100644
--- a/src/de/robv/android/xposed/XC_MethodReplacement.java
+++ b/src/de/robv/android/xposed/XC_MethodReplacement.java
@@ -45,7 +45,7 @@ public static XC_MethodReplacement returnConstant(final Object result) {
* @see #returnConstant(Object)
*/
public static XC_MethodReplacement returnConstant(int priority, final Object result) {
- return new XC_MethodReplacement() {
+ return new XC_MethodReplacement(priority) {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
return result;
From 81354531bf556398607e989048f29461109f1390 Mon Sep 17 00:00:00 2001
From: rovo89
Date: Sun, 25 Aug 2013 11:29:50 +0200
Subject: [PATCH 08/90] declare license
---
NOTICE.txt | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 NOTICE.txt
diff --git a/NOTICE.txt b/NOTICE.txt
new file mode 100644
index 00000000..d1fc673f
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,25 @@
+LICENSE FOR THE MAIN PRODUCT
+============================
+
+Copyright 2013 rovo89, Tungstwenty
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+
+INCLUDED LIBRARIES
+==================
+
+This product includes slightly modified code of the "Apache Commons Lang"
+library. See lib/apache-commons-lang/NOTICE.txt for licensing details.
+
From d54bbaba33121b15f2ace2189893e641d576c453 Mon Sep 17 00:00:00 2001
From: rovo89
Date: Sun, 25 Aug 2013 11:30:15 +0200
Subject: [PATCH 09/90] Bump version to 30
Why moving from 2.1.4 to 30?
Version numbers can be anything. Using the x.y.z format is a tradional way
of indicating the amount and importance of changes between two versions to
end-users. However, Xposed is more than XposedBridge, there is also the
native binary and the installer. The state of this set of components is
better shown by the version number of the installer, which is displayed in
the "About" screen. That currently makes two very similar x.y.z versions
which can easily be confusing.
Apart from the one mentioned above, there is no big advantage of writing
the version as x.y.z. On the contrary, simple integers are much easier to
compare - and that's what this version number is mainly used for. Checking
whether the latest JAR is installed and checking "xposedminversion" of
modules. And the best thing: Both formats are compatible with the current
version comparison implementation. 30 is like 30.0.0, which is clearly
bigger than 2.1.4. And 2.1.4 can be seen as 2, which is lower than 30.
The lowest possible number would have been 3, but as this seems too small
and wouldn't reflect the many iterations XposedBridge already went
through. Therefore, it's 30 now.
---
assets/VERSION | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/assets/VERSION b/assets/VERSION
index c346e7a0..64bb6b74 100644
--- a/assets/VERSION
+++ b/assets/VERSION
@@ -1 +1 @@
-2.1.4
\ No newline at end of file
+30
From ed9277291368e420d91a2304f34ba436ea5de8e9 Mon Sep 17 00:00:00 2001
From: rovo89
Date: Sun, 25 Aug 2013 12:35:33 +0200
Subject: [PATCH 10/90] make sure to include NOTICE.txt in the compiled file
---
.classpath | 6 ++++--
NOTICE.txt | 14 ++++++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/.classpath b/.classpath
index 4683f9b8..5861e979 100644
--- a/.classpath
+++ b/.classpath
@@ -2,13 +2,15 @@
-
+
-
+
+
+
diff --git a/NOTICE.txt b/NOTICE.txt
index d1fc673f..a50b1337 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -21,5 +21,15 @@ INCLUDED LIBRARIES
==================
This product includes slightly modified code of the "Apache Commons Lang"
-library. See lib/apache-commons-lang/NOTICE.txt for licensing details.
-
+library. See lib/apache-commons-lang for details.
+Here is a copy of the NOTICE.txt from that directory:
+-------------------------------------------------------------------------
+Apache Commons Lang
+Copyright 2001-2011 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software from the Spring Framework,
+under the Apache License 2.0 (see: StringUtils.containsWhitespace())
+-------------------------------------------------------------------------
From d1325efd220e8d3acae90e5d897ef15d25890c1f Mon Sep 17 00:00:00 2001
From: rovo89
Date: Sun, 25 Aug 2013 20:21:55 +0200
Subject: [PATCH 11/90] fix build
---
.classpath | 1 -
.project | 5 +++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/.classpath b/.classpath
index 5861e979..ca30b19f 100644
--- a/.classpath
+++ b/.classpath
@@ -11,6 +11,5 @@
-
diff --git a/.project b/.project
index 8b30bd11..3f966ddc 100644
--- a/.project
+++ b/.project
@@ -36,5 +36,10 @@
2ANDROID_SDK/sources/android-15
+
+ src/NOTICE.txt
+ 1
+ PROJECT_LOC/NOTICE.txt
+
From 9f3508d7ccf59f6037e28a3a18b432b4d886e105 Mon Sep 17 00:00:00 2001
From: rovo89
Date: Sun, 15 Sep 2013 09:21:45 +0200
Subject: [PATCH 12/90] v31: Get rid of /data/xposed
---
assets/VERSION | 2 +-
install.bat | 4 ++--
src/de/robv/android/xposed/XposedBridge.java | 18 ++++++++++--------
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/assets/VERSION b/assets/VERSION
index 64bb6b74..e85087af 100644
--- a/assets/VERSION
+++ b/assets/VERSION
@@ -1 +1 @@
-30
+31
diff --git a/install.bat b/install.bat
index f00dfe7d..4670717c 100644
--- a/install.bat
+++ b/install.bat
@@ -1,4 +1,4 @@
cd /d %~dp0
dir bin\XposedBridge.apk
-adb push bin\XposedBridge.apk /data/xposed/XposedBridge.jar.newversion
-pause
\ No newline at end of file
+adb push bin\XposedBridge.apk /data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar.newversion
+pause
diff --git a/src/de/robv/android/xposed/XposedBridge.java b/src/de/robv/android/xposed/XposedBridge.java
index 80974355..fb26fbc6 100644
--- a/src/de/robv/android/xposed/XposedBridge.java
+++ b/src/de/robv/android/xposed/XposedBridge.java
@@ -30,6 +30,7 @@
import java.util.Set;
import java.util.TreeSet;
+import android.annotation.SuppressLint;
import android.app.ActivityThread;
import android.app.AndroidAppHelper;
import android.app.LoadedApk;
@@ -59,10 +60,12 @@ public final class XposedBridge {
// log for initialization of a few mods is about 500 bytes, so 2*20 kB (2*~350 lines) should be enough
private static final int MAX_LOGFILE_SIZE = 20*1024;
private static boolean disableHooks = false;
-
+
private static final Object[] EMPTY_ARRAY = new Object[0];
public static final ClassLoader BOOTCLASSLOADER = ClassLoader.getSystemClassLoader();
-
+ @SuppressLint("SdCardPath")
+ public static final String BASE_DIR = "/data/data/de.robv.android.xposed.installer/";
+
// built-in handlers
private static final Map> hookedMethodCallbacks
= new HashMap>();
@@ -80,9 +83,9 @@ private static void main(String[] args) {
try {
// initialize log file
try {
- File logFile = new File("/data/xposed/debug.log");
+ File logFile = new File(BASE_DIR + "log/debug.log");
if (startClassName == null && logFile.length() > MAX_LOGFILE_SIZE)
- logFile.renameTo(new File("/data/xposed/debug.log.old"));
+ logFile.renameTo(new File(BASE_DIR + "log/debug.log.old"));
logWriter = new PrintWriter(new FileWriter(logFile, true));
logFile.setReadable(true, false);
logFile.setWritable(true, false);
@@ -233,10 +236,10 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
/**
- * Try to load all modules defined in /data/xposed/modules.list
+ * Try to load all modules defined in BASE_DIR/conf/modules.list
*/
private static void loadModules(String startClassName) throws IOException {
- BufferedReader apks = new BufferedReader(new FileReader("/data/xposed/modules.list"));
+ BufferedReader apks = new BufferedReader(new FileReader(BASE_DIR + "conf/modules.list"));
String apk;
while ((apk = apks.readLine()) != null) {
loadModule(apk, startClassName);
@@ -247,7 +250,6 @@ private static void loadModules(String startClassName) throws IOException {
/**
* Load a module from an APK by calling the init(String) method for all classes defined
* in assets/xposed_init.
- * @see MethodSignatureGuide#init
*/
private static void loadModule(String apk, String startClassName) {
log("Loading modules from " + apk);
@@ -317,7 +319,7 @@ private static void loadModule(String apk, String startClassName) {
}
/**
- * Writes a message to /data/xposed/debug.log (needs to have chmod 777)
+ * Writes a message to BASE_DIR/log/debug.log (needs to have chmod 777)
* @param text log message
*/
public synchronized static void log(String text) {
From 3926fa79b802ac6d0a68dff022e25e9202664e5f Mon Sep 17 00:00:00 2001
From: rovo89
Date: Mon, 30 Sep 2013 23:52:12 +0200
Subject: [PATCH 13/90] v32: Removed unused classes from the Commons Lang Lib
The resulting XposedBridge.jar is then 91 kB instead of 186 kB.
---
assets/VERSION | 2 +-
lib/apache-commons-lang/MODIFICATIONS.txt | 40 +-
.../apache/commons/lang3/AnnotationUtils.java | 371 ---
.../org/apache/commons/lang3/BitField.java | 283 --
.../apache/commons/lang3/BooleanUtils.java | 1082 -------
.../apache/commons/lang3/CharEncoding.java | 105 -
.../org/apache/commons/lang3/CharRange.java | 356 --
.../org/apache/commons/lang3/CharSet.java | 278 --
.../apache/commons/lang3/CharSetUtils.java | 217 --
.../org/apache/commons/lang3/EnumUtils.java | 208 --
.../org/apache/commons/lang3/LocaleUtils.java | 297 --
.../commons/lang3/RandomStringUtils.java | 322 --
.../org/apache/commons/lang3/Range.java | 493 ---
.../commons/lang3/SerializationException.java | 78 -
.../commons/lang3/SerializationUtils.java | 271 --
.../commons/lang3/StringEscapeUtils.java | 585 ----
.../lang3/builder/StandardToStringStyle.java | 560 ----
.../lang3/concurrent/AtomicInitializer.java | 106 -
.../concurrent/AtomicSafeInitializer.java | 96 -
.../concurrent/BackgroundInitializer.java | 333 --
.../lang3/concurrent/BasicThreadFactory.java | 381 ---
.../CallableBackgroundInitializer.java | 126 -
.../lang3/concurrent/ConcurrentException.java | 70 -
.../concurrent/ConcurrentInitializer.java | 54 -
.../ConcurrentRuntimeException.java | 72 -
.../lang3/concurrent/ConcurrentUtils.java | 386 ---
.../lang3/concurrent/ConstantInitializer.java | 128 -
.../lang3/concurrent/LazyInitializer.java | 119 -
.../MultiBackgroundInitializer.java | 352 --
.../lang3/concurrent/TimedSemaphore.java | 421 ---
.../commons/lang3/concurrent/package.html | 23 -
.../lang3/event/EventListenerSupport.java | 316 --
.../commons/lang3/event/EventUtils.java | 130 -
.../apache/commons/lang3/event/package.html | 22 -
.../lang3/exception/ContextedException.java | 246 --
.../exception/ContextedRuntimeException.java | 247 --
.../exception/DefaultExceptionContext.java | 159 -
.../lang3/exception/ExceptionContext.java | 103 -
.../lang3/exception/ExceptionUtils.java | 697 ----
.../apache/commons/lang3/math/Fraction.java | 959 ------
.../commons/lang3/math/IEEE754rUtils.java | 265 --
.../commons/lang3/math/NumberUtils.java | 1414 --------
.../apache/commons/lang3/math/package.html | 25 -
.../commons/lang3/mutable/MutableBoolean.java | 193 --
.../commons/lang3/mutable/MutableByte.java | 283 --
.../commons/lang3/mutable/MutableDouble.java | 312 --
.../commons/lang3/mutable/MutableFloat.java | 313 --
.../commons/lang3/mutable/MutableLong.java | 273 --
.../commons/lang3/mutable/MutableObject.java | 126 -
.../commons/lang3/mutable/MutableShort.java | 283 --
.../lang3/reflect/ConstructorUtils.java | 289 --
.../commons/lang3/reflect/FieldUtils.java | 595 ----
.../commons/lang3/reflect/TypeUtils.java | 1088 -------
.../commons/lang3/text/CompositeFormat.java | 116 -
.../lang3/text/ExtendedMessageFormat.java | 535 ----
.../commons/lang3/text/FormatFactory.java | 42 -
.../commons/lang3/text/FormattableUtils.java | 151 -
.../apache/commons/lang3/text/StrBuilder.java | 2849 -----------------
.../apache/commons/lang3/text/StrLookup.java | 172 -
.../apache/commons/lang3/text/StrMatcher.java | 436 ---
.../commons/lang3/text/StrSubstitutor.java | 926 ------
.../commons/lang3/text/StrTokenizer.java | 1104 -------
.../apache/commons/lang3/text/WordUtils.java | 497 ---
.../apache/commons/lang3/text/package.html | 26 -
.../text/translate/AggregateTranslator.java | 60 -
.../translate/CharSequenceTranslator.java | 125 -
.../text/translate/CodePointTranslator.java | 56 -
.../lang3/text/translate/EntityArrays.java | 425 ---
.../text/translate/LookupTranslator.java | 80 -
.../text/translate/NumericEntityEscaper.java | 119 -
.../translate/NumericEntityUnescaper.java | 139 -
.../lang3/text/translate/OctalUnescaper.java | 60 -
.../lang3/text/translate/UnicodeEscaper.java | 130 -
.../text/translate/UnicodeUnescaper.java | 66 -
.../commons/lang3/text/translate/package.html | 27 -
.../commons/lang3/time/DateFormatUtils.java | 320 --
.../apache/commons/lang3/time/DateUtils.java | 1831 -----------
.../lang3/time/DurationFormatUtils.java | 662 ----
.../commons/lang3/time/FastDateFormat.java | 1519 ---------
.../commons/lang3/time/FormatCache.java | 202 --
.../apache/commons/lang3/time/StopWatch.java | 382 ---
.../apache/commons/lang3/time/package.html | 23 -
.../commons/lang3/tuple/MutablePair.java | 123 -
83 files changed, 40 insertions(+), 29716 deletions(-)
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/AnnotationUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/BitField.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/BooleanUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/CharEncoding.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/CharRange.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/CharSet.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/CharSetUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/EnumUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/LocaleUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/RandomStringUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/Range.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/SerializationException.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/SerializationUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/StringEscapeUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/builder/StandardToStringStyle.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/AtomicInitializer.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/CallableBackgroundInitializer.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentException.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentInitializer.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConstantInitializer.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/LazyInitializer.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/TimedSemaphore.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/package.html
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/event/EventListenerSupport.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/event/EventUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/event/package.html
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/exception/ContextedException.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/exception/ContextedRuntimeException.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/exception/DefaultExceptionContext.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/exception/ExceptionContext.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/exception/ExceptionUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/math/Fraction.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/math/IEEE754rUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/math/NumberUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/math/package.html
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/mutable/MutableBoolean.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/mutable/MutableByte.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/mutable/MutableDouble.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/mutable/MutableFloat.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/mutable/MutableLong.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/mutable/MutableObject.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/mutable/MutableShort.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/reflect/ConstructorUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/reflect/FieldUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/reflect/TypeUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/CompositeFormat.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/ExtendedMessageFormat.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/FormatFactory.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/FormattableUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/StrBuilder.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/StrLookup.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/StrMatcher.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/StrSubstitutor.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/StrTokenizer.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/WordUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/package.html
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/AggregateTranslator.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/CodePointTranslator.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/EntityArrays.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/LookupTranslator.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/OctalUnescaper.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/UnicodeEscaper.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/UnicodeUnescaper.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/text/translate/package.html
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/time/DateFormatUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/time/DateUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/time/DurationFormatUtils.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/time/FastDateFormat.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/time/FormatCache.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/time/StopWatch.java
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/time/package.html
delete mode 100644 lib/apache-commons-lang/external/org/apache/commons/lang3/tuple/MutablePair.java
diff --git a/assets/VERSION b/assets/VERSION
index e85087af..f5c89552 100644
--- a/assets/VERSION
+++ b/assets/VERSION
@@ -1 +1 @@
-31
+32
diff --git a/lib/apache-commons-lang/MODIFICATIONS.txt b/lib/apache-commons-lang/MODIFICATIONS.txt
index 3ac474de..d6f4e370 100644
--- a/lib/apache-commons-lang/MODIFICATIONS.txt
+++ b/lib/apache-commons-lang/MODIFICATIONS.txt
@@ -3,4 +3,42 @@ as downloaded from http://commons.apache.org/lang/download_lang.cgi, except for
these modifications:
- Class MemberUtils changed to public
- Method compareParameterTypes in MemberUtils changed to public
-- Prefix "external." for packages to avoid conflicts with other apps
\ No newline at end of file
+- Prefix "external." for packages to avoid conflicts with other apps
+- Removed unused sub-packages for smaller file size:
+concurrent/
+event/
+math/
+text/
+time/
+- Removed unused classes for smaller file size:
+AnnotationUtils.java
+BitField.java
+BooleanUtils.java
+CharEncoding.java
+CharRange.java
+CharSet.java
+CharSetUtils.java
+EnumUtils.java
+LocaleUtils.java
+RandomStringUtils.java
+Range.java
+SerializationException.java
+SerializationUtils.java
+StringEscapeUtils.java
+builder/StandardToStringStyle.java
+exception/ContextedException.java
+exception/ContextedRuntimeException.java
+exception/DefaultExceptionContext.java
+exception/ExceptionContext.java
+exception/ExceptionUtils.java
+mutable/MutableBoolean.java
+mutable/MutableByte.java
+mutable/MutableDouble.java
+mutable/MutableFloat.java
+mutable/MutableLong.java
+mutable/MutableObject.java
+mutable/MutableShort.java
+reflect/ConstructorUtils.java
+reflect/FieldUtils.java
+reflect/TypeUtils.java
+tuple/MutablePair.java
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/AnnotationUtils.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/AnnotationUtils.java
deleted file mode 100644
index 57fa3922..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/AnnotationUtils.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-
-import external.org.apache.commons.lang3.builder.ToStringBuilder;
-import external.org.apache.commons.lang3.builder.ToStringStyle;
-
-/**
- *
Helper methods for working with {@link Annotation} instances.
- *
- *
This class contains various utility methods that make working with
- * annotations simpler.
- *
- *
{@link Annotation} instances are always proxy objects; unfortunately
- * dynamic proxies cannot be depended upon to know how to implement certain
- * methods in the same manner as would be done by "natural" {@link Annotation}s.
- * The methods presented in this class can be used to avoid that possibility. It
- * is of course also possible for dynamic proxies to actually delegate their
- * e.g. {@link Annotation#equals(Object)}/{@link Annotation#hashCode()}/
- * {@link Annotation#toString()} implementations to {@link AnnotationUtils}.
- *
- *
#ThreadSafe#
- *
- * @since 3.0
- * @version $Id: AnnotationUtils.java 1083850 2011-03-21 15:59:10Z mbenson $
- */
-public class AnnotationUtils {
-
- /**
- * A style that prints annotations as recommended.
- */
- private static final ToStringStyle TO_STRING_STYLE = new ToStringStyle() {
- /** Serialization version */
- private static final long serialVersionUID = 1L;
-
- {
- setDefaultFullDetail(true);
- setArrayContentDetail(true);
- setUseClassName(true);
- setUseShortClassName(true);
- setUseIdentityHashCode(false);
- setContentStart("(");
- setContentEnd(")");
- setFieldSeparator(", ");
- setArrayStart("[");
- setArrayEnd("]");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getShortClassName(java.lang.Class> cls) {
- Class extends Annotation> annotationType = null;
- for (Class> iface : ClassUtils.getAllInterfaces(cls)) {
- if (Annotation.class.isAssignableFrom(iface)) {
- @SuppressWarnings("unchecked")
- //because we just checked the assignability
- Class extends Annotation> found = (Class extends Annotation>) iface;
- annotationType = found;
- break;
- }
- }
- return new StringBuilder(annotationType == null ? "" : annotationType.getName())
- .insert(0, '@').toString();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void appendDetail(StringBuffer buffer, String fieldName, Object value) {
- if (value instanceof Annotation) {
- value = AnnotationUtils.toString((Annotation) value);
- }
- super.appendDetail(buffer, fieldName, value);
- }
-
- };
-
- /**
- *
{@code AnnotationUtils} instances should NOT be constructed in
- * standard programming. Instead, the class should be used statically.
- *
- *
This constructor is public to permit tools that require a JavaBean
- * instance to operate.
Checks if two annotations are equal using the criteria for equality
- * presented in the {@link Annotation#equals(Object)} API docs.
- *
- * @param a1 the first Annotation to compare, {@code null} returns
- * {@code false} unless both are {@code null}
- * @param a2 the second Annotation to compare, {@code null} returns
- * {@code false} unless both are {@code null}
- * @return {@code true} if the two annotations are {@code equal} or both
- * {@code null}
- */
- public static boolean equals(Annotation a1, Annotation a2) {
- if (a1 == a2) {
- return true;
- }
- if (a1 == null || a2 == null) {
- return false;
- }
- Class extends Annotation> type = a1.annotationType();
- Class extends Annotation> type2 = a2.annotationType();
- Validate.notNull(type, "Annotation %s with null annotationType()", a1);
- Validate.notNull(type2, "Annotation %s with null annotationType()", a2);
- if (!type.equals(type2)) {
- return false;
- }
- try {
- for (Method m : type.getDeclaredMethods()) {
- if (m.getParameterTypes().length == 0
- && isValidAnnotationMemberType(m.getReturnType())) {
- Object v1 = m.invoke(a1);
- Object v2 = m.invoke(a2);
- if (!memberEquals(m.getReturnType(), v1, v2)) {
- return false;
- }
- }
- }
- } catch (IllegalAccessException ex) {
- return false;
- } catch (InvocationTargetException ex) {
- return false;
- }
- return true;
- }
-
- /**
- *
Generate a hash code for the given annotation using the algorithm
- * presented in the {@link Annotation#hashCode()} API docs.
- *
- * @param a the Annotation for a hash code calculation is desired, not
- * {@code null}
- * @return the calculated hash code
- * @throws RuntimeException if an {@code Exception} is encountered during
- * annotation member access
- * @throws IllegalStateException if an annotation method invocation returns
- * {@code null}
- */
- public static int hashCode(Annotation a) {
- int result = 0;
- Class extends Annotation> type = a.annotationType();
- for (Method m : type.getDeclaredMethods()) {
- try {
- Object value = m.invoke(a);
- if (value == null) {
- throw new IllegalStateException(
- String.format("Annotation method %s returned null", m));
- }
- result += hashMember(m.getName(), value);
- } catch (RuntimeException ex) {
- throw ex;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
- return result;
- }
-
- /**
- *
Generate a string representation of an Annotation, as suggested by
- * {@link Annotation#toString()}.
- *
- * @param a the annotation of which a string representation is desired
- * @return the standard string representation of an annotation, not
- * {@code null}
- */
- public static String toString(final Annotation a) {
- ToStringBuilder builder = new ToStringBuilder(a, TO_STRING_STYLE);
- for (Method m : a.annotationType().getDeclaredMethods()) {
- if (m.getParameterTypes().length > 0) {
- continue; //wtf?
- }
- try {
- builder.append(m.getName(), m.invoke(a));
- } catch (RuntimeException ex) {
- throw ex;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
- return builder.build();
- }
-
- /**
- *
Checks if the specified type is permitted as an annotation member.
- *
- *
The Java language specification only permits certain types to be used
- * in annotations. These include {@link String}, {@link Class}, primitive
- * types, {@link Annotation}, {@link Enum}, and single-dimensional arrays of
- * these types.
- *
- * @param type the type to check, {@code null}
- * @return {@code true} if the type is a valid type to use in an annotation
- */
- public static boolean isValidAnnotationMemberType(Class> type) {
- if (type == null) {
- return false;
- }
- if (type.isArray()) {
- type = type.getComponentType();
- }
- return type.isPrimitive() || type.isEnum() || type.isAnnotation()
- || String.class.equals(type) || Class.class.equals(type);
- }
-
- //besides modularity, this has the advantage of autoboxing primitives:
- /**
- * Helper method for generating a hash code for a member of an annotation.
- *
- * @param name the name of the member
- * @param value the value of the member
- * @return a hash code for this member
- */
- private static int hashMember(String name, Object value) {
- int part1 = name.hashCode() * 127;
- if (value.getClass().isArray()) {
- return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
- }
- if (value instanceof Annotation) {
- return part1 ^ hashCode((Annotation) value);
- }
- return part1 ^ value.hashCode();
- }
-
- /**
- * Helper method for checking whether two objects of the given type are
- * equal. This method is used to compare the parameters of two annotation
- * instances.
- *
- * @param type the type of the objects to be compared
- * @param o1 the first object
- * @param o2 the second object
- * @return a flag whether these objects are equal
- */
- private static boolean memberEquals(Class> type, Object o1, Object o2) {
- if (o1 == o2) {
- return true;
- }
- if (o1 == null || o2 == null) {
- return false;
- }
- if (type.isArray()) {
- return arrayMemberEquals(type.getComponentType(), o1, o2);
- }
- if (type.isAnnotation()) {
- return equals((Annotation) o1, (Annotation) o2);
- }
- return o1.equals(o2);
- }
-
- /**
- * Helper method for comparing two objects of an array type.
- *
- * @param componentType the component type of the array
- * @param o1 the first object
- * @param o2 the second object
- * @return a flag whether these objects are equal
- */
- private static boolean arrayMemberEquals(Class> componentType, Object o1, Object o2) {
- if (componentType.isAnnotation()) {
- return annotationArrayMemberEquals((Annotation[]) o1, (Annotation[]) o2);
- }
- if (componentType.equals(Byte.TYPE)) {
- return Arrays.equals((byte[]) o1, (byte[]) o2);
- }
- if (componentType.equals(Short.TYPE)) {
- return Arrays.equals((short[]) o1, (short[]) o2);
- }
- if (componentType.equals(Integer.TYPE)) {
- return Arrays.equals((int[]) o1, (int[]) o2);
- }
- if (componentType.equals(Character.TYPE)) {
- return Arrays.equals((char[]) o1, (char[]) o2);
- }
- if (componentType.equals(Long.TYPE)) {
- return Arrays.equals((long[]) o1, (long[]) o2);
- }
- if (componentType.equals(Float.TYPE)) {
- return Arrays.equals((float[]) o1, (float[]) o2);
- }
- if (componentType.equals(Double.TYPE)) {
- return Arrays.equals((double[]) o1, (double[]) o2);
- }
- if (componentType.equals(Boolean.TYPE)) {
- return Arrays.equals((boolean[]) o1, (boolean[]) o2);
- }
- return Arrays.equals((Object[]) o1, (Object[]) o2);
- }
-
- /**
- * Helper method for comparing two arrays of annotations.
- *
- * @param a1 the first array
- * @param a2 the second array
- * @return a flag whether these arrays are equal
- */
- private static boolean annotationArrayMemberEquals(Annotation[] a1, Annotation[] a2) {
- if (a1.length != a2.length) {
- return false;
- }
- for (int i = 0; i < a1.length; i++) {
- if (!equals(a1[i], a2[i])) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Helper method for generating a hash code for an array.
- *
- * @param componentType the component type of the array
- * @param o the array
- * @return a hash code for the specified array
- */
- private static int arrayMemberHash(Class> componentType, Object o) {
- if (componentType.equals(Byte.TYPE)) {
- return Arrays.hashCode((byte[]) o);
- }
- if (componentType.equals(Short.TYPE)) {
- return Arrays.hashCode((short[]) o);
- }
- if (componentType.equals(Integer.TYPE)) {
- return Arrays.hashCode((int[]) o);
- }
- if (componentType.equals(Character.TYPE)) {
- return Arrays.hashCode((char[]) o);
- }
- if (componentType.equals(Long.TYPE)) {
- return Arrays.hashCode((long[]) o);
- }
- if (componentType.equals(Float.TYPE)) {
- return Arrays.hashCode((float[]) o);
- }
- if (componentType.equals(Double.TYPE)) {
- return Arrays.hashCode((double[]) o);
- }
- if (componentType.equals(Boolean.TYPE)) {
- return Arrays.hashCode((boolean[]) o);
- }
- return Arrays.hashCode((Object[]) o);
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/BitField.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/BitField.java
deleted file mode 100644
index 1ba2153d..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/BitField.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-/**
- *
Operations on bit-mapped fields.
- *
- * @since 2.0
- * @version $Id: BitField.java 1088899 2011-04-05 05:31:27Z bayard $
- */
-public class BitField {
-
- private final int _mask;
- private final int _shift_count;
-
- /**
- *
Creates a BitField instance.
- *
- * @param mask the mask specifying which bits apply to this
- * BitField. Bits that are set in this mask are the bits
- * that this BitField operates on
- */
- public BitField(int mask) {
- _mask = mask;
- int count = 0;
- int bit_pattern = mask;
-
- if (bit_pattern != 0) {
- while ((bit_pattern & 1) == 0) {
- count++;
- bit_pattern >>= 1;
- }
- }
- _shift_count = count;
- }
-
- /**
- *
Obtains the value for the specified BitField, appropriately
- * shifted right.
- *
- *
Many users of a BitField will want to treat the specified
- * bits as an int value, and will not want to be aware that the
- * value is stored as a BitField (and so shifted left so many
- * bits).
- *
- * @see #setValue(int,int)
- * @param holder the int data containing the bits we're interested
- * in
- * @return the selected bits, shifted right appropriately
- */
- public int getValue(int holder) {
- return getRawValue(holder) >> _shift_count;
- }
-
- /**
- *
Obtains the value for the specified BitField, appropriately
- * shifted right, as a short.
- *
- *
Many users of a BitField will want to treat the specified
- * bits as an int value, and will not want to be aware that the
- * value is stored as a BitField (and so shifted left so many
- * bits).
- *
- * @see #setShortValue(short,short)
- * @param holder the short data containing the bits we're
- * interested in
- * @return the selected bits, shifted right appropriately
- */
- public short getShortValue(short holder) {
- return (short) getValue(holder);
- }
-
- /**
- *
Obtains the value for the specified BitField, unshifted.
- *
- * @param holder the int data containing the bits we're
- * interested in
- * @return the selected bits
- */
- public int getRawValue(int holder) {
- return holder & _mask;
- }
-
- /**
- *
Obtains the value for the specified BitField, unshifted.
- *
- * @param holder the short data containing the bits we're
- * interested in
- * @return the selected bits
- */
- public short getShortRawValue(short holder) {
- return (short) getRawValue(holder);
- }
-
- /**
- *
Returns whether the field is set or not.
- *
- *
This is most commonly used for a single-bit field, which is
- * often used to represent a boolean value; the results of using
- * it for a multi-bit field is to determine whether *any* of its
- * bits are set.
- *
- * @param holder the int data containing the bits we're interested
- * in
- * @return {@code true} if any of the bits are set,
- * else {@code false}
- */
- public boolean isSet(int holder) {
- return (holder & _mask) != 0;
- }
-
- /**
- *
Returns whether all of the bits are set or not.
- *
- *
This is a stricter test than {@link #isSet(int)},
- * in that all of the bits in a multi-bit set must be set
- * for this method to return {@code true}.
- *
- * @param holder the int data containing the bits we're
- * interested in
- * @return {@code true} if all of the bits are set,
- * else {@code false}
- */
- public boolean isAllSet(int holder) {
- return (holder & _mask) == _mask;
- }
-
- /**
- *
Replaces the bits with new values.
- *
- * @see #getValue(int)
- * @param holder the int data containing the bits we're
- * interested in
- * @param value the new value for the specified bits
- * @return the value of holder with the bits from the value
- * parameter replacing the old bits
- */
- public int setValue(int holder, int value) {
- return (holder & ~_mask) | ((value << _shift_count) & _mask);
- }
-
- /**
- *
Replaces the bits with new values.
- *
- * @see #getShortValue(short)
- * @param holder the short data containing the bits we're
- * interested in
- * @param value the new value for the specified bits
- * @return the value of holder with the bits from the value
- * parameter replacing the old bits
- */
- public short setShortValue(short holder, short value) {
- return (short) setValue(holder, value);
- }
-
- /**
- *
Clears the bits.
- *
- * @param holder the int data containing the bits we're
- * interested in
- * @return the value of holder with the specified bits cleared
- * (set to {@code 0})
- */
- public int clear(int holder) {
- return holder & ~_mask;
- }
-
- /**
- *
Clears the bits.
- *
- * @param holder the short data containing the bits we're
- * interested in
- * @return the value of holder with the specified bits cleared
- * (set to {@code 0})
- */
- public short clearShort(short holder) {
- return (short) clear(holder);
- }
-
- /**
- *
Clears the bits.
- *
- * @param holder the byte data containing the bits we're
- * interested in
- *
- * @return the value of holder with the specified bits cleared
- * (set to {@code 0})
- */
- public byte clearByte(byte holder) {
- return (byte) clear(holder);
- }
-
- /**
- *
Sets the bits.
- *
- * @param holder the int data containing the bits we're
- * interested in
- * @return the value of holder with the specified bits set
- * to {@code 1}
- */
- public int set(int holder) {
- return holder | _mask;
- }
-
- /**
- *
Sets the bits.
- *
- * @param holder the short data containing the bits we're
- * interested in
- * @return the value of holder with the specified bits set
- * to {@code 1}
- */
- public short setShort(short holder) {
- return (short) set(holder);
- }
-
- /**
- *
Sets the bits.
- *
- * @param holder the byte data containing the bits we're
- * interested in
- *
- * @return the value of holder with the specified bits set
- * to {@code 1}
- */
- public byte setByte(byte holder) {
- return (byte) set(holder);
- }
-
- /**
- *
Sets a boolean BitField.
- *
- * @param holder the int data containing the bits we're
- * interested in
- * @param flag indicating whether to set or clear the bits
- * @return the value of holder with the specified bits set or
- * cleared
- */
- public int setBoolean(int holder, boolean flag) {
- return flag ? set(holder) : clear(holder);
- }
-
- /**
- *
Sets a boolean BitField.
- *
- * @param holder the short data containing the bits we're
- * interested in
- * @param flag indicating whether to set or clear the bits
- * @return the value of holder with the specified bits set or
- * cleared
- */
- public short setShortBoolean(short holder, boolean flag) {
- return flag ? setShort(holder) : clearShort(holder);
- }
-
- /**
- *
Sets a boolean BitField.
- *
- * @param holder the byte data containing the bits we're
- * interested in
- * @param flag indicating whether to set or clear the bits
- * @return the value of holder with the specified bits set or
- * cleared
- */
- public byte setByteBoolean(byte holder, boolean flag) {
- return flag ? setByte(holder) : clearByte(holder);
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/BooleanUtils.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/BooleanUtils.java
deleted file mode 100644
index 795a6c52..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/BooleanUtils.java
+++ /dev/null
@@ -1,1082 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-import external.org.apache.commons.lang3.math.NumberUtils;
-
-/**
- *
Operations on boolean primitives and Boolean objects.
- *
- *
This class tries to handle {@code null} input gracefully.
- * An exception will not be thrown for a {@code null} input.
- * Each method documents its behaviour in more detail.
{@code BooleanUtils} instances should NOT be constructed in standard programming.
- * Instead, the class should be used as {@code BooleanUtils.negate(true);}.
- *
- *
This constructor is public to permit tools that require a JavaBean instance
- * to operate.
- *
- * @param value the int to convert
- * @return {@code true} if non-zero, {@code false}
- * if zero
- */
- public static boolean toBoolean(int value) {
- return value != 0;
- }
-
- /**
- *
Converts an int to a Boolean using the convention that {@code zero}
- * is {@code false}.
- *
- * @param value the Integer to convert
- * @param trueValue the value to match for {@code true}
- * @param falseValue the value to match for {@code false}
- * @return {@code true} or {@code false}
- * @throws IllegalArgumentException if no match
- */
- public static boolean toBoolean(int value, int trueValue, int falseValue) {
- if (value == trueValue) {
- return true;
- }
- if (value == falseValue) {
- return false;
- }
- // no match
- throw new IllegalArgumentException("The Integer did not match either specified value");
- }
-
- /**
- *
Converts an Integer to a boolean specifying the conversion values.
- *
- * @param value the Integer to convert
- * @param trueValue the value to match for {@code true}, may be {@code null}
- * @param falseValue the value to match for {@code false}, may be {@code null}
- * @return {@code true} or {@code false}
- * @throws IllegalArgumentException if no match
- */
- public static boolean toBoolean(Integer value, Integer trueValue, Integer falseValue) {
- if (value == null) {
- if (trueValue == null) {
- return true;
- }
- if (falseValue == null) {
- return false;
- }
- } else if (value.equals(trueValue)) {
- return true;
- } else if (value.equals(falseValue)) {
- return false;
- }
- // no match
- throw new IllegalArgumentException("The Integer did not match either specified value");
- }
-
- /**
- *
Converts an int to a Boolean specifying the conversion values.
- *
- *
NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.
- *
- * @param value the Integer to convert
- * @param trueValue the value to match for {@code true}
- * @param falseValue the value to match for {@code false}
- * @param nullValue the value to to match for {@code null}
- * @return Boolean.TRUE, Boolean.FALSE, or {@code null}
- * @throws IllegalArgumentException if no match
- */
- public static Boolean toBooleanObject(int value, int trueValue, int falseValue, int nullValue) {
- if (value == trueValue) {
- return Boolean.TRUE;
- }
- if (value == falseValue) {
- return Boolean.FALSE;
- }
- if (value == nullValue) {
- return null;
- }
- // no match
- throw new IllegalArgumentException("The Integer did not match any specified value");
- }
-
- /**
- *
Converts an Integer to a Boolean specifying the conversion values.
- *
- *
NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.
- *
- * @param value the Integer to convert
- * @param trueValue the value to match for {@code true}, may be {@code null}
- * @param falseValue the value to match for {@code false}, may be {@code null}
- * @param nullValue the value to to match for {@code null}, may be {@code null}
- * @return Boolean.TRUE, Boolean.FALSE, or {@code null}
- * @throws IllegalArgumentException if no match
- */
- public static Boolean toBooleanObject(Integer value, Integer trueValue, Integer falseValue, Integer nullValue) {
- if (value == null) {
- if (trueValue == null) {
- return Boolean.TRUE;
- }
- if (falseValue == null) {
- return Boolean.FALSE;
- }
- if (nullValue == null) {
- return null;
- }
- } else if (value.equals(trueValue)) {
- return Boolean.TRUE;
- } else if (value.equals(falseValue)) {
- return Boolean.FALSE;
- } else if (value.equals(nullValue)) {
- return null;
- }
- // no match
- throw new IllegalArgumentException("The Integer did not match any specified value");
- }
-
- // Boolean to Integer methods
- //-----------------------------------------------------------------------
- /**
- *
Converts a boolean to an int using the convention that
- * {@code zero} is {@code false}.
- *
- * @param bool the to convert
- * @param trueValue the value to return if {@code true}
- * @param falseValue the value to return if {@code false}
- * @return the appropriate value
- */
- public static int toInteger(boolean bool, int trueValue, int falseValue) {
- return bool ? trueValue : falseValue;
- }
-
- /**
- *
Converts a Boolean to an int specifying the conversion values.
- *
- * @param bool the Boolean to convert
- * @param trueValue the value to return if {@code true}
- * @param falseValue the value to return if {@code false}
- * @param nullValue the value to return if {@code null}
- * @return the appropriate value
- */
- public static int toInteger(Boolean bool, int trueValue, int falseValue, int nullValue) {
- if (bool == null) {
- return nullValue;
- }
- return bool.booleanValue() ? trueValue : falseValue;
- }
-
- /**
- *
Converts a boolean to an Integer specifying the conversion values.
- *
- * @param bool the to convert
- * @param trueValue the value to return if {@code true}, may be {@code null}
- * @param falseValue the value to return if {@code false}, may be {@code null}
- * @return the appropriate value
- */
- public static Integer toIntegerObject(boolean bool, Integer trueValue, Integer falseValue) {
- return bool ? trueValue : falseValue;
- }
-
- /**
- *
Converts a Boolean to an Integer specifying the conversion values.
- *
- * @param bool the Boolean to convert
- * @param trueValue the value to return if {@code true}, may be {@code null}
- * @param falseValue the value to return if {@code false}, may be {@code null}
- * @param nullValue the value to return if {@code null}, may be {@code null}
- * @return the appropriate value
- */
- public static Integer toIntegerObject(Boolean bool, Integer trueValue, Integer falseValue, Integer nullValue) {
- if (bool == null) {
- return nullValue;
- }
- return bool.booleanValue() ? trueValue : falseValue;
- }
-
- // String to Boolean methods
- //-----------------------------------------------------------------------
- /**
- *
Converts a String to a Boolean.
- *
- *
{@code 'true'}, {@code 'on'} or {@code 'yes'}
- * (case insensitive) will return {@code true}.
- * {@code 'false'}, {@code 'off'} or {@code 'no'}
- * (case insensitive) will return {@code false}.
- * Otherwise, {@code null} is returned.
- *
- *
NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.
- *
- * @param str the String to check
- * @param trueString the String to match for {@code true} (case sensitive), may be {@code null}
- * @param falseString the String to match for {@code false} (case sensitive), may be {@code null}
- * @param nullString the String to match for {@code null} (case sensitive), may be {@code null}
- * @return the Boolean value of the string, {@code null} if either the String matches {@code nullString}
- * or if {@code null} input and {@code nullString} is {@code null}
- * @throws IllegalArgumentException if the String doesn't match
- */
- public static Boolean toBooleanObject(String str, String trueString, String falseString, String nullString) {
- if (str == null) {
- if (trueString == null) {
- return Boolean.TRUE;
- }
- if (falseString == null) {
- return Boolean.FALSE;
- }
- if (nullString == null) {
- return null;
- }
- } else if (str.equals(trueString)) {
- return Boolean.TRUE;
- } else if (str.equals(falseString)) {
- return Boolean.FALSE;
- } else if (str.equals(nullString)) {
- return null;
- }
- // no match
- throw new IllegalArgumentException("The String did not match any specified value");
- }
-
- // String to boolean methods
- //-----------------------------------------------------------------------
- /**
- *
Converts a String to a boolean (optimised for performance).
- *
- *
{@code 'true'}, {@code 'on'} or {@code 'yes'}
- * (case insensitive) will return {@code true}. Otherwise,
- * {@code false} is returned.
- *
- *
This method performs 4 times faster (JDK1.4) than
- * {@code Boolean.valueOf(String)}. However, this method accepts
- * 'on' and 'yes' as true values.
- *
- *
- *
- * @param str the String to check
- * @return the boolean value of the string, {@code false} if no match or the String is null
- */
- public static boolean toBoolean(String str) {
- return toBooleanObject(str) == Boolean.TRUE;
- }
-
- /**
- *
Converts a String to a Boolean throwing an exception if no match found.
- *
- * @param str the String to check
- * @param trueString the String to match for {@code true} (case sensitive), may be {@code null}
- * @param falseString the String to match for {@code false} (case sensitive), may be {@code null}
- * @return the boolean value of the string
- * @throws IllegalArgumentException if the String doesn't match
- */
- public static boolean toBoolean(String str, String trueString, String falseString) {
- if (str == trueString) {
- return true;
- } else if (str == falseString) {
- return false;
- } else if (str != null) {
- if (str.equals(trueString)) {
- return true;
- } else if (str.equals(falseString)) {
- return false;
- }
- }
- // no match
- throw new IllegalArgumentException("The String did not match either specified value");
- }
-
- // Boolean to String methods
- //-----------------------------------------------------------------------
- /**
- *
Converts a Boolean to a String returning {@code 'true'},
- * {@code 'false'}, or {@code null}.
- *
- * @param bool the Boolean to check
- * @param trueString the String to return if {@code true}, may be {@code null}
- * @param falseString the String to return if {@code false}, may be {@code null}
- * @param nullString the String to return if {@code null}, may be {@code null}
- * @return one of the three input Strings
- */
- public static String toString(Boolean bool, String trueString, String falseString, String nullString) {
- if (bool == null) {
- return nullString;
- }
- return bool.booleanValue() ? trueString : falseString;
- }
-
- // boolean to String methods
- //-----------------------------------------------------------------------
- /**
- *
Converts a boolean to a String returning {@code 'true'}
- * or {@code 'false'}.
- *
- * @param bool the Boolean to check
- * @param trueString the String to return if {@code true}, may be {@code null}
- * @param falseString the String to return if {@code false}, may be {@code null}
- * @return one of the two input Strings
- */
- public static String toString(boolean bool, String trueString, String falseString) {
- return bool ? trueString : falseString;
- }
-
- // logical operations
- // ----------------------------------------------------------------------
- /**
- *
- *
- * @param array an array of {@code Boolean}s
- * @return {@code true} if the xor is successful.
- * @throws IllegalArgumentException if {@code array} is {@code null}
- * @throws IllegalArgumentException if {@code array} is empty.
- * @throws IllegalArgumentException if {@code array} contains a {@code null}
- */
- public static Boolean xor(Boolean... array) {
- if (array == null) {
- throw new IllegalArgumentException("The Array must not be null");
- }
- if (array.length == 0) {
- throw new IllegalArgumentException("Array is empty");
- }
- try {
- boolean[] primitive = ArrayUtils.toPrimitive(array);
- return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
- } catch (NullPointerException ex) {
- throw new IllegalArgumentException("The array must not contain any null elements");
- }
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/CharEncoding.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/CharEncoding.java
deleted file mode 100644
index 9666dd20..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/CharEncoding.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package external.org.apache.commons.lang3;
-
-import java.nio.charset.Charset;
-import java.nio.charset.IllegalCharsetNameException;
-
-/**
- *
Character encoding names required of every implementation of the Java platform.
Every implementation of the Java platform is required to support the following character encodings.
- * Consult the release documentation for your implementation to see if any other encodings are supported.
- *
Every implementation of the Java platform is required to support this character encoding.
- */
- public static final String ISO_8859_1 = "ISO-8859-1";
-
- /**
- *
Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block
- * of the Unicode character set.
- *
- *
Every implementation of the Java platform is required to support this character encoding.
- */
- public static final String US_ASCII = "US-ASCII";
-
- /**
- *
Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial
- * byte-order mark (either order accepted on input, big-endian used on output).
- *
- *
Every implementation of the Java platform is required to support this character encoding.
- */
- public static final String UTF_16 = "UTF-16";
-
- /**
- *
Sixteen-bit Unicode Transformation Format, big-endian byte order.
- *
- *
Every implementation of the Java platform is required to support this character encoding.
- */
- public static final String UTF_16BE = "UTF-16BE";
-
- /**
- *
Sixteen-bit Unicode Transformation Format, little-endian byte order.
- *
- *
Every implementation of the Java platform is required to support this character encoding.
- */
- public static final String UTF_16LE = "UTF-16LE";
-
- /**
- *
Eight-bit Unicode Transformation Format.
- *
- *
Every implementation of the Java platform is required to support this character encoding.
- */
- public static final String UTF_8 = "UTF-8";
-
- //-----------------------------------------------------------------------
- /**
- *
- *
- * @param name the name of the requested charset; may be either a canonical name or an alias, null returns false
- * @return {@code true} if the charset is available in the current Java virtual machine
- */
- public static boolean isSupported(String name) {
- if (name == null) {
- return false;
- }
- try {
- return Charset.isSupported(name);
- } catch (IllegalCharsetNameException ex) {
- return false;
- }
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/CharRange.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/CharRange.java
deleted file mode 100644
index 55db6c6a..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/CharRange.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- *
A contiguous range of characters, optionally negated.
- *
- *
Instances are immutable.
- *
- *
#ThreadSafe#
- * @since 1.0
- * @version $Id: CharRange.java 1090427 2011-04-08 20:17:10Z bayard $
- */
-// TODO: This is no longer public and will be removed later as CharSet is moved
-// to depend on Range.
-final class CharRange implements Iterable, Serializable {
-
- /**
- * Required for serialization support. Lang version 2.0.
- *
- * @see java.io.Serializable
- */
- private static final long serialVersionUID = 8270183163158333422L;
-
- /** The first character, inclusive, in the range. */
- private final char start;
- /** The last character, inclusive, in the range. */
- private final char end;
- /** True if the range is everything except the characters specified. */
- private final boolean negated;
-
- /** Cached toString. */
- private transient String iToString;
-
- /**
- *
Constructs a {@code CharRange} over a set of characters,
- * optionally negating the range.
- *
- *
A negated range includes everything except that defined by the
- * start and end characters.
- *
- *
If start and end are in the wrong order, they are reversed.
- * Thus {@code a-e} is the same as {@code e-a}.
- *
- * @param start first character, inclusive, in this range
- * @param end last character, inclusive, in this range
- * @param negated true to express everything except the range
- */
- private CharRange(char start, char end, boolean negated) {
- super();
- if (start > end) {
- char temp = start;
- start = end;
- end = temp;
- }
-
- this.start = start;
- this.end = end;
- this.negated = negated;
- }
-
- /**
- *
Constructs a {@code CharRange} over a single character.
- *
- * @param ch only character in this range
- * @return the new CharRange object
- * @see CharRange#CharRange(char, char, boolean)
- * @since 2.5
- */
- public static CharRange is(char ch) {
- return new CharRange(ch, ch, false);
- }
-
- /**
- *
Constructs a negated {@code CharRange} over a single character.
- *
- * @param ch only character in this range
- * @return the new CharRange object
- * @see CharRange#CharRange(char, char, boolean)
- * @since 2.5
- */
- public static CharRange isNot(char ch) {
- return new CharRange(ch, ch, true);
- }
-
- /**
- *
Constructs a {@code CharRange} over a set of characters.
- *
- * @param start first character, inclusive, in this range
- * @param end last character, inclusive, in this range
- * @return the new CharRange object
- * @see CharRange#CharRange(char, char, boolean)
- * @since 2.5
- */
- public static CharRange isIn(char start, char end) {
- return new CharRange(start, end, false);
- }
-
- /**
- *
Constructs a negated {@code CharRange} over a set of characters.
- *
- * @param start first character, inclusive, in this range
- * @param end last character, inclusive, in this range
- * @return the new CharRange object
- * @see CharRange#CharRange(char, char, boolean)
- * @since 2.5
- */
- public static CharRange isNotIn(char start, char end) {
- return new CharRange(start, end, true);
- }
-
- // Accessors
- //-----------------------------------------------------------------------
- /**
- *
Gets the start character for this character range.
Is the character specified contained in this range.
- *
- * @param ch the character to check
- * @return {@code true} if this range contains the input character
- */
- public boolean contains(char ch) {
- return (ch >= start && ch <= end) != negated;
- }
-
- /**
- *
Are all the characters of the passed in range contained in
- * this range.
- *
- * @param range the range to check against
- * @return {@code true} if this range entirely contains the input range
- * @throws IllegalArgumentException if {@code null} input
- */
- public boolean contains(CharRange range) {
- if (range == null) {
- throw new IllegalArgumentException("The Range must not be null");
- }
- if (negated) {
- if (range.negated) {
- return start >= range.start && end <= range.end;
- }
- return range.end < start || range.start > end;
- }
- if (range.negated) {
- return start == 0 && end == Character.MAX_VALUE;
- }
- return start <= range.start && end >= range.end;
- }
-
- // Basics
- //-----------------------------------------------------------------------
- /**
- *
Compares two CharRange objects, returning true if they represent
- * exactly the same range of characters defined in the same way.
- *
- * @param obj the object to compare to
- * @return true if equal
- */
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (obj instanceof CharRange == false) {
- return false;
- }
- CharRange other = (CharRange) obj;
- return start == other.start && end == other.end && negated == other.negated;
- }
-
- /**
- *
Gets a hashCode compatible with the equals method.
- *
- * @return a suitable hashCode
- */
- @Override
- public int hashCode() {
- return 83 + start + 7 * end + (negated ? 1 : 0);
- }
-
- /**
- *
Gets a string representation of the character range.
- *
- * @return string representation of this range
- */
- @Override
- public String toString() {
- if (iToString == null) {
- StringBuilder buf = new StringBuilder(4);
- if (isNegated()) {
- buf.append('^');
- }
- buf.append(start);
- if (start != end) {
- buf.append('-');
- buf.append(end);
- }
- iToString = buf.toString();
- }
- return iToString;
- }
-
- // Expansions
- //-----------------------------------------------------------------------
- /**
- *
Returns an iterator which can be used to walk through the characters described by this range.
- *
- *
#NotThreadSafe# the iterator is not threadsafe
- * @return an iterator to the chars represented by this range
- * @since 2.5
- */
- public Iterator iterator() {
- return new CharacterIterator(this);
- }
-
- /**
- * Character {@link Iterator}.
- *
#NotThreadSafe#
- */
- private static class CharacterIterator implements Iterator {
- /** The current character */
- private char current;
-
- private final CharRange range;
- private boolean hasNext;
-
- /**
- * Construct a new iterator for the character range.
- *
- * @param r The character range
- */
- private CharacterIterator(CharRange r) {
- range = r;
- hasNext = true;
-
- if (range.negated) {
- if (range.start == 0) {
- if (range.end == Character.MAX_VALUE) {
- // This range is an empty set
- hasNext = false;
- } else {
- current = (char) (range.end + 1);
- }
- } else {
- current = 0;
- }
- } else {
- current = range.start;
- }
- }
-
- /**
- * Prepare the next character in the range.
- */
- private void prepareNext() {
- if (range.negated) {
- if (current == Character.MAX_VALUE) {
- hasNext = false;
- } else if (current + 1 == range.start) {
- if (range.end == Character.MAX_VALUE) {
- hasNext = false;
- } else {
- current = (char) (range.end + 1);
- }
- } else {
- current = (char) (current + 1);
- }
- } else if (current < range.end) {
- current = (char) (current + 1);
- } else {
- hasNext = false;
- }
- }
-
- /**
- * Has the iterator not reached the end character yet?
- *
- * @return {@code true} if the iterator has yet to reach the character date
- */
- public boolean hasNext() {
- return hasNext;
- }
-
- /**
- * Return the next character in the iteration
- *
- * @return {@code Character} for the next character
- */
- public Character next() {
- if (hasNext == false) {
- throw new NoSuchElementException();
- }
- char cur = current;
- prepareNext();
- return Character.valueOf(cur);
- }
-
- /**
- * Always throws UnsupportedOperationException.
- *
- * @throws UnsupportedOperationException
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/CharSet.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/CharSet.java
deleted file mode 100644
index b745ea34..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/CharSet.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- *
A set of characters.
- *
- *
Instances are immutable, but instances of subclasses may not be.
- *
- *
#ThreadSafe#
- * @since 1.0
- * @version $Id: CharSet.java 1199894 2011-11-09 17:53:59Z ggregory $
- */
-public class CharSet implements Serializable {
-
- /**
- * Required for serialization support. Lang version 2.0.
- *
- * @see java.io.Serializable
- */
- private static final long serialVersionUID = 5947847346149275958L;
-
- /**
- * A CharSet defining no characters.
- * @since 2.0
- */
- public static final CharSet EMPTY = new CharSet((String) null);
-
- /**
- * A CharSet defining ASCII alphabetic characters "a-zA-Z".
- * @since 2.0
- */
- public static final CharSet ASCII_ALPHA = new CharSet("a-zA-Z");
-
- /**
- * A CharSet defining ASCII alphabetic characters "a-z".
- * @since 2.0
- */
- public static final CharSet ASCII_ALPHA_LOWER = new CharSet("a-z");
-
- /**
- * A CharSet defining ASCII alphabetic characters "A-Z".
- * @since 2.0
- */
- public static final CharSet ASCII_ALPHA_UPPER = new CharSet("A-Z");
-
- /**
- * A CharSet defining ASCII alphabetic characters "0-9".
- * @since 2.0
- */
- public static final CharSet ASCII_NUMERIC = new CharSet("0-9");
-
- /**
- * A Map of the common cases used in the factory.
- * Subclasses can add more common patterns if desired
- * @since 2.0
- */
- protected static final Map COMMON = Collections.synchronizedMap(new HashMap());
-
- static {
- COMMON.put(null, EMPTY);
- COMMON.put("", EMPTY);
- COMMON.put("a-zA-Z", ASCII_ALPHA);
- COMMON.put("A-Za-z", ASCII_ALPHA);
- COMMON.put("a-z", ASCII_ALPHA_LOWER);
- COMMON.put("A-Z", ASCII_ALPHA_UPPER);
- COMMON.put("0-9", ASCII_NUMERIC);
- }
-
- /** The set of CharRange objects. */
- private final Set set = Collections.synchronizedSet(new HashSet());
-
- //-----------------------------------------------------------------------
- /**
- *
Factory method to create a new CharSet using a special syntax.
- *
- *
- *
{@code null} or empty string ("")
- * - set containing no characters
- *
Single character, such as "a"
- * - set containing just that character
- *
Multi character, such as "a-e"
- * - set containing characters from one character to the other
- *
Negated, such as "^a" or "^a-e"
- * - set containing all characters except those defined
- *
Combinations, such as "abe-g"
- * - set containing all the characters from the individual sets
- *
- *
- *
The matching order is:
- *
- *
Negated multi character range, such as "^a-e"
- *
Ordinary multi character range, such as "a-e"
- *
Negated single character, such as "^a"
- *
Ordinary single character, such as "a"
- *
- *
Matching works left to right. Once a match is found the
- * search starts again from the next character.
- *
- *
If the same range is defined twice using the same syntax, only
- * one range will be kept.
- * Thus, "a-ca-c" creates only one range of "a-c".
- *
- *
If the start and end of a range are in the wrong order,
- * they are reversed. Thus "a-e" is the same as "e-a".
- * As a result, "a-ee-a" would create only one range,
- * as the "a-e" and "e-a" are the same.
- *
- *
The set of characters represented is the union of the specified ranges.
- *
- *
All CharSet objects returned by this method will be immutable.
- *
- * @param setStrs Strings to merge into the set, may be null
- * @return a CharSet instance
- * @since 2.4
- */
- public static CharSet getInstance(String... setStrs) {
- if (setStrs == null) {
- return null;
- }
- if (setStrs.length == 1) {
- CharSet common = COMMON.get(setStrs[0]);
- if (common != null) {
- return common;
- }
- }
- return new CharSet(setStrs);
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Constructs a new CharSet using the set syntax.
- * Each string is merged in with the set.
- *
- * @param set Strings to merge into the initial set
- * @throws NullPointerException if set is {@code null}
- */
- protected CharSet(String... set) {
- super();
- int sz = set.length;
- for (int i = 0; i < sz; i++) {
- add(set[i]);
- }
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Add a set definition string to the {@code CharSet}.
Gets the internal set as an array of CharRange objects.
- *
- * @return an array of immutable CharRange objects
- * @since 2.0
- */
-// NOTE: This is no longer public as CharRange is no longer a public class.
-// It may be replaced when CharSet moves to Range.
- /*public*/ CharRange[] getCharRanges() {
- return set.toArray(new CharRange[set.size()]);
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Does the {@code CharSet} contain the specified
- * character {@code ch}.
- *
- * @param ch the character to check for
- * @return {@code true} if the set contains the characters
- */
- public boolean contains(char ch) {
- for (CharRange range : set) {
- if (range.contains(ch)) {
- return true;
- }
- }
- return false;
- }
-
- // Basics
- //-----------------------------------------------------------------------
- /**
- *
Compares two {@code CharSet} objects, returning true if they represent
- * exactly the same set of characters defined in the same way.
- *
- *
The two sets {@code abc} and {@code a-c} are not
- * equal according to this method.
- *
- * @param obj the object to compare to
- * @return true if equal
- * @since 2.0
- */
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (obj instanceof CharSet == false) {
- return false;
- }
- CharSet other = (CharSet) obj;
- return set.equals(other.set);
- }
-
- /**
- *
Gets a hash code compatible with the equals method.
- *
- * @return string representation of the set
- */
- @Override
- public String toString() {
- return set.toString();
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/CharSetUtils.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/CharSetUtils.java
deleted file mode 100644
index 82946ac4..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/CharSetUtils.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-/**
- *
Operations on {@code CharSet} instances.
- *
- *
This class handles {@code null} input gracefully.
- * An exception will not be thrown for a {@code null} input.
- * Each method documents its behaviour in more detail.
CharSetUtils instances should NOT be constructed in standard programming.
- * Instead, the class should be used as {@code CharSetUtils.evaluateSet(null);}.
- *
- *
This constructor is public to permit tools that require a JavaBean instance
- * to operate.
- *
- * @see CharSet#getInstance(java.lang.String...) for set-syntax.
- * @param str String to count characters in, may be null
- * @param set String[] set of characters to count, may be null
- * @return the character count, zero if null string input
- */
- public static int count(String str, String... set) {
- if (StringUtils.isEmpty(str) || deepEmpty(set)) {
- return 0;
- }
- CharSet chars = CharSet.getInstance(set);
- int count = 0;
- for (char c : str.toCharArray()) {
- if (chars.contains(c)) {
- count++;
- }
- }
- return count;
- }
-
- // Keep
- //-----------------------------------------------------------------------
- /**
- *
Takes an argument in set-syntax, see evaluateSet,
- * and keeps any of characters present in the specified string.
- *
- * @see CharSet#getInstance(java.lang.String...) for set-syntax.
- * @param str String to delete characters from, may be null
- * @param set String[] set of characters to delete, may be null
- * @return the modified String, {@code null} if null string input
- */
- public static String delete(String str, String... set) {
- if (StringUtils.isEmpty(str) || deepEmpty(set)) {
- return str;
- }
- return modify(str, set, false);
- }
-
- //-----------------------------------------------------------------------
- /**
- * Implementation of delete and keep
- *
- * @param str String to modify characters within
- * @param set String[] set of characters to modify
- * @param expect whether to evaluate on match, or non-match
- * @return the modified String, not null
- */
- private static String modify(String str, String[] set, boolean expect) {
- CharSet chars = CharSet.getInstance(set);
- StringBuilder buffer = new StringBuilder(str.length());
- char[] chrs = str.toCharArray();
- int sz = chrs.length;
- for(int i=0; iUtility library to provide helper methods for Java enums.
- *
- *
#ThreadSafe#
- *
- * @since 3.0
- * @version $Id: EnumUtils.java 1199894 2011-11-09 17:53:59Z ggregory $
- */
-public class EnumUtils {
-
- /**
- * This constructor is public to permit tools that require a JavaBean
- * instance to operate.
- */
- public EnumUtils() {
- }
-
- /**
- *
Gets the {@code Map} of enums by name.
- *
- *
This method is useful when you need a map of enums by name.
- *
- * @param the type of the enumeration
- * @param enumClass the class of the enum to query, not null
- * @return the modifiable map of enum names to enums, never null
- */
- public static > Map getEnumMap(Class enumClass) {
- Map map = new LinkedHashMap();
- for (E e: enumClass.getEnumConstants()) {
- map.put(e.name(), e);
- }
- return map;
- }
-
- /**
- *
Gets the {@code List} of enums.
- *
- *
This method is useful when you need a list of enums rather than an array.
- *
- * @param the type of the enumeration
- * @param enumClass the class of the enum to query, not null
- * @return the modifiable list of enums, never null
- */
- public static > List getEnumList(Class enumClass) {
- return new ArrayList(Arrays.asList(enumClass.getEnumConstants()));
- }
-
- /**
- *
Checks if the specified name is a valid enum for the class.
- *
- *
This method differs from {@link Enum#valueOf} in that checks if the name is
- * a valid enum without needing to catch the exception.
- *
- * @param the type of the enumeration
- * @param enumClass the class of the enum to query, not null
- * @param enumName the enum name, null returns false
- * @return true if the enum name is valid, otherwise false
- */
- public static > boolean isValidEnum(Class enumClass, String enumName) {
- if (enumName == null) {
- return false;
- }
- try {
- Enum.valueOf(enumClass, enumName);
- return true;
- } catch (IllegalArgumentException ex) {
- return false;
- }
- }
-
- /**
- *
Gets the enum for the class, returning {@code null} if not found.
- *
- *
This method differs from {@link Enum#valueOf} in that it does not throw an exception
- * for an invalid enum name.
- *
- * @param the type of the enumeration
- * @param enumClass the class of the enum to query, not null
- * @param enumName the enum name, null returns null
- * @return the enum, null if not found
- */
- public static > E getEnum(Class enumClass, String enumName) {
- if (enumName == null) {
- return null;
- }
- try {
- return Enum.valueOf(enumClass, enumName);
- } catch (IllegalArgumentException ex) {
- return null;
- }
- }
-
- /**
- *
Creates a long bit vector representation of the given subset of an Enum.
- *
- *
This generates a value that is usable by {@link EnumUtils#processBitVector}.
- *
- *
Do not use this method if you have more than 64 values in your Enum, as this
- * would create a value greater than a long can hold.
- *
- * @param enumClass the class of the enum we are working with, not {@code null}
- * @param values the values we want to convert, not {@code null}
- * @param the type of the enumeration
- * @return a long whose binary value represents the given set of enum values.
- * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}
- * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
- * @since 3.0.1
- */
- public static > long generateBitVector(Class enumClass, Iterable values) {
- checkBitVectorable(enumClass);
- Validate.notNull(values);
- long total = 0;
- for (E constant : values) {
- total |= 1 << constant.ordinal();
- }
- return total;
- }
-
- /**
- *
Creates a long bit vector representation of the given array of Enum values.
- *
- *
This generates a value that is usable by {@link EnumUtils#processBitVector}.
- *
- *
Do not use this method if you have more than 64 values in your Enum, as this
- * would create a value greater than a long can hold.
- *
- * @param enumClass the class of the enum we are working with, not {@code null}
- * @param values the values we want to convert, not {@code null}
- * @param the type of the enumeration
- * @return a long whose binary value represents the given set of enum values.
- * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}
- * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
- * @since 3.0.1
- */
- public static > long generateBitVector(Class enumClass, E... values) {
- Validate.noNullElements(values);
- return generateBitVector(enumClass, Arrays. asList(values));
- }
-
- /**
- *
Convert a long value created by {@link EnumUtils#generateBitVector} into the set of
- * enum values that it represents.
- *
- *
If you store this value, beware any changes to the enum that would affect ordinal values.
- * @param enumClass the class of the enum we are working with, not {@code null}
- * @param value the long value representation of a set of enum values
- * @param the type of the enumeration
- * @return a set of enum values
- * @throws NullPointerException if {@code enumClass} is {@code null}
- * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
- * @since 3.0.1
- */
- public static > EnumSet processBitVector(Class enumClass, long value) {
- final E[] constants = checkBitVectorable(enumClass).getEnumConstants();
- final EnumSet results = EnumSet.noneOf(enumClass);
- for (E constant : constants) {
- if ((value & 1 << constant.ordinal()) != 0) {
- results.add(constant);
- }
- }
- return results;
- }
-
- /**
- * Validate that {@code enumClass} is compatible with representation in a {@code long}.
- * @param the type of the enumeration
- * @param enumClass to check
- * @return {@code enumClass}
- * @throws NullPointerException if {@code enumClass} is {@code null}
- * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
- * @since 3.0.1
- */
- private static > Class checkBitVectorable(Class enumClass) {
- Validate.notNull(enumClass, "EnumClass must be defined.");
-
- final E[] constants = enumClass.getEnumConstants();
- Validate.isTrue(constants != null, "%s does not seem to be an Enum type", enumClass);
- Validate.isTrue(constants.length <= Long.SIZE, "Cannot store %s %s values in %s bits", constants.length,
- enumClass.getSimpleName(), Long.SIZE);
-
- return enumClass;
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/LocaleUtils.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/LocaleUtils.java
deleted file mode 100644
index 4a714ac0..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/LocaleUtils.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- *
Operations to assist when working with a {@link Locale}.
- *
- *
This class tries to handle {@code null} input gracefully.
- * An exception will not be thrown for a {@code null} input.
- * Each method documents its behaviour in more detail.
- *
- * @since 2.2
- * @version $Id: LocaleUtils.java 1090563 2011-04-09 11:00:10Z sebb $
- */
-public class LocaleUtils {
-
- /** Concurrent map of language locales by country. */
- private static final ConcurrentMap> cLanguagesByCountry =
- new ConcurrentHashMap>();
-
- /** Concurrent map of country locales by language. */
- private static final ConcurrentMap> cCountriesByLanguage =
- new ConcurrentHashMap>();
-
- /**
- *
{@code LocaleUtils} instances should NOT be constructed in standard programming.
- * Instead, the class should be used as {@code LocaleUtils.toLocale("en_GB");}.
- *
- *
This constructor is public to permit tools that require a JavaBean instance
- * to operate.
This method takes the string format of a locale and creates the
- * locale object from it.
- *
- *
- * LocaleUtils.toLocale("en") = new Locale("en", "")
- * LocaleUtils.toLocale("en_GB") = new Locale("en", "GB")
- * LocaleUtils.toLocale("en_GB_xxx") = new Locale("en", "GB", "xxx") (#)
- *
- *
- *
(#) The behaviour of the JDK variant constructor changed between JDK1.3 and JDK1.4.
- * In JDK1.3, the constructor upper cases the variant, in JDK1.4, it doesn't.
- * Thus, the result from getVariant() may vary depending on your JDK.
- *
- *
This method validates the input strictly.
- * The language code must be lowercase.
- * The country code must be uppercase.
- * The separator must be an underscore.
- * The length must be correct.
- *
- *
- * @param str the locale String to convert, null returns null
- * @return a Locale, null if null input
- * @throws IllegalArgumentException if the string is an invalid format
- */
- public static Locale toLocale(String str) {
- if (str == null) {
- return null;
- }
- int len = str.length();
- if (len != 2 && len != 5 && len < 7) {
- throw new IllegalArgumentException("Invalid locale format: " + str);
- }
- char ch0 = str.charAt(0);
- char ch1 = str.charAt(1);
- if (ch0 < 'a' || ch0 > 'z' || ch1 < 'a' || ch1 > 'z') {
- throw new IllegalArgumentException("Invalid locale format: " + str);
- }
- if (len == 2) {
- return new Locale(str, "");
- } else {
- if (str.charAt(2) != '_') {
- throw new IllegalArgumentException("Invalid locale format: " + str);
- }
- char ch3 = str.charAt(3);
- if (ch3 == '_') {
- return new Locale(str.substring(0, 2), "", str.substring(4));
- }
- char ch4 = str.charAt(4);
- if (ch3 < 'A' || ch3 > 'Z' || ch4 < 'A' || ch4 > 'Z') {
- throw new IllegalArgumentException("Invalid locale format: " + str);
- }
- if (len == 5) {
- return new Locale(str.substring(0, 2), str.substring(3, 5));
- } else {
- if (str.charAt(5) != '_') {
- throw new IllegalArgumentException("Invalid locale format: " + str);
- }
- return new Locale(str.substring(0, 2), str.substring(3, 5), str.substring(6));
- }
- }
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Obtains the list of locales to search through when performing
- * a locale search.
- *
- * @param locale the locale to start from
- * @return the unmodifiable list of Locale objects, 0 being locale, not null
- */
- public static List localeLookupList(Locale locale) {
- return localeLookupList(locale, locale);
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Obtains the list of locales to search through when performing
- * a locale search.
The result list begins with the most specific locale, then the
- * next more general and so on, finishing with the default locale.
- * The list will never contain the same locale twice.
- *
- * @param locale the locale to start from, null returns empty list
- * @param defaultLocale the default locale to use if no other is found
- * @return the unmodifiable list of Locale objects, 0 being locale, not null
- */
- public static List localeLookupList(Locale locale, Locale defaultLocale) {
- List list = new ArrayList(4);
- if (locale != null) {
- list.add(locale);
- if (locale.getVariant().length() > 0) {
- list.add(new Locale(locale.getLanguage(), locale.getCountry()));
- }
- if (locale.getCountry().length() > 0) {
- list.add(new Locale(locale.getLanguage(), ""));
- }
- if (list.contains(defaultLocale) == false) {
- list.add(defaultLocale);
- }
- }
- return Collections.unmodifiableList(list);
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Obtains an unmodifiable list of installed locales.
- *
- *
This method is a wrapper around {@link Locale#getAvailableLocales()}.
- * It is more efficient, as the JDK method must create a new array each
- * time it is called.
- *
- * @return the unmodifiable list of available locales
- */
- public static List availableLocaleList() {
- return SyncAvoid.AVAILABLE_LOCALE_LIST;
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Obtains an unmodifiable set of installed locales.
- *
- *
This method is a wrapper around {@link Locale#getAvailableLocales()}.
- * It is more efficient, as the JDK method must create a new array each
- * time it is called.
- *
- * @return the unmodifiable set of available locales
- */
- public static Set availableLocaleSet() {
- return SyncAvoid.AVAILABLE_LOCALE_SET;
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Checks if the locale specified is in the list of available locales.
- *
- * @param locale the Locale object to check if it is available
- * @return true if the locale is a known locale
- */
- public static boolean isAvailableLocale(Locale locale) {
- return availableLocaleList().contains(locale);
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Obtains the list of languages supported for a given country.
- *
- *
This method takes a country code and searches to find the
- * languages available for that country. Variant locales are removed.
- *
- * @param countryCode the 2 letter country code, null returns empty
- * @return an unmodifiable List of Locale objects, not null
- */
- public static List languagesByCountry(String countryCode) {
- if (countryCode == null) {
- return Collections.emptyList();
- }
- List langs = cLanguagesByCountry.get(countryCode);
- if (langs == null) {
- langs = new ArrayList();
- List locales = availableLocaleList();
- for (int i = 0; i < locales.size(); i++) {
- Locale locale = locales.get(i);
- if (countryCode.equals(locale.getCountry()) &&
- locale.getVariant().length() == 0) {
- langs.add(locale);
- }
- }
- langs = Collections.unmodifiableList(langs);
- cLanguagesByCountry.putIfAbsent(countryCode, langs);
- langs = cLanguagesByCountry.get(countryCode);
- }
- return langs;
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Obtains the list of countries supported for a given language.
- *
- *
This method takes a language code and searches to find the
- * countries available for that language. Variant locales are removed.
- *
- * @param languageCode the 2 letter language code, null returns empty
- * @return an unmodifiable List of Locale objects, not null
- */
- public static List countriesByLanguage(String languageCode) {
- if (languageCode == null) {
- return Collections.emptyList();
- }
- List countries = cCountriesByLanguage.get(languageCode);
- if (countries == null) {
- countries = new ArrayList();
- List locales = availableLocaleList();
- for (int i = 0; i < locales.size(); i++) {
- Locale locale = locales.get(i);
- if (languageCode.equals(locale.getLanguage()) &&
- locale.getCountry().length() != 0 &&
- locale.getVariant().length() == 0) {
- countries.add(locale);
- }
- }
- countries = Collections.unmodifiableList(countries);
- cCountriesByLanguage.putIfAbsent(languageCode, countries);
- countries = cCountriesByLanguage.get(languageCode);
- }
- return countries;
- }
-
- //-----------------------------------------------------------------------
- // class to avoid synchronization
- static class SyncAvoid {
- /** Unmodifiable list of available locales. */
- private static List AVAILABLE_LOCALE_LIST;
- /** Unmodifiable set of available locales. */
- private static Set AVAILABLE_LOCALE_SET;
-
- static {
- List list = new ArrayList(Arrays.asList(Locale.getAvailableLocales())); // extra safe
- AVAILABLE_LOCALE_LIST = Collections.unmodifiableList(list);
- AVAILABLE_LOCALE_SET = Collections.unmodifiableSet(new HashSet(availableLocaleList()));
- }
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/RandomStringUtils.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/RandomStringUtils.java
deleted file mode 100644
index 04e2101e..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/RandomStringUtils.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-import java.util.Random;
-
-/**
- *
Operations for random {@code String}s.
- *
Currently private high surrogate characters are ignored.
- * These are Unicode characters that fall between the values 56192 (db80)
- * and 56319 (dbff) as we don't know how to handle them.
- * High and low surrogates are correctly dealt with - that is if a
- * high surrogate is randomly chosen, 55296 (d800) to 56191 (db7f)
- * then it is followed by a low surrogate. If a low surrogate is chosen,
- * 56320 (dc00) to 57343 (dfff) then it is placed after a randomly
- * chosen high surrogate.
Random object used by random method. This has to be not local
- * to the random method so as to not return the same value in the
- * same millisecond.
- */
- private static final Random RANDOM = new Random();
-
- /**
- *
{@code RandomStringUtils} instances should NOT be constructed in
- * standard programming. Instead, the class should be used as
- * {@code RandomStringUtils.random(5);}.
- *
- *
This constructor is public to permit tools that require a JavaBean instance
- * to operate.
- */
- public RandomStringUtils() {
- super();
- }
-
- // Random
- //-----------------------------------------------------------------------
- /**
- *
Creates a random string whose length is the number of characters
- * specified.
- *
- *
Characters will be chosen from the set of all characters.
- *
- * @param count the length of random string to create
- * @return the random string
- */
- public static String random(int count) {
- return random(count, false, false);
- }
-
- /**
- *
Creates a random string whose length is the number of characters
- * specified.
- *
- *
Characters will be chosen from the set of characters whose
- * ASCII value is between {@code 32} and {@code 126} (inclusive).
- *
- * @param count the length of random string to create
- * @return the random string
- */
- public static String randomAscii(int count) {
- return random(count, 32, 127, false, false);
- }
-
- /**
- *
Creates a random string whose length is the number of characters
- * specified.
- *
- *
Characters will be chosen from the set of alphabetic
- * characters.
- *
- * @param count the length of random string to create
- * @return the random string
- */
- public static String randomAlphabetic(int count) {
- return random(count, true, false);
- }
-
- /**
- *
Creates a random string whose length is the number of characters
- * specified.
- *
- *
Characters will be chosen from the set of alpha-numeric
- * characters.
- *
- * @param count the length of random string to create
- * @return the random string
- */
- public static String randomAlphanumeric(int count) {
- return random(count, true, true);
- }
-
- /**
- *
Creates a random string whose length is the number of characters
- * specified.
- *
- *
Characters will be chosen from the set of numeric
- * characters.
- *
- * @param count the length of random string to create
- * @return the random string
- */
- public static String randomNumeric(int count) {
- return random(count, false, true);
- }
-
- /**
- *
Creates a random string whose length is the number of characters
- * specified.
- *
- *
Characters will be chosen from the set of alpha-numeric
- * characters as indicated by the arguments.
- *
- * @param count the length of random string to create
- * @param letters if {@code true}, generated string will include
- * alphabetic characters
- * @param numbers if {@code true}, generated string will include
- * numeric characters
- * @return the random string
- */
- public static String random(int count, boolean letters, boolean numbers) {
- return random(count, 0, 0, letters, numbers);
- }
-
- /**
- *
Creates a random string whose length is the number of characters
- * specified.
- *
- *
Characters will be chosen from the set of alpha-numeric
- * characters as indicated by the arguments.
- *
- * @param count the length of random string to create
- * @param start the position in set of chars to start at
- * @param end the position in set of chars to end before
- * @param letters if {@code true}, generated string will include
- * alphabetic characters
- * @param numbers if {@code true}, generated string will include
- * numeric characters
- * @return the random string
- */
- public static String random(int count, int start, int end, boolean letters, boolean numbers) {
- return random(count, start, end, letters, numbers, null, RANDOM);
- }
-
- /**
- *
Creates a random string based on a variety of options, using
- * default source of randomness.
- *
- *
This method has exactly the same semantics as
- * {@link #random(int,int,int,boolean,boolean,char[],Random)}, but
- * instead of using an externally supplied source of randomness, it uses
- * the internal static {@link Random} instance.
- *
- * @param count the length of random string to create
- * @param start the position in set of chars to start at
- * @param end the position in set of chars to end before
- * @param letters only allow letters?
- * @param numbers only allow numbers?
- * @param chars the set of chars to choose randoms from.
- * If {@code null}, then it will use the set of all chars.
- * @return the random string
- * @throws ArrayIndexOutOfBoundsException if there are not
- * {@code (end - start) + 1} characters in the set array.
- */
- public static String random(int count, int start, int end, boolean letters, boolean numbers, char... chars) {
- return random(count, start, end, letters, numbers, chars, RANDOM);
- }
-
- /**
- *
Creates a random string based on a variety of options, using
- * supplied source of randomness.
- *
- *
If start and end are both {@code 0}, start and end are set
- * to {@code ' '} and {@code 'z'}, the ASCII printable
- * characters, will be used, unless letters and numbers are both
- * {@code false}, in which case, start and end are set to
- * {@code 0} and {@code Integer.MAX_VALUE}.
- *
- *
If set is not {@code null}, characters between start and
- * end are chosen.
- *
- *
This method accepts a user-supplied {@link Random}
- * instance to use as a source of randomness. By seeding a single
- * {@link Random} instance with a fixed seed and using it for each call,
- * the same random sequence of strings can be generated repeatedly
- * and predictably.
- *
- * @param count the length of random string to create
- * @param start the position in set of chars to start at
- * @param end the position in set of chars to end before
- * @param letters only allow letters?
- * @param numbers only allow numbers?
- * @param chars the set of chars to choose randoms from.
- * If {@code null}, then it will use the set of all chars.
- * @param random a source of randomness.
- * @return the random string
- * @throws ArrayIndexOutOfBoundsException if there are not
- * {@code (end - start) + 1} characters in the set array.
- * @throws IllegalArgumentException if {@code count} < 0.
- * @since 2.0
- */
- public static String random(int count, int start, int end, boolean letters, boolean numbers,
- char[] chars, Random random) {
- if (count == 0) {
- return "";
- } else if (count < 0) {
- throw new IllegalArgumentException("Requested random string length " + count + " is less than 0.");
- }
- if (start == 0 && end == 0) {
- end = 'z' + 1;
- start = ' ';
- if (!letters && !numbers) {
- start = 0;
- end = Integer.MAX_VALUE;
- }
- }
-
- char[] buffer = new char[count];
- int gap = end - start;
-
- while (count-- != 0) {
- char ch;
- if (chars == null) {
- ch = (char) (random.nextInt(gap) + start);
- } else {
- ch = chars[random.nextInt(gap) + start];
- }
- if (letters && Character.isLetter(ch)
- || numbers && Character.isDigit(ch)
- || !letters && !numbers) {
- if(ch >= 56320 && ch <= 57343) {
- if(count == 0) {
- count++;
- } else {
- // low surrogate, insert high surrogate after putting it in
- buffer[count] = ch;
- count--;
- buffer[count] = (char) (55296 + random.nextInt(128));
- }
- } else if(ch >= 55296 && ch <= 56191) {
- if(count == 0) {
- count++;
- } else {
- // high surrogate, insert low surrogate before putting it in
- buffer[count] = (char) (56320 + random.nextInt(128));
- count--;
- buffer[count] = ch;
- }
- } else if(ch >= 56192 && ch <= 56319) {
- // private high surrogate, no effing clue, so skip it
- count++;
- } else {
- buffer[count] = ch;
- }
- } else {
- count++;
- }
- }
- return new String(buffer);
- }
-
- /**
- *
Creates a random string whose length is the number of characters
- * specified.
- *
- *
Characters will be chosen from the set of characters
- * specified.
- *
- * @param count the length of random string to create
- * @param chars the String containing the set of characters to use,
- * may be null
- * @return the random string
- * @throws IllegalArgumentException if {@code count} < 0.
- */
- public static String random(int count, String chars) {
- if (chars == null) {
- return random(count, 0, 0, false, false, null, RANDOM);
- }
- return random(count, chars.toCharArray());
- }
-
- /**
- *
Creates a random string whose length is the number of characters
- * specified.
- *
- *
Characters will be chosen from the set of characters specified.
- *
- * @param count the length of random string to create
- * @param chars the character array containing the set of characters to use,
- * may be null
- * @return the random string
- * @throws IllegalArgumentException if {@code count} < 0.
- */
- public static String random(int count, char... chars) {
- if (chars == null) {
- return random(count, 0, 0, false, false, null, RANDOM);
- }
- return random(count, 0, chars.length, false, false, chars, RANDOM);
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/Range.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/Range.java
deleted file mode 100644
index f3d43263..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/Range.java
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-/**
- *
An immutable range of objects from a minimum to maximum point inclusive.
- *
- *
The objects need to either be implementations of {@code Comparable}
- * or you need to supply a {@code Comparator}.
- *
- *
#ThreadSafe# if the objects and comparator are thread-safe
- *
- * @since 3.0
- * @version $Id: Range.java 1199894 2011-11-09 17:53:59Z ggregory $
- */
-public final class Range implements Serializable {
-
- /**
- * Serialization version.
- * @see java.io.Serializable
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * The ordering scheme used in this range.
- */
- private final Comparator comparator;
- /**
- * The minimum value in this range (inclusive).
- */
- private final T minimum;
- /**
- * The maximum value in this range (inclusive).
- */
- private final T maximum;
- /**
- * Cached output hashCode (class is immutable).
- */
- private transient int hashCode;
- /**
- * Cached output toString (class is immutable).
- */
- private transient String toString;
-
- /**
- *
Obtains a range using the specified element as both the minimum
- * and maximum in this range.
- *
- *
The range uses the natural ordering of the elements to determine where
- * values lie in the range.
- *
- * @param the type of the elements in this range
- * @param element the value to use for this range, not null
- * @return the range object, not null
- * @throws IllegalArgumentException if the element is null
- * @throws ClassCastException if the element is not {@code Comparable}
- */
- public static > Range is(T element) {
- return between(element, element, null);
- }
-
- /**
- *
Obtains a range using the specified element as both the minimum
- * and maximum in this range.
- *
- *
The range uses the specified {@code Comparator} to determine where
- * values lie in the range.
- *
- * @param the type of the elements in this range
- * @param element the value to use for this range, must not be {@code null}
- * @param comparator the comparator to be used, null for natural ordering
- * @return the range object, not null
- * @throws IllegalArgumentException if the element is null
- * @throws ClassCastException if using natural ordering and the elements are not {@code Comparable}
- */
- public static Range is(T element, Comparator comparator) {
- return between(element, element, comparator);
- }
-
- /**
- *
Obtains a range with the specified minimum and maximum values (both inclusive).
- *
- *
The range uses the natural ordering of the elements to determine where
- * values lie in the range.
- *
- *
The arguments may be passed in the order (min,max) or (max,min).
- * The getMinimum and getMaximum methods will return the correct values.
- *
- * @param the type of the elements in this range
- * @param fromInclusive the first value that defines the edge of the range, inclusive
- * @param toInclusive the second value that defines the edge of the range, inclusive
- * @return the range object, not null
- * @throws IllegalArgumentException if either element is null
- * @throws ClassCastException if the elements are not {@code Comparable}
- */
- public static > Range between(T fromInclusive, T toInclusive) {
- return between(fromInclusive, toInclusive, null);
- }
-
- /**
- *
Obtains a range with the specified minimum and maximum values (both inclusive).
- *
- *
The range uses the specified {@code Comparator} to determine where
- * values lie in the range.
- *
- *
The arguments may be passed in the order (min,max) or (max,min).
- * The getMinimum and getMaximum methods will return the correct values.
- *
- * @param the type of the elements in this range
- * @param fromInclusive the first value that defines the edge of the range, inclusive
- * @param toInclusive the second value that defines the edge of the range, inclusive
- * @param comparator the comparator to be used, null for natural ordering
- * @return the range object, not null
- * @throws IllegalArgumentException if either element is null
- * @throws ClassCastException if using natural ordering and the elements are not {@code Comparable}
- */
- public static Range between(T fromInclusive, T toInclusive, Comparator comparator) {
- return new Range(fromInclusive, toInclusive, comparator);
- }
-
- /**
- * Creates an instance.
- *
- * @param element1 the first element, not null
- * @param element2 the second element, not null
- * @param comparator the comparator to be used, null for natural ordering
- */
- @SuppressWarnings("unchecked")
- private Range(T element1, T element2, Comparator comparator) {
- if (element1 == null || element2 == null) {
- throw new IllegalArgumentException("Elements in a range must not be null: element1=" +
- element1 + ", element2=" + element2);
- }
- if (comparator == null) {
- comparator = ComparableComparator.INSTANCE;
- }
- if (comparator.compare(element1, element2) < 1) {
- this.minimum = element1;
- this.maximum = element2;
- } else {
- this.minimum = element2;
- this.maximum = element1;
- }
- this.comparator = comparator;
- }
-
- // Accessors
- //--------------------------------------------------------------------
-
- /**
- *
Gets the minimum value in this range.
- *
- * @return the minimum value in this range, not null
- */
- public T getMinimum() {
- return minimum;
- }
-
- /**
- *
Gets the maximum value in this range.
- *
- * @return the maximum value in this range, not null
- */
- public T getMaximum() {
- return maximum;
- }
-
- /**
- *
Gets the comparator being used to determine if objects are within the range.
- *
- *
Natural ordering uses an internal comparator implementation, thus this
- * method never returns null. See {@link #isNaturalOrdering()}.
- *
- * @return the comparator being used, not null
- */
- public Comparator getComparator() {
- return comparator;
- }
-
- /**
- *
Whether or not the Range is using the natural ordering of the elements.
- *
- *
Natural ordering uses an internal comparator implementation, thus this
- * method is the only way to check if a null comparator was specified.
- *
- * @return true if using natural ordering
- */
- public boolean isNaturalOrdering() {
- return comparator == ComparableComparator.INSTANCE;
- }
-
- // Element tests
- //--------------------------------------------------------------------
-
- /**
- *
Checks whether the specified element occurs within this range.
- *
- * @param element the element to check for, null returns false
- * @return true if the specified element occurs within this range
- */
- public boolean contains(T element) {
- if (element == null) {
- return false;
- }
- return comparator.compare(element, minimum) > -1 && comparator.compare(element, maximum) < 1;
- }
-
- /**
- *
Checks whether this range is after the specified element.
- *
- * @param element the element to check for, null returns false
- * @return true if this range is entirely after the specified element
- */
- public boolean isAfter(T element) {
- if (element == null) {
- return false;
- }
- return comparator.compare(element, minimum) < 0;
- }
-
- /**
- *
Checks whether this range starts with the specified element.
- *
- * @param element the element to check for, null returns false
- * @return true if the specified element occurs within this range
- */
- public boolean isStartedBy(T element) {
- if (element == null) {
- return false;
- }
- return comparator.compare(element, minimum) == 0;
- }
-
- /**
- *
Checks whether this range starts with the specified element.
- *
- * @param element the element to check for, null returns false
- * @return true if the specified element occurs within this range
- */
- public boolean isEndedBy(T element) {
- if (element == null) {
- return false;
- }
- return comparator.compare(element, maximum) == 0;
- }
-
- /**
- *
Checks whether this range is before the specified element.
- *
- * @param element the element to check for, null returns false
- * @return true if this range is entirely before the specified element
- */
- public boolean isBefore(T element) {
- if (element == null) {
- return false;
- }
- return comparator.compare(element, maximum) > 0;
- }
-
- /**
- *
Checks where the specified element occurs relative to this range.
- *
- *
The API is reminiscent of the Comparable interface returning {@code -1} if
- * the element is before the range, {@code 0} if contained within the range and
- * {@code 1} if the element is after the range.
- *
- * @param element the element to check for, not null
- * @return -1, 0 or +1 depending on the element's location relative to the range
- */
- public int elementCompareTo(T element) {
- if (element == null) {
- // Comparable API says throw NPE on null
- throw new NullPointerException("Element is null");
- }
- if (isAfter(element)) {
- return -1;
- } else if (isBefore(element)) {
- return 1;
- } else {
- return 0;
- }
- }
-
- // Range tests
- //--------------------------------------------------------------------
-
- /**
- *
Checks whether this range contains all the elements of the specified range.
- *
- *
This method may fail if the ranges have two different comparators or element types.
- *
- * @param otherRange the range to check, null returns false
- * @return true if this range contains the specified range
- * @throws RuntimeException if ranges cannot be compared
- */
- public boolean containsRange(Range otherRange) {
- if (otherRange == null) {
- return false;
- }
- return contains(otherRange.minimum)
- && contains(otherRange.maximum);
- }
-
- /**
- *
Checks whether this range is completely after the specified range.
- *
- *
This method may fail if the ranges have two different comparators or element types.
- *
- * @param otherRange the range to check, null returns false
- * @return true if this range is completely after the specified range
- * @throws RuntimeException if ranges cannot be compared
- */
- public boolean isAfterRange(Range otherRange) {
- if (otherRange == null) {
- return false;
- }
- return isAfter(otherRange.maximum);
- }
-
- /**
- *
Checks whether this range is overlapped by the specified range.
- *
- *
Two ranges overlap if there is at least one element in common.
- *
- *
This method may fail if the ranges have two different comparators or element types.
- *
- * @param otherRange the range to test, null returns false
- * @return true if the specified range overlaps with this
- * range; otherwise, {@code false}
- * @throws RuntimeException if ranges cannot be compared
- */
- public boolean isOverlappedBy(Range otherRange) {
- if (otherRange == null) {
- return false;
- }
- return otherRange.contains(minimum)
- || otherRange.contains(maximum)
- || contains(otherRange.minimum);
- }
-
- /**
- *
Checks whether this range is completely before the specified range.
- *
- *
This method may fail if the ranges have two different comparators or element types.
- *
- * @param otherRange the range to check, null returns false
- * @return true if this range is completely before the specified range
- * @throws RuntimeException if ranges cannot be compared
- */
- public boolean isBeforeRange(Range otherRange) {
- if (otherRange == null) {
- return false;
- }
- return isBefore(otherRange.minimum);
- }
-
- /**
- * Calculate the intersection of {@code this} and an overlapping Range.
- * @param other overlapping Range
- * @return range representing the intersection of {@code this} and {@code other} ({@code this} if equal)
- * @throws IllegalArgumentException if {@code other} does not overlap {@code this}
- * @since 3.0.1
- */
- public Range intersectionWith(Range other) {
- if (!this.isOverlappedBy(other)) {
- throw new IllegalArgumentException(String.format(
- "Cannot calculate intersection with non-overlapping range %s", other));
- }
- if (this.equals(other)) {
- return this;
- }
- T min = getComparator().compare(minimum, other.minimum) < 0 ? other.minimum : minimum;
- T max = getComparator().compare(maximum, other.maximum) < 0 ? maximum : other.maximum;
- return between(min, max, getComparator());
- }
-
- // Basics
- //--------------------------------------------------------------------
-
- /**
- *
Compares this range to another object to test if they are equal.
.
- *
- *
To be equal, the minimum and maximum values must be equal, which
- * ignores any differences in the comparator.
- *
- * @param obj the reference object with which to compare
- * @return true if this object is equal
- */
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj == null || obj.getClass() != getClass()) {
- return false;
- } else {
- @SuppressWarnings("unchecked") // OK because we checked the class above
- Range range = (Range) obj;
- return minimum.equals(range.minimum) &&
- maximum.equals(range.maximum);
- }
- }
-
- /**
- *
Gets a suitable hash code for the range.
- *
- * @return a hash code value for this object
- */
- @Override
- public int hashCode() {
- int result = hashCode;
- if (hashCode == 0) {
- result = 17;
- result = 37 * result + getClass().hashCode();
- result = 37 * result + minimum.hashCode();
- result = 37 * result + maximum.hashCode();
- hashCode = result;
- }
- return result;
- }
-
- /**
- *
Gets the range as a {@code String}.
- *
- *
The format of the String is '[min..max]'.
- *
- * @return the {@code String} representation of this range
- */
- @Override
- public String toString() {
- String result = toString;
- if (result == null) {
- StringBuilder buf = new StringBuilder(32);
- buf.append('[');
- buf.append(minimum);
- buf.append("..");
- buf.append(maximum);
- buf.append(']');
- result = buf.toString();
- toString = result;
- }
- return result;
- }
-
- /**
- *
Formats the receiver using the given format.
- *
- *
This uses {@link java.util.Formattable} to perform the formatting. Three variables may
- * be used to embed the minimum, maximum and comparator.
- * Use {@code %1$s} for the minimum element, {@code %2$s} for the maximum element
- * and {@code %3$s} for the comparator.
- * The default format used by {@code toString()} is {@code [%1$s..%2$s]}.
- *
- * @param format the format string, optionally containing {@code %1$s}, {@code %2$s} and {@code %3$s}, not null
- * @return the formatted string, not null
- */
- public String toString(String format) {
- return String.format(format, minimum, maximum, comparator);
- }
-
- //-----------------------------------------------------------------------
- @SuppressWarnings({"rawtypes", "unchecked"})
- private enum ComparableComparator implements Comparator {
- INSTANCE;
- /**
- * Comparable based compare implementation.
- *
- * @param obj1 left hand side of comparison
- * @param obj2 right hand side of comparison
- * @return negative, 0, positive comparison value
- */
- public int compare(Object obj1, Object obj2) {
- return ((Comparable) obj1).compareTo(obj2);
- }
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/SerializationException.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/SerializationException.java
deleted file mode 100644
index 9f4ee019..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/SerializationException.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-/**
- *
Exception thrown when the Serialization process fails.
- *
- *
The original error is wrapped within this one.
- *
- *
#NotThreadSafe# because Throwable is not threadsafe
Constructs a new {@code SerializationException} with specified
- * nested {@code Throwable}.
- *
- * @param cause The {@code Exception} or {@code Error}
- * that caused this exception to be thrown.
- */
- public SerializationException(Throwable cause) {
- super(cause);
- }
-
- /**
- *
Constructs a new {@code SerializationException} with specified
- * detail message and nested {@code Throwable}.
- *
- * @param msg The error message.
- * @param cause The {@code Exception} or {@code Error}
- * that caused this exception to be thrown.
- */
- public SerializationException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/SerializationUtils.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/SerializationUtils.java
deleted file mode 100644
index 3d85b93b..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/SerializationUtils.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.io.OutputStream;
-import java.io.Serializable;
-
-/**
- *
Assists with the serialization process and performs additional functionality based
- * on serialization.
- *
- *
- *
Deep clone using serialization
- *
Serialize managing finally and IOException
- *
Deserialize managing finally and IOException
- *
- *
- *
This class throws exceptions for invalid {@code null} inputs.
- * Each method documents its behaviour in more detail.
SerializationUtils instances should NOT be constructed in standard programming.
- * Instead, the class should be used as {@code SerializationUtils.clone(object)}.
- *
- *
This constructor is public to permit tools that require a JavaBean instance
- * to operate.
This is many times slower than writing clone methods by hand
- * on all objects in your object graph. However, for complex object
- * graphs, or for those that don't support deep cloning this can
- * be a simple alternative implementation. Of course all the objects
- * must be {@code Serializable}.
- *
- * @param the type of the object involved
- * @param object the {@code Serializable} object to clone
- * @return the cloned object
- * @throws SerializationException (runtime) if the serialization fails
- */
- public static T clone(T object) {
- if (object == null) {
- return null;
- }
- byte[] objectData = serialize(object);
- ByteArrayInputStream bais = new ByteArrayInputStream(objectData);
-
- ClassLoaderAwareObjectInputStream in = null;
- try {
- // stream closed in the finally
- in = new ClassLoaderAwareObjectInputStream(bais, object.getClass().getClassLoader());
- /*
- * when we serialize and deserialize an object,
- * it is reasonable to assume the deserialized object
- * is of the same type as the original serialized object
- */
- @SuppressWarnings("unchecked") // see above
- T readObject = (T) in.readObject();
- return readObject;
-
- } catch (ClassNotFoundException ex) {
- throw new SerializationException("ClassNotFoundException while reading cloned object data", ex);
- } catch (IOException ex) {
- throw new SerializationException("IOException while reading cloned object data", ex);
- } finally {
- try {
- if (in != null) {
- in.close();
- }
- } catch (IOException ex) {
- throw new SerializationException("IOException on closing cloned object data InputStream.", ex);
- }
- }
- }
-
- // Serialize
- //-----------------------------------------------------------------------
- /**
- *
Serializes an {@code Object} to the specified stream.
- *
- *
The stream will be closed once the object is written.
- * This avoids the need for a finally clause, and maybe also exception
- * handling, in the application code.
- *
- *
The stream passed in is not buffered internally within this method.
- * This is the responsibility of your application if desired.
- *
- * @param obj the object to serialize to bytes, may be null
- * @param outputStream the stream to write to, must not be null
- * @throws IllegalArgumentException if {@code outputStream} is {@code null}
- * @throws SerializationException (runtime) if the serialization fails
- */
- public static void serialize(Serializable obj, OutputStream outputStream) {
- if (outputStream == null) {
- throw new IllegalArgumentException("The OutputStream must not be null");
- }
- ObjectOutputStream out = null;
- try {
- // stream closed in the finally
- out = new ObjectOutputStream(outputStream);
- out.writeObject(obj);
-
- } catch (IOException ex) {
- throw new SerializationException(ex);
- } finally {
- try {
- if (out != null) {
- out.close();
- }
- } catch (IOException ex) { // NOPMD
- // ignore close exception
- }
- }
- }
-
- /**
- *
Serializes an {@code Object} to a byte array for
- * storage/serialization.
- *
- * @param obj the object to serialize to bytes
- * @return a byte[] with the converted Serializable
- * @throws SerializationException (runtime) if the serialization fails
- */
- public static byte[] serialize(Serializable obj) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
- serialize(obj, baos);
- return baos.toByteArray();
- }
-
- // Deserialize
- //-----------------------------------------------------------------------
- /**
- *
Deserializes an {@code Object} from the specified stream.
- *
- *
The stream will be closed once the object is written. This
- * avoids the need for a finally clause, and maybe also exception
- * handling, in the application code.
- *
- *
The stream passed in is not buffered internally within this method.
- * This is the responsibility of your application if desired.
- *
- * @param inputStream the serialized object input stream, must not be null
- * @return the deserialized object
- * @throws IllegalArgumentException if {@code inputStream} is {@code null}
- * @throws SerializationException (runtime) if the serialization fails
- */
- public static Object deserialize(InputStream inputStream) {
- if (inputStream == null) {
- throw new IllegalArgumentException("The InputStream must not be null");
- }
- ObjectInputStream in = null;
- try {
- // stream closed in the finally
- in = new ObjectInputStream(inputStream);
- return in.readObject();
-
- } catch (ClassNotFoundException ex) {
- throw new SerializationException(ex);
- } catch (IOException ex) {
- throw new SerializationException(ex);
- } finally {
- try {
- if (in != null) {
- in.close();
- }
- } catch (IOException ex) { // NOPMD
- // ignore close exception
- }
- }
- }
-
- /**
- *
Deserializes a single {@code Object} from an array of bytes.
- *
- * @param objectData the serialized object, must not be null
- * @return the deserialized object
- * @throws IllegalArgumentException if {@code objectData} is {@code null}
- * @throws SerializationException (runtime) if the serialization fails
- */
- public static Object deserialize(byte[] objectData) {
- if (objectData == null) {
- throw new IllegalArgumentException("The byte[] must not be null");
- }
- ByteArrayInputStream bais = new ByteArrayInputStream(objectData);
- return deserialize(bais);
- }
-
- /**
- *
Custom specialization of the standard JDK {@link java.io.ObjectInputStream}
- * that uses a custom ClassLoader to resolve a class.
- * If the specified ClassLoader is not able to resolve the class,
- * the context classloader of the current thread will be used.
- * This way, the standard deserialization work also in web-application
- * containers and application servers, no matter in which of the
- * ClassLoader the particular class that encapsulates
- * serialization/deserialization lives.
- *
- *
For more in-depth information about the problem for which this
- * class here is a workaround, see the JIRA issue LANG-626.
- */
- static class ClassLoaderAwareObjectInputStream extends ObjectInputStream {
- private ClassLoader classLoader;
-
- /**
- * Constructor.
- * @param in The InputStream.
- * @param classLoader classloader to use
- * @throws IOException if an I/O error occurs while reading stream header.
- * @see java.io.ObjectInputStream
- */
- public ClassLoaderAwareObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException {
- super(in);
- this.classLoader = classLoader;
- }
-
- /**
- * Overriden version that uses the parametrized ClassLoader or the ClassLoader
- * of the current Thread to resolve the class.
- * @param desc An instance of class ObjectStreamClass.
- * @return A Class object corresponding to desc.
- * @throws IOException Any of the usual Input/Output exceptions.
- * @throws ClassNotFoundException If class of a serialized object cannot be found.
- */
- @Override
- protected Class> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- String name = desc.getName();
- try {
- return Class.forName(name, false, classLoader);
- } catch (ClassNotFoundException ex) {
- return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
- }
- }
-
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/StringEscapeUtils.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/StringEscapeUtils.java
deleted file mode 100644
index 0524f923..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/StringEscapeUtils.java
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import external.org.apache.commons.lang3.text.translate.AggregateTranslator;
-import external.org.apache.commons.lang3.text.translate.CharSequenceTranslator;
-import external.org.apache.commons.lang3.text.translate.EntityArrays;
-import external.org.apache.commons.lang3.text.translate.LookupTranslator;
-import external.org.apache.commons.lang3.text.translate.NumericEntityUnescaper;
-import external.org.apache.commons.lang3.text.translate.OctalUnescaper;
-import external.org.apache.commons.lang3.text.translate.UnicodeEscaper;
-import external.org.apache.commons.lang3.text.translate.UnicodeUnescaper;
-
-/**
- *
Escapes and unescapes {@code String}s for
- * Java, Java Script, HTML and XML.
- *
- *
#ThreadSafe#
- * @since 2.0
- * @version $Id: StringEscapeUtils.java 1148520 2011-07-19 20:53:23Z ggregory $
- */
-public class StringEscapeUtils {
-
- /* ESCAPE TRANSLATORS */
-
- /**
- * Translator object for escaping Java.
- *
- * While {@link #escapeJava(String)} is the expected method of use, this
- * object allows the Java escaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator ESCAPE_JAVA =
- new LookupTranslator(
- new String[][] {
- {"\"", "\\\""},
- {"\\", "\\\\"},
- }).with(
- new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_ESCAPE())
- ).with(
- UnicodeEscaper.outsideOf(32, 0x7f)
- );
-
- /**
- * Translator object for escaping EcmaScript/JavaScript.
- *
- * While {@link #escapeEcmaScript(String)} is the expected method of use, this
- * object allows the EcmaScript escaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator ESCAPE_ECMASCRIPT =
- new AggregateTranslator(
- new LookupTranslator(
- new String[][] {
- {"'", "\\'"},
- {"\"", "\\\""},
- {"\\", "\\\\"},
- {"/", "\\/"}
- }),
- new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_ESCAPE()),
- UnicodeEscaper.outsideOf(32, 0x7f)
- );
-
- /**
- * Translator object for escaping XML.
- *
- * While {@link #escapeXml(String)} is the expected method of use, this
- * object allows the XML escaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator ESCAPE_XML =
- new AggregateTranslator(
- new LookupTranslator(EntityArrays.BASIC_ESCAPE()),
- new LookupTranslator(EntityArrays.APOS_ESCAPE())
- );
-
- /**
- * Translator object for escaping HTML version 3.0.
- *
- * While {@link #escapeHtml3(String)} is the expected method of use, this
- * object allows the HTML escaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator ESCAPE_HTML3 =
- new AggregateTranslator(
- new LookupTranslator(EntityArrays.BASIC_ESCAPE()),
- new LookupTranslator(EntityArrays.ISO8859_1_ESCAPE())
- );
-
- /**
- * Translator object for escaping HTML version 4.0.
- *
- * While {@link #escapeHtml4(String)} is the expected method of use, this
- * object allows the HTML escaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator ESCAPE_HTML4 =
- new AggregateTranslator(
- new LookupTranslator(EntityArrays.BASIC_ESCAPE()),
- new LookupTranslator(EntityArrays.ISO8859_1_ESCAPE()),
- new LookupTranslator(EntityArrays.HTML40_EXTENDED_ESCAPE())
- );
-
- /**
- * Translator object for escaping individual Comma Separated Values.
- *
- * While {@link #escapeCsv(String)} is the expected method of use, this
- * object allows the CSV escaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator ESCAPE_CSV = new CsvEscaper();
-
- // TODO: Create a parent class - 'SinglePassTranslator' ?
- // It would handle the index checking + length returning,
- // and could also have an optimization check method.
- static class CsvEscaper extends CharSequenceTranslator {
-
- private static final char CSV_DELIMITER = ',';
- private static final char CSV_QUOTE = '"';
- private static final String CSV_QUOTE_STR = String.valueOf(CSV_QUOTE);
- private static final char[] CSV_SEARCH_CHARS =
- new char[] {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
-
- @Override
- public int translate(CharSequence input, int index, Writer out) throws IOException {
-
- if(index != 0) {
- throw new IllegalStateException("CsvEscaper should never reach the [1] index");
- }
-
- if (StringUtils.containsNone(input.toString(), CSV_SEARCH_CHARS)) {
- out.write(input.toString());
- } else {
- out.write(CSV_QUOTE);
- out.write(StringUtils.replace(input.toString(), CSV_QUOTE_STR, CSV_QUOTE_STR + CSV_QUOTE_STR));
- out.write(CSV_QUOTE);
- }
- return input.length();
- }
- }
-
- /* UNESCAPE TRANSLATORS */
-
- /**
- * Translator object for unescaping escaped Java.
- *
- * While {@link #unescapeJava(String)} is the expected method of use, this
- * object allows the Java unescaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- // TODO: throw "illegal character: \92" as an Exception if a \ on the end of the Java (as per the compiler)?
- public static final CharSequenceTranslator UNESCAPE_JAVA =
- new AggregateTranslator(
- new OctalUnescaper(), // .between('\1', '\377'),
- new UnicodeUnescaper(),
- new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_UNESCAPE()),
- new LookupTranslator(
- new String[][] {
- {"\\\\", "\\"},
- {"\\\"", "\""},
- {"\\'", "'"},
- {"\\", ""}
- })
- );
-
- /**
- * Translator object for unescaping escaped EcmaScript.
- *
- * While {@link #unescapeEcmaScript(String)} is the expected method of use, this
- * object allows the EcmaScript unescaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator UNESCAPE_ECMASCRIPT = UNESCAPE_JAVA;
-
- /**
- * Translator object for unescaping escaped HTML 3.0.
- *
- * While {@link #unescapeHtml3(String)} is the expected method of use, this
- * object allows the HTML unescaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator UNESCAPE_HTML3 =
- new AggregateTranslator(
- new LookupTranslator(EntityArrays.BASIC_UNESCAPE()),
- new LookupTranslator(EntityArrays.ISO8859_1_UNESCAPE()),
- new NumericEntityUnescaper()
- );
-
- /**
- * Translator object for unescaping escaped HTML 4.0.
- *
- * While {@link #unescapeHtml4(String)} is the expected method of use, this
- * object allows the HTML unescaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator UNESCAPE_HTML4 =
- new AggregateTranslator(
- new LookupTranslator(EntityArrays.BASIC_UNESCAPE()),
- new LookupTranslator(EntityArrays.ISO8859_1_UNESCAPE()),
- new LookupTranslator(EntityArrays.HTML40_EXTENDED_UNESCAPE()),
- new NumericEntityUnescaper()
- );
-
- /**
- * Translator object for unescaping escaped XML.
- *
- * While {@link #unescapeXml(String)} is the expected method of use, this
- * object allows the XML unescaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator UNESCAPE_XML =
- new AggregateTranslator(
- new LookupTranslator(EntityArrays.BASIC_UNESCAPE()),
- new LookupTranslator(EntityArrays.APOS_UNESCAPE()),
- new NumericEntityUnescaper()
- );
-
- /**
- * Translator object for unescaping escaped Comma Separated Value entries.
- *
- * While {@link #unescapeCsv(String)} is the expected method of use, this
- * object allows the CSV unescaping functionality to be used
- * as the foundation for a custom translator.
- *
- * @since 3.0
- */
- public static final CharSequenceTranslator UNESCAPE_CSV = new CsvUnescaper();
-
- static class CsvUnescaper extends CharSequenceTranslator {
-
- private static final char CSV_DELIMITER = ',';
- private static final char CSV_QUOTE = '"';
- private static final String CSV_QUOTE_STR = String.valueOf(CSV_QUOTE);
- private static final char[] CSV_SEARCH_CHARS =
- new char[] {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
-
- @Override
- public int translate(CharSequence input, int index, Writer out) throws IOException {
-
- if(index != 0) {
- throw new IllegalStateException("CsvUnescaper should never reach the [1] index");
- }
-
- if ( input.charAt(0) != CSV_QUOTE || input.charAt(input.length() - 1) != CSV_QUOTE ) {
- out.write(input.toString());
- return input.length();
- }
-
- // strip quotes
- String quoteless = input.subSequence(1, input.length() - 1).toString();
-
- if ( StringUtils.containsAny(quoteless, CSV_SEARCH_CHARS) ) {
- // deal with escaped quotes; ie) ""
- out.write(StringUtils.replace(quoteless, CSV_QUOTE_STR + CSV_QUOTE_STR, CSV_QUOTE_STR));
- } else {
- out.write(input.toString());
- }
- return input.length();
- }
- }
-
- /* Helper functions */
-
- /**
- *
{@code StringEscapeUtils} instances should NOT be constructed in
- * standard programming.
- *
- *
Instead, the class should be used as:
- *
StringEscapeUtils.escapeJava("foo");
- *
- *
This constructor is public to permit tools that require a JavaBean
- * instance to operate.
Escapes the characters in a {@code String} using Java String rules.
- *
- *
Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.)
- *
- *
So a tab becomes the characters {@code '\\'} and
- * {@code 't'}.
- *
- *
The only difference between Java strings and JavaScript strings
- * is that in JavaScript, a single quote and forward-slash (/) are escaped.
- *
- *
Example:
- *
- * input string: He didn't say, "Stop!"
- * output string: He didn't say, \"Stop!\"
- *
- *
- *
- * @param input String to escape values in, may be null
- * @return String with escaped values, {@code null} if null string input
- */
- public static final String escapeJava(String input) {
- return ESCAPE_JAVA.translate(input);
- }
-
- /**
- *
Escapes the characters in a {@code String} using EcmaScript String rules.
- *
Escapes any values it finds into their EcmaScript String form.
- * Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.)
- *
- *
So a tab becomes the characters {@code '\\'} and
- * {@code 't'}.
- *
- *
The only difference between Java strings and EcmaScript strings
- * is that in EcmaScript, a single quote and forward-slash (/) are escaped.
- *
- *
Note that EcmaScript is best known by the JavaScript and ActionScript dialects.
- *
- *
Example:
- *
- * input string: He didn't say, "Stop!"
- * output string: He didn\'t say, \"Stop!\"
- *
- *
- *
- * @param input String to escape values in, may be null
- * @return String with escaped values, {@code null} if null string input
- *
- * @since 3.0
- */
- public static final String escapeEcmaScript(String input) {
- return ESCAPE_ECMASCRIPT.translate(input);
- }
-
- /**
- *
Unescapes any Java literals found in the {@code String}.
- * For example, it will turn a sequence of {@code '\'} and
- * {@code 'n'} into a newline character, unless the {@code '\'}
- * is preceded by another {@code '\'}.
- *
- * @param input the {@code String} to unescape, may be null
- * @return a new unescaped {@code String}, {@code null} if null string input
- */
- public static final String unescapeJava(String input) {
- return UNESCAPE_JAVA.translate(input);
- }
-
- /**
- *
Unescapes any EcmaScript literals found in the {@code String}.
- *
- *
For example, it will turn a sequence of {@code '\'} and {@code 'n'}
- * into a newline character, unless the {@code '\'} is preceded by another
- * {@code '\'}.
- *
- * @see #unescapeJava(String)
- * @param input the {@code String} to unescape, may be null
- * @return A new unescaped {@code String}, {@code null} if null string input
- *
- * @since 3.0
- */
- public static final String unescapeEcmaScript(String input) {
- return UNESCAPE_ECMASCRIPT.translate(input);
- }
-
- // HTML and XML
- //--------------------------------------------------------------------------
- /**
- *
Escapes the characters in a {@code String} using HTML entities.
- *
- *
- * For example:
- *
- *
"bread" & "butter"
- * becomes:
- *
- * "bread" & "butter".
- *
- *
- *
Supports all known HTML 4.0 entities, including funky accents.
- * Note that the commonly used apostrophe escape character (')
- * is not a legal entity and so is not supported).
Escapes the characters in a {@code String} using HTML entities.
- *
Supports only the HTML 3.0 entities.
- *
- * @param input the {@code String} to escape, may be null
- * @return a new escaped {@code String}, {@code null} if null string input
- *
- * @since 3.0
- */
- public static final String escapeHtml3(String input) {
- return ESCAPE_HTML3.translate(input);
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Unescapes a string containing entity escapes to a string
- * containing the actual Unicode characters corresponding to the
- * escapes. Supports HTML 4.0 entities.
- *
- *
For example, the string "<Français>"
- * will become "<Français>"
- *
- *
If an entity is unrecognized, it is left alone, and inserted
- * verbatim into the result string. e.g. ">&zzzz;x" will
- * become ">&zzzz;x".
- *
- * @param input the {@code String} to unescape, may be null
- * @return a new unescaped {@code String}, {@code null} if null string input
- *
- * @since 3.0
- */
- public static final String unescapeHtml4(String input) {
- return UNESCAPE_HTML4.translate(input);
- }
-
- /**
- *
Unescapes a string containing entity escapes to a string
- * containing the actual Unicode characters corresponding to the
- * escapes. Supports only HTML 3.0 entities.
- *
- * @param input the {@code String} to unescape, may be null
- * @return a new unescaped {@code String}, {@code null} if null string input
- *
- * @since 3.0
- */
- public static final String unescapeHtml3(String input) {
- return UNESCAPE_HTML3.translate(input);
- }
-
- //-----------------------------------------------------------------------
- /**
- *
Escapes the characters in a {@code String} using XML entities.
- *
- *
For example: "bread" & "butter" =>
- * "bread" & "butter".
- *
- *
- *
Supports only the five basic XML entities (gt, lt, quot, amp, apos).
- * Does not support DTDs or external entities.
- *
- *
Note that Unicode characters greater than 0x7f are as of 3.0, no longer
- * escaped. If you still wish this functionality, you can achieve it
- * via the following:
- * {@code StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );}
- *
- * @param input the {@code String} to escape, may be null
- * @return a new escaped {@code String}, {@code null} if null string input
- * @see #unescapeXml(java.lang.String)
- */
- public static final String escapeXml(String input) {
- return ESCAPE_XML.translate(input);
- }
-
-
- //-----------------------------------------------------------------------
- /**
- *
Unescapes a string containing XML entity escapes to a string
- * containing the actual Unicode characters corresponding to the
- * escapes.
- *
- *
Supports only the five basic XML entities (gt, lt, quot, amp, apos).
- * Does not support DTDs or external entities.
- *
- *
Note that numerical \\u Unicode codes are unescaped to their respective
- * Unicode characters. This may change in future releases.
- *
- * @param input the {@code String} to unescape, may be null
- * @return a new unescaped {@code String}, {@code null} if null string input
- * @see #escapeXml(String)
- */
- public static final String unescapeXml(String input) {
- return UNESCAPE_XML.translate(input);
- }
-
-
- //-----------------------------------------------------------------------
-
- /**
- *
Returns a {@code String} value for a CSV column enclosed in double quotes,
- * if required.
- *
- *
If the value contains a comma, newline or double quote, then the
- * String value is returned enclosed in double quotes.
- *
- *
- *
Any double quote characters in the value are escaped with another double quote.
- *
- *
If the value does not contain a comma, newline or double quote, then the
- * String value is returned unchanged.
- *
- *
- * see Wikipedia and
- * RFC 4180.
- *
- * @param input the input CSV column String, may be null
- * @return the input String, enclosed in double quotes if the value contains a comma,
- * newline or double quote, {@code null} if null string input
- * @since 2.4
- */
- public static final String escapeCsv(String input) {
- return ESCAPE_CSV.translate(input);
- }
-
- /**
- *
Returns a {@code String} value for an unescaped CSV column.
- *
- *
If the value is enclosed in double quotes, and contains a comma, newline
- * or double quote, then quotes are removed.
- *
- *
- *
Any double quote escaped characters (a pair of double quotes) are unescaped
- * to just one double quote.
- *
- *
If the value is not enclosed in double quotes, or is and does not contain a
- * comma, newline or double quote, then the String value is returned unchanged.
- *
- *
- * see Wikipedia and
- * RFC 4180.
- *
- * @param input the input CSV column String, may be null
- * @return the input String, with enclosing double quotes removed and embedded double
- * quotes unescaped, {@code null} if null string input
- * @since 2.4
- */
- public static final String unescapeCsv(String input) {
- return UNESCAPE_CSV.translate(input);
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/builder/StandardToStringStyle.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/builder/StandardToStringStyle.java
deleted file mode 100644
index d55790a0..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/builder/StandardToStringStyle.java
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.builder;
-
-/**
- *
Works with {@link ToStringBuilder} to create a toString.
- *
- *
This class is intended to be used as a singleton.
- * There is no need to instantiate a new style each time.
- * Simply instantiate the class once, customize the values as required, and
- * store the result in a public static final variable for the rest of the
- * program to access.
- *
- * @return the current useClassName flag
- */
- @Override
- public boolean isUseClassName() { // NOPMD as this is implementing the abstract class
- return super.isUseClassName();
- }
-
- /**
- *
Sets whether to use the class name.
- *
- * @param useClassName the new useClassName flag
- */
- @Override
- public void setUseClassName(boolean useClassName) { // NOPMD as this is implementing the abstract class
- super.setUseClassName(useClassName);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets whether to output short or long class names.
- *
- * @return the current useShortClassName flag
- * @since 2.0
- */
- @Override
- public boolean isUseShortClassName() { // NOPMD as this is implementing the abstract class
- return super.isUseShortClassName();
- }
-
- /**
- *
Sets whether to output short or long class names.
- *
- * @param useShortClassName the new useShortClassName flag
- * @since 2.0
- */
- @Override
- public void setUseShortClassName(boolean useShortClassName) { // NOPMD as this is implementing the abstract class
- super.setUseShortClassName(useShortClassName);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets whether to use the identity hash code.
- * @return the current useIdentityHashCode flag
- */
- @Override
- public boolean isUseIdentityHashCode() { // NOPMD as this is implementing the abstract class
- return super.isUseIdentityHashCode();
- }
-
- /**
- *
Sets whether to use the identity hash code.
- *
- * @param useIdentityHashCode the new useIdentityHashCode flag
- */
- @Override
- public void setUseIdentityHashCode(boolean useIdentityHashCode) { // NOPMD as this is implementing the abstract class
- super.setUseIdentityHashCode(useIdentityHashCode);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets whether to use the field names passed in.
- *
- * @return the current useFieldNames flag
- */
- @Override
- public boolean isUseFieldNames() { // NOPMD as this is implementing the abstract class
- return super.isUseFieldNames();
- }
-
- /**
- *
Sets whether to use the field names passed in.
- *
- * @param useFieldNames the new useFieldNames flag
- */
- @Override
- public void setUseFieldNames(boolean useFieldNames) { // NOPMD as this is implementing the abstract class
- super.setUseFieldNames(useFieldNames);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets whether to use full detail when the caller doesn't
- * specify.
- *
- * @return the current defaultFullDetail flag
- */
- @Override
- public boolean isDefaultFullDetail() { // NOPMD as this is implementing the abstract class
- return super.isDefaultFullDetail();
- }
-
- /**
- *
Sets whether to use full detail when the caller doesn't
- * specify.
- *
- * @param defaultFullDetail the new defaultFullDetail flag
- */
- @Override
- public void setDefaultFullDetail(boolean defaultFullDetail) { // NOPMD as this is implementing the abstract class
- super.setDefaultFullDetail(defaultFullDetail);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets whether to output array content detail.
- *
- * @return the current array content detail setting
- */
- @Override
- public boolean isArrayContentDetail() { // NOPMD as this is implementing the abstract class
- return super.isArrayContentDetail();
- }
-
- /**
- *
Sets whether to output array content detail.
- *
- * @param arrayContentDetail the new arrayContentDetail flag
- */
- @Override
- public void setArrayContentDetail(boolean arrayContentDetail) { // NOPMD as this is implementing the abstract class
- super.setArrayContentDetail(arrayContentDetail);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the array start text.
- *
- * @return the current array start text
- */
- @Override
- public String getArrayStart() { // NOPMD as this is implementing the abstract class
- return super.getArrayStart();
- }
-
- /**
- *
Sets the array start text.
- *
- *
null is accepted, but will be converted
- * to an empty String.
- *
- * @param arrayStart the new array start text
- */
- @Override
- public void setArrayStart(String arrayStart) { // NOPMD as this is implementing the abstract class
- super.setArrayStart(arrayStart);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the array end text.
- *
- * @return the current array end text
- */
- @Override
- public String getArrayEnd() { // NOPMD as this is implementing the abstract class
- return super.getArrayEnd();
- }
-
- /**
- *
Sets the array end text.
- *
- *
null is accepted, but will be converted
- * to an empty String.
- *
- * @param arrayEnd the new array end text
- */
- @Override
- public void setArrayEnd(String arrayEnd) { // NOPMD as this is implementing the abstract class
- super.setArrayEnd(arrayEnd);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the array separator text.
- *
- * @return the current array separator text
- */
- @Override
- public String getArraySeparator() { // NOPMD as this is implementing the abstract class
- return super.getArraySeparator();
- }
-
- /**
- *
Sets the array separator text.
- *
- *
null is accepted, but will be converted
- * to an empty String.
- *
- * @param arraySeparator the new array separator text
- */
- @Override
- public void setArraySeparator(String arraySeparator) { // NOPMD as this is implementing the abstract class
- super.setArraySeparator(arraySeparator);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the content start text.
- *
- * @return the current content start text
- */
- @Override
- public String getContentStart() { // NOPMD as this is implementing the abstract class
- return super.getContentStart();
- }
-
- /**
- *
Sets the content start text.
- *
- *
null is accepted, but will be converted
- * to an empty String.
- *
- * @param contentStart the new content start text
- */
- @Override
- public void setContentStart(String contentStart) { // NOPMD as this is implementing the abstract class
- super.setContentStart(contentStart);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the content end text.
- *
- * @return the current content end text
- */
- @Override
- public String getContentEnd() { // NOPMD as this is implementing the abstract class
- return super.getContentEnd();
- }
-
- /**
- *
Sets the content end text.
- *
- *
null is accepted, but will be converted
- * to an empty String.
- *
- * @param contentEnd the new content end text
- */
- @Override
- public void setContentEnd(String contentEnd) { // NOPMD as this is implementing the abstract class
- super.setContentEnd(contentEnd);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the field name value separator text.
- *
- * @return the current field name value separator text
- */
- @Override
- public String getFieldNameValueSeparator() { // NOPMD as this is implementing the abstract class
- return super.getFieldNameValueSeparator();
- }
-
- /**
- *
Sets the field name value separator text.
- *
- *
null is accepted, but will be converted
- * to an empty String.
- *
- * @param fieldNameValueSeparator the new field name value separator text
- */
- @Override
- public void setFieldNameValueSeparator(String fieldNameValueSeparator) { // NOPMD as this is implementing the abstract class
- super.setFieldNameValueSeparator(fieldNameValueSeparator);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the field separator text.
- *
- * @return the current field separator text
- */
- @Override
- public String getFieldSeparator() { // NOPMD as this is implementing the abstract class
- return super.getFieldSeparator();
- }
-
- /**
- *
Sets the field separator text.
- *
- *
null is accepted, but will be converted
- * to an empty String.
- *
- * @param fieldSeparator the new field separator text
- */
- @Override
- public void setFieldSeparator(String fieldSeparator) { // NOPMD as this is implementing the abstract class
- super.setFieldSeparator(fieldSeparator);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets whether the field separator should be added at the start
- * of each buffer.
- *
- * @return the fieldSeparatorAtStart flag
- * @since 2.0
- */
- @Override
- public boolean isFieldSeparatorAtStart() { // NOPMD as this is implementing the abstract class
- return super.isFieldSeparatorAtStart();
- }
-
- /**
- *
Sets whether the field separator should be added at the start
- * of each buffer.
- *
- * @param fieldSeparatorAtStart the fieldSeparatorAtStart flag
- * @since 2.0
- */
- @Override
- public void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart) { // NOPMD as this is implementing the abstract class
- super.setFieldSeparatorAtStart(fieldSeparatorAtStart);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets whether the field separator should be added at the end
- * of each buffer.
- *
- * @return fieldSeparatorAtEnd flag
- * @since 2.0
- */
- @Override
- public boolean isFieldSeparatorAtEnd() { // NOPMD as this is implementing the abstract class
- return super.isFieldSeparatorAtEnd();
- }
-
- /**
- *
Sets whether the field separator should be added at the end
- * of each buffer.
- *
- * @param fieldSeparatorAtEnd the fieldSeparatorAtEnd flag
- * @since 2.0
- */
- @Override
- public void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd) { // NOPMD as this is implementing the abstract class
- super.setFieldSeparatorAtEnd(fieldSeparatorAtEnd);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the text to output when null found.
- *
- * @return the current text to output when null found
- */
- @Override
- public String getNullText() { // NOPMD as this is implementing the abstract class
- return super.getNullText();
- }
-
- /**
- *
Sets the text to output when null found.
- *
- *
null is accepted, but will be converted
- * to an empty String.
- *
- * @param nullText the new text to output when null found
- */
- @Override
- public void setNullText(String nullText) { // NOPMD as this is implementing the abstract class
- super.setNullText(nullText);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the text to output when a Collection,
- * Map or Array size is output.
- *
- *
This is output before the size value.
- *
- * @return the current start of size text
- */
- @Override
- public String getSizeStartText() { // NOPMD as this is implementing the abstract class
- return super.getSizeStartText();
- }
-
- /**
- *
Sets the start text to output when a Collection,
- * Map or Array size is output.
- *
- *
This is output before the size value.
- *
- *
null is accepted, but will be converted to
- * an empty String.
- *
- * @param sizeStartText the new start of size text
- */
- @Override
- public void setSizeStartText(String sizeStartText) { // NOPMD as this is implementing the abstract class
- super.setSizeStartText(sizeStartText);
- }
-
- //---------------------------------------------------------------------
-
- /**
- * Gets the end text to output when a Collection,
- * Map or Array size is output.
- *
- *
This is output after the size value.
- *
- * @return the current end of size text
- */
- @Override
- public String getSizeEndText() { // NOPMD as this is implementing the abstract class
- return super.getSizeEndText();
- }
-
- /**
- *
Sets the end text to output when a Collection,
- * Map or Array size is output.
- *
- *
This is output after the size value.
- *
- *
null is accepted, but will be converted
- * to an empty String.
- *
- * @param sizeEndText the new end of size text
- */
- @Override
- public void setSizeEndText(String sizeEndText) { // NOPMD as this is implementing the abstract class
- super.setSizeEndText(sizeEndText);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the start text to output when an Object is
- * output in summary mode.
- *
- *
This is output before the size value.
- *
- * @return the current start of summary text
- */
- @Override
- public String getSummaryObjectStartText() { // NOPMD as this is implementing the abstract class
- return super.getSummaryObjectStartText();
- }
-
- /**
- *
Sets the start text to output when an Object is
- * output in summary mode.
- *
- *
This is output before the size value.
- *
- *
null is accepted, but will be converted to
- * an empty String.
- *
- * @param summaryObjectStartText the new start of summary text
- */
- @Override
- public void setSummaryObjectStartText(String summaryObjectStartText) { // NOPMD as this is implementing the abstract class
- super.setSummaryObjectStartText(summaryObjectStartText);
- }
-
- //---------------------------------------------------------------------
-
- /**
- *
Gets the end text to output when an Object is
- * output in summary mode.
- *
- *
This is output after the size value.
- *
- * @return the current end of summary text
- */
- @Override
- public String getSummaryObjectEndText() { // NOPMD as this is implementing the abstract class
- return super.getSummaryObjectEndText();
- }
-
- /**
- *
Sets the end text to output when an Object is
- * output in summary mode.
- *
- *
This is output after the size value.
- *
- *
null is accepted, but will be converted to
- * an empty String.
- *
- * @param summaryObjectEndText the new end of summary text
- */
- @Override
- public void setSummaryObjectEndText(String summaryObjectEndText) { // NOPMD as this is implementing the abstract class
- super.setSummaryObjectEndText(summaryObjectEndText);
- }
-
- //---------------------------------------------------------------------
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/AtomicInitializer.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/AtomicInitializer.java
deleted file mode 100644
index 5359b2b9..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/AtomicInitializer.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- *
- * A specialized implementation of the {@code ConcurrentInitializer} interface
- * based on an {@link AtomicReference} variable.
- *
- *
- * This class maintains a member field of type {@code AtomicReference}. It
- * implements the following algorithm to create and initialize an object in its
- * {@link #get()} method:
- *
- *
First it is checked whether the {@code AtomicReference} variable contains
- * already a value. If this is the case, the value is directly returned.
- *
Otherwise the {@link #initialize()} method is called. This method must be
- * defined in concrete subclasses to actually create the managed object.
- *
After the object was created by {@link #initialize()} it is checked
- * whether the {@code AtomicReference} variable is still undefined. This has to
- * be done because in the meantime another thread may have initialized the
- * object. If the reference is still empty, the newly created object is stored
- * in it and returned by this method.
- *
Otherwise the value stored in the {@code AtomicReference} is returned.
- *
- *
- *
- * Because atomic variables are used this class does not need any
- * synchronization. So there is no danger of deadlock, and access to the managed
- * object is efficient. However, if multiple threads access the {@code
- * AtomicInitializer} object before it has been initialized almost at the same
- * time, it can happen that {@link #initialize()} is called multiple times. The
- * algorithm outlined above guarantees that {@link #get()} always returns the
- * same object though.
- *
- *
- * Compared with the {@link LazyInitializer} class, this class can be more
- * efficient because it does not need synchronization. The drawback is that the
- * {@link #initialize()} method can be called multiple times which may be
- * problematic if the creation of the managed object is expensive. As a rule of
- * thumb this initializer implementation is preferable if there are not too many
- * threads involved and the probability that multiple threads access an
- * uninitialized object is small. If there is high parallelism,
- * {@link LazyInitializer} is more appropriate.
- *
- *
- * @since 3.0
- * @version $Id: AtomicInitializer.java 1088899 2011-04-05 05:31:27Z bayard $
- * @param the type of the object managed by this initializer class
- */
-public abstract class AtomicInitializer implements ConcurrentInitializer {
- /** Holds the reference to the managed object. */
- private final AtomicReference reference = new AtomicReference();
-
- /**
- * Returns the object managed by this initializer. The object is created if
- * it is not available yet and stored internally. This method always returns
- * the same object.
- *
- * @return the object created by this {@code AtomicInitializer}
- * @throws ConcurrentException if an error occurred during initialization of
- * the object
- */
- public T get() throws ConcurrentException {
- T result = reference.get();
-
- if (result == null) {
- result = initialize();
- if (!reference.compareAndSet(null, result)) {
- // another thread has initialized the reference
- result = reference.get();
- }
- }
-
- return result;
- }
-
- /**
- * Creates and initializes the object managed by this {@code
- * AtomicInitializer}. This method is called by {@link #get()} when the
- * managed object is not available yet. An implementation can focus on the
- * creation of the object. No synchronization is needed, as this is already
- * handled by {@code get()}. As stated by the class comment, it is possible
- * that this method is called multiple times.
- *
- * @return the managed data object
- * @throws ConcurrentException if an error occurs during object creation
- */
- protected abstract T initialize() throws ConcurrentException;
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java
deleted file mode 100644
index a8c31c2d..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- *
- * A specialized {@code ConcurrentInitializer} implementation which is similar
- * to {@link AtomicInitializer}, but ensures that the {@link #initialize()}
- * method is called only once.
- *
- *
- * As {@link AtomicInitializer} this class is based on atomic variables, so it
- * can create an object under concurrent access without synchronization.
- * However, it implements an additional check to guarantee that the
- * {@link #initialize()} method which actually creates the object cannot be
- * called multiple times.
- *
- *
- * Because of this additional check this implementation is slightly less
- * efficient than {@link AtomicInitializer}, but if the object creation in the
- * {@code initialize()} method is expensive or if multiple invocations of
- * {@code initialize()} are problematic, it is the better alternative.
- *
- *
- * From its semantics this class has the same properties as
- * {@link LazyInitializer}. It is a "save" implementation of the lazy
- * initializer pattern. Comparing both classes in terms of efficiency is
- * difficult because which one is faster depends on multiple factors. Because
- * {@code AtomicSafeInitializer} does not use synchronization at all it probably
- * outruns {@link LazyInitializer}, at least under low or moderate concurrent
- * access. Developers should run their own benchmarks on the expected target
- * platform to decide which implementation is suitable for their specific use
- * case.
- *
- *
- * @since 3.0
- * @version $Id: AtomicSafeInitializer.java 1088899 2011-04-05 05:31:27Z bayard $
- * @param the type of the object managed by this initializer class
- */
-public abstract class AtomicSafeInitializer implements
- ConcurrentInitializer {
- /** A guard which ensures that initialize() is called only once. */
- private final AtomicReference> factory =
- new AtomicReference>();
-
- /** Holds the reference to the managed object. */
- private final AtomicReference reference = new AtomicReference();
-
- /**
- * Get (and initialize, if not initialized yet) the required object
- *
- * @return lazily initialized object
- * @throws ConcurrentException if the initialization of the object causes an
- * exception
- */
- public final T get() throws ConcurrentException {
- T result;
-
- while ((result = reference.get()) == null) {
- if (factory.compareAndSet(null, this)) {
- reference.set(initialize());
- }
- }
-
- return result;
- }
-
- /**
- * Creates and initializes the object managed by this
- * {@code AtomicInitializer}. This method is called by {@link #get()} when
- * the managed object is not available yet. An implementation can focus on
- * the creation of the object. No synchronization is needed, as this is
- * already handled by {@code get()}. This method is guaranteed to be called
- * only once.
- *
- * @return the managed data object
- * @throws ConcurrentException if an error occurs during object creation
- */
- protected abstract T initialize() throws ConcurrentException;
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/BackgroundInitializer.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
deleted file mode 100644
index f43d06e0..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/BackgroundInitializer.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-/**
- *
- * A class that allows complex initialization operations in a background task.
- *
- *
- * Applications often have to do some expensive initialization steps when they
- * are started, e.g. constructing a connection to a database, reading a
- * configuration file, etc. Doing these things in parallel can enhance
- * performance as the CPU load can be improved. However, when access to the
- * resources initialized in a background thread is actually required,
- * synchronization has to be performed to ensure that their initialization is
- * complete.
- *
- *
- * This abstract base class provides support for this use case. A concrete
- * subclass must implement the {@link #initialize()} method. Here an arbitrary
- * initialization can be implemented, and a result object can be returned. With
- * this method in place the basic usage of this class is as follows (where
- * {@code MyBackgroundInitializer} is a concrete subclass):
- *
- *
- * MyBackgroundInitializer initializer = new MyBackgroundInitializer();
- * initializer.start();
- * // Now do some other things. Initialization runs in a parallel thread
- * ...
- * // Wait for the end of initialization and access the result object
- * Object result = initializer.get();
- *
- *
- *
- *
- * After the construction of a {@code BackgroundInitializer} object its
- * {@link #start()} method has to be called. This starts the background
- * processing. The application can now continue to do other things. When it
- * needs access to the object produced by the {@code BackgroundInitializer} it
- * calls its {@link #get()} method. If initialization is already complete,
- * {@link #get()} returns the result object immediately. Otherwise it blocks
- * until the result object is fully constructed.
- *
- *
- * {@code BackgroundInitializer} is a thin wrapper around a {@code Future}
- * object and uses an {@code ExecutorService} for running the background
- * initialization task. It is possible to pass in an {@code ExecutorService} at
- * construction time or set one using {@code setExternalExecutor()} before
- * {@code start()} was called. Then this object is used to spawn the background
- * task. If no {@code ExecutorService} has been provided, {@code
- * BackgroundInitializer} creates a temporary {@code ExecutorService} and
- * destroys it when initialization is complete.
- *
- *
- * The methods provided by {@code BackgroundInitializer} provide for minimal
- * interaction with the wrapped {@code Future} object. It is also possible to
- * obtain the {@code Future} object directly. Then the enhanced functionality
- * offered by {@code Future} can be used, e.g. to check whether the background
- * operation is complete or to cancel the operation.
- *
- *
- * @since 3.0
- * @version $Id: BackgroundInitializer.java 1082044 2011-03-16 04:26:58Z bayard $
- * @param the type of the object managed by this initializer class
- */
-public abstract class BackgroundInitializer implements
- ConcurrentInitializer {
- /** The external executor service for executing tasks. */
- private ExecutorService externalExecutor;
-
- /** A reference to the executor service that is actually used. */
- private ExecutorService executor;
-
- /** Stores the handle to the background task. */
- private Future future;
-
- /**
- * Creates a new instance of {@code BackgroundInitializer}. No external
- * {@code ExecutorService} is used.
- */
- protected BackgroundInitializer() {
- this(null);
- }
-
- /**
- * Creates a new instance of {@code BackgroundInitializer} and initializes
- * it with the given {@code ExecutorService}. If the {@code ExecutorService}
- * is not null, the background task for initializing this object will be
- * scheduled at this service. Otherwise a new temporary {@code
- * ExecutorService} is created.
- *
- * @param exec an external {@code ExecutorService} to be used for task
- * execution
- */
- protected BackgroundInitializer(ExecutorService exec) {
- setExternalExecutor(exec);
- }
-
- /**
- * Returns the external {@code ExecutorService} to be used by this class.
- *
- * @return the {@code ExecutorService}
- */
- public final synchronized ExecutorService getExternalExecutor() {
- return externalExecutor;
- }
-
- /**
- * Returns a flag whether this {@code BackgroundInitializer} has already
- * been started.
- *
- * @return a flag whether the {@link #start()} method has already been
- * called
- */
- public synchronized boolean isStarted() {
- return future != null;
- }
-
- /**
- * Sets an {@code ExecutorService} to be used by this class. The {@code
- * ExecutorService} passed to this method is used for executing the
- * background task. Thus it is possible to re-use an already existing
- * {@code ExecutorService} or to use a specially configured one. If no
- * {@code ExecutorService} is set, this instance creates a temporary one and
- * destroys it after background initialization is complete. Note that this
- * method must be called before {@link #start()}; otherwise an exception is
- * thrown.
- *
- * @param externalExecutor the {@code ExecutorService} to be used
- * @throws IllegalStateException if this initializer has already been
- * started
- */
- public final synchronized void setExternalExecutor(
- ExecutorService externalExecutor) {
- if (isStarted()) {
- throw new IllegalStateException(
- "Cannot set ExecutorService after start()!");
- }
-
- this.externalExecutor = externalExecutor;
- }
-
- /**
- * Starts the background initialization. With this method the initializer
- * becomes active and invokes the {@link #initialize()} method in a
- * background task. A {@code BackgroundInitializer} can be started exactly
- * once. The return value of this method determines whether the start was
- * successful: only the first invocation of this method returns true,
- * following invocations will return false.
- *
- * @return a flag whether the initializer could be started successfully
- */
- public synchronized boolean start() {
- // Not yet started?
- if (!isStarted()) {
-
- // Determine the executor to use and whether a temporary one has to
- // be created
- ExecutorService tempExec;
- executor = getExternalExecutor();
- if (executor == null) {
- executor = tempExec = createExecutor();
- } else {
- tempExec = null;
- }
-
- future = executor.submit(createTask(tempExec));
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns the result of the background initialization. This method blocks
- * until initialization is complete. If the background processing caused a
- * runtime exception, it is directly thrown by this method. Checked
- * exceptions, including {@code InterruptedException} are wrapped in a
- * {@link ConcurrentException}. Calling this method before {@link #start()}
- * was called causes an {@code IllegalStateException} exception to be
- * thrown.
- *
- * @return the object produced by this initializer
- * @throws ConcurrentException if a checked exception occurred during
- * background processing
- * @throws IllegalStateException if {@link #start()} has not been called
- */
- public T get() throws ConcurrentException {
- try {
- return getFuture().get();
- } catch (ExecutionException execex) {
- ConcurrentUtils.handleCause(execex);
- return null; // should not be reached
- } catch (InterruptedException iex) {
- // reset interrupted state
- Thread.currentThread().interrupt();
- throw new ConcurrentException(iex);
- }
- }
-
- /**
- * Returns the {@code Future} object that was created when {@link #start()}
- * was called. Therefore this method can only be called after {@code
- * start()}.
- *
- * @return the {@code Future} object wrapped by this initializer
- * @throws IllegalStateException if {@link #start()} has not been called
- */
- public synchronized Future getFuture() {
- if (future == null) {
- throw new IllegalStateException("start() must be called first!");
- }
-
- return future;
- }
-
- /**
- * Returns the {@code ExecutorService} that is actually used for executing
- * the background task. This method can be called after {@link #start()}
- * (before {@code start()} it returns null). If an external executor
- * was set, this is also the active executor. Otherwise this method returns
- * the temporary executor that was created by this object.
- *
- * @return the {@code ExecutorService} for executing the background task
- */
- protected synchronized final ExecutorService getActiveExecutor() {
- return executor;
- }
-
- /**
- * Returns the number of background tasks to be created for this
- * initializer. This information is evaluated when a temporary {@code
- * ExecutorService} is created. This base implementation returns 1. Derived
- * classes that do more complex background processing can override it. This
- * method is called from a synchronized block by the {@link #start()}
- * method. Therefore overriding methods should be careful with obtaining
- * other locks and return as fast as possible.
- *
- * @return the number of background tasks required by this initializer
- */
- protected int getTaskCount() {
- return 1;
- }
-
- /**
- * Performs the initialization. This method is called in a background task
- * when this {@code BackgroundInitializer} is started. It must be
- * implemented by a concrete subclass. An implementation is free to perform
- * arbitrary initialization. The object returned by this method can be
- * queried using the {@link #get()} method.
- *
- * @return a result object
- * @throws Exception if an error occurs
- */
- protected abstract T initialize() throws Exception;
-
- /**
- * Creates a task for the background initialization. The {@code Callable}
- * object returned by this method is passed to the {@code ExecutorService}.
- * This implementation returns a task that invokes the {@link #initialize()}
- * method. If a temporary {@code ExecutorService} is used, it is destroyed
- * at the end of the task.
- *
- * @param execDestroy the {@code ExecutorService} to be destroyed by the
- * task
- * @return a task for the background initialization
- */
- private Callable createTask(ExecutorService execDestroy) {
- return new InitializationTask(execDestroy);
- }
-
- /**
- * Creates the {@code ExecutorService} to be used. This method is called if
- * no {@code ExecutorService} was provided at construction time.
- *
- * @return the {@code ExecutorService} to be used
- */
- private ExecutorService createExecutor() {
- return Executors.newFixedThreadPool(getTaskCount());
- }
-
- private class InitializationTask implements Callable {
- /** Stores the executor service to be destroyed at the end. */
- private final ExecutorService execFinally;
-
- /**
- * Creates a new instance of {@code InitializationTask} and initializes
- * it with the {@code ExecutorService} to be destroyed at the end.
- *
- * @param exec the {@code ExecutorService}
- */
- public InitializationTask(ExecutorService exec) {
- execFinally = exec;
- }
-
- /**
- * Initiates initialization and returns the result.
- *
- * @return the result object
- * @throws Exception if an error occurs
- */
- public T call() throws Exception {
- try {
- return initialize();
- } finally {
- if (execFinally != null) {
- execFinally.shutdown();
- }
- }
- }
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/BasicThreadFactory.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
deleted file mode 100644
index 72fe8646..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/BasicThreadFactory.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- *
- * An implementation of the {@code ThreadFactory} interface that provides some
- * configuration options for the threads it creates.
- *
- *
- * A {@code ThreadFactory} is used for instance by an {@code ExecutorService} to
- * create the threads it uses for executing tasks. In many cases users do not
- * have to care about a {@code ThreadFactory} because the default one used by an
- * {@code ExecutorService} will do. However, if there are special requirements
- * for the threads, a custom {@code ThreadFactory} has to be created.
- *
- *
- * This class provides some frequently needed configuration options for the
- * threads it creates. These are the following:
- *
- *
A name pattern for the threads created by this factory can be specified.
- * This is often useful if an application uses multiple executor services for
- * different purposes. If the names of the threads used by these services have
- * meaningful names, log output or exception traces can be much easier to read.
- * Naming patterns are format strings as used by the {@code
- * String.format()} method. The string can contain the place holder {@code %d}
- * which will be replaced by the number of the current thread ({@code
- * ThreadFactoryImpl} keeps a counter of the threads it has already created).
- * For instance, the naming pattern {@code "My %d. worker thread"} will result
- * in thread names like {@code "My 1. worker thread"}, {@code
- * "My 2. worker thread"} and so on.
- *
A flag whether the threads created by this factory should be daemon
- * threads. This can impact the exit behavior of the current Java application
- * because the JVM shuts down if there are only daemon threads running.
- *
The priority of the thread. Here an integer value can be provided. The
- * {@code java.lang.Thread} class defines constants for valid ranges of priority
- * values.
- *
The {@code UncaughtExceptionHandler} for the thread. This handler is
- * called if an uncaught exception occurs within the thread.
- *
- *
- *
- * {@code BasicThreadFactory} wraps another thread factory which actually
- * creates new threads. The configuration options are set on the threads created
- * by the wrapped thread factory. On construction time the factory to be wrapped
- * can be specified. If none is provided, a default {@code ThreadFactory} is
- * used.
- *
- *
- * Instances of {@code BasicThreadFactory} are not created directly, but the
- * nested {@code Builder} class is used for this purpose. Using the builder only
- * the configuration options an application is interested in need to be set. The
- * following example shows how a {@code BasicThreadFactory} is created and
- * installed in an {@code ExecutorService}:
- *
- *
- * // Create a factory that produces daemon threads with a naming pattern and
- * // a priority
- * BasicThreadFactory factory = new BasicThreadFactory.Builder()
- * .namingPattern("workerthread-%d")
- * .daemon(true)
- * .priority(Thread.MAX_PRIORITY)
- * .build();
- * // Create an executor service for single-threaded execution
- * ExecutorService exec = Executors.newSingleThreadExecutor(factory);
- *
- *
- *
- * @since 3.0
- * @version $Id: BasicThreadFactory.java 1079423 2011-03-08 16:38:09Z sebb $
- */
-public class BasicThreadFactory implements ThreadFactory {
- /** A counter for the threads created by this factory. */
- private final AtomicLong threadCounter;
-
- /** Stores the wrapped factory. */
- private final ThreadFactory wrappedFactory;
-
- /** Stores the uncaught exception handler. */
- private final Thread.UncaughtExceptionHandler uncaughtExceptionHandler;
-
- /** Stores the naming pattern for newly created threads. */
- private final String namingPattern;
-
- /** Stores the priority. */
- private final Integer priority;
-
- /** Stores the daemon status flag. */
- private final Boolean daemonFlag;
-
- /**
- * Creates a new instance of {@code ThreadFactoryImpl} and configures it
- * from the specified {@code Builder} object.
- *
- * @param builder the {@code Builder} object
- */
- private BasicThreadFactory(Builder builder) {
- if (builder.wrappedFactory == null) {
- wrappedFactory = Executors.defaultThreadFactory();
- } else {
- wrappedFactory = builder.wrappedFactory;
- }
-
- namingPattern = builder.namingPattern;
- priority = builder.priority;
- daemonFlag = builder.daemonFlag;
- uncaughtExceptionHandler = builder.exceptionHandler;
-
- threadCounter = new AtomicLong();
- }
-
- /**
- * Returns the wrapped {@code ThreadFactory}. This factory is used for
- * actually creating threads. This method never returns null. If no
- * {@code ThreadFactory} was passed when this object was created, a default
- * thread factory is returned.
- *
- * @return the wrapped {@code ThreadFactory}
- */
- public final ThreadFactory getWrappedFactory() {
- return wrappedFactory;
- }
-
- /**
- * Returns the naming pattern for naming newly created threads. Result can
- * be null if no naming pattern was provided.
- *
- * @return the naming pattern
- */
- public final String getNamingPattern() {
- return namingPattern;
- }
-
- /**
- * Returns the daemon flag. This flag determines whether newly created
- * threads should be daemon threads. If true, this factory object
- * calls {@code setDaemon(true)} on the newly created threads. Result can be
- * null if no daemon flag was provided at creation time.
- *
- * @return the daemon flag
- */
- public final Boolean getDaemonFlag() {
- return daemonFlag;
- }
-
- /**
- * Returns the priority of the threads created by this factory. Result can
- * be null if no priority was specified.
- *
- * @return the priority for newly created threads
- */
- public final Integer getPriority() {
- return priority;
- }
-
- /**
- * Returns the {@code UncaughtExceptionHandler} for the threads created by
- * this factory. Result can be null if no handler was provided.
- *
- * @return the {@code UncaughtExceptionHandler}
- */
- public final Thread.UncaughtExceptionHandler getUncaughtExceptionHandler() {
- return uncaughtExceptionHandler;
- }
-
- /**
- * Returns the number of threads this factory has already created. This
- * class maintains an internal counter that is incremented each time the
- * {@link #newThread(Runnable)} method is invoked.
- *
- * @return the number of threads created by this factory
- */
- public long getThreadCount() {
- return threadCounter.get();
- }
-
- /**
- * Creates a new thread. This implementation delegates to the wrapped
- * factory for creating the thread. Then, on the newly created thread the
- * corresponding configuration options are set.
- *
- * @param r the {@code Runnable} to be executed by the new thread
- * @return the newly created thread
- */
- public Thread newThread(Runnable r) {
- Thread t = getWrappedFactory().newThread(r);
- initializeThread(t);
-
- return t;
- }
-
- /**
- * Initializes the specified thread. This method is called by
- * {@link #newThread(Runnable)} after a new thread has been obtained from
- * the wrapped thread factory. It initializes the thread according to the
- * options set for this factory.
- *
- * @param t the thread to be initialized
- */
- private void initializeThread(Thread t) {
-
- if (getNamingPattern() != null) {
- Long count = Long.valueOf(threadCounter.incrementAndGet());
- t.setName(String.format(getNamingPattern(), count));
- }
-
- if (getUncaughtExceptionHandler() != null) {
- t.setUncaughtExceptionHandler(getUncaughtExceptionHandler());
- }
-
- if (getPriority() != null) {
- t.setPriority(getPriority().intValue());
- }
-
- if (getDaemonFlag() != null) {
- t.setDaemon(getDaemonFlag().booleanValue());
- }
- }
-
- /**
- *
- * A builder class for creating instances of {@code
- * BasicThreadFactory}.
- *
- *
- * Using this builder class instances of {@code BasicThreadFactory} can be
- * created and initialized. The class provides methods that correspond to
- * the configuration options supported by {@code BasicThreadFactory}. Method
- * chaining is supported. Refer to the documentation of {@code
- * BasicThreadFactory} for a usage example.
- *
- *
- * @version $Id: BasicThreadFactory.java 1079423 2011-03-08 16:38:09Z sebb $
- */
- public static class Builder
- implements external.org.apache.commons.lang3.builder.Builder {
-
- /** The wrapped factory. */
- private ThreadFactory wrappedFactory;
-
- /** The uncaught exception handler. */
- private Thread.UncaughtExceptionHandler exceptionHandler;
-
- /** The naming pattern. */
- private String namingPattern;
-
- /** The priority. */
- private Integer priority;
-
- /** The daemon flag. */
- private Boolean daemonFlag;
-
- /**
- * Sets the {@code ThreadFactory} to be wrapped by the new {@code
- * BasicThreadFactory}.
- *
- * @param factory the wrapped {@code ThreadFactory} (must not be
- * null)
- * @return a reference to this {@code Builder}
- * @throws NullPointerException if the passed in {@code ThreadFactory}
- * is null
- */
- public Builder wrappedFactory(ThreadFactory factory) {
- if (factory == null) {
- throw new NullPointerException(
- "Wrapped ThreadFactory must not be null!");
- }
-
- wrappedFactory = factory;
- return this;
- }
-
- /**
- * Sets the naming pattern to be used by the new {@code
- * BasicThreadFactory}.
- *
- * @param pattern the naming pattern (must not be null)
- * @return a reference to this {@code Builder}
- * @throws NullPointerException if the naming pattern is null
- */
- public Builder namingPattern(String pattern) {
- if (pattern == null) {
- throw new NullPointerException(
- "Naming pattern must not be null!");
- }
-
- namingPattern = pattern;
- return this;
- }
-
- /**
- * Sets the daemon flag for the new {@code BasicThreadFactory}. If this
- * flag is set to true the new thread factory will create daemon
- * threads.
- *
- * @param f the value of the daemon flag
- * @return a reference to this {@code Builder}
- */
- public Builder daemon(boolean f) {
- daemonFlag = Boolean.valueOf(f);
- return this;
- }
-
- /**
- * Sets the priority for the threads created by the new {@code
- * BasicThreadFactory}.
- *
- * @param prio the priority
- * @return a reference to this {@code Builder}
- */
- public Builder priority(int prio) {
- priority = Integer.valueOf(prio);
- return this;
- }
-
- /**
- * Sets the uncaught exception handler for the threads created by the
- * new {@code BasicThreadFactory}.
- *
- * @param handler the {@code UncaughtExceptionHandler} (must not be
- * null)
- * @return a reference to this {@code Builder}
- * @throws NullPointerException if the exception handler is null
- */
- public Builder uncaughtExceptionHandler(
- Thread.UncaughtExceptionHandler handler) {
- if (handler == null) {
- throw new NullPointerException(
- "Uncaught exception handler must not be null!");
- }
-
- exceptionHandler = handler;
- return this;
- }
-
- /**
- * Resets this builder. All configuration options are set to default
- * values. Note: If the {@link #build()} method was called, it is not
- * necessary to call {@code reset()} explicitly because this is done
- * automatically.
- */
- public void reset() {
- wrappedFactory = null;
- exceptionHandler = null;
- namingPattern = null;
- priority = null;
- daemonFlag = null;
- }
-
- /**
- * Creates a new {@code BasicThreadFactory} with all configuration
- * options that have been specified by calling methods on this builder.
- * After creating the factory {@link #reset()} is called.
- *
- * @return the new {@code BasicThreadFactory}
- */
- public BasicThreadFactory build() {
- BasicThreadFactory factory = new BasicThreadFactory(this);
- reset();
- return factory;
- }
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/CallableBackgroundInitializer.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/CallableBackgroundInitializer.java
deleted file mode 100644
index eb6b7dda..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/CallableBackgroundInitializer.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-
-/**
- *
- * A specialized {@link BackgroundInitializer} implementation that wraps a
- * {@code Callable} object.
- *
- *
- * An instance of this class is initialized with a {@code Callable} object when
- * it is constructed. The implementation of the {@link #initialize()} method
- * defined in the super class delegates to this {@code Callable} so that the
- * {@code Callable} is executed in the background thread.
- *
- *
- * The {@code java.util.concurrent.Callable} interface is a standard mechanism
- * of the JDK to define tasks to be executed by another thread. The {@code
- * CallableBackgroundInitializer} class allows combining this standard interface
- * with the background initializer API.
- *
- *
- * Usage of this class is very similar to the default usage pattern of the
- * {@link BackgroundInitializer} class: Just create an instance and provide the
- * {@code Callable} object to be executed, then call the initializer's
- * {@link #start()} method. This causes the {@code Callable} to be executed in
- * another thread. When the results of the {@code Callable} are needed the
- * initializer's {@link #get()} method can be called (which may block until
- * background execution is complete). The following code fragment shows a
- * typical usage example:
- *
- *
- * // a Callable that performs a complex computation
- * Callable<Integer> computationCallable = new MyComputationCallable();
- * // setup the background initializer
- * CallableBackgroundInitializer<Integer> initializer =
- * new CallableBackgroundInitializer(computationCallable);
- * initializer.start();
- * // Now do some other things. Initialization runs in a parallel thread
- * ...
- * // Wait for the end of initialization and access the result
- * Integer result = initializer.get();
- *
- *
- *
- *
- * @since 3.0
- * @version $Id: CallableBackgroundInitializer.java 1082044 2011-03-16 04:26:58Z bayard $
- * @param the type of the object managed by this initializer class
- */
-public class CallableBackgroundInitializer extends BackgroundInitializer {
- /** The Callable to be executed. */
- private final Callable callable;
-
- /**
- * Creates a new instance of {@code CallableBackgroundInitializer} and sets
- * the {@code Callable} to be executed in a background thread.
- *
- * @param call the {@code Callable} (must not be null)
- * @throws IllegalArgumentException if the {@code Callable} is null
- */
- public CallableBackgroundInitializer(Callable call) {
- checkCallable(call);
- callable = call;
- }
-
- /**
- * Creates a new instance of {@code CallableBackgroundInitializer} and
- * initializes it with the {@code Callable} to be executed in a background
- * thread and the {@code ExecutorService} for managing the background
- * execution.
- *
- * @param call the {@code Callable} (must not be null)
- * @param exec an external {@code ExecutorService} to be used for task
- * execution
- * @throws IllegalArgumentException if the {@code Callable} is null
- */
- public CallableBackgroundInitializer(Callable call, ExecutorService exec) {
- super(exec);
- checkCallable(call);
- callable = call;
- }
-
- /**
- * Performs initialization in a background thread. This implementation
- * delegates to the {@code Callable} passed at construction time of this
- * object.
- *
- * @return the result of the initialization
- * @throws Exception if an error occurs
- */
- @Override
- protected T initialize() throws Exception {
- return callable.call();
- }
-
- /**
- * Tests the passed in {@code Callable} and throws an exception if it is
- * undefined.
- *
- * @param call the object to check
- * @throws IllegalArgumentException if the {@code Callable} is null
- */
- private void checkCallable(Callable call) {
- if (call == null) {
- throw new IllegalArgumentException("Callable must not be null!");
- }
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentException.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentException.java
deleted file mode 100644
index 999f851f..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentException.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-/**
- *
- * An exception class used for reporting error conditions related to accessing
- * data of background tasks.
- *
- *
- * The purpose of this exception class is analogous to the default JDK exception
- * class {@link java.util.concurrent.ExecutionException}, i.e. it wraps an
- * exception that occurred during the execution of a task. However, in contrast
- * to {@code ExecutionException}, it wraps only checked exceptions. Runtime
- * exceptions are thrown directly.
- *
- *
- * @since 3.0
- * @version $Id: ConcurrentException.java 1088899 2011-04-05 05:31:27Z bayard $
- */
-public class ConcurrentException extends Exception {
- /**
- * The serial version UID.
- */
- private static final long serialVersionUID = 6622707671812226130L;
-
- /**
- * Creates a new, uninitialized instance of {@code ConcurrentException}.
- */
- protected ConcurrentException() {
- super();
- }
-
- /**
- * Creates a new instance of {@code ConcurrentException} and initializes it
- * with the given cause.
- *
- * @param cause the cause of this exception
- * @throws IllegalArgumentException if the cause is not a checked exception
- */
- public ConcurrentException(Throwable cause) {
- super(ConcurrentUtils.checkedException(cause));
- }
-
- /**
- * Creates a new instance of {@code ConcurrentException} and initializes it
- * with the given message and cause.
- *
- * @param msg the error message
- * @param cause the cause of this exception
- * @throws IllegalArgumentException if the cause is not a checked exception
- */
- public ConcurrentException(String msg, Throwable cause) {
- super(msg, ConcurrentUtils.checkedException(cause));
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentInitializer.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentInitializer.java
deleted file mode 100644
index 95c4e637..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentInitializer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-/**
- *
- * Definition of an interface for the thread-safe initialization of objects.
- *
- *
- * The idea behind this interface is to provide access to an object in a
- * thread-safe manner. A {@code ConcurrentInitializer} can be passed to multiple
- * threads which can all access the object produced by the initializer. Through
- * the {@link #get()} method the object can be queried.
- *
- *
- * Concrete implementations of this interface will use different strategies for
- * the creation of the managed object, e.g. lazy initialization or
- * initialization in a background thread. This is completely transparent to
- * client code, so it is possible to change the initialization strategy without
- * affecting clients.
- *
- *
- * @since 3.0
- * @version $Id: ConcurrentInitializer.java 1088899 2011-04-05 05:31:27Z bayard $
- * @param the type of the object managed by this initializer class
- */
-public interface ConcurrentInitializer {
- /**
- * Returns the fully initialized object produced by this {@code
- * ConcurrentInitializer}. A concrete implementation here returns the
- * results of the initialization process. This method may block until
- * results are available. Typically, once created the result object is
- * always the same.
- *
- * @return the object created by this {@code ConcurrentException}
- * @throws ConcurrentException if an error occurred during initialization of
- * the object
- */
- T get() throws ConcurrentException;
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.java
deleted file mode 100644
index 3d4bd85d..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-/**
- *
- * An exception class used for reporting runtime error conditions related to
- * accessing data of background tasks.
- *
- *
- * This class is an analogon of the {@link ConcurrentException} exception class.
- * However, it is a runtime exception and thus does not need explicit catch
- * clauses. Some methods of {@link ConcurrentUtils} throw {@code
- * ConcurrentRuntimeException} exceptions rather than
- * {@link ConcurrentException} exceptions. They can be used by client code that
- * does not want to be bothered with checked exceptions.
- *
- *
- * @since 3.0
- * @version $Id: ConcurrentRuntimeException.java 1088899 2011-04-05 05:31:27Z bayard $
- */
-public class ConcurrentRuntimeException extends RuntimeException {
- /**
- * The serial version UID.
- */
- private static final long serialVersionUID = -6582182735562919670L;
-
- /**
- * Creates a new, uninitialized instance of {@code
- * ConcurrentRuntimeException}.
- */
- protected ConcurrentRuntimeException() {
- super();
- }
-
- /**
- * Creates a new instance of {@code ConcurrentRuntimeException} and
- * initializes it with the given cause.
- *
- * @param cause the cause of this exception
- * @throws IllegalArgumentException if the cause is not a checked exception
- */
- public ConcurrentRuntimeException(Throwable cause) {
- super(ConcurrentUtils.checkedException(cause));
- }
-
- /**
- * Creates a new instance of {@code ConcurrentRuntimeException} and
- * initializes it with the given message and cause.
- *
- * @param msg the error message
- * @param cause the cause of this exception
- * @throws IllegalArgumentException if the cause is not a checked exception
- */
- public ConcurrentRuntimeException(String msg, Throwable cause) {
- super(msg, ConcurrentUtils.checkedException(cause));
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentUtils.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentUtils.java
deleted file mode 100644
index 1070fe3c..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConcurrentUtils.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-/**
- *
- * An utility class providing functionality related to the {@code
- * java.util.concurrent} package.
- *
- *
- * @since 3.0
- * @version $Id: ConcurrentUtils.java 1199894 2011-11-09 17:53:59Z ggregory $
- */
-public class ConcurrentUtils {
-
- /**
- * Private constructor so that no instances can be created. This class
- * contains only static utility methods.
- */
- private ConcurrentUtils() {
- }
-
- /**
- * Inspects the cause of the specified {@code ExecutionException} and
- * creates a {@code ConcurrentException} with the checked cause if
- * necessary. This method performs the following checks on the cause of the
- * passed in exception:
- *
- *
If the passed in exception is null or the cause is
- * null, this method returns null.
- *
If the cause is a runtime exception, it is directly thrown.
- *
If the cause is an error, it is directly thrown, too.
- *
In any other case the cause is a checked exception. The method then
- * creates a {@link ConcurrentException}, initializes it with the cause, and
- * returns it.
- *
- *
- * @param ex the exception to be processed
- * @return a {@code ConcurrentException} with the checked cause
- */
- public static ConcurrentException extractCause(ExecutionException ex) {
- if (ex == null || ex.getCause() == null) {
- return null;
- }
-
- throwCause(ex);
- return new ConcurrentException(ex.getMessage(), ex.getCause());
- }
-
- /**
- * Inspects the cause of the specified {@code ExecutionException} and
- * creates a {@code ConcurrentRuntimeException} with the checked cause if
- * necessary. This method works exactly like
- * {@link #extractCause(ExecutionException)}. The only difference is that
- * the cause of the specified {@code ExecutionException} is extracted as a
- * runtime exception. This is an alternative for client code that does not
- * want to deal with checked exceptions.
- *
- * @param ex the exception to be processed
- * @return a {@code ConcurrentRuntimeException} with the checked cause
- */
- public static ConcurrentRuntimeException extractCauseUnchecked(
- ExecutionException ex) {
- if (ex == null || ex.getCause() == null) {
- return null;
- }
-
- throwCause(ex);
- return new ConcurrentRuntimeException(ex.getMessage(), ex.getCause());
- }
-
- /**
- * Handles the specified {@code ExecutionException}. This method calls
- * {@link #extractCause(ExecutionException)} for obtaining the cause of the
- * exception - which might already cause an unchecked exception or an error
- * being thrown. If the cause is a checked exception however, it is wrapped
- * in a {@code ConcurrentException}, which is thrown. If the passed in
- * exception is null or has no cause, the method simply returns
- * without throwing an exception.
- *
- * @param ex the exception to be handled
- * @throws ConcurrentException if the cause of the {@code
- * ExecutionException} is a checked exception
- */
- public static void handleCause(ExecutionException ex)
- throws ConcurrentException {
- ConcurrentException cex = extractCause(ex);
-
- if (cex != null) {
- throw cex;
- }
- }
-
- /**
- * Handles the specified {@code ExecutionException} and transforms it into a
- * runtime exception. This method works exactly like
- * {@link #handleCause(ExecutionException)}, but instead of a
- * {@link ConcurrentException} it throws a
- * {@link ConcurrentRuntimeException}. This is an alternative for client
- * code that does not want to deal with checked exceptions.
- *
- * @param ex the exception to be handled
- * @throws ConcurrentRuntimeException if the cause of the {@code
- * ExecutionException} is a checked exception; this exception is then
- * wrapped in the thrown runtime exception
- */
- public static void handleCauseUnchecked(ExecutionException ex) {
- ConcurrentRuntimeException crex = extractCauseUnchecked(ex);
-
- if (crex != null) {
- throw crex;
- }
- }
-
- /**
- * Tests whether the specified {@code Throwable} is a checked exception. If
- * not, an exception is thrown.
- *
- * @param ex the {@code Throwable} to check
- * @return a flag whether the passed in exception is a checked exception
- * @throws IllegalArgumentException if the {@code Throwable} is not a
- * checked exception
- */
- static Throwable checkedException(Throwable ex) {
- if (ex != null && !(ex instanceof RuntimeException)
- && !(ex instanceof Error)) {
- return ex;
- } else {
- throw new IllegalArgumentException("Not a checked exception: " + ex);
- }
- }
-
- /**
- * Tests whether the cause of the specified {@code ExecutionException}
- * should be thrown and does it if necessary.
- *
- * @param ex the exception in question
- */
- private static void throwCause(ExecutionException ex) {
- if (ex.getCause() instanceof RuntimeException) {
- throw (RuntimeException) ex.getCause();
- }
-
- if (ex.getCause() instanceof Error) {
- throw (Error) ex.getCause();
- }
- }
-
- //-----------------------------------------------------------------------
- /**
- * Invokes the specified {@code ConcurrentInitializer} and returns the
- * object produced by the initializer. This method just invokes the {@code
- * get()} method of the given {@code ConcurrentInitializer}. It is
- * null-safe: if the argument is null, result is also
- * null.
- *
- * @param the type of the object produced by the initializer
- * @param initializer the {@code ConcurrentInitializer} to be invoked
- * @return the object managed by the {@code ConcurrentInitializer}
- * @throws ConcurrentException if the {@code ConcurrentInitializer} throws
- * an exception
- */
- public static T initialize(ConcurrentInitializer initializer)
- throws ConcurrentException {
- return initializer != null ? initializer.get() : null;
- }
-
- /**
- * Invokes the specified {@code ConcurrentInitializer} and transforms
- * occurring exceptions to runtime exceptions. This method works like
- * {@link #initialize(ConcurrentInitializer)}, but if the {@code
- * ConcurrentInitializer} throws a {@link ConcurrentException}, it is
- * caught, and the cause is wrapped in a {@link ConcurrentRuntimeException}.
- * So client code does not have to deal with checked exceptions.
- *
- * @param the type of the object produced by the initializer
- * @param initializer the {@code ConcurrentInitializer} to be invoked
- * @return the object managed by the {@code ConcurrentInitializer}
- * @throws ConcurrentRuntimeException if the initializer throws an exception
- */
- public static T initializeUnchecked(ConcurrentInitializer initializer) {
- try {
- return initialize(initializer);
- } catch (ConcurrentException cex) {
- throw new ConcurrentRuntimeException(cex.getCause());
- }
- }
-
- //-----------------------------------------------------------------------
- /**
- *
- * Puts a value in the specified {@code ConcurrentMap} if the key is not yet
- * present. This method works similar to the {@code putIfAbsent()} method of
- * the {@code ConcurrentMap} interface, but the value returned is different.
- * Basically, this method is equivalent to the following code fragment:
- *
- *
- *
- * except that the action is performed atomically. So this method always
- * returns the value which is stored in the map.
- *
- *
- * This method is null-safe: It accepts a null map as input
- * without throwing an exception. In this case the return value is
- * null, too.
- *
- *
- * @param the type of the keys of the map
- * @param the type of the values of the map
- * @param map the map to be modified
- * @param key the key of the value to be added
- * @param value the value to be added
- * @return the value stored in the map after this operation
- */
- public static V putIfAbsent(ConcurrentMap map, K key, V value) {
- if (map == null) {
- return null;
- }
-
- V result = map.putIfAbsent(key, value);
- return result != null ? result : value;
- }
-
- /**
- * Checks if a concurrent map contains a key and creates a corresponding
- * value if not. This method first checks the presence of the key in the
- * given map. If it is already contained, its value is returned. Otherwise
- * the {@code get()} method of the passed in {@link ConcurrentInitializer}
- * is called. With the resulting object
- * {@link #putIfAbsent(ConcurrentMap, Object, Object)} is called. This
- * handles the case that in the meantime another thread has added the key to
- * the map. Both the map and the initializer can be null; in this
- * case this method simply returns null.
- *
- * @param the type of the keys of the map
- * @param the type of the values of the map
- * @param map the map to be modified
- * @param key the key of the value to be added
- * @param init the {@link ConcurrentInitializer} for creating the value
- * @return the value stored in the map after this operation; this may or may
- * not be the object created by the {@link ConcurrentInitializer}
- * @throws ConcurrentException if the initializer throws an exception
- */
- public static V createIfAbsent(ConcurrentMap map, K key,
- ConcurrentInitializer init) throws ConcurrentException {
- if (map == null || init == null) {
- return null;
- }
-
- V value = map.get(key);
- if (value == null) {
- return putIfAbsent(map, key, init.get());
- }
- return value;
- }
-
- /**
- * Checks if a concurrent map contains a key and creates a corresponding
- * value if not, suppressing checked exceptions. This method calls
- * {@code createIfAbsent()}. If a {@link ConcurrentException} is thrown, it
- * is caught and re-thrown as a {@link ConcurrentRuntimeException}.
- *
- * @param the type of the keys of the map
- * @param the type of the values of the map
- * @param map the map to be modified
- * @param key the key of the value to be added
- * @param init the {@link ConcurrentInitializer} for creating the value
- * @return the value stored in the map after this operation; this may or may
- * not be the object created by the {@link ConcurrentInitializer}
- * @throws ConcurrentRuntimeException if the initializer throws an exception
- */
- public static V createIfAbsentUnchecked(ConcurrentMap map,
- K key, ConcurrentInitializer init) {
- try {
- return createIfAbsent(map, key, init);
- } catch (ConcurrentException cex) {
- throw new ConcurrentRuntimeException(cex.getCause());
- }
- }
-
- //-----------------------------------------------------------------------
- /**
- *
- * Gets an implementation of Future that is immediately done
- * and returns the specified constant value.
- *
- *
- * This can be useful to return a simple constant immediately from the
- * concurrent processing, perhaps as part of avoiding nulls.
- * A constant future can also be useful in testing.
- *
- *
- * @param the type of the value used by this {@code Future} object
- * @param value the constant value to return, may be null
- * @return an instance of Future that will return the value, never null
- */
- public static Future constantFuture(T value) {
- return new ConstantFuture(value);
- }
-
- /**
- * A specialized {@code Future} implementation which wraps a constant value.
- * @param the type of the value wrapped by this class
- */
- static final class ConstantFuture implements Future {
- /** The constant value. */
- private final T value;
-
- /**
- * Creates a new instance of {@code ConstantFuture} and initializes it
- * with the constant value.
- *
- * @param value the value (may be null)
- */
- ConstantFuture(T value) {
- this.value = value;
- }
-
- /**
- * {@inheritDoc} This implementation always returns true because
- * the constant object managed by this {@code Future} implementation is
- * always available.
- */
- public boolean isDone() {
- return true;
- }
-
- /**
- * {@inheritDoc} This implementation just returns the constant value.
- */
- public T get() {
- return value;
- }
-
- /**
- * {@inheritDoc} This implementation just returns the constant value; it
- * does not block, therefore the timeout has no meaning.
- */
- public T get(long timeout, TimeUnit unit) {
- return value;
- }
-
- /**
- * {@inheritDoc} This implementation always returns false; there
- * is no background process which could be cancelled.
- */
- public boolean isCancelled() {
- return false;
- }
-
- /**
- * {@inheritDoc} The cancel operation is not supported. This
- * implementation always returns false.
- */
- public boolean cancel(boolean mayInterruptIfRunning) {
- return false;
- }
- }
-
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConstantInitializer.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConstantInitializer.java
deleted file mode 100644
index bc600e69..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/ConstantInitializer.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-import external.org.apache.commons.lang3.ObjectUtils;
-
-/**
- *
- * A very simple implementation of the {@link ConcurrentInitializer} interface
- * which always returns the same object.
- *
- *
- * An instance of this class is passed a reference to an object when it is
- * constructed. The {@link #get()} method just returns this object. No
- * synchronization is required.
- *
- *
- * This class is useful for instance for unit testing or in cases where a
- * specific object has to be passed to an object which expects a
- * {@link ConcurrentInitializer}.
- *
- *
- * @since 3.0
- * @version $Id: ConstantInitializer.java 1199894 2011-11-09 17:53:59Z ggregory $
- * @param the type of the object managed by this initializer
- */
-public class ConstantInitializer implements ConcurrentInitializer {
- /** Constant for the format of the string representation. */
- private static final String FMT_TO_STRING = "ConstantInitializer@%d [ object = %s ]";
-
- /** Stores the managed object. */
- private final T object;
-
- /**
- * Creates a new instance of {@code ConstantInitializer} and initializes it
- * with the object to be managed. The {@code get()} method will always
- * return the object passed here. This class does not place any restrictions
- * on the object. It may be null, then {@code get()} will return
- * null, too.
- *
- * @param obj the object to be managed by this initializer
- */
- public ConstantInitializer(T obj) {
- object = obj;
- }
-
- /**
- * Directly returns the object that was passed to the constructor. This is
- * the same object as returned by {@code get()}. However, this method does
- * not declare that it throws an exception.
- *
- * @return the object managed by this initializer
- */
- public final T getObject() {
- return object;
- }
-
- /**
- * Returns the object managed by this initializer. This implementation just
- * returns the object passed to the constructor.
- *
- * @return the object managed by this initializer
- * @throws ConcurrentException if an error occurs
- */
- public T get() throws ConcurrentException {
- return getObject();
- }
-
- /**
- * Returns a hash code for this object. This implementation returns the hash
- * code of the managed object.
- *
- * @return a hash code for this object
- */
- @Override
- public int hashCode() {
- return getObject() != null ? getObject().hashCode() : 0;
- }
-
- /**
- * Compares this object with another one. This implementation returns
- * true if and only if the passed in object is an instance of
- * {@code ConstantInitializer} which refers to an object equals to the
- * object managed by this instance.
- *
- * @param obj the object to compare to
- * @return a flag whether the objects are equal
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ConstantInitializer>)) {
- return false;
- }
-
- ConstantInitializer> c = (ConstantInitializer>) obj;
- return ObjectUtils.equals(getObject(), c.getObject());
- }
-
- /**
- * Returns a string representation for this object. This string also
- * contains a string representation of the object managed by this
- * initializer.
- *
- * @return a string for this object
- */
- @Override
- public String toString() {
- return String.format(FMT_TO_STRING, Integer.valueOf(System.identityHashCode(this)),
- String.valueOf(getObject()));
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/LazyInitializer.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/LazyInitializer.java
deleted file mode 100644
index c99b644f..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/LazyInitializer.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-/**
- *
- * This class provides a generic implementation of the lazy initialization
- * pattern.
- *
- *
- * Sometimes an application has to deal with an object only under certain
- * circumstances, e.g. when the user selects a specific menu item or if a
- * special event is received. If the creation of the object is costly or the
- * consumption of memory or other system resources is significant, it may make
- * sense to defer the creation of this object until it is really needed. This is
- * a use case for the lazy initialization pattern.
- *
- *
- * This abstract base class provides an implementation of the double-check idiom
- * for an instance field as discussed in Joshua Bloch's "Effective Java", 2nd
- * edition, item 71. The class already implements all necessary synchronization.
- * A concrete subclass has to implement the {@code initialize()} method, which
- * actually creates the wrapped data object.
- *
- *
- * As an usage example consider that we have a class {@code ComplexObject} whose
- * instantiation is a complex operation. In order to apply lazy initialization
- * to this class, a subclass of {@code LazyInitializer} has to be created:
- *
- *
- * public class ComplexObjectInitializer extends LazyInitializer<ComplexObject> {
- * @Override
- * protected ComplexObject initialize() {
- * return new ComplexObject();
- * }
- * }
- *
- *
- * Access to the data object is provided through the {@code get()} method. So,
- * code that wants to obtain the {@code ComplexObject} instance would simply
- * look like this:
- *
- *
- * // Create an instance of the lazy initializer
- * ComplexObjectInitializer initializer = new ComplexObjectInitializer();
- * ...
- * // When the object is actually needed:
- * ComplexObject cobj = initializer.get();
- *
- *
- *
- *
- * If multiple threads call the {@code get()} method when the object has not yet
- * been created, they are blocked until initialization completes. The algorithm
- * guarantees that only a single instance of the wrapped object class is
- * created, which is passed to all callers. Once initialized, calls to the
- * {@code get()} method are pretty fast because no synchronization is needed
- * (only an access to a volatile member field).
- *
- *
- * @since 3.0
- * @version $Id: LazyInitializer.java 1088899 2011-04-05 05:31:27Z bayard $
- * @param the type of the object managed by this initializer class
- */
-public abstract class LazyInitializer implements ConcurrentInitializer {
- /** Stores the managed object. */
- private volatile T object;
-
- /**
- * Returns the object wrapped by this instance. On first access the object
- * is created. After that it is cached and can be accessed pretty fast.
- *
- * @return the object initialized by this {@code LazyInitializer}
- * @throws ConcurrentException if an error occurred during initialization of
- * the object
- */
- public T get() throws ConcurrentException {
- // use a temporary variable to reduce the number of reads of the
- // volatile field
- T result = object;
-
- if (result == null) {
- synchronized (this) {
- result = object;
- if (result == null) {
- object = result = initialize();
- }
- }
- }
-
- return result;
- }
-
- /**
- * Creates and initializes the object managed by this {@code
- * LazyInitializer}. This method is called by {@link #get()} when the object
- * is accessed for the first time. An implementation can focus on the
- * creation of the object. No synchronization is needed, as this is already
- * handled by {@code get()}.
- *
- * @return the managed data object
- * @throws ConcurrentException if an error occurs during object creation
- */
- protected abstract T initialize() throws ConcurrentException;
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java
deleted file mode 100644
index cea6e3f6..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-
-/**
- *
- * A specialized {@link BackgroundInitializer} implementation that can deal with
- * multiple background initialization tasks.
- *
- *
- * This class has a similar purpose as {@link BackgroundInitializer}. However,
- * it is not limited to a single background initialization task. Rather it
- * manages an arbitrary number of {@code BackgroundInitializer} objects,
- * executes them, and waits until they are completely initialized. This is
- * useful for applications that have to perform multiple initialization tasks
- * that can run in parallel (i.e. that do not depend on each other). This class
- * takes care about the management of an {@code ExecutorService} and shares it
- * with the {@code BackgroundInitializer} objects it is responsible for; so the
- * using application need not bother with these details.
- *
- *
- * The typical usage scenario for {@code MultiBackgroundInitializer} is as
- * follows:
- *
- *
Create a new instance of the class. Optionally pass in a pre-configured
- * {@code ExecutorService}. Alternatively {@code MultiBackgroundInitializer} can
- * create a temporary {@code ExecutorService} and delete it after initialization
- * is complete.
- *
Create specialized {@link BackgroundInitializer} objects for the
- * initialization tasks to be performed and add them to the {@code
- * MultiBackgroundInitializer} using the
- * {@link #addInitializer(String, BackgroundInitializer)} method.
- *
After all initializers have been added, call the {@link #start()} method.
- *
- *
When access to the result objects produced by the {@code
- * BackgroundInitializer} objects is needed call the {@link #get()} method. The
- * object returned here provides access to all result objects created during
- * initialization. It also stores information about exceptions that have
- * occurred.
- *
- *
- *
- * {@code MultiBackgroundInitializer} starts a special controller task that
- * starts all {@code BackgroundInitializer} objects added to the instance.
- * Before the an initializer is started it is checked whether this initializer
- * already has an {@code ExecutorService} set. If this is the case, this {@code
- * ExecutorService} is used for running the background task. Otherwise the
- * current {@code ExecutorService} of this {@code MultiBackgroundInitializer} is
- * shared with the initializer.
- *
- *
- * The easiest way of using this class is to let it deal with the management of
- * an {@code ExecutorService} itself: If no external {@code ExecutorService} is
- * provided, the class creates a temporary {@code ExecutorService} (that is
- * capable of executing all background tasks in parallel) and destroys it at the
- * end of background processing.
- *
- *
- * Alternatively an external {@code ExecutorService} can be provided - either at
- * construction time or later by calling the
- * {@link #setExternalExecutor(ExecutorService)} method. In this case all
- * background tasks are scheduled at this external {@code ExecutorService}.
- * Important note: When using an external {@code
- * ExecutorService} be sure that the number of threads managed by the service is
- * large enough. Otherwise a deadlock can happen! This is the case in the
- * following scenario: {@code MultiBackgroundInitializer} starts a task that
- * starts all registered {@code BackgroundInitializer} objects and waits for
- * their completion. If for instance a single threaded {@code ExecutorService}
- * is used, none of the background tasks can be executed, and the task created
- * by {@code MultiBackgroundInitializer} waits forever.
- *
- *
- * @since 3.0
- * @version $Id: MultiBackgroundInitializer.java 1082301 2011-03-16 21:02:15Z oheger $
- */
-public class MultiBackgroundInitializer
- extends
- BackgroundInitializer {
- /** A map with the child initializers. */
- private final Map> childInitializers =
- new HashMap>();
-
- /**
- * Creates a new instance of {@code MultiBackgroundInitializer}.
- */
- public MultiBackgroundInitializer() {
- super();
- }
-
- /**
- * Creates a new instance of {@code MultiBackgroundInitializer} and
- * initializes it with the given external {@code ExecutorService}.
- *
- * @param exec the {@code ExecutorService} for executing the background
- * tasks
- */
- public MultiBackgroundInitializer(ExecutorService exec) {
- super(exec);
- }
-
- /**
- * Adds a new {@code BackgroundInitializer} to this object. When this
- * {@code MultiBackgroundInitializer} is started, the given initializer will
- * be processed. This method must not be called after {@link #start()} has
- * been invoked.
- *
- * @param name the name of the initializer (must not be null)
- * @param init the {@code BackgroundInitializer} to add (must not be
- * null)
- * @throws IllegalArgumentException if a required parameter is missing
- * @throws IllegalStateException if {@code start()} has already been called
- */
- public void addInitializer(String name, BackgroundInitializer> init) {
- if (name == null) {
- throw new IllegalArgumentException(
- "Name of child initializer must not be null!");
- }
- if (init == null) {
- throw new IllegalArgumentException(
- "Child initializer must not be null!");
- }
-
- synchronized (this) {
- if (isStarted()) {
- throw new IllegalStateException(
- "addInitializer() must not be called after start()!");
- }
- childInitializers.put(name, init);
- }
- }
-
- /**
- * Returns the number of tasks needed for executing all child {@code
- * BackgroundInitializer} objects in parallel. This implementation sums up
- * the required tasks for all child initializers (which is necessary if one
- * of the child initializers is itself a {@code MultiBackgroundInitializer}
- * ). Then it adds 1 for the control task that waits for the completion of
- * the children.
- *
- * @return the number of tasks required for background processing
- */
- @Override
- protected int getTaskCount() {
- int result = 1;
-
- for (BackgroundInitializer> bi : childInitializers.values()) {
- result += bi.getTaskCount();
- }
-
- return result;
- }
-
- /**
- * Creates the results object. This implementation starts all child {@code
- * BackgroundInitializer} objects. Then it collects their results and
- * creates a {@code MultiBackgroundInitializerResults} object with this
- * data. If a child initializer throws a checked exceptions, it is added to
- * the results object. Unchecked exceptions are propagated.
- *
- * @return the results object
- * @throws Exception if an error occurs
- */
- @Override
- protected MultiBackgroundInitializerResults initialize() throws Exception {
- Map> inits;
- synchronized (this) {
- // create a snapshot to operate on
- inits = new HashMap>(
- childInitializers);
- }
-
- // start the child initializers
- ExecutorService exec = getActiveExecutor();
- for (BackgroundInitializer> bi : inits.values()) {
- if (bi.getExternalExecutor() == null) {
- // share the executor service if necessary
- bi.setExternalExecutor(exec);
- }
- bi.start();
- }
-
- // collect the results
- Map results = new HashMap();
- Map excepts = new HashMap();
- for (Map.Entry> e : inits.entrySet()) {
- try {
- results.put(e.getKey(), e.getValue().get());
- } catch (ConcurrentException cex) {
- excepts.put(e.getKey(), cex);
- }
- }
-
- return new MultiBackgroundInitializerResults(inits, results, excepts);
- }
-
- /**
- * A data class for storing the results of the background initialization
- * performed by {@code MultiBackgroundInitializer}. Objects of this inner
- * class are returned by {@link MultiBackgroundInitializer#initialize()}.
- * They allow access to all result objects produced by the
- * {@link BackgroundInitializer} objects managed by the owning instance. It
- * is also possible to retrieve status information about single
- * {@link BackgroundInitializer}s, i.e. whether they completed normally or
- * caused an exception.
- */
- public static class MultiBackgroundInitializerResults {
- /** A map with the child initializers. */
- private final Map> initializers;
-
- /** A map with the result objects. */
- private final Map resultObjects;
-
- /** A map with the exceptions. */
- private final Map exceptions;
-
- /**
- * Creates a new instance of {@code MultiBackgroundInitializerResults}
- * and initializes it with maps for the {@code BackgroundInitializer}
- * objects, their result objects and the exceptions thrown by them.
- *
- * @param inits the {@code BackgroundInitializer} objects
- * @param results the result objects
- * @param excepts the exceptions
- */
- private MultiBackgroundInitializerResults(
- Map> inits,
- Map results,
- Map excepts) {
- initializers = inits;
- resultObjects = results;
- exceptions = excepts;
- }
-
- /**
- * Returns the {@code BackgroundInitializer} with the given name. If the
- * name cannot be resolved, an exception is thrown.
- *
- * @param name the name of the {@code BackgroundInitializer}
- * @return the {@code BackgroundInitializer} with this name
- * @throws NoSuchElementException if the name cannot be resolved
- */
- public BackgroundInitializer> getInitializer(String name) {
- return checkName(name);
- }
-
- /**
- * Returns the result object produced by the {@code
- * BackgroundInitializer} with the given name. This is the object
- * returned by the initializer's {@code initialize()} method. If this
- * {@code BackgroundInitializer} caused an exception, null is
- * returned. If the name cannot be resolved, an exception is thrown.
- *
- * @param name the name of the {@code BackgroundInitializer}
- * @return the result object produced by this {@code
- * BackgroundInitializer}
- * @throws NoSuchElementException if the name cannot be resolved
- */
- public Object getResultObject(String name) {
- checkName(name);
- return resultObjects.get(name);
- }
-
- /**
- * Returns a flag whether the {@code BackgroundInitializer} with the
- * given name caused an exception.
- *
- * @param name the name of the {@code BackgroundInitializer}
- * @return a flag whether this initializer caused an exception
- * @throws NoSuchElementException if the name cannot be resolved
- */
- public boolean isException(String name) {
- checkName(name);
- return exceptions.containsKey(name);
- }
-
- /**
- * Returns the {@code ConcurrentException} object that was thrown by the
- * {@code BackgroundInitializer} with the given name. If this
- * initializer did not throw an exception, the return value is
- * null. If the name cannot be resolved, an exception is thrown.
- *
- * @param name the name of the {@code BackgroundInitializer}
- * @return the exception thrown by this initializer
- * @throws NoSuchElementException if the name cannot be resolved
- */
- public ConcurrentException getException(String name) {
- checkName(name);
- return exceptions.get(name);
- }
-
- /**
- * Returns a set with the names of all {@code BackgroundInitializer}
- * objects managed by the {@code MultiBackgroundInitializer}.
- *
- * @return an (unmodifiable) set with the names of the managed {@code
- * BackgroundInitializer} objects
- */
- public Set initializerNames() {
- return Collections.unmodifiableSet(initializers.keySet());
- }
-
- /**
- * Returns a flag whether the whole initialization was successful. This
- * is the case if no child initializer has thrown an exception.
- *
- * @return a flag whether the initialization was successful
- */
- public boolean isSuccessful() {
- return exceptions.isEmpty();
- }
-
- /**
- * Checks whether an initializer with the given name exists. If not,
- * throws an exception. If it exists, the associated child initializer
- * is returned.
- *
- * @param name the name to check
- * @return the initializer with this name
- * @throws NoSuchElementException if the name is unknown
- */
- private BackgroundInitializer> checkName(String name) {
- BackgroundInitializer> init = initializers.get(name);
- if (init == null) {
- throw new NoSuchElementException(
- "No child initializer with name " + name);
- }
-
- return init;
- }
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/TimedSemaphore.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/TimedSemaphore.java
deleted file mode 100644
index 2e859ee0..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/TimedSemaphore.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.concurrent;
-
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-/**
- *
- * A specialized semaphore implementation that provides a number of
- * permits in a given time frame.
- *
- *
- * This class is similar to the {@code java.util.concurrent.Semaphore} class
- * provided by the JDK in that it manages a configurable number of permits.
- * Using the {@link #acquire()} method a permit can be requested by a thread.
- * However, there is an additional timing dimension: there is no {@code
- * release()} method for freeing a permit, but all permits are automatically
- * released at the end of a configurable time frame. If a thread calls
- * {@link #acquire()} and the available permits are already exhausted for this
- * time frame, the thread is blocked. When the time frame ends all permits
- * requested so far are restored, and blocking threads are waked up again, so
- * that they can try to acquire a new permit. This basically means that in the
- * specified time frame only the given number of operations is possible.
- *
- *
- * A use case for this class is to artificially limit the load produced by a
- * process. As an example consider an application that issues database queries
- * on a production system in a background process to gather statistical
- * information. This background processing should not produce so much database
- * load that the functionality and the performance of the production system are
- * impacted. Here a {@code TimedSemaphore} could be installed to guarantee that
- * only a given number of database queries are issued per second.
- *
- *
- * A thread class for performing database queries could look as follows:
- *
- *
- * public class StatisticsThread extends Thread {
- * // The semaphore for limiting database load.
- * private final TimedSemaphore semaphore;
- * // Create an instance and set the semaphore
- * public StatisticsThread(TimedSemaphore timedSemaphore) {
- * semaphore = timedSemaphore;
- * }
- * // Gather statistics
- * public void run() {
- * try {
- * while(true) {
- * semaphore.acquire(); // limit database load
- * performQuery(); // issue a query
- * }
- * } catch(InterruptedException) {
- * // fall through
- * }
- * }
- * ...
- * }
- *
- *
- * The following code fragment shows how a {@code TimedSemaphore} is created
- * that allows only 10 operations per second and passed to the statistics
- * thread:
- *
- *
- * TimedSemaphore sem = new TimedSemaphore(1, TimeUnit.SECOND, 10);
- * StatisticsThread thread = new StatisticsThread(sem);
- * thread.start();
- *
- *
- *
- *
- * When creating an instance the time period for the semaphore must be
- * specified. {@code TimedSemaphore} uses an executor service with a
- * corresponding period to monitor this interval. The {@code
- * ScheduledExecutorService} to be used for this purpose can be provided at
- * construction time. Alternatively the class creates an internal executor
- * service.
- *
- *
- * Client code that uses {@code TimedSemaphore} has to call the
- * {@link #acquire()} method in aach processing step. {@code TimedSemaphore}
- * keeps track of the number of invocations of the {@link #acquire()} method and
- * blocks the calling thread if the counter exceeds the limit specified. When
- * the timer signals the end of the time period the counter is reset and all
- * waiting threads are released. Then another cycle can start.
- *
- *
- * It is possible to modify the limit at any time using the
- * {@link #setLimit(int)} method. This is useful if the load produced by an
- * operation has to be adapted dynamically. In the example scenario with the
- * thread collecting statistics it may make sense to specify a low limit during
- * day time while allowing a higher load in the night time. Reducing the limit
- * takes effect immediately by blocking incoming callers. If the limit is
- * increased, waiting threads are not released immediately, but wake up when the
- * timer runs out. Then, in the next period more processing steps can be
- * performed without blocking. By setting the limit to 0 the semaphore can be
- * switched off: in this mode the {@link #acquire()} method never blocks, but
- * lets all callers pass directly.
- *
- *
- * When the {@code TimedSemaphore} is no more needed its {@link #shutdown()}
- * method should be called. This causes the periodic task that monitors the time
- * interval to be canceled. If the {@code ScheduledExecutorService} has been
- * created by the semaphore at construction time, it is also shut down.
- * resources. After that {@link #acquire()} must not be called any more.
- *
- *
- * @since 3.0
- * @version $Id: TimedSemaphore.java 1199894 2011-11-09 17:53:59Z ggregory $
- */
-public class TimedSemaphore {
- /**
- * Constant for a value representing no limit. If the limit is set to a
- * value less or equal this constant, the {@code TimedSemaphore} will be
- * effectively switched off.
- */
- public static final int NO_LIMIT = 0;
-
- /** Constant for the thread pool size for the executor. */
- private static final int THREAD_POOL_SIZE = 1;
-
- /** The executor service for managing the timer thread. */
- private final ScheduledExecutorService executorService;
-
- /** Stores the period for this timed semaphore. */
- private final long period;
-
- /** The time unit for the period. */
- private final TimeUnit unit;
-
- /** A flag whether the executor service was created by this object. */
- private final boolean ownExecutor;
-
- /** A future object representing the timer task. */
- private ScheduledFuture> task;
-
- /** Stores the total number of invocations of the acquire() method. */
- private long totalAcquireCount;
-
- /**
- * The counter for the periods. This counter is increased every time a
- * period ends.
- */
- private long periodCount;
-
- /** The limit. */
- private int limit;
-
- /** The current counter. */
- private int acquireCount;
-
- /** The number of invocations of acquire() in the last period. */
- private int lastCallsPerPeriod;
-
- /** A flag whether shutdown() was called. */
- private boolean shutdown;
-
- /**
- * Creates a new instance of {@link TimedSemaphore} and initializes it with
- * the given time period and the limit.
- *
- * @param timePeriod the time period
- * @param timeUnit the unit for the period
- * @param limit the limit for the semaphore
- * @throws IllegalArgumentException if the period is less or equals 0
- */
- public TimedSemaphore(long timePeriod, TimeUnit timeUnit, int limit) {
- this(null, timePeriod, timeUnit, limit);
- }
-
- /**
- * Creates a new instance of {@link TimedSemaphore} and initializes it with
- * an executor service, the given time period, and the limit. The executor
- * service will be used for creating a periodic task for monitoring the time
- * period. It can be null, then a default service will be created.
- *
- * @param service the executor service
- * @param timePeriod the time period
- * @param timeUnit the unit for the period
- * @param limit the limit for the semaphore
- * @throws IllegalArgumentException if the period is less or equals 0
- */
- public TimedSemaphore(ScheduledExecutorService service, long timePeriod,
- TimeUnit timeUnit, int limit) {
- if (timePeriod <= 0) {
- throw new IllegalArgumentException("Time period must be greater 0!");
- }
-
- period = timePeriod;
- unit = timeUnit;
-
- if (service != null) {
- executorService = service;
- ownExecutor = false;
- } else {
- ScheduledThreadPoolExecutor s = new ScheduledThreadPoolExecutor(
- THREAD_POOL_SIZE);
- s.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
- s.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
- executorService = s;
- ownExecutor = true;
- }
-
- setLimit(limit);
- }
-
- /**
- * Returns the limit enforced by this semaphore. The limit determines how
- * many invocations of {@link #acquire()} are allowed within the monitored
- * period.
- *
- * @return the limit
- */
- public final synchronized int getLimit() {
- return limit;
- }
-
- /**
- * Sets the limit. This is the number of times the {@link #acquire()} method
- * can be called within the time period specified. If this limit is reached,
- * further invocations of {@link #acquire()} will block. Setting the limit
- * to a value <= {@link #NO_LIMIT} will cause the limit to be disabled,
- * i.e. an arbitrary number of{@link #acquire()} invocations is allowed in
- * the time period.
- *
- * @param limit the limit
- */
- public final synchronized void setLimit(int limit) {
- this.limit = limit;
- }
-
- /**
- * Initializes a shutdown. After that the object cannot be used any more.
- * This method can be invoked an arbitrary number of times. All invocations
- * after the first one do not have any effect.
- */
- public synchronized void shutdown() {
- if (!shutdown) {
-
- if (ownExecutor) {
- // if the executor was created by this instance, it has
- // to be shutdown
- getExecutorService().shutdownNow();
- }
- if (task != null) {
- task.cancel(false);
- }
-
- shutdown = true;
- }
- }
-
- /**
- * Tests whether the {@link #shutdown()} method has been called on this
- * object. If this method returns true, this instance cannot be used
- * any longer.
- *
- * @return a flag whether a shutdown has been performed
- */
- public synchronized boolean isShutdown() {
- return shutdown;
- }
-
- /**
- * Tries to acquire a permit from this semaphore. This method will block if
- * the limit for the current period has already been reached. If
- * {@link #shutdown()} has already been invoked, calling this method will
- * cause an exception. The very first call of this method starts the timer
- * task which monitors the time period set for this {@code TimedSemaphore}.
- * From now on the semaphore is active.
- *
- * @throws InterruptedException if the thread gets interrupted
- * @throws IllegalStateException if this semaphore is already shut down
- */
- public synchronized void acquire() throws InterruptedException {
- if (isShutdown()) {
- throw new IllegalStateException("TimedSemaphore is shut down!");
- }
-
- if (task == null) {
- task = startTimer();
- }
-
- boolean canPass = false;
- do {
- canPass = getLimit() <= NO_LIMIT || acquireCount < getLimit();
- if (!canPass) {
- wait();
- } else {
- acquireCount++;
- }
- } while (!canPass);
- }
-
- /**
- * Returns the number of (successful) acquire invocations during the last
- * period. This is the number of times the {@link #acquire()} method was
- * called without blocking. This can be useful for testing or debugging
- * purposes or to determine a meaningful threshold value. If a limit is set,
- * the value returned by this method won't be greater than this limit.
- *
- * @return the number of non-blocking invocations of the {@link #acquire()}
- * method
- */
- public synchronized int getLastAcquiresPerPeriod() {
- return lastCallsPerPeriod;
- }
-
- /**
- * Returns the number of invocations of the {@link #acquire()} method for
- * the current period. This may be useful for testing or debugging purposes.
- *
- * @return the current number of {@link #acquire()} invocations
- */
- public synchronized int getAcquireCount() {
- return acquireCount;
- }
-
- /**
- * Returns the number of calls to the {@link #acquire()} method that can
- * still be performed in the current period without blocking. This method
- * can give an indication whether it is safe to call the {@link #acquire()}
- * method without risking to be suspended. However, there is no guarantee
- * that a subsequent call to {@link #acquire()} actually is not-blocking
- * because in the mean time other threads may have invoked the semaphore.
- *
- * @return the current number of available {@link #acquire()} calls in the
- * current period
- */
- public synchronized int getAvailablePermits() {
- return getLimit() - getAcquireCount();
- }
-
- /**
- * Returns the average number of successful (i.e. non-blocking)
- * {@link #acquire()} invocations for the entire life-time of this {@code
- * TimedSemaphore}. This method can be used for instance for statistical
- * calculations.
- *
- * @return the average number of {@link #acquire()} invocations per time
- * unit
- */
- public synchronized double getAverageCallsPerPeriod() {
- return periodCount == 0 ? 0 : (double) totalAcquireCount
- / (double) periodCount;
- }
-
- /**
- * Returns the time period. This is the time monitored by this semaphore.
- * Only a given number of invocations of the {@link #acquire()} method is
- * possible in this period.
- *
- * @return the time period
- */
- public long getPeriod() {
- return period;
- }
-
- /**
- * Returns the time unit. This is the unit used by {@link #getPeriod()}.
- *
- * @return the time unit
- */
- public TimeUnit getUnit() {
- return unit;
- }
-
- /**
- * Returns the executor service used by this instance.
- *
- * @return the executor service
- */
- protected ScheduledExecutorService getExecutorService() {
- return executorService;
- }
-
- /**
- * Starts the timer. This method is called when {@link #acquire()} is called
- * for the first time. It schedules a task to be executed at fixed rate to
- * monitor the time period specified.
- *
- * @return a future object representing the task scheduled
- */
- protected ScheduledFuture> startTimer() {
- return getExecutorService().scheduleAtFixedRate(new Runnable() {
- public void run() {
- endOfPeriod();
- }
- }, getPeriod(), getPeriod(), getUnit());
- }
-
- /**
- * The current time period is finished. This method is called by the timer
- * used internally to monitor the time period. It resets the counter and
- * releases the threads waiting for this barrier.
- */
- synchronized void endOfPeriod() {
- lastCallsPerPeriod = acquireCount;
- totalAcquireCount += acquireCount;
- periodCount++;
- acquireCount = 0;
- notifyAll();
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/package.html b/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/package.html
deleted file mode 100644
index 0ab61e0e..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/concurrent/package.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-Provides support classes for multi-threaded programming. This package is
-intended to be an extension to java.util.concurrent.
-
These classes are thread-safe.
-
-
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/event/EventListenerSupport.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/event/EventListenerSupport.java
deleted file mode 100644
index 4ece87d6..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/event/EventListenerSupport.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package external.org.apache.commons.lang3.event;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import external.org.apache.commons.lang3.Validate;
-
-/**
- * An EventListenerSupport object can be used to manage a list of event
- * listeners of a particular type. The class provides
- * {@link #addListener(Object)} and {@link #removeListener(Object)} methods
- * for registering listeners, as well as a {@link #fire()} method for firing
- * events to the listeners.
- *
- *
- * To use this class, suppose you want to support ActionEvents. You would do:
- *
- * public class MyActionEventSource
- * {
- * private EventListenerSupport actionListeners =
- * EventListenerSupport.create(ActionListener.class);
- *
- * public void someMethodThatFiresAction()
- * {
- * ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "somethingCool");
- * actionListeners.fire().actionPerformed(e);
- * }
- * }
- *
- *
- * Serializing an {@link EventListenerSupport} instance will result in any
- * non-{@link Serializable} listeners being silently dropped.
- *
- * @param the type of event listener that is supported by this proxy.
- *
- * @since 3.0
- * @version $Id: EventListenerSupport.java 1082302 2011-03-16 21:08:27Z oheger $
- */
-public class EventListenerSupport implements Serializable {
-
- /** Serialization version */
- private static final long serialVersionUID = 3593265990380473632L;
-
- /**
- * The list used to hold the registered listeners. This list is
- * intentionally a thread-safe copy-on-write-array so that traversals over
- * the list of listeners will be atomic.
- */
- private List listeners = new CopyOnWriteArrayList();
-
- /**
- * The proxy representing the collection of listeners. Calls to this proxy
- * object will sent to all registered listeners.
- */
- private transient L proxy;
-
- /**
- * Empty typed array for #getListeners().
- */
- private transient L[] prototypeArray;
-
- /**
- * Creates an EventListenerSupport object which supports the specified
- * listener type.
- *
- * @param the type of the listener interface
- * @param listenerInterface the type of listener interface that will receive
- * events posted using this class.
- *
- * @return an EventListenerSupport object which supports the specified
- * listener type.
- *
- * @throws NullPointerException if listenerInterface is
- * null.
- * @throws IllegalArgumentException if listenerInterface is
- * not an interface.
- */
- public static EventListenerSupport create(Class listenerInterface) {
- return new EventListenerSupport(listenerInterface);
- }
-
- /**
- * Creates an EventListenerSupport object which supports the provided
- * listener interface.
- *
- * @param listenerInterface the type of listener interface that will receive
- * events posted using this class.
- *
- * @throws NullPointerException if listenerInterface is
- * null.
- * @throws IllegalArgumentException if listenerInterface is
- * not an interface.
- */
- public EventListenerSupport(Class listenerInterface) {
- this(listenerInterface, Thread.currentThread().getContextClassLoader());
- }
-
- /**
- * Creates an EventListenerSupport object which supports the provided
- * listener interface using the specified class loader to create the JDK
- * dynamic proxy.
- *
- * @param listenerInterface the listener interface.
- * @param classLoader the class loader.
- *
- * @throws NullPointerException if listenerInterface or
- * classLoader is null.
- * @throws IllegalArgumentException if listenerInterface is
- * not an interface.
- */
- public EventListenerSupport(Class listenerInterface, ClassLoader classLoader) {
- this();
- Validate.notNull(listenerInterface, "Listener interface cannot be null.");
- Validate.notNull(classLoader, "ClassLoader cannot be null.");
- Validate.isTrue(listenerInterface.isInterface(), "Class {0} is not an interface",
- listenerInterface.getName());
- initializeTransientFields(listenerInterface, classLoader);
- }
-
- /**
- * Create a new EventListenerSupport instance.
- * Serialization-friendly constructor.
- */
- private EventListenerSupport() {
- }
-
- /**
- * Returns a proxy object which can be used to call listener methods on all
- * of the registered event listeners. All calls made to this proxy will be
- * forwarded to all registered listeners.
- *
- * @return a proxy object which can be used to call listener methods on all
- * of the registered event listeners
- */
- public L fire() {
- return proxy;
- }
-
-//**********************************************************************************************************************
-// Other Methods
-//**********************************************************************************************************************
-
- /**
- * Registers an event listener.
- *
- * @param listener the event listener (may not be null).
- *
- * @throws NullPointerException if listener is
- * null.
- */
- public void addListener(L listener) {
- Validate.notNull(listener, "Listener object cannot be null.");
- listeners.add(listener);
- }
-
- /**
- * Returns the number of registered listeners.
- *
- * @return the number of registered listeners.
- */
- int getListenerCount() {
- return listeners.size();
- }
-
- /**
- * Unregisters an event listener.
- *
- * @param listener the event listener (may not be null).
- *
- * @throws NullPointerException if listener is
- * null.
- */
- public void removeListener(L listener) {
- Validate.notNull(listener, "Listener object cannot be null.");
- listeners.remove(listener);
- }
-
- /**
- * Get an array containing the currently registered listeners.
- * Modification to this array's elements will have no effect on the
- * {@link EventListenerSupport} instance.
- * @return L[]
- */
- public L[] getListeners() {
- return listeners.toArray(prototypeArray);
- }
-
- /**
- * Serialize.
- * @param objectOutputStream the output stream
- * @throws IOException if an IO error occurs
- */
- private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
- ArrayList serializableListeners = new ArrayList();
-
- // don't just rely on instanceof Serializable:
- ObjectOutputStream testObjectOutputStream = new ObjectOutputStream(new ByteArrayOutputStream());
- for (L listener : listeners) {
- try {
- testObjectOutputStream.writeObject(listener);
- serializableListeners.add(listener);
- } catch (IOException exception) {
- //recreate test stream in case of indeterminate state
- testObjectOutputStream = new ObjectOutputStream(new ByteArrayOutputStream());
- }
- }
- /*
- * we can reconstitute everything we need from an array of our listeners,
- * which has the additional advantage of typically requiring less storage than a list:
- */
- objectOutputStream.writeObject(serializableListeners.toArray(prototypeArray));
- }
-
- /**
- * Deserialize.
- * @param objectInputStream the input stream
- * @throws IOException if an IO error occurs
- * @throws ClassNotFoundException if the class cannot be resolved
- */
- private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
- @SuppressWarnings("unchecked")
- L[] listeners = (L[]) objectInputStream.readObject();
-
- this.listeners = new CopyOnWriteArrayList(listeners);
-
- @SuppressWarnings("unchecked")
- Class listenerInterface = (Class) listeners.getClass().getComponentType();
-
- initializeTransientFields(listenerInterface, Thread.currentThread().getContextClassLoader());
- }
-
- /**
- * Initialize transient fields.
- * @param listenerInterface the class of the listener interface
- * @param classLoader the class loader to be used
- */
- private void initializeTransientFields(Class listenerInterface, ClassLoader classLoader) {
- @SuppressWarnings("unchecked")
- L[] array = (L[]) Array.newInstance(listenerInterface, 0);
- this.prototypeArray = array;
- createProxy(listenerInterface, classLoader);
- }
-
- /**
- * Create the proxy object.
- * @param listenerInterface the class of the listener interface
- * @param classLoader the class loader to be used
- */
- private void createProxy(Class listenerInterface, ClassLoader classLoader) {
- proxy = listenerInterface.cast(Proxy.newProxyInstance(classLoader,
- new Class[] { listenerInterface }, createInvocationHandler()));
- }
-
- /**
- * Create the {@link InvocationHandler} responsible for broadcasting calls
- * to the managed listeners. Subclasses can override to provide custom behavior.
- * @return ProxyInvocationHandler
- */
- protected InvocationHandler createInvocationHandler() {
- return new ProxyInvocationHandler();
- }
-
- /**
- * An invocation handler used to dispatch the event(s) to all the listeners.
- */
- protected class ProxyInvocationHandler implements InvocationHandler {
- /** Serialization version */
- private static final long serialVersionUID = 1L;
-
- /**
- * Propagates the method call to all registered listeners in place of
- * the proxy listener object.
- *
- * @param proxy the proxy object representing a listener on which the
- * invocation was called.
- * @param method the listener method that will be called on all of the
- * listeners.
- * @param args event arguments to propagate to the listeners.
- * @return the result of the method call
- * @throws Throwable if an error occurs
- */
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- for (L listener : listeners) {
- method.invoke(listener, args);
- }
- return null;
- }
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/event/EventUtils.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/event/EventUtils.java
deleted file mode 100644
index 0cfcb8b4..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/event/EventUtils.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package external.org.apache.commons.lang3.event;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import external.org.apache.commons.lang3.reflect.MethodUtils;
-
-/**
- * Provides some useful event-based utility methods.
- *
- * @since 3.0
- * @version $Id: EventUtils.java 1091072 2011-04-11 13:42:03Z mbenson $
- */
-public class EventUtils {
-
- /**
- * Adds an event listener to the specified source. This looks for an "add" method corresponding to the event
- * type (addActionListener, for example).
- * @param eventSource the event source
- * @param listenerType the event listener type
- * @param listener the listener
- * @param the event listener type
- *
- * @throws IllegalArgumentException if the object doesn't support the listener type
- */
- public static void addEventListener(Object eventSource, Class listenerType, L listener) {
- try {
- MethodUtils.invokeMethod(eventSource, "add" + listenerType.getSimpleName(), listener);
- } catch (NoSuchMethodException e) {
- throw new IllegalArgumentException("Class " + eventSource.getClass().getName()
- + " does not have a public add" + listenerType.getSimpleName()
- + " method which takes a parameter of type " + listenerType.getName() + ".");
- } catch (IllegalAccessException e) {
- throw new IllegalArgumentException("Class " + eventSource.getClass().getName()
- + " does not have an accessible add" + listenerType.getSimpleName ()
- + " method which takes a parameter of type " + listenerType.getName() + ".");
- } catch (InvocationTargetException e) {
- throw new RuntimeException("Unable to add listener.", e.getCause());
- }
- }
-
- /**
- * Binds an event listener to a specific method on a specific object.
- *
- * @param the event listener type
- * @param target the target object
- * @param methodName the name of the method to be called
- * @param eventSource the object which is generating events (JButton, JList, etc.)
- * @param listenerType the listener interface (ActionListener.class, SelectionListener.class, etc.)
- * @param eventTypes the event types (method names) from the listener interface (if none specified, all will be
- * supported)
- */
- public static void bindEventsToMethod(Object target, String methodName, Object eventSource,
- Class listenerType, String... eventTypes) {
- final L listener = listenerType.cast(Proxy.newProxyInstance(target.getClass().getClassLoader(),
- new Class[] { listenerType }, new EventBindingInvocationHandler(target, methodName, eventTypes)));
- addEventListener(eventSource, listenerType, listener);
- }
-
- private static class EventBindingInvocationHandler implements InvocationHandler {
- private final Object target;
- private final String methodName;
- private final Set eventTypes;
-
- /**
- * Creates a new instance of {@code EventBindingInvocationHandler}.
- *
- * @param target the target object for method invocations
- * @param methodName the name of the method to be invoked
- * @param eventTypes the names of the supported event types
- */
- EventBindingInvocationHandler(final Object target, final String methodName, String[] eventTypes) {
- this.target = target;
- this.methodName = methodName;
- this.eventTypes = new HashSet(Arrays.asList(eventTypes));
- }
-
- /**
- * Handles a method invocation on the proxy object.
- *
- * @param proxy the proxy instance
- * @param method the method to be invoked
- * @param parameters the parameters for the method invocation
- * @return the result of the method call
- * @throws Throwable if an error occurs
- */
- public Object invoke(final Object proxy, final Method method, final Object[] parameters) throws Throwable {
- if (eventTypes.isEmpty() || eventTypes.contains(method.getName())) {
- if (hasMatchingParametersMethod(method)) {
- return MethodUtils.invokeMethod(target, methodName, parameters);
- } else {
- return MethodUtils.invokeMethod(target, methodName);
- }
- }
- return null;
- }
-
- /**
- * Checks whether a method for the passed in parameters can be found.
- *
- * @param method the listener method invoked
- * @return a flag whether the parameters could be matched
- */
- private boolean hasMatchingParametersMethod(final Method method) {
- return MethodUtils.getAccessibleMethod(target.getClass(), methodName, method.getParameterTypes()) != null;
- }
- }
-}
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/event/package.html b/lib/apache-commons-lang/external/org/apache/commons/lang3/event/package.html
deleted file mode 100644
index c5d95f67..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/event/package.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-Provides some useful event-based utilities.
-@since 3.0
-
-
diff --git a/lib/apache-commons-lang/external/org/apache/commons/lang3/exception/ContextedException.java b/lib/apache-commons-lang/external/org/apache/commons/lang3/exception/ContextedException.java
deleted file mode 100644
index 477af842..00000000
--- a/lib/apache-commons-lang/external/org/apache/commons/lang3/exception/ContextedException.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package external.org.apache.commons.lang3.exception;
-
-import java.util.List;
-import java.util.Set;
-
-import external.org.apache.commons.lang3.tuple.Pair;
-
-/**
- *
- * An exception that provides an easy and safe way to add contextual information.
- *
- * An exception trace itself is often insufficient to provide rapid diagnosis of the issue.
- * Frequently what is needed is a select few pieces of local contextual data.
- * Providing this data is tricky however, due to concerns over formatting and nulls.
- *
- * The contexted exception approach allows the exception to be created together with a
- * list of context label-value pairs. This additional information is automatically included in
- * the message and printed stack trace.
- *
- * An unchecked version of this exception is provided by ContextedRuntimeException.
- *
- *
- *
- * @see ContextedRuntimeException
- * @since 3.0
- */
-public class ContextedException extends Exception implements ExceptionContext {
-
- /** The serialization version. */
- private static final long serialVersionUID = 20110706L;
- /** The context where the data is stored. */
- private final ExceptionContext exceptionContext;
-
- /**
- * Instantiates ContextedException without message or cause.
- *
- * The context information is stored using a default implementation.
- */
- public ContextedException() {
- super();
- exceptionContext = new DefaultExceptionContext();
- }
-
- /**
- * Instantiates ContextedException with message, but without cause.
- *
- * The context information is stored using a default implementation.
- *
- * @param message the exception message, may be null
- */
- public ContextedException(String message) {
- super(message);
- exceptionContext = new DefaultExceptionContext();
- }
-
- /**
- * Instantiates ContextedException with cause, but without message.
- *
- * The context information is stored using a default implementation.
- *
- * @param cause the underlying cause of the exception, may be null
- */
- public ContextedException(Throwable cause) {
- super(cause);
- exceptionContext = new DefaultExceptionContext();
- }
-
- /**
- * Instantiates ContextedException with cause and message.
- *
- * The context information is stored using a default implementation.
- *
- * @param message the exception message, may be null
- * @param cause the underlying cause of the exception, may be null
- */
- public ContextedException(String message, Throwable cause) {
- super(message, cause);
- exceptionContext = new DefaultExceptionContext();
- }
-
- /**
- * Instantiates ContextedException with cause, message, and ExceptionContext.
- *
- * @param message the exception message, may be null
- * @param cause the underlying cause of the exception, may be null
- * @param context the context used to store the additional information, null uses default implementation
- */
- public ContextedException(String message, Throwable cause, ExceptionContext context) {
- super(message, cause);
- if (context == null) {
- context = new DefaultExceptionContext();
- }
- exceptionContext = context;
- }
-
- //-----------------------------------------------------------------------
- /**
- * Adds information helpful to a developer in diagnosing and correcting the problem.
- * For the information to be meaningful, the value passed should have a reasonable
- * toString() implementation.
- * Different values can be added with the same label multiple times.
- *
- * Note: This exception is only serializable if the object added is serializable.
- *
- *
- * @param label a textual label associated with information, {@code null} not recommended
- * @param value information needed to understand exception, may be {@code null}
- * @return {@code this}, for method chaining, not {@code null}
- */
- public ContextedException addContextValue(String label, Object value) {
- exceptionContext.addContextValue(label, value);
- return this;
- }
-
- /**
- * Sets information helpful to a developer in diagnosing and correcting the problem.
- * For the information to be meaningful, the value passed should have a reasonable
- * toString() implementation.
- * Any existing values with the same labels are removed before the new one is added.
- *
- * Note: This exception is only serializable if the object added as value is serializable.
- *
- *
- * @param label a textual label associated with information, {@code null} not recommended
- * @param value information needed to understand exception, may be {@code null}
- * @return {@code this}, for method chaining, not {@code null}
- */
- public ContextedException setContextValue(String label, Object value) {
- exceptionContext.setContextValue(label, value);
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public List