diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java index eaedc88a6..fc22ee97d 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java @@ -19,9 +19,8 @@ package org.apache.olingo.client.api.communication; import org.apache.http.StatusLine; -import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.commons.api.ex.ODataRuntimeException; import org.apache.olingo.commons.api.ex.ODataError; +import org.apache.olingo.commons.api.ex.ODataRuntimeException; /** * Represents a client error in OData. @@ -55,9 +54,9 @@ public class ODataClientErrorException extends ODataRuntimeException { * @param error OData error to be wrapped. */ public ODataClientErrorException(final StatusLine statusLine, final ODataError error) { - super(error == null - ? statusLine.toString() - : (StringUtils.isBlank(error.getCode()) ? StringUtils.EMPTY : "(" + error.getCode() + ") ") + super(error == null ? + statusLine.toString() : + (error.getCode() == null || error.getCode().isEmpty() ? "" : "(" + error.getCode() + ") ") + error.getMessage() + " [" + statusLine.toString() + "]"); this.statusLine = statusLine; diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientEntitySetIterator.java index a57d2f501..837ba3adf 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientEntitySetIterator.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientEntitySetIterator.java @@ -28,7 +28,6 @@ import java.util.Iterator; import java.util.NoSuchElementException; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.data.ResWrap; import org.apache.olingo.client.api.serialization.ODataDeserializerException; @@ -262,12 +261,10 @@ public class ClientEntitySetIterator'); } - res = attrsDeclaration == null - ? StringUtils.EMPTY - : new String(attrsDeclaration, Constants.UTF8).trim(); + res = attrsDeclaration == null ? "" : new String(attrsDeclaration, Constants.UTF8).trim(); } catch (Exception e) { LOG.error("Error retrieving entities from EntitySet", e); - res = StringUtils.EMPTY; + res = ""; } return res.endsWith("/") ? res.substring(0, res.length() - 1) : res; diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientLinkType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientLinkType.java index e4b6a22f2..2b89b953b 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientLinkType.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientLinkType.java @@ -18,7 +18,6 @@ */ package org.apache.olingo.client.api.domain; -import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.format.ContentType; @@ -78,9 +77,8 @@ public enum ClientLinkType { * @return ODataLinkType object. */ public static ClientLinkType fromString(final String rel, final String type) { - if (StringUtils.isNotBlank(rel) && rel.startsWith(Constants.NS_MEDIA_EDIT_LINK_REL)) { - - return MEDIA_EDIT.setType(StringUtils.isBlank(type) ? "*/*" : type); + if (rel != null && rel.startsWith(Constants.NS_MEDIA_EDIT_LINK_REL)) { + return MEDIA_EDIT.setType(type == null || type.isEmpty() ? "*/*" : type); } if (ClientLinkType.ENTITY_NAVIGATION.type.equals(type)) { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/SegmentType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/SegmentType.java index f3f2a5035..fb290cb11 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/SegmentType.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/SegmentType.java @@ -18,7 +18,6 @@ */ package org.apache.olingo.client.api.uri; -import org.apache.commons.lang3.StringUtils; /** * URI Segment types. @@ -46,8 +45,7 @@ public enum SegmentType { CROSS_JOIN("$crossjoin"), ALL("$all"), /** - * For query options like as $count that needs to stay in their own segment, right after service root. - * + * For query options like $count that need to stay in their own segment, right after service root. * @see QueryOption#COUNT */ ROOT_QUERY_OPTION, @@ -56,7 +54,7 @@ public enum SegmentType { private final String value; private SegmentType() { - this.value = StringUtils.EMPTY; + this.value = ""; } private SegmentType(final String value) { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/RetrieveRequestFactoryImpl.java index 1f5d80b02..6b0f01233 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/RetrieveRequestFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/RetrieveRequestFactoryImpl.java @@ -20,7 +20,6 @@ package org.apache.olingo.client.core.communication.request.retrieve; import java.net.URI; -import org.apache.commons.lang3.StringUtils; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest; @@ -34,11 +33,11 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceD import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest; import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory; import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest; -import org.apache.olingo.client.core.uri.URIUtils; import org.apache.olingo.client.api.domain.ClientEntity; import org.apache.olingo.client.api.domain.ClientEntitySet; import org.apache.olingo.client.api.domain.ClientProperty; import org.apache.olingo.client.api.domain.ClientSingleton; +import org.apache.olingo.client.core.uri.URIUtils; public class RetrieveRequestFactoryImpl implements RetrieveRequestFactory { @@ -82,9 +81,9 @@ public class RetrieveRequestFactoryImpl implements RetrieveRequestFactory { @Override public ODataServiceDocumentRequest getServiceDocumentRequest(final String serviceRoot) { return new ODataServiceDocumentRequestImpl(client, - StringUtils.isNotBlank(serviceRoot) && serviceRoot.endsWith("/") - ? client.newURIBuilder(serviceRoot).build() - : client.newURIBuilder(serviceRoot + "/").build()); + serviceRoot != null && !serviceRoot.isEmpty() && serviceRoot.endsWith("/") ? + client.newURIBuilder(serviceRoot).build() : + client.newURIBuilder(serviceRoot + '/').build()); } @Override diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AbstractAtomDealer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AbstractAtomDealer.java index 30fb582a7..245d9b63c 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AbstractAtomDealer.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AbstractAtomDealer.java @@ -23,7 +23,6 @@ import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; -import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.Constants; abstract class AbstractAtomDealer { @@ -89,7 +88,7 @@ abstract class AbstractAtomDealer { } protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException { - writer.writeNamespace(StringUtils.EMPTY, Constants.NS_ATOM); + writer.writeNamespace("", Constants.NS_ATOM); writer.writeNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI); writer.writeNamespace(Constants.PREFIX_METADATA, Constants.NS_METADATA); writer.writeNamespace(Constants.PREFIX_DATASERVICES, Constants.NS_DATASERVICES); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Valuable.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Valuable.java index 2fec36937..a2cb50964 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Valuable.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Valuable.java @@ -20,10 +20,6 @@ package org.apache.olingo.commons.api.data; import java.util.List; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.olingo.commons.api.edm.geo.Geospatial; /** @@ -175,19 +171,4 @@ public abstract class Valuable extends Annotatable { public ValueType getValueType() { return valueType; } - - @Override - public boolean equals(final Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); - } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java index c0e5819f4..539196c23 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java @@ -102,10 +102,8 @@ public abstract class Geospatial implements Serializable { protected Geospatial(final Dimension dimension, final Type type, final SRID srid) { this.dimension = dimension; this.type = type; - this.srid = srid == null - ? new SRID() - : srid; - this.srid.setDimension(dimension); + this.srid = srid == null ? new SRID() : srid; + this.srid.setDimension(dimension); } /** diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java index ae2e3da3d..f919ac8ef 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java @@ -18,7 +18,6 @@ */ package org.apache.olingo.commons.core.edm; -import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmEntityType; @@ -54,9 +53,10 @@ public class EdmTypeInfo { } public EdmTypeInfo build() { - return new EdmTypeInfo(edm, typeExpression.indexOf('.') == -1 && StringUtils.isNotBlank(defaultNamespace) - ? defaultNamespace + "." + typeExpression - : typeExpression); + return new EdmTypeInfo(edm, + typeExpression.indexOf('.') == -1 && defaultNamespace != null && !defaultNamespace.isEmpty() ? + defaultNamespace + "." + typeExpression : + typeExpression); } } @@ -98,7 +98,7 @@ public class EdmTypeInfo { typeName = baseType.substring(lastDotIdx + 1); } - if (StringUtils.isBlank(typeName)) { + if (typeName == null || typeName.isEmpty()) { throw new IllegalArgumentException("Null or empty type name in " + typeExpression); } diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java index ed9911458..fb73d0f75 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java @@ -31,7 +31,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmAction; import org.apache.olingo.commons.api.edm.EdmAnnotations; @@ -444,7 +443,7 @@ public class EdmImplCachingTest { private static final long serialVersionUID = 3109256773218160485L; { - put(StringUtils.EMPTY, schema); + put("", schema); } }; } diff --git a/lib/server-core-ext/pom.xml b/lib/server-core-ext/pom.xml index af286c0f6..7a39e0d89 100644 --- a/lib/server-core-ext/pom.xml +++ b/lib/server-core-ext/pom.xml @@ -69,10 +69,6 @@ mockito-all test - - org.slf4j - slf4j-simple - commons-io commons-io diff --git a/lib/server-core/pom.xml b/lib/server-core/pom.xml index 0c329d9ca..a6cf00e3e 100644 --- a/lib/server-core/pom.xml +++ b/lib/server-core/pom.xml @@ -65,12 +65,12 @@ com.fasterxml.jackson.core jackson-databind - + com.fasterxml aalto-xml - + junit junit @@ -79,10 +79,6 @@ org.mockito mockito-all - - org.slf4j - slf4j-simple - diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java index d3876b6bb..b556d8e01 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java @@ -33,7 +33,6 @@ import javax.xml.stream.events.Attribute; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; -import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.AbstractODataObject; import org.apache.olingo.commons.api.data.ComplexValue; @@ -172,8 +171,9 @@ public class ODataXmlDeserializer implements ODataDeserializer { if (propertyValueQName.equals(start.getName())) { // retrieve name from context final Attribute context = start.getAttributeByName(contextQName); - if (context != null) { - property.setName(StringUtils.substringAfterLast(context.getValue(), "/")); + if (context != null && context.getValue() != null) { + final int pos = context.getValue().lastIndexOf('/'); + property.setName(pos == -1 ? "" : context.getValue().substring(pos + 1)); } } else { property.setName(start.getName().getLocalPart()); diff --git a/lib/server-core/src/test/resources/simplelogger.properties b/lib/server-core/src/test/resources/simplelogger.properties deleted file mode 100644 index 2a3350c78..000000000 --- a/lib/server-core/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,20 +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. -# -org.slf4j.simpleLogger.defaultLogLevel=debug -org.slf4j.simpleLogger.logFile=System.out \ No newline at end of file diff --git a/lib/server-test/pom.xml b/lib/server-test/pom.xml index 3b48d9e2b..212673fb3 100644 --- a/lib/server-test/pom.xml +++ b/lib/server-test/pom.xml @@ -54,11 +54,6 @@ org.mockito mockito-all - - org.slf4j - slf4j-simple - test - commons-io commons-io diff --git a/lib/server-test/src/test/resources/simplelogger.properties b/lib/server-test/src/test/resources/simplelogger.properties deleted file mode 100644 index 2a3350c78..000000000 --- a/lib/server-test/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,20 +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. -# -org.slf4j.simpleLogger.defaultLogLevel=debug -org.slf4j.simpleLogger.logFile=System.out \ No newline at end of file