diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java index 1760603e5..d3fb87ae5 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java @@ -515,6 +515,8 @@ public class CheckStyleTask private FormatterType mFormatterType; /** the file to output to */ private File mToFile; + /** Whether or not the write to the named file. */ + private boolean mUseFile = true; /** * Set the type of the formatter. @@ -539,6 +541,15 @@ public class CheckStyleTask mToFile = aTo; } + /** + * Sets whether or not we write to a file if it is provided. + * @param aUse whether not not to use provided file. + */ + public void setUseFile(boolean aUse) + { + mUseFile = aUse; + } + /** * Creates a listener for the formatter. * @param aTask the task running @@ -564,7 +575,7 @@ public class CheckStyleTask private AuditListener createDefaultLogger(Task aTask) throws IOException { - if (mToFile == null) { + if (mToFile == null || !mUseFile) { return new DefaultLogger( new LogOutputStream(aTask, Project.MSG_DEBUG), true, new LogOutputStream(aTask, Project.MSG_ERR), true); @@ -580,7 +591,7 @@ public class CheckStyleTask private AuditListener createXMLLogger(Task aTask) throws IOException { - if (mToFile == null) { + if (mToFile == null || !mUseFile) { return new XMLLogger( new LogOutputStream(aTask, Project.MSG_INFO), true); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java index bafa3942f..82cdc5004 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java @@ -80,9 +80,9 @@ public class SuppressionsLoaderTest extends TestCase "src/testinputs/com/puppycrawl/tools/checkstyle/suppressions_bad_int.xml"); } catch (CheckstyleException ex) { - assertEquals( - "number format exception src/testinputs/com/puppycrawl/tools/checkstyle/suppressions_bad_int.xml - For input string: \"a\"", - ex.getMessage()); + assertTrue( + ex.getMessage(), + ex.getMessage().startsWith("number format exception src/testinputs/com/puppycrawl/tools/checkstyle/suppressions_bad_int.xml - ")); } } } diff --git a/src/xdocs/anttask.xml b/src/xdocs/anttask.xml index 47dc9f3ce..7d140b65f 100755 --- a/src/xdocs/anttask.xml +++ b/src/xdocs/anttask.xml @@ -247,6 +247,12 @@
diff --git a/src/xdocs/releasenotes.xml b/src/xdocs/releasenotes.xml index a56804474..8b10bff0b 100755 --- a/src/xdocs/releasenotes.xml +++ b/src/xdocs/releasenotes.xml @@ -11,6 +11,12 @@
New features:
+ +Fixed Bugs:
Other improvements: