diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2018-11-27 02:59:03 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2018-11-27 02:59:03 +0000 |
commit | f6315def9c252d7b3866eb580d4c0c5de003a86e (patch) | |
tree | 928b5a3075b3081437039123c9d10173c223f884 /src/main | |
parent | 985b8674968ca118a4845280174aa69924242145 (diff) | |
download | jackcess-f6315def9c252d7b3866eb580d4c0c5de003a86e.tar.gz jackcess-f6315def9c252d7b3866eb580d4c0c5de003a86e.zip |
switch to commons lang3
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/jdk8@1230 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/main')
18 files changed, 60 insertions, 62 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/expr/Identifier.java b/src/main/java/com/healthmarketscience/jackcess/expr/Identifier.java index 45db1ad..709a7cd 100644 --- a/src/main/java/com/healthmarketscience/jackcess/expr/Identifier.java +++ b/src/main/java/com/healthmarketscience/jackcess/expr/Identifier.java @@ -16,7 +16,8 @@ limitations under the License. package com.healthmarketscience.jackcess.expr; -import org.apache.commons.lang.ObjectUtils; +import java.util.Objects; + /** * identifies a database entity (e.g. the name of a database field). An @@ -71,9 +72,9 @@ public class Identifier Identifier oi = (Identifier)o; - return (ObjectUtils.equals(_objectName, oi._objectName) && - ObjectUtils.equals(_collectionName, oi._collectionName) && - ObjectUtils.equals(_propertyName, oi._propertyName)); + return (Objects.equals(_objectName, oi._objectName) && + Objects.equals(_collectionName, oi._collectionName) && + Objects.equals(_propertyName, oi._propertyName)); } @Override diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java index be2bf1c..8fa1906 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java @@ -54,7 +54,7 @@ import com.healthmarketscience.jackcess.expr.Identifier; import com.healthmarketscience.jackcess.impl.complex.ComplexValueForeignKeyImpl; import com.healthmarketscience.jackcess.util.ColumnValidator; import com.healthmarketscience.jackcess.util.SimpleColumnValidator; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java b/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java index 8440f81..18811c3 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java @@ -32,7 +32,7 @@ import com.healthmarketscience.jackcess.RuntimeIOException; import static com.healthmarketscience.jackcess.impl.OleUtil.*; import com.healthmarketscience.jackcess.util.MemFileChannel; import static com.healthmarketscience.jackcess.util.OleBlob.*; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.poi.poifs.filesystem.DirectoryEntry; import org.apache.poi.poifs.filesystem.DocumentEntry; import org.apache.poi.poifs.filesystem.DocumentInputStream; diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/CustomToStringStyle.java b/src/main/java/com/healthmarketscience/jackcess/impl/CustomToStringStyle.java index 707e163..89ef061 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/CustomToStringStyle.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/CustomToStringStyle.java @@ -21,9 +21,8 @@ import java.util.Collection; import java.util.Iterator; import java.util.Map; -import org.apache.commons.lang.SystemUtils; -import org.apache.commons.lang.builder.StandardToStringStyle; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.StandardToStringStyle; +import org.apache.commons.lang3.builder.ToStringBuilder; /** * Custom ToStringStyle for use with ToStringBuilder. @@ -34,7 +33,7 @@ public class CustomToStringStyle extends StandardToStringStyle { private static final long serialVersionUID = 0L; - private static final String ML_FIELD_SEP = SystemUtils.LINE_SEPARATOR + " "; + private static final String ML_FIELD_SEP = System.lineSeparator() + " "; private static final String IMPL_SUFFIX = "Impl"; private static final int MAX_BYTE_DETAIL_LEN = 20; private static final Object IGNORE_ME = new Object(); @@ -47,7 +46,7 @@ public class CustomToStringStyle extends StandardToStringStyle setFieldSeparatorAtStart(true); setFieldNameValueSeparator(": "); setArraySeparator("," + ML_FIELD_SEP); - setContentEnd(SystemUtils.LINE_SEPARATOR + "]"); + setContentEnd(System.lineSeparator() + "]"); setUseShortClassName(true); } }; @@ -91,7 +90,7 @@ public class CustomToStringStyle extends StandardToStringStyle } @Override - protected String getShortClassName(Class clss) { + protected String getShortClassName(Class<?> clss) { String shortName = super.getShortClassName(clss); if(shortName.endsWith(IMPL_SUFFIX)) { shortName = shortName.substring(0, @@ -116,7 +115,7 @@ public class CustomToStringStyle extends StandardToStringStyle @Override protected void appendDetail(StringBuffer buffer, String fieldName, - Collection value) { + Collection<?> value) { buffer.append("["); // gather contents of list in a new StringBuffer @@ -145,13 +144,12 @@ public class CustomToStringStyle extends StandardToStringStyle @Override protected void appendDetail(StringBuffer buffer, String fieldName, - Map value) { + Map<?,?> value) { buffer.append("{"); // gather contents of map in a new StringBuffer StringBuffer sb = new StringBuffer(); - @SuppressWarnings("unchecked") - Iterator<Map.Entry<?,?>> iter = value.entrySet().iterator(); + Iterator<? extends Map.Entry<?,?>> iter = value.entrySet().iterator(); if(iter.hasNext()) { if(isFieldSeparatorAtStart()) { appendFieldSeparator(sb); @@ -203,7 +201,7 @@ public class CustomToStringStyle extends StandardToStringStyle private static String indent(Object obj) { return ((obj != null) ? obj.toString().replaceAll( - SystemUtils.LINE_SEPARATOR, ML_FIELD_SEP) : null); + System.lineSeparator(), ML_FIELD_SEP) : null); } public static Object ignoreNull(Object obj) { diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java index 6831e99..220d5b0 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java @@ -73,8 +73,8 @@ import com.healthmarketscience.jackcess.util.LinkResolver; import com.healthmarketscience.jackcess.util.ReadOnlyFileChannel; import com.healthmarketscience.jackcess.util.SimpleColumnValidatorFactory; import com.healthmarketscience.jackcess.util.TableIterableBuilder; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java b/src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java index e2b2dd5..341859d 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java @@ -33,7 +33,7 @@ import com.healthmarketscience.jackcess.IndexBuilder; import com.healthmarketscience.jackcess.RuntimeIOException; import static com.healthmarketscience.jackcess.impl.ByteUtil.ByteStream; import static com.healthmarketscience.jackcess.impl.IndexCodes.*; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/IndexImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/IndexImpl.java index 0fbd231..5332432 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/IndexImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/IndexImpl.java @@ -25,7 +25,7 @@ import java.util.Map; import com.healthmarketscience.jackcess.CursorBuilder; import com.healthmarketscience.jackcess.Index; import com.healthmarketscience.jackcess.IndexBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/IndexPageCache.java b/src/main/java/com/healthmarketscience/jackcess/impl/IndexPageCache.java index 4ee1882..d594c1c 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/IndexPageCache.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/IndexPageCache.java @@ -29,7 +29,7 @@ import java.util.Map; import java.util.RandomAccess; import static com.healthmarketscience.jackcess.impl.IndexData.*; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; /** * Manager of the index pages for a IndexData. diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/OleUtil.java b/src/main/java/com/healthmarketscience/jackcess/impl/OleUtil.java index d8a2336..466b6a4 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/OleUtil.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/OleUtil.java @@ -35,7 +35,7 @@ import java.util.regex.Pattern; import com.healthmarketscience.jackcess.DataType; import com.healthmarketscience.jackcess.util.OleBlob; import static com.healthmarketscience.jackcess.util.OleBlob.*; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; /** * Utility code for working with OLE data. diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/RowIdImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/RowIdImpl.java index 7bfab4a..5ce8214 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/RowIdImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/RowIdImpl.java @@ -19,7 +19,7 @@ package com.healthmarketscience.jackcess.impl; import java.io.Serializable; import com.healthmarketscience.jackcess.RowId; -import org.apache.commons.lang.builder.CompareToBuilder; +import org.apache.commons.lang3.builder.CompareToBuilder; /** diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java index 15a0c8c..e065f05 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java @@ -52,7 +52,7 @@ import com.healthmarketscience.jackcess.Table; import com.healthmarketscience.jackcess.expr.Identifier; import com.healthmarketscience.jackcess.util.ErrorHandler; import com.healthmarketscience.jackcess.util.ExportUtil; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/expr/DefaultTextFunctions.java b/src/main/java/com/healthmarketscience/jackcess/impl/expr/DefaultTextFunctions.java index 5643766..fcc9cb5 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/expr/DefaultTextFunctions.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/expr/DefaultTextFunctions.java @@ -13,7 +13,6 @@ 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.healthmarketscience.jackcess.impl.expr; import java.math.BigDecimal; @@ -23,7 +22,6 @@ import com.healthmarketscience.jackcess.expr.EvalException; import com.healthmarketscience.jackcess.expr.Function; import com.healthmarketscience.jackcess.expr.LocaleContext; import com.healthmarketscience.jackcess.expr.Value; -import org.apache.commons.lang.WordUtils; import static com.healthmarketscience.jackcess.impl.expr.DefaultFunctions.*; import static com.healthmarketscience.jackcess.impl.expr.FunctionSupport.*; @@ -360,6 +358,7 @@ public class DefaultTextFunctions } }); + @SuppressWarnings("deprecation") public static final Function STRCONV = registerStringFunc(new FuncVar("StrConv", 2, 3) { @Override protected Value evalVar(EvalContext ctx, Value[] params) { @@ -387,7 +386,8 @@ public class DefaultTextFunctions break; case 3: // vbProperCase - str = WordUtils.capitalize(str.toLowerCase()); + str = org.apache.commons.lang3.text.WordUtils.capitalize( + str.toLowerCase()); break; default: // do nothing @@ -441,11 +441,11 @@ public class DefaultTextFunctions String fmtStr = params[1].getAsString(ctx); int firstDay = DefaultDateFunctions.getFirstDayParam(ctx, params, 2); int firstWeekType = DefaultDateFunctions.getFirstWeekTypeParam(ctx, params, 3); - + return FormatUtil.format(ctx, expr, fmtStr, firstDay, firstWeekType); } }); - + private static String nchars(int num, char c) { StringBuilder sb = new StringBuilder(num); nchars(sb, num, c); @@ -457,7 +457,7 @@ public class DefaultTextFunctions sb.append(c); } } - + private static String trim(String str, boolean doLeft, boolean doRight) { int start = 0; int end = str.length(); diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java b/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java index d2bb847..bee27ca 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java @@ -47,7 +47,7 @@ import com.healthmarketscience.jackcess.expr.TemporalConfig; import com.healthmarketscience.jackcess.expr.Value; import com.healthmarketscience.jackcess.impl.expr.ExpressionTokenizer.Token; import com.healthmarketscience.jackcess.impl.expr.ExpressionTokenizer.TokenType; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; /** diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/expr/StringValue.java b/src/main/java/com/healthmarketscience/jackcess/impl/expr/StringValue.java index 19b22eb..197d8b5 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/expr/StringValue.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/expr/StringValue.java @@ -23,7 +23,7 @@ import java.text.DecimalFormatSymbols; import com.healthmarketscience.jackcess.expr.EvalException; import com.healthmarketscience.jackcess.expr.LocaleContext; import com.healthmarketscience.jackcess.expr.Value; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; /** * diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/query/QueryFormat.java b/src/main/java/com/healthmarketscience/jackcess/impl/query/QueryFormat.java index f9513d4..f0272f3 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/query/QueryFormat.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/query/QueryFormat.java @@ -22,14 +22,13 @@ import java.util.regex.Pattern; import com.healthmarketscience.jackcess.DataType; import com.healthmarketscience.jackcess.query.Query; -import org.apache.commons.lang.SystemUtils; /** * Constants used by the query data parsing. - * + * * @author James Ahlborn */ -public class QueryFormat +public class QueryFormat { private QueryFormat() {} @@ -90,7 +89,7 @@ public class QueryFormat public static final short APPEND_VALUE_FLAG = (short)0x8000; public static final short CROSSTAB_PIVOT_FLAG = 0x01; - public static final short CROSSTAB_NORMAL_FLAG = 0x02; + public static final short CROSSTAB_NORMAL_FLAG = 0x02; public static final String UNION_PART1 = "X7YZ_____1"; public static final String UNION_PART2 = "X7YZ_____2"; @@ -102,10 +101,10 @@ public class QueryFormat public static final Pattern IDENTIFIER_SEP_PAT = Pattern.compile("\\."); public static final char IDENTIFIER_SEP_CHAR = '.'; - public static final String NEWLINE = SystemUtils.LINE_SEPARATOR; + public static final String NEWLINE = System.lineSeparator(); - public static final Map<Short,String> PARAM_TYPE_MAP = + public static final Map<Short,String> PARAM_TYPE_MAP = new HashMap<Short,String>(); static { PARAM_TYPE_MAP.put((short)0, "Value"); @@ -123,7 +122,7 @@ public class QueryFormat PARAM_TYPE_MAP.put((short)DataType.GUID.getValue(), "Guid"); } - public static final Map<Short,String> JOIN_TYPE_MAP = + public static final Map<Short,String> JOIN_TYPE_MAP = new HashMap<Short,String>(); static { JOIN_TYPE_MAP.put((short)1, " INNER JOIN "); @@ -131,7 +130,7 @@ public class QueryFormat JOIN_TYPE_MAP.put((short)3, " RIGHT JOIN "); } - public static final Map<Short,Query.Type> TYPE_MAP = + public static final Map<Short,Query.Type> TYPE_MAP = new HashMap<Short,Query.Type>(); static { for(Query.Type type : Query.Type.values()) { diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/query/QueryImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/query/QueryImpl.java index 6b51236..389ca90 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/query/QueryImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/query/QueryImpl.java @@ -27,7 +27,7 @@ import com.healthmarketscience.jackcess.impl.RowIdImpl; import com.healthmarketscience.jackcess.impl.RowImpl; import static com.healthmarketscience.jackcess.impl.query.QueryFormat.*; import com.healthmarketscience.jackcess.query.Query; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/com/healthmarketscience/jackcess/util/RowFilter.java b/src/main/java/com/healthmarketscience/jackcess/util/RowFilter.java index 440d9dd..607bf9a 100644 --- a/src/main/java/com/healthmarketscience/jackcess/util/RowFilter.java +++ b/src/main/java/com/healthmarketscience/jackcess/util/RowFilter.java @@ -19,17 +19,17 @@ package com.healthmarketscience.jackcess.util; import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; +import java.util.Objects; import com.healthmarketscience.jackcess.Column; import com.healthmarketscience.jackcess.Row; -import org.apache.commons.lang.ObjectUtils; /** * The RowFilter class encapsulates a filter test for a table row. This can * be used by the {@link #apply(Iterable)} method to create an Iterable over a * table which returns only rows matching some criteria. - * + * * @author Patricia Donaldson, Xerox Corporation * @usage _general_class_ */ @@ -59,22 +59,22 @@ public abstract class RowFilter /** * Creates a filter based on a row pattern. - * + * * @param rowPattern Map from column names to the values to be matched. * A table row will match the target if - * {@code ObjectUtils.equals(rowPattern.get(s), row.get(s))} + * {@code Objects.equals(rowPattern.get(s), row.get(s))} * for all column names in the pattern map. * @return a filter which matches table rows which match the values in the * row pattern */ - public static RowFilter matchPattern(final Map<String,?> rowPattern) + public static RowFilter matchPattern(final Map<String,?> rowPattern) { return new RowFilter() { @Override - public boolean matches(Row row) + public boolean matches(Row row) { for(Map.Entry<String,?> e : rowPattern.entrySet()) { - if(!ObjectUtils.equals(e.getValue(), row.get(e.getKey()))) { + if(!Objects.equals(e.getValue(), row.get(e.getKey()))) { return false; } } @@ -89,18 +89,18 @@ public abstract class RowFilter * @param columnPattern column to be matched * @param valuePattern value to be matched. * A table row will match the target if - * {@code ObjectUtils.equals(valuePattern, row.get(columnPattern.getName()))}. + * {@code Objects.equals(valuePattern, row.get(columnPattern.getName()))}. * @return a filter which matches table rows which match the value in the * row pattern */ - public static RowFilter matchPattern(final Column columnPattern, - final Object valuePattern) + public static RowFilter matchPattern(final Column columnPattern, + final Object valuePattern) { return new RowFilter() { @Override - public boolean matches(Row row) + public boolean matches(Row row) { - return ObjectUtils.equals(valuePattern, columnPattern.getRowValue(row)); + return Objects.equals(valuePattern, columnPattern.getRowValue(row)); } }; } @@ -118,7 +118,7 @@ public abstract class RowFilter { return new RowFilter() { @Override - public boolean matches(Row row) + public boolean matches(Row row) { return !filter.matches(row); } @@ -140,7 +140,7 @@ public abstract class RowFilter public static Iterable<Row> apply(RowFilter rowFilter, Iterable<? extends Row> iterable) { - return((rowFilter != null) ? rowFilter.apply(iterable) : + return((rowFilter != null) ? rowFilter.apply(iterable) : (Iterable<Row>)iterable); } @@ -152,7 +152,7 @@ public abstract class RowFilter { private final Iterable<? extends Row> _iterable; - private FilterIterable(Iterable<? extends Row> iterable) + private FilterIterable(Iterable<? extends Row> iterable) { _iterable = iterable; } @@ -163,7 +163,7 @@ public abstract class RowFilter * iterable, returning only rows for which the {@link RowFilter#matches} * method returns {@code true} */ - public Iterator<Row> iterator() + public Iterator<Row> iterator() { return new Iterator<Row>() { private final Iterator<? extends Row> _iter = _iterable.iterator(); diff --git a/src/main/java/com/healthmarketscience/jackcess/util/SimpleColumnMatcher.java b/src/main/java/com/healthmarketscience/jackcess/util/SimpleColumnMatcher.java index a564834..b814e93 100644 --- a/src/main/java/com/healthmarketscience/jackcess/util/SimpleColumnMatcher.java +++ b/src/main/java/com/healthmarketscience/jackcess/util/SimpleColumnMatcher.java @@ -19,12 +19,12 @@ package com.healthmarketscience.jackcess.util; import java.io.IOException; import java.util.Arrays; +import java.util.Objects; import com.healthmarketscience.jackcess.DataType; import com.healthmarketscience.jackcess.Table; import com.healthmarketscience.jackcess.impl.ColumnImpl; import com.healthmarketscience.jackcess.impl.DatabaseImpl; -import org.apache.commons.lang.ObjectUtils; /** * Simple concrete implementation of ColumnMatcher which tests for equality. @@ -48,7 +48,7 @@ public class SimpleColumnMatcher implements ColumnMatcher { return true; } - if((value1 != null) && (value2 != null) && + if((value1 != null) && (value2 != null) && (value1.getClass() != value2.getClass())) { // the values aren't the same type, try coercing them to "internal" @@ -58,7 +58,7 @@ public class SimpleColumnMatcher implements ColumnMatcher { DatabaseImpl db = (DatabaseImpl)table.getDatabase(); Object internalV1 = ColumnImpl.toInternalValue(dataType, value1, db); Object internalV2 = ColumnImpl.toInternalValue(dataType, value2, db); - + return equals(internalV1, internalV2); } catch(IOException e) { // ignored, just go with the original result @@ -73,7 +73,7 @@ public class SimpleColumnMatcher implements ColumnMatcher { */ private static boolean equals(Object o1, Object o2) { - return (ObjectUtils.equals(o1, o2) || + return (Objects.equals(o1, o2) || ((o1 instanceof byte[]) && (o2 instanceof byte[]) && Arrays.equals((byte[])o1, (byte[])o2))); } |