From ee734212a92dcff694cbc0e8b8d9fa5aa52119fe Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 12 Jan 2011 17:22:40 +0000 Subject: [PATCH] HMEF dumping and properties tweaks git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1058243 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/hmef/MAPIAttribute.java | 6 ++--- .../org/apache/poi/hmef/dev/HMEFDumper.java | 23 ++++++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hmef/MAPIAttribute.java b/src/scratchpad/src/org/apache/poi/hmef/MAPIAttribute.java index 81629e1db5..badf25ce71 100644 --- a/src/scratchpad/src/org/apache/poi/hmef/MAPIAttribute.java +++ b/src/scratchpad/src/org/apache/poi/hmef/MAPIAttribute.java @@ -104,7 +104,8 @@ public class MAPIAttribute { MAPIProperty prop = MAPIProperty.get(id); if(id >= 0x8000 && id <= 0xFFFF) { // TODO - throw new UnsupportedOperationException("Not yet implemented for id " + id); + System.err.println("Not yet implemented for id " + id); + break; } // Now read in the value(s) @@ -128,11 +129,10 @@ public class MAPIAttribute { // Data is always padded out to a 4 byte boundary if(len % 4 != 0) { - byte[] padding = new byte[len % 4]; + byte[] padding = new byte[4 - (len % 4)]; IOUtils.readFully(inp, padding); } } - break; } // All done diff --git a/src/scratchpad/src/org/apache/poi/hmef/dev/HMEFDumper.java b/src/scratchpad/src/org/apache/poi/hmef/dev/HMEFDumper.java index 133e9a6345..a64a558a17 100644 --- a/src/scratchpad/src/org/apache/poi/hmef/dev/HMEFDumper.java +++ b/src/scratchpad/src/org/apache/poi/hmef/dev/HMEFDumper.java @@ -37,15 +37,24 @@ public final class HMEFDumper { throw new IllegalArgumentException("Filename must be given"); } - for(String filename : args) { + boolean truncatePropData = true; + for(int i=0; i 0) { - int len = Math.min( attr.getData().length, 48 ); + int len = attr.getData().length; + if(truncatePropertyData) { + len = Math.min( attr.getData().length, 48 ); + } + int loops = len/16; if(loops == 0) loops = 1; -- 2.39.5