From 34923f6b487c2c47c0c0d6366c524e72659fea26 Mon Sep 17 00:00:00 2001 From: rnveach Date: Tue, 23 Apr 2019 06:57:19 -0400 Subject: [PATCH] replace deprecated method calls with newer checkstyle version --- .../plugins/checkstyle/AbstractCheckstyleReport.java | 9 +++++---- .../checkstyle/CheckstyleViolationCheckMojo.java | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java index f89d0596..04ccba11 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java @@ -60,6 +60,7 @@ import com.puppycrawl.tools.checkstyle.DefaultLogger; import com.puppycrawl.tools.checkstyle.XMLLogger; import com.puppycrawl.tools.checkstyle.api.AuditListener; +import com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; /** @@ -628,11 +629,11 @@ protected AuditListener getListener() if ( "xml".equals( outputFileFormat ) ) { - listener = new XMLLogger( out, true ); + listener = new XMLLogger( out, OutputStreamOptions.CLOSE ); } else if ( "plain".equals( outputFileFormat ) ) { - listener = new DefaultLogger( out, true ); + listener = new DefaultLogger( out, OutputStreamOptions.CLOSE ); } else { @@ -681,13 +682,13 @@ protected DefaultLogger getConsoleListener() if ( useFile == null ) { stringOutputStream = new ByteArrayOutputStream(); - consoleListener = new DefaultLogger( stringOutputStream, false ); + consoleListener = new DefaultLogger( stringOutputStream, OutputStreamOptions.NONE ); } else { OutputStream out = getOutputStream( useFile ); - consoleListener = new DefaultLogger( out, true ); + consoleListener = new DefaultLogger( out, OutputStreamOptions.CLOSE ); } return consoleListener; diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java index 8c500014..b9b8e0e3 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java @@ -62,6 +62,7 @@ import com.puppycrawl.tools.checkstyle.DefaultLogger; import com.puppycrawl.tools.checkstyle.XMLLogger; import com.puppycrawl.tools.checkstyle.api.AuditListener; +import com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; /** @@ -731,13 +732,13 @@ private DefaultLogger getConsoleListener() if ( useFile == null ) { stringOutputStream = new ByteArrayOutputStream(); - consoleListener = new DefaultLogger( stringOutputStream, false ); + consoleListener = new DefaultLogger( stringOutputStream, OutputStreamOptions.NONE ); } else { OutputStream out = getOutputStream( useFile ); - consoleListener = new DefaultLogger( out, true ); + consoleListener = new DefaultLogger( out, OutputStreamOptions.CLOSE ); } return consoleListener; @@ -778,7 +779,7 @@ private AuditListener getListener() if ( "xml".equals( outputFileFormat ) ) { - listener = new XMLLogger( out, true ); + listener = new XMLLogger( out, OutputStreamOptions.CLOSE ); } else if ( "plain".equals( outputFileFormat ) ) { @@ -790,8 +791,8 @@ else if ( "plain".equals( outputFileFormat ) ) outputXmlFile.deleteOnExit(); OutputStream xmlOut = getOutputStream( outputXmlFile ); CompositeAuditListener compoundListener = new CompositeAuditListener(); - compoundListener.addListener( new XMLLogger( xmlOut, true ) ); - compoundListener.addListener( new DefaultLogger( out, true ) ); + compoundListener.addListener( new XMLLogger( xmlOut, OutputStreamOptions.CLOSE ) ); + compoundListener.addListener( new DefaultLogger( out, OutputStreamOptions.CLOSE ) ); listener = compoundListener; } catch ( IOException e )