You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2009/10/09 00:29:43 UTC

svn commit: r823348 [3/4] - in /poi/trunk/src: contrib/src/org/apache/poi/hssf/contrib/view/ contrib/src/org/apache/poi/ss/usermodel/contrib/ examples/src/org/apache/poi/hpsf/examples/ java/org/apache/poi/ddf/ java/org/apache/poi/hpsf/ java/org/apache/...

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java Thu Oct  8 22:29:41 2009
@@ -217,7 +217,7 @@
      * @return name of the record
      */
     public static String recordName(int type) {
-        String name = (String)typeToName.get(new Integer(type));
+        String name = (String)typeToName.get(Integer.valueOf(type));
         if (name == null) name = "Unknown" + type;
         return name;
     }
@@ -232,7 +232,7 @@
      * @return class to handle the record, or null if an unknown (eg Escher) record
      */
 	public static Class recordHandlingClass(int type) {
-		Class c = (Class)typeToClass.get(new Integer(type));
+		Class c = (Class)typeToClass.get(Integer.valueOf(type));
 		return c;
 	}
 
@@ -252,7 +252,7 @@
 				if (val instanceof Type) {
 					Type t = (Type)val;
 					Class c = t.handlingClass;
-					Integer id = new Integer(t.typeID);
+					Integer id = Integer.valueOf(t.typeID);
 					if(c == null) { c = UnknownRecordPlaceholder.class; }
 
                     typeToName.put(id, f[i].getName());

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java Thu Oct  8 22:29:41 2009
@@ -124,7 +124,7 @@
 	public void updateOtherRecordReferences(Hashtable oldToNewReferencesLookup) {
 		// Look up the new positions of our preceding UserEditAtomOffset
 		if(lastUserEditAtomOffset != 0) {
-			Integer newLocation = (Integer)oldToNewReferencesLookup.get(new Integer(lastUserEditAtomOffset));
+			Integer newLocation = (Integer)oldToNewReferencesLookup.get(Integer.valueOf(lastUserEditAtomOffset));
 			if(newLocation == null) {
 				throw new RuntimeException("Couldn't find the new location of the UserEditAtom that used to be at " + lastUserEditAtomOffset);
 			}
@@ -132,7 +132,7 @@
 		}
 
 		// Ditto for our PersistPtr
-		Integer newLocation = (Integer)oldToNewReferencesLookup.get(new Integer(persistPointersOffset));
+		Integer newLocation = (Integer)oldToNewReferencesLookup.get(Integer.valueOf(persistPointersOffset));
 		if(newLocation == null) {
 			throw new RuntimeException("Couldn't find the new location of the PersistPtr that used to be at " + persistPointersOffset);
 		}

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java Thu Oct  8 22:29:41 2009
@@ -162,7 +162,7 @@
 				// PersistPtr, remove their old positions
 				int[] ids = pph.getKnownSlideIDs();
 				for (int j = 0; j < ids.length; j++) {
-					Integer id = new Integer(ids[j]);
+					Integer id = Integer.valueOf(ids[j]);
 					if (mostRecentByBytes.containsKey(id)) {
 						mostRecentByBytes.remove(id);
 					}
@@ -171,7 +171,7 @@
 				// Now, update the byte level locations with their latest values
 				Hashtable thisSetOfLocations = pph.getSlideLocationsLookup();
 				for (int j = 0; j < ids.length; j++) {
-					Integer id = new Integer(ids[j]);
+					Integer id = Integer.valueOf(ids[j]);
 					mostRecentByBytes.put(id, thisSetOfLocations.get(id));
 				}
 			}
@@ -192,18 +192,18 @@
 		}
 		Arrays.sort(allIDs);
 		for (int i = 0; i < allIDs.length; i++) {
-			_sheetIdToCoreRecordsLookup.put(new Integer(allIDs[i]), new Integer(i));
+			_sheetIdToCoreRecordsLookup.put(Integer.valueOf(allIDs[i]), Integer.valueOf(i));
 		}
 
 		// Now convert the byte offsets back into record offsets
 		for (int i = 0; i < _records.length; i++) {
 			if (_records[i] instanceof PositionDependentRecord) {
 				PositionDependentRecord pdr = (PositionDependentRecord) _records[i];
-				Integer recordAt = new Integer(pdr.getLastOnDiskOffset());
+				Integer recordAt = Integer.valueOf(pdr.getLastOnDiskOffset());
 
 				// Is it one we care about?
 				for (int j = 0; j < allIDs.length; j++) {
-					Integer thisID = new Integer(allIDs[j]);
+					Integer thisID = Integer.valueOf(allIDs[j]);
 					Integer thatRecordAt = (Integer) mostRecentByBytes.get(thisID);
 
 					if (thatRecordAt.equals(recordAt)) {
@@ -258,7 +258,7 @@
 	 *            the refID
 	 */
 	private Record getCoreRecordForRefID(int refID) {
-		Integer coreRecordId = (Integer) _sheetIdToCoreRecordsLookup.get(new Integer(refID));
+		Integer coreRecordId = (Integer) _sheetIdToCoreRecordsLookup.get(Integer.valueOf(refID));
 		if (coreRecordId != null) {
 			Record r = _mostRecentCoreRecords[coreRecordId.intValue()];
 			return r;
@@ -364,8 +364,8 @@
 
 					// Record the match between slide id and these notes
 					SlidePersistAtom spa = notesSets[i].getSlidePersistAtom();
-					Integer slideId = new Integer(spa.getSlideIdentifier());
-					slideIdToNotes.put(slideId, new Integer(i));
+					Integer slideId = Integer.valueOf(spa.getSlideIdentifier());
+					slideIdToNotes.put(slideId, Integer.valueOf(i));
 				} else {
 					logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i
 							+ " said its record was at refID "
@@ -422,7 +422,7 @@
 			// 0 if slide has no notes.
 			int noteId = slidesRecords[i].getSlideAtom().getNotesID();
 			if (noteId != 0) {
-				Integer notesPos = (Integer) slideIdToNotes.get(new Integer(noteId));
+				Integer notesPos = (Integer) slideIdToNotes.get(Integer.valueOf(noteId));
 				if (notesPos != null)
 					notes = _notes[notesPos.intValue()];
 				else

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java Thu Oct  8 22:29:41 2009
@@ -146,7 +146,7 @@
       fieldOffset += LittleEndian.INT_SIZE;
       int dsSize = LittleEndian.getInt(mainStream, fieldOffset);
 
-      if (offsetList.contains(new Integer(x)) ^ areKnown)
+      if (offsetList.contains(Integer.valueOf(x)) ^ areKnown)
       {
         if (dsSize > 0)
         {
@@ -160,7 +160,7 @@
           {
             UnhandledDataStructure unhandled = new UnhandledDataStructure(
               tableStream, dsOffset, dsSize);
-            _unknownMap.put(new Integer(x), unhandled);
+            _unknownMap.put(Integer.valueOf(x), unhandled);
           }
         }
       }
@@ -208,7 +208,7 @@
 
     for (int x = 0; x < length; x++)
     {
-      UnhandledDataStructure ds = (UnhandledDataStructure)_unknownMap.get(new Integer(x));
+      UnhandledDataStructure ds = (UnhandledDataStructure)_unknownMap.get(Integer.valueOf(x));
       if (ds != null)
       {
         LittleEndian.putInt(mainStream, offset, tableStream.getOffset());

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FSPATable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FSPATable.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FSPATable.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FSPATable.java Thu Oct  8 22:29:41 2009
@@ -48,13 +48,13 @@
             FSPA fspa = new FSPA(property.getBytes(), 0);
 
             _shapes.add(fspa);
-            _shapeIndexesByPropertyStart.put(new Integer(property.getStart()), new Integer(i));
+            _shapeIndexesByPropertyStart.put(Integer.valueOf(property.getStart()), Integer.valueOf(i));
         }
     }
 
     public FSPA getFspaFromCp(int cp)
     {
-        Integer idx = (Integer)_shapeIndexesByPropertyStart.get(new Integer(cp));
+        Integer idx = (Integer)_shapeIndexesByPropertyStart.get(Integer.valueOf(cp));
         if (idx == null) {
             return null;
         }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java Thu Oct  8 22:29:41 2009
@@ -58,18 +58,18 @@
     public void fillVariableFields(byte[] mainDocument, byte[] tableStream)
     {
       HashSet fieldSet = new HashSet();
-      fieldSet.add(new Integer(FIBFieldHandler.STSHF));
-      fieldSet.add(new Integer(FIBFieldHandler.CLX));
-      fieldSet.add(new Integer(FIBFieldHandler.DOP));
-      fieldSet.add(new Integer(FIBFieldHandler.PLCFBTECHPX));
-      fieldSet.add(new Integer(FIBFieldHandler.PLCFBTEPAPX));
-      fieldSet.add(new Integer(FIBFieldHandler.PLCFSED));
-      fieldSet.add(new Integer(FIBFieldHandler.PLCFLST));
-      fieldSet.add(new Integer(FIBFieldHandler.PLFLFO));
-      fieldSet.add(new Integer(FIBFieldHandler.PLCFFLDMOM));
-      fieldSet.add(new Integer(FIBFieldHandler.STTBFFFN));
-      fieldSet.add(new Integer(FIBFieldHandler.STTBSAVEDBY));
-      fieldSet.add(new Integer(FIBFieldHandler.MODIFIED));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.STSHF));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.CLX));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.DOP));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.PLCFBTECHPX));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.PLCFBTEPAPX));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.PLCFSED));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.PLCFLST));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.PLFLFO));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.PLCFFLDMOM));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.STTBFFFN));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.STTBSAVEDBY));
+      fieldSet.add(Integer.valueOf(FIBFieldHandler.MODIFIED));
 
 
       _shortHandler = new FIBShortHandler(mainDocument);

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java Thu Oct  8 22:29:41 2009
@@ -58,7 +58,7 @@
     for (int x = 0; x < length; x++)
     {
       ListData lst = new ListData(tableStream, lstOffset);
-      _listMap.put(new Integer(lst.getLsid()), lst);
+      _listMap.put(Integer.valueOf(lst.getLsid()), lst);
       lstOffset += LIST_DATA_SIZE;
 
       int num = lst.numLevels();
@@ -96,12 +96,12 @@
   public int addList(ListData lst, ListFormatOverride override)
   {
     int lsid = lst.getLsid();
-    while (_listMap.get(new Integer(lsid)) != null)
+    while (_listMap.get(Integer.valueOf(lsid)) != null)
     {
       lsid = lst.resetListID();
       override.setLsid(lsid);
     }
-    _listMap.put(new Integer(lsid), lst);
+    _listMap.put(Integer.valueOf(lsid), lst);
     _overrideList.add(override);
     return lsid;
   }
@@ -190,7 +190,7 @@
 
   public ListLevel getLevel(int listID, int level)
   {
-    ListData lst = (ListData)_listMap.get(new Integer(listID));
+    ListData lst = (ListData)_listMap.get(Integer.valueOf(listID));
     if(level < lst.numLevels()) {
     	ListLevel lvl = lst.getLevels()[level];
     	return lvl;
@@ -201,7 +201,7 @@
 
   public ListData getListData(int listID)
   {
-    return (ListData) _listMap.get(new Integer(listID));
+    return (ListData) _listMap.get(Integer.valueOf(listID));
   }
 
   public boolean equals(Object obj)

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java Thu Oct  8 22:29:41 2009
@@ -400,12 +400,12 @@
     HashMap tabMap = new HashMap();
     for (int x = 0; x < tabPositions.length; x++)
     {
-      tabMap.put(new Integer(tabPositions[x]), new Byte(tabDescriptors[x]));
+      tabMap.put(Integer.valueOf(tabPositions[x]), Byte.valueOf(tabDescriptors[x]));
     }
 
     for (int x = 0; x < delSize; x++)
     {
-      tabMap.remove(new Integer(LittleEndian.getShort(grpprl, offset)));
+      tabMap.remove(Integer.valueOf(LittleEndian.getShort(grpprl, offset)));
       offset += LittleEndian.SHORT_SIZE;
     }
 
@@ -413,8 +413,8 @@
     int start = offset;
     for (int x = 0; x < addSize; x++)
     {
-      Integer key = new Integer(LittleEndian.getShort(grpprl, offset));
-      Byte val = new Byte(grpprl[start + ((LittleEndian.SHORT_SIZE * addSize) + x)]);
+      Integer key = Integer.valueOf(LittleEndian.getShort(grpprl, offset));
+      Byte val = Byte.valueOf(grpprl[start + ((LittleEndian.SHORT_SIZE * addSize) + x)]);
       tabMap.put(key, val);
       offset += LittleEndian.SHORT_SIZE;
     }
@@ -452,20 +452,20 @@
 //    HashMap tabMap = new HashMap();
 //    for (int x = 0; x < tabPositions.length; x++)
 //    {
-//      tabMap.put(new Integer(tabPositions[x]), new Byte(tabDescriptors[x]));
+//      tabMap.put(Integer.valueOf(tabPositions[x]), Byte.valueOf(tabDescriptors[x]));
 //    }
 //
 //    for (int x = 0; x < delSize; x++)
 //    {
-//      tabMap.remove(new Integer(LittleEndian.getInt(grpprl, offset)));
+//      tabMap.remove(Integer.valueOf(LittleEndian.getInt(grpprl, offset)));
 //      offset += LittleEndian.INT_SIZE;;
 //    }
 //
 //    int addSize = grpprl[offset++];
 //    for (int x = 0; x < addSize; x++)
 //    {
-//      Integer key = new Integer(LittleEndian.getInt(grpprl, offset));
-//      Byte val = new Byte(grpprl[(LittleEndian.INT_SIZE * (addSize - x)) + x]);
+//      Integer key = Integer.valueOf(LittleEndian.getInt(grpprl, offset));
+//      Byte val = Byte.valueOf(grpprl[(LittleEndian.INT_SIZE * (addSize - x)) + x]);
 //      tabMap.put(key, val);
 //      offset += LittleEndian.INT_SIZE;
 //    }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java Thu Oct  8 22:29:41 2009
@@ -59,16 +59,16 @@
 		Record[] r = wss.getRecords();
 		Hashtable pp = new Hashtable();
 		Hashtable ue = new Hashtable();
-		ue.put(new Integer(0),new Integer(0)); // Will show 0 if first
+		ue.put(Integer.valueOf(0),Integer.valueOf(0)); // Will show 0 if first
 		int pos = 0;
 		int lastUEPos = -1;
 
 		for(int i=0; i<r.length; i++) {
 			if(r[i] instanceof PersistPtrHolder) {
-				pp.put(new Integer(pos), r[i]);
+				pp.put(Integer.valueOf(pos), r[i]);
 			}
 			if(r[i] instanceof UserEditAtom) {
-				ue.put(new Integer(pos), r[i]);
+				ue.put(Integer.valueOf(pos), r[i]);
 				lastUEPos = pos;
 			}
 
@@ -84,8 +84,8 @@
 				int luPos = uea.getLastUserEditAtomOffset();
 				int ppPos = uea.getPersistPointersOffset();
 
-				assertTrue(pp.containsKey(new Integer(ppPos)));
-				assertTrue(ue.containsKey(new Integer(luPos)));
+				assertTrue(pp.containsKey(Integer.valueOf(ppPos)));
+				assertTrue(ue.containsKey(Integer.valueOf(luPos)));
 			}
 		}
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java Thu Oct  8 22:29:41 2009
@@ -109,15 +109,15 @@
 
         //map slide number and starting phrase of its notes
         Map<Integer, String> notesMap = new HashMap<Integer, String>();
-        notesMap.put(new Integer(4), "For  decades before calculators");
-        notesMap.put(new Integer(5), "Several commercial applications");
-        notesMap.put(new Integer(6), "There are three variations of LNS that are discussed here");
-        notesMap.put(new Integer(7), "Although multiply and square root are easier");
-        notesMap.put(new Integer(8), "The bus Z is split into Z_H and Z_L");
+        notesMap.put(Integer.valueOf(4), "For  decades before calculators");
+        notesMap.put(Integer.valueOf(5), "Several commercial applications");
+        notesMap.put(Integer.valueOf(6), "There are three variations of LNS that are discussed here");
+        notesMap.put(Integer.valueOf(7), "Although multiply and square root are easier");
+        notesMap.put(Integer.valueOf(8), "The bus Z is split into Z_H and Z_L");
 
         Slide[] slide = ppt.getSlides();
         for (int i = 0; i < slide.length; i++) {
-            Integer slideNumber = new Integer(slide[i].getSlideNumber());
+            Integer slideNumber = Integer.valueOf(slide[i].getSlideNumber());
             Notes notes = slide[i].getNotesSheet();
             if (notesMap.containsKey(slideNumber)){
                 assertNotNull(notes);

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java Thu Oct  8 22:29:41 2009
@@ -43,117 +43,80 @@
 /**
  * Basing on: src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java
  * This class tests reading and writing of meta data. No actual document is created. All information
- * is stored in a virtal document in a ByteArrayOutputStream
+ * is stored in a virtual document in a ByteArrayOutputStream
  * @author Matthias G\u00fcnter
  */
-public class TestMetaDataIPI extends TestCase{
+public final class TestMetaDataIPI extends TestCase{
 
- private ByteArrayOutputStream bout= null; //our store
- private POIFSFileSystem poifs=null;
- DirectoryEntry dir = null;
- DocumentSummaryInformation dsi=null;
- SummaryInformation si=null;
- 
-
-
- /**
-  * Setup is used to get the document ready. Gets the DocumentSummaryInformation and the 
-  * SummaryInformation to reasonable values
-  */
- public void setUp(){
-	 bout=new ByteArrayOutputStream();
-	 poifs= new POIFSFileSystem();
-     dir = poifs.getRoot();
-     dsi=null;
-     try
-     {
-         DocumentEntry dsiEntry = (DocumentEntry)
-             dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
-         DocumentInputStream dis = new DocumentInputStream(dsiEntry);
-         PropertySet ps = new PropertySet(dis);
-         dis.close();
-         dsi = new DocumentSummaryInformation(ps);
-       
-         
-     }
-     catch (FileNotFoundException ex)
-     {
-         /* There is no document summary information yet. We have to create a
-          * new one. */
-         dsi = PropertySetFactory.newDocumentSummaryInformation();
-         assertNotNull(dsi);
-     } catch (IOException e) {
-		e.printStackTrace();
-		fail();
-	} catch (NoPropertySetStreamException e) {
-		e.printStackTrace();
-		fail();
-	} catch (MarkUnsupportedException e) {
-		e.printStackTrace();
-		fail();
-	} catch (UnexpectedPropertySetTypeException e) {
-		e.printStackTrace();
-		fail();
-	}
-    assertNotNull(dsi);
-    try
-    {
-        DocumentEntry dsiEntry = (DocumentEntry)
-            dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
-        DocumentInputStream dis = new DocumentInputStream(dsiEntry);
-        PropertySet ps = new PropertySet(dis);
-        dis.close();
-        si = new SummaryInformation(ps);
-      
-        
-    }
-    catch (FileNotFoundException ex)
-    {
-        /* There is no document summary information yet. We have to create a
-         * new one. */
-        si = PropertySetFactory.newSummaryInformation();
-        assertNotNull(si);
-    } catch (IOException e) {
-		e.printStackTrace();
-		fail();
-	} catch (NoPropertySetStreamException e) {
-		e.printStackTrace();
-		fail();
-	} catch (MarkUnsupportedException e) {
-		e.printStackTrace();
-		fail();
-	} catch (UnexpectedPropertySetTypeException e) {
-		e.printStackTrace();
-		fail();
-	}
-	assertNotNull(dsi);
-    
-    
- }
- 
- /**
-  * Setting a lot of things to null.
-  */
- public void tearDown(){
-	bout=null;
-	poifs=null;
-	dir=null;
-	dsi=null;
-	 
- }
- 
- 
- /**
-  * Closes the ByteArrayOutputStream and reads it into a ByteArrayInputStream.
-  * When finished writing information this method is used in the tests to
-  * start reading from the created document and then the see if the results match.
-  *
-  */
-  public void closeAndReOpen(){
-	     
-	     try {
+	private ByteArrayOutputStream bout; //our store
+	private POIFSFileSystem poifs;
+	private DirectoryEntry dir;
+	private DocumentSummaryInformation dsi;
+	private SummaryInformation si;
+
+
+
+	/**
+	 * Setup is used to get the document ready. Gets the DocumentSummaryInformation and the
+	 * SummaryInformation to reasonable values
+	 */
+	public void setUp() {
+		bout = new ByteArrayOutputStream();
+		poifs = new POIFSFileSystem();
+		dir = poifs.getRoot();
+		dsi = null;
+		try {
+			DocumentEntry dsiEntry = (DocumentEntry) dir
+					.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+			DocumentInputStream dis = new DocumentInputStream(dsiEntry);
+			PropertySet ps = new PropertySet(dis);
+			dis.close();
+			dsi = new DocumentSummaryInformation(ps);
+
+		} catch (FileNotFoundException ex) {
+			/*
+			 * There is no document summary information yet. We have to create a
+			 * new one.
+			 */
+			dsi = PropertySetFactory.newDocumentSummaryInformation();
+			assertNotNull(dsi);
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail();
+		}
+		assertNotNull(dsi);
+		try {
+			DocumentEntry dsiEntry = (DocumentEntry) dir
+					.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
+			DocumentInputStream dis = new DocumentInputStream(dsiEntry);
+			PropertySet ps = new PropertySet(dis);
+			dis.close();
+			si = new SummaryInformation(ps);
+
+		} catch (FileNotFoundException ex) {
+			/*
+			 * There is no document summary information yet. We have to create a
+			 * new one.
+			 */
+			si = PropertySetFactory.newSummaryInformation();
+			assertNotNull(si);
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail();
+		}
+		assertNotNull(dsi);
+	}
+
+	/**
+	 * Closes the ByteArrayOutputStream and reads it into a ByteArrayInputStream.
+	 * When finished writing information this method is used in the tests to
+	 * start reading from the created document and then the see if the results match.
+	 */
+	public void closeAndReOpen() {
+
+		try {
 			dsi.write(dir, DocumentSummaryInformation.DEFAULT_STREAM_NAME);
-			si.write(dir,SummaryInformation.DEFAULT_STREAM_NAME);
+			si.write(dir, SummaryInformation.DEFAULT_STREAM_NAME);
 		} catch (WritingNotSupportedException e) {
 			e.printStackTrace();
 			fail();
@@ -162,659 +125,592 @@
 			fail();
 		}
 
-        si=null;
-        dsi=null;
+		si = null;
+		dsi = null;
 		try {
-			
 			poifs.writeFilesystem(bout);
 			bout.flush();
-			
 		} catch (IOException e) {
-
 			e.printStackTrace();
 			fail();
 		}
-	     
-	     InputStream is=new ByteArrayInputStream(bout.toByteArray());
-	   assertNotNull(is);
-	   POIFSFileSystem poifs=null;
+
+		InputStream is = new ByteArrayInputStream(bout.toByteArray());
+		assertNotNull(is);
+		POIFSFileSystem poifs = null;
 		try {
 			poifs = new POIFSFileSystem(is);
 		} catch (IOException e) {
-
 			e.printStackTrace();
 			fail();
 		}
-	     try {
+		try {
 			is.close();
 		} catch (IOException e) {
 			e.printStackTrace();
 			fail();
 		}
-	    assertNotNull(poifs);
-	     /* Read the document summary information. */
-	     DirectoryEntry dir = poifs.getRoot();
-	     
-	     try
-	     {
-	         DocumentEntry dsiEntry = (DocumentEntry)
-	             dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
-	         DocumentInputStream dis = new DocumentInputStream(dsiEntry);
-	         PropertySet ps = new PropertySet(dis);
-	         dis.close();
-	         dsi = new DocumentSummaryInformation(ps);
-	     }
-	     catch (FileNotFoundException ex)
-	     {
-	         fail();
-	     } catch (IOException e) {
-			e.printStackTrace();
+		assertNotNull(poifs);
+		/* Read the document summary information. */
+		DirectoryEntry dir = poifs.getRoot();
+
+		try {
+			DocumentEntry dsiEntry = (DocumentEntry) dir
+					.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+			DocumentInputStream dis = new DocumentInputStream(dsiEntry);
+			PropertySet ps = new PropertySet(dis);
+			dis.close();
+			dsi = new DocumentSummaryInformation(ps);
+		} catch (FileNotFoundException ex) {
 			fail();
-		} catch (NoPropertySetStreamException e) {
+		} catch (Exception e) {
 			e.printStackTrace();
 			fail();
-		} catch (MarkUnsupportedException e) {
+		}
+		try {
+			DocumentEntry dsiEntry = (DocumentEntry) dir
+					.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
+			DocumentInputStream dis = new DocumentInputStream(dsiEntry);
+			PropertySet ps = new PropertySet(dis);
+			dis.close();
+			si = new SummaryInformation(ps);
+
+		} catch (FileNotFoundException ex) {
+			/*
+			 * There is no document summary information yet. We have to create a
+			 * new one.
+			 */
+			si = PropertySetFactory.newSummaryInformation();
+			assertNotNull(si);
+		} catch (Exception e) {
 			e.printStackTrace();
 			fail();
-		} catch (UnexpectedPropertySetTypeException e) {
-			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Sets the most important information in DocumentSummaryInformation and Summary Information and rereads it
+	 */
+	public void testOne() {
+
+		// DocumentSummaryInformation
+		dsi.setCompany("xxxCompanyxxx");
+		dsi.setManager("xxxManagerxxx");
+		dsi.setCategory("xxxCategoryxxx");
+
+		// SummaryInformation
+		si.setTitle("xxxTitlexxx");
+		si.setAuthor("xxxAuthorxxx");
+		si.setComments("xxxCommentsxxx");
+		si.setKeywords("xxxKeyWordsxxx");
+		si.setSubject("xxxSubjectxxx");
+
+		// Custom Properties (in DocumentSummaryInformation
+		CustomProperties customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
+			customProperties = new CustomProperties();
+		}
+
+		/* Insert some custom properties into the container. */
+		customProperties.put("Key1", "Value1");
+		customProperties.put("Schl\u00fcssel2", "Wert2");
+		customProperties.put("Sample Integer", new Integer(12345));
+		customProperties.put("Sample Boolean", Boolean.TRUE);
+		Date date = new Date();
+		customProperties.put("Sample Date", date);
+		customProperties.put("Sample Double", new Double(-1.0001));
+		customProperties.put("Sample Negative Integer", new Integer(-100000));
+
+		dsi.setCustomProperties(customProperties);
+
+		// start reading
+		closeAndReOpen();
+
+		// testing
+		assertNotNull(dsi);
+		assertNotNull(si);
+
+		assertEquals("Category", "xxxCategoryxxx", dsi.getCategory());
+		assertEquals("Company", "xxxCompanyxxx", dsi.getCompany());
+		assertEquals("Manager", "xxxManagerxxx", dsi.getManager());
+
+		assertEquals("", "xxxAuthorxxx", si.getAuthor());
+		assertEquals("", "xxxTitlexxx", si.getTitle());
+		assertEquals("", "xxxCommentsxxx", si.getComments());
+		assertEquals("", "xxxKeyWordsxxx", si.getKeywords());
+		assertEquals("", "xxxSubjectxxx", si.getSubject());
+
+		/*
+		 * Read the custom properties. If there are no custom properties yet,
+		 * the application has to create a new CustomProperties object. It will
+		 * serve as a container for custom properties.
+		 */
+		customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
 			fail();
 		}
-		  try
-		    {
-		        DocumentEntry dsiEntry = (DocumentEntry)
-		            dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
-		        DocumentInputStream dis = new DocumentInputStream(dsiEntry);
-		        PropertySet ps = new PropertySet(dis);
-		        dis.close();
-		        si = new SummaryInformation(ps);
-		      
-		        
-		    }
-		    catch (FileNotFoundException ex)
-		    {
-		        /* There is no document summary information yet. We have to create a
-		         * new one. */
-		        si = PropertySetFactory.newSummaryInformation();
-		        assertNotNull(si);
-		    } catch (IOException e) {
-				e.printStackTrace();
-				fail();
-			} catch (NoPropertySetStreamException e) {
-				e.printStackTrace();
-				fail();
-			} catch (MarkUnsupportedException e) {
-				e.printStackTrace();
-				fail();
-			} catch (UnexpectedPropertySetTypeException e) {
-				e.printStackTrace();
-				fail();
-			}
-  }
-  
-  /**
-   * Sets the most important information in DocumentSummaryInformation and Summary Information and rereads it
-   *
-   */
- public void testOne(){
-	 
-	 //DocumentSummaryInformation
-	 dsi.setCompany("xxxCompanyxxx");
-	 dsi.setManager("xxxManagerxxx");
-	 dsi.setCategory("xxxCategoryxxx");
-	 
-	 //SummaryInformation
-	 si.setTitle("xxxTitlexxx");
-	 si.setAuthor("xxxAuthorxxx");
-	 si.setComments("xxxCommentsxxx");
-	 si.setKeywords("xxxKeyWordsxxx");
-	 si.setSubject("xxxSubjectxxx");
-	 
-	 //Custom Properties (in DocumentSummaryInformation
-     CustomProperties customProperties = dsi.getCustomProperties();
-     if (customProperties == null){
-         customProperties = new CustomProperties();
-     }
-     
-     /* Insert some custom properties into the container. */
-     customProperties.put("Key1", "Value1");
-     customProperties.put("Schl\u00fcssel2", "Wert2");
-     customProperties.put("Sample Integer", new Integer(12345));
-     customProperties.put("Sample Boolean", new Boolean(true));
-     Date date=new Date();
-     customProperties.put("Sample Date", date);
-     customProperties.put("Sample Double", new Double(-1.0001));
-     customProperties.put("Sample Negative Integer", new Integer(-100000));
-
-     dsi.setCustomProperties(customProperties);
-
-     //start reading
-	 closeAndReOpen();
-     
-	 //testing
-     assertNotNull(dsi);
-     assertNotNull(si);
-     
-     assertEquals("Category","xxxCategoryxxx",dsi.getCategory());
-     assertEquals("Company","xxxCompanyxxx",dsi.getCompany());
-     assertEquals("Manager","xxxManagerxxx",dsi.getManager());
-     
-     assertEquals("","xxxAuthorxxx",si.getAuthor());
-     assertEquals("","xxxTitlexxx",si.getTitle());
-     assertEquals("","xxxCommentsxxx",si.getComments());
-     assertEquals("","xxxKeyWordsxxx",si.getKeywords());
-     assertEquals("","xxxSubjectxxx",si.getSubject());
-     
-
-     /* Read the custom properties. If there are no custom properties yet,
-      * the application has to create a new CustomProperties object. It will
-      * serve as a container for custom properties. */
-     customProperties = dsi.getCustomProperties();
-     if (customProperties == null){
-    	 fail();
-         }
-     
-     /* Insert some custom properties into the container. */
-     String a1=(String) customProperties.get("Key1");
-     assertEquals("Key1","Value1",a1);
-     String a2=(String) customProperties.get("Schl\u00fcssel2");
-     assertEquals("Schl\u00fcssel2","Wert2",a2);
-     Integer a3=(Integer) customProperties.get("Sample Integer");
-     assertEquals("Sample Number",new Integer(12345),a3);
-     Boolean a4=(Boolean) customProperties.get("Sample Boolean");
-     assertEquals("Sample Boolean",new Boolean(true),a4);
-     Date a5=(Date) customProperties.get("Sample Date");
-     assertEquals("Custom Date:",date,a5);
-     
-     Double a6=(Double) customProperties.get("Sample Double");
-     assertEquals("Custom Float",new Double(-1.0001),a6);
-     
-     Integer a7=(Integer) customProperties.get("Sample Negative Integer");
-     assertEquals("Neg", new Integer(-100000),a7);
- }
-     
-
- /**
-  * multiplies a string
-  * @param s Input String
-  * @return  the multiplied String
-  */
- public String elongate(String s){
-	 StringBuffer sb=new StringBuffer();
-	 for (int i=0;i<10000;i++){
-		 sb.append(s);
-		 sb.append(" ");
-	 }
-	 return sb.toString();
- }
- 
- 
- 
- /**
-  * Test very long input in each of the fields (approx 30-60KB each)
-  *
-  */
-public void testTwo(){
-	 
-	String company=elongate("company");
-	String manager=elongate("manager");
-	String category=elongate("category");
-	String title=elongate("title");
-	String author=elongate("author");
-	String comments=elongate("comments");
-	String keywords=elongate("keywords");
-	String subject=elongate("subject");
-	String p1=elongate("p1");
-	String p2=elongate("p2");
-	String k1=elongate("k1");
-	String k2=elongate("k2");
-	
-	 dsi.setCompany(company);
-	 dsi.setManager(manager);
-	 dsi.setCategory(category);
-	 
-	 si.setTitle(title);
-	 si.setAuthor(author);
-	 si.setComments(comments);
-	 si.setKeywords(keywords);
-	 si.setSubject(subject);
-    CustomProperties customProperties = dsi.getCustomProperties();
-    if (customProperties == null){
-        customProperties = new CustomProperties();
-    }
-    
-    /* Insert some custom properties into the container. */
-    customProperties.put(k1, p1);
-    customProperties.put(k2, p2);
-    customProperties.put("Sample Number", new Integer(12345));
-    customProperties.put("Sample Boolean", new Boolean(true));
-    Date date=new Date();
-    customProperties.put("Sample Date", date);
-
-    dsi.setCustomProperties(customProperties);
-
-
-	 closeAndReOpen();
-  
-   assertNotNull(dsi);
-   assertNotNull(si);
-    /* Change the category to "POI example". Any former category value will
-     * be lost. If there has been no category yet, it will be created. */
-    assertEquals("Category",category,dsi.getCategory());
-    assertEquals("Company",company,dsi.getCompany());
-    assertEquals("Manager",manager,dsi.getManager());
-    
-    assertEquals("",author,si.getAuthor());
-    assertEquals("",title,si.getTitle());
-    assertEquals("",comments,si.getComments());
-    assertEquals("",keywords,si.getKeywords());
-    assertEquals("",subject,si.getSubject());
-    
-    
-    /* Read the custom properties. If there are no custom properties
-     * yet, the application has to create a new CustomProperties object.
-     * It will serve as a container for custom properties. */
-    customProperties = dsi.getCustomProperties();
-    if (customProperties == null){
-   	 fail();
-        }
-    
-    /* Insert some custom properties into the container. */
-    String a1=(String) customProperties.get(k1);
-    assertEquals("Key1",p1,a1);
-    String a2=(String) customProperties.get(k2);
-    assertEquals("Schl\u00fcssel2",p2,a2);
-    Integer a3=(Integer) customProperties.get("Sample Number");
-    assertEquals("Sample Number",new Integer(12345),a3);
-    Boolean a4=(Boolean) customProperties.get("Sample Boolean");
-    assertEquals("Sample Boolean",new Boolean(true),a4);
-    Date a5=(Date) customProperties.get("Sample Date");
-    assertEquals("Custom Date:",date,a5);
 
+		/* Insert some custom properties into the container. */
+		String a1 = (String) customProperties.get("Key1");
+		assertEquals("Key1", "Value1", a1);
+		String a2 = (String) customProperties.get("Schl\u00fcssel2");
+		assertEquals("Schl\u00fcssel2", "Wert2", a2);
+		Integer a3 = (Integer) customProperties.get("Sample Integer");
+		assertEquals("Sample Number", new Integer(12345), a3);
+		Boolean a4 = (Boolean) customProperties.get("Sample Boolean");
+		assertEquals("Sample Boolean", Boolean.TRUE, a4);
+		Date a5 = (Date) customProperties.get("Sample Date");
+		assertEquals("Custom Date:", date, a5);
 
+		Double a6 = (Double) customProperties.get("Sample Double");
+		assertEquals("Custom Float", new Double(-1.0001), a6);
+
+		Integer a7 = (Integer) customProperties.get("Sample Negative Integer");
+		assertEquals("Neg", new Integer(-100000), a7);
 	}
-    
 
-/**
- * adds strange characters to the string
- * @param s Input String
- * @return  the multiplied String
- */
-public String strangize(String s){
-	 StringBuffer sb=new StringBuffer();
-	 String[] umlaute= {"\u00e4","\u00fc","\u00f6","\u00dc","$","\u00d6","\u00dc","\u00c9","\u00d6","@","\u00e7","&"};
-	 char j=0;
-	 Random rand=new Random();
-	 for (int i=0;i<5;i++){
-		 sb.append(s);
-		 sb.append(" ");
-		 j=(char) rand.nextInt(220);
-		 j+=33;
-		 // System.out.println(j);
-		 sb.append(">");
-		 sb.append(new Character(j));
-		 sb.append("=");
-		 sb.append(umlaute[rand.nextInt(umlaute.length)]);
-		 sb.append("<");
-	 }
-	 
-	 return sb.toString();
-}
+	/**
+	 * multiplies a string
+	 * @param s Input String
+	 * @return the multiplied String
+	 */
+	private static String elongate(String s) {
+		StringBuffer sb = new StringBuffer();
+		for (int i = 0; i < 10000; i++) {
+			sb.append(s);
+			sb.append(" ");
+		}
+		return sb.toString();
+	}
 
+	/**
+	 * Test very long input in each of the fields (approx 30-60KB each)
+	 */
+	public void testTwo() {
+
+		String company = elongate("company");
+		String manager = elongate("manager");
+		String category = elongate("category");
+		String title = elongate("title");
+		String author = elongate("author");
+		String comments = elongate("comments");
+		String keywords = elongate("keywords");
+		String subject = elongate("subject");
+		String p1 = elongate("p1");
+		String p2 = elongate("p2");
+		String k1 = elongate("k1");
+		String k2 = elongate("k2");
+
+		dsi.setCompany(company);
+		dsi.setManager(manager);
+		dsi.setCategory(category);
+
+		si.setTitle(title);
+		si.setAuthor(author);
+		si.setComments(comments);
+		si.setKeywords(keywords);
+		si.setSubject(subject);
+		CustomProperties customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
+			customProperties = new CustomProperties();
+		}
 
-/**
- * Tests with strange characters in keys and data (Umlaute etc.)
- *
- */
-public void testThree(){
-	 
-	String company=strangize("company");
-	String manager=strangize("manager");
-	String category=strangize("category");
-	String title=strangize("title");
-	String author=strangize("author");
-	String comments=strangize("comments");
-	String keywords=strangize("keywords");
-	String subject=strangize("subject");
-	String p1=strangize("p1");
-	String p2=strangize("p2");
-	String k1=strangize("k1");
-	String k2=strangize("k2");
-	
-	 dsi.setCompany(company);
-	 dsi.setManager(manager);
-	 dsi.setCategory(category);
-	 
-	 si.setTitle(title);
-	 si.setAuthor(author);
-	 si.setComments(comments);
-	 si.setKeywords(keywords);
-	 si.setSubject(subject);
-   CustomProperties customProperties = dsi.getCustomProperties();
-   if (customProperties == null){
-       customProperties = new CustomProperties();
-   }
-   
-   /* Insert some custom properties into the container. */
-   customProperties.put(k1, p1);
-   customProperties.put(k2, p2);
-   customProperties.put("Sample Number", new Integer(12345));
-   customProperties.put("Sample Boolean", new Boolean(false));
-   Date date=new Date(0);
-   customProperties.put("Sample Date", date);
-
-   dsi.setCustomProperties(customProperties);
-
-
-	 closeAndReOpen();
- 
-  assertNotNull(dsi);
-  assertNotNull(si);
-   /* Change the category to "POI example". Any former category value will
-    * be lost. If there has been no category yet, it will be created. */
-   assertEquals("Category",category,dsi.getCategory());
-   assertEquals("Company",company,dsi.getCompany());
-   assertEquals("Manager",manager,dsi.getManager());
-   
-   assertEquals("",author,si.getAuthor());
-   assertEquals("",title,si.getTitle());
-   assertEquals("",comments,si.getComments());
-   assertEquals("",keywords,si.getKeywords());
-   assertEquals("",subject,si.getSubject());
-   
-   
-   /* Read the custom properties. If there are no custom properties yet,
-    * the application has to create a new CustomProperties object. It will
-    * serve as a container for custom properties. */
-   customProperties = dsi.getCustomProperties();
-   if (customProperties == null){
-  	 fail();
-       }
-   
-   /* Insert some custom properties into the container. */
-   // System.out.println(k1);
-   String a1=(String) customProperties.get(k1);
-   assertEquals("Key1",p1,a1);
-   String a2=(String) customProperties.get(k2);
-   assertEquals("Schl\u00fcssel2",p2,a2);
-   Integer a3=(Integer) customProperties.get("Sample Number");
-   assertEquals("Sample Number",new Integer(12345),a3);
-   Boolean a4=(Boolean) customProperties.get("Sample Boolean");
-   assertEquals("Sample Boolean",new Boolean(false),a4);
-   Date a5=(Date) customProperties.get("Sample Date");
-   assertEquals("Custom Date:",date,a5);
-  
+		/* Insert some custom properties into the container. */
+		customProperties.put(k1, p1);
+		customProperties.put(k2, p2);
+		customProperties.put("Sample Number", new Integer(12345));
+		customProperties.put("Sample Boolean", Boolean.TRUE);
+		Date date = new Date();
+		customProperties.put("Sample Date", date);
+
+		dsi.setCustomProperties(customProperties);
+
+		closeAndReOpen();
+
+		assertNotNull(dsi);
+		assertNotNull(si);
+		/*
+		 * Change the category to "POI example". Any former category value will
+		 * be lost. If there has been no category yet, it will be created.
+		 */
+		assertEquals("Category", category, dsi.getCategory());
+		assertEquals("Company", company, dsi.getCompany());
+		assertEquals("Manager", manager, dsi.getManager());
+
+		assertEquals("", author, si.getAuthor());
+		assertEquals("", title, si.getTitle());
+		assertEquals("", comments, si.getComments());
+		assertEquals("", keywords, si.getKeywords());
+		assertEquals("", subject, si.getSubject());
+
+		/*
+		 * Read the custom properties. If there are no custom properties yet,
+		 * the application has to create a new CustomProperties object. It will
+		 * serve as a container for custom properties.
+		 */
+		customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
+			fail();
+		}
+
+		/* Insert some custom properties into the container. */
+		String a1 = (String) customProperties.get(k1);
+		assertEquals("Key1", p1, a1);
+		String a2 = (String) customProperties.get(k2);
+		assertEquals("Schl\u00fcssel2", p2, a2);
+		Integer a3 = (Integer) customProperties.get("Sample Number");
+		assertEquals("Sample Number", new Integer(12345), a3);
+		Boolean a4 = (Boolean) customProperties.get("Sample Boolean");
+		assertEquals("Sample Boolean", Boolean.TRUE, a4);
+		Date a5 = (Date) customProperties.get("Sample Date");
+		assertEquals("Custom Date:", date, a5);
 
 	}
-   
-   /**
-    * Iterative testing: writing, reading etc.
-    *
-    */
-   public void testFour(){
-	   for (int i=1;i<100;i++){
-		   setUp();
-		   testThree();
-		   tearDown();
-	   }
-   }
-   
-   
 
-   /**
-    * adds strange characters to the string with the adding of unicode characters
-    * @param s Input String
-    * @return  the multiplied String
-    */
-   public String strangizeU(String s){
-	  
-   	 StringBuffer sb=new StringBuffer();
-     String[] umlaute= {"\u00e4","\u00fc","\u00f6","\u00dc","$","\u00d6","\u00dc","\u00c9","\u00d6","@","\u00e7","&"};
-   	 char j=0;
-   	 Random rand=new Random();
-   	 for (int i=0;i<5;i++){
-   		 sb.append(s);
-   		 sb.append(" ");
-   		 j=(char) rand.nextInt(220);
-   		 j+=33;
-   		 // System.out.println(j);
-   		 sb.append(">");
-   		 sb.append(new Character(j));
-   		 sb.append("=");
-   		 sb.append(umlaute[rand.nextInt(umlaute.length)]);
-   		 sb.append("<");
-   	 }
-   	 sb.append("\u00e4\u00f6\u00fc\uD840\uDC00");
-   	 return sb.toString();
-   }
-   /**
-    * Unicode test
-    *
-    */
-   public void testUnicode(){
-	   String company=strangizeU("company");
-		String manager=strangizeU("manager");
-		String category=strangizeU("category");
-		String title=strangizeU("title");
-		String author=strangizeU("author");
-		String comments=strangizeU("comments");
-		String keywords=strangizeU("keywords");
-		String subject=strangizeU("subject");
-		String p1=strangizeU("p1");
-		String p2=strangizeU("p2");
-		String k1=strangizeU("k1");
-		String k2=strangizeU("k2");
-		
-		 dsi.setCompany(company);
-		 dsi.setManager(manager);
-		 dsi.setCategory(category);
-		 
-		 si.setTitle(title);
-		 si.setAuthor(author);
-		 si.setComments(comments);
-		 si.setKeywords(keywords);
-		 si.setSubject(subject);
-	   CustomProperties customProperties = dsi.getCustomProperties();
-	   if (customProperties == null){
-	       customProperties = new CustomProperties();
-	   }
-	   
-	   /* Insert some custom properties into the container. */
-	   customProperties.put(k1, p1);
-	   customProperties.put(k2, p2);
-	   customProperties.put("Sample Number", new Integer(12345));
-	   customProperties.put("Sample Boolean", new Boolean(true));
-	   Date date=new Date();
-	   customProperties.put("Sample Date", date);
-
-	   dsi.setCustomProperties(customProperties);
-
-
-		 closeAndReOpen();
-	 
-	  assertNotNull(dsi);
-	  assertNotNull(si);
-	   /* Change the category to "POI example". Any former category value will
-	    * be lost. If there has been no category yet, it will be created. */
-	   assertEquals("Category",category,dsi.getCategory());
-	   assertEquals("Company",company,dsi.getCompany());
-	   assertEquals("Manager",manager,dsi.getManager());
-	   
-	   assertEquals("",author,si.getAuthor());
-	   assertEquals("",title,si.getTitle());
-	   assertEquals("",comments,si.getComments());
-	   assertEquals("",keywords,si.getKeywords());
-	   assertEquals("",subject,si.getSubject());
-	   
-	   
-       /* Read the custom properties. If there are no custom properties yet,
-        * the application has to create a new CustomProperties object. It will
-        * serve as a container for custom properties. */
-	   customProperties = dsi.getCustomProperties();
-	   if (customProperties == null){
-	  	 fail();
-	       }
-	   
-	   /* Insert some custom properties into the container. */
-	   // System.out.println(k1);
-	   String a1=(String) customProperties.get(k1);
-	   assertEquals("Key1",p1,a1);
-	   String a2=(String) customProperties.get(k2);
-	   assertEquals("Schl\u00fcssel2",p2,a2);
-       Integer a3=(Integer) customProperties.get("Sample Number");
-	   assertEquals("Sample Number",new Integer(12345),a3);
-	   Boolean a4=(Boolean) customProperties.get("Sample Boolean");
-	   assertEquals("Sample Boolean",new Boolean(true),a4);
-	   Date a5=(Date) customProperties.get("Sample Date");
-	   assertEquals("Custom Date:",date,a5);
-	  
-	
-
-   }
-   
-   
-   /**
-    * Iterative testing of the unicode test
-    *
+
+	/**
+	 * adds strange characters to the string
+	 * @param s Input String
+	 * @return  the multiplied String
+	 */
+	private static String strangize(String s) {
+		StringBuffer sb = new StringBuffer();
+		String[] umlaute = { "\u00e4", "\u00fc", "\u00f6", "\u00dc", "$", "\u00d6", "\u00dc",
+				"\u00c9", "\u00d6", "@", "\u00e7", "&" };
+		char j = 0;
+		Random rand = new Random(0); // TODO - no Random - tests should be completely deterministic
+		for (int i = 0; i < 5; i++) {
+			sb.append(s);
+			sb.append(" ");
+			j = (char) rand.nextInt(220);
+			j += 33;
+			// System.out.println(j);
+			sb.append(">");
+			sb.append(new Character(j));
+			sb.append("=");
+			sb.append(umlaute[rand.nextInt(umlaute.length)]);
+			sb.append("<");
+		}
+
+		return sb.toString();
+	}
+
+
+	/**
+	 * Tests with strange characters in keys and data (Umlaute etc.)
+	 */
+	public void testThree() {
+
+		String company = strangize("company");
+		String manager = strangize("manager");
+		String category = strangize("category");
+		String title = strangize("title");
+		String author = strangize("author");
+		String comments = strangize("comments");
+		String keywords = strangize("keywords");
+		String subject = strangize("subject");
+		String p1 = strangize("p1");
+		String p2 = strangize("p2");
+		String k1 = strangize("k1");
+		String k2 = strangize("k2");
+
+		dsi.setCompany(company);
+		dsi.setManager(manager);
+		dsi.setCategory(category);
+
+		si.setTitle(title);
+		si.setAuthor(author);
+		si.setComments(comments);
+		si.setKeywords(keywords);
+		si.setSubject(subject);
+		CustomProperties customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
+			customProperties = new CustomProperties();
+		}
+
+		/* Insert some custom properties into the container. */
+		customProperties.put(k1, p1);
+		customProperties.put(k2, p2);
+		customProperties.put("Sample Number", new Integer(12345));
+		customProperties.put("Sample Boolean", Boolean.FALSE);
+		Date date = new Date(0);
+		customProperties.put("Sample Date", date);
+
+		dsi.setCustomProperties(customProperties);
+
+		closeAndReOpen();
+
+		assertNotNull(dsi);
+		assertNotNull(si);
+		/*
+		 * Change the category to "POI example". Any former category value will
+		 * be lost. If there has been no category yet, it will be created.
+		 */
+		assertEquals("Category", category, dsi.getCategory());
+		assertEquals("Company", company, dsi.getCompany());
+		assertEquals("Manager", manager, dsi.getManager());
+
+		assertEquals("", author, si.getAuthor());
+		assertEquals("", title, si.getTitle());
+		assertEquals("", comments, si.getComments());
+		assertEquals("", keywords, si.getKeywords());
+		assertEquals("", subject, si.getSubject());
+
+		/*
+		 * Read the custom properties. If there are no custom properties yet,
+		 * the application has to create a new CustomProperties object. It will
+		 * serve as a container for custom properties.
+		 */
+		customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
+			fail();
+		}
+
+		/* Insert some custom properties into the container. */
+		// System.out.println(k1);
+		String a1 = (String) customProperties.get(k1);
+		assertEquals("Key1", p1, a1);
+		String a2 = (String) customProperties.get(k2);
+		assertEquals("Schl\u00fcssel2", p2, a2);
+		Integer a3 = (Integer) customProperties.get("Sample Number");
+		assertEquals("Sample Number", new Integer(12345), a3);
+		Boolean a4 = (Boolean) customProperties.get("Sample Boolean");
+		assertEquals("Sample Boolean", Boolean.FALSE, a4);
+		Date a5 = (Date) customProperties.get("Sample Date");
+		assertEquals("Custom Date:", date, a5);
+
+	}
+
+	/**
+	 * Iterative testing: writing, reading etc.
+	 */
+	public void testFour() {
+		for (int i = 1; i < 100; i++) {
+			setUp();
+			testThree();
+		}
+	}
+
+
+
+	/**
+	 * adds strange characters to the string with the adding of unicode characters
+	 * @param s Input String
+	 * @return  the multiplied String
     */
-   public void testSix(){
-	   for (int i=1;i<100;i++){
-		   setUp();
-		   testUnicode();
-		   tearDown();
-	   }
-   }
-   
+	private static String strangizeU(String s) {
+
+		StringBuffer sb = new StringBuffer();
+		String[] umlaute = { "\u00e4", "\u00fc", "\u00f6", "\u00dc", "$", "\u00d6", "\u00dc",
+				"\u00c9", "\u00d6", "@", "\u00e7", "&" };
+		char j = 0;
+		Random rand = new Random(0); // TODO - no Random - tests should be completely deterministic
+		for (int i = 0; i < 5; i++) {
+			sb.append(s);
+			sb.append(" ");
+			j = (char) rand.nextInt(220);
+			j += 33;
+			// System.out.println(j);
+			sb.append(">");
+			sb.append(new Character(j));
+			sb.append("=");
+			sb.append(umlaute[rand.nextInt(umlaute.length)]);
+			sb.append("<");
+		}
+		sb.append("\u00e4\u00f6\u00fc\uD840\uDC00");
+		return sb.toString();
+	}
+
+	/**
+	 * Unicode test
+	 */
+	public void testUnicode() {
+		String company = strangizeU("company");
+		String manager = strangizeU("manager");
+		String category = strangizeU("category");
+		String title = strangizeU("title");
+		String author = strangizeU("author");
+		String comments = strangizeU("comments");
+		String keywords = strangizeU("keywords");
+		String subject = strangizeU("subject");
+		String p1 = strangizeU("p1");
+		String p2 = strangizeU("p2");
+		String k1 = strangizeU("k1");
+		String k2 = strangizeU("k2");
+
+		dsi.setCompany(company);
+		dsi.setManager(manager);
+		dsi.setCategory(category);
+
+		si.setTitle(title);
+		si.setAuthor(author);
+		si.setComments(comments);
+		si.setKeywords(keywords);
+		si.setSubject(subject);
+		CustomProperties customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
+			customProperties = new CustomProperties();
+		}
+
+		/* Insert some custom properties into the container. */
+		customProperties.put(k1, p1);
+		customProperties.put(k2, p2);
+		customProperties.put("Sample Number", new Integer(12345));
+		customProperties.put("Sample Boolean", Boolean.TRUE);
+		Date date = new Date();
+		customProperties.put("Sample Date", date);
+
+		dsi.setCustomProperties(customProperties);
+
+		closeAndReOpen();
+
+		assertNotNull(dsi);
+		assertNotNull(si);
+		/*
+		 * Change the category to "POI example". Any former category value will
+		 * be lost. If there has been no category yet, it will be created.
+		 */
+		assertEquals("Category", category, dsi.getCategory());
+		assertEquals("Company", company, dsi.getCompany());
+		assertEquals("Manager", manager, dsi.getManager());
+
+		assertEquals("", author, si.getAuthor());
+		assertEquals("", title, si.getTitle());
+		assertEquals("", comments, si.getComments());
+		assertEquals("", keywords, si.getKeywords());
+		assertEquals("", subject, si.getSubject());
+
+		/*
+		 * Read the custom properties. If there are no custom properties yet,
+		 * the application has to create a new CustomProperties object. It will
+		 * serve as a container for custom properties.
+		 */
+		customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
+			fail();
+		}
+
+		/* Insert some custom properties into the container. */
+		// System.out.println(k1);
+		String a1 = (String) customProperties.get(k1);
+		assertEquals("Key1", p1, a1);
+		String a2 = (String) customProperties.get(k2);
+		assertEquals("Schl\u00fcssel2", p2, a2);
+		Integer a3 = (Integer) customProperties.get("Sample Number");
+		assertEquals("Sample Number", new Integer(12345), a3);
+		Boolean a4 = (Boolean) customProperties.get("Sample Boolean");
+		assertEquals("Sample Boolean", Boolean.TRUE, a4);
+		Date a5 = (Date) customProperties.get("Sample Date");
+		assertEquals("Custom Date:", date, a5);
+	}
+
 
    /**
-    * Tests conversion in custom fields and errors
-    *
-    */
-  public void testConvAndExistance(){
-  	 
-  	
-      CustomProperties customProperties = dsi.getCustomProperties();
-      if (customProperties == null){
-          customProperties = new CustomProperties();
-      }
-      
-      /* Insert some custom properties into the container. */
-      customProperties.put("int", new Integer(12345));
-      customProperties.put("negint", new Integer(-12345));
-      customProperties.put("long", new Long(12345));
-      customProperties.put("neglong", new Long(-12345));
-      customProperties.put("boolean", new Boolean(true));
-      customProperties.put("string", "a String");
-      //customProperties.put("float", new Float(12345.0));  is not valid
-      //customProperties.put("negfloat", new Float(-12345.1)); is not valid
-      customProperties.put("double", new Double(12345.2));
-      customProperties.put("negdouble", new Double(-12345.3));
-      //customProperties.put("char", new Character('a')); is not valid
-      
-      Date date=new Date();
-      customProperties.put("date", date);
-
-      dsi.setCustomProperties(customProperties);
-
-
-  	 closeAndReOpen();
-    
-     assertNotNull(dsi);
-     assertNotNull(si);
-      /* Change the category to "POI example". Any former category value will
-       * be lost. If there has been no category yet, it will be created. */
-      assertNull(dsi.getCategory());
-      assertNull(dsi.getCompany());
-      assertNull(dsi.getManager());
-      
-      assertNull(si.getAuthor());
-      assertNull(si.getTitle());
-      assertNull(si.getComments());
-      assertNull(si.getKeywords());
-      assertNull(si.getSubject());
-      
-      
-      /* Read the custom properties. If there are no custom properties
-       * yet, the application has to create a new CustomProperties object.
-       * It will serve as a container for custom properties. */
-      customProperties = dsi.getCustomProperties();
-      if (customProperties == null){
-     	 fail();
-          }
-      
-      /* Insert some custom properties into the container. */
-
-      Integer a3=(Integer) customProperties.get("int");
-      assertEquals("int",new Integer(12345),a3);
-      
-      a3=(Integer) customProperties.get("negint");
-      assertEquals("negint",new Integer(-12345),a3);
-      
-      Long al=(Long) customProperties.get("neglong");
-      assertEquals("neglong",new Long(-12345),al);
-      
-      al=(Long) customProperties.get("long");
-      assertEquals("long",new Long(12345),al);
-      
-      Boolean a4=(Boolean) customProperties.get("boolean");
-      assertEquals("boolean",new Boolean(true),a4);
-      
-      Date a5=(Date) customProperties.get("date");
-      assertEquals("Custom Date:",date,a5);
-  
-      Double d=(Double) customProperties.get("double");
-      assertEquals("int",new Double(12345.2),d);
-      
-      d=(Double) customProperties.get("negdouble");
-      assertEquals("string",new Double(-12345.3),d);
-
-      String s=(String) customProperties.get("string");
-      assertEquals("sring","a String",s);
-      
-      Object o=null;
-      
-      o=customProperties.get("string");
-      if (!(o instanceof String)){
-    	  fail();
-      }
-      o=customProperties.get("boolean");
-      if (!(o instanceof Boolean)){
-    	  fail();
-      }
-      
-      o=customProperties.get("int");
-      if (!(o instanceof Integer)){
-    	  fail();
-      }
-      o=customProperties.get("negint");
-      if (!(o instanceof Integer)){
-    	  fail();
-      }
-      
-      o=customProperties.get("long");
-      if (!(o instanceof Long)){
-    	  fail();
-      }
-      o=customProperties.get("neglong");
-      if (!(o instanceof Long)){
-    	  fail();
-      }
-      
-      o=customProperties.get("double");
-      if (!(o instanceof Double)){
-    	  fail();
-      }
-      o=customProperties.get("negdouble");
-      if (!(o instanceof Double)){
-    	  fail();
-      }
-      
-      o=customProperties.get("date");
-      if (!(o instanceof Date)){
-    	  fail();
-      }
-   	}
-      
+	 * Iterative testing of the unicode test
+	 * 
+	 */
+	public void testSix() {
+		for (int i = 1; i < 100; i++) {
+			setUp();
+			testUnicode();
+		}
+	}
+
+
+	/**
+	 * Tests conversion in custom fields and errors
+	 */
+	public void testConvAndExistence() {
+
+		CustomProperties customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
+			customProperties = new CustomProperties();
+		}
+
+		/* Insert some custom properties into the container. */
+		customProperties.put("int", new Integer(12345));
+		customProperties.put("negint", new Integer(-12345));
+		customProperties.put("long", new Long(12345));
+		customProperties.put("neglong", new Long(-12345));
+		customProperties.put("boolean", Boolean.TRUE);
+		customProperties.put("string", "a String");
+		// customProperties.put("float", new Float(12345.0)); is not valid
+		// customProperties.put("negfloat", new Float(-12345.1)); is not valid
+		customProperties.put("double", new Double(12345.2));
+		customProperties.put("negdouble", new Double(-12345.3));
+		// customProperties.put("char", new Character('a')); is not valid
+
+		Date date = new Date();
+		customProperties.put("date", date);
+
+		dsi.setCustomProperties(customProperties);
+
+		closeAndReOpen();
+
+		assertNotNull(dsi);
+		assertNotNull(si);
+		/*
+		 * Change the category to "POI example". Any former category value will
+		 * be lost. If there has been no category yet, it will be created.
+		 */
+		assertNull(dsi.getCategory());
+		assertNull(dsi.getCompany());
+		assertNull(dsi.getManager());
+
+		assertNull(si.getAuthor());
+		assertNull(si.getTitle());
+		assertNull(si.getComments());
+		assertNull(si.getKeywords());
+		assertNull(si.getSubject());
+
+		/*
+		 * Read the custom properties. If there are no custom properties yet,
+		 * the application has to create a new CustomProperties object. It will
+		 * serve as a container for custom properties.
+		 */
+		customProperties = dsi.getCustomProperties();
+		if (customProperties == null) {
+			fail();
+		}
+
+		/* Insert some custom properties into the container. */
 
-   
-}
\ No newline at end of file
+		Integer a3 = (Integer) customProperties.get("int");
+		assertEquals("int", new Integer(12345), a3);
+
+		a3 = (Integer) customProperties.get("negint");
+		assertEquals("negint", new Integer(-12345), a3);
+
+		Long al = (Long) customProperties.get("neglong");
+		assertEquals("neglong", new Long(-12345), al);
+
+		al = (Long) customProperties.get("long");
+		assertEquals("long", new Long(12345), al);
+
+		Boolean a4 = (Boolean) customProperties.get("boolean");
+		assertEquals("boolean", Boolean.TRUE, a4);
+
+		Date a5 = (Date) customProperties.get("date");
+		assertEquals("Custom Date:", date, a5);
+
+		Double d = (Double) customProperties.get("double");
+		assertEquals("int", new Double(12345.2), d);
+
+		d = (Double) customProperties.get("negdouble");
+		assertEquals("string", new Double(-12345.3), d);
+
+		String s = (String) customProperties.get("string");
+		assertEquals("sring", "a String", s);
+
+
+		assertTrue(customProperties.get("string") instanceof String);
+		assertTrue(customProperties.get("boolean") instanceof Boolean);
+		assertTrue(customProperties.get("int") instanceof Integer);
+		assertTrue(customProperties.get("negint") instanceof Integer);
+		assertTrue(customProperties.get("long") instanceof Long);
+		assertTrue(customProperties.get("neglong") instanceof Long);
+		assertTrue(customProperties.get("double") instanceof Double);
+		assertTrue(customProperties.get("negdouble") instanceof Double);
+		assertTrue(customProperties.get("date") instanceof Date);
+	}
+}

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java Thu Oct  8 22:29:41 2009
@@ -53,7 +53,7 @@
 
     /**
      * <p>Read a the test file from the "data" directory.</p>
-     * 
+     *
      * @exception FileNotFoundException if the file to be read does not exist.
      * @exception IOException if any other I/O exception occurs
      */
@@ -68,7 +68,7 @@
      * <p>Tests the {@link PropertySet} methods. The test file has two
      * property set: the first one is a {@link SummaryInformation},
      * the second one is a {@link DocumentSummaryInformation}.</p>
-     * 
+     *
      * @exception IOException if an I/O exception occurs
      * @exception HPSFException if an HPSF exception occurs
      */
@@ -82,9 +82,9 @@
         Assert.assertEquals(ps.getSectionCount(), 2);
         Section s = (Section) ps.getSections().get(1);
         Assert.assertEquals(s.getProperty(1),
-                            new Integer(Constants.CP_UTF16));
+                            Integer.valueOf(Constants.CP_UTF16));
         Assert.assertEquals(s.getProperty(2),
-                            new Integer(-96070278));
+                            Integer.valueOf(-96070278));
         Assert.assertEquals(s.getProperty(3),
                             "MCon_Info zu Office bei Schreiner");
         Assert.assertEquals(s.getProperty(4),

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java Thu Oct  8 22:29:41 2009
@@ -107,7 +107,7 @@
     /**
      * <p>Writes an empty property set to a POIFS and reads it back
      * in.</p>
-     * 
+     *
      * @exception IOException if an I/O exception occurs
      */
     public void testNoFormatID() throws IOException
@@ -150,7 +150,7 @@
     /**
      * <p>Writes an empty property set to a POIFS and reads it back
      * in.</p>
-     * 
+     *
      * @exception IOException if an I/O exception occurs
      * @exception UnsupportedVariantTypeException if HPSF does not yet support
      * a variant type to be written
@@ -190,7 +190,7 @@
     /**
      * <p>Writes a simple property set with a SummaryInformation section to a
      * POIFS and reads it back in.</p>
-     * 
+     *
      * @exception IOException if an I/O exception occurs
      * @exception UnsupportedVariantTypeException if HPSF does not yet support
      * a variant type to be written
@@ -199,30 +199,30 @@
         throws IOException, UnsupportedVariantTypeException
     {
         final String AUTHOR = "Rainer Klute";
-        final String TITLE = "Test Document"; 
+        final String TITLE = "Test Document";
         final File dataDir = _samples.getFile("");
         final File filename = new File(dataDir, POI_FS);
         filename.deleteOnExit();
         final OutputStream out = new FileOutputStream(filename);
         final POIFSFileSystem poiFs = new POIFSFileSystem();
-    
+
         final MutablePropertySet ps = new MutablePropertySet();
         final MutableSection si = new MutableSection();
         si.setFormatID(SectionIDMap.SUMMARY_INFORMATION_ID);
         ps.getSections().set(0, si);
-    
+
         final MutableProperty p = new MutableProperty();
         p.setID(PropertyIDMap.PID_AUTHOR);
         p.setType(Variant.VT_LPWSTR);
         p.setValue(AUTHOR);
         si.setProperty(p);
         si.setProperty(PropertyIDMap.PID_TITLE, Variant.VT_LPSTR, TITLE);
-    
+
         poiFs.createDocument(ps.toInputStream(),
                              SummaryInformation.DEFAULT_STREAM_NAME);
         poiFs.writeFilesystem(out);
         out.close();
-    
+
         /* Read the POIFS: */
         final PropertySet[] psa = new PropertySet[1];
         final POIFSReader r = new POIFSReader();
@@ -240,7 +240,7 @@
                         fail(org.apache.poi.hpsf.Util.toString(ex));
                     }
                 }
