]> source.dussan.org Git - poi.git/commitdiff
remove some unused imports and some useless TODOs, slightly more
authorDominik Stadler <centic@apache.org>
Tue, 31 Dec 2013 15:12:30 +0000 (15:12 +0000)
committerDominik Stadler <centic@apache.org>
Tue, 31 Dec 2013 15:12:30 +0000 (15:12 +0000)
coverage, @Overrides, more info on failing test, fix some Eclipse
warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1554535 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
src/java/org/apache/poi/ss/formula/functions/Rept.java
src/ooxml/java/org/apache/poi/openxml4j/opc/internal/signature/DigitalCertificatePart.java
src/ooxml/java/org/apache/poi/openxml4j/opc/signature/PackageDigitalSignature.java
src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java
src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java
src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java
src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java
src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java

index 535e7781f2dad4aaca82142a8d8dbab0e45883e9..16bc38598412443325929209ea92a982e9d72b8c 100644 (file)
@@ -25,8 +25,8 @@ import java.util.TreeMap;
 
 import org.apache.poi.hssf.model.RecordStream;
 import org.apache.poi.hssf.record.*;
-import org.apache.poi.ss.formula.FormulaShifter;
 import org.apache.poi.ss.SpreadsheetVersion;
+import org.apache.poi.ss.formula.FormulaShifter;
 
 /**
  *
@@ -237,14 +237,15 @@ public final class RowRecordsAggregate extends RecordAggregate {
                  rowIterator.next();
                int result = 0;
                while(rowIterator.hasNext() && (i++ < endIndex)) {
-                 Record rec = (Record)rowIterator.next();
+                 Record rec = rowIterator.next();
                  result += rec.getRecordSize();
                  rv.visitRecord(rec);
                }
                return result;
        }
 
-       public void visitContainedRecords(RecordVisitor rv) {
+    @Override
+    public void visitContainedRecords(RecordVisitor rv) {
 
                PositionTrackingVisitor stv = new PositionTrackingVisitor(rv, 0);
                //DBCells are serialized before row records.
index b93d96915df5025cfe6e7224621420342774705e..0dbb189cddc1e830654527e4784f5ae87178312e 100644 (file)
 \r
 package org.apache.poi.ss.formula.functions;\r
 \r
-import org.apache.poi.ss.formula.OperationEvaluationContext;\r
-import org.apache.poi.ss.formula.eval.*;\r
-\r
-import java.math.BigDecimal;\r
+import org.apache.poi.ss.formula.eval.ErrorEval;\r
+import org.apache.poi.ss.formula.eval.EvaluationException;\r
+import org.apache.poi.ss.formula.eval.OperandResolver;\r
+import org.apache.poi.ss.formula.eval.StringEval;\r
+import org.apache.poi.ss.formula.eval.ValueEval;\r
 \r
 /**\r
  * Implementation for Excel REPT () function.<p/>\r
index 19ba500f2eaea652bcf936f00adc568d86da5f60..797f12f02a5b07691fbf718cc6c99519729c53df 100644 (file)
@@ -41,38 +41,29 @@ public final class DigitalCertificatePart extends PackagePart  {
 
        @Override
        public void close() {
-               // TODO Auto-generated method stub
-
        }
 
        @Override
        public void flush() {
-               // TODO Auto-generated method stub
-
        }
 
        @Override
        protected InputStream getInputStreamImpl() throws IOException {
-               // TODO Auto-generated method stub
                return null;
        }
 
        @Override
        protected OutputStream getOutputStreamImpl() {
-               // TODO Auto-generated method stub
                return null;
        }
 
        @Override
        public boolean load(InputStream ios) throws InvalidFormatException {
-               // TODO Auto-generated method stub
                return false;
        }
 
        @Override
        public boolean save(OutputStream zos) throws OpenXML4JException {
-               // TODO Auto-generated method stub
                return false;
        }
-
 }
index c7a9b8f7ea15fc3385db64ccacc198fa3b25016e..370e52e5128af40714bafbc1534a367b29333d5e 100644 (file)
@@ -34,37 +34,29 @@ public final class PackageDigitalSignature extends PackagePart {
 
        @Override
        public void close() {
-               // TODO Auto-generated method stub
-
        }
 
        @Override
        public void flush() {
-               // TODO Auto-generated method stub
-
        }
 
        @Override
        protected InputStream getInputStreamImpl() throws IOException {
-               // TODO Auto-generated method stub
                return null;
        }
 
        @Override
        protected OutputStream getOutputStreamImpl() {
-               // TODO Auto-generated method stub
                return null;
        }
 
        @Override
        public boolean load(InputStream ios) throws InvalidFormatException {
-               // TODO Auto-generated method stub
                return false;
        }
 
        @Override
        public boolean save(OutputStream zos) throws OpenXML4JException {
-               // TODO Auto-generated method stub
                return false;
        }
 }
index 09dccdff1e1d7399f8a91ee69ff7be6d4d79adf0..b6523bedde73034b157199c090a56ef111ee0ea6 100644 (file)
 ==================================================================== */
 package org.apache.poi.xslf;
 
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+
 import org.apache.poi.POIXMLDocument;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
