From: Yegor Kozlov Date: Sun, 4 Oct 2009 16:01:29 +0000 (+0000) Subject: reduced the number of compiler warnings generated by JDK 1.6.13 with -Xlint X-Git-Tag: REL_3_6~112 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8f4139a9a6041ec05a30223f84f39e0939bc863b;p=poi.git reduced the number of compiler warnings generated by JDK 1.6.13 with -Xlint git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@821551 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java index a313f36026..44290db92b 100644 --- a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java +++ b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java @@ -152,7 +152,7 @@ public class ExtractorFactory { */ public static POITextExtractor[] getEmbededDocsTextExtractors(POIOLE2TextExtractor ext) throws IOException { // Find all the embeded directories - ArrayList dirs = new ArrayList(); + ArrayList dirs = new ArrayList(); POIFSFileSystem fs = ext.getFileSystem(); if(fs == null) { throw new IllegalStateException("The extractor didn't know which POIFS it came from!"); diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/Package.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/Package.java index bedc9b86d5..c32d7ee54c 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/Package.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/Package.java @@ -37,6 +37,7 @@ import org.apache.poi.util.POILogger; * @author Julien Chable, CDubet * */ +@Deprecated public abstract class Package extends OPCPackage { /** @@ -48,7 +49,8 @@ public abstract class Package extends OPCPackage { /** * @deprecated use {@link OPCPackage} */ - protected Package(PackageAccess access) { + @Deprecated + protected Package(PackageAccess access) { super(access); } @@ -56,6 +58,7 @@ public abstract class Package extends OPCPackage { /** * @deprecated use {@link OPCPackage#open(String)} */ + @Deprecated public static Package open(String path) throws InvalidFormatException { return open(path, defaultPackageAccess); } @@ -63,6 +66,7 @@ public abstract class Package extends OPCPackage { /** * @deprecated use {@link OPCPackage#open(String,PackageAccess)} */ + @Deprecated public static Package open(String path, PackageAccess access) throws InvalidFormatException { if (path == null || "".equals(path.trim()) @@ -80,6 +84,7 @@ public abstract class Package extends OPCPackage { /** * @deprecated use {@link OPCPackage#open(InputStream)} */ + @Deprecated public static Package open(InputStream in) throws InvalidFormatException, IOException { Package pack = new ZipPackage(in, PackageAccess.READ); @@ -92,6 +97,7 @@ public abstract class Package extends OPCPackage { /** * @deprecated use {@link OPCPackage#openOrCreate(java.io.File)} */ + @Deprecated public static Package openOrCreate(File file) throws InvalidFormatException { Package retPackage = null; if (file.exists()) { @@ -105,6 +111,7 @@ public abstract class Package extends OPCPackage { /** * @deprecated use {@link OPCPackage#create(String)} */ + @Deprecated public static Package create(String path) { return create(new File(path)); } @@ -112,6 +119,7 @@ public abstract class Package extends OPCPackage { /** * @deprecated use {@link OPCPackage#create(File)} */ + @Deprecated public static Package create(File file) { if (file == null || (file.exists() && file.isDirectory())) throw new IllegalArgumentException("file"); @@ -133,6 +141,7 @@ public abstract class Package extends OPCPackage { /** * @deprecated use {@link OPCPackage#create(OutputStream)} */ + @Deprecated public static Package create(OutputStream output) { Package pkg = null; pkg = new ZipPackage(); diff --git a/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java b/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java index 6ca8ba6da9..53cb5d6677 100644 --- a/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java +++ b/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java @@ -297,7 +297,7 @@ public class XSSFExportToXml implements Comparator{ case XSSFCell.CELL_TYPE_STRING: value = cell.getStringCellValue(); break; case XSSFCell.CELL_TYPE_BOOLEAN: value += cell.getBooleanCellValue(); break; - case XSSFCell.CELL_TYPE_ERROR: value = cell.getErrorCellString(); + case XSSFCell.CELL_TYPE_ERROR: value = cell.getErrorCellString(); break; case XSSFCell.CELL_TYPE_FORMULA: value = cell.getStringCellValue(); break; case XSSFCell.CELL_TYPE_NUMERIC: value += cell.getRawValue(); break; default: ; diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java index ffdc684f5b..bfcf85305e 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java @@ -97,7 +97,7 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing { xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"> */ if(isNew) xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDrawing.type.getName().getNamespaceURI(), "wsDr", "xdr")); - Map map = new HashMap(); + Map map = new HashMap(); map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a"); map.put(STRelationshipId.type.getName().getNamespaceURI(), "r"); xmlOptions.setSaveSuggestedPrefixes(map); diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFactory.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFactory.java index ab0ef2b443..cc2cbe521d 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFactory.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFactory.java @@ -54,7 +54,7 @@ public final class XSSFFactory extends POIXMLFactory { } try { - Class cls = descriptor.getRelationClass(); + Class cls = descriptor.getRelationClass(); Constructor constructor = cls.getDeclaredConstructor(PackagePart.class, PackageRelationship.class); return constructor.newInstance(part, rel); } catch (Exception e){ @@ -64,7 +64,7 @@ public final class XSSFFactory extends POIXMLFactory { public POIXMLDocumentPart newDocumentPart(POIXMLRelation descriptor){ try { - Class cls = descriptor.getRelationClass(); + Class cls = descriptor.getRelationClass(); Constructor constructor = cls.getDeclaredConstructor(); return constructor.newInstance(); } catch (Exception e){ diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java index 0130eca232..c6ef17bdc7 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java @@ -55,9 +55,10 @@ public class XSSFFormulaEvaluator implements FormulaEvaluator { * @param stabilityClassifier used to optimise caching performance. Pass null * for the (conservative) assumption that any cell may have its definition changed after * evaluation begins. - * @deprecated (Sep 2009) (reduce overloading) use {@link #create(HSSFWorkbook, IStabilityClassifier, UDFFinder)} + * @deprecated (Sep 2009) (reduce overloading) use {@link #create(XSSFWorkbook, org.apache.poi.ss.formula.IStabilityClassifier, org.apache.poi.hssf.record.formula.udf.UDFFinder)} */ - public XSSFFormulaEvaluator(XSSFWorkbook workbook, IStabilityClassifier stabilityClassifier) { + @Deprecated + public XSSFFormulaEvaluator(XSSFWorkbook workbook, IStabilityClassifier stabilityClassifier) { _bookEvaluator = new WorkbookEvaluator(XSSFEvaluationWorkbook.create(workbook), stabilityClassifier, null); } private XSSFFormulaEvaluator(XSSFWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) { diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index 8db42bc183..b5a70286a2 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -2326,7 +2326,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTWorksheet.type.getName().getNamespaceURI(), "worksheet")); - Map map = new HashMap(); + Map map = new HashMap(); map.put(STRelationshipId.type.getName().getNamespaceURI(), "r"); xmlOptions.setSaveSuggestedPrefixes(map); diff --git a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java b/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java index a0ffb87bf9..41f47836f3 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java +++ b/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java @@ -263,7 +263,7 @@ public class XWPFHeaderFooterPolicy { private XmlOptions commit(XWPFHeaderFooter wrapper) { XmlOptions xmlOptions = new XmlOptions(wrapper.DEFAULT_XML_OPTIONS); - Map map = new HashMap(); + Map map = new HashMap(); map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m"); map.put("urn:schemas-microsoft-com:office:office", "o"); map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r"); diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java index 7a43ff46d4..6a5f5c1c9b 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java @@ -326,7 +326,7 @@ public class XWPFDocument extends POIXMLDocument { XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDocument1.type.getName().getNamespaceURI(), "document")); - Map map = new HashMap(); + Map map = new HashMap(); map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m"); map.put("urn:schemas-microsoft-com:office:office", "o"); map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r"); diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFactory.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFactory.java index 02b18d9a2e..dfa67d95f6 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFactory.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFactory.java @@ -53,7 +53,7 @@ public final class XWPFFactory extends POIXMLFactory { } try { - Class cls = descriptor.getRelationClass(); + Class cls = descriptor.getRelationClass(); Constructor constructor = cls.getDeclaredConstructor(PackagePart.class, PackageRelationship.class); return constructor.newInstance(part, rel); } catch (Exception e){ @@ -63,7 +63,7 @@ public final class XWPFFactory extends POIXMLFactory { public POIXMLDocumentPart newDocumentPart(POIXMLRelation descriptor){ try { - Class cls = descriptor.getRelationClass(); + Class cls = descriptor.getRelationClass(); Constructor constructor = cls.getDeclaredConstructor(); return constructor.newInstance(); } catch (Exception e){ diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCCompliancePartName.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCCompliancePartName.java index c7db283942..2593594522 100644 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCCompliancePartName.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCCompliancePartName.java @@ -91,7 +91,7 @@ public final class TestOPCCompliancePartName extends TestCase { try { uri = new URI(s); } catch (URISyntaxException e) { - assertTrue(s == "[Content_Types].xml"); + assertTrue(s.equals("[Content_Types].xml")); continue; } assertFalse("This part name SHOULD NOT be valid: " + s,