]> source.dussan.org Git - poi.git/commitdiff
Applied patches from Loiec Lefeavre
authorAndrew C. Oliver <acoliver@apache.org>
Fri, 15 Mar 2002 02:47:56 +0000 (02:47 +0000)
committerAndrew C. Oliver <acoliver@apache.org>
Fri, 15 Mar 2002 02:47:56 +0000 (02:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352216 13f79535-47bb-0310-9956-ffa450edef68

22 files changed:
src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java
src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
src/java/org/apache/poi/poifs/property/Property.java
src/java/org/apache/poi/poifs/property/PropertyFactory.java
src/java/org/apache/poi/poifs/property/PropertyTable.java
src/java/org/apache/poi/poifs/property/RootProperty.java
src/java/org/apache/poi/poifs/storage/BATBlock.java
src/java/org/apache/poi/poifs/storage/BlockAllocationTableReader.java
src/java/org/apache/poi/poifs/storage/BlockAllocationTableWriter.java
src/java/org/apache/poi/poifs/storage/DocumentBlock.java
src/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java
src/java/org/apache/poi/poifs/storage/HeaderBlockReader.java
src/java/org/apache/poi/poifs/storage/HeaderBlockWriter.java
src/java/org/apache/poi/poifs/storage/PropertyBlock.java
src/java/org/apache/poi/poifs/storage/RawDataBlock.java
src/java/org/apache/poi/poifs/storage/SmallDocumentBlock.java
src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java
src/testcases/org/apache/poi/poifs/property/TestDirectoryProperty.java
src/testcases/org/apache/poi/poifs/property/TestRootProperty.java
src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.java
src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.java

index 0cef96459219f62ea4e01145e08d97f461bb2143..890074a2fdf7508fa7f45fa017ce73bd7e65ae66 100644 (file)
@@ -72,6 +72,7 @@ import org.apache.poi.hssf.record.BoolErrRecord;
 import org.apache.poi.hssf.record.ExtendedFormatRecord;
 
 import java.util.Date;
+import java.util.Calendar;
 
 /**
  * High level representation of a cell in a row of a spreadsheet.
@@ -633,6 +634,19 @@ public class HSSFCell
         setCellValue(HSSFDateUtil.getExcelDate(value));
     }
 
+    /**
+     * set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as
+     * a date.
+     *
+     * @param value  the date value to set this cell to.  For formulas we'll set the
+     *        precalculated value, for numerics we'll set its value. For othertypes we
+     *        will change the cell to a numeric cell and set its value.
+     */
+    public void setCellValue(Calendar value)
+    {
+        setCellValue(value.getTime());
+    }
+
     /**
      * set a string value for the cell.
      *
index 907557de42cae5880b20a3b8547771b4fa0350a1..e500591efc96e08c444d989734abd55aa508470f 100644 (file)
@@ -59,7 +59,7 @@ import java.io.*;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.dev.POIFSViewable;
 import org.apache.poi.poifs.property.DocumentProperty;
 import org.apache.poi.poifs.property.Property;
@@ -628,7 +628,7 @@ public class POIFSDocument
                     writer.processPOIFSWriterEvent(
                         new POIFSWriterEvent(dstream, path, name, size));
                     dstream.writeFiller(countBlocks()
-                                        * PoiFSConstants
+                                        * POIFSConstants
                                             .BIG_BLOCK_SIZE, DocumentBlock
                                             .getFillByte());
                 }
@@ -654,8 +654,8 @@ public class POIFSDocument
             {
                 if (writer != null)
                 {
-                    rval = (size + PoiFSConstants.BIG_BLOCK_SIZE - 1)
-                           / PoiFSConstants.BIG_BLOCK_SIZE;
+                    rval = (size + POIFSConstants.BIG_BLOCK_SIZE - 1)
+                           / POIFSConstants.BIG_BLOCK_SIZE;
                 }
                 else
                 {
index de1ca30726b4b2714c3c4ab089591eb924f87c8d..dbd473f23f0a1fa7224de6c4580c04757ae91886 100644 (file)
@@ -59,7 +59,7 @@ import java.io.*;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.dev.POIFSViewable;
 import org.apache.poi.poifs.property.DirectoryProperty;
 import org.apache.poi.poifs.property.DocumentProperty;
index d7560ab17771aa7a6e2d1892d4c0fbc3023cb1c6..d5c1614afe2b6ce0a7bb46272daf4e8a8227d0e6 100644 (file)
@@ -59,7 +59,7 @@ import java.io.*;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.dev.POIFSViewable;
 import org.apache.poi.util.ByteField;
 import org.apache.poi.util.IntegerField;
@@ -124,7 +124,7 @@ public abstract class Property
 
     protected Property()
     {
-        _raw_data = new byte[ PoiFSConstants.PROPERTY_SIZE ];
+        _raw_data = new byte[ POIFSConstants.PROPERTY_SIZE ];
         Arrays.fill(_raw_data, _default_fill);
         _name_size         = new ShortField(_name_size_offset);
         _property_type     =
@@ -160,9 +160,9 @@ public abstract class Property
 
     protected Property(final int index, final byte [] array, final int offset)
     {
-        _raw_data = new byte[ PoiFSConstants.PROPERTY_SIZE ];
+        _raw_data = new byte[ POIFSConstants.PROPERTY_SIZE ];
         System.arraycopy(array, offset, _raw_data, 0,
-                         PoiFSConstants.PROPERTY_SIZE);
+                         POIFSConstants.PROPERTY_SIZE);
         _name_size         = new ShortField(_name_size_offset, _raw_data);
         _property_type     =
             new ByteField(PropertyConstants.PROPERTY_TYPE_OFFSET, _raw_data);
index 20f0dc1e8f435b7c5360c00983036859d1fd88ab..43ba1076d34e8ed863e23899466604509250e097 100644 (file)
@@ -59,7 +59,7 @@ import java.io.IOException;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.storage.ListManagedBlock;
 
 /**
@@ -102,7 +102,7 @@ class PropertyFactory
         {
             byte[] data           = blocks[ j ].getData();
             int    property_count = data.length
-                                    / PoiFSConstants.PROPERTY_SIZE;
+                                    / POIFSConstants.PROPERTY_SIZE;
             int    offset         = 0;
 
             for (int k = 0; k < property_count; k++)
@@ -130,7 +130,7 @@ class PropertyFactory
                         properties.add(null);
                         break;
                 }
-                offset += PoiFSConstants.PROPERTY_SIZE;
+                offset += POIFSConstants.PROPERTY_SIZE;
             }
         }
         return properties;
index d744e9bb340082d6a8981baf2a2bc83a295280e5..e7d25efc20cc8539121fd9f471eebc56444c3c59 100644 (file)
@@ -60,7 +60,7 @@ import java.io.OutputStream;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.filesystem.BATManaged;
 import org.apache.poi.poifs.storage.BlockWritable;
 import org.apache.poi.poifs.storage.PropertyBlock;
@@ -88,7 +88,7 @@ public class PropertyTable
 
     public PropertyTable()
     {
-        _start_block = PoiFSConstants.END_OF_CHAIN;
+        _start_block = POIFSConstants.END_OF_CHAIN;
         _properties  = new ArrayList();
         addProperty(new RootProperty());
         _blocks = null;
@@ -110,7 +110,7 @@ public class PropertyTable
                          final RawDataBlockList blockList)
         throws IOException
     {
-        _start_block = PoiFSConstants.END_OF_CHAIN;
+        _start_block = POIFSConstants.END_OF_CHAIN;
         _blocks      = null;
         _properties  =
             PropertyFactory
index 7a275eb0a14f0d2eed677fd94db9b3865256f81c..973a16d040e03b5f000d028e2988b6dad5e12178 100644 (file)
@@ -59,7 +59,7 @@ import java.util.*;
 
 import java.io.IOException;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.storage.SmallDocumentBlock;
 
 /**
@@ -83,7 +83,7 @@ public class RootProperty
         // overrides
         setNodeColor(_NODE_BLACK);
         setPropertyType(PropertyConstants.ROOT_TYPE);
-        setStartBlock(PoiFSConstants.END_OF_CHAIN);
+        setStartBlock(POIFSConstants.END_OF_CHAIN);
     }
 
     /**
index 0b54bb6d6193210c38c59cc5537384424fca8c41..f8bbbdc879984348eaedc27d519deb1f63b81f44 100644 (file)
@@ -60,7 +60,7 @@ import java.io.OutputStream;
 
 import java.util.Arrays;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.IntegerField;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianConsts;
@@ -76,7 +76,7 @@ public class BATBlock
     extends BigBlock
 {
     private static final int  _entries_per_block      =
-        PoiFSConstants.BIG_BLOCK_SIZE / LittleEndianConsts.INT_SIZE;
+        POIFSConstants.BIG_BLOCK_SIZE / LittleEndianConsts.INT_SIZE;
     private static final int  _entries_per_xbat_block = _entries_per_block
                                                             - 1;
     private static final int  _xbat_chain_offset      =
@@ -91,7 +91,7 @@ public class BATBlock
 
     private BATBlock()
     {
-        _data = new byte[ PoiFSConstants.BIG_BLOCK_SIZE ];
+        _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
         Arrays.fill(_data, _default_value);
         _fields = new IntegerField[ _entries_per_block ];
         int offset = 0;
@@ -164,7 +164,7 @@ public class BATBlock
             {
                 blocks[ index ].setXBATChain(startBlock + index + 1);
             }
-            blocks[ index ].setXBATChain(PoiFSConstants.END_OF_CHAIN);
+            blocks[ index ].setXBATChain(POIFSConstants.END_OF_CHAIN);
         }
         return blocks;
     }
index 357be636adf8e7f9c1d5b0308b79b084543ec16b..ade9b5feaf6fa67aa9ead61fcc8ad85963afec1b 100644 (file)
@@ -60,7 +60,7 @@ import java.io.OutputStream;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.IntList;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianConsts;
@@ -158,7 +158,7 @@ public class BlockAllocationTableReader
                     offset                  += LittleEndianConsts.INT_SIZE;
                 }
                 chain_index = LittleEndian.getInt(data, chain_index_offset);
-                if (chain_index == PoiFSConstants.END_OF_CHAIN)
+                if (chain_index == POIFSConstants.END_OF_CHAIN)
                 {
                     break;
                 }
@@ -222,7 +222,7 @@ public class BlockAllocationTableReader
         List blocks       = new ArrayList();
         int  currentBlock = startBlock;
 
-        while (currentBlock != PoiFSConstants.END_OF_CHAIN)
+        while (currentBlock != POIFSConstants.END_OF_CHAIN)
         {
             blocks.add(blockList.remove(currentBlock));
             currentBlock = _entries.get(currentBlock);
@@ -261,7 +261,7 @@ public class BlockAllocationTableReader
      * @param index of the current block
      *
      * @return index of the next block (may be
-     *         PoiFSConstants.END_OF_CHAIN, indicating end of chain
+     *         POIFSConstants.END_OF_CHAIN, indicating end of chain
      *         (duh))
      *
      * @exception IOException if the current block is unused
@@ -305,7 +305,7 @@ public class BlockAllocationTableReader
             {
                 int entry = LittleEndian.getInt(data, offset);
 
-                if (entry == PoiFSConstants.UNUSED_BLOCK)
+                if (entry == POIFSConstants.UNUSED_BLOCK)
                 {
                     raw_blocks.zap(_entries.size());
                 }
index 4fa181955e47e16f639e6f05de5163f36bad4627..ddd14b26feb46f1eab2c2634777ed608b4c07276 100644 (file)
@@ -60,7 +60,7 @@ import java.io.OutputStream;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.filesystem.BATManaged;
 import org.apache.poi.util.IntList;
 import org.apache.poi.util.LittleEndian;
@@ -95,7 +95,7 @@ public class BlockAllocationTableWriter
 
     public BlockAllocationTableWriter()
     {
-        _start_block = PoiFSConstants.END_OF_CHAIN;
+        _start_block = POIFSConstants.END_OF_CHAIN;
         _entries     = new IntList();
         _blocks      = new BATBlock[ 0 ];
     }
@@ -162,7 +162,7 @@ public class BlockAllocationTableWriter
             {
                 _entries.add(index++);
             }
-            _entries.add(PoiFSConstants.END_OF_CHAIN);
+            _entries.add(POIFSConstants.END_OF_CHAIN);
         }
         return startBlock;
     }
index 9f5207cc6fd827dcc97d35acdb00c3447bf7264d..9836e3b27da4a1c7a269a3d98271ed4f76cba73d 100644 (file)
@@ -61,7 +61,7 @@ import java.io.OutputStream;
 
 import java.util.Arrays;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.IntegerField;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianConsts;
@@ -118,7 +118,7 @@ public class DocumentBlock
 
     private DocumentBlock()
     {
-        _data = new byte[ PoiFSConstants.BIG_BLOCK_SIZE ];
+        _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
         Arrays.fill(_data, _default_value);
     }
 
@@ -141,7 +141,7 @@ public class DocumentBlock
 
     public boolean partiallyRead()
     {
-        return _bytes_read != PoiFSConstants.BIG_BLOCK_SIZE;
+        return _bytes_read != POIFSConstants.BIG_BLOCK_SIZE;
     }
 
     /**
@@ -168,7 +168,7 @@ public class DocumentBlock
                                            final int size)
     {
         DocumentBlock[] rval   =
-            new DocumentBlock[ (size + PoiFSConstants.BIG_BLOCK_SIZE - 1) / PoiFSConstants.BIG_BLOCK_SIZE ];
+            new DocumentBlock[ (size + POIFSConstants.BIG_BLOCK_SIZE - 1) / POIFSConstants.BIG_BLOCK_SIZE ];
         int             offset = 0;
 
         for (int k = 0; k < rval.length; k++)
@@ -176,14 +176,14 @@ public class DocumentBlock
             rval[ k ] = new DocumentBlock();
             if (offset < array.length)
             {
-                int length = Math.min(PoiFSConstants.BIG_BLOCK_SIZE,
+                int length = Math.min(POIFSConstants.BIG_BLOCK_SIZE,
                                       array.length - offset);
 
                 System.arraycopy(array, offset, rval[ k ]._data, 0, length);
-                if (length != PoiFSConstants.BIG_BLOCK_SIZE)
+                if (length != POIFSConstants.BIG_BLOCK_SIZE)
                 {
                     Arrays.fill(rval[ k ]._data, length,
-                                PoiFSConstants.BIG_BLOCK_SIZE,
+                                POIFSConstants.BIG_BLOCK_SIZE,
                                 _default_value);
                 }
             }
@@ -191,7 +191,7 @@ public class DocumentBlock
             {
                 Arrays.fill(rval[ k ]._data, _default_value);
             }
-            offset += PoiFSConstants.BIG_BLOCK_SIZE;
+            offset += POIFSConstants.BIG_BLOCK_SIZE;
         }
         return rval;
     }
@@ -207,10 +207,10 @@ public class DocumentBlock
     public static void read(final DocumentBlock [] blocks,
                             final byte [] buffer, final int offset)
     {
-        int firstBlockIndex  = offset / PoiFSConstants.BIG_BLOCK_SIZE;
-        int firstBlockOffset = offset % PoiFSConstants.BIG_BLOCK_SIZE;
+        int firstBlockIndex  = offset / POIFSConstants.BIG_BLOCK_SIZE;
+        int firstBlockOffset = offset % POIFSConstants.BIG_BLOCK_SIZE;
         int lastBlockIndex   = (offset + buffer.length - 1)
-                               / PoiFSConstants.BIG_BLOCK_SIZE;
+                               / POIFSConstants.BIG_BLOCK_SIZE;
 
         if (firstBlockIndex == lastBlockIndex)
         {
@@ -223,14 +223,14 @@ public class DocumentBlock
 
             System.arraycopy(blocks[ firstBlockIndex ]._data,
                              firstBlockOffset, buffer, buffer_offset,
-                             PoiFSConstants.BIG_BLOCK_SIZE
+                             POIFSConstants.BIG_BLOCK_SIZE
                              - firstBlockOffset);
-            buffer_offset += PoiFSConstants.BIG_BLOCK_SIZE - firstBlockOffset;
+            buffer_offset += POIFSConstants.BIG_BLOCK_SIZE - firstBlockOffset;
             for (int j = firstBlockIndex + 1; j < lastBlockIndex; j++)
             {
                 System.arraycopy(blocks[ j ]._data, 0, buffer, buffer_offset,
-                                 PoiFSConstants.BIG_BLOCK_SIZE);
-                buffer_offset += PoiFSConstants.BIG_BLOCK_SIZE;
+                                 POIFSConstants.BIG_BLOCK_SIZE);
+                buffer_offset += POIFSConstants.BIG_BLOCK_SIZE;
             }
             System.arraycopy(blocks[ lastBlockIndex ]._data, 0, buffer,
                              buffer_offset, buffer.length - buffer_offset);
index 0bb5b124b1b0c1c94627a447c07b880bdf257cbc..c2c440160c8d04e515082c420e91626fb6a6808a 100644 (file)
@@ -55,7 +55,7 @@
 
 package org.apache.poi.poifs.storage;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.IntegerField;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianConsts;
@@ -73,7 +73,7 @@ public interface HeaderBlockConstants
     public static final long _signature             = 0xE11AB1A1E011CFD0L;
     public static final int  _bat_array_offset      = 0x4c;
     public static final int  _max_bats_in_header    =
-        (PoiFSConstants.BIG_BLOCK_SIZE - _bat_array_offset)
+        (POIFSConstants.BIG_BLOCK_SIZE - _bat_array_offset)
         / LittleEndianConsts.INT_SIZE;
 
     // useful offsets
index c33d86468ca1d3dca5bb015e0dbf7abbde4af976..8eb10533cbc9327df0826864ade61b1c27faeb13 100644 (file)
@@ -59,7 +59,7 @@ import java.io.*;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.IntegerField;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianConsts;
@@ -103,17 +103,17 @@ public class HeaderBlockReader
     public HeaderBlockReader(final InputStream stream)
         throws IOException
     {
-        _data = new byte[ PoiFSConstants.BIG_BLOCK_SIZE ];
+        _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
         int byte_count = stream.read(_data);
 
-        if (byte_count != PoiFSConstants.BIG_BLOCK_SIZE)
+        if (byte_count != POIFSConstants.BIG_BLOCK_SIZE)
         {
             String type = " byte" + ((byte_count == 1) ? ("")
                                                        : ("s"));
 
             throw new IOException("Unable to read entire header; "
                                   + byte_count + type + " read; expected "
-                                  + PoiFSConstants.BIG_BLOCK_SIZE + " bytes");
+                                  + POIFSConstants.BIG_BLOCK_SIZE + " bytes");
         }
 
         // verify signature
index 1d4bed50adc045754e7d7a266a8097d728acdc2c..9253d1c61c6e3e7b70c6884273931ab1fa410118 100644 (file)
@@ -59,7 +59,7 @@ import java.io.*;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.IntegerField;
 import org.apache.poi.util.LittleEndianConsts;
 import org.apache.poi.util.LongField;
@@ -99,7 +99,7 @@ public class HeaderBlockWriter
 
     public HeaderBlockWriter()
     {
-        _data = new byte[ PoiFSConstants.BIG_BLOCK_SIZE ];
+        _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
         Arrays.fill(_data, _default_value);
         new LongField(_signature_offset, _signature, _data);
         new IntegerField(0x08, 0, _data);
@@ -115,15 +115,15 @@ public class HeaderBlockWriter
         new IntegerField(0x28, 0, _data);
         _bat_count      = new IntegerField(_bat_count_offset, 0, _data);
         _property_start = new IntegerField(_property_start_offset,
-                                           PoiFSConstants.END_OF_CHAIN,
+                                           POIFSConstants.END_OF_CHAIN,
                                            _data);
         new IntegerField(0x34, 0, _data);
         new IntegerField(0x38, 0x1000, _data);
         _sbat_start = new IntegerField(_sbat_start_offset,
-                                       PoiFSConstants.END_OF_CHAIN, _data);
+                                       POIFSConstants.END_OF_CHAIN, _data);
         new IntegerField(0x40, 1, _data);
         _xbat_start = new IntegerField(_xbat_start_offset,
-                                       PoiFSConstants.END_OF_CHAIN, _data);
+                                       POIFSConstants.END_OF_CHAIN, _data);
         _xbat_count = new IntegerField(_xbat_count_offset, 0, _data);
     }
 
@@ -170,7 +170,7 @@ public class HeaderBlockWriter
         else
         {
             rvalue = BATBlock.createXBATBlocks(new int[ 0 ], 0);
-            _xbat_start.set(PoiFSConstants.END_OF_CHAIN, _data);
+            _xbat_start.set(POIFSConstants.END_OF_CHAIN, _data);
         }
         _xbat_count.set(rvalue.length, _data);
         return rvalue;
index 36f15d91e366e1f6ea7809d5b06bbfb16cad37ff..cd7729501d1576dbc562e4e3788b1a19a95d8bb1 100644 (file)
@@ -59,7 +59,7 @@ import java.io.*;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.property.Property;
 import org.apache.poi.util.IntegerField;
 import org.apache.poi.util.LittleEndian;
@@ -75,7 +75,7 @@ public class PropertyBlock
     extends BigBlock
 {
     private static final int _properties_per_block =
-        PoiFSConstants.BIG_BLOCK_SIZE / PoiFSConstants.PROPERTY_SIZE;
+        POIFSConstants.BIG_BLOCK_SIZE / POIFSConstants.PROPERTY_SIZE;
     private Property[]       _properties;
 
     /**
index 05a53ab7c4cefb1594b8624e8a0973e94d946c32..9c7d680c93216e694e062c1ec678f92480df4ff2 100644 (file)
@@ -55,7 +55,7 @@
 
 package org.apache.poi.poifs.storage;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 
 import java.io.*;
 
@@ -83,21 +83,21 @@ public class RawDataBlock
     public RawDataBlock(final InputStream stream)
         throws IOException
     {
-        _data = new byte[ PoiFSConstants.BIG_BLOCK_SIZE ];
+        _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
         int count = stream.read(_data);
 
         if (count == -1)
         {
             _eof = true;
         }
-        else if (count != PoiFSConstants.BIG_BLOCK_SIZE)
+        else if (count != POIFSConstants.BIG_BLOCK_SIZE)
         {
             String type = " byte" + ((count == 1) ? ("")
                                                   : ("s"));
 
             throw new IOException("Unable to read entire block; " + count
                                   + type + " read; expected "
-                                  + PoiFSConstants.BIG_BLOCK_SIZE + " bytes");
+                                  + POIFSConstants.BIG_BLOCK_SIZE + " bytes");
         }
         else
         {
index b5e27f9068dcdf92268debd174b37335417738fe..4cb157af35075385d1dd22e2ce6949321339f9da 100644 (file)
@@ -59,7 +59,7 @@ import java.io.*;
 
 import java.util.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 
 /**
  * Storage for documents that are too small to use regular
@@ -75,7 +75,7 @@ public class SmallDocumentBlock
     private static final byte _default_fill         = ( byte ) 0xff;
     private static final int  _block_size           = 64;
     private static final int  _blocks_per_big_block =
-        PoiFSConstants.BIG_BLOCK_SIZE / _block_size;
+        POIFSConstants.BIG_BLOCK_SIZE / _block_size;
 
     private SmallDocumentBlock(final byte [] data, final int index)
     {
index f7eb6a5162cf7f19dbd63edc234ec57c616d63ef..04fa4c6584c170c93825cabc172b7d9536d27581 100644 (file)
@@ -135,7 +135,7 @@ public class TestCellStyle
     }
 
     /**
-     * Tests that is creating a file with a date works correctly.
+     * Tests that is creating a file with a date or an calendar works correctly.
      */
     public void testDataStyle()
             throws Exception
@@ -147,10 +147,21 @@ public class TestCellStyle
         HSSFSheet        s    = wb.createSheet();
         HSSFCellStyle    cs   = wb.createCellStyle();
         HSSFRow row = s.createRow((short)0);
+
+        // with Date:
         HSSFCell cell = row.createCell((short)1);
         cs.setDataFormat(HSSFDataFormat.getFormat("m/d/yy"));
         cell.setCellStyle(cs);
         cell.setCellValue(new Date());
+
+        // with Calendar:
+        cell = row.createCell((short)2);
+        cs.setDataFormat(HSSFDataFormat.getFormat("m/d/yy"));
+        cell.setCellStyle(cs);
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(new Date());
+        cell.setCellValue(cal);
+
         wb.write(out);
         out.close();
 
index 3ed55270e9c72707e7832f7168e2bc3b5446b9d0..9eca02541b532884967429927dc354e2bcc976b6 100644 (file)
@@ -61,7 +61,7 @@ import java.util.*;
 
 import junit.framework.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 
 /**
  * Class to test DirectoryProperty functionality
index 8304647595c1a101232c470de263547a966807bf..cec79393ee3ab461619783478c89b74a630a4a83 100644 (file)
@@ -61,7 +61,7 @@ import java.util.*;
 
 import junit.framework.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 
 /**
  * Class to test RootProperty functionality
@@ -124,7 +124,7 @@ public class TestRootProperty
         {
             _testblock[ index ] = ( byte ) 0;
         }
-        _testblock[ index++ ] = ( byte ) PoiFSConstants.END_OF_CHAIN;
+        _testblock[ index++ ] = ( byte ) POIFSConstants.END_OF_CHAIN;
         for (; index < 0x78; index++)
         {
             _testblock[ index ] = ( byte ) 0xff;
index cd0c116b716a2f87a6ac49ac4bd042bee6a7f883..566b363ee2b5d63cfe6f476c75bab2ad636b8c29 100644 (file)
@@ -61,7 +61,7 @@ import java.util.*;
 
 import junit.framework.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianConsts;
 
@@ -1254,7 +1254,7 @@ public class TestBlockAllocationTableReader
             else if (i % 256 == 255)
             {
                 assertEquals("Verify end of chain for block " + i,
-                             PoiFSConstants.END_OF_CHAIN,
+                             POIFSConstants.END_OF_CHAIN,
                              table.getNextBlockIndex(i));
             }
             else
index c751f038b2de98d99f31483914ba12c93117e8a7..f8e57472758bc47c3e6bfa8541030b8a5a985757 100644 (file)
@@ -61,7 +61,7 @@ import java.util.*;
 
 import junit.framework.*;
 
-import org.apache.poi.poifs.common.PoiFSConstants;
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianConsts;
 
@@ -189,7 +189,7 @@ public class TestBlockAllocationTableWriter
                 offset += LittleEndianConsts.INT_SIZE;
             }
             LittleEndian.putInt(expected, offset,
-                                PoiFSConstants.END_OF_CHAIN);
+                                POIFSConstants.END_OF_CHAIN);
             offset += 4;
             block_index++;
         }
@@ -197,7 +197,7 @@ public class TestBlockAllocationTableWriter
         // add BAT block indices
         LittleEndian.putInt(expected, offset, block_index++);
         offset += LittleEndianConsts.INT_SIZE;
-        LittleEndian.putInt(expected, offset, PoiFSConstants.END_OF_CHAIN);
+        LittleEndian.putInt(expected, offset, POIFSConstants.END_OF_CHAIN);
         for (int k = 0; k < expected.length; k++)
         {
             assertEquals("At offset " + k, expected[ k ], output[ k ]);