-    
+
             },
             SummaryInformation.DEFAULT_STREAM_NAME);
         r.read(new FileInputStream(filename));
@@ -259,7 +259,7 @@
     /**
      * <p>Writes a simple property set with two sections to a POIFS and reads it
      * back in.</p>
-     * 
+     *
      * @exception IOException if an I/O exception occurs
      * @exception WritingNotSupportedException if HPSF does not yet support
      * a variant type to be written
@@ -365,7 +365,7 @@
     {
         Throwable t = null;
         final int codepage = CODEPAGE_DEFAULT;
-        if (!hasProperDefaultCharset())            
+        if (!hasProperDefaultCharset())
         {
             System.err.println(IMPROPER_DEFAULT_CHARSET_MESSAGE +
                 " This testcase is skipped.");
@@ -375,8 +375,8 @@
         try
         {
             check(Variant.VT_EMPTY, null, codepage);
-            check(Variant.VT_BOOL, new Boolean(true), codepage);
-            check(Variant.VT_BOOL, new Boolean(false), codepage);
+            check(Variant.VT_BOOL, Boolean.TRUE, codepage);
+            check(Variant.VT_BOOL, Boolean.FALSE, codepage);
             check(Variant.VT_CF, new byte[]{0}, codepage);
             check(Variant.VT_CF, new byte[]{0, 1}, codepage);
             check(Variant.VT_CF, new byte[]{0, 1, 2}, codepage);
@@ -385,11 +385,11 @@
             check(Variant.VT_CF, new byte[]{0, 1, 2, 3, 4, 5}, codepage);
             check(Variant.VT_CF, new byte[]{0, 1, 2, 3, 4, 5, 6}, codepage);
             check(Variant.VT_CF, new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, codepage);
-            check(Variant.VT_I4, new Integer(27), codepage);
-            check(Variant.VT_I8, new Long(28), codepage);
+            check(Variant.VT_I4, Integer.valueOf(27), codepage);
+            check(Variant.VT_I8, Long.valueOf(28), codepage);
             check(Variant.VT_R8, new Double(29.0), codepage);
-            check(Variant.VT_I4, new Integer(-27), codepage);
-            check(Variant.VT_I8, new Long(-28), codepage);
+            check(Variant.VT_I4, Integer.valueOf(-27), codepage);
+            check(Variant.VT_I8, Long.valueOf(-28), codepage);
             check(Variant.VT_R8, new Double(-29.0), codepage);
             check(Variant.VT_FILETIME, new Date(), codepage);
             check(Variant.VT_I4, new Integer(Integer.MAX_VALUE), codepage);
@@ -460,7 +460,7 @@
         for (int i = 0; i < validCodepages.length; i++)
         {
             final int cp = validCodepages[i];
-            if (cp == -1 && !hasProperDefaultCharset())            
+            if (cp == -1 && !hasProperDefaultCharset())
             {
                 System.err.println(IMPROPER_DEFAULT_CHARSET_MESSAGE +
                      " This testcase is skipped for the default codepage.");
@@ -590,10 +590,10 @@
      * @param codepage The codepage to use for writing and reading.
      * @throws UnsupportedVariantTypeException if the variant is not supported.
      * @throws IOException if an I/O exception occurs.
-     * @throws ReadingNotSupportedException 
-     * @throws UnsupportedEncodingException 
+     * @throws ReadingNotSupportedException
+     * @throws UnsupportedEncodingException
      */
