aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java7
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/Rept.java9
-rw-r--r--src/ooxml/java/org/apache/poi/openxml4j/opc/internal/signature/DigitalCertificatePart.java9
-rw-r--r--src/ooxml/java/org/apache/poi/openxml4j/opc/signature/PackageDigitalSignature.java8
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java24
-rw-r--r--src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java24
-rw-r--r--src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java12
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java2
-rw-r--r--src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java42
9 files changed, 65 insertions, 72 deletions
diff --git a/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java b/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
index 535e7781f2..16bc385984 100644
--- a/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
+++ b/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
@@ -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.
diff --git a/src/java/org/apache/poi/ss/formula/functions/Rept.java b/src/java/org/apache/poi/ss/formula/functions/Rept.java
index b93d96915d..0dbb189cdd 100644
--- a/src/java/org/apache/poi/ss/formula/functions/Rept.java
+++ b/src/java/org/apache/poi/ss/formula/functions/Rept.java
@@ -17,10 +17,11 @@
package org.apache.poi.ss.formula.functions;
-import org.apache.poi.ss.formula.OperationEvaluationContext;
-import org.apache.poi.ss.formula.eval.*;
-
-import java.math.BigDecimal;
+import org.apache.poi.ss.formula.eval.ErrorEval;
+import org.apache.poi.ss.formula.eval.EvaluationException;
+import org.apache.poi.ss.formula.eval.OperandResolver;
+import org.apache.poi.ss.formula.eval.StringEval;
+import org.apache.poi.ss.formula.eval.ValueEval;
/**
* Implementation for Excel REPT () function.<p/>
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/signature/DigitalCertificatePart.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/signature/DigitalCertificatePart.java
index 19ba500f2e..797f12f02a 100644
--- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/signature/DigitalCertificatePart.java
+++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/signature/DigitalCertificatePart.java
@@ -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;
}
-
}
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/signature/PackageDigitalSignature.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/signature/PackageDigitalSignature.java
index c7a9b8f7ea..370e52e512 100644
--- a/src/ooxml/java/org/apache/poi/openxml4j/opc/signature/PackageDigitalSignature.java
+++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/signature/PackageDigitalSignature.java
@@ -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;
}
}
diff --git a/src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java b/src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java
index 09dccdff1e..b6523bedde 100644
--- a/src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java
+++ b/src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java
@@ -16,6 +16,10 @@
==================================================================== */
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;
}
diff --git a/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java b/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java
index bba2f5bd15..c6d2bd7058 100644
--- a/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java
+++ b/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java
@@ -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);
+ }
}
diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java
index 628767ecae..941c44b7f6 100644
--- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java
+++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java
@@ -18,7 +18,12 @@
*/
package org.apache.poi.xslf.usermodel;
+import java.io.OutputStream;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
import junit.framework.TestCase;
+
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellReference;
@@ -27,13 +32,6 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openxmlformats.schemas.drawingml.x2006.chart.*;
-import org.openxmlformats.schemas.drawingml.x2006.main.*;
-import org.openxmlformats.schemas.presentationml.x2006.main.CTConnector;
-
-import java.awt.*;
-import java.io.*;
-import java.util.LinkedHashMap;
-import java.util.Map;
/**
* @author Yegor Kozlov
diff --git a/src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java b/src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java
index 736f7577ac..2eaee22e1f 100644
--- a/src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java
+++ b/src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java
@@ -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 );
diff --git a/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java b/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
index 43cdd8b856..5920202c75 100644
--- a/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
+++ b/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
@@ -16,28 +16,6 @@
==================================================================== */
package org.apache.poi.hssf.model;
-import junit.framework.TestCase;
-import org.apache.poi.ddf.*;
-import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.record.ContinueRecord;
-import org.apache.poi.hssf.record.DrawingRecord;
-import org.apache.poi.hssf.record.EOFRecord;
-import org.apache.poi.hssf.record.EscherAggregate;
-import org.apache.poi.hssf.record.NoteRecord;
-import org.apache.poi.hssf.record.ObjRecord;
-import org.apache.poi.hssf.record.Record;
-import org.apache.poi.hssf.record.RecordBase;
-import org.apache.poi.hssf.record.RecordFactory;
-import org.apache.poi.hssf.record.TextObjectRecord;
-import org.apache.poi.hssf.record.WindowTwoRecord;
-import org.apache.poi.hssf.record.aggregates.RowRecordsAggregate;
-import org.apache.poi.hssf.usermodel.HSSFPatriarch;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFTestHelper;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.util.HexDump;
-import org.apache.poi.util.HexRead;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -49,6 +27,23 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import junit.framework.TestCase;
+
+import org.apache.poi.ddf.DefaultEscherRecordFactory;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherDggRecord;
+import org.apache.poi.ddf.EscherRecord;
+import org.apache.poi.ddf.EscherRecordFactory;
+import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.hssf.record.*;
+import org.apache.poi.hssf.record.aggregates.RowRecordsAggregate;
+import org.apache.poi.hssf.usermodel.HSSFPatriarch;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFTestHelper;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.HexRead;
+
/**
* @author Yegor Kozlov
* @author Evgeniy Berlog
@@ -179,6 +174,9 @@ public class TestDrawingAggregate extends TestCase {
}
}
);
+ assertNotNull(
+ "Need to find files in test-data path, had path: " + new File(System.getProperty("POI.testdata.path"), "spreadsheet"),
+ xls);
for(File file : xls) {
HSSFWorkbook wb;
try {