Skip to content

Commit 5dfc2cb

Browse files
committed
2 parents 4681f65 + 1758e25 commit 5dfc2cb

File tree

49 files changed

+264
-561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+264
-561
lines changed

src/conf/checkstyle.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ limitations under the License.
6060
<property name="scope" value="protected" />
6161
</module>
6262
<module name="NeedBraces" />
63+
<module name="ParenPad" />
6364
<module name="RedundantImport" />
65+
<module name="TypecastParenPad" />
6466
<module name="UnusedImports" />
6567
</module>
6668
<property name="localeLanguage" value="en" />

src/main/java/org/apache/commons/beanutils/BeanComparator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class BeanComparator<T> implements Comparator<T>, Serializable {
7171
* </p>
7272
*/
7373
public BeanComparator() {
74-
this( null );
74+
this(null);
7575
}
7676

7777
/**
@@ -232,7 +232,7 @@ private int internalCompare(final Object val1, final Object val2) {
232232
* @param property String method name to call to compare
233233
* If the property passed in is null then the actual objects will be compared
234234
*/
235-
public void setProperty( final String property ) {
235+
public void setProperty(final String property) {
236236
this.property = property;
237237
}
238238
}

src/main/java/org/apache/commons/beanutils/BeanMap.java

Lines changed: 188 additions & 269 deletions
Large diffs are not rendered by default.

src/main/java/org/apache/commons/beanutils/BeanPredicate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public boolean evaluate(final Object object) {
6565
boolean evaluation = false;
6666

6767
try {
68-
final Object propValue = PropertyUtils.getProperty( object, propertyName );
68+
final Object propValue = PropertyUtils.getProperty(object, propertyName);
6969
evaluation = predicate.evaluate(propValue);
7070
} catch (final IllegalArgumentException e) {
7171
final String errorMsg = "Problem during evaluation.";

src/main/java/org/apache/commons/beanutils/LazyDynaList.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,10 @@ public void setElementType(final Class<?> elementType) {
514514
this.elementDynaBeanType = dynaBean.getClass();
515515

516516
// Re-calculate the type
517-
if (WrapDynaBean.class.isAssignableFrom(elementDynaBeanType )) {
518-
this.elementType = ((WrapDynaBean)dynaBean).getInstance().getClass();
519-
} else if (LazyDynaMap.class.isAssignableFrom(elementDynaBeanType )) {
520-
this.elementType = ((LazyDynaMap)dynaBean).getMap().getClass();
517+
if (WrapDynaBean.class.isAssignableFrom(elementDynaBeanType)) {
518+
this.elementType = ((WrapDynaBean) dynaBean).getInstance().getClass();
519+
} else if (LazyDynaMap.class.isAssignableFrom(elementDynaBeanType)) {
520+
this.elementType = ((LazyDynaMap) dynaBean).getMap().getClass();
521521
}
522522

523523
}

src/main/java/org/apache/commons/beanutils/MethodUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,9 @@ public static Method getMatchingAccessibleMethod(
521521
}
522522
setMethodAccessible(method); // Default access superclass workaround
523523
myCost = getTotalTransformationCost(parameterTypes,method.getParameterTypes());
524-
if ( myCost < bestMatchCost ) {
525-
bestMatch = method;
526-
bestMatchCost = myCost;
524+
if (myCost < bestMatchCost) {
525+
bestMatch = method;
526+
bestMatchCost = myCost;
527527
}
528528
}
529529

@@ -532,11 +532,11 @@ public static Method getMatchingAccessibleMethod(
532532
}
533533
}
534534
}
535-
if ( bestMatch != null ){
536-
cacheMethod(md, bestMatch);
535+
if (bestMatch != null) {
536+
cacheMethod(md, bestMatch);
537537
} else {
538-
// didn't find a match
539-
log.trace("No match found.");
538+
// didn't find a match
539+
log.trace("No match found.");
540540
}
541541

542542
return bestMatch;

src/main/java/org/apache/commons/beanutils/PropertyUtilsBean.java

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,58 +1197,43 @@ public Resolver getResolver() {
11971197
* @throws NoSuchMethodException if an accessor method for this
11981198
* propety cannot be found
11991199
*/
1200-
public Object getSimpleProperty(final Object bean, final String name)
1201-
throws IllegalAccessException, InvocationTargetException,
1202-
NoSuchMethodException {
1200+
public Object getSimpleProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
12031201

12041202
if (bean == null) {
12051203
throw new IllegalArgumentException("No bean specified");
12061204
}
12071205
if (name == null) {
1208-
throw new IllegalArgumentException("No name specified for bean class '" +
1209-
bean.getClass() + "'");
1206+
throw new IllegalArgumentException("No name specified for bean class '" + bean.getClass() + "'");
12101207
}
12111208

12121209
// Validate the syntax of the property name
12131210
if (resolver.hasNested(name)) {
1214-
throw new IllegalArgumentException
1215-
("Nested property names are not allowed: Property '" +
1216-
name + "' on bean class '" + bean.getClass() + "'");
1211+
throw new IllegalArgumentException("Nested property names are not allowed: Property '" + name + "' on bean class '" + bean.getClass() + "'");
12171212
}
12181213
if (resolver.isIndexed(name)) {
1219-
throw new IllegalArgumentException
1220-
("Indexed property names are not allowed: Property '" +
1221-
name + "' on bean class '" + bean.getClass() + "'");
1214+
throw new IllegalArgumentException("Indexed property names are not allowed: Property '" + name + "' on bean class '" + bean.getClass() + "'");
12221215
}
12231216
if (resolver.isMapped(name)) {
1224-
throw new IllegalArgumentException
1225-
("Mapped property names are not allowed: Property '" +
1226-
name + "' on bean class '" + bean.getClass() + "'");
1217+
throw new IllegalArgumentException("Mapped property names are not allowed: Property '" + name + "' on bean class '" + bean.getClass() + "'");
12271218
}
12281219

12291220
// Handle DynaBean instances specially
12301221
if (bean instanceof DynaBean) {
1231-
final DynaProperty descriptor =
1232-
((DynaBean) bean).getDynaClass().getDynaProperty(name);
1222+
final DynaProperty descriptor = ((DynaBean) bean).getDynaClass().getDynaProperty(name);
12331223
if (descriptor == null) {
1234-
throw new NoSuchMethodException("Unknown property '" +
1235-
name + "' on dynaclass '" +
1236-
((DynaBean) bean).getDynaClass() + "'" );
1224+
throw new NoSuchMethodException("Unknown property '" + name + "' on dynaclass '" + ((DynaBean) bean).getDynaClass() + "'");
12371225
}
12381226
return ((DynaBean) bean).get(name);
12391227
}
12401228

12411229
// Retrieve the property getter method for the specified property
1242-
final PropertyDescriptor descriptor =
1243-
getPropertyDescriptor(bean, name);
1230+
final PropertyDescriptor descriptor = getPropertyDescriptor(bean, name);
12441231
if (descriptor == null) {
1245-
throw new NoSuchMethodException("Unknown property '" +
1246-
name + "' on class '" + bean.getClass() + "'" );
1232+
throw new NoSuchMethodException("Unknown property '" + name + "' on class '" + bean.getClass() + "'");
12471233
}
12481234
final Method readMethod = getReadMethod(bean.getClass(), descriptor);
12491235
if (readMethod == null) {
1250-
throw new NoSuchMethodException("Property '" + name +
1251-
"' has no getter method in class '" + bean.getClass() + "'");
1236+
throw new NoSuchMethodException("Property '" + name + "' has no getter method in class '" + bean.getClass() + "'");
12521237
}
12531238

12541239
return invokeMethod(readMethod, bean, EMPTY_OBJECT_ARRAY);

src/main/java/org/apache/commons/beanutils/RowSetDynaClass.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public RowSetDynaClass(final ResultSet resultSet, final int limit) throws SQLExc
243243
protected void copy(final ResultSet resultSet) throws SQLException {
244244

245245
int cnt = 0;
246-
while (resultSet.next() && (limit < 0 || cnt++ < limit) ) {
246+
while (resultSet.next() && (limit < 0 || cnt++ < limit)) {
247247
final DynaBean bean = createDynaBean();
248248
for (final DynaProperty propertie : properties) {
249249
final String name = propertie.getName();

src/main/java/org/apache/commons/beanutils/WeakFastHashMap.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ protected K iteratorNext(final Map.Entry<K, V> entry) {
316316
}
317317

318318
// Constructors
319-
// ----------------------------------------------------------------------
320319

321320
/**
322321
* Collection implementation over the values of the FastHashMap
@@ -347,7 +346,6 @@ protected V iteratorNext(final Map.Entry<K, V> entry) {
347346
private boolean fast;
348347

349348
// Property access
350-
// ----------------------------------------------------------------------
351349

352350
/**
353351
* Construct an empty map.
@@ -366,7 +364,6 @@ public WeakFastHashMap(final int capacity) {
366364
}
367365

368366
// Map access
369-
// ----------------------------------------------------------------------
370367
// These methods can forward straight to the wrapped Map in 'fast' mode.
371368
// (because they are query methods)
372369

@@ -430,7 +427,6 @@ protected Map<K, V> cloneMap(final Map<? extends K, ? extends V> map) {
430427
}
431428

432429
// Map modification
433-
// ----------------------------------------------------------------------
434430
// These methods perform special behaviour in 'fast' mode.
435431
// The map is cloned, updated and then assigned back.
436432
// See the comments at the top as to why this won't always work.
@@ -478,7 +474,6 @@ protected Map<K, V> createMap(final int capacity) {
478474
}
479475

480476
// Basic object methods
481-
// ----------------------------------------------------------------------
482477

483478
protected Map<K, V> createMap(final int capacity, final float factor) {
484479
return new WeakHashMap<>(capacity, factor);
@@ -499,7 +494,6 @@ public Set<Map.Entry<K, V>> entrySet() {
499494
}
500495

501496
// Map views
502-
// ----------------------------------------------------------------------
503497

504498
/**
505499
* Compare the specified object with this list for equality. This
@@ -588,7 +582,6 @@ public boolean getFast() {
588582
}
589583

590584
// Abstractions on Map creations (for subclasses such as WeakFastHashMap)
591-
// ----------------------------------------------------------------------
592585

593586
/**
594587
* Return the hash code value for this map. This implementation uses
@@ -685,7 +678,6 @@ public void putAll(final Map<? extends K, ? extends V> in) {
685678
}
686679

687680
// Map view inner classes
688-
// ----------------------------------------------------------------------
689681

690682
/**
691683
* Remove any mapping for this key, and return any previously

src/main/java/org/apache/commons/beanutils/locale/LocaleConvertUtilsBean.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,7 @@ protected FastHashMap create(final Locale locale) {
417417
// behaviour of toString and valueOf methods of these classes
418418
converter.put(java.sql.Date.class, new SqlDateLocaleConverter(locale, "yyyy-MM-dd"));
419419
converter.put(java.sql.Time.class, new SqlTimeLocaleConverter(locale, "HH:mm:ss"));
420-
converter.put( java.sql.Timestamp.class,
421-
new SqlTimestampLocaleConverter(locale, "yyyy-MM-dd HH:mm:ss.S")
422-
);
420+
converter.put(java.sql.Timestamp.class, new SqlTimestampLocaleConverter(locale, "yyyy-MM-dd HH:mm:ss.S"));
423421

424422
converter.setFast(true);
425423

0 commit comments

Comments
 (0)