-    private void check(final long variantType, final Object value, 
+    private void check(final long variantType, final Object value,
                        final int codepage)
         throws UnsupportedVariantTypeException, IOException,
                ReadingNotSupportedException, UnsupportedEncodingException
@@ -651,17 +651,17 @@
      * <p>This test method does a write and read back test with all POI
      * filesystems in the "data" directory by performing the following
      * actions for each file:</p>
-     * 
+     *
      * <ul>
-     * 
+     *
      * <li><p>Read its property set streams.</p></li>
-     * 
+     *
      * <li><p>Create a new POI filesystem containing the origin file's
      * property set streams.</p></li>
-     * 
+     *
      * <li><p>Read the property set streams from the POI filesystem just
      * created.</p></li>
-     * 
+     *
      * <li><p>Compare each property set stream with the corresponding one from
      * the origin file and check whether they are equal.</p></li>
      *
@@ -731,7 +731,7 @@
                 final InputStream in2 = new ByteArrayInputStream(bytes2);
                 final PropertySet ps1 = PropertySetFactory.create(in1);
                 final PropertySet ps2 = PropertySetFactory.create(in2);
-            
+
                 /* Compare the property set stream with the corresponding one
                  * from the origin file and check whether they are equal. */
                 assertEquals("Equality for file " + f.getName(), ps1, ps2);
@@ -761,14 +761,14 @@
             final MutablePropertySet ps1 = new MutablePropertySet();
             final MutableSection s = (MutableSection) ps1.getSections().get(0);
             final Map m = new HashMap(3, 1.0f);
-            m.put(new Long(1), "String 1");
-            m.put(new Long(2), "String 2");
-            m.put(new Long(3), "String 3");
+            m.put(Long.valueOf(1), "String 1");
+            m.put(Long.valueOf(2), "String 2");
+            m.put(Long.valueOf(3), "String 3");
             s.setDictionary(m);
             s.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[0]);
             int codepage = Constants.CP_UNICODE;
             s.setProperty(PropertyIDMap.PID_CODEPAGE, Variant.VT_I2,
-                          new Integer(codepage));
+                          Integer.valueOf(codepage));
             poiFs.createDocument(ps1.toInputStream(), "Test");
             poiFs.writeFilesystem(out);
             out.close();
