Fixed some sonar problems.
This commit is contained in:
@@ -174,8 +174,8 @@ public class PagedResultsRequestControl extends AbstractRequestControlDirContext
|
||||
|
||||
Control result = null;
|
||||
try {
|
||||
result = (Control) constructor.newInstance(new Object[] { new Integer(pageSize), actualCookie,
|
||||
Boolean.valueOf(critical) });
|
||||
result = (Control) constructor.newInstance(pageSize, actualCookie,
|
||||
critical);
|
||||
}
|
||||
catch (Exception e) {
|
||||
ReflectionUtils.handleReflectionException(e);
|
||||
|
||||
@@ -151,6 +151,26 @@ class RangeOption implements Comparable<RangeOption> {
|
||||
return this.getTerminal() > that.getTerminal() ? 1 : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
RangeOption that = (RangeOption) o;
|
||||
|
||||
if (initial != that.initial) return false;
|
||||
if (terminal != that.terminal) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = initial;
|
||||
result = 31 * result + terminal;
|
||||
return result;
|
||||
}
|
||||
|
||||
public RangeOption nextRange(int pageSize) {
|
||||
if (getTerminal() < 0) {
|
||||
throw new IllegalStateException("Cannot generate next range, range-terminal: " + getTerminal());
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package org.springframework.ldap.test;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import org.springframework.ldap.core.AttributesMapper;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.directory.Attribute;
|
||||
import javax.naming.directory.Attributes;
|
||||
|
||||
import org.springframework.ldap.core.AttributesMapper;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Dummy AttributesMapper for testing purposes to check that the received
|
||||
@@ -55,14 +55,14 @@ public class AttributeCheckAttributesMapper implements AttributesMapper {
|
||||
}
|
||||
|
||||
public void setAbsentAttributes(String[] absentAttributes) {
|
||||
this.absentAttributes = absentAttributes;
|
||||
this.absentAttributes = Arrays.copyOf(absentAttributes, absentAttributes.length);
|
||||
}
|
||||
|
||||
public void setExpectedAttributes(String[] expectedAttributes) {
|
||||
this.expectedAttributes = expectedAttributes;
|
||||
this.expectedAttributes = Arrays.copyOf(expectedAttributes, expectedAttributes.length);
|
||||
}
|
||||
|
||||
public void setExpectedValues(String[] expectedValues) {
|
||||
this.expectedValues = expectedValues;
|
||||
this.expectedValues = Arrays.copyOf(expectedValues, expectedValues.length);
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ import junit.framework.Assert;
|
||||
import org.springframework.ldap.core.ContextMapper;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Dummy ContextMapper for testing purposes to check that the received
|
||||
* Attributes are the expected ones.
|
||||
@@ -45,22 +47,22 @@ public class AttributeCheckContextMapper implements ContextMapper {
|
||||
Assert.assertEquals(expectedValues[i], attributeValue);
|
||||
}
|
||||
|
||||
for (int i = 0; i < absentAttributes.length; i++) {
|
||||
Assert.assertNull(adapter.getStringAttribute(absentAttributes[i]));
|
||||
for (String absentAttribute : absentAttributes) {
|
||||
Assert.assertNull(adapter.getStringAttribute(absentAttribute));
|
||||
}
|
||||
|
||||
return adapter;
|
||||
}
|
||||
|
||||
public void setAbsentAttributes(String[] absentAttributes) {
|
||||
this.absentAttributes = absentAttributes;
|
||||
this.absentAttributes = Arrays.copyOf(absentAttributes, absentAttributes.length);
|
||||
}
|
||||
|
||||
public void setExpectedAttributes(String[] expectedAttributes) {
|
||||
this.expectedAttributes = expectedAttributes;
|
||||
this.expectedAttributes = Arrays.copyOf(expectedAttributes, expectedAttributes.length);
|
||||
}
|
||||
|
||||
public void setExpectedValues(String[] expectedValues) {
|
||||
this.expectedValues = expectedValues;
|
||||
this.expectedValues = Arrays.copyOf(expectedValues, expectedValues.length);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user