@@ -27,24 +31,7 @@ import org.apache.poi.util.Internal;
 import org.apache.poi.xslf.usermodel.XMLSlideShow;
 import org.apache.poi.xslf.usermodel.XSLFRelation;
 import org.apache.xmlbeans.XmlException;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentList;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesSlide;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTPresentation;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTSlide;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideIdList;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideIdListEntry;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMaster;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMasterIdList;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMasterIdListEntry;
-import org.openxmlformats.schemas.presentationml.x2006.main.CmLstDocument;
-import org.openxmlformats.schemas.presentationml.x2006.main.NotesDocument;
-import org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument;
-import org.openxmlformats.schemas.presentationml.x2006.main.SldDocument;
-import org.openxmlformats.schemas.presentationml.x2006.main.SldMasterDocument;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
+import org.openxmlformats.schemas.presentationml.x2006.main.*;
 
 /**
  * Experimental class to do low level processing of pptx files.
@@ -253,6 +240,7 @@ public class XSLFSlideShow extends POIXMLDocument {
     /**
      * Get the document's embedded files.
      */
+    @Override
     public List<PackagePart> getAllEmbedds() throws OpenXML4JException {
         return embedds;
     }
index bba2f5bd15bcf5433de248d5b8585b4775bdc1d0..c6d2bd70583a7b725fcd8bbd530a2b18c4c69fd3 100644 (file)
@@ -22,15 +22,17 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 
 import junit.framework.TestCase;
 
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackageRelationship;
-import org.apache.poi.util.TempFile;
 import org.apache.poi.util.PackageHelper;
+import org.apache.poi.util.TempFile;
 
 /**
  * Test recursive read and write of OPC packages
@@ -43,6 +45,7 @@ public final class TestPOIXMLDocument extends TestCase {
             super(pkg);
         }
 
+        @Override
         public List<PackagePart> getAllEmbedds() {
             throw new RuntimeException("not supported");
         }
@@ -57,10 +60,12 @@ public final class TestPOIXMLDocument extends TestCase {
         public TestFactory() {
             //
         }
+        @Override
         public POIXMLDocumentPart createDocumentPart(POIXMLDocumentPart parent, PackageRelationship rel, PackagePart part){
             return new POIXMLDocumentPart(part, rel);
         }
 
+        @Override
         public POIXMLDocumentPart newDocumentPart(POIXMLRelation descriptor){
             throw new RuntimeException("not supported");
         }
@@ -73,6 +78,8 @@ public final class TestPOIXMLDocument extends TestCase {
     private static void traverse(POIXMLDocumentPart part, HashMap<String,POIXMLDocumentPart> context) throws IOException{
         context.put(part.getPackageRelationship().getTargetURI().toString(), part);
         for(POIXMLDocumentPart p : part.getRelations()){
+            assertNotNull(p.toString());
+            
             String uri = p.getPackageRelationship().getTargetURI().toString();
             if (!context.containsKey(uri)) {
                 traverse(p, context);
@@ -152,4 +159,19 @@ public final class TestPOIXMLDocument extends TestCase {
         }
 
     }
+
+    public void testCommitNullPart() throws IOException, InvalidFormatException {
+        POIXMLDocumentPart part = new POIXMLDocumentPart();
+        part.prepareForCommit();
+        part.commit();
+        part.onSave(new HashSet<PackagePart>());
+
+        assertNull(part.getRelationById(null));
+        assertNull(part.getRelationId(null));
+        assertFalse(part.removeRelation(null, true));
+        part.removeRelation(null);
+        assertNull(part.toString());
+        part.onDocumentCreate();
+        //part.getTargetPart(null);
+    }
 }
index 628767ecae97c19f5a339ca55af418a9d17e7a46..941c44b7f664744743dcca0aac4179248be3d4e5 100644 (file)
  */\r
 package org.apache.poi.xslf.usermodel;\r
 \r
+import java.io.OutputStream;\r
+import java.util.LinkedHashMap;\r
+import java.util.Map;\r
+\r
 import junit.framework.TestCase;\r