@@ -813,14 +813,14 @@
             final MutablePropertySet ps1 = new MutablePropertySet();
             final MutableSection s = (MutableSection) ps1.getSections().get(0);
             final Map m = new HashMap(3, 1.0f);
-            m.put(new Long(1), "String 1");
-            m.put(new Long(2), "String 2");
-            m.put(new Long(3), "String 3");
+            m.put(Long.valueOf(1), "String 1");
+            m.put(Long.valueOf(2), "String 2");
+            m.put(Long.valueOf(3), "String 3");
             s.setDictionary(m);
             s.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[0]);
             int codepage = 12345;
             s.setProperty(PropertyIDMap.PID_CODEPAGE, Variant.VT_I2,
-                          new Integer(codepage));
+                          Integer.valueOf(codepage));
             poiFs.createDocument(ps1.toInputStream(), "Test");
             poiFs.writeFilesystem(out);
             out.close();

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java Thu Oct  8 22:29:41 2009
@@ -58,7 +58,7 @@
 /**
  * <p>Tests HPSF's high-level writing functionality for the well-known property
  * set "SummaryInformation" and "DocumentSummaryInformation".</p>
- * 
+ *
  * @author Rainer Klute
  *     <a href="mailto:klute@rainer-klute.de">klute@rainer-klute.de</a>
  */
