Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/ThreeWayMerger.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/ThreeWayMerger.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/ThreeWayMerger.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/ThreeWayMerger.java Sun Apr 21 13:29:41 2024 @@ -22,7 +22,6 @@ package org.apache.torque.generator.merg import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.Charset; -import java.nio.charset.UnsupportedCharsetException; import org.apache.torque.generator.GeneratorException; import org.eclipse.jgit.diff.RawText; @@ -54,24 +53,11 @@ public class ThreeWayMerger String base, String generated, String edited, - String charsetName) + Charset charSet) throws GeneratorException { MergeAlgorithm mergeAlgorithm = new MergeAlgorithm(); - MergeResult<RawText> mergeResult; - Charset charSet; - try - { - charSet = Charset.forName(charsetName); - } - catch (UnsupportedCharsetException e) - { - throw new GeneratorException( - "unknown character set " + charsetName, - e); - } - - mergeResult = mergeAlgorithm.merge( + MergeResult<RawText> mergeResult = mergeAlgorithm.merge( RawTextComparator.DEFAULT, new RawText(base.getBytes(charSet)), new RawText(generated.getBytes(charSet)),
Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/option/OptionImpl.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/option/OptionImpl.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/option/OptionImpl.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/option/OptionImpl.java Sun Apr 21 13:29:41 2024 @@ -1,5 +1,7 @@ package org.apache.torque.generator.option; +import java.util.Objects; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -30,12 +32,12 @@ public class OptionImpl implements Optio /** * The qualified name of the option, including the name and the context. */ - private QualifiedName qualifiedName; + private final QualifiedName qualifiedName; /** * The value of the option. */ - private Object value; + private final Object value; /** * Constructs an optionImpl from a namespace, a name and a value. @@ -127,13 +129,7 @@ public class OptionImpl implements Optio @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((qualifiedName == null) ? 0 : qualifiedName.hashCode()); - result = prime * result - + ((value == null) ? 0 : value.hashCode()); - return result; + return Objects.hash(qualifiedName, value); } @Override @@ -143,35 +139,17 @@ public class OptionImpl implements Optio { return true; } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) + if ((obj == null) || (getClass() != obj.getClass())) { return false; } final OptionImpl other = (OptionImpl) obj; - if (qualifiedName == null) - { - if (other.qualifiedName != null) - { - return false; - } - } - else if (!qualifiedName.equals(other.qualifiedName)) + if (!Objects.equals(qualifiedName, other.qualifiedName)) { return false; } - if (value == null) - { - if (other.value != null) - { - return false; - } - } - else if (!value.equals(other.value)) + if (!Objects.equals(value, other.value)) { return false; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/DebuggingOutletWrapper.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/DebuggingOutletWrapper.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/DebuggingOutletWrapper.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/DebuggingOutletWrapper.java Sun Apr 21 13:29:41 2024 @@ -37,7 +37,7 @@ import org.apache.torque.generator.qname public class DebuggingOutletWrapper implements Outlet { /** The wrapped outlet, not null. */ - private Outlet delegate; + private final Outlet delegate; /** * Constructor. Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/Mergepoint.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/Mergepoint.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/Mergepoint.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/Mergepoint.java Sun Apr 21 13:29:41 2024 @@ -28,7 +28,7 @@ public class Mergepoint /** * The name of the merge point. */ - private String name; + private final String name; /** * Constructor. @@ -65,7 +65,7 @@ public class Mergepoint @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append(name); return result.toString(); } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletImpl.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletImpl.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletImpl.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletImpl.java Sun Apr 21 13:29:41 2024 @@ -249,7 +249,7 @@ public abstract class OutletImpl impleme @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append("(name=").append(name).append(","); result.append("inputElementName=").append(inputElementName); result.append(")"); @@ -382,7 +382,7 @@ public abstract class OutletImpl impleme + " Returning the empty String."); return ""; } - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (MergepointAction action : actions) { if (log.isDebugEnabled()) @@ -406,12 +406,7 @@ public abstract class OutletImpl impleme } result.append(actionResult.getStringResult()); } - catch (GeneratorException e) - { - log.error("mergepoint() : Error executing action " + action, e); - throw e; - } - catch (RuntimeException e) + catch (GeneratorException | RuntimeException e) { log.error("mergepoint() : Error executing action " + action, e); throw e; Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletResult.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletResult.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletResult.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletResult.java Sun Apr 21 13:29:41 2024 @@ -118,11 +118,7 @@ public class OutletResult { return true; } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) + if ((obj == null) || (getClass() != obj.getClass())) { return false; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/processor/string/ConstantNameCreator.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/processor/string/ConstantNameCreator.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/processor/string/ConstantNameCreator.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/processor/string/ConstantNameCreator.java Sun Apr 21 13:29:41 2024 @@ -82,7 +82,7 @@ public class ConstantNameCreator extends * If the string starts is empty or start with a number, the character <code>toReplaceWith</code> * is prefixed to the constant name. * Finally, the new String is returned. - * + * * <p> * Example: "prOceSS-*+ing~#._Test" is converted to "PR_OCE_SS_ING_TEST" * Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/qname/Namespace.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/qname/Namespace.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/qname/Namespace.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/qname/Namespace.java Sun Apr 21 13:29:41 2024 @@ -59,7 +59,7 @@ public final class Namespace /** * The String representation of the namespace. Is never null. */ - private String namespace; + private final String namespace; /** * Constructs a namespace from its string representation. @@ -104,7 +104,7 @@ public final class Namespace { throw new NullPointerException("namespaceParts must not be null"); } - StringBuffer assembledNamespace = new StringBuffer(); + StringBuilder assembledNamespace = new StringBuilder(); for (Iterator<String> partIt = namespaceParts.iterator(); partIt.hasNext();) { @@ -187,12 +187,7 @@ public final class Namespace } // The root namespace is not contained in an non-root namespace. - if (ROOT_NAMESPACE.equals(this)) - { - return false; - } - - if (!this.namespace.startsWith(otherNamespace.namespace)) + if (ROOT_NAMESPACE.equals(this) || !this.namespace.startsWith(otherNamespace.namespace)) { return false; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelPropertyPointer.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelPropertyPointer.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelPropertyPointer.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelPropertyPointer.java Sun Apr 21 13:29:41 2024 @@ -507,16 +507,7 @@ public class ModelPropertyPointer extend { return valueClass.getField(name); } - catch (final SecurityException e) - { - throw new JXPathException( - "Cannot access property: " - + valueClass.getName() - + "." - + name, - e); - } - catch (final NoSuchFieldException e) + catch (final SecurityException | NoSuchFieldException e) { throw new JXPathException( "Cannot access property: " @@ -533,16 +524,7 @@ public class ModelPropertyPointer extend { return field.get(getBean()); } - catch (final IllegalArgumentException e) - { - throw new JXPathException( - "Cannot access property: " - + (bean == null ? "null" : bean.getClass().getName()) - + "." - + name, - e); - } - catch (final IllegalAccessException e) + catch (final IllegalArgumentException | IllegalAccessException e) { throw new JXPathException( "Cannot access property: " @@ -560,12 +542,7 @@ public class ModelPropertyPointer extend { field.set(getBean(), value); } - catch (final IllegalArgumentException e) - { - throw new JXPathInvalidAccessException( - "Cannot set property: " + asPath(), e); - } - catch (final IllegalAccessException e) + catch (final IllegalArgumentException | IllegalAccessException e) { throw new JXPathInvalidAccessException( "Cannot set property: " + asPath(), e); Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/PostprocessorDefinition.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/PostprocessorDefinition.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/PostprocessorDefinition.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/PostprocessorDefinition.java Sun Apr 21 13:29:41 2024 @@ -84,11 +84,7 @@ public final class PostprocessorDefiniti { return true; } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) + if ((obj == null) || (getClass() != obj.getClass())) { return false; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java Sun Apr 21 13:29:41 2024 @@ -29,6 +29,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.ListIterator; import java.util.Map; +import java.util.Objects; import java.util.Set; /** @@ -598,12 +599,7 @@ public class SourceElement implements Se { return false; } - if (reference == null && toCompare == null) - { - return true; - } - - if (compared.contains(reference)) + if ((reference == null && toCompare == null) || compared.contains(reference)) { // although it is not certain that reference is equal to toCompare // if it is contained in compared, it does mean that equality @@ -631,20 +627,9 @@ public class SourceElement implements Se = reference.getAttribute(attributeName); Object toCompareAttributeContent = toCompare.getAttribute(attributeName); - if (referenceAttributeContent == null) - { - if (toCompareAttributeContent != null) - { - return false; - } - } - else + if (!Objects.equals(referenceAttributeContent, toCompareAttributeContent)) { - if (!referenceAttributeContent.equals( - toCompareAttributeContent)) - { - return false; - } + return false; } } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributeIterator.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributeIterator.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributeIterator.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributeIterator.java Sun Apr 21 13:29:41 2024 @@ -79,7 +79,7 @@ public class SourceElementAttributeItera for (final String attributeName : attributeNames) { final Object value = sourceElement.getAttribute(attributeName); - if (testAttr(attributeName, value)) + if (testAttr(attributeName)) { names.add(name); } @@ -92,7 +92,7 @@ public class SourceElementAttributeItera * @param attr to test * @return whether test succeeded */ - private boolean testAttr(final String attributeName, final Object value) + private boolean testAttr(final String attributeName) { if (name.equals("*") || name.equals(attributeName)) { Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributePointer.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributePointer.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributePointer.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributePointer.java Sun Apr 21 13:29:41 2024 @@ -149,7 +149,7 @@ public class SourceElementAttributePoint @Override public String asPath() { - final StringBuffer buffer = new StringBuffer(); + final StringBuilder buffer = new StringBuilder(); if (parent != null) { buffer.append(parent.asPath()); Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointer.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointer.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointer.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointer.java Sun Apr 21 13:29:41 2024 @@ -179,11 +179,7 @@ public class SourceElementNodePointer ex final QName testName = nodeNameTest.getNodeName(); final boolean wildcard = nodeNameTest.isWildcard(); final String testPrefix = testName.getPrefix(); - if (wildcard && testPrefix == null) - { - return true; - } - if (wildcard || testName.getName().equals(sourceElement.getName())) + if ((wildcard && testPrefix == null) || wildcard || testName.getName().equals(sourceElement.getName())) { return true; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePath.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePath.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePath.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePath.java Sun Apr 21 13:29:41 2024 @@ -641,7 +641,7 @@ public final class SourcePath throws GeneratorException { final StringBuilder result = new StringBuilder(); - getParentPath(sourceElement, new HashSet<SourceElement>(), result); + getParentPath(sourceElement, new HashSet<>(), result); result.append(sourceElement.getName()); return result.toString(); } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePathPointer.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePathPointer.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePathPointer.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePathPointer.java Sun Apr 21 13:29:41 2024 @@ -1,5 +1,7 @@ package org.apache.torque.generator.source; +import java.util.Objects; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -48,11 +50,7 @@ public class SourcePathPointer @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((path == null) ? 0 : path.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - return result; + return Objects.hash(path, value); } @Override @@ -62,34 +60,16 @@ public class SourcePathPointer { return true; } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) + if ((obj == null) || (getClass() != obj.getClass())) { return false; } SourcePathPointer other = (SourcePathPointer) obj; - if (path == null) - { - if (other.path != null) - { - return false; - } - } - else if (!path.equals(other.path)) + if (!Objects.equals(path, other.path)) { return false; } - if (value == null) - { - if (other.value != null) - { - return false; - } - } - else if (!value.equals(other.value)) + if (!Objects.equals(value, other.value)) { return false; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java Sun Apr 21 13:29:41 2024 @@ -84,11 +84,7 @@ public final class SourceTransformerDefi { return true; } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) + if ((obj == null) || (getClass() != obj.getClass())) { return false; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ColumnMetadata.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ColumnMetadata.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ColumnMetadata.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ColumnMetadata.java Sun Apr 21 13:29:41 2024 @@ -27,25 +27,25 @@ package org.apache.torque.generator.sour public class ColumnMetadata { /** The column name. */ - private String name; + private final String name; /** The data type of the column, as in java.sql.Types. */ - private Integer sqlType; + private final Integer sqlType; /** The maximum size of the column. */ - private Integer size; + private final Integer size; /** * 0 if the column may not be null, * 1 if the column may be known, * 2 unknown. */ - private Integer nullType; + private final Integer nullType; /** The default value of the column, or null if no default value exists. */ - private String defValue; + private final String defValue; /** The number of decimal digits of the column. */ - private Integer decimalDigits; + private final Integer decimalDigits; /** Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ForeignKeyMetadata.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ForeignKeyMetadata.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ForeignKeyMetadata.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ForeignKeyMetadata.java Sun Apr 21 13:29:41 2024 @@ -36,10 +36,10 @@ public class ForeignKeyMetadata private String foreignKeyName; /** The local columns of the foreign key. */ - private List<String> localColumns = new ArrayList<>(); + private final List<String> localColumns = new ArrayList<>(); /** The foreign columns of the foreign key. */ - private List<String> foreignColumns = new ArrayList<>(); + private final List<String> foreignColumns = new ArrayList<>(); /** * Returns the name of the referenced (foreign) table. Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/JdbcMetadataSourceProvider.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/JdbcMetadataSourceProvider.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/JdbcMetadataSourceProvider.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/JdbcMetadataSourceProvider.java Sun Apr 21 13:29:41 2024 @@ -33,19 +33,19 @@ import org.apache.torque.generator.sourc public class JdbcMetadataSourceProvider extends SourceProvider { /** The name of the option to retrieve the JDBC URL from. */ - private String urlOption; + private final String urlOption; /** The name of the option to retrieve the JDBC driver from. */ - private String driverOption; + private final String driverOption; /** The name of the option to retrieve the JDBC user name from. */ - private String usernameOption; + private final String usernameOption; /** The name of the option to retrieve the JDBC password from. */ - private String passwordOption; + private final String passwordOption; /** The name of the option to retrieve the JDBC schema from. */ - private String schemaOption; + private final String schemaOption; /** JDBC URL. */ private String url; @@ -94,7 +94,7 @@ public class JdbcMetadataSourceProvider /* (non-Javadoc) * @see org.apache.torque.generator.source.SourceProvider#initInternal(org.apache.torque.generator.configuration.ConfigurationHandlers, org.apache.torque.generator.control.ControllerState) - * + * * Generates an XML database schema from JDBC metadata. */ @Override Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/CombinedFileSource.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/CombinedFileSource.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/CombinedFileSource.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/CombinedFileSource.java Sun Apr 21 13:29:41 2024 @@ -186,7 +186,7 @@ public class CombinedFileSource extends @Override public byte[] getContentChecksum() { - byte[] result = new byte[] {}; + byte[] result = {}; for (FileSource fileSource : fileSources) { Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSource.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSource.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSource.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSource.java Sun Apr 21 13:29:41 2024 @@ -244,7 +244,7 @@ public class FileSource extends SourceIm @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append("(path=").append(path) .append(",type=").append(format); return result.toString(); Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSourceProvider.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSourceProvider.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSourceProvider.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSourceProvider.java Sun Apr 21 13:29:41 2024 @@ -50,7 +50,7 @@ public class FileSourceProvider extends * The type of the file(s), or null if the type should be determined * from the file name extension. */ - private StreamSourceFormat sourceFormat; + private final StreamSourceFormat sourceFormat; /** The fileset defining the source files, not null. */ private Fileset sourceFileset; @@ -229,7 +229,7 @@ public class FileSourceProvider extends @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append("(sourceFileset=").append(sourceFileset) .append(",sourceFormat=").append(sourceFormat) .append(")"); @@ -335,11 +335,7 @@ public class FileSourceProvider extends @Override public void copyNotSetSettingsFrom(SourceProvider sourceProvider) { - if (sourceProvider == null) - { - return; - } - if (!(sourceProvider instanceof FileSourceProvider)) + if ((sourceProvider == null) || !(sourceProvider instanceof FileSourceProvider)) { return; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/PropertiesSourceFormat.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/PropertiesSourceFormat.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/PropertiesSourceFormat.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/PropertiesSourceFormat.java Sun Apr 21 13:29:41 2024 @@ -111,13 +111,7 @@ public final class PropertiesSourceForma { properties.load(inputStream); } - catch (IOException e) - { - throw new SourceException( - "Error parsing Properties source file: " + e.getMessage(), - e); - } - catch (IllegalArgumentException e) + catch (IOException | IllegalArgumentException e) { throw new SourceException( "Error parsing Properties source file: " + e.getMessage(), @@ -162,11 +156,7 @@ public final class PropertiesSourceForma @Override public boolean equals(Object other) { - if (other == null) - { - return false; - } - if (!other.getClass().equals(PropertiesSourceFormat.class)) + if ((other == null) || !other.getClass().equals(PropertiesSourceFormat.class)) { return false; } @@ -248,11 +238,7 @@ public final class PropertiesSourceForma { return true; } - if (!super.equals(obj)) - { - return false; - } - if (getClass() != obj.getClass()) + if (!super.equals(obj) || (getClass() != obj.getClass())) { return false; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceFormat.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceFormat.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceFormat.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceFormat.java Sun Apr 21 13:29:41 2024 @@ -63,15 +63,7 @@ public final class XmlSourceFormat imple SAX_FACTORY.setFeature( "http://apache.org/xml/features/validation/schema", true); } - catch (SAXNotSupportedException e) - { - throw new RuntimeException(e); - } - catch (SAXNotRecognizedException e) - { - throw new RuntimeException(e); - } - catch (ParserConfigurationException e) + catch (SAXNotSupportedException | SAXNotRecognizedException | ParserConfigurationException e) { throw new RuntimeException(e); } @@ -180,11 +172,7 @@ public final class XmlSourceFormat imple @Override public boolean equals(Object other) { - if (other == null) - { - return false; - } - if (!other.getClass().equals(XmlSourceFormat.class)) + if ((other == null) || !other.getClass().equals(XmlSourceFormat.class)) { return false; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceSaxHandler.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceSaxHandler.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceSaxHandler.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceSaxHandler.java Sun Apr 21 13:29:41 2024 @@ -49,7 +49,7 @@ public class XmlSourceSaxHandler extends private SourceElement root; /** The known entity references, not null. */ - private EntityReferences entityReferences; + private final EntityReferences entityReferences; /** * Constructor. Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/AttributeTransformer.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/AttributeTransformer.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/AttributeTransformer.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/AttributeTransformer.java Sun Apr 21 13:29:41 2024 @@ -33,10 +33,10 @@ import org.apache.torque.generator.sourc /** * Adds or replaces attributes in a SourceElement according to a definition * file. An example for a line in the definition file would be: - * + * * <p> * ${attribute(override):newAttribute}=prefix${attribute:oldAttribute}${option:suffix} - * + * * <p> * This would add the attribute newAttribute to the current sourceElement, * and its content would be (in java notation) @@ -45,7 +45,7 @@ import org.apache.torque.generator.sourc * ? "" * : currentElement.getAttribute("oldAttribute")) * + options.getOption("suffix") - * + * * <p> * On the left hand side, one can use attribute(override) (which replaces * the attribute if its already there) and attribute(noOverride) which @@ -101,7 +101,7 @@ public class AttributeTransformer implem /** * The list of transform rules which is created from the definition file. */ - private List<TransformRule> transformRules = new ArrayList<>(); + private final List<TransformRule> transformRules = new ArrayList<>(); /** * Constructor. @@ -622,19 +622,19 @@ public class AttributeTransformer implem ATTRIBUTE_NO_OVERRIDE("attribute(noOverride)", false, true); /** The name of the type. */ - private String name; + private final String name; /** * Whether this type can occur in the right hand side (the source) * of a definition. */ - private boolean inSource; + private final boolean inSource; /** * Whether this type can occur in the left hand side (the target) * of a definition. */ - private boolean inTarget; + private final boolean inTarget; /** @@ -646,7 +646,7 @@ public class AttributeTransformer implem * @param inTarget whether this type can occur in the left hand side * (the target) of a definition. */ - private Type(String name, boolean inSource, boolean inTarget) + Type(String name, boolean inSource, boolean inTarget) { this.name = name; this.inSource = inSource; @@ -700,13 +700,13 @@ public class AttributeTransformer implem /** * The type of the element. */ - private Type type; + private final Type type; /** * The content of the element (which can be the name of the attribute, * option, or the plain text itself) */ - private String content; + private final String content; /** * Constructor. @@ -937,12 +937,12 @@ public class AttributeTransformer implem /** * What should be set in which manner ? */ - private Definition target; + private final Definition target; /** * The rule of how to compose the new content. */ - private List<Definition> source; + private final List<Definition> source; /** * Constructor. Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java Sun Apr 21 13:29:41 2024 @@ -170,11 +170,7 @@ public class LoadAllSourceFilesTransform } } } - catch (ConfigurationException e) - { - throw new SourceTransformerException(e); - } - catch (SourceException e) + catch (ConfigurationException | SourceException e) { throw new SourceTransformerException(e); } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/SourceElementToModelTransformer.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/SourceElementToModelTransformer.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/SourceElementToModelTransformer.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/SourceElementToModelTransformer.java Sun Apr 21 13:29:41 2024 @@ -162,7 +162,7 @@ public class SourceElementToModelTransfo targetModelRoot, (SourceElement) modelRoot, controllerState.getUnitConfiguration(), - new HashMap<SourceElement, Object>()); + new HashMap<>()); return targetModelRoot; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/PropertyAccess.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/PropertyAccess.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/PropertyAccess.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/PropertyAccess.java Sun Apr 21 13:29:41 2024 @@ -119,8 +119,8 @@ public class PropertyAccess { this(target, propertyName, - Arrays.asList(new String[] {"_"}), - Arrays.asList(new String[] {"s", "Array", "List"})); + Arrays.asList("_"), + Arrays.asList("s", "Array", "List")); } /** @@ -289,15 +289,7 @@ public class PropertyAccess = PropertyUtils.getPropertyDescriptor(target, name); return propertyDescriptor; } - catch (final NoSuchMethodException e) - { - throw new SourceTransformerException(e); - } - catch (final IllegalAccessException e) - { - throw new SourceTransformerException(e); - } - catch (final InvocationTargetException e) + catch (final NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw new SourceTransformerException(e); } @@ -515,11 +507,7 @@ public class PropertyAccess + value.getClass().getName() , e); } - catch (final IllegalAccessException e) - { - throw new SourceTransformerException(e); - } - catch (final InvocationTargetException e) + catch (final IllegalAccessException | InvocationTargetException e) { throw new SourceTransformerException(e); } @@ -565,11 +553,7 @@ public class PropertyAccess { return field.get(target); } - catch (final IllegalArgumentException e) - { - throw new SourceTransformerException(e); - } - catch (final IllegalAccessException e) + catch (final IllegalArgumentException | IllegalAccessException e) { throw new SourceTransformerException(e); } @@ -591,15 +575,7 @@ public class PropertyAccess { return readMethod.invoke(target); } - catch (final IllegalArgumentException e) - { - throw new SourceTransformerException(e); - } - catch (final IllegalAccessException e) - { - throw new SourceTransformerException(e); - } - catch (final InvocationTargetException e) + catch (final IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { throw new SourceTransformerException(e); } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/TemplateOutletImpl.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/TemplateOutletImpl.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/TemplateOutletImpl.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/TemplateOutletImpl.java Sun Apr 21 13:29:41 2024 @@ -188,7 +188,7 @@ implements TemplateOutlet reader = new InputStreamReader(filteredStream, encoding); } - StringBuffer contentBuffer = new StringBuffer(); + StringBuilder contentBuffer = new StringBuilder(); while (true) { char[] charBuffer = new char[LOAD_BUFFER_SIZE]; @@ -223,7 +223,7 @@ implements TemplateOutlet @Override public String toString() { - StringBuffer result = new StringBuffer(super.toString()).append(","); + StringBuilder result = new StringBuilder(super.toString()).append(","); result.append("encoding=").append(encoding).append(","); result.append("content="); if (!contentMap.isEmpty()) Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/GroovyScriptOutlet.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/GroovyScriptOutlet.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/GroovyScriptOutlet.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/GroovyScriptOutlet.java Sun Apr 21 13:29:41 2024 @@ -38,7 +38,7 @@ import org.apache.torque.generator.qname */ public class GroovyScriptOutlet extends GroovyOutlet { - + /** The groovy shell to execute groovy scripts. */ private static volatile GroovyShell groovyShell = null; @@ -46,12 +46,12 @@ public class GroovyScriptOutlet extends /** The cached compiled scripts, keyed by the detokenized path. */ private static Map<String, Script> cachedScripts = new HashMap<>(); - + /** * Initializes GroovyShell with provided class loader. - * + * * @param cl if class loader is null uses {@link Thread#currentThread()}.getContextClassLoader() - * + * * @return */ GroovyShell getInstance(ClassLoader cl) @@ -66,7 +66,7 @@ public class GroovyScriptOutlet extends } return groovyShell; } - + /** * Constructs a new GroovyScriptOutlet. * Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/TorqueGenVelocity.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/TorqueGenVelocity.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/TorqueGenVelocity.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/TorqueGenVelocity.java Sun Apr 21 13:29:41 2024 @@ -41,12 +41,12 @@ public class TorqueGenVelocity /** * The state of the controller in which this generator interface is used. */ - private ControllerState controllerState; + private final ControllerState controllerState; /** * The outlet in which context this class is used. */ - private VelocityOutlet outlet; + private final VelocityOutlet outlet; /** * A counter which can be used in velocity templates. Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/VelocityOutlet.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/VelocityOutlet.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/VelocityOutlet.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/VelocityOutlet.java Sun Apr 21 13:29:41 2024 @@ -192,7 +192,7 @@ public class VelocityOutlet extends Temp /** * Executes the generation process; the result is returned. - * + * * * @param controllerState the current controller state. * @@ -217,14 +217,14 @@ public class VelocityOutlet extends Temp Properties properties = new Properties(); /*properties.put( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, Log4JLogChute.class.getName()); - + // test properties.put(RuntimeConstants.EVALUATE_CONTEXT_CLASS, "org.apache.velocity.VelocityContext");*/ /* * runtime.conversion.handler = none * space.gobbling = bc * directive.if.emptycheck = false - * + * * cf. http://velocity.apache.org/engine/2.0/upgrading.html */ properties.put( Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/variable/Variable.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/variable/Variable.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/variable/Variable.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/variable/Variable.java Sun Apr 21 13:29:41 2024 @@ -1,5 +1,7 @@ package org.apache.torque.generator.variable; +import java.util.Objects; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -60,7 +62,7 @@ public class Variable /** * The name of the variable. */ - private QualifiedName name; + private final QualifiedName name; /** * The value fo the variable. May be null. @@ -70,7 +72,7 @@ public class Variable /** * The scope of this variable. Is never null. */ - private Scope scope; + private final Scope scope; /** * Constructor. @@ -139,12 +141,7 @@ public class Variable @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((scope == null) ? 0 : scope.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - return result; + return Objects.hash(name, scope, value); } @Override @@ -154,49 +151,24 @@ public class Variable { return true; } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) + if ((obj == null) || (getClass() != obj.getClass())) { return false; } final Variable other = (Variable) obj; - if (name == null) - { - if (other.name != null) - { - return false; - } - } - else if (!name.equals(other.name)) + if (!Objects.equals(name, other.name)) { return false; } - if (scope == null) - { - if (other.scope != null) - { - return false; - } - } - else if (!scope.equals(other.scope)) + if (!Objects.equals(scope, other.scope)) { return false; } - if (value == null) - { - if (other.value != null) - { - return false; - } - } - else if (!value.equals(other.value)) + if (!Objects.equals(value, other.value)) { return false; } Modified: db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/variable/VariableStore.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/variable/VariableStore.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/variable/VariableStore.java (original) +++ db/torque/trunk/torque-generator/src/main/java/org/apache/torque/generator/variable/VariableStore.java Sun Apr 21 13:29:41 2024 @@ -34,7 +34,7 @@ public class VariableStore * contains all variables with the scope * <code>Variable.Scope.OUTLET<code>. */ - private QualifiedNameMap<Variable> outletScope + private final QualifiedNameMap<Variable> outletScope = new QualifiedNameMap<>(); /** @@ -44,21 +44,21 @@ public class VariableStore * in the current outlet, and with descending index the variables added * to the respective calling outlets. */ - private LinkedList<QualifiedNameMap<Variable>> childrenScopeList + private final LinkedList<QualifiedNameMap<Variable>> childrenScopeList = new LinkedList<>(); /** * contains all variables with the scope * <code>Variable.Scope.FILE<code>. */ - private QualifiedNameMap<Variable> fileScope + private final QualifiedNameMap<Variable> fileScope = new QualifiedNameMap<>(); /** * contains all variables with the scope * <code>Variable.Scope.GLOBAL<code>. */ - private QualifiedNameMap<Variable> globalScope + private final QualifiedNameMap<Variable> globalScope = new QualifiedNameMap<>(); /** @@ -124,7 +124,7 @@ public class VariableStore */ public void startOutlet() { - childrenScopeList.addLast(new QualifiedNameMap<Variable>()); + childrenScopeList.addLast(new QualifiedNameMap<>()); } /** Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ConfigurationTestTransformer.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ConfigurationTestTransformer.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ConfigurationTestTransformer.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ConfigurationTestTransformer.java Sun Apr 21 13:29:41 2024 @@ -52,11 +52,7 @@ public class ConfigurationTestTransforme { return true; } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) + if ((obj == null) || (getClass() != obj.getClass())) { return false; } Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/OtherConfigurationTestTransformer.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/OtherConfigurationTestTransformer.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/OtherConfigurationTestTransformer.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/OtherConfigurationTestTransformer.java Sun Apr 21 13:29:41 2024 @@ -52,11 +52,7 @@ public class OtherConfigurationTestTrans { return true; } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) + if ((obj == null) || (getClass() != obj.getClass())) { return false; } Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ReadConfigurationTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ReadConfigurationTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ReadConfigurationTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ReadConfigurationTest.java Sun Apr 21 13:29:41 2024 @@ -88,9 +88,9 @@ import org.junit.jupiter.api.TestInfo; public class ReadConfigurationTest extends BaseTest { private ControllerState controllerState; - - private Logger logger = LogManager.getLogger(getClass()); - + + private final Logger logger = LogManager.getLogger(getClass()); + @BeforeEach public void setUp(TestInfo testInfo, RepetitionInfo repetitionInfo) @@ -99,10 +99,10 @@ public class ReadConfigurationTest exten int currentRepetition = repetitionInfo.getCurrentRepetition(); if (currentRepetition % 2 == 0) { - Loglevel.setLoggingAdapter(new Log4j2LoggingAdapter()); + Loglevel.setLoggingAdapter(new Log4j2LoggingAdapter()); } else { // no implicit Loglevel.setLoggingAdapter(null); - Loglevel.setLoggingAdapter(new Log4jLoggingAdapter()); + Loglevel.setLoggingAdapter(new Log4jLoggingAdapter()); } UnitConfiguration unitConfiguration = new UnitConfiguration(); // unit configuration @@ -238,8 +238,8 @@ public class ReadConfigurationTest exten { Fileset sourceFileset = new Fileset( projectPaths.getDefaultSourcePath(), - new HashSet<String>(), - new HashSet<String>()); + new HashSet<>(), + new HashSet<>()); FileSourceProvider sourceProvider = new FileSourceProvider( new XmlSourceFormat(), sourceFileset, @@ -740,7 +740,7 @@ public class ReadConfigurationTest exten Fileset sourceFileset = new Fileset( projectPaths.getDefaultSourcePath(), createSetFrom("parentSource"), - new HashSet<String>()); + new HashSet<>()); FileSourceProvider sourceProvider = new FileSourceProvider( new XmlSourceFormat(), sourceFileset, @@ -810,8 +810,8 @@ public class ReadConfigurationTest exten { Fileset sourceFileset = new Fileset( projectPaths.getDefaultSourcePath(), - new HashSet<String>(), - new HashSet<String>()); + new HashSet<>(), + new HashSet<>()); FileSourceProvider sourceProvider = new FileSourceProvider( new XmlSourceFormat(), sourceFileset, Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationTest.java Sun Apr 21 13:29:41 2024 @@ -41,7 +41,7 @@ import org.junit.Test; public class OutletConfigurationTest { /** Unit descriptor for the tests. */ - private UnitDescriptor unitDescriptor = new UnitDescriptor( + private final UnitDescriptor unitDescriptor = new UnitDescriptor( Packaging.JAR, new Maven2DirectoryProjectPaths(new File(".")), new DefaultTorqueGeneratorPaths()); Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/example/gettingstarted/GettingStartedTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/example/gettingstarted/GettingStartedTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/example/gettingstarted/GettingStartedTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/example/gettingstarted/GettingStartedTest.java Sun Apr 21 13:29:41 2024 @@ -58,7 +58,7 @@ public class GettingStartedTest extends assertTrue(generatedJavaFile.exists()); File expectedJavaFile = new File( "src/test/resources/org/apache/torque/generator/example/gettingstarted/PropertyKeys.java"); - + assertTrue(FileUtils.contentEquals(generatedJavaFile, expectedJavaFile), "The files differ!"); //junitx.framework.FileAssert.assertEquals( // expectedJavaFile, Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/file/FilesetTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/file/FilesetTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/file/FilesetTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/file/FilesetTest.java Sun Apr 21 13:29:41 2024 @@ -253,8 +253,8 @@ public class FilesetTest { Fileset fileset = new Fileset( TEST_BASE_DIR, - new HashSet<String>(), - new HashSet<String>()); + new HashSet<>(), + new HashSet<>()); List<File> fileList = fileset.getFiles(); Iterator<File> fileIt = fileList.iterator(); while (fileIt.hasNext()) @@ -295,8 +295,7 @@ public class FilesetTest createSetFrom("subfolder/*"), createSetFrom("subfolder/2.properties")); assertFileListEquals( - fileset, - new File[] {}); + fileset); } @Test @@ -307,8 +306,7 @@ public class FilesetTest createSetFrom("subfolder/*"), createSetFrom("subfolder\\2.properties")); assertFileListEquals( - fileset, - new File[] {}); + fileset); } @Test @@ -319,8 +317,7 @@ public class FilesetTest createSetFrom("subfolder/*"), createSetFrom("*/2.properties")); assertFileListEquals( - fileset, - new File[] {}); + fileset); } @Test @@ -331,8 +328,7 @@ public class FilesetTest createSetFrom("subfolder/*"), createSetFrom("su??old?r/2.properties")); assertFileListEquals( - fileset, - new File[] {}); + fileset); } @Test @@ -343,8 +339,7 @@ public class FilesetTest createSetFrom("subfolder/*"), createSetFrom("su??old?r/./2.properties")); assertFileListEquals( - fileset, - new File[] {}); + fileset); } @Test Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/java/JavaOutlet.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/java/JavaOutlet.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/java/JavaOutlet.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/java/JavaOutlet.java Sun Apr 21 13:29:41 2024 @@ -1,5 +1,7 @@ package org.apache.torque.generator.java; +import java.util.Objects; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -93,34 +95,16 @@ public class JavaOutlet extends OutletIm { return true; } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) + if ((obj == null) || (getClass() != obj.getClass())) { return false; } JavaOutlet other = (JavaOutlet) obj; - if (bar == null) - { - if (other.bar != null) - { - return false; - } - } - else if (!bar.equals(other.bar)) + if (!Objects.equals(bar, other.bar)) { return false; } - if (foo == null) - { - if (other.foo != null) - { - return false; - } - } - else if (!foo.equals(other.foo)) + if (!Objects.equals(foo, other.foo)) { return false; } Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/outlet/OutletResultTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/outlet/OutletResultTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/outlet/OutletResultTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/outlet/OutletResultTest.java Sun Apr 21 13:29:41 2024 @@ -40,7 +40,7 @@ public class OutletResultTest private static final String STRING_INITIAL_CONTENT = "String!\r\ncontent"; private static final byte[] BYTE_ARRAY_INITIAL_CONTENT - = new byte[] {34, -56, 126, -127 }; + = {34, -56, 126, -127 }; /** System under test. */ private OutletResult stringOutletResult; Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/properties/PropertiesParserTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/properties/PropertiesParserTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/properties/PropertiesParserTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/properties/PropertiesParserTest.java Sun Apr 21 13:29:41 2024 @@ -35,7 +35,7 @@ import org.junit.Test; public class PropertiesParserTest { - private ControllerState controllerState = new ControllerState(); + private final ControllerState controllerState = new ControllerState(); public PropertiesParserTest() { Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/SourceToXmlTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/SourceToXmlTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/SourceToXmlTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/SourceToXmlTest.java Sun Apr 21 13:29:41 2024 @@ -39,7 +39,7 @@ import org.junit.Test; */ public class SourceToXmlTest { - private ControllerState controllerState = new ControllerState(); + private final ControllerState controllerState = new ControllerState(); public SourceToXmlTest() { Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/XmlParserTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/XmlParserTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/XmlParserTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/XmlParserTest.java Sun Apr 21 13:29:41 2024 @@ -34,7 +34,7 @@ import org.junit.Test; public class XmlParserTest { - private ControllerState controllerState = new ControllerState(); + private final ControllerState controllerState = new ControllerState(); public XmlParserTest() { Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/AttributeTransformerTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/AttributeTransformerTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/AttributeTransformerTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/AttributeTransformerTest.java Sun Apr 21 13:29:41 2024 @@ -198,7 +198,7 @@ public class AttributeTransformerTest @Test public void testParseDefinitionInsideValue() - { + { assertThrows(SourceTransformerException.class, () -> { emptyTransformer.parse( "${option:torque.attribute${option:torque.otherAttr}", @@ -229,7 +229,7 @@ public class AttributeTransformerTest @Test public void testParseOptionInTarget() { - assertThrows(SourceTransformerException.class, () -> { + assertThrows(SourceTransformerException.class, () -> { emptyTransformer.parse( "${option:torque.optionValue}", false); Modified: db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/velocity/VelocityTemplateFilterTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/velocity/VelocityTemplateFilterTest.java?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/velocity/VelocityTemplateFilterTest.java (original) +++ db/torque/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/velocity/VelocityTemplateFilterTest.java Sun Apr 21 13:29:41 2024 @@ -147,7 +147,7 @@ public class VelocityTemplateFilterTest reader = new InputStreamReader(stream, encoding); } - StringBuffer contentBuffer = new StringBuffer(); + StringBuilder contentBuffer = new StringBuilder(); while (true) { char[] charBuffer = new char[8192]; Modified: db/torque/trunk/torque-generator/src/test/resources/log4j2-test.xml URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-generator/src/test/resources/log4j2-test.xml?rev=1917241&r1=1917240&r2=1917241&view=diff ============================================================================== --- db/torque/trunk/torque-generator/src/test/resources/log4j2-test.xml (original) +++ db/torque/trunk/torque-generator/src/test/resources/log4j2-test.xml Sun Apr 21 13:29:41 2024 @@ -17,7 +17,7 @@ specific language governing permissions and limitations under the License. --> -<Configuration status="warn" name="Torque" packages=""> +<Configuration status="warn" name="Torque"> <Appenders> <Console name="console" target="SYSTEM_OUT"> <PatternLayout pattern="%d [%t] %-5p | %c - %m%n"/> --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org