+\r
 import org.apache.poi.POIXMLDocumentPart;\r
 import org.apache.poi.ss.util.CellRangeAddress;\r
 import org.apache.poi.ss.util.CellReference;\r
@@ -27,13 +32,6 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;\r
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;\r
 import org.openxmlformats.schemas.drawingml.x2006.chart.*;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.*;\r
-import org.openxmlformats.schemas.presentationml.x2006.main.CTConnector;\r
-\r
-import java.awt.*;\r
-import java.io.*;\r
-import java.util.LinkedHashMap;\r
-import java.util.Map;\r
 \r
 /**\r
  * @author Yegor Kozlov\r
index 736f7577ac2f940630ff8593d53691c6156c636f..2eaee22e1f4a7efacf500374e418f9c96d18dfc2 100644 (file)
@@ -63,6 +63,7 @@ public class TestExcelConverterSuite
             final String name = child.getName();
             suite.addTest( new TestCase( name + " [FO]" )
             {
+                @Override
                 public void runTest() throws Exception
                 {
                     testFo( child );
@@ -70,6 +71,7 @@ public class TestExcelConverterSuite
             } );
             suite.addTest( new TestCase( name + " [HTML]" )
             {
+                @Override
                 public void runTest() throws Exception
                 {
                     testHtml( child );
index 43cdd8b856bbedc78ff95b34fdc2618124695562..5920202c75acfd2921640f402f1c12689b265ab4 100644 (file)
 ==================================================================== */\r
 package org.apache.poi.hssf.model;\r
 \r
-import junit.framework.TestCase;\r
-import org.apache.poi.ddf.*;\r
-import org.apache.poi.hssf.HSSFTestDataSamples;\r
-import org.apache.poi.hssf.record.ContinueRecord;\r
-import org.apache.poi.hssf.record.DrawingRecord;\r
-import org.apache.poi.hssf.record.EOFRecord;\r
-import org.apache.poi.hssf.record.EscherAggregate;\r
-import org.apache.poi.hssf.record.NoteRecord;\r
-import org.apache.poi.hssf.record.ObjRecord;\r
-import org.apache.poi.hssf.record.Record;\r
-import org.apache.poi.hssf.record.RecordBase;\r
-import org.apache.poi.hssf.record.RecordFactory;\r
-import org.apache.poi.hssf.record.TextObjectRecord;\r
-import org.apache.poi.hssf.record.WindowTwoRecord;\r
-import org.apache.poi.hssf.record.aggregates.RowRecordsAggregate;\r
-import org.apache.poi.hssf.usermodel.HSSFPatriarch;\r
-import org.apache.poi.hssf.usermodel.HSSFSheet;\r
-import org.apache.poi.hssf.usermodel.HSSFTestHelper;\r
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;\r
-import org.apache.poi.util.HexDump;\r
-import org.apache.poi.util.HexRead;\r
-\r
 import java.io.ByteArrayInputStream;\r
 import java.io.ByteArrayOutputStream;\r
 import java.io.File;\r
@@ -49,6 +27,23 @@ import java.util.HashMap;
 import java.util.List;\r
 import java.util.Map;\r
 \r
+import junit.framework.TestCase;\r
+\r
+import org.apache.poi.ddf.DefaultEscherRecordFactory;\r
+import org.apache.poi.ddf.EscherContainerRecord;\r
+import org.apache.poi.ddf.EscherDggRecord;\r
+import org.apache.poi.ddf.EscherRecord;\r
+import org.apache.poi.ddf.EscherRecordFactory;\r
+import org.apache.poi.hssf.HSSFTestDataSamples;\r
+import org.apache.poi.hssf.record.*;\r
+import org.apache.poi.hssf.record.aggregates.RowRecordsAggregate;\r
+import org.apache.poi.hssf.usermodel.HSSFPatriarch;\r
+import org.apache.poi.hssf.usermodel.HSSFSheet;\r
+import org.apache.poi.hssf.usermodel.HSSFTestHelper;\r
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;\r
+import org.apache.poi.util.HexDump;\r
+import org.apache.poi.util.HexRead;\r
+\r
 /**\r
  * @author Yegor Kozlov\r
  * @author Evgeniy Berlog\r
@@ -179,6 +174,9 @@ public class TestDrawingAggregate extends TestCase {
                     }\r
                 }\r
         );\r
+        assertNotNull(\r
+                "Need to find files in test-data path, had path: " + new File(System.getProperty("POI.testdata.path"), "spreadsheet"), \r
+                xls);\r
         for(File file : xls) {\r
             HSSFWorkbook wb;\r
             try {\r