@@ -83,11 +83,6 @@
      * pointed to by the "POI.testdata.path" system property, trying to extract
      * the document summary information stream in the root directory and calling
      * its get... methods.</p>
-     * @throws IOException 
-     * @throws FileNotFoundException 
-     * @throws MarkUnsupportedException 
-     * @throws NoPropertySetStreamException 
-     * @throws UnexpectedPropertySetTypeException 
      */
     public void testReadDocumentSummaryInformation()
             throws FileNotFoundException, IOException,
@@ -131,7 +126,7 @@
                 final DocumentInputStream dis = new DocumentInputStream(dsiEntry);
                 final PropertySet ps = new PropertySet(dis);
                 final DocumentSummaryInformation dsi = new DocumentSummaryInformation(ps);
-                
+
                 /* Execute the get... methods. */
                 dsi.getByteCount();
                 dsi.getByteOrder();
@@ -159,43 +154,43 @@
      * <p>This test method test the writing of properties in the well-known
      * property set streams "SummaryInformation" and
      * "DocumentSummaryInformation" by performing the following steps:</p>
-     * 
+     *
      * <ol>
-     * 
+     *
      * <li><p>Read a test document <em>doc1</em> into a POI filesystem.</p></li>
-     * 
+     *
      * <li><p>Read the summary information stream and the document summary
      * information stream from the POI filesystem.</p></li>
