From 698c9b127960d9056fafc01fbdf34970b95e4e1d Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sun, 3 Jan 2010 20:56:40 +0000 Subject: [PATCH] Add in a few bits of Generics to avoid warnings git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@895477 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/poifs/filesystem/DirectoryEntry.java | 2 +- .../poi/poifs/filesystem/DirectoryNode.java | 17 +++++++++-------- .../apache/poi/extractor/ExtractorFactory.java | 12 ++++++------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java b/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java index de8bb1f577..8b7119b571 100644 --- a/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java +++ b/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java @@ -47,7 +47,7 @@ public interface DirectoryEntry * implementations of Entry. */ - public Iterator getEntries(); + public Iterator getEntries(); /** * is this DirectoryEntry empty? diff --git a/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java b/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java index 6805e5197b..3621637317 100644 --- a/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java +++ b/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java @@ -41,7 +41,7 @@ public class DirectoryNode { // Map of Entry instances, keyed by their names - private Map _entries; + private Map _entries; // the POIFSFileSystem we belong to private POIFSFileSystem _filesystem; @@ -75,12 +75,12 @@ public class DirectoryNode }); } _filesystem = filesystem; - _entries = new HashMap(); - Iterator iter = property.getChildren(); + _entries = new HashMap(); + Iterator iter = property.getChildren(); while (iter.hasNext()) { - Property child = ( Property ) iter.next(); + Property child = iter.next(); Entry childNode = null; if (child.isDirectory()) @@ -215,7 +215,7 @@ public class DirectoryNode * implementations of Entry. */ - public Iterator getEntries() + public Iterator getEntries() { return _entries.values().iterator(); } @@ -263,7 +263,7 @@ public class DirectoryNode if (name != null) { - rval = ( Entry ) _entries.get(name); + rval = _entries.get(name); } if (rval == null) { @@ -416,8 +416,9 @@ public class DirectoryNode List components = new ArrayList(); components.add(getProperty()); - SortedMap sortedEntries = new TreeMap(_entries); - Iterator iter = sortedEntries.values().iterator(); + SortedMap sortedEntries = + new TreeMap(_entries); + Iterator iter = sortedEntries.values().iterator(); while (iter.hasNext()) { diff --git a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java index 44290db92b..34e4829de5 100644 --- a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java +++ b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java @@ -123,8 +123,8 @@ public class ExtractorFactory { public static POIOLE2TextExtractor createExtractor(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException { // Look for certain entries in the stream, to figure it // out from - for(Iterator entries = poifsDir.getEntries(); entries.hasNext(); ) { - Entry entry = (Entry)entries.next(); + for(Iterator entries = poifsDir.getEntries(); entries.hasNext(); ) { + Entry entry = entries.next(); if(entry.getName().equals("Workbook")) { return new ExcelExtractor(poifsDir, fs); @@ -160,9 +160,9 @@ public class ExtractorFactory { if(ext instanceof ExcelExtractor) { // These are in MBD... under the root - Iterator it = fs.getRoot().getEntries(); + Iterator it = fs.getRoot().getEntries(); while(it.hasNext()) { - Entry entry = (Entry)it.next(); + Entry entry = it.next(); if(entry.getName().startsWith("MBD")) { dirs.add(entry); } @@ -172,9 +172,9 @@ public class ExtractorFactory { try { DirectoryEntry op = (DirectoryEntry) fs.getRoot().getEntry("ObjectPool"); - Iterator it = op.getEntries(); + Iterator it = op.getEntries(); while(it.hasNext()) { - Entry entry = (Entry)it.next(); + Entry entry = it.next(); if(entry.getName().startsWith("_")) { dirs.add(entry); } -- 2.39.5