diff --git a/json-path/pom.xml b/json-path/pom.xml index 84d775e1..a20ee021 100644 --- a/json-path/pom.xml +++ b/json-path/pom.xml @@ -30,10 +30,6 @@ net.minidev json-smart - - org.apache.commons - commons-lang3 - org.codehaus.jackson jackson-mapper-asl diff --git a/json-path/src/main/java/com/jayway/jsonpath/Configuration.java b/json-path/src/main/java/com/jayway/jsonpath/Configuration.java index ddd940c8..f02c11f7 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/Configuration.java +++ b/json-path/src/main/java/com/jayway/jsonpath/Configuration.java @@ -22,7 +22,7 @@ import java.util.Collections; import java.util.EnumSet; import java.util.Set; -import static org.apache.commons.lang3.Validate.notNull; +import static com.jayway.jsonpath.internal.Utils.*; /** * User: kalle diff --git a/json-path/src/main/java/com/jayway/jsonpath/Criteria.java b/json-path/src/main/java/com/jayway/jsonpath/Criteria.java index edda2d4f..9c923060 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/Criteria.java +++ b/json-path/src/main/java/com/jayway/jsonpath/Criteria.java @@ -14,13 +14,13 @@ */ package com.jayway.jsonpath; -import org.apache.commons.lang3.Validate; +import com.jayway.jsonpath.internal.Utils; import java.util.*; import java.util.regex.Pattern; import static java.util.Arrays.asList; -import static org.apache.commons.lang3.Validate.notNull; +import static com.jayway.jsonpath.internal.Utils.*; /** * @author Kalle Stenflo @@ -60,14 +60,14 @@ public class Criteria { private Criteria(String key) { - Validate.notEmpty(key, "key can not be null or empty"); + Utils.notEmpty(key, "key can not be null or empty"); this.criteriaChain = new ArrayList(); this.criteriaChain.add(this); this.key = JsonPath.compile(key); } private Criteria(List criteriaChain, String key) { - Validate.notEmpty(key, "key can not be null or empty"); + Utils.notEmpty(key, "key can not be null or empty"); this.criteriaChain = criteriaChain; this.criteriaChain.add(this); this.key = JsonPath.compile(key); diff --git a/json-path/src/main/java/com/jayway/jsonpath/JsonModel.java b/json-path/src/main/java/com/jayway/jsonpath/JsonModel.java index d5bf2cbc..9769f142 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/JsonModel.java +++ b/json-path/src/main/java/com/jayway/jsonpath/JsonModel.java @@ -14,10 +14,10 @@ */ package com.jayway.jsonpath; -import com.jayway.jsonpath.internal.ConvertUtils; import com.jayway.jsonpath.internal.JsonFormatter; import com.jayway.jsonpath.internal.JsonReader; import com.jayway.jsonpath.internal.PathToken; +import com.jayway.jsonpath.internal.Utils; import com.jayway.jsonpath.spi.JsonProvider; import com.jayway.jsonpath.spi.JsonProviderFactory; import com.jayway.jsonpath.spi.MappingProviderFactory; @@ -28,8 +28,7 @@ import java.net.URL; import java.util.*; import static java.util.Arrays.asList; -import static org.apache.commons.lang3.Validate.isTrue; -import static org.apache.commons.lang3.Validate.notNull; +import static com.jayway.jsonpath.internal.Utils.*; /** * A JsonModel holds a parsed JSON document and provides easy read and write operations. In contrast to the @@ -889,22 +888,22 @@ public class JsonModel { @Override public Integer getInteger(String key) { - return ConvertUtils.toInt(get(key)); + return Utils.toInt(get(key)); } @Override public Long getLong(String key) { - return ConvertUtils.toLong(get(key)); + return Utils.toLong(get(key)); } @Override public Double getDouble(String key) { - return ConvertUtils.toDouble(get(key)); + return Utils.toDouble(get(key)); } @Override public String getString(String key) { - return ConvertUtils.toString(get(key)); + return Utils.toString(get(key)); } @Override diff --git a/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java b/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java index 746d02f1..7fde6e8a 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java +++ b/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java @@ -15,15 +15,14 @@ package com.jayway.jsonpath; -import com.jayway.jsonpath.internal.IOUtils; import com.jayway.jsonpath.internal.JsonReader; import com.jayway.jsonpath.internal.PathToken; import com.jayway.jsonpath.internal.PathTokenizer; +import com.jayway.jsonpath.internal.Utils; import com.jayway.jsonpath.internal.filter.PathTokenFilter; import com.jayway.jsonpath.spi.HttpProviderFactory; import com.jayway.jsonpath.spi.JsonProvider; import com.jayway.jsonpath.spi.JsonProviderFactory; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,8 +34,8 @@ import java.net.URL; import java.util.LinkedList; import java.util.regex.Pattern; +import static com.jayway.jsonpath.internal.Utils.*; import static java.util.Arrays.asList; -import static org.apache.commons.lang3.Validate.*; /** *

@@ -117,7 +116,7 @@ public class JsonPath { notEmpty(jsonPath, "path can not be empty"); - int filterCountInPath = StringUtils.countMatches(jsonPath, "[?]"); + int filterCountInPath = Utils.countMatches(jsonPath, "[?]"); isTrue(filterCountInPath == filters.length, "Filters in path ([?]) does not match provided filters."); this.tokenizer = new PathTokenizer(jsonPath); @@ -326,7 +325,7 @@ public class JsonPath { in = HttpProviderFactory.getProvider().get(jsonURL); return read(configuration.getProvider().parse(in), configuration); } finally { - IOUtils.closeQuietly(in); + Utils.closeQuietly(in); } } @@ -364,7 +363,7 @@ public class JsonPath { fis = new FileInputStream(jsonFile); return read(configuration.getProvider().parse(fis), configuration); } finally { - IOUtils.closeQuietly(fis); + Utils.closeQuietly(fis); } } @@ -383,7 +382,7 @@ public class JsonPath { try { return read(JsonProviderFactory.createProvider().parse(jsonInputStream)); } finally { - IOUtils.closeQuietly(jsonInputStream); + Utils.closeQuietly(jsonInputStream); } } @@ -404,7 +403,7 @@ public class JsonPath { try { return read(configuration.getProvider().parse(jsonInputStream), configuration); } finally { - IOUtils.closeQuietly(jsonInputStream); + Utils.closeQuietly(jsonInputStream); } } diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/ConvertUtils.java b/json-path/src/main/java/com/jayway/jsonpath/internal/ConvertUtils.java deleted file mode 100644 index a46542a9..00000000 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/ConvertUtils.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2011 the original author or authors. - * 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. - */ -package com.jayway.jsonpath.internal; - -import com.jayway.jsonpath.InvalidConversionException; - -/** - * @author Kalle Stenflo - */ -public class ConvertUtils { - - /** - * converts to Integer with radix 10 - * - * @param o object to convert - * @return converted value - */ - public static Integer toInt(Object o) { - if (null == o) - return null; - if (o instanceof Number) - return ((Number) o).intValue(); - try { - return Integer.valueOf(o.toString().trim(), 10); - } catch (Exception e) { - throw new InvalidConversionException("Could not convert " + o.toString() + " to Integer"); - } - } - - - /** - * converts to Long with radix 10 - * - * @param o object to convert - * @return converted value - */ - public static Long toLong(Object o) { - if (null == o) - return null; - if (o instanceof Number) - return ((Number) o).longValue(); - try { - return Long.valueOf(o.toString().trim(), 10); - } catch (Exception e) { - throw new InvalidConversionException("Could not convert " + o.toString() + " to Long"); - } - } - - /** - * converts to Double with radix 10 - * - * @param o object to convert - * @return converted value - */ - public static Double toDouble(Object o) { - if (null == o) - return null; - if (o instanceof Number) - return ((Number) o).doubleValue(); - try { - return Double.valueOf(o.toString().trim()); - } catch (Exception e) { - throw new InvalidConversionException("Could not convert " + o.toString() + " to Double"); - } - } - - public static String toString(Object o) { - if(null == o){ - return null; - } - - return o.toString(); - } -} diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/IOUtils.java b/json-path/src/main/java/com/jayway/jsonpath/internal/IOUtils.java deleted file mode 100644 index 3a0dc4fe..00000000 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/IOUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2011 the original author or authors. - * 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. - */ -package com.jayway.jsonpath.internal; - -import java.io.Closeable; -import java.io.IOException; - -/** - * @author Kalle Stenflo - */ -public abstract class IOUtils { - - public static void closeQuietly(Closeable closeable) { - try { - if (closeable != null) { - closeable.close(); - } - } catch (IOException ignore) {} - } -} diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/JsonReader.java b/json-path/src/main/java/com/jayway/jsonpath/internal/JsonReader.java index 624da08c..45aaa26b 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/JsonReader.java +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/JsonReader.java @@ -10,8 +10,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; -import static org.apache.commons.lang3.Validate.notEmpty; -import static org.apache.commons.lang3.Validate.notNull; +import static com.jayway.jsonpath.internal.Utils.*; /** * User: kalle @@ -70,7 +69,7 @@ public class JsonReader implements ParseContext, ReadContext { fis = new FileInputStream(json); parse(fis); } finally { - IOUtils.closeQuietly(fis); + Utils.closeQuietly(fis); } return this; } diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/Utils.java b/json-path/src/main/java/com/jayway/jsonpath/internal/Utils.java new file mode 100644 index 00000000..c9256976 --- /dev/null +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/Utils.java @@ -0,0 +1,451 @@ +package com.jayway.jsonpath.internal; + +import com.jayway.jsonpath.InvalidConversionException; + +import java.io.*; + +public class Utils { + + //--------------------------------------------------------- + // + // IO + // + //--------------------------------------------------------- + + public static void closeQuietly(Closeable closeable) { + try { + if (closeable != null) { + closeable.close(); + } + } catch (IOException ignore) {} + } + + //--------------------------------------------------------- + // + // Strings + // + //--------------------------------------------------------- + + /** + *

Checks if a CharSequence is empty ("") or null.

+ * + *
+     * StringUtils.isEmpty(null)      = true
+     * StringUtils.isEmpty("")        = true
+     * StringUtils.isEmpty(" ")       = false
+     * StringUtils.isEmpty("bob")     = false
+     * StringUtils.isEmpty("  bob  ") = false
+     * 
+ * + *

NOTE: This method changed in Lang version 2.0. + * It no longer trims the CharSequence. + * That functionality is available in isBlank().

+ * + * @param cs the CharSequence to check, may be null + * @return {@code true} if the CharSequence is empty or null + * @since 3.0 Changed signature from isEmpty(String) to isEmpty(CharSequence) + */ + public static boolean isEmpty(CharSequence cs) { + return cs == null || cs.length() == 0; + } + + /** + * Used by the indexOf(CharSequence methods) as a green implementation of indexOf. + * + * @param cs the {@code CharSequence} to be processed + * @param searchChar the {@code CharSequence} to be searched for + * @param start the start index + * @return the index where the search sequence was found + */ + static int indexOf(CharSequence cs, CharSequence searchChar, int start) { + return cs.toString().indexOf(searchChar.toString(), start); + } + + /** + *

Counts how many times the substring appears in the larger string.

+ * + *

A {@code null} or empty ("") String input returns {@code 0}.

+ * + *
+     * StringUtils.countMatches(null, *)       = 0
+     * StringUtils.countMatches("", *)         = 0
+     * StringUtils.countMatches("abba", null)  = 0
+     * StringUtils.countMatches("abba", "")    = 0
+     * StringUtils.countMatches("abba", "a")   = 2
+     * StringUtils.countMatches("abba", "ab")  = 1
+     * StringUtils.countMatches("abba", "xxx") = 0
+     * 
+ * + * @param str the CharSequence to check, may be null + * @param sub the substring to count, may be null + * @return the number of occurrences, 0 if either CharSequence is {@code null} + * @since 3.0 Changed signature from countMatches(String, String) to countMatches(CharSequence, CharSequence) + */ + public static int countMatches(CharSequence str, CharSequence sub) { + if (isEmpty(str) || isEmpty(sub)) { + return 0; + } + int count = 0; + int idx = 0; + while ((idx = indexOf(str, sub, idx)) != -1) { + count++; + idx += sub.length(); + } + return count; + } + + //--------------------------------------------------------- + // + // Validators + // + //--------------------------------------------------------- + + /** + *

