This patch makes the following changes in org.apache.poi.hpsf: 1) Adds a new class Thumbnail.java to allow manipulation of thumbnail images in Summary Information. 2) Adds some Javadoc comments to Variant.VT_CF to describe the Clipboard Format Variant 3) Removes the UnsupportedOperationException from SummaryInformation.getThumbnail() 4) Modifies Propery.java to allow it to properly handle VT_CF variants 5) Fixes the bad patch I submitted to remove the NCSA references. I didn't diff with the -u option last time, my bad. The new file Thumbnail.java will be attached in a .zip. - Drew *****CVS exited normally with code 1***** ? Thumbnail.java cvs server: Diffing . Index: DocumentSummaryInformation.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java,v retrieving revision 1.2 diff -u -r1.2 DocumentSummaryInformation.java --- DocumentSummaryInformation.java 30 Apr 2002 03:51:02 -0000 1.2 +++ DocumentSummaryInformation.java 1 May 2002 06:10:40 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: HPSFException.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/HPSFException.java,v retrieving revision 1.2 diff -u -r1.2 HPSFException.java --- HPSFException.java 30 Apr 2002 03:51:02 -0000 1.2 +++ HPSFException.java 1 May 2002 06:10:40 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: HPSFRuntimeException.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/HPSFRuntimeException.java,v retrieving revision 1.2 diff -u -r1.2 HPSFRuntimeException.java --- HPSFRuntimeException.java 30 Apr 2002 03:51:02 -0000 1.2 +++ HPSFRuntimeException.java 1 May 2002 06:10:40 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: MarkUnsupportedException.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/MarkUnsupportedException.java,v retrieving revision 1.2 diff -u -r1.2 MarkUnsupportedException.java --- MarkUnsupportedException.java 30 Apr 2002 03:51:02 -0000 1.2 +++ MarkUnsupportedException.java 1 May 2002 06:10:40 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: NoPropertySetStreamException.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/NoPropertySetStreamException.java,v retrieving revision 1.2 diff -u -r1.2 NoPropertySetStreamException.java --- NoPropertySetStreamException.java 30 Apr 2002 03:51:02 -0000 1.2 +++ NoPropertySetStreamException.java 1 May 2002 06:10:40 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: NoSingleSectionException.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/NoSingleSectionException.java,v retrieving revision 1.2 diff -u -r1.2 NoSingleSectionException.java --- NoSingleSectionException.java 30 Apr 2002 03:51:02 -0000 1.2 +++ NoSingleSectionException.java 1 May 2002 06:10:41 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: Property.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/Property.java,v retrieving revision 1.2 diff -u -r1.2 Property.java --- Property.java 30 Apr 2002 03:51:02 -0000 1.2 +++ Property.java 1 May 2002 06:10:41 -0000 @@ -89,6 +89,7 @@ * @see Variant * * @author Rainer Klute (klute@rainer-klute.de) + * @author Drew Varner (Drew.Varner InAndAround sc.edu) * @version $Id: Property.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $ * @since 2002-02-09 */ @@ -202,6 +203,23 @@ while (src[last] == 0 && first <= last) last--; value = new String(src, first, last - first + 1); + break; + } + case Variant.VT_CF: + { + // the first four bytes in src, from + // src[offset] to src[offset + 3] contain + // the DWord for VT_CF, so skip it, we don't + // need it + + // truncate the length of the return array by + // a DWord length (4 bytes) + length = length - DWord.LENGTH; + + final byte[] v = new byte[length]; + for (int i = 0; i < length; i++) + v[i] = src[offset + i + DWord.LENGTH]; + value = v; break; } default: Index: PropertySet.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/PropertySet.java,v retrieving revision 1.2 diff -u -r1.2 PropertySet.java --- PropertySet.java 30 Apr 2002 03:51:02 -0000 1.2 +++ PropertySet.java 1 May 2002 06:10:42 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; @@ -385,7 +377,7 @@ offset += ClassID.LENGTH; sectionCount = new DWord(src, offset).intValue(); offset += DWord.LENGTH; - + /* Read the sections, which are following the header. They * start with an array of section descriptions. Each one * consists of a format ID telling what the section contains Index: PropertySetFactory.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/PropertySetFactory.java,v retrieving revision 1.2 diff -u -r1.2 PropertySetFactory.java --- PropertySetFactory.java 30 Apr 2002 03:51:02 -0000 1.2 +++ PropertySetFactory.java 1 May 2002 06:10:43 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: Section.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/Section.java,v retrieving revision 1.2 diff -u -r1.2 Section.java --- Section.java 30 Apr 2002 03:51:02 -0000 1.2 +++ Section.java 1 May 2002 06:10:43 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: SpecialPropertySet.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/SpecialPropertySet.java,v retrieving revision 1.2 diff -u -r1.2 SpecialPropertySet.java --- SpecialPropertySet.java 30 Apr 2002 03:51:02 -0000 1.2 +++ SpecialPropertySet.java 1 May 2002 06:10:44 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: SummaryInformation.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/SummaryInformation.java,v retrieving revision 1.5 diff -u -r1.5 SummaryInformation.java --- SummaryInformation.java 28 Apr 2002 06:39:55 -0000 1.5 +++ SummaryInformation.java 1 May 2002 06:10:44 -0000 @@ -276,8 +276,6 @@ */ public byte[] getThumbnail() { - if (true) - throw new UnsupportedOperationException("FIXME"); return (byte[]) getProperty(PropertyIDMap.PID_THUMBNAIL); } Index: UnexpectedPropertySetTypeException.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/UnexpectedPropertySetTypeException.java,v retrieving revision 1.2 diff -u -r1.2 UnexpectedPropertySetTypeException.java --- UnexpectedPropertySetTypeException.java 30 Apr 2002 03:51:02 -0000 1.2 +++ UnexpectedPropertySetTypeException.java 1 May 2002 06:10:45 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: Util.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hpsf/Util.java,v retrieving revision 1.2 diff -u -r1.2 Util.java --- Util.java 30 Apr 2002 03:51:02 -0000 1.2 +++ Util.java 1 May 2002 06:10:45 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; Index: Variant.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/Variant.java,v retrieving revision 1.2 diff -u -r1.2 Variant.java --- Variant.java 30 Apr 2002 03:51:02 -0000 1.2 +++ Variant.java 1 May 2002 06:10:46 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf; @@ -307,9 +299,34 @@ public final static int VT_CF = 71; /** - * <p>[P] A Class ID. <span style="background-color: - * #ffff00">How long is this? How is it to be - * interpreted?</span></p> + * <p>[P] A Class ID.</p> + * <p>It consists of a 32 bit unsigned integer indicating the size + * of the structure, a 32 bit signed integer indicating (Clipboard + * Format Tag) indicating the type of data that it contains, and + * then a byte array containing the data.</p> + * + * <p>The valid Clipboard Format Tags are: + * <ul> + * <li>{@link Thumbnail#CFTAG_WINDOWS}</li> + * <li>{@link Thumbnail#CFTAG_MACINTOSH}</li> + * <li>{@link Thumbnail#CFTAG_NODATA}</li> + * <li>{@link Thumbnail#CFTAG_FMTID}</li> + * </ul></p> + * + * <p> + * <pre>typedef struct tagCLIPDATA { + * // cbSize is the size of the buffer pointed to + * // by pClipData, plus sizeof(ulClipFmt) + * ULONG cbSize; + * long ulClipFmt; + * BYTE* pClipData; + * } CLIPDATA;</pre> + * See + * <a href="msdn.microsoft.com/library/en-us/com/stgrstrc_0uwk.asp" + * target="_blank"> + * msdn.microsoft.com/library/en-us/com/stgrstrc_0uwk.asp + * </a> + * </p> */ public final static int VT_CLSID = 72; cvs server: Diffing littleendian cvs server: Diffing wellknown Index: wellknown/PropertyIDMap.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java,v retrieving revision 1.2 diff -u -r1.2 PropertyIDMap.java --- wellknown/PropertyIDMap.java 30 Apr 2002 03:51:03 -0000 1.2 +++ wellknown/PropertyIDMap.java 1 May 2002 06:10:46 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf.wellknown; Index: wellknown/SectionIDMap.java =================================================================== RCS file: /home/cvspublic/jakarta- poi/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java,v retrieving revision 1.2 diff -u -r1.2 SectionIDMap.java --- wellknown/SectionIDMap.java 30 Apr 2002 03:51:03 -0000 1.2 +++ wellknown/SectionIDMap.java 1 May 2002 06:10:47 -0000 @@ -50,14 +50,6 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. -* -* Portions of this software are based upon public domain software -* originally written at the National Center for Supercomputing Applications, -* University of Illinois, Urbana-Champaign. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. */ package org.apache.poi.hpsf.wellknown;
Created attachment 1748 [details] The file Thumbnail.java, part of the patch
Hi Drew, can you *attach* the patch part. Its difficult to get valid patches by cut and paste. Furthermore, can you diff -u again? I've already applied your NCSA removal patch.
Actually Andy, the patch I gave you last time made things worse. I didn't use the -u option on diff, so it added the notice about NCSA public domain software a second time in the license comments. *oops*. Rainer has already applied my patch, closing this Bug.
ouch. sorry about that. hehe... I guess we need unit tests for the comments ;-)