From 5a0b8d7b359419c07fbcb03dd724adc7cb474301 Mon Sep 17 00:00:00 2001 From: Jan Materne Date: Wed, 24 Oct 2007 12:20:01 +0000 Subject: [PATCH] checkstyle git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@587872 13f79535-47bb-0310-9956-ffa450edef68 --- .../optional/junit/FailureRecorder.java | 37 ++++++++++++------- .../optional/junit/FormatterElement.java | 19 +++++----- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java index 2cf17131a..a1ea38521 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java @@ -64,7 +64,7 @@ import org.apache.tools.ant.util.FileUtils; * the failing test cases in a static list. Because we dont have a finalizer * method in the formatters "lifecycle", we register this formatter as * BuildListener and generate the new java source on taskFinished event. - * + * * @since Ant 1.8.0 */ public class FailureRecorder extends DataType implements JUnitResultFormatter, BuildListener { @@ -91,7 +91,7 @@ public class FailureRecorder extends DataType implements JUnitResultFormatter, B /** A writer for writing the generated source to. */ private PrintWriter writer; - + /** * Location and name of the generated JUnit class. * Lazy instantiated via getLocationName(). @@ -121,7 +121,8 @@ public class FailureRecorder extends DataType implements JUnitResultFormatter, B } else { locationName = DEFAULT_CLASS_LOCATION; verbose("System property '" + MAGIC_PROPERTY_CLASS_LOCATION + "' not set, so use " - + "value as location for collector class: '" + DEFAULT_CLASS_LOCATION + "'"); + + "value as location for collector class: '" + + DEFAULT_CLASS_LOCATION + "'"); } File locationFile = new File(locationName); @@ -132,14 +133,14 @@ public class FailureRecorder extends DataType implements JUnitResultFormatter, B + " use absolute path instead (" + locationName + ")"); } } - + return locationName; } /** * This method is called by the Ant runtime by reflection. We use the project reference for * registration of this class as BuildListener. - * + * * @param project * project reference */ @@ -149,7 +150,7 @@ public class FailureRecorder extends DataType implements JUnitResultFormatter, B // check if already registered boolean alreadyRegistered = false; Vector allListeners = project.getBuildListeners(); - for(int i=0; i task. So all tests passed - * and we could create the new java class. + * The task outside of this JUnitResultFormatter is the task. So all tests passed + * and we could create the new java class. + * @param event not used * @see org.apache.tools.ant.BuildListener#taskFinished(org.apache.tools.ant.BuildEvent) */ public void taskFinished(BuildEvent event) { @@ -406,5 +415,5 @@ public class FailureRecorder extends DataType implements JUnitResultFormatter, B */ public void taskStarted(BuildEvent event) { } - + } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java index 14bc6a646..69bf3ab17 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java @@ -98,7 +98,6 @@ public class FormatterElement { * @param type the enumerated value to use. */ public void setType(TypeAttribute type) { - //TODO: Besseren Zugriffsalgorithums: TypeAttribut.getClassname() if ("xml".equals(type.getValue())) { setClassname(XML_FORMATTER_CLASS_NAME); } else { @@ -240,8 +239,8 @@ public class FormatterElement { public void setProject(Project project) { this.project = project; } - - + + /** * @since Ant 1.6 */ @@ -270,7 +269,7 @@ public class FormatterElement { "Using loader " + loader + " on class " + classname + ": " + e, e); } - + Object o = null; try { o = f.newInstance(); @@ -279,7 +278,7 @@ public class FormatterElement { } catch (IllegalAccessException e) { throw new BuildException(e); } - + if (!(o instanceof JUnitTaskMirror.JUnitResultFormatterMirror)) { throw new BuildException(classname + " is not a JUnitResultFormatter"); } @@ -293,7 +292,7 @@ public class FormatterElement { } } r.setOutput(out); - + boolean needToSetProjectReference = true; try { @@ -306,17 +305,17 @@ public class FormatterElement { } catch (Exception e) { // no field present, so no previous reference exists } - + if (needToSetProjectReference) { Method setter; try { - setter = r.getClass().getMethod("setProject", new Class[] { Project.class }); - setter.invoke(r, new Object[] { project }); + setter = r.getClass().getMethod("setProject", new Class[] {Project.class}); + setter.invoke(r, new Object[] {project} ); } catch (Exception e) { // no setProject to invoke; just ignore } } - + return r; }