Repository: olingo-odata2 Updated Branches: refs/heads/master daa83f4d8 -> aedda7455
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/edm/provider/EdmFunctionImportImplProv.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/edm/provider/EdmFunctionImportImplProv.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/edm/provider/EdmFunctionImportImplProv.java index 29f0f20..3df7e77 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/edm/provider/EdmFunctionImportImplProv.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/edm/provider/EdmFunctionImportImplProv.java @@ -64,9 +64,9 @@ public class EdmFunctionImportImplProv extends EdmNamedImplProv implements EdmFu private void buildFunctionImportParametersInternal() { parameters = new HashMap<String, FunctionImportParameter>(); - List<FunctionImportParameter> parameters = functionImport.getParameters(); - if (parameters != null) { - for (FunctionImportParameter parameter : parameters) { + List<FunctionImportParameter> functionImportParameters = functionImport.getParameters(); + if (functionImportParameters != null) { + for (FunctionImportParameter parameter : functionImportParameters) { this.parameters.put(parameter.getName(), parameter); } } @@ -99,9 +99,9 @@ public class EdmFunctionImportImplProv extends EdmNamedImplProv implements EdmFu if (parametersList == null) { parametersList = new ArrayList<String>(); - List<FunctionImportParameter> parameters = functionImport.getParameters(); - if(parameters != null) { - for (FunctionImportParameter parameter : parameters) { + List<FunctionImportParameter> functionImportParameters = functionImport.getParameters(); + if(functionImportParameters != null) { + for (FunctionImportParameter parameter : functionImportParameters) { parametersList.add(parameter.getName()); } } http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java index c45657e..9966f26 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java @@ -96,9 +96,9 @@ public class EntityTypeMapping { */ public EntityTypeMapping getEntityTypeMapping(final String name) { if (isComplex()) { - for (EntityTypeMapping mapping : mappings) { - if (mapping.propertyName.equals(name)) { - return mapping; + for (EntityTypeMapping mappingValue : mappings) { + if (mappingValue.propertyName.equals(name)) { + return mappingValue; } } } @@ -113,9 +113,9 @@ public class EntityTypeMapping { */ public Class<?> getMappingClass(final String name) { if (isComplex()) { - for (EntityTypeMapping mapping : mappings) { - if (mapping.propertyName.equals(name)) { - return mapping.mapping; + for (EntityTypeMapping mappingValue : mappings) { + if (mappingValue.propertyName.equals(name)) { + return mappingValue.mapping; } } } http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java index fb4977b..d9d8e6e 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java @@ -387,7 +387,7 @@ public class JsonEntryConsumer { private void updateExpandSelectTree(final String navigationPropertyName, final ODataFeed feed) { List<ODataEntry> entries = feed.getEntries(); - if (entries.size() > 0) { + if (!entries.isEmpty()) { updateExpandSelectTree(navigationPropertyName, entries.get(0)); } else { expandSelectTree.setExpanded(); http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java index 9b427d5..c98bdeb 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java @@ -163,7 +163,7 @@ public class XmlFeedConsumer { String inlineCountString = reader.getElementText(); if (inlineCountString != null) { try { - int inlineCountNumber = Integer.valueOf(inlineCountString); + int inlineCountNumber = Integer.parseInt(inlineCountString); if (inlineCountNumber >= 0) { metadata.setInlineCount(inlineCountNumber); } else { http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java index b4eb1de..160fdf6 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java @@ -547,7 +547,7 @@ public class XmlMetadataConsumer { reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_ENTITY_TYPE); EntityType entityType = new EntityType(); List<Property> properties = new ArrayList<Property>(); - List<NavigationProperty> navProperties = new ArrayList<NavigationProperty>(); + List<NavigationProperty> navPropertiesList = new ArrayList<NavigationProperty>(); List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>(); Key key = null; @@ -578,7 +578,7 @@ public class XmlMetadataConsumer { } else if (XmlMetadataConstants.EDM_PROPERTY.equals(currentHandledStartTagName)) { properties.add(readProperty(reader)); } else if (XmlMetadataConstants.EDM_NAVIGATION_PROPERTY.equals(currentHandledStartTagName)) { - navProperties.add(readNavigationProperty(reader)); + navPropertiesList.add(readNavigationProperty(reader)); } else { annotationElements.add(readAnnotationElement(reader)); } @@ -588,7 +588,7 @@ public class XmlMetadataConsumer { if (!annotationElements.isEmpty()) { entityType.setAnnotationElements(annotationElements); } - entityType.setKey(key).setProperties(properties).setNavigationProperties(navProperties); + entityType.setKey(key).setProperties(properties).setNavigationProperties(navPropertiesList); if (entityType.getName() != null) { FullQualifiedName fqName = new FullQualifiedName(currentNamespace, entityType.getName()); entityTypesMap.put(fqName, entityType); http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java index 0ce7f80..02128f2 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java @@ -44,7 +44,7 @@ public class JsonDeletedEntryEntityProducer { throws EntityProviderException { JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer); try { - if (deletedEntries.size() > 0) { + if (!deletedEntries.isEmpty()) { if(!noPreviousEntries){ jsonStreamWriter.separator(); } http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataExceptionWrapper.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataExceptionWrapper.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataExceptionWrapper.java index 61d6dd0..a942693 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataExceptionWrapper.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataExceptionWrapper.java @@ -262,29 +262,29 @@ public class ODataExceptionWrapper { private ContentType getContentType(final Map<String, String> queryParameters, final List<String> acceptHeaderContentTypes) { - ContentType contentType = getContentTypeByUriInfo(queryParameters); - if (contentType == null) { - contentType = getContentTypeByAcceptHeader(acceptHeaderContentTypes); + ContentType cntType = getContentTypeByUriInfo(queryParameters); + if (cntType == null) { + cntType = getContentTypeByAcceptHeader(acceptHeaderContentTypes); } - return contentType; + return cntType; } private ContentType getContentTypeByUriInfo(final Map<String, String> queryParameters) { - ContentType contentType = null; + ContentType cntType = null; if (queryParameters != null) { if (queryParameters.containsKey(DOLLAR_FORMAT)) { String contentTypeString = queryParameters.get(DOLLAR_FORMAT); if (DOLLAR_FORMAT_JSON.equals(contentTypeString)) { - contentType = ContentType.APPLICATION_JSON; + cntType = ContentType.APPLICATION_JSON; } else { // Any format mentioned in the $format parameter other than json results in an application/xml content type // for error messages // due to the OData V2 Specification - contentType = ContentType.APPLICATION_XML; + cntType = ContentType.APPLICATION_XML; } } } - return contentType; + return cntType; } private ContentType getContentTypeByAcceptHeader(final List<String> acceptHeaderContentTypes) { @@ -308,29 +308,29 @@ public class ODataExceptionWrapper { } private ContentType getContentType(final UriInfo uriInfo, final HttpHeaders httpHeaders) { - ContentType contentType = getContentTypeByUriInfo(uriInfo); - if (contentType == null) { - contentType = getContentTypeByAcceptHeader(httpHeaders); + ContentType cntType = getContentTypeByUriInfo(uriInfo); + if (cntType == null) { + cntType = getContentTypeByAcceptHeader(httpHeaders); } - return contentType; + return cntType; } private ContentType getContentTypeByUriInfo(final UriInfo uriInfo) { - ContentType contentType = null; + ContentType cntType = null; if (uriInfo != null && uriInfo.getQueryParameters() != null) { MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(); if (queryParameters.containsKey(DOLLAR_FORMAT)) { String contentTypeString = queryParameters.getFirst(DOLLAR_FORMAT); if (DOLLAR_FORMAT_JSON.equals(contentTypeString)) { - contentType = ContentType.APPLICATION_JSON; + cntType = ContentType.APPLICATION_JSON; } else { // Any format mentioned in the $format parameter other than json results in an application/xml content type // for error messages due to the OData V2 Specification. - contentType = ContentType.APPLICATION_XML; + cntType = ContentType.APPLICATION_XML; } } } - return contentType; + return cntType; } private ContentType getContentTypeByAcceptHeader(final HttpHeaders httpHeaders) { @@ -355,10 +355,10 @@ public class ODataExceptionWrapper { private ODataErrorCallback getErrorHandlerCallbackFromContext(final ODataContext context) throws ClassNotFoundException, InstantiationException, IllegalAccessException { - ODataErrorCallback callback = null; + ODataErrorCallback cback = null; ODataServiceFactory serviceFactory = context.getServiceFactory(); - callback = serviceFactory.getCallback(ODataErrorCallback.class); - return callback; + cback = serviceFactory.getCallback(ODataErrorCallback.class); + return cback; } } http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataExceptionWrapper.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataExceptionWrapper.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataExceptionWrapper.java index e012ec4..bd342ae 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataExceptionWrapper.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataExceptionWrapper.java @@ -181,28 +181,28 @@ public class ODataExceptionWrapper { } private ContentType getContentType(final Map<String, String> queryParameters, final List<String> acceptHeaders) { - ContentType contentType = getContentTypeByUriInfo(queryParameters); - if (contentType == null) { - contentType = getContentTypeByAcceptHeader(acceptHeaders); + ContentType cntType = getContentTypeByUriInfo(queryParameters); + if (cntType == null) { + cntType = getContentTypeByAcceptHeader(acceptHeaders); } - return contentType; + return cntType; } private ContentType getContentTypeByUriInfo(final Map<String, String> queryParameters) { - ContentType contentType = null; + ContentType cntType = null; if (queryParameters != null) { if (queryParameters.containsKey(DOLLAR_FORMAT)) { String contentTypeString = queryParameters.get(DOLLAR_FORMAT); if (DOLLAR_FORMAT_JSON.equals(contentTypeString)) { - contentType = ContentType.APPLICATION_JSON; + cntType = ContentType.APPLICATION_JSON; } else { // Any format mentioned in the $format parameter other than json results in an application/xml content type // for error messages due to the OData V2 Specification. - contentType = ContentType.APPLICATION_XML; + cntType = ContentType.APPLICATION_XML; } } } - return contentType; + return cntType; } private ContentType getContentTypeByAcceptHeader(final List<String> acceptHeaders) { http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java index 0e2000c..571c313 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java @@ -347,7 +347,6 @@ public class ODataServlet extends HttpServlet { ODataExceptionWrapper exceptionWrapper = new ODataExceptionWrapper(req, serviceFactory); ODataResponse response = exceptionWrapper.wrapInExceptionResponse(new ODataNotImplementedException(messageReference)); -// resp.setStatus(HttpStatusCodes.NOT_IMPLEMENTED.getStatusCode()); createResponse(resp, response); } http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/RestUtil.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/RestUtil.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/RestUtil.java index 3ee30d0..9f5721f 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/RestUtil.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/RestUtil.java @@ -232,7 +232,7 @@ public class RestUtil { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(req.getContextPath()).append(req.getServletPath()); for (final PathSegment ps : precedingPathSegments) { - if (!ps.getPath().equals("") && ps.getPath().length() > 0) { + if (!"".equals(ps.getPath()) && ps.getPath().length() > 0) { stringBuilder.append("/").append(ps.getPath()); } for (final String key : ps.getMatrixParameters().keySet()) { http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java index cddbe96..9225b48 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -135,11 +136,11 @@ public class UriParserImpl extends UriParser { private <T, K> Map<T, List<K>> convertFromSingleMapToMultiMap(final Map<T, K> singleMap) { Map<T, List<K>> multiMap = new HashMap<T, List<K>>(); - for (T key : singleMap.keySet()) { + for (Entry<T, K> entry : singleMap.entrySet()) { List<K> valueList = new LinkedList<K>(); - valueList.add(singleMap.get(key)); + valueList.add(entry.getValue()); - multiMap.put(key, valueList); + multiMap.put(entry.getKey(), valueList); } return multiMap; @@ -147,19 +148,19 @@ public class UriParserImpl extends UriParser { private void preparePathSegments() throws UriSyntaxException { // Remove an empty path segment at the start of the OData part of the resource path. - if (!pathSegments.isEmpty() && pathSegments.get(0).equals("")) { + if (!pathSegments.isEmpty() && "".equals(pathSegments.get(0))) { pathSegments.remove(0); } // Remove an empty path segment at the end of the resource path, // although there is nothing in the OData specification that would allow that. - if (!pathSegments.isEmpty() && pathSegments.get(pathSegments.size() - 1).equals("")) { + if (!pathSegments.isEmpty() && "".equals(pathSegments.get(pathSegments.size() - 1))) { pathSegments.remove(pathSegments.size() - 1); } // Intermediate empty path segments are an error, however. for (String pathSegment : pathSegments) { - if (pathSegment.equals("")) { + if ("".equals(pathSegment)) { throw new UriSyntaxException(UriSyntaxException.EMPTYSEGMENT); } } http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java index 230ec59..2741d50 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java @@ -405,7 +405,7 @@ public class FilterParserImpl implements FilterParser { if (token == null) { return null; } - if ((token.getKind() == TokenKind.SYMBOL) && (token.getUriLiteral().equals("/"))) { + if ((token.getKind() == TokenKind.SYMBOL) && ("/".equals(token.getUriLiteral()))) { operator = availableBinaryOperators.get(token.getUriLiteral()); } else if (token.getKind() == TokenKind.LITERAL) { operator = availableBinaryOperators.get(token.getUriLiteral()); @@ -571,7 +571,7 @@ public class FilterParserImpl implements FilterParser { actualParameterTypes.add(rightType); // special case for navigation property (non-)equality comparison with null - if (binOpt.getCategory().equals("Equality") + if ("Equality".equals(binOpt.getCategory()) && (leftType != null && leftType.getKind() == EdmTypeKind.ENTITY && rightType == EdmSimpleTypeFacadeImpl.getEdmSimpleType(EdmSimpleTypeKind.Null) || leftType == EdmSimpleTypeFacadeImpl.getEdmSimpleType(EdmSimpleTypeKind.Null) @@ -629,7 +629,6 @@ public class FilterParserImpl implements FilterParser { Map<String, InfoUnaryOperator> lAvailableUnaryOperators = new HashMap<String, InfoUnaryOperator>(); // create type validators - // InputTypeValidator typeValidatorPromotion = new InputTypeValidator.TypePromotionValidator(); ParameterSetCombination combination = null; // create type helpers EdmSimpleType boolean_ = EdmSimpleTypeFacadeImpl.getEdmSimpleType(EdmSimpleTypeKind.Boolean); @@ -790,24 +789,7 @@ public class FilterParserImpl implements FilterParser { "Relational", 40, combination)); // ---Equality--- - // combination = new ParameterSetCombination.PSCflex(); combination.addFirst(new ParameterSet(boolean_, boolean_, boolean_)); - /* - * combination.add(new ParameterSet(boolean_, string, string)); - * combination.add(new ParameterSet(boolean_, time, time)); - * combination.add(new ParameterSet(boolean_, datetime, datetime)); - * combination.add(new ParameterSet(boolean_, datetimeoffset, datetimeoffset)); - * combination.add(new ParameterSet(boolean_, guid, guid)); - * combination.add(new ParameterSet(boolean_, sbyte, sbyte)); - * combination.add(new ParameterSet(boolean_, byte_, byte_)); - * combination.add(new ParameterSet(boolean_, int16, int16)); - * combination.add(new ParameterSet(boolean_, int32, int32)); - * combination.add(new ParameterSet(boolean_, int64, int64)); - * combination.add(new ParameterSet(boolean_, single, single)); - * combination.add(new ParameterSet(boolean_, double_, double_)); - * combination.add(new ParameterSet(boolean_, decimal, decimal)); - * combination.add(new ParameterSet(boolean_, binary, binary)); - */ combination.add(new ParameterSet(boolean_, boolean_, null_)); combination.add(new ParameterSet(boolean_, null_, boolean_)); http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/InfoUnaryOperator.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/InfoUnaryOperator.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/InfoUnaryOperator.java index de8bf86..32d7586 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/InfoUnaryOperator.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/InfoUnaryOperator.java @@ -58,28 +58,4 @@ class InfoUnaryOperator { return combination.validate(actualParameterTypes); } - /** - * Returns the EdmType of the returned value of a Method - * If a method may have different return types (depending on the input type) null will be returned. - */ - /* - * public EdmType getReturnType() - * { - * int parameterCount = allowedParameterTypes.size(); - * if (parameterCount == 0) - * return null; - * - * if (parameterCount == 1) - * return allowedParameterTypes.get(0).getReturnType(); - * - * //There are more than 1 possible return type, check if they are equal, if not return null. - * EdmType returnType = allowedParameterTypes.get(0).getReturnType(); - * for (int i = 1; i < parameterCount; i++) - * if (returnType != allowedParameterTypes.get(i)) - * return null; - * - * return returnType; - * } - */ - } http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/OrderByParserImpl.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/OrderByParserImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/OrderByParserImpl.java index 6cda554..2ae87ea 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/OrderByParserImpl.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/OrderByParserImpl.java @@ -57,11 +57,11 @@ public class OrderByParserImpl extends FilterParserImpl implements OrderByParser Token token = tokenList.lookToken(); if (token == null) { orderNode.setSortOrder(SortOrder.asc); - } else if ((token.getKind() == TokenKind.LITERAL) && (token.getUriLiteral().equals("asc"))) { + } else if ((token.getKind() == TokenKind.LITERAL) && ("asc".equals(token.getUriLiteral()))) { orderNode.setSortOrder(SortOrder.asc); tokenList.next(); token = tokenList.lookToken(); - } else if ((token.getKind() == TokenKind.LITERAL) && (token.getUriLiteral().equals("desc"))) { + } else if ((token.getKind() == TokenKind.LITERAL) && ("desc".equals(token.getUriLiteral()))) { orderNode.setSortOrder(SortOrder.desc); tokenList.next(); token = tokenList.lookToken(); http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ParameterSetCombination.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ParameterSetCombination.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ParameterSetCombination.java index f3446d3..72c8b54 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ParameterSetCombination.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ParameterSetCombination.java @@ -77,7 +77,7 @@ public interface ParameterSetCombination { @Override public ParameterSet validate(final List<EdmType> actualParameterTypes) throws ExpressionParserInternalError { - if (combinations.size() == 0) { + if (combinations.isEmpty()) { return new ParameterSet(null, null); } @@ -117,7 +117,6 @@ public interface ParameterSetCombination { public ParameterSet validate(final List<EdmType> actualParameterTypes) throws ExpressionParserInternalError { EdmType xxx = actualParameterTypes.get(actualParameterTypes.size() - 1); return new ParameterSet(xxx, null); - // return actualParameterTypes.get(actualParameterTypes.size() - 1); } @Override http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenList.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenList.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenList.java index 4dbef4a..53d1124 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenList.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenList.java @@ -85,7 +85,7 @@ public class TokenList implements Iterator<Token> { } public boolean hasTokens() { - return (tokens.size() > 0); + return (!tokens.isEmpty()); } public int tokenCount() { http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java index 953f71f..1cff2d0 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java @@ -34,7 +34,6 @@ import org.apache.olingo.odata2.core.edm.EdmSimpleTypeFacadeImpl; */ public class Tokenizer { - // Pattern OTHER_LIT = Pattern.compile("^([[A-Za-z0-9]._~%!$&*+;:@-]+)"); private static final Pattern OTHER_LIT = Pattern.compile("(?:\\p{L}|\\p{Digit}|[-._~%!$&*+;:@])+"); private static final Pattern FUNK = Pattern @@ -194,7 +193,7 @@ public class Tokenizer { private boolean checkForBoolean(final int oldPosition, final String rem_expr) { boolean isBoolean = false; - if (rem_expr.equals("true") || rem_expr.equals("false")) { + if ("true".equals(rem_expr) || "false".equals(rem_expr)) { curPosition = curPosition + rem_expr.length(); tokens.appendEdmTypedToken(oldPosition, TokenKind.SIMPLE_TYPE, rem_expr, new EdmLiteral(EdmSimpleTypeFacadeImpl .getEdmSimpleType(EdmSimpleTypeKind.Boolean), rem_expr)); http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/aedda745/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenizerException.java ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenizerException.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenizerException.java index cb02bbd..7547935 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenizerException.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/TokenizerException.java @@ -75,19 +75,6 @@ public class TokenizerException extends ODataMessageException { return new TokenizerException(msgRef, ex).setToken(token); } - /* - * static public TokenizerException createTYPEDECTECTION_FAILED_ON_EDMTYPE(EdmLiteralException ex, int position, - * String uriLiteral) - * { - * MessageReference msgRef = TokenizerException.TYPEDECTECTION_FAILED_ON_EDMTYPE.create(); - * - * msgRef.addContent(uriLiteral); - * msgRef.addContent(position); - * Token token = new Token(TokenKind.UNKNOWN, position, uriLiteral); - * - * return new TokenizerException(msgRef).setToken(token); - * } - */ static public TokenizerException createUNKNOWN_CHARACTER(final int position, final String uriLiteral, final String expression) { MessageReference msgRef = TokenizerException.UNKNOWN_CHARACTER.create();
