aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/integrationtest/org/apache/poi/stress/SlideShowHandler.java28
-rw-r--r--src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java11
-rw-r--r--src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java4
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java3
4 files changed, 23 insertions, 23 deletions
diff --git a/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java b/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java
index 9c0e7316d0..8e426a1d98 100644
--- a/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java
+++ b/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java
@@ -50,7 +50,7 @@ public abstract class SlideShowHandler extends POIFSFileHandler {
// write out the file
ByteArrayOutputStream out = writeToArray(ss);
-
+
readContent(ss);
// read in the written file
@@ -67,11 +67,11 @@ public abstract class SlideShowHandler extends POIFSFileHandler {
} finally {
stream.close();
}
-
+
return stream;
}
-
+
private void readContent(SlideShow<?,?> ss) {
for (Slide<?,?> s : ss.getSlides()) {
s.getTitle();
@@ -96,8 +96,8 @@ public abstract class SlideShowHandler extends POIFSFileHandler {
private void readShapes(Shape<?,?> s) {
// recursively walk group-shapes
if(s instanceof GroupShape) {
- GroupShape<? extends Shape, ?> shapes = (GroupShape<? extends Shape, ?>) s;
- for (Shape<? extends Shape, ?> shape : shapes) {
+ GroupShape<? extends Shape<?,?>, ?> shapes = (GroupShape<? extends Shape<?,?>, ?>) s;
+ for (Shape<? extends Shape<?,?>, ?> shape : shapes) {
readShapes(shape);
}
}
@@ -123,20 +123,22 @@ public abstract class SlideShowHandler extends POIFSFileHandler {
}
}
}
-
+
private void readPictures(SlideShow<?,?> ss) {
for (PictureData pd : ss.getPictureData()) {
Dimension dim = pd.getImageDimension();
- assertTrue(dim.getHeight() >= 0);
- assertTrue(dim.getWidth() >= 0);
+ assertTrue("Expecting a valid height, but had an image with height: " + dim.getHeight(),
+ dim.getHeight() >= 0);
+ assertTrue("Expecting a valid width, but had an image with width: " + dim.getWidth(),
+ dim.getWidth() >= 0);
}
}
-
+
private void renderSlides(SlideShow<?,?> ss) {
- Dimension pgsize = ss.getPageSize();
+ Dimension pgSize = ss.getPageSize();
for (Slide<?,?> s : ss.getSlides()) {
- BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_ARGB);
+ BufferedImage img = new BufferedImage(pgSize.width, pgSize.height, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = img.createGraphics();
// default rendering options
@@ -145,10 +147,10 @@ public abstract class SlideShowHandler extends POIFSFileHandler {
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
graphics.setRenderingHint(Drawable.BUFFERED_IMAGE, new WeakReference<>(img));
-
+
// draw stuff
s.draw(graphics);
-
+
graphics.dispose();
img.flush();
}
diff --git a/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java b/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java
index 448ae11a06..1765e2588e 100644
--- a/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java
+++ b/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java
@@ -89,13 +89,10 @@ public final class HeaderFooterRecord extends StandardRecord {
}
public String toString() {
- StringBuilder sb = new StringBuilder();
-
- sb.append('[').append("HEADERFOOTER").append("] (0x");
- sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT)).append(")\n");
- sb.append(" rawData=").append(HexDump.toHex(_rawData)).append("\n");
- sb.append("[/").append("HEADERFOOTER").append("]\n");
- return sb.toString();
+ return '[' + "HEADERFOOTER" + "] (0x" +
+ Integer.toHexString(sid).toUpperCase(Locale.ROOT) + ")\n" +
+ " rawData=" + HexDump.toHex(_rawData) + "\n" +
+ "[/" + "HEADERFOOTER" + "]\n";
}
@Override
diff --git a/src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java b/src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java
index 2a19670f1f..ae6e8fdad7 100644
--- a/src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java
+++ b/src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java
@@ -60,7 +60,7 @@ public abstract class HPBFPart {
dir = (DirectoryNode)dir.getEntry(path[i]);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("File invalid - failed to find directory entry '"
- + path[i] + "'");
+ + path[i] + "': " + e);
}
}
return dir;
@@ -101,7 +101,7 @@ public abstract class HPBFPart {
public final byte[] getData() {
return data;
}
-
+
protected final void setData(byte[] data) {
this.data = data.clone();
}
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java
index ee6e15051d..adf2c75e5d 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java
@@ -64,7 +64,8 @@ public class ComplexFileTable {
this._grpprls = sprmBuffers.toArray(new SprmBuffer[0]);
if (tableStream[offset] != TEXT_PIECE_TABLE_TYPE) {
- throw new IOException("The text piece table is corrupted");
+ throw new IOException("The text piece table is corrupted, expected byte value " + TEXT_PIECE_TABLE_TYPE +
+ " but had " + tableStream[offset]);
}
int pieceTableSize = LittleEndian.getInt(tableStream, ++offset);
offset += LittleEndian.INT_SIZE;