Validate that the specified argument is not {@code null}; + * otherwise throwing an exception with the specified message. + * + *

Validate.notNull(myObject, "The object must not be null");
+ * + * @param the object type + * @param object the object to check + * @param message the {@link String#format(String, Object...)} exception message if invalid, not null + * @param values the optional values for the formatted exception message + * @return the validated object (never {@code null} for method chaining) + * @throws NullPointerException if the object is {@code null} + */ + public static T notNull(T object, String message, Object... values) { + if (object == null) { + throw new IllegalArgumentException(String.format(message, values)); + } + return object; + } + + /** + *

Validate that the argument condition is {@code true}; otherwise + * throwing an exception with the specified message. This method is useful when + * validating according to an arbitrary boolean expression, such as validating a + * primitive number or using your own custom validation expression.

+ * + *
Validate.isTrue(i > 0.0, "The value must be greater than zero: %d", i);
+ * + *

For performance reasons, the long value is passed as a separate parameter and + * appended to the exception message only in the case of an error.

+ * + * @param expression the boolean expression to check + * @param message + * @throws IllegalArgumentException if expression is {@code false} + */ + public static void isTrue(boolean expression, String message) { + if (expression == false) { + throw new IllegalArgumentException(message); + } + } + + /** + *

Validate that the specified argument character sequence is + * neither {@code null} nor a length of zero (no characters); + * otherwise throwing an exception with the specified message. + * + *

Validate.notEmpty(myString, "The string must not be empty");
+ * + * @param the character sequence type + * @param chars the character sequence to check, validated not null by this method + * @param message the {@link String#format(String, Object...)} exception message if invalid, not null + * @param values the optional values for the formatted exception message, null array not recommended + * @return the validated character sequence (never {@code null} method for chaining) + * @throws NullPointerException if the character sequence is {@code null} + * @throws IllegalArgumentException if the character sequence is empty + */ + public static T notEmpty(T chars, String message, Object... values) { + if (chars == null) { + throw new IllegalArgumentException(String.format(message, values)); + } + if (chars.length() == 0) { + throw new IllegalArgumentException(String.format(message, values)); + } + return chars; + } + + + + //--------------------------------------------------------- + // + // Converters + // + //--------------------------------------------------------- + /** + * converts to Integer with radix 10 + * + * @param o object to convert + * @return converted value + */ + public static Integer toInt(Object o) { + if (null == o) + return null; + if (o instanceof Number) + return ((Number) o).intValue(); + try { + return Integer.valueOf(o.toString().trim(), 10); + } catch (Exception e) { + throw new InvalidConversionException("Could not convert " + o.toString() + " to Integer"); + } + } + + + /** + * converts to Long with radix 10 + * + * @param o object to convert + * @return converted value + */ + public static Long toLong(Object o) { + if (null == o) + return null; + if (o instanceof Number) + return ((Number) o).longValue(); + try { + return Long.valueOf(o.toString().trim(), 10); + } catch (Exception e) { + throw new InvalidConversionException("Could not convert " + o.toString() + " to Long"); + } + } + + /** + * converts to Double with radix 10 + * + * @param o object to convert + * @return converted value + */ + public static Double toDouble(Object o) { + if (null == o) + return null; + if (o instanceof Number) + return ((Number) o).doubleValue(); + try { + return Double.valueOf(o.toString().trim()); + } catch (Exception e) { + throw new InvalidConversionException("Could not convert " + o.toString() + " to Double"); + } + } + + public static String toString(Object o) { + if(null == o){ + return null; + } + + return o.toString(); + } + + //--------------------------------------------------------- + // + // Serialization + // + //--------------------------------------------------------- + + /** + *

Deep clone an {@code Object} using serialization.

+ * + *

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 + */ + 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 RuntimeException("ClassNotFoundException while reading cloned object data", ex); + } catch (IOException ex) { + throw new RuntimeException("IOException while reading cloned object data", ex); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException ex) { + throw new RuntimeException("IOException on closing cloned object data InputStream.", ex); + } + } + } + + + /** + *

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 RuntimeException (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 RuntimeException(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 RuntimeException (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 RuntimeException (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 RuntimeException(ex); + } catch (IOException ex) { + throw new RuntimeException(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 RuntimeException (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/json-path/src/main/java/com/jayway/jsonpath/spi/impl/AbstractJsonProvider.java b/json-path/src/main/java/com/jayway/jsonpath/spi/impl/AbstractJsonProvider.java index 7fc9adac..d35e5702 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/spi/impl/AbstractJsonProvider.java +++ b/json-path/src/main/java/com/jayway/jsonpath/spi/impl/AbstractJsonProvider.java @@ -14,8 +14,8 @@ */ package com.jayway.jsonpath.spi.impl; +import com.jayway.jsonpath.internal.Utils; import com.jayway.jsonpath.spi.JsonProvider; -import org.apache.commons.lang3.SerializationUtils; import java.io.Serializable; import java.util.ArrayList; @@ -30,7 +30,7 @@ public abstract class AbstractJsonProvider implements JsonProvider { @Override public Object clone(Object obj){ - return SerializationUtils.clone((Serializable)obj); + return Utils.clone((Serializable) obj); } /** diff --git a/json-path/src/test/java/com/jayway/jsonpath/HttpProviderTest.java b/json-path/src/test/java/com/jayway/jsonpath/HttpProviderTest.java index dac8704d..f2c6651b 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/HttpProviderTest.java +++ b/json-path/src/test/java/com/jayway/jsonpath/HttpProviderTest.java @@ -1,8 +1,7 @@ package com.jayway.jsonpath; -import com.jayway.jsonpath.internal.IOUtils; +import com.jayway.jsonpath.internal.Utils; import com.jayway.jsonpath.spi.HttpProviderFactory; -import org.junit.Ignore; import org.junit.Test; import java.io.IOException; @@ -42,7 +41,7 @@ public class HttpProviderTest { assertEquals(EXPECTED, json); } catch (IOException e) { - IOUtils.closeQuietly(inputStream); + Utils.closeQuietly(inputStream); } } diff --git a/json-path/src/test/java/com/jayway/jsonpath/IssuesTest.java b/json-path/src/test/java/com/jayway/jsonpath/IssuesTest.java index f30a90ea..937b2cdc 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/IssuesTest.java +++ b/json-path/src/test/java/com/jayway/jsonpath/IssuesTest.java @@ -1,11 +1,9 @@ package com.jayway.jsonpath; -import com.jayway.jsonpath.internal.IOUtils; - +import com.jayway.jsonpath.internal.Utils; import net.minidev.json.JSONObject; import org.hamcrest.Matchers; -import org.junit.Ignore; import org.junit.Test; import java.io.InputStream; @@ -109,7 +107,7 @@ public class IssuesTest { is.close(); } catch (Exception e) { e.printStackTrace(); - IOUtils.closeQuietly(is); + Utils.closeQuietly(is); } } diff --git a/json-path/src/test/java/com/jayway/jsonpath/JsonProviderTest.java b/json-path/src/test/java/com/jayway/jsonpath/JsonProviderTest.java index 97949795..0112daff 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/JsonProviderTest.java +++ b/json-path/src/test/java/com/jayway/jsonpath/JsonProviderTest.java @@ -1,7 +1,7 @@ package com.jayway.jsonpath; +import com.jayway.jsonpath.internal.Utils; import com.jayway.jsonpath.spi.impl.JacksonProvider; -import org.apache.commons.lang3.SerializationUtils; import org.junit.Test; import java.io.Serializable; @@ -60,7 +60,7 @@ public class JsonProviderTest { Serializable jsonObject = (Serializable) model(DOCUMENT).getJsonObject(); - Object clone = SerializationUtils.clone(jsonObject); + Object clone = Utils.clone(jsonObject); System.out.println(model(clone).toJson()); diff --git a/pom.xml b/pom.xml index 50c83fd6..9e3c2890 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,6 @@ 1.7.5 4.10 2.4 - 3.1 1.3 1.9.11 1.2 @@ -203,12 +202,6 @@ ${json-smart.version}
- - org.apache.commons - commons-lang3 - ${commons-lang.version} - - org.codehaus.jackson jackson-mapper-asl