Merge branch 'pr-1045', fixes #1036

This commit is contained in:
Andreas Dangel
2018-04-23 20:29:40 +02:00
7 changed files with 13 additions and 15 deletions

View File

@ -98,6 +98,7 @@ Other languages are equivalent.
* all
* [#695](https://github.com/pmd/pmd/issues/695): \[core] Extend comment-based suppression to all JavaCC languages
* [#988](https://github.com/pmd/pmd/issues/988): \[core] FileNotFoundException for missing classes directory with analysis cache enabled
* [#1036](https://github.com/pmd/pmd/issues/1036): \[core] Non-XML output breaks XML-based CLI integrations
* documentation
* [#994](https://github.com/pmd/pmd/issues/994): \[doc] Delete duplicate page contributing.md on the website
* java

View File

@ -15,7 +15,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Handler;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -45,7 +45,6 @@ import net.sourceforge.pmd.util.database.DBURI;
import net.sourceforge.pmd.util.database.SourceObject;
import net.sourceforge.pmd.util.datasource.DataSource;
import net.sourceforge.pmd.util.datasource.ReaderDataSource;
import net.sourceforge.pmd.util.log.ConsoleLogHandler;
import net.sourceforge.pmd.util.log.ScopedLogHandlersManager;
/**
@ -450,8 +449,7 @@ public class PMD {
final PMDConfiguration configuration = params.toConfiguration();
final Level logLevel = params.isDebug() ? Level.FINER : Level.INFO;
final Handler logHandler = new ConsoleLogHandler();
final ScopedLogHandlersManager logHandlerManager = new ScopedLogHandlersManager(logLevel, logHandler);
final ScopedLogHandlersManager logHandlerManager = new ScopedLogHandlersManager(logLevel, new ConsoleHandler());
final Level oldLogLevel = LOG.getLevel();
// Need to do this, since the static logger has already been initialized
// at this point

View File

@ -351,7 +351,7 @@ public class CPDConfiguration extends AbstractConfiguration {
}
}
FilenameFilter filter = new FilenameFilter() {
return new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
File f = new File(dir, name);
@ -362,7 +362,6 @@ public class CPDConfiguration extends AbstractConfiguration {
return languageFilter.accept(dir, name);
}
};
return filter;
}
/**

View File

@ -720,7 +720,7 @@ public class GUI implements CPDListener {
final long start = System.currentTimeMillis();
Timer t = new Timer(1000, new ActionListener() {
return new Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
long now = System.currentTimeMillis();
@ -731,7 +731,6 @@ public class GUI implements CPDListener {
timeField.setText(formatTime(minutes, seconds));
}
});
return t;
}
private static String formatTime(long minutes, long seconds) {
@ -762,7 +761,7 @@ public class GUI implements CPDListener {
private TableModel tableModelFrom(final List<Match> items) {
TableModel model = new SortingTableModel<Match>() {
return new SortingTableModel<Match>() {
private int sortColumn;
private boolean sortDescending;
@ -837,8 +836,6 @@ public class GUI implements CPDListener {
}
}
};
return model;
}
private void sortOnColumn(int columnIndex) {

View File

@ -312,7 +312,7 @@ public class Designer implements ClipboardOwner {
@Override
public Enumeration<TreeNode> children() {
Enumeration<TreeNode> e = new Enumeration<TreeNode>() {
return new Enumeration<TreeNode>() {
int i = 0;
@Override
@ -325,7 +325,6 @@ public class Designer implements ClipboardOwner {
return kids[i++];
}
};
return e;
}
@Override
@ -395,7 +394,7 @@ public class Designer implements ClipboardOwner {
getChildAt(0); // force it to build kids
}
Enumeration<TreeNode> e = new Enumeration<TreeNode>() {
return new Enumeration<TreeNode>() {
int i = 0;
@Override
@ -408,7 +407,6 @@ public class Designer implements ClipboardOwner {
return kids[i++];
}
};
return e;
}
@Override

View File

@ -14,7 +14,9 @@ import java.util.logging.LogRecord;
* Log to the console using a basic formatter.
*
* @author Wouter Zelle
* @deprecated This class will be complety removed in 7.0.0
*/
@Deprecated
public class ConsoleLogHandler extends Handler {
private static final Formatter FORMATTER = new PmdLogFormatter();

View File

@ -36,7 +36,9 @@ public class ScopedLogHandlersManager {
}
for (Handler handler : newHandlers) {
logger.addHandler(handler);
handler.setLevel(level);
}
logger.setUseParentHandlers(false);
}
public void close() {
@ -47,5 +49,6 @@ public class ScopedLogHandlersManager {
logger.addHandler(handler);
}
logger.setLevel(oldLogLevel);
logger.setUseParentHandlers(true);
}
}