-     * 
+     *
      * <li><p>Write all properties supported by HPSF to the summary
      * information (e.g. author, edit date, application name) and to the
      * document summary information (e.g. company, manager).</p></li>
-     * 
+     *
      * <li><p>Write the summary information stream and the document summary
      * information stream to the POI filesystem.</p></li>
-     * 
+     *
      * <li><p>Write the POI filesystem to a (temporary) file <em>doc2</em>
      * and close the latter.</p></li>
-     * 
+     *
      * <li><p>Open <em>doc2</em> for reading and check summary information
      * and document summary information. All properties written before must be
      * found in the property streams of <em>doc2</em> and have the correct
      * values.</p></li>
-     * 
+     *
      * <li><p>Remove all properties supported by HPSF from the summary
      * information (e.g. author, edit date, application name) and from the
      * document summary information (e.g. company, manager).</p></li>
-     * 
+     *
      * <li><p>Write the summary information stream and the document summary
      * information stream to the POI filesystem.</p></li>
-     * 
+     *
      * <li><p>Write the POI filesystem to a (temporary) file <em>doc3</em>
      * and close the latter.</p></li>
-     * 
+     *
      * <li><p>Open <em>doc3</em> for reading and check summary information
      * and document summary information. All properties removed before must not
      * be found in the property streams of <em>doc3</em>.</p></li> </ol>
