DATAREST-957 - Polish most critical Sonar warnings.
Fixed broken equals(…) in ProjectionDefinition. Switched to iterating over Map's entry set instead of the keys. Made UriAwareHttpServletRequest static.
This commit is contained in:
@@ -190,7 +190,7 @@ public class BasePathAwareHandlerMapping extends RequestMappingHandlerMapping {
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
private class UriAwareHttpServletRequest implements HttpServletRequest {
|
||||
private static class UriAwareHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private final ServletContext context;
|
||||
private final String path;
|
||||
|
||||
@@ -382,10 +382,13 @@ class RepositoryPropertyReferenceController extends AbstractRepositoryRestContro
|
||||
}
|
||||
}
|
||||
} else if (prop.property.isMap()) {
|
||||
|
||||
Map<Object, Object> m = (Map<Object, Object>) prop.propertyValue;
|
||||
Iterator<Object> itr = m.keySet().iterator();
|
||||
Iterator<Entry<Object, Object>> itr = m.entrySet().iterator();
|
||||
|
||||
while (itr.hasNext()) {
|
||||
Object key = itr.next();
|
||||
|
||||
Object key = itr.next().getKey();
|
||||
|
||||
IdentifierAccessor accessor = prop.entity.getIdentifierAccessor(m.get(key));
|
||||
String s = accessor.getIdentifier().toString();
|
||||
@@ -394,6 +397,7 @@ class RepositoryPropertyReferenceController extends AbstractRepositoryRestContro
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
prop.accessor.setProperty(prop.property, null);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.springframework.data.rest.webmvc.config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
|
||||
@@ -103,8 +104,8 @@ class QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver
|
||||
|
||||
MultiValueMap<String, String> result = new LinkedMultiValueMap<String, String>();
|
||||
|
||||
for (String key : source.keySet()) {
|
||||
result.put(key, Arrays.asList(source.get(key)));
|
||||
for (Entry<String, String[]> entry : source.entrySet()) {
|
||||
result.put(entry.getKey(), Arrays.asList(entry.getValue()));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
@@ -166,14 +167,14 @@ class WrappedProperties {
|
||||
Map<String, List<PersistentProperty<?>>> nestedProperties = findUnwrappedPropertyPaths(
|
||||
annotatedMember.getRawType(), propertyNameTransformer, true);
|
||||
|
||||
for (String key : nestedProperties.keySet()) {
|
||||
for (Entry<String, List<PersistentProperty<?>>> entry : nestedProperties.entrySet()) {
|
||||
|
||||
List<PersistentProperty<?>> persistentProperties = new ArrayList<PersistentProperty<?>>();
|
||||
|
||||
persistentProperties.add(persistentProperty);
|
||||
persistentProperties.addAll(nestedProperties.get(key));
|
||||
persistentProperties.addAll(entry.getValue());
|
||||
|
||||
mapping.put(key, persistentProperties);
|
||||
mapping.put(entry.getKey(), persistentProperties);
|
||||
}
|
||||
|
||||
return mapping;
|
||||
|
||||
Reference in New Issue
Block a user