poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1516312 - in /poi/trunk/src: java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java
Date Wed, 21 Aug 2013 22:06:07 GMT
Author: centic
Date: Wed Aug 21 22:06:07 2013
New Revision: 1516312

URL: http://svn.apache.org/r1516312
Log:
Also fix some Eclipse warnings while hunting Bugs: Generics, unused
variables, ...

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?rev=1516312&r1=1516311&r2=1516312&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java Wed Aug 21 22:06:07
2013
@@ -36,11 +36,11 @@ import org.apache.poi.ddf.EscherBitmapBl
 import org.apache.poi.ddf.EscherBlipRecord;
 import org.apache.poi.ddf.EscherRecord;
 import org.apache.poi.hssf.OldExcelFormatException;
+import org.apache.poi.hssf.model.DrawingManager2;
 import org.apache.poi.hssf.model.HSSFFormulaParser;
 import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.model.InternalWorkbook;
 import org.apache.poi.hssf.model.RecordStream;
-import org.apache.poi.hssf.model.DrawingManager2;
 import org.apache.poi.hssf.record.*;
 import org.apache.poi.hssf.record.aggregates.RecordAggregate.RecordVisitor;
 import org.apache.poi.hssf.record.common.UnicodeString;
@@ -51,6 +51,7 @@ import org.apache.poi.ss.formula.Formula
 import org.apache.poi.ss.formula.FormulaType;
 import org.apache.poi.ss.formula.SheetNameFormatter;
 import org.apache.poi.ss.formula.udf.AggregatingUDFFinder;
+import org.apache.poi.ss.formula.udf.IndexedUDFFinder;
 import org.apache.poi.ss.formula.udf.UDFFinder;
 import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
 import org.apache.poi.ss.util.CellRangeAddress;
@@ -58,7 +59,6 @@ import org.apache.poi.ss.util.WorkbookUt
 import org.apache.poi.util.Configurator;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
-import org.apache.poi.ss.formula.udf.IndexedUDFFinder;
 
 
 /**
@@ -118,7 +118,7 @@ public final class HSSFWorkbook extends 
      * this holds the HSSFFont objects attached to this workbook.
      * We only create these from the low level records as required.
      */
-    private Hashtable fonts;
+    private Hashtable<Short,HSSFFont> fonts;
 
     /**
      * holds whether or not to preserve other nodes in the POIFS.  Used
@@ -285,7 +285,6 @@ public final class HSSFWorkbook extends 
         workbook = InternalWorkbook.createWorkbook(records);
         setPropertiesFromWorkbook(workbook);
         int recOffset = workbook.getNumRecords();
-        int sheetNum = 0;
 
         // convert all LabelRecord records to LabelSSTRecord
         convertLabelRecords(records, recOffset);
@@ -353,13 +352,13 @@ public final class HSSFWorkbook extends 
       * @see org.apache.poi.hssf.record.SSTRecord
       */
 