-     * 
+     *
      * @throws IOException if some I/O error occurred.
      * @throws MarkUnsupportedException
      * @throws NoPropertySetStreamException
@@ -209,17 +204,17 @@
         POIDataSamples _samples = POIDataSamples.getHPSFInstance();
         final File dataDir = _samples.getFile("");
         final File doc1 = new File(dataDir, POI_FS);
-    
+
         /* Read a test document <em>doc1</em> into a POI filesystem. */
         POIFSFileSystem poifs = new POIFSFileSystem(new FileInputStream(doc1));
         DirectoryEntry dir = poifs.getRoot();
         DocumentEntry siEntry = (DocumentEntry) dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
         DocumentEntry dsiEntry = (DocumentEntry) dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
-    
+
         /*
          * Read the summary information stream and the document summary
          * information stream from the POI filesystem.
-         * 
+         *
          * Please note that the result consists of SummaryInformation and
          * DocumentSummaryInformation instances which are in memory only. To
          * make them permanent they have to be written to a POI filesystem
@@ -232,7 +227,7 @@
         dis = new DocumentInputStream(dsiEntry);
         ps = new PropertySet(dis);
         DocumentSummaryInformation dsi = new DocumentSummaryInformation(ps);
-    
+
         /*
          * Write all properties supported by HPSF to the summary information
          * (e.g. author, edit date, application name) and to the document
@@ -245,7 +240,7 @@
         final long time2 = cal.getTimeInMillis();
         cal.set(2002, 8, 8, 8, 8, 8);
         final long time3 = cal.getTimeInMillis();
-    
+
         int nr = 4711;
         final String P_APPLICATION_NAME = "ApplicationName";
         final String P_AUTHOR = "Author";
@@ -265,7 +260,7 @@
         // FIXME (byte array properties not yet implemented): final byte[] P_THUMBNAIL = new byte[123];
         final String P_TITLE = "Title";
         final int    P_WORD_COUNT = ++nr;
-    
+
         final int     P_BYTE_COUNT = ++nr;
         final String  P_CATEGORY = "Category";
         final String  P_COMPANY = "Company";
@@ -296,7 +291,7 @@
         final Long MIN_LONG = new Long(Long.MIN_VALUE);
         final Double MAX_DOUBLE = new Double(Double.MAX_VALUE);
         final Double MIN_DOUBLE = new Double(Double.MIN_VALUE);
-        
+
         si.setApplicationName(P_APPLICATION_NAME);
         si.setAuthor(P_AUTHOR);
         si.setCharCount(P_CHAR_COUNT);
@@ -315,7 +310,7 @@
         // FIXME (byte array properties not yet implemented): si.setThumbnail(P_THUMBNAIL);
         si.setTitle(P_TITLE);
         si.setWordCount(P_WORD_COUNT);
-    
+
         dsi.setByteCount(P_BYTE_COUNT);
         dsi.setCategory(P_CATEGORY);
         dsi.setCompany(P_COMPANY);
@@ -345,7 +340,7 @@
         customProperties.put("negative_Integer", NEGATIVE_INTEGER);
         customProperties.put("negative_Long", NEGATIVE_LONG);
         customProperties.put("negative_Double", NEGATIVE_DOUBLE);
-        customProperties.put("Boolean", new Boolean(true));
+        customProperties.put("Boolean", Boolean.TRUE);
         customProperties.put("Date", now);
         customProperties.put("max_Integer", MAX_INTEGER);
         customProperties.put("min_Integer", MIN_INTEGER);
@@ -378,14 +373,14 @@
         dir = poifs.getRoot();
         siEntry = (DocumentEntry) dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
         dsiEntry = (DocumentEntry) dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
-    
+
         dis = new DocumentInputStream(siEntry);
         ps = new PropertySet(dis);
         si = new SummaryInformation(ps);
         dis = new DocumentInputStream(dsiEntry);
         ps = new PropertySet(dis);
         dsi = new DocumentSummaryInformation(ps);
-    
+
         assertEquals(P_APPLICATION_NAME, si.getApplicationName());
         assertEquals(P_AUTHOR, si.getAuthor());
         assertEquals(P_CHAR_COUNT, si.getCharCount());
@@ -404,7 +399,7 @@
         // FIXME (byte array properties not yet implemented): assertEquals(P_THUMBNAIL, si.getThumbnail());
         assertEquals(P_TITLE, si.getTitle());
         assertEquals(P_WORD_COUNT, si.getWordCount());
-    
+
         assertEquals(P_BYTE_COUNT, dsi.getByteCount());
         assertEquals(P_CATEGORY, dsi.getCategory());
         assertEquals(P_COMPANY, dsi.getCompany());
@@ -434,7 +429,7 @@
         assertEquals(NEGATIVE_INTEGER, cps.get("negative_Integer"));
         assertEquals(NEGATIVE_LONG, cps.get("negative_Long"));
         assertEquals(NEGATIVE_DOUBLE, cps.get("negative_Double"));
-        assertEquals(new Boolean(true), cps.get("Boolean"));
+        assertEquals(Boolean.TRUE, cps.get("Boolean"));
         assertEquals(now, cps.get("Date"));
         assertEquals(MAX_INTEGER, cps.get("max_Integer"));
         assertEquals(MIN_INTEGER, cps.get("min_Integer"));
@@ -464,7 +459,7 @@
         si.removeThumbnail();
         si.removeTitle();
         si.removeWordCount();
-    
+
         dsi.removeByteCount();
         dsi.removeCategory();
         dsi.removeCompany();
@@ -481,14 +476,14 @@
         dsi.removePresentationFormat();
         dsi.removeScale();
         dsi.removeSlideCount();
-    
-        /* 
+
+        /*
          * <li><p>Write the summary information stream and the document summary
          * information stream to the POI filesystem. */
         si.write(dir, siEntry.getName());
         dsi.write(dir, dsiEntry.getName());
-    
-        /* 
+
+        /*
          * <li><p>Write the POI filesystem to a (temporary) file <em>doc3</em>
          * and close the latter. */
         final File doc3 = File.createTempFile("POI_HPSF_Test.", ".tmp");
@@ -496,8 +491,8 @@
         out = new FileOutputStream(doc3);
         poifs.writeFilesystem(out);
         out.close();
-    
-        /* 
+
+        /*
          * Open <em>doc3</em> for reading and check summary information
          * and document summary information. All properties removed before must not
          * be found in the property streams of <em>doc3</em>.
@@ -506,14 +501,14 @@
         dir = poifs.getRoot();
         siEntry = (DocumentEntry) dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
         dsiEntry = (DocumentEntry) dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
-    
+
         dis = new DocumentInputStream(siEntry);
         ps = new PropertySet(dis);
         si = new SummaryInformation(ps);
         dis = new DocumentInputStream(dsiEntry);
         ps = new PropertySet(dis);
         dsi = new DocumentSummaryInformation(ps);
-    
+
         assertEquals(null, si.getApplicationName());
         assertEquals(null, si.getAuthor());
         assertEquals(0, si.getCharCount());
@@ -537,7 +532,7 @@
         assertEquals(null, si.getTitle());
         assertEquals(0, si.getWordCount());
         assertTrue(si.wasNull());
-    
+
         assertEquals(0, dsi.getByteCount());
         assertTrue(dsi.wasNull());
         assertEquals(null, dsi.getCategory());
@@ -611,7 +606,7 @@
                 else
                     dsi = PropertySetFactory.newDocumentSummaryInformation();
                 final CustomProperties cps = dsi.getCustomProperties();
-                
+
                 if (cps == null)
                     /* The document does not have custom properties. */
                     return;
@@ -663,14 +658,14 @@
         assertEquals(1, cps.size());
         Object v1 = cps.get(KEY);
         assertEquals(VALUE_1, v1);
-        
+
         /* After adding a custom property with the same name the size must still
          * be one. */
         cps.put(KEY, VALUE_2);
         assertEquals(1, cps.size());
         Object v2 = cps.get(KEY);
         assertEquals(VALUE_2, v2);
-        
+
         /* Removing the custom property must return the remove property and
          * reduce the size to 0. */
         cp = (CustomProperty) cps.remove(KEY);
@@ -715,7 +710,7 @@
         p.setType(Variant.VT_LPWSTR);
         p.setValue(VALUE_1);
         s.setProperty(p);
-        dictionary.put(new Long(ID_1), NAME_1);
+        dictionary.put(Long.valueOf(ID_1), NAME_1);
         s.setDictionary(dictionary);
         cps = dsi.getCustomProperties();
         assertEquals(1, cps.size());
@@ -723,7 +718,7 @@
 
         /* Add another custom property. */
         s.setProperty(ID_2, Variant.VT_LPWSTR, VALUE_1);
-        dictionary.put(new Long(ID_2), NAME_1);
+        dictionary.put(Long.valueOf(ID_2), NAME_1);
         s.setDictionary(dictionary);
         cps = dsi.getCustomProperties();
         assertEquals(1, cps.size());



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org