Minor refactoring
* Remove unneeded exception declarations * Collapse catch blocks * Replace string concatenation with builder append
This commit is contained in:
committed by
Mahmoud Ben Hassine
parent
dca16fb5bd
commit
df2e778fbd
@@ -246,10 +246,7 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
|
||||
try {
|
||||
return type.newInstance();
|
||||
}
|
||||
catch (InstantiationException e) {
|
||||
ReflectionUtils.handleReflectionException(e);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
catch (InstantiationException | IllegalAccessException e) {
|
||||
ReflectionUtils.handleReflectionException(e);
|
||||
}
|
||||
// should not happen
|
||||
@@ -370,10 +367,7 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
|
||||
nestedValue = wrapper.getPropertyType(nestedName).newInstance();
|
||||
wrapper.setPropertyValue(nestedName, nestedValue);
|
||||
}
|
||||
catch (InstantiationException e) {
|
||||
ReflectionUtils.handleReflectionException(e);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
catch (InstantiationException | IllegalAccessException e) {
|
||||
ReflectionUtils.handleReflectionException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class RecursiveCollectionLineAggregator<T> implements LineAggregator<Coll
|
||||
|
||||
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
|
||||
|
||||
private LineAggregator<T> delegate = new PassThroughLineAggregator<T>();
|
||||
private LineAggregator<T> delegate = new PassThroughLineAggregator<>();
|
||||
|
||||
/**
|
||||
* Public setter for the {@link LineAggregator} to use on single items, that
|
||||
@@ -47,13 +47,13 @@ public class RecursiveCollectionLineAggregator<T> implements LineAggregator<Coll
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.file.transform.LineAggregator#aggregate(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public String aggregate(Collection<T> items) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (T value : items) {
|
||||
builder.append(delegate.aggregate(value) + LINE_SEPARATOR);
|
||||
builder.append(delegate.aggregate(value)).append(LINE_SEPARATOR);
|
||||
}
|
||||
return builder.delete(builder.length()-LINE_SEPARATOR.length(),builder.length()).toString();
|
||||
return builder.delete(builder.length() - LINE_SEPARATOR.length(), builder.length()).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class IteratorItemReader<T> implements ItemReader<T> {
|
||||
* iterator provided.
|
||||
*/
|
||||
@Override
|
||||
public T read() throws Exception, UnexpectedInputException, ParseException {
|
||||
public T read() {
|
||||
if (iterator.hasNext())
|
||||
return iterator.next();
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user