-     private void convertLabelRecords(List records, int offset)
+     private void convertLabelRecords(List<Record> records, int offset)
      {
          if (log.check( POILogger.DEBUG ))
              log.log(POILogger.DEBUG, "convertLabelRecords called");
          for (int k = offset; k < records.size(); k++)
          {
-             Record rec = ( Record ) records.get(k);
+             Record rec = records.get(k);
 
              if (rec.getSid() == LabelRecord.sid)
              {
@@ -661,9 +660,6 @@ public final class HSSFWorkbook extends 
         return workbook.resolveNameXText(refIndex, definedNameIndex);
     }
 
-
-
-
     /**
      * create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns
      * the high level representation.  Use this to create new sheets.
@@ -1034,7 +1030,7 @@ public final class HSSFWorkbook extends 
 
     public HSSFFont createFont()
     {
-        FontRecord font = workbook.createNewFont();
+        /*FontRecord font =*/ workbook.createNewFont();
         short fontindex = (short) (getNumberOfFonts() - 1);
 
         if (fontindex > 3)
@@ -1094,14 +1090,14 @@ public final class HSSFWorkbook extends 
      * @return HSSFFont at the index
      */
     public HSSFFont getFontAt(short idx) {
-        if(fonts == null) fonts = new Hashtable();
+        if(fonts == null) fonts = new Hashtable<Short, HSSFFont>();
 
         // So we don't confuse users, give them back
         //  the same object every time, but create
         //  them lazily
         Short sIdx = Short.valueOf(idx);
         if(fonts.containsKey(sIdx)) {
-            return (HSSFFont)fonts.get(sIdx);
+            return fonts.get(sIdx);
         }
 
         FontRecord font = workbook.getFontRecordAt(idx);
@@ -1118,7 +1114,7 @@ public final class HSSFWorkbook extends 
      *  and that's not something you should normally do
      */
     protected void resetFontCache() {
-        fonts = new Hashtable();
+        fonts = new Hashtable<Short, HSSFFont>();
     }
 
     /**
@@ -1217,12 +1213,12 @@ public final class HSSFWorkbook extends 
      */
     private static final class SheetRecordCollector implements RecordVisitor {
 
-        private List _list;
+        private List<Record> _list;
         private int _totalSize;
 
         public SheetRecordCollector() {
             _totalSize = 0;
-            _list = new ArrayList(128);
+            _list = new ArrayList<Record>(128);
         }
         public int getTotalSize() {
             return _totalSize;
@@ -1230,12 +1226,13 @@ public final class HSSFWorkbook extends 
         public void visitRecord(Record r) {
             _list.add(r);
             _totalSize+=r.getRecordSize();
+            
         }
         public int serialize(int offset, byte[] data) {
             int result = 0;
             int nRecs = _list.size();
             for(int i=0; i<nRecs; i++) {
-                Record rec = (Record)_list.get(i);
+                Record rec = _list.get(i);
                 result += rec.serialize(offset + result, data);
             }
             return result;
@@ -1556,11 +1553,11 @@ public final class HSSFWorkbook extends 
     {
         DrawingGroupRecord r = (DrawingGroupRecord) workbook.findFirstRecordBySid( DrawingGroupRecord.sid
);
         r.decode();
-        List escherRecords = r.getEscherRecords();
+        List<EscherRecord> escherRecords = r.getEscherRecords();
         PrintWriter w = new PrintWriter(System.out);
-        for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); )
+        for ( Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext();
)
         {
-            EscherRecord escherRecord = (EscherRecord) iterator.next();
+            EscherRecord escherRecord = iterator.next();
             if (fat)
                 System.out.println(escherRecord.toString());
             else

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java?rev=1516312&r1=1516311&r2=1516312&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java Wed Aug
21 22:06:07 2013
@@ -19,7 +19,13 @@
 
 package org.apache.poi.xssf.streaming;
 
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPOutputStream;
 
@@ -35,7 +41,8 @@ public class GZIPSheetDataWriter extends
     /**
      * @return temp file to write sheet data
      */
-    public File createTempFile()throws IOException {
+    @Override
+	public File createTempFile()throws IOException {
         File fd = File.createTempFile("poi-sxssf-sheet-xml", ".gz");
         return fd;
     }
@@ -43,7 +50,8 @@ public class GZIPSheetDataWriter extends
     /**
      * @return a wrapped instance of GZIPOutputStream
      */
-    public Writer createWriter(File fd)throws IOException {
+    @Override
+	public Writer createWriter(File fd)throws IOException {
         return new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(fd)));
     }
 
@@ -51,7 +59,8 @@ public class GZIPSheetDataWriter extends
     /**
      * @return a GZIPInputStream stream to read the compressed temp file
      */
-    public InputStream getWorksheetXMLInputStream() throws IOException {
+    @Override
+	public InputStream getWorksheetXMLInputStream() throws IOException {
         File fd = getTempFile();
         return new GZIPInputStream(new FileInputStream(fd));
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message