General cleanup.
This commit is contained in:
parent
889f470ea6
commit
80c8e1c7a8
|
|
@ -547,9 +547,7 @@ public class CheckStyleTask
|
|||
{
|
||||
return createXMLLogger(aTask);
|
||||
}
|
||||
else {
|
||||
return createDefaultLogger(aTask);
|
||||
}
|
||||
return createDefaultLogger(aTask);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -580,9 +578,7 @@ public class CheckStyleTask
|
|||
return new XMLLogger(
|
||||
new LogOutputStream(aTask, Project.MSG_INFO), true);
|
||||
}
|
||||
else {
|
||||
return new XMLLogger(new FileOutputStream(mToFile), true);
|
||||
}
|
||||
return new XMLLogger(new FileOutputStream(mToFile), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -376,9 +376,7 @@ public class Checker extends AutomaticBean
|
|||
throw new IllegalArgumentException("Cannot resolve path "
|
||||
+ orig);
|
||||
}
|
||||
else {
|
||||
s.pop();
|
||||
}
|
||||
s.pop();
|
||||
}
|
||||
else { // plain component
|
||||
s.push(thisToken);
|
||||
|
|
|
|||
|
|
@ -124,17 +124,17 @@ final class StringArrayReader extends Reader
|
|||
ensureOpen();
|
||||
return mUnderlyingArray[mArrayIdx].charAt(mStringIdx++);
|
||||
}
|
||||
else {
|
||||
// don't bother duplicating the new line handling above
|
||||
// for the uncommon case
|
||||
return super.read();
|
||||
}
|
||||
}
|
||||
// don't bother duplicating the new line handling above
|
||||
// for the uncommon case
|
||||
return super.read();
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an IOException if the reader has already been closed.
|
||||
* @throws IOException if the stream has been closed
|
||||
*/
|
||||
* Throws an IOException if the reader has already been closed.
|
||||
*
|
||||
* @throws IOException
|
||||
* if the stream has been closed
|
||||
*/
|
||||
private void ensureOpen() throws IOException
|
||||
{
|
||||
if (mClosed) {
|
||||
|
|
|
|||
|
|
@ -345,9 +345,7 @@ final class StrArrayConverter extends AbstractArrayConverter
|
|||
if (useDefault) {
|
||||
return (defaultValue);
|
||||
}
|
||||
else {
|
||||
throw new ConversionException("No value specified");
|
||||
}
|
||||
throw new ConversionException("No value specified");
|
||||
}
|
||||
|
||||
// Deal with the no-conversion-needed case
|
||||
|
|
@ -370,29 +368,30 @@ final class StrArrayConverter extends AbstractArrayConverter
|
|||
if (useDefault) {
|
||||
return (defaultValue);
|
||||
}
|
||||
else {
|
||||
throw new ConversionException(aValue.toString(), e);
|
||||
}
|
||||
throw new ConversionException(aValue.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Parse an incoming String of the form similar to an array initializer
|
||||
* in the Java language into a <code>List</code> individual Strings
|
||||
* for each element, according to the following rules.</p>
|
||||
* <ul>
|
||||
* <li>The string must have matching '{' and '}' delimiters around
|
||||
* a comma-delimited list of values.</li>
|
||||
* <li>Whitespace before and after each element is stripped.
|
||||
* <li>If an element is itself delimited by matching single or double
|
||||
* quotes, the usual rules for interpreting a quoted String apply.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param aValue String value to be parsed
|
||||
* @return the list of Strings parsed from the array
|
||||
* @throws NullPointerException if <code>svalue</code>
|
||||
* is <code>null</code>
|
||||
*/
|
||||
* <p>
|
||||
* Parse an incoming String of the form similar to an array initializer in
|
||||
* the Java language into a <code>List</code> individual Strings for each
|
||||
* element, according to the following rules.
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>The string must have matching '{' and '}' delimiters around a
|
||||
* comma-delimited list of values.</li>
|
||||
* <li>Whitespace before and after each element is stripped.
|
||||
* <li>If an element is itself delimited by matching single or double
|
||||
* quotes, the usual rules for interpreting a quoted String apply.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param aValue
|
||||
* String value to be parsed
|
||||
* @return the list of Strings parsed from the array
|
||||
* @throws NullPointerException
|
||||
* if <code>svalue</code> is <code>null</code>
|
||||
*/
|
||||
protected List parseElements(String aValue)
|
||||
throws NullPointerException
|
||||
{
|
||||
|
|
|
|||
|
|
@ -167,20 +167,14 @@ public class GenericIllegalRegexpCheck extends AbstractFormatCheck
|
|||
// check if the expression is on the rest of the line
|
||||
return findNonCommentMatch(aLine, aLineNumber, endCol);
|
||||
}
|
||||
else {
|
||||
// end of line reached
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// not intersecting with comment
|
||||
return true;
|
||||
// end of line reached
|
||||
return false;
|
||||
}
|
||||
// not intersecting with comment
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// no match is found
|
||||
return false;
|
||||
}
|
||||
// no match is found
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @return the regexp to match against */
|
||||
|
|
|
|||
|
|
@ -137,11 +137,8 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck
|
|||
if (aLine.startsWith("import ")) {
|
||||
return IGNORE;
|
||||
}
|
||||
else {
|
||||
return super.calcChecksum(aLine);
|
||||
}
|
||||
return super.calcChecksum(aLine);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** a jakarta commons log */
|
||||
|
|
@ -261,10 +258,8 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck
|
|||
if (aFile.getName().endsWith(".java")) {
|
||||
return new JavaChecksumGenerator();
|
||||
}
|
||||
else {
|
||||
// TODO: Not sure what to do with binary files such as gifs
|
||||
return new TextfileChecksumGenerator();
|
||||
}
|
||||
// TODO: Not sure what to do with binary files such as gifs
|
||||
return new TextfileChecksumGenerator();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ public class ForHandler extends BlockParentHandler
|
|||
if (aChild instanceof ElseHandler) {
|
||||
return getLevel();
|
||||
}
|
||||
else {
|
||||
return super.suggestedChildLevel(aChild);
|
||||
}
|
||||
return super.suggestedChildLevel(aChild);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ public class IfHandler extends BlockParentHandler
|
|||
if (aChild instanceof ElseHandler) {
|
||||
return getLevel();
|
||||
}
|
||||
else {
|
||||
return super.suggestedChildLevel(aChild);
|
||||
}
|
||||
return super.suggestedChildLevel(aChild);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -71,9 +69,7 @@ public class IfHandler extends BlockParentHandler
|
|||
if (isIfAfterElse()) {
|
||||
return getParent().getLevel();
|
||||
}
|
||||
else {
|
||||
return super.getLevelImpl();
|
||||
}
|
||||
return super.getLevelImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -100,10 +100,7 @@ public class MethodCallHandler extends ExpressionHandler
|
|||
if (areOnSameLine(container.getMainAst(), getMainAst())) {
|
||||
return container.getLevel();
|
||||
}
|
||||
else {
|
||||
return new IndentLevel(container.getLevel(),
|
||||
getBasicOffset());
|
||||
}
|
||||
return new IndentLevel(container.getLevel(), getBasicOffset());
|
||||
}
|
||||
|
||||
// if we get here, we are the child of the left hand side (name
|
||||
|
|
@ -126,16 +123,15 @@ public class MethodCallHandler extends ExpressionHandler
|
|||
if (lineStart != firstCol) {
|
||||
return new IndentLevel(lineStart);
|
||||
}
|
||||
else {
|
||||
return super.getLevelImpl();
|
||||
}
|
||||
return super.getLevelImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first AST of the specified method call.
|
||||
*
|
||||
* @param aAst the method call
|
||||
*
|
||||
*
|
||||
* @param aAst
|
||||
* the method call
|
||||
*
|
||||
* @return the first AST of the specified method call
|
||||
*/
|
||||
private DetailAST getFirstAst(DetailAST aAst)
|
||||
|
|
|
|||
|
|
@ -70,14 +70,12 @@ public class SlistHandler extends BlockParentHandler
|
|||
{
|
||||
return getParent().suggestedChildLevel(aChild);
|
||||
}
|
||||
else {
|
||||
return super.suggestedChildLevel(aChild);
|
||||
}
|
||||
return super.suggestedChildLevel(aChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the child element that is not a list of statements.
|
||||
*
|
||||
*
|
||||
* @return the non-list child element
|
||||
*/
|
||||
protected DetailAST getNonlistChild()
|
||||
|
|
|
|||
|
|
@ -57,8 +57,6 @@ public class TryHandler extends BlockParentHandler
|
|||
{
|
||||
return getLevel();
|
||||
}
|
||||
else {
|
||||
return super.suggestedChildLevel(aChild);
|
||||
}
|
||||
return super.suggestedChildLevel(aChild);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,9 +146,8 @@ public abstract class AbstractUsageCheck
|
|||
if (definition != null) {
|
||||
return definition.getNumReferences();
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -134,9 +134,7 @@ public class OneMethodPrivateFieldCheck
|
|||
if (definition != null) {
|
||||
return definition.getReferences();
|
||||
}
|
||||
else {
|
||||
final Set dummy = new HashSet();
|
||||
return dummy.iterator();
|
||||
}
|
||||
final Set dummy = new HashSet();
|
||||
return dummy.iterator();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,9 +165,7 @@ public class UnknownClass implements IClass {
|
|||
final UnknownClass other = (UnknownClass) o;
|
||||
return other.getName().equals(getName());
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
|
|
|||
|
|
@ -106,9 +106,7 @@ public class TokenTypesDoclet
|
|||
aReporter.printError("Only one -destfile option allowed.");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
foundDestFileOption = true;
|
||||
}
|
||||
foundDestFileOption = true;
|
||||
}
|
||||
}
|
||||
if (!foundDestFileOption) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ public class PackageNamesLoaderTest extends TestCase
|
|||
}
|
||||
|
||||
public void testNoFile()
|
||||
throws CheckstyleException
|
||||
{
|
||||
try {
|
||||
PackageNamesLoader.loadModuleFactory("NoFile");
|
||||
|
|
|
|||
Loading…
Reference in New Issue