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
This commit is contained in:
Yegor Kozlov 2009-10-04 16:01:29 +00:00
parent 2ad9b00e9f
commit 5d21532e8f
11 changed files with 24 additions and 14 deletions

View File

@ -152,7 +152,7 @@ public class ExtractorFactory {
*/ */
public static POITextExtractor[] getEmbededDocsTextExtractors(POIOLE2TextExtractor ext) throws IOException { public static POITextExtractor[] getEmbededDocsTextExtractors(POIOLE2TextExtractor ext) throws IOException {
// Find all the embeded directories // Find all the embeded directories
ArrayList dirs = new ArrayList(); ArrayList<Entry> dirs = new ArrayList<Entry>();
POIFSFileSystem fs = ext.getFileSystem(); POIFSFileSystem fs = ext.getFileSystem();
if(fs == null) { if(fs == null) {
throw new IllegalStateException("The extractor didn't know which POIFS it came from!"); throw new IllegalStateException("The extractor didn't know which POIFS it came from!");

View File

@ -37,6 +37,7 @@ import org.apache.poi.util.POILogger;
* @author Julien Chable, CDubet * @author Julien Chable, CDubet
* *
*/ */
@Deprecated
public abstract class Package extends OPCPackage { public abstract class Package extends OPCPackage {
/** /**
@ -48,6 +49,7 @@ public abstract class Package extends OPCPackage {
/** /**
* @deprecated use {@link OPCPackage} * @deprecated use {@link OPCPackage}
*/ */
@Deprecated
protected Package(PackageAccess access) { protected Package(PackageAccess access) {
super(access); super(access);
} }
@ -56,6 +58,7 @@ public abstract class Package extends OPCPackage {
/** /**
* @deprecated use {@link OPCPackage#open(String)} * @deprecated use {@link OPCPackage#open(String)}
*/ */
@Deprecated
public static Package open(String path) throws InvalidFormatException { public static Package open(String path) throws InvalidFormatException {
return open(path, defaultPackageAccess); return open(path, defaultPackageAccess);
} }
@ -63,6 +66,7 @@ public abstract class Package extends OPCPackage {
/** /**
* @deprecated use {@link OPCPackage#open(String,PackageAccess)} * @deprecated use {@link OPCPackage#open(String,PackageAccess)}
*/ */
@Deprecated
public static Package open(String path, PackageAccess access) public static Package open(String path, PackageAccess access)
throws InvalidFormatException { throws InvalidFormatException {
if (path == null || "".equals(path.trim()) if (path == null || "".equals(path.trim())
@ -80,6 +84,7 @@ public abstract class Package extends OPCPackage {
/** /**
* @deprecated use {@link OPCPackage#open(InputStream)} * @deprecated use {@link OPCPackage#open(InputStream)}
*/ */
@Deprecated
public static Package open(InputStream in) throws InvalidFormatException, public static Package open(InputStream in) throws InvalidFormatException,
IOException { IOException {
Package pack = new ZipPackage(in, PackageAccess.READ); 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 use {@link OPCPackage#openOrCreate(java.io.File)}
*/ */
@Deprecated
public static Package openOrCreate(File file) throws InvalidFormatException { public static Package openOrCreate(File file) throws InvalidFormatException {
Package retPackage = null; Package retPackage = null;
if (file.exists()) { if (file.exists()) {
@ -105,6 +111,7 @@ public abstract class Package extends OPCPackage {
/** /**
* @deprecated use {@link OPCPackage#create(String)} * @deprecated use {@link OPCPackage#create(String)}
*/ */
@Deprecated
public static Package create(String path) { public static Package create(String path) {
return create(new File(path)); return create(new File(path));
} }
@ -112,6 +119,7 @@ public abstract class Package extends OPCPackage {
/** /**
* @deprecated use {@link OPCPackage#create(File)} * @deprecated use {@link OPCPackage#create(File)}
*/ */
@Deprecated
public static Package create(File file) { public static Package create(File file) {
if (file == null || (file.exists() && file.isDirectory())) if (file == null || (file.exists() && file.isDirectory()))
throw new IllegalArgumentException("file"); throw new IllegalArgumentException("file");
@ -133,6 +141,7 @@ public abstract class Package extends OPCPackage {
/** /**
* @deprecated use {@link OPCPackage#create(OutputStream)} * @deprecated use {@link OPCPackage#create(OutputStream)}
*/ */
@Deprecated
public static Package create(OutputStream output) { public static Package create(OutputStream output) {
Package pkg = null; Package pkg = null;
pkg = new ZipPackage(); pkg = new ZipPackage();

View File

@ -297,7 +297,7 @@ public class XSSFExportToXml implements Comparator<String>{
case XSSFCell.CELL_TYPE_STRING: value = cell.getStringCellValue(); break; case XSSFCell.CELL_TYPE_STRING: value = cell.getStringCellValue(); break;
case XSSFCell.CELL_TYPE_BOOLEAN: value += cell.getBooleanCellValue(); 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_FORMULA: value = cell.getStringCellValue(); break;
case XSSFCell.CELL_TYPE_NUMERIC: value += cell.getRawValue(); break; case XSSFCell.CELL_TYPE_NUMERIC: value += cell.getRawValue(); break;
default: ; default: ;

View File

@ -97,7 +97,7 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing {
xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"> xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing">
*/ */
if(isNew) xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDrawing.type.getName().getNamespaceURI(), "wsDr", "xdr")); if(isNew) xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDrawing.type.getName().getNamespaceURI(), "wsDr", "xdr"));
Map map = new HashMap(); Map<String, String> map = new HashMap<String, String>();
map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a"); map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a");
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r"); map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
xmlOptions.setSaveSuggestedPrefixes(map); xmlOptions.setSaveSuggestedPrefixes(map);

View File

@ -54,7 +54,7 @@ public final class XSSFFactory extends POIXMLFactory {
} }
try { try {
Class cls = descriptor.getRelationClass(); Class<? extends POIXMLDocumentPart> cls = descriptor.getRelationClass();
Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor(PackagePart.class, PackageRelationship.class); Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor(PackagePart.class, PackageRelationship.class);
return constructor.newInstance(part, rel); return constructor.newInstance(part, rel);
} catch (Exception e){ } catch (Exception e){
@ -64,7 +64,7 @@ public final class XSSFFactory extends POIXMLFactory {
public POIXMLDocumentPart newDocumentPart(POIXMLRelation descriptor){ public POIXMLDocumentPart newDocumentPart(POIXMLRelation descriptor){
try { try {
Class cls = descriptor.getRelationClass(); Class<? extends POIXMLDocumentPart> cls = descriptor.getRelationClass();
Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor(); Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor();
return constructor.newInstance(); return constructor.newInstance();
} catch (Exception e){ } catch (Exception e){

View File

@ -55,8 +55,9 @@ public class XSSFFormulaEvaluator implements FormulaEvaluator {
* @param stabilityClassifier used to optimise caching performance. Pass <code>null</code> * @param stabilityClassifier used to optimise caching performance. Pass <code>null</code>
* for the (conservative) assumption that any cell may have its definition changed after * for the (conservative) assumption that any cell may have its definition changed after
* evaluation begins. * 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)}
*/ */
@Deprecated
public XSSFFormulaEvaluator(XSSFWorkbook workbook, IStabilityClassifier stabilityClassifier) { public XSSFFormulaEvaluator(XSSFWorkbook workbook, IStabilityClassifier stabilityClassifier) {
_bookEvaluator = new WorkbookEvaluator(XSSFEvaluationWorkbook.create(workbook), stabilityClassifier, null); _bookEvaluator = new WorkbookEvaluator(XSSFEvaluationWorkbook.create(workbook), stabilityClassifier, null);
} }

View File

@ -2326,7 +2326,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTWorksheet.type.getName().getNamespaceURI(), "worksheet")); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTWorksheet.type.getName().getNamespaceURI(), "worksheet"));
Map map = new HashMap(); Map<String, String> map = new HashMap<String, String>();
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r"); map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
xmlOptions.setSaveSuggestedPrefixes(map); xmlOptions.setSaveSuggestedPrefixes(map);

View File

@ -263,7 +263,7 @@ public class XWPFHeaderFooterPolicy {
private XmlOptions commit(XWPFHeaderFooter wrapper) { private XmlOptions commit(XWPFHeaderFooter wrapper) {
XmlOptions xmlOptions = new XmlOptions(wrapper.DEFAULT_XML_OPTIONS); XmlOptions xmlOptions = new XmlOptions(wrapper.DEFAULT_XML_OPTIONS);
Map map = new HashMap(); Map<String, String> map = new HashMap<String, String>();
map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m"); map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");
map.put("urn:schemas-microsoft-com:office:office", "o"); map.put("urn:schemas-microsoft-com:office:office", "o");
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r"); map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");

View File

@ -326,7 +326,7 @@ public class XWPFDocument extends POIXMLDocument {
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDocument1.type.getName().getNamespaceURI(), "document")); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDocument1.type.getName().getNamespaceURI(), "document"));
Map map = new HashMap(); Map<String, String> map = new HashMap<String, String>();
map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m"); map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");
map.put("urn:schemas-microsoft-com:office:office", "o"); map.put("urn:schemas-microsoft-com:office:office", "o");
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r"); map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");

View File

@ -53,7 +53,7 @@ public final class XWPFFactory extends POIXMLFactory {
} }
try { try {
Class cls = descriptor.getRelationClass(); Class<? extends POIXMLDocumentPart> cls = descriptor.getRelationClass();
Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor(PackagePart.class, PackageRelationship.class); Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor(PackagePart.class, PackageRelationship.class);
return constructor.newInstance(part, rel); return constructor.newInstance(part, rel);
} catch (Exception e){ } catch (Exception e){
@ -63,7 +63,7 @@ public final class XWPFFactory extends POIXMLFactory {
public POIXMLDocumentPart newDocumentPart(POIXMLRelation descriptor){ public POIXMLDocumentPart newDocumentPart(POIXMLRelation descriptor){
try { try {
Class cls = descriptor.getRelationClass(); Class<? extends POIXMLDocumentPart> cls = descriptor.getRelationClass();
Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor(); Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor();
return constructor.newInstance(); return constructor.newInstance();
} catch (Exception e){ } catch (Exception e){

View File

@ -91,7 +91,7 @@ public final class TestOPCCompliancePartName extends TestCase {
try { try {
uri = new URI(s); uri = new URI(s);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
assertTrue(s == "[Content_Types].xml"); assertTrue(s.equals("[Content_Types].xml"));
continue; continue;
} }
assertFalse("This part name SHOULD NOT be valid: " + s, assertFalse("This part name SHOULD NOT be valid: " + s,