forked from phoedos/pmd
StringBuffer -> StringBuilder switchovers, refactoring
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7345 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -3,7 +3,15 @@
|
||||
*/
|
||||
package net.sourceforge.pmd.cpd;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import net.sourceforge.pmd.util.IOUtil;
|
||||
|
||||
/**
|
||||
* @author Philippe T'Seyen
|
||||
@ -38,9 +46,7 @@ public class FileReporter {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(outputStream, encoding));
|
||||
writer.write(content);
|
||||
} finally {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
IOUtil.closeQuietly(writer);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
throw new ReportException(ioe);
|
||||
|
@ -64,6 +64,7 @@ import javax.swing.table.TableColumnModel;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import net.sourceforge.pmd.PMD;
|
||||
import net.sourceforge.pmd.util.IOUtil;
|
||||
|
||||
public class GUI implements CPDListener {
|
||||
|
||||
@ -205,9 +206,7 @@ public class GUI implements CPDListener {
|
||||
} catch (IOException e) {
|
||||
error("Couldn't save file" + f.getAbsolutePath(), e);
|
||||
} finally {
|
||||
if (pw != null) {
|
||||
pw.close();
|
||||
}
|
||||
IOUtil.closeQuietly(pw);
|
||||
}
|
||||
} else {
|
||||
error("Could not write to file " + f.getAbsolutePath(), null);
|
||||
@ -441,7 +440,7 @@ public class GUI implements CPDListener {
|
||||
int[] selectionIndices = resultsTable.getSelectedRows();
|
||||
int colCount = resultsTable.getColumnCount();
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int r=0; r<selectionIndices.length; r++) {
|
||||
if (r > 0) {
|
||||
|
@ -41,7 +41,7 @@ public class TokenMgrError extends RuntimeException
|
||||
* equivalents in the given string
|
||||
*/
|
||||
protected static final String addEscapes(String str) {
|
||||
StringBuffer retval = new StringBuffer();
|
||||
StringBuilder retval = new StringBuilder();
|
||||
char ch;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
switch (str.charAt(i))
|
||||
|
Reference in New Issue
Block a user