From 12472dcf076998ecd77b6aec305b9c84af13e57e Mon Sep 17 00:00:00 2001 From: donald.g.dunne Date: Fri, 20 Dec 2013 09:22:25 -0700 Subject: refactor: Remove warnings and technical debt Change-Id: I08b39067dd08ef51ca4881eef3b188fb4cabcbf1 --- .../osee/framework/jdk/core/text/tool/Find.java | 49 ++++++++++++---------- .../osee/framework/jdk/core/type/BaseIdentity.java | 1 + .../osee/framework/jdk/core/type/VariantData.java | 1 - .../eclipse/osee/framework/jdk/core/util/AXml.java | 4 -- .../osee/framework/jdk/core/util/ByteUtil.java | 4 -- .../eclipse/osee/framework/jdk/core/util/Lib.java | 1 + .../core/util/SingletonApplicationInstance.java | 3 -- .../osee/framework/jdk/core/util/io/Zip.java | 1 + .../jdk/core/util/io/xml/WordMlTableWriter.java | 15 ++++--- .../jdk/core/util/io/xml/WordSaxHandler.java | 4 -- .../framework/jdk/core/util/network/PortUtil.java | 2 +- .../osee/framework/jdk/core/util/xml/Xml.java | 1 - .../jdk/core/util/xml/XmlTransformAsProcess.java | 3 +- .../framework/jdk/core/util/xml/excel/Cell.java | 1 + .../framework/jdk/core/util/xml/excel/Row.java | 1 + .../framework/jdk/core/util/xml/excel/Style.java | 1 + .../framework/jdk/core/util/xml/excel/Table.java | 1 + .../jdk/core/util/xml/excel/WorkBook.java | 1 + .../jdk/core/util/xml/excel/WorkSheet.java | 1 + 19 files changed, 45 insertions(+), 50 deletions(-) (limited to 'plugins/org.eclipse.osee.framework.jdk.core') diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/text/tool/Find.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/text/tool/Find.java index 11464473072..61002cad26f 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/text/tool/Find.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/text/tool/Find.java @@ -90,33 +90,36 @@ public class Find { File resultFile = new File("results.txt"); BufferedWriter out = new BufferedWriter(new FileWriter(resultFile)); - List files = Lib.recursivelyListFiles(new File(args[1]), Pattern.compile(args[2])); - System.out.println("Searching " + files.size() + " files..."); - if (files.isEmpty()) { - return; - } + try { + List files = Lib.recursivelyListFiles(new File(args[1]), Pattern.compile(args[2])); + System.out.println("Searching " + files.size() + " files..."); + if (files.isEmpty()) { + return; + } - FileToBufferConvert toBuffer = null; - if (Boolean.valueOf(args[6]).booleanValue()) { - toBuffer = new StripBlockComments(); - } else { - toBuffer = simpleToBuffer; - } + FileToBufferConvert toBuffer = null; + if (Boolean.valueOf(args[6]).booleanValue()) { + toBuffer = new StripBlockComments(); + } else { + toBuffer = simpleToBuffer; + } - Find app = new Find(patterns, files, toBuffer); - app.setRegionPadding(Integer.parseInt(args[3]), Integer.parseInt(args[4])); + Find app = new Find(patterns, files, toBuffer); + app.setRegionPadding(Integer.parseInt(args[3]), Integer.parseInt(args[4])); - if (Boolean.valueOf(args[5]).booleanValue()) { - app.findMeNot(); - } else { - app.find(999999, true); - } - OutputStreamWriter stdOut = new OutputStreamWriter(System.out); - stdOut.write(resultFile.getAbsolutePath()); + if (Boolean.valueOf(args[5]).booleanValue()) { + app.findMeNot(); + } else { + app.find(999999, true); + } + OutputStreamWriter stdOut = new OutputStreamWriter(System.out); + stdOut.write(resultFile.getAbsolutePath()); - app.writeUnusedPatterns(stdOut); - app.getResults().writeFindResutls(out); - out.close(); + app.writeUnusedPatterns(stdOut); + app.getResults().writeFindResutls(out); + } finally { + out.close(); + } } public void setRegionPadding(int precedingCount, int trailingCount) { diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/BaseIdentity.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/BaseIdentity.java index 638a0d459ef..9845ef16ccd 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/BaseIdentity.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/BaseIdentity.java @@ -31,6 +31,7 @@ public class BaseIdentity implements Identity { return getGuid().hashCode(); } + @SuppressWarnings("unchecked") @Override public boolean equals(Object obj) { boolean equal = false; diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/VariantData.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/VariantData.java index b968a6d3938..88a278ad423 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/VariantData.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/VariantData.java @@ -24,7 +24,6 @@ import org.eclipse.osee.framework.jdk.core.util.Lib; * @author Roberto E. Escobar */ public class VariantData implements IVariantData { - private static final long serialVersionUID = 9076969425223251739L; private static final String EXCEPTION_MESSAGE = "No setting found for key: [%s]"; private static final String CONVERSION_EXCEPTION_MESSAGE = "Unable to convert [%s] from [%s] to [%s]"; diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/AXml.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/AXml.java index fcad6b153ec..808c963dc9f 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/AXml.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/AXml.java @@ -40,10 +40,6 @@ public class AXml { return addTagData(elementName, data, false); } - public static String addTagData(String elementName, Integer[] data, String separator) { - return addTagData(elementName, Collections.toString(separator, data), false); - } - public static String addTagData(String elementName, Collection data, String separator) { return addTagData(elementName, Collections.toString(separator, data), false); } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/ByteUtil.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/ByteUtil.java index 16536c84f1e..8053a725f53 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/ByteUtil.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/ByteUtil.java @@ -48,23 +48,19 @@ public class ByteUtil { } public static void printHex(byte[] data, int bytesPerGroup, int groupPerLine, StringBuilder strBuilder) { - int groups = 0; for (int i = 0; i < data.length; i++) { strBuilder.append(ByteUtil.toHexString(data[i])); if ((i + 1) % bytesPerGroup == 0) { strBuilder.append(" "); - groups++; } } } public static void printHex(byte[] data, int bytesPerGroup, int groupPerLine, boolean isSpaced, StringBuilder strBuilder) { - int groups = 0; for (int i = 0; i < data.length; i++) { strBuilder.append(ByteUtil.toHexString(data[i])); if ((i + 1) % bytesPerGroup == 0 && isSpaced) { strBuilder.append(" "); - groups++; } } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java index 48179d1fbe2..eb13c4034a5 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java @@ -213,6 +213,7 @@ public final class Lib { return stringWriter.toString(); } + @SuppressWarnings("resource") public static void copyFile(File source, File destination) throws IOException { final FileChannel in = new FileInputStream(source).getChannel(); try { diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/SingletonApplicationInstance.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/SingletonApplicationInstance.java index d41b7d4617f..096d82800bf 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/SingletonApplicationInstance.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/SingletonApplicationInstance.java @@ -17,8 +17,6 @@ import java.nio.channels.DatagramChannel; public class SingletonApplicationInstance { - private static DatagramChannel lockChannel; - public static void verifySingleton(int port) throws Exception { if (findOther(port)) { System.out.println("found another instance"); @@ -34,7 +32,6 @@ public class SingletonApplicationInstance { channel.configureBlocking(true); InetSocketAddress address = new InetSocketAddress(host, port); channel.socket().bind(address); - lockChannel = channel; return false; } catch (BindException e) { return true; diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/Zip.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/Zip.java index b2155bca0e3..067defd8500 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/Zip.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/Zip.java @@ -56,6 +56,7 @@ public class Zip { // Complete the ZIP file out.close(); } catch (IOException e) { + // do nothing } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/WordMlTableWriter.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/WordMlTableWriter.java index db284176f8f..23119667fdb 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/WordMlTableWriter.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/WordMlTableWriter.java @@ -72,17 +72,16 @@ public class WordMlTableWriter extends AbstractSheetWriter { @Override public void writeCellText(Object cellData, int cellIndex) throws IOException { - if(cellData instanceof String){ - String cellDataStr = (String)cellData; - str.append(CELL_STRART); - if (cellDataStr != null) { - str.append(cellDataStr); - } - str.append(CELL_END); - } + if (cellData instanceof String) { + String cellDataStr = (String) cellData; + str.append(CELL_STRART); + str.append(cellDataStr); + str.append(CELL_END); + } } @Override public void endWorkbook() { + // do nothing } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/WordSaxHandler.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/WordSaxHandler.java index 039521360fd..48b28865c88 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/WordSaxHandler.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/WordSaxHandler.java @@ -40,10 +40,6 @@ public class WordSaxHandler extends AbstractSaxHandler { inHeader = true; } else if (localName.equalsIgnoreCase("ftr")) { inFooter = true; - } else if (localName.equalsIgnoreCase("Table")) { - - } else if (localName.equalsIgnoreCase("Worksheet")) { - } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/network/PortUtil.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/network/PortUtil.java index a5b6c327cef..cd83ac7b3a0 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/network/PortUtil.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/network/PortUtil.java @@ -92,7 +92,7 @@ public class PortUtil { if (nextPort >= basePort + 250 - numberOfPorts) { nextPort = basePort; } - for (int i = nextPort, count = 1; i < basePort + 250; i++, count++) { + for (int i = nextPort; i < basePort + 250; i++) { boolean passed = true; for (int j = i; j < numberOfPorts + i; j++) { if (!checkIfPortIsTaken(j)) { diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/Xml.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/Xml.java index 307a847757f..17b98506cbb 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/Xml.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/Xml.java @@ -37,7 +37,6 @@ public class Xml { private static final String[] XML_ESCAPES = new String[] {"&", "<", ">", """}; private static final String LINEFEED = " "; private static final String CARRIAGE_RETURN = " "; - private static final Pattern squareBracket = Pattern.compile("\\]"); public final static XPathFactory myXPathFactory = XPathFactory.newInstance(); public final static XPath myXPath = myXPathFactory.newXPath(); public final static String wordLeader1 = diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/XmlTransformAsProcess.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/XmlTransformAsProcess.java index 6feb54a4bb6..89a96fde846 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/XmlTransformAsProcess.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/XmlTransformAsProcess.java @@ -46,7 +46,7 @@ public class XmlTransformAsProcess { outputFromNetwork = null; } - private URL getClassLocation(final Class classToFind) { + private URL getClassLocation(final Class classToFind) { URL result = null; if (classToFind == null) { throw new IllegalArgumentException("Class is null"); @@ -68,6 +68,7 @@ public class XmlTransformAsProcess { result = new URL(result, classAsResource); } } catch (MalformedURLException ignore) { + // do nothing } } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Cell.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Cell.java index d2f372e0994..85f5c88da72 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Cell.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Cell.java @@ -25,5 +25,6 @@ public class Cell implements Xmlizable { } public void initializeFromXml(Document doc) { + // do nothing } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Row.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Row.java index 00e1b2e37c4..79ed6b22042 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Row.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Row.java @@ -25,5 +25,6 @@ public class Row implements Xmlizable { } public void initializeFromXml(Document doc) { + // do nothing } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Style.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Style.java index e158a78d3b0..c729b75f8a3 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Style.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Style.java @@ -25,5 +25,6 @@ public class Style implements Xmlizable { } public void initializeFromXml(Document doc) { + // do nothing } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Table.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Table.java index 1a731668de3..05ffbb7915d 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Table.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/Table.java @@ -25,5 +25,6 @@ public class Table implements Xmlizable { } public void initializeFromXml(Document doc) { + // do nothing } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/WorkBook.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/WorkBook.java index 61b37765624..db6204d7b28 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/WorkBook.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/WorkBook.java @@ -25,5 +25,6 @@ public class WorkBook implements Xmlizable { } public void initializeFromXml(Document doc) { + // do nothing } } diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/WorkSheet.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/WorkSheet.java index 025f573857d..5f497dc5763 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/WorkSheet.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/xml/excel/WorkSheet.java @@ -25,5 +25,6 @@ public class WorkSheet implements Xmlizable { } public void initializeFromXml(Document doc) { + // do nothing } } -- cgit v1.2.3