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 [1/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/...
Author: josh
Date: Thu Oct 8 22:29:41 2009
New Revision: 823348
URL: http://svn.apache.org/viewvc?rev=823348&view=rev
Log:
Bugzilla 47962 - Fixed some potential NPEs. Avoided unnecessary creation of box instances. Applied patch with mods
Modified:
poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableCellEditor.java
poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableUtils.java
poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/CellUtil.java
poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/RegionUtil.java
poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java
poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java
poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java
poi/trunk/src/java/org/apache/poi/ddf/EscherProperties.java
poi/trunk/src/java/org/apache/poi/hpsf/CustomProperties.java
poi/trunk/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java
poi/trunk/src/java/org/apache/poi/hpsf/MutableSection.java
poi/trunk/src/java/org/apache/poi/hpsf/Property.java
poi/trunk/src/java/org/apache/poi/hpsf/Section.java
poi/trunk/src/java/org/apache/poi/hpsf/Variant.java
poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java
poi/trunk/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.java
poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/HSSFRequest.java
poi/trunk/src/java/org/apache/poi/hssf/model/DrawingManager.java
poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java
poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java
poi/trunk/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java
poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
poi/trunk/src/java/org/apache/poi/hssf/record/NoteRecord.java
poi/trunk/src/java/org/apache/poi/hssf/record/PageBreakRecord.java
poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java
poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java
poi/trunk/src/java/org/apache/poi/hssf/record/TextObjectRecord.java
poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java
poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
poi/trunk/src/java/org/apache/poi/hssf/record/formula/function/FunctionDataBuilder.java
poi/trunk/src/java/org/apache/poi/hssf/usermodel/FontDetails.java
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java
poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
poi/trunk/src/java/org/apache/poi/ss/usermodel/BuiltinFormats.java
poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
poi/trunk/src/java/org/apache/poi/ss/util/SheetReferences.java
poi/trunk/src/java/org/apache/poi/util/BitFieldFactory.java
poi/trunk/src/java/org/apache/poi/util/HexRead.java
poi/trunk/src/java/org/apache/poi/util/IntMapper.java
poi/trunk/src/java/org/apache/poi/util/POILogger.java
poi/trunk/src/java/org/apache/poi/util/StringUtil.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLProperties.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/Borders.java
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/TOC.java
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java
poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/data/ListTables.java
poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/util/BTreeSet.java
poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java
poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/ListTables.java
poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/util/BTreeSet.java
poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java
poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/UserEditAndPersistListing.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ShapeTypes.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CString.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Record.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FSPATable.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java
poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java
poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java
poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/function/ExcelFileFormatDocFunctionExtractor.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/StreamUtility.java
poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
poi/trunk/src/testcases/org/apache/poi/util/LocalTestNode.java
poi/trunk/src/testcases/org/apache/poi/util/TestArrayUtil.java
poi/trunk/src/testcases/org/apache/poi/util/TestBinaryTree.java
poi/trunk/src/testcases/org/apache/poi/util/TestPOILogger.java
poi/trunk/src/testcases/org/apache/poi/util/TestStringUtil.java
Modified: poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableCellEditor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableCellEditor.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableCellEditor.java (original)
+++ poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableCellEditor.java Thu Oct 8 22:29:41 2009
@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.hssf.contrib.view;
import java.awt.*;
@@ -33,7 +33,6 @@
* nearly completely consists of overridden methods.
*
* @author Jason Height
- * @since 16 July 2002
*/
public class SVTableCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
private static final Color black = getAWTColor(new HSSFColor.BLACK());
@@ -192,7 +191,7 @@
*
*/
private final Color getAWTColor(int index, Color deflt) {
- HSSFColor clr = (HSSFColor)colors.get(new Integer(index));
+ HSSFColor clr = (HSSFColor)colors.get(Integer.valueOf(index));
if (clr == null) return deflt;
return getAWTColor(clr);
}
@@ -201,5 +200,4 @@
short[] rgb = clr.getTriplet();
return new Color(rgb[0],rgb[1],rgb[2]);
}
-
}
Modified: poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableUtils.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableUtils.java (original)
+++ poi/trunk/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableUtils.java Thu Oct 8 22:29:41 2009
@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.hssf.contrib.view;
import java.util.*;
@@ -29,7 +29,6 @@
* SVTableCell Editor and Renderer helper functions.
*
* @author Jason Height
- * @since 16 July 2002
*/
public class SVTableUtils {
private final static Hashtable colors = HSSFColor.getIndexHash();
@@ -73,7 +72,7 @@
* @return The aWTColor value
*/
public final static Color getAWTColor(int index, Color deflt) {
- HSSFColor clr = (HSSFColor) colors.get(new Integer(index));
+ HSSFColor clr = (HSSFColor) colors.get(Integer.valueOf(index));
if (clr == null) {
return deflt;
}
@@ -91,5 +90,4 @@
short[] rgb = clr.getTriplet();
return new Color(rgb[0], rgb[1], rgb[2]);
}
-
}
Modified: poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/CellUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/CellUtil.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/CellUtil.java (original)
+++ poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/CellUtil.java Thu Oct 8 22:29:41 2009
@@ -154,7 +154,7 @@
* @see CellStyle for alignment options
*/
public static void setAlignment(Cell cell, Workbook workbook, short align) {
- setCellStyleProperty(cell, workbook, ALIGNMENT, new Short(align));
+ setCellStyleProperty(cell, workbook, ALIGNMENT, Short.valueOf(align));
}
/**
@@ -311,7 +311,7 @@
* @param value property value
*/
private static void putShort(Map<String, Object> properties, String name, short value) {
- properties.put(name, new Short(value));
+ properties.put(name, Short.valueOf(value));
}
/**
@@ -322,7 +322,7 @@
* @param value property value
*/
private static void putBoolean(Map<String, Object> properties, String name, boolean value) {
- properties.put(name, new Boolean(value));
+ properties.put(name, Boolean.valueOf(value));
}
/**
Modified: poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/RegionUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/RegionUtil.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/RegionUtil.java (original)
+++ poi/trunk/src/contrib/src/org/apache/poi/ss/usermodel/contrib/RegionUtil.java Thu Oct 8 22:29:41 2009
@@ -48,7 +48,7 @@
public CellPropertySetter(Workbook workbook, String propertyName, int value) {
_workbook = workbook;
_propertyName = propertyName;
- _propertyValue = new Short((short) value);
+ _propertyValue = Short.valueOf((short) value);
}
Modified: poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java Thu Oct 8 22:29:41 2009
@@ -45,53 +45,52 @@
* the summary information and in the document summary information. The
* application reads the name of a POI filesystem from the command line and
* performs the following actions:</p>
- *
+ *
* <ul>
- *
+ *
* <li><p>Open the POI filesystem.</p></li>
- *
+ *
* <li><p>Read the summary information.</p></li>
- *
+ *
* <li><p>Read and print the "author" property.</p></li>
- *
+ *
* <li><p>Change the author to "Rainer Klute".</p></li>
- *
+ *
* <li><p>Read the document summary information.</p></li>
- *
+ *
* <li><p>Read and print the "category" property.</p></li>
- *
+ *
* <li><p>Change the category to "POI example".</p></li>
- *
+ *
* <li><p>Read the custom properties (if available).</p></li>
- *
+ *
* <li><p>Insert a new custom property.</p></li>
- *
+ *
* <li><p>Write the custom properties back to the document summary
* information.</p></li>
- *
+ *
* <li><p>Write the summary information to the POI filesystem.</p></li>
- *
+ *
* <li><p>Write the document summary information to the POI filesystem.</p></li>
- *
+ *
* <li><p>Write the POI filesystem back to the original file.</p></li>
- *
+ *
* </ol>
- *
+ *
* @author Rainer Klute <a
* href="mailto:klute@rainer-klute.de">klute@rainer-klute.de</a>
*/
-public class ModifyDocumentSummaryInformation
-{
+public class ModifyDocumentSummaryInformation {
/**
* <p>Main method - see class description.</p>
*
* @param args The command-line parameters.
- * @throws IOException
- * @throws MarkUnsupportedException
- * @throws NoPropertySetStreamException
- * @throws UnexpectedPropertySetTypeException
- * @throws WritingNotSupportedException
+ * @throws IOException
+ * @throws MarkUnsupportedException
+ * @throws NoPropertySetStreamException
+ * @throws UnexpectedPropertySetTypeException
+ * @throws WritingNotSupportedException
*/
public static void main(final String[] args) throws IOException,
NoPropertySetStreamException, MarkUnsupportedException,
@@ -165,12 +164,12 @@
CustomProperties customProperties = dsi.getCustomProperties();
if (customProperties == null)
customProperties = new CustomProperties();
-
+
/* Insert some custom properties into the container. */
customProperties.put("Key 1", "Value 1");
customProperties.put("Schl\u00fcssel 2", "Wert 2");
customProperties.put("Sample Number", new Integer(12345));
- customProperties.put("Sample Boolean", new Boolean(true));
+ customProperties.put("Sample Boolean", Boolean.TRUE);
customProperties.put("Sample Date", new Date());
/* Read a custom property. */
@@ -191,6 +190,5 @@
OutputStream out = new FileOutputStream(poiFilesystem);
poifs.writeFilesystem(out);
out.close();
- }
-
+ }
}
Modified: poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java Thu Oct 8 22:29:41 2009
@@ -89,7 +89,7 @@
return r;
}
- Constructor<? extends EscherRecord> recordConstructor = recordsMap.get(new Short(header.getRecordId()));
+ Constructor<? extends EscherRecord> recordConstructor = recordsMap.get(Short.valueOf(header.getRecordId()));
EscherRecord escherRecord = null;
if (recordConstructor == null) {
return new UnknownEscherRecord();
@@ -135,7 +135,7 @@
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
- result.put(new Short(sid), constructor);
+ result.put(Short.valueOf(sid), constructor);
}
return result;
}
Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherOptRecord.java Thu Oct 8 22:29:41 2009
@@ -158,7 +158,7 @@
{
EscherProperty p1 = (EscherProperty) o1;
EscherProperty p2 = (EscherProperty) o2;
- return new Short( p1.getPropertyNumber() ).compareTo( new Short( p2.getPropertyNumber() ) );
+ return Short.valueOf( p1.getPropertyNumber() ).compareTo( Short.valueOf( p2.getPropertyNumber() ) );
}
} );
}
Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherProperties.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherProperties.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherProperties.java Thu Oct 8 22:29:41 2009
@@ -586,20 +586,20 @@
}
private static void addProp(Map<Short, EscherPropertyMetaData> m, int s, String propName) {
- m.put(new Short((short) s), new EscherPropertyMetaData(propName));
+ m.put(Short.valueOf((short) s), new EscherPropertyMetaData(propName));
}
private static void addProp(Map<Short, EscherPropertyMetaData> m, int s, String propName, byte type) {
- m.put(new Short((short) s), new EscherPropertyMetaData(propName, type));
+ m.put(Short.valueOf((short) s), new EscherPropertyMetaData(propName, type));
}
public static String getPropertyName(short propertyId) {
- EscherPropertyMetaData o = properties.get(new Short(propertyId));
+ EscherPropertyMetaData o = properties.get(Short.valueOf(propertyId));
return o == null ? "unknown" : o.getDescription();
}
public static byte getPropertyType(short propertyId) {
- EscherPropertyMetaData escherPropertyMetaData = properties.get(new Short(propertyId));
+ EscherPropertyMetaData escherPropertyMetaData = properties.get(Short.valueOf(propertyId));
return escherPropertyMetaData == null ? 0 : escherPropertyMetaData.getType();
}
}
Modified: poi/trunk/src/java/org/apache/poi/hpsf/CustomProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/CustomProperties.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/CustomProperties.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/CustomProperties.java Thu Oct 8 22:29:41 2009
@@ -33,7 +33,7 @@
* name is the key that maps to a typed value. This implementation hides
* property IDs from the developer and regards the property names as keys to
* typed values.</p>
- *
+ *
* <p>While this class provides a simple API to custom properties, it ignores
* the fact that not names, but IDs are the real keys to properties. Under the
* hood this class maintains a 1:1 relationship between IDs and names. Therefore
@@ -41,14 +41,14 @@
* mapping to the same name or with properties without a name: the result will
* contain only a subset of the original properties. If you really need to deal
* such property sets, use HPSF's low-level access methods.</p>
- *
+ *
* <p>An application can call the {@link #isPure} method to check whether a
* property set parsed by {@link CustomProperties} is still pure (i.e.
* unmodified) or whether one or more properties have been dropped.</p>
- *
+ *
* <p>This class is not thread-safe; concurrent access to instances of this
* class must be synchronized.</p>
- *
+ *
* @author Rainer Klute <a
* href="mailto:klute@rainer-klute.de"><klute@rainer-klute.de></a>
*/
@@ -64,7 +64,7 @@
* <p>Maps property names to property IDs.</p>
*/
private Map dictionaryNameToID = new HashMap();
-
+
/**
* <p>Tells whether this object is pure or not.</p>
*/
@@ -96,7 +96,7 @@
") do not match.");
/* Register name and ID in the dictionary. Mapping in both directions is possible. If there is already a */
- final Long idKey = new Long(cp.getID());
+ final Long idKey = Long.valueOf(cp.getID());
final Object oldID = dictionaryNameToID.get(name);
dictionaryIDToName.remove(oldID);
dictionaryNameToID.put(name, idKey);
@@ -113,16 +113,16 @@
/**
* <p>Puts a {@link CustomProperty} that has not yet a valid ID into this
* map. The method will allocate a suitable ID for the custom property:</p>
- *
+ *
* <ul>
- *
+ *
* <li><p>If there is already a property with the same name, take the ID
* of that property.</p></li>
- *
+ *
* <li><p>Otherwise find the highest ID and use its value plus one.</p></li>
- *
+ *
* </ul>
- *
+ *
* @param customProperty
* @return If the was already a property with the same name, the
* @throws ClassCastException
@@ -153,7 +153,7 @@
/**
* <p>Removes a custom property.</p>
- * @param name The name of the custom property to remove
+ * @param name The name of the custom property to remove
* @return The removed property or <code>null</code> if the specified property was not found.
*
* @see java.util.HashSet#remove(java.lang.Object)
@@ -170,7 +170,7 @@
/**
* <p>Adds a named string property.</p>
- *
+ *
* @param name The property's name.
* @param value The property's value.
* @return the property that was stored under the specified name before, or
@@ -258,10 +258,10 @@
return put(cp);
}
-
+
/**
* <p>Gets a named value from the custom properties.</p>
- *
+ *
* @param name the name of the value to get
* @return the value or <code>null</code> if a value with the specified
* name is not found in the custom properties.
@@ -292,18 +292,18 @@
final CustomProperty cp = new CustomProperty(p, name);
return put(cp);
}
-
+
/**
* Returns a set of all the names of our
* custom properties
*/
public Set keySet() {
- return dictionaryNameToID.keySet();
- }
+ return dictionaryNameToID.keySet();
+ }
- /**
+ /**
* <p>Sets the codepage.</p>
*
* @param codepage the codepage
@@ -313,7 +313,7 @@
final MutableProperty p = new MutableProperty();
p.setID(PropertyIDMap.PID_CODEPAGE);
p.setType(Variant.VT_I2);
- p.setValue(new Integer(codepage));
+ p.setValue(Integer.valueOf(codepage));
put(new CustomProperty(p));
}
@@ -322,7 +322,7 @@
/**
* <p>Gets the dictionary which contains IDs and names of the named custom
* properties.
- *
+ *
* @return the dictionary.
*/
Map getDictionary()
@@ -355,7 +355,7 @@
* <p>Tells whether this {@link CustomProperties} instance is pure or one or
* more properties of the underlying low-level property set has been
* dropped.</p>
- *
+ *
* @return <code>true</code> if the {@link CustomProperties} is pure, else
* <code>false</code>.
*/
@@ -373,5 +373,4 @@
{
this.isPure = isPure;
}
-
}
Modified: poi/trunk/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java Thu Oct 8 22:29:41 2009
@@ -567,9 +567,8 @@
/**
* <p>Gets the custom properties.</p>
- *
+ *
* @return The custom properties.
- * @since 2006-02-09
*/
public CustomProperties getCustomProperties()
{
@@ -589,7 +588,7 @@
{
propertyCount++;
final CustomProperty cp = new CustomProperty(p,
- (String) dictionary.get(new Long(id)));
+ (String) dictionary.get(Long.valueOf(id)));
cps.put(cp.getName(), cp);
}
}
@@ -601,9 +600,8 @@
/**
* <p>Sets the custom properties.</p>
- *
+ *
* @param customProperties The custom properties
- * @since 2006-02-07
*/
public void setCustomProperties(final CustomProperties customProperties)
{
@@ -650,8 +648,6 @@
/**
* <p>Removes the custom properties.</p>
- *
- * @since 2006-02-08
*/
public void removeCustomProperties()
{
@@ -674,5 +670,4 @@
{
throw new UnsupportedOperationException(msg + " is not yet implemented.");
}
-
}
Modified: poi/trunk/src/java/org/apache/poi/hpsf/MutableSection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/MutableSection.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/MutableSection.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/MutableSection.java Thu Oct 8 22:29:41 2009
@@ -80,11 +80,11 @@
/**
- * <p>Constructs a <code>MutableSection</code> by doing a deep copy of an
- * existing <code>Section</code>. All nested <code>Property</code>
+ * <p>Constructs a <code>MutableSection</code> by doing a deep copy of an
+ * existing <code>Section</code>. All nested <code>Property</code>
* instances, will be their mutable counterparts in the new
* <code>MutableSection</code>.</p>
- *
+ *
* @param s The section set to copy
*/
public MutableSection(final Section s)
@@ -182,7 +182,7 @@
*/
public void setProperty(final int id, final int value)
{
- setProperty(id, Variant.VT_I4, new Integer(value));
+ setProperty(id, Variant.VT_I4, Integer.valueOf(value));
dirty = true;
}
@@ -199,7 +199,7 @@
*/
public void setProperty(final int id, final long value)
{
- setProperty(id, Variant.VT_I8, new Long(value));
+ setProperty(id, Variant.VT_I8, Long.valueOf(value));
dirty = true;
}
@@ -216,7 +216,7 @@
*/
public void setProperty(final int id, final boolean value)
{
- setProperty(id, Variant.VT_BOOL, new Boolean(value));
+ setProperty(id, Variant.VT_BOOL, Boolean.valueOf(value));
dirty = true;
}
@@ -300,7 +300,7 @@
*/
protected void setPropertyBooleanValue(final int id, final boolean value)
{
- setProperty(id, Variant.VT_BOOL, new Boolean(value));
+ setProperty(id, Variant.VT_BOOL, Boolean.valueOf(value));
}
@@ -339,10 +339,10 @@
* properties) and the properties themselves.</p>
*
* @return the section's length in bytes.
- * @throws WritingNotSupportedException
- * @throws IOException
+ * @throws WritingNotSupportedException
+ * @throws IOException
*/
- private int calcSize() throws WritingNotSupportedException, IOException
+ private int calcSize() throws WritingNotSupportedException, IOException
{
final ByteArrayOutputStream out = new ByteArrayOutputStream();
write(out);
@@ -357,7 +357,7 @@
/**
* <p>Writes this section into an output stream.</p>
- *
+ *
* <p>Internally this is done by writing into three byte array output
* streams: one for the properties, one for the property list and one for
* the section as such. The two former are appended to the latter when they
@@ -390,7 +390,7 @@
* "propertyListStream". */
final ByteArrayOutputStream propertyListStream =
new ByteArrayOutputStream();
-
+
/* Maintain the current position in the list. */
int position = 0;
@@ -418,7 +418,7 @@
* dictionary is present. In order to cope with this problem we
* add the codepage property and set it to Unicode. */
setProperty(PropertyIDMap.PID_CODEPAGE, Variant.VT_I2,
- new Integer(Constants.CP_UNICODE));
+ Integer.valueOf(Constants.CP_UNICODE));
codepage = getCodepage();
}
@@ -444,7 +444,7 @@
{
final MutableProperty p = (MutableProperty) i.next();
final long id = p.getID();
-
+
/* Write the property list entry. */
TypeWriter.writeUIntToStream(propertyListStream, p.getID());
TypeWriter.writeUIntToStream(propertyListStream, position);
@@ -472,17 +472,17 @@
/* Write the section: */
byte[] pb1 = propertyListStream.toByteArray();
byte[] pb2 = propertyStream.toByteArray();
-
+
/* Write the section's length: */
TypeWriter.writeToStream(out, LittleEndian.INT_SIZE * 2 +
pb1.length + pb2.length);
-
+
/* Write the section's number of properties: */
TypeWriter.writeToStream(out, getPropertyCount());
-
+
/* Write the property list: */
out.write(pb1);
-
+
/* Write the properties: */
out.write(pb2);
@@ -562,7 +562,7 @@
* <p>Overwrites the super class' method to cope with a redundancy:
* the property count is maintained in a separate member variable, but
* shouldn't.</p>
- *
+ *
* @return The number of properties in this section
*/
public int getPropertyCount()
@@ -574,7 +574,7 @@
/**
* <p>Gets this section's properties.</p>
- *
+ *
* @return this section's properties.
*/
public Property[] getProperties()
@@ -587,7 +587,7 @@
/**
* <p>Gets a property.</p>
- *
+ *
* @param id The ID of the property to get
* @return The property or <code>null</code> if there is no such property
*/
@@ -611,10 +611,10 @@
* method.</p>
*
* @param dictionary The dictionary
- *
+ *
* @exception IllegalPropertySetDataException if the dictionary's key and
* value types are not correct.
- *
+ *
* @see Section#getDictionary()
*/
public void setDictionary(final Map dictionary)
@@ -646,7 +646,7 @@
(Integer) getProperty(PropertyIDMap.PID_CODEPAGE);
if (codepage == null)
setProperty(PropertyIDMap.PID_CODEPAGE, Variant.VT_I2,
- new Integer(Constants.CP_UNICODE));
+ Integer.valueOf(Constants.CP_UNICODE));
}
else
/* Setting the dictionary to null means to remove property 0.
@@ -658,7 +658,7 @@
/**
* <p>Sets a property.</p>
- *
+ *
* @param id The property ID.
* @param value The property's value. The value's class must be one of those
* supported by HPSF.
@@ -707,7 +707,6 @@
public void setCodepage(final int codepage)
{
setProperty(PropertyIDMap.PID_CODEPAGE, Variant.VT_I2,
- new Integer(codepage));
+ Integer.valueOf(codepage));
}
-
}
Modified: poi/trunk/src/java/org/apache/poi/hpsf/Property.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/Property.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/Property.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/Property.java Thu Oct 8 22:29:41 2009
@@ -217,7 +217,7 @@
for (int i = 0; i < nrEntries; i++)
{
/* The key. */
- final Long id = new Long(LittleEndian.getUInt(src, o));
+ final Long id = Long.valueOf(LittleEndian.getUInt(src, o));
o += LittleEndian.INT_SIZE;
/* The value (a string). The length is the either the
Modified: poi/trunk/src/java/org/apache/poi/hpsf/Section.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/Section.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/Section.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/Section.java Thu Oct 8 22:29:41 2009
@@ -278,7 +278,7 @@
this.offset + ple.offset,
ple.length, codepage);
if (p.getID() == PropertyIDMap.PID_CODEPAGE)
- p = new Property(p.getID(), p.getType(), new Integer(codepage));
+ p = new Property(p.getID(), p.getType(), Integer.valueOf(codepage));
properties[i1++] = p;
}
@@ -450,7 +450,7 @@
{
String s = null;
if (dictionary != null)
- s = (String) dictionary.get(new Long(pid));
+ s = (String) dictionary.get(Long.valueOf(pid));
if (s == null)
s = SectionIDMap.getPIDString(getFormatID().getBytes(), pid);
if (s == null)
Modified: poi/trunk/src/java/org/apache/poi/hpsf/Variant.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/Variant.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/Variant.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/Variant.java Thu Oct 8 22:29:41 2009
@@ -351,32 +351,32 @@
/**
* <p>Denotes a variant type with a length that is unknown to HPSF yet.</p>
*/
- public static final Integer LENGTH_UNKNOWN = new Integer(-2);
+ public static final Integer LENGTH_UNKNOWN = Integer.valueOf(-2);
/**
* <p>Denotes a variant type with a variable length.</p>
*/
- public static final Integer LENGTH_VARIABLE = new Integer(-1);
+ public static final Integer LENGTH_VARIABLE = Integer.valueOf(-1);
/**
* <p>Denotes a variant type with a length of 0 bytes.</p>
*/
- public static final Integer LENGTH_0 = new Integer(0);
+ public static final Integer LENGTH_0 = Integer.valueOf(0);
/**
* <p>Denotes a variant type with a length of 2 bytes.</p>
*/
- public static final Integer LENGTH_2 = new Integer(2);
+ public static final Integer LENGTH_2 = Integer.valueOf(2);
/**
* <p>Denotes a variant type with a length of 4 bytes.</p>
*/
- public static final Integer LENGTH_4 = new Integer(4);
+ public static final Integer LENGTH_4 = Integer.valueOf(4);
/**
* <p>Denotes a variant type with a length of 8 bytes.</p>
*/
- public static final Integer LENGTH_8 = new Integer(8);
+ public static final Integer LENGTH_8 = Integer.valueOf(8);
@@ -384,92 +384,92 @@
{
/* Initialize the number-to-name map: */
Map tm1 = new HashMap();
- tm1.put(new Long(0), "VT_EMPTY");
- tm1.put(new Long(1), "VT_NULL");
- tm1.put(new Long(2), "VT_I2");
- tm1.put(new Long(3), "VT_I4");
- tm1.put(new Long(4), "VT_R4");
- tm1.put(new Long(5), "VT_R8");
- tm1.put(new Long(6), "VT_CY");
- tm1.put(new Long(7), "VT_DATE");
- tm1.put(new Long(8), "VT_BSTR");
- tm1.put(new Long(9), "VT_DISPATCH");
- tm1.put(new Long(10), "VT_ERROR");
- tm1.put(new Long(11), "VT_BOOL");
- tm1.put(new Long(12), "VT_VARIANT");
- tm1.put(new Long(13), "VT_UNKNOWN");
- tm1.put(new Long(14), "VT_DECIMAL");
- tm1.put(new Long(16), "VT_I1");
- tm1.put(new Long(17), "VT_UI1");
- tm1.put(new Long(18), "VT_UI2");
- tm1.put(new Long(19), "VT_UI4");
- tm1.put(new Long(20), "VT_I8");
- tm1.put(new Long(21), "VT_UI8");
- tm1.put(new Long(22), "VT_INT");
- tm1.put(new Long(23), "VT_UINT");
- tm1.put(new Long(24), "VT_VOID");
- tm1.put(new Long(25), "VT_HRESULT");
- tm1.put(new Long(26), "VT_PTR");
- tm1.put(new Long(27), "VT_SAFEARRAY");
- tm1.put(new Long(28), "VT_CARRAY");
- tm1.put(new Long(29), "VT_USERDEFINED");
- tm1.put(new Long(30), "VT_LPSTR");
- tm1.put(new Long(31), "VT_LPWSTR");
- tm1.put(new Long(64), "VT_FILETIME");
- tm1.put(new Long(65), "VT_BLOB");
- tm1.put(new Long(66), "VT_STREAM");
- tm1.put(new Long(67), "VT_STORAGE");
- tm1.put(new Long(68), "VT_STREAMED_OBJECT");
- tm1.put(new Long(69), "VT_STORED_OBJECT");
- tm1.put(new Long(70), "VT_BLOB_OBJECT");
- tm1.put(new Long(71), "VT_CF");
- tm1.put(new Long(72), "VT_CLSID");
+ tm1.put(Long.valueOf(0), "VT_EMPTY");
+ tm1.put(Long.valueOf(1), "VT_NULL");
+ tm1.put(Long.valueOf(2), "VT_I2");
+ tm1.put(Long.valueOf(3), "VT_I4");
+ tm1.put(Long.valueOf(4), "VT_R4");
+ tm1.put(Long.valueOf(5), "VT_R8");
+ tm1.put(Long.valueOf(6), "VT_CY");
+ tm1.put(Long.valueOf(7), "VT_DATE");
+ tm1.put(Long.valueOf(8), "VT_BSTR");
+ tm1.put(Long.valueOf(9), "VT_DISPATCH");
+ tm1.put(Long.valueOf(10), "VT_ERROR");
+ tm1.put(Long.valueOf(11), "VT_BOOL");
+ tm1.put(Long.valueOf(12), "VT_VARIANT");
+ tm1.put(Long.valueOf(13), "VT_UNKNOWN");
+ tm1.put(Long.valueOf(14), "VT_DECIMAL");
+ tm1.put(Long.valueOf(16), "VT_I1");
+ tm1.put(Long.valueOf(17), "VT_UI1");
+ tm1.put(Long.valueOf(18), "VT_UI2");
+ tm1.put(Long.valueOf(19), "VT_UI4");
+ tm1.put(Long.valueOf(20), "VT_I8");
+ tm1.put(Long.valueOf(21), "VT_UI8");
+ tm1.put(Long.valueOf(22), "VT_INT");
+ tm1.put(Long.valueOf(23), "VT_UINT");
+ tm1.put(Long.valueOf(24), "VT_VOID");
+ tm1.put(Long.valueOf(25), "VT_HRESULT");
+ tm1.put(Long.valueOf(26), "VT_PTR");
+ tm1.put(Long.valueOf(27), "VT_SAFEARRAY");
+ tm1.put(Long.valueOf(28), "VT_CARRAY");
+ tm1.put(Long.valueOf(29), "VT_USERDEFINED");
+ tm1.put(Long.valueOf(30), "VT_LPSTR");
+ tm1.put(Long.valueOf(31), "VT_LPWSTR");
+ tm1.put(Long.valueOf(64), "VT_FILETIME");
+ tm1.put(Long.valueOf(65), "VT_BLOB");
+ tm1.put(Long.valueOf(66), "VT_STREAM");
+ tm1.put(Long.valueOf(67), "VT_STORAGE");
+ tm1.put(Long.valueOf(68), "VT_STREAMED_OBJECT");
+ tm1.put(Long.valueOf(69), "VT_STORED_OBJECT");
+ tm1.put(Long.valueOf(70), "VT_BLOB_OBJECT");
+ tm1.put(Long.valueOf(71), "VT_CF");
+ tm1.put(Long.valueOf(72), "VT_CLSID");
Map tm2 = new HashMap(tm1.size(), 1.0F);
tm2.putAll(tm1);
numberToName = Collections.unmodifiableMap(tm2);
/* Initialize the number-to-length map: */
tm1.clear();
- tm1.put(new Long(0), LENGTH_0);
- tm1.put(new Long(1), LENGTH_UNKNOWN);
- tm1.put(new Long(2), LENGTH_2);
- tm1.put(new Long(3), LENGTH_4);
- tm1.put(new Long(4), LENGTH_4);
- tm1.put(new Long(5), LENGTH_8);
- tm1.put(new Long(6), LENGTH_UNKNOWN);
- tm1.put(new Long(7), LENGTH_UNKNOWN);
- tm1.put(new Long(8), LENGTH_UNKNOWN);
- tm1.put(new Long(9), LENGTH_UNKNOWN);
- tm1.put(new Long(10), LENGTH_UNKNOWN);
- tm1.put(new Long(11), LENGTH_UNKNOWN);
- tm1.put(new Long(12), LENGTH_UNKNOWN);
- tm1.put(new Long(13), LENGTH_UNKNOWN);
- tm1.put(new Long(14), LENGTH_UNKNOWN);
- tm1.put(new Long(16), LENGTH_UNKNOWN);
- tm1.put(new Long(17), LENGTH_UNKNOWN);
- tm1.put(new Long(18), LENGTH_UNKNOWN);
- tm1.put(new Long(19), LENGTH_UNKNOWN);
- tm1.put(new Long(20), LENGTH_UNKNOWN);
- tm1.put(new Long(21), LENGTH_UNKNOWN);
- tm1.put(new Long(22), LENGTH_UNKNOWN);
- tm1.put(new Long(23), LENGTH_UNKNOWN);
- tm1.put(new Long(24), LENGTH_UNKNOWN);
- tm1.put(new Long(25), LENGTH_UNKNOWN);
- tm1.put(new Long(26), LENGTH_UNKNOWN);
- tm1.put(new Long(27), LENGTH_UNKNOWN);
- tm1.put(new Long(28), LENGTH_UNKNOWN);
- tm1.put(new Long(29), LENGTH_UNKNOWN);
- tm1.put(new Long(30), LENGTH_VARIABLE);
- tm1.put(new Long(31), LENGTH_UNKNOWN);
- tm1.put(new Long(64), LENGTH_8);
- tm1.put(new Long(65), LENGTH_UNKNOWN);
- tm1.put(new Long(66), LENGTH_UNKNOWN);
- tm1.put(new Long(67), LENGTH_UNKNOWN);
- tm1.put(new Long(68), LENGTH_UNKNOWN);
- tm1.put(new Long(69), LENGTH_UNKNOWN);
- tm1.put(new Long(70), LENGTH_UNKNOWN);
- tm1.put(new Long(71), LENGTH_UNKNOWN);
- tm1.put(new Long(72), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(0), LENGTH_0);
+ tm1.put(Long.valueOf(1), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(2), LENGTH_2);
+ tm1.put(Long.valueOf(3), LENGTH_4);
+ tm1.put(Long.valueOf(4), LENGTH_4);
+ tm1.put(Long.valueOf(5), LENGTH_8);
+ tm1.put(Long.valueOf(6), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(7), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(8), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(9), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(10), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(11), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(12), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(13), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(14), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(16), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(17), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(18), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(19), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(20), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(21), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(22), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(23), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(24), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(25), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(26), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(27), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(28), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(29), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(30), LENGTH_VARIABLE);
+ tm1.put(Long.valueOf(31), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(64), LENGTH_8);
+ tm1.put(Long.valueOf(65), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(66), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(67), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(68), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(69), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(70), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(71), LENGTH_UNKNOWN);
+ tm1.put(Long.valueOf(72), LENGTH_UNKNOWN);
tm2 = new HashMap(tm1.size(), 1.0F);
tm2.putAll(tm1);
numberToLength = Collections.unmodifiableMap(tm2);
@@ -486,7 +486,7 @@
*/
public static String getVariantName(final long variantType)
{
- final String name = (String) numberToName.get(new Long(variantType));
+ final String name = (String) numberToName.get(Long.valueOf(variantType));
return name != null ? name : "unknown variant type";
}
@@ -501,7 +501,7 @@
*/
public static int getVariantLength(final long variantType)
{
- final Long key = new Long((int) variantType);
+ final Long key = Long.valueOf((int) variantType);
final Long length = (Long) numberToLength.get(key);
if (length == null)
return -2;
Modified: poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java Thu Oct 8 22:29:41 2009
@@ -29,10 +29,10 @@
/**
* <p>Supports reading and writing of variant data.</p>
- *
+ *
* <p><strong>FIXME (3):</strong> Reading and writing should be made more
* uniform than it is now. The following items should be resolved:
- *
+ *
* <ul>
*
* <li><p>Reading requires a length parameter that is 4 byte greater than the
@@ -68,7 +68,7 @@
* on or off.</p>
*
* @return <code>true</code> if logging is turned on, else
- * <code>false</code>.
+ * <code>false</code>.
*/
public static boolean isLogUnsupportedTypes()
{
@@ -97,7 +97,7 @@
{
if (unsupportedMessage == null)
unsupportedMessage = new LinkedList();
- Long vt = new Long(ex.getVariantType());
+ Long vt = Long.valueOf(ex.getVariantType());
if (!unsupportedMessage.contains(vt))
{
System.err.println(ex.getMessage());
@@ -121,7 +121,7 @@
* <p>Checks whether HPSF supports the specified variant type. Unsupported
* types should be implemented included in the {@link #SUPPORTED_TYPES}
* array.</p>
- *
+ *
* @see Variant
* @param variantType the variant type to check
* @return <code>true</code> if HPFS supports this type, else
@@ -139,7 +139,7 @@
/**
* <p>Reads a variant type from a byte array.</p>
- *
+ *
* @param src The byte array
* @param offset The offset in the byte array where the variant starts
* @param length The length of the variant including the variant type field
@@ -182,7 +182,7 @@
* Read a short. In Java it is represented as an
* Integer object.
*/
- value = new Integer(LittleEndian.getShort(src, o1));
+ value = Integer.valueOf(LittleEndian.getShort(src, o1));
break;
}
case Variant.VT_I4:
@@ -191,7 +191,7 @@
* Read a word. In Java it is represented as an
* Integer object.
*/
- value = new Integer(LittleEndian.getInt(src, o1));
+ value = Integer.valueOf(LittleEndian.getInt(src, o1));
break;
}
case Variant.VT_I8:
@@ -200,7 +200,7 @@
* Read a double word. In Java it is represented as a
* Long object.
*/
- value = new Long(LittleEndian.getLong(src, o1));
+ value = Long.valueOf(LittleEndian.getLong(src, o1));
break;
}
case Variant.VT_R8:
@@ -279,7 +279,7 @@
* while the current implementation calculates it in the Section constructor.
* Test files in Bugzilla 42726 and 45583 clearly show that this approach does not always work.
* The workaround below attempts to gracefully handle such cases instead of throwing exceptions.
- *
+ *
* August 20, 2009
*/
l1 = LittleEndian.getInt(src, o1); o1 += LittleEndian.INT_SIZE;
@@ -318,16 +318,16 @@
/**
- * <p>Turns a codepage number into the equivalent character encoding's
+ * <p>Turns a codepage number into the equivalent character encoding's
* name.</p>
*
* @param codepage The codepage number
- *
- * @return The character encoding's name. If the codepage number is 65001,
+ *
+ * @return The character encoding's name. If the codepage number is 65001,
* the encoding name is "UTF-8". All other positive numbers are mapped to
- * "cp" followed by the number, e.g. if the codepage number is 1252 the
+ * "cp" followed by the number, e.g. if the codepage number is 1252 the
* returned character encoding name will be "cp1252".
- *
+ *
* @exception UnsupportedEncodingException if the specified codepage is
* less than zero.
*/
@@ -500,7 +500,7 @@
}
case Variant.VT_LPWSTR:
{
- final int nrOfChars = ((String) value).length() + 1;
+ final int nrOfChars = ((String) value).length() + 1;
length += TypeWriter.writeUIntToStream(out, nrOfChars);
char[] s = Util.pad4((String) value);
for (int i = 0; i < s.length; i++)
@@ -546,7 +546,7 @@
+ value.getClass().toString() + ", "
+ value.toString());
}
- length += TypeWriter.writeToStream(out,
+ length += TypeWriter.writeToStream(out,
((Integer) value).intValue());
break;
}
@@ -558,7 +558,7 @@
}
case Variant.VT_R8:
{
- length += TypeWriter.writeToStream(out,
+ length += TypeWriter.writeToStream(out,
((Double) value).doubleValue());
break;
}
@@ -579,7 +579,7 @@
* is a byte array we can write it nevertheless. */
if (value instanceof byte[])
{
- final byte[] b = (byte[]) value;
+ final byte[] b = (byte[]) value;
out.write(b);
length = b.length;
writeUnsupportedTypeMessage
@@ -593,5 +593,4 @@
return length;
}
-
}
Modified: poi/trunk/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java Thu Oct 8 22:29:41 2009
@@ -102,7 +102,7 @@
/** <p>ID of the property that denotes whether read/write access to the
* document is allowed or whether is should be opened as read-only. It can
* have the following values:</p>
- *
+ *
* <table>
* <tbody>
* <tr>
@@ -133,7 +133,7 @@
* section of the Document Summary Information property set.
*/
- /**
+ /**
* <p>The entry is a dictionary.</p>
*/
public static final int PID_DICTIONARY = 0;
@@ -143,61 +143,61 @@
*/
public static final int PID_CODEPAGE = 1;
- /**
+ /**
* <p>The entry is a string denoting the category the file belongs
* to, e.g. review, memo, etc. This is useful to find documents of
* same type.</p>
*/
public static final int PID_CATEGORY = 2;
- /**
+ /**
* <p>Target format for power point presentation, e.g. 35mm,
* printer, video etc.</p>
*/
public static final int PID_PRESFORMAT = 3;
- /**
+ /**
* <p>Number of bytes.</p>
*/
public static final int PID_BYTECOUNT = 4;
- /**
+ /**
* <p>Number of lines.</p>
*/
public static final int PID_LINECOUNT = 5;
- /**
+ /**
* <p>Number of paragraphs.</p>
*/
public static final int PID_PARCOUNT = 6;
- /**
+ /**
* <p>Number of slides in a power point presentation.</p>
*/
public static final int PID_SLIDECOUNT = 7;
- /**
+ /**
* <p>Number of slides with notes.</p>
*/
public static final int PID_NOTECOUNT = 8;
- /**
+ /**
* <p>Number of hidden slides.</p>
*/
public static final int PID_HIDDENCOUNT = 9;
- /**
+ /**
* <p>Number of multimedia clips, e.g. sound or video.</p>
*/
public static final int PID_MMCLIPCOUNT = 10;
- /**
+ /**
* <p>This entry is set to -1 when scaling of the thumbnail is
* desired. Otherwise the thumbnail should be cropped.</p>
*/
public static final int PID_SCALE = 11;
- /**
+ /**
* <p>This entry denotes an internally used property. It is a
* vector of variants consisting of pairs of a string (VT_LPSTR)
* and a number (VT_I4). The string is a heading name, and the
@@ -206,29 +206,29 @@
*/
public static final int PID_HEADINGPAIR = 12;
- /**
+ /**
* <p>This entry contains the names of document parts (word: names
* of the documents in the master document, excel: sheet names,
* power point: slide titles, binder: document names).</p>
*/
public static final int PID_DOCPARTS = 13;
- /**
+ /**
* <p>This entry contains the name of the project manager.</p>
*/
public static final int PID_MANAGER = 14;
- /**
+ /**
* <p>This entry contains the company name.</p>
*/
public static final int PID_COMPANY = 15;
- /**
+ /**
* <p>If this entry is -1 the links are dirty and should be
* re-evaluated.</p>
*/
public static final int PID_LINKSDIRTY = 16;
-
+
/**
* <p>The highest well-known property ID. Applications are free to use higher values for custom purposes.</p>
*/
@@ -254,7 +254,7 @@
/**
* <p>Creates a {@link PropertyIDMap}.</p>
- *
+ *
* @param initialCapacity The initial capacity as defined for
* {@link HashMap}
* @param loadFactor The load factor as defined for {@link HashMap}
@@ -268,7 +268,7 @@
/**
* <p>Creates a {@link PropertyIDMap} backed by another map.</p>
- *
+ *
* @param map The instance to be created is backed by this map.
*/
public PropertyIDMap(final Map map)
@@ -291,7 +291,7 @@
*/
public Object put(final long id, final String idString)
{
- return put(new Long(id), idString);
+ return put(Long.valueOf(id), idString);
}
@@ -305,7 +305,7 @@
*/
public Object get(final long id)
{
- return get(new Long(id));
+ return get(Long.valueOf(id));
}
@@ -392,5 +392,4 @@
System.out.println("s1: " + s1);
System.out.println("s2: " + s2);
}
-
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.java Thu Oct 8 22:29:41 2009
@@ -73,7 +73,7 @@
public void processRecordInternally(Record record) {
if (record instanceof FormatRecord) {
FormatRecord fr = (FormatRecord) record;
- _customFormatRecords.put(new Integer(fr.getIndexCode()), fr);
+ _customFormatRecords.put(Integer.valueOf(fr.getIndexCode()), fr);
}
if (record instanceof ExtendedFormatRecord) {
ExtendedFormatRecord xr = (ExtendedFormatRecord) record;
@@ -117,7 +117,7 @@
public String getFormatString(int formatIndex) {
String format = null;
if (formatIndex >= HSSFDataFormat.getNumberOfBuiltinBuiltinFormats()) {
- FormatRecord tfr = _customFormatRecords.get(new Integer(formatIndex));
+ FormatRecord tfr = _customFormatRecords.get(Integer.valueOf(formatIndex));
if (tfr == null) {
System.err.println("Requested format at index " + formatIndex
+ ", but it wasn't found");
Modified: poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/HSSFRequest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/HSSFRequest.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/HSSFRequest.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/HSSFRequest.java Thu Oct 8 22:29:41 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -16,12 +15,12 @@
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.eventusermodel;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
+import java.util.Map;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.RecordFactory;
@@ -37,71 +36,54 @@
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Carey Sublette (careysub@earthling.net)
*/
+public class HSSFRequest {
+ private final Map<Short, List<HSSFListener>> _records;
+
+ /** Creates a new instance of HSSFRequest */
+ public HSSFRequest() {
+ _records = new HashMap<Short, List<HSSFListener>>(50); // most folks won't listen for too many of these
+ }
+
+ /**
+ * add an event listener for a particular record type. The trick is you have to know
+ * what the records are for or just start with our examples and build on them. Alternatively,
+ * you CAN call addListenerForAllRecords and you'll receive ALL record events in one listener,
+ * but if you like to squeeze every last byte of efficiency out of life you my not like this.
+ * (its sure as heck what I plan to do)
+ *
+ * @see #addListenerForAllRecords(HSSFListener)
+ *
+ * @param lsnr for the event
+ * @param sid identifier for the record type this is the .sid static member on the individual records
+ * for example req.addListener(myListener, BOFRecord.sid)
+ */
+ public void addListener(HSSFListener lsnr, short sid) {
+ List<HSSFListener> list = _records.get(Short.valueOf(sid));
-public class HSSFRequest
-{
- private HashMap records;
-
- /** Creates a new instance of HSSFRequest */
-
- public HSSFRequest()
- {
- records =
- new HashMap(50); // most folks won't listen for too many of these
- }
-
- /**
- * add an event listener for a particular record type. The trick is you have to know
- * what the records are for or just start with our examples and build on them. Alternatively,
- * you CAN call addListenerForAllRecords and you'll recieve ALL record events in one listener,
- * but if you like to squeeze every last byte of efficiency out of life you my not like this.
- * (its sure as heck what I plan to do)
- *
- * @see #addListenerForAllRecords(HSSFListener)
- *
- * @param lsnr for the event
- * @param sid identifier for the record type this is the .sid static member on the individual records
- * for example req.addListener(myListener, BOFRecord.sid)
- */
-
- public void addListener(HSSFListener lsnr, short sid)
- {
- List list = null;
- Object obj = records.get(new Short(sid));
-
- if (obj != null)
- {
- list = ( List ) obj;
- }
- else
- {
- list = new ArrayList(
- 1); // probably most people will use one listener
- list.add(lsnr);
- records.put(new Short(sid), list);
- }
- }
-
- /**
- * This is the equivilent of calling addListener(myListener, sid) for EVERY
- * record in the org.apache.poi.hssf.record package. This is for lazy
- * people like me. You can call this more than once with more than one listener, but
- * that seems like a bad thing to do from a practice-perspective unless you have a
- * compelling reason to do so (like maybe you send the event two places or log it or
- * something?).
- *
- * @param lsnr a single listener to associate with ALL records
- */
-
- public void addListenerForAllRecords(HSSFListener lsnr)
- {
- short[] rectypes = RecordFactory.getAllKnownRecordSIDs();
-
- for (int k = 0; k < rectypes.length; k++)
- {
- addListener(lsnr, rectypes[ k ]);
- }
- }
+ if (list == null) {
+ list = new ArrayList<HSSFListener>(1); // probably most people will use one listener
+ _records.put(Short.valueOf(sid), list);
+ }
+ list.add(lsnr);
+ }
+
+ /**
+ * This is the equivalent of calling addListener(myListener, sid) for EVERY
+ * record in the org.apache.poi.hssf.record package. This is for lazy
+ * people like me. You can call this more than once with more than one listener, but
+ * that seems like a bad thing to do from a practice-perspective unless you have a
+ * compelling reason to do so (like maybe you send the event two places or log it or
+ * something?).
+ *
+ * @param lsnr a single listener to associate with ALL records
+ */
+ public void addListenerForAllRecords(HSSFListener lsnr) {
+ short[] rectypes = RecordFactory.getAllKnownRecordSIDs();
+
+ for (int k = 0; k < rectypes.length; k++) {
+ addListener(lsnr, rectypes[k]);
+ }
+ }
/**
* Called by HSSFEventFactory, passes the Record to each listener associated with
@@ -112,32 +94,26 @@
* @return numeric user-specified result code. If zero continue processing.
* @throws HSSFUserException User exception condition
*/
-
- protected short processRecord(Record rec) throws HSSFUserException
- {
- Object obj = records.get(new Short(rec.getSid()));
- short userCode = 0;
-
- if (obj != null)
- {
- List listeners = ( List ) obj;
-
- for (int k = 0; k < listeners.size(); k++)
- {
- Object listenObj = listeners.get(k);
- if (listenObj instanceof AbortableHSSFListener)
- {
- AbortableHSSFListener listener = ( AbortableHSSFListener ) listenObj;
- userCode = listener.abortableProcessRecord(rec);
- if (userCode!=0) break;
- }
- else
- {
- HSSFListener listener = ( HSSFListener ) listenObj;
+ protected short processRecord(Record rec) throws HSSFUserException {
+ Object obj = _records.get(Short.valueOf(rec.getSid()));
+ short userCode = 0;
+
+ if (obj != null) {
+ List listeners = (List) obj;
+
+ for (int k = 0; k < listeners.size(); k++) {
+ Object listenObj = listeners.get(k);
+ if (listenObj instanceof AbortableHSSFListener) {
+ AbortableHSSFListener listener = (AbortableHSSFListener) listenObj;
+ userCode = listener.abortableProcessRecord(rec);
+ if (userCode != 0)
+ break;
+ } else {
+ HSSFListener listener = (HSSFListener) listenObj;
listener.processRecord(rec);
}
- }
- }
- return userCode;
- }
+ }
+ }
+ return userCode;
+ }
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/model/DrawingManager.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/DrawingManager.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/DrawingManager.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/DrawingManager.java Thu Oct 8 22:29:41 2009
@@ -48,7 +48,7 @@
dg.setLastMSOSPID( -1 );
dgg.addCluster( dgId, 0 );
dgg.setDrawingsSaved( dgg.getDrawingsSaved() + 1 );
- dgMap.put( new Short( dgId ), dg );
+ dgMap.put( Short.valueOf( dgId ), dg );
return dg;
}
@@ -60,7 +60,7 @@
public int allocateShapeId(short drawingGroupId)
{
// Get the last shape id for this drawing group.
- EscherDgRecord dg = (EscherDgRecord) dgMap.get(new Short(drawingGroupId));
+ EscherDgRecord dg = (EscherDgRecord) dgMap.get(Short.valueOf(drawingGroupId));
int lastShapeId = dg.getLastMSOSPID();
Modified: poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java Thu Oct 8 22:29:41 2009
@@ -1031,7 +1031,7 @@
public void setColumnWidth(int column, int width) {
if(width > 255*256) throw new IllegalArgumentException("The maximum column width for an individual cell is 255 characters.");
- setColumn(column, null, new Integer(width), null, null, null);
+ setColumn(column, null, Integer.valueOf(width), null, null, null);
}
/**
@@ -1059,7 +1059,7 @@
setColumn( column, null, null, null, Boolean.valueOf(hidden), null);
}
public void setDefaultColumnStyle(int column, int styleIndex) {
- setColumn(column, new Short((short)styleIndex), null, null, null, null);
+ setColumn(column, Short.valueOf((short)styleIndex), null, null, null, null);
}
private void setColumn(int column, Short xfStyle, Integer width, Integer level, Boolean hidden, Boolean collapsed) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java Thu Oct 8 22:29:41 2009
@@ -180,7 +180,7 @@
public static Workbook createWorkbook(List<Record> recs) {
if (log.check( POILogger.DEBUG ))
log.log(DEBUG, "Workbook (readfile) created with reclen=",
- new Integer(recs.size()));
+ Integer.valueOf(recs.size()));
Workbook retval = new Workbook();
List<Record> records = new ArrayList<Record>(recs.size() / 3);
retval.records.setRecords(records);
@@ -517,8 +517,8 @@
public void setSheetBof(int sheetIndex, int pos) {
if (log.check( POILogger.DEBUG ))
- log.log(DEBUG, "setting bof for sheetnum =", new Integer(sheetIndex),
- " at pos=", new Integer(pos));
+ log.log(DEBUG, "setting bof for sheetnum =", Integer.valueOf(sheetIndex),
+ " at pos=", Integer.valueOf(pos));
checkSheets(sheetIndex);
getBoundSheetRec(sheetIndex)
.setPositionOfBof(pos);
@@ -757,7 +757,7 @@
public int getNumSheets() {
if (log.check( POILogger.DEBUG ))
- log.log(DEBUG, "getNumSheets=", new Integer(boundsheets.size()));
+ log.log(DEBUG, "getNumSheets=", Integer.valueOf(boundsheets.size()));
return boundsheets.size();
}
@@ -769,7 +769,7 @@
public int getNumExFormats() {
if (log.check( POILogger.DEBUG ))
- log.log(DEBUG, "getXF=", new Integer(numxfs));
+ log.log(DEBUG, "getXF=", Integer.valueOf(numxfs));
return numxfs;
}
@@ -903,7 +903,7 @@
UnicodeString retval = sst.getString(str);
if (log.check( POILogger.DEBUG ))
- log.log(DEBUG, "Returning SST for index=", new Integer(str),
+ log.log(DEBUG, "Returning SST for index=", Integer.valueOf(str),
" String= ", retval);
return retval;
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java Thu Oct 8 22:29:41 2009
@@ -6,7 +6,7 @@
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -48,15 +48,15 @@
private Ptg field_2_refPtg;
/** for when the 'formula' doesn't parse properly */
private byte[] field_2_unknownFormulaData;
- /** note- this byte is not present in the encoding if the string length is zero */
+ /** note- this byte is not present in the encoding if the string length is zero */
private boolean field_3_unicode_flag; // Flags whether the string is Unicode.
private String field_4_ole_classname; // Classname of the embedded OLE document (e.g. Word.Document.8)
/** Formulas often have a single non-zero trailing byte.
* This is in a similar position to he pre-streamId padding
- * It is unknown if the value is important (it seems to mirror a value a few bytes earlier)
+ * It is unknown if the value is important (it seems to mirror a value a few bytes earlier)
* */
private Byte field_4_unknownByte;
- private Integer field_5_stream_id; // ID of the OLE stream containing the actual data.
+ private Integer field_5_stream_id; // ID of the OLE stream containing the actual data.
private byte[] field_6_unknown;
@@ -131,7 +131,7 @@
int b = in.readByte();
remaining -= LittleEndian.BYTE_SIZE;
if (field_2_refPtg != null && field_4_ole_classname == null) {
- field_4_unknownByte = new Byte((byte)b);
+ field_4_unknownByte = Byte.valueOf((byte)b);
}
}
int nUnexpectedPadding = remaining - dataLenAfterFormula;
@@ -144,7 +144,7 @@
// Fetch the stream ID
if (dataLenAfterFormula >= 4) {
- field_5_stream_id = new Integer(in.readInt());
+ field_5_stream_id = Integer.valueOf(in.readInt());
remaining -= LittleEndian.INT_SIZE;
} else {
field_5_stream_id = null;
@@ -158,7 +158,7 @@
switch(ptgSid) {
case AreaPtg.sid: return new AreaPtg(in);
case Area3DPtg.sid: return new Area3DPtg(in);
- case RefPtg.sid: return new RefPtg(in);
+ case RefPtg.sid: return new RefPtg(in);
case Ref3DPtg.sid: return new Ref3DPtg(in);
}
return null;
@@ -175,11 +175,11 @@
in.readFully(result);
return result;
}
-
+
private int getStreamIDOffset(int formulaSize) {
int result = 2 + 4; // formulaSize + f2unknown_int
result += formulaSize;
-
+
int stringLen;
if (field_4_ole_classname == null) {
// don't write 0x03, stringLen, flag, text
@@ -198,16 +198,16 @@
}
// pad to next 2 byte boundary
if ((result % 2) != 0) {
- result ++;
+ result ++;
}
return result;
}
-
+
private int getDataSize(int idOffset) {
int result = 2 + idOffset; // 2 for idOffset short field itself
if (field_5_stream_id != null) {
- result += 4;
+ result += 4;
}
return result + field_6_unknown.length;
}
@@ -222,7 +222,7 @@
int formulaSize = field_2_refPtg == null ? field_2_unknownFormulaData.length : field_2_refPtg.getSize();
int idOffset = getStreamIDOffset(formulaSize);
int dataSize = getDataSize(idOffset);
-
+
out.writeShort(sid);
out.writeShort(dataSize);
@@ -238,7 +238,7 @@
} else {
field_2_refPtg.write(out);
}
- pos += formulaSize;
+ pos += formulaSize;
int stringLen;
if (field_4_ole_classname == null) {
@@ -251,16 +251,16 @@
out.writeShort(stringLen);
pos+=2;
if (stringLen > 0) {
- out.writeByte(field_3_unicode_flag ? 0x01 : 0x00);
- pos+=1;
-
- if (field_3_unicode_flag) {
- StringUtil.putUnicodeLE(field_4_ole_classname, out);
- pos += stringLen * 2;
- } else {
- StringUtil.putCompressedUnicode(field_4_ole_classname, out);
- pos += stringLen;
- }
+ out.writeByte(field_3_unicode_flag ? 0x01 : 0x00);
+ pos+=1;
+
+ if (field_3_unicode_flag) {
+ StringUtil.putUnicodeLE(field_4_ole_classname, out);
+ pos += stringLen * 2;
+ } else {
+ StringUtil.putCompressedUnicode(field_4_ole_classname, out);
+ pos += stringLen;
+ }
}
}
@@ -272,12 +272,12 @@
case 0:
break;
default:
- throw new IllegalStateException("Bad padding calculation (" + idOffset + ", " + pos + ")");
+ throw new IllegalStateException("Bad padding calculation (" + idOffset + ", " + pos + ")");
}
if (field_5_stream_id != null) {
out.writeInt(field_5_stream_id.intValue());
- pos += 4;
+ pos += 4;
}
out.write(field_6_unknown);
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java Thu Oct 8 22:29:41 2009
@@ -434,7 +434,7 @@
{
if ( recordId == EscherClientDataRecord.RECORD_ID || recordId == EscherTextboxRecord.RECORD_ID )
{
- spEndingOffsets.add( new Integer( offset ) );
+ spEndingOffsets.add( Integer.valueOf( offset ) );
shapes.add( record );
}
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/NoteRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/NoteRecord.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/NoteRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/NoteRecord.java Thu Oct 8 22:29:41 2009
@@ -40,7 +40,7 @@
*/
public final static short NOTE_VISIBLE = 0x2;
- private static final Byte DEFAULT_PADDING = new Byte((byte)0);
+ private static final Byte DEFAULT_PADDING = Byte.valueOf((byte)0);
private int field_1_row;
private int field_2_col;
@@ -50,9 +50,9 @@
private String field_6_author;
/**
* Saves padding byte value to reduce delta during round-trip serialization.<br/>
- *
+ *
* The documentation is not clear about how padding should work. In any case
- * Excel(2007) does something different.
+ * Excel(2007) does something different.
*/
private Byte field_7_padding;
@@ -89,7 +89,7 @@
field_6_author = StringUtil.readCompressedUnicode(in, length);
}
if (in.available() == 1) {
- field_7_padding = new Byte(in.readByte());
+ field_7_padding = Byte.valueOf(in.readByte());
}
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/PageBreakRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/PageBreakRecord.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/PageBreakRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/PageBreakRecord.java Thu Oct 8 22:29:41 2009
@@ -90,7 +90,7 @@
for(int k = 0; k < nBreaks; k++) {
Break br = new Break(in);
_breaks.add(br);
- _breakMap.put(new Integer(br.main), br);
+ _breakMap.put(Integer.valueOf(br.main), br);
}
}
@@ -160,7 +160,7 @@
*/
public void addBreak(int main, int subFrom, int subTo) {
- Integer key = new Integer(main);
+ Integer key = Integer.valueOf(main);
Break region = _breakMap.get(key);
if(region == null) {
region = new Break(main, subFrom, subTo);
@@ -178,7 +178,7 @@
* @param main (zero-based)
*/
public final void removeBreak(int main) {
- Integer rowKey = new Integer(main);
+ Integer rowKey = Integer.valueOf(main);
Break region = _breakMap.get(rowKey);
_breaks.remove(region);
_breakMap.remove(rowKey);
@@ -190,7 +190,7 @@
* @return The Break or null if no break exists at the row/col specified.
*/
public final Break getBreak(int main) {
- Integer rowKey = new Integer(main);
+ Integer rowKey = Integer.valueOf(main);
return _breakMap.get(rowKey);
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java Thu Oct 8 22:29:41 2009
@@ -227,7 +227,7 @@
* <code>null</code> if the specified record is not interpreted by POI.
*/
public static Class<? extends Record> getRecordClass(int sid) {
- I_RecordCreator rc = _recordCreatorsById.get(new Integer(sid));
+ I_RecordCreator rc = _recordCreatorsById.get(Integer.valueOf(sid));
if (rc == null) {
return null;
}
@@ -254,7 +254,7 @@
}
public static Record createSingleRecord(RecordInputStream in) {
- I_RecordCreator constructor = _recordCreatorsById.get(new Integer(in.getSid()));
+ I_RecordCreator constructor = _recordCreatorsById.get(Integer.valueOf(in.getSid()));
if (constructor == null) {
return new UnknownRecord(in);
@@ -346,7 +346,7 @@
throw new RecordFormatException(
"Unable to determine record types");
}
- Integer key = new Integer(sid);
+ Integer key = Integer.valueOf(sid);
if (result.containsKey(key)) {
Class<?> prevClass = result.get(key).getRecordClass();
throw new RuntimeException("duplicate record sid 0x" + Integer.toHexString(sid).toUpperCase()
@@ -354,7 +354,7 @@
}
result.put(key, new ReflectionRecordCreator(constructor));
}
-// result.put(new Integer(0x0406), result.get(new Integer(0x06)));
+// result.put(Integer.valueOf(0x0406), result.get(Integer.valueOf(0x06)));
return result;
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java Thu Oct 8 22:29:41 2009
@@ -143,7 +143,7 @@
_linkPtg = readRefPtg(buf);
switch (linkSize - formulaSize - 6) {
case 1:
- _unknownByte6 = new Byte(in.readByte());
+ _unknownByte6 = Byte.valueOf(in.readByte());
break;
case 0:
_unknownByte6 = null;
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/TextObjectRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/TextObjectRecord.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/TextObjectRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/TextObjectRecord.java Thu Oct 8 22:29:41 2009
@@ -30,7 +30,7 @@
* followed by two or more continue records unless there is no actual text. The
* first continue records contain the text data and the last continue record
* contains the formatting runs.<p/>
- *
+ *
* @author Glen Stampoultzis (glens at apache.org)
*/
public final class TextObjectRecord extends ContinuableRecord {
@@ -68,7 +68,7 @@
/*
* Note - the next three fields are very similar to those on
* EmbededObjectRefSubRecord(ftPictFmla 0x0009)
- *
+ *
* some observed values for the 4 bytes preceding the formula: C0 5E 86 03
* C0 11 AC 02 80 F1 8A 03 D4 F0 8A 03
*/
@@ -76,7 +76,7 @@
/** expect tRef, tRef3D, tArea, tArea3D or tName */
private Ptg _linkRefPtg;
/**
- * Not clear if needed . Excel seems to be OK if this byte is not present.
+ * Not clear if needed . Excel seems to be OK if this byte is not present.
* Value is often the same as the earlier firstColumn byte. */
private Byte _unknownPostFormulaByte;
@@ -108,7 +108,7 @@
}
_linkRefPtg = ptgs[0];
if (in.remaining() > 0) {
- _unknownPostFormulaByte = new Byte(in.readByte());
+ _unknownPostFormulaByte = Byte.valueOf(in.readByte());
} else {
_unknownPostFormulaByte = null;
}
@@ -161,7 +161,7 @@
}
private void serializeTXORecord(ContinuableRecordOutput out) {
-
+
out.writeShort(field_1_options);
out.writeShort(field_2_textOrientation);
out.writeShort(field_3_reserved4);
@@ -170,7 +170,7 @@
out.writeShort(_text.length());
out.writeShort(getFormattingDataLength());
out.writeInt(field_8_reserved7);
-
+
if (_linkRefPtg != null) {
int formulaSize = _linkRefPtg.getSize();
out.writeShort(formulaSize);
@@ -194,12 +194,12 @@
serializeTXORecord(out);
if (_text.getString().length() > 0) {
serializeTrailingRecords(out);
- }
+ }
}
private int getFormattingDataLength() {
if (_text.length() < 1) {
- // important - no formatting data if text is empty
+ // important - no formatting data if text is empty
return 0;
}
return (_text.numFormattingRuns() + 1) * FORMAT_RUN_ENCODED_SIZE;
@@ -262,7 +262,7 @@
/**
* Get the text orientation field for the TextObjectBase record.
- *
+ *
* @return One of TEXT_ORIENTATION_NONE TEXT_ORIENTATION_TOP_TO_BOTTOM
* TEXT_ORIENTATION_ROT_RIGHT TEXT_ORIENTATION_ROT_LEFT
*/
@@ -272,7 +272,7 @@
/**
* Set the text orientation field for the TextObjectBase record.
- *
+ *
* @param textOrientation
* One of TEXT_ORIENTATION_NONE TEXT_ORIENTATION_TOP_TO_BOTTOM
* TEXT_ORIENTATION_ROT_RIGHT TEXT_ORIENTATION_ROT_LEFT
@@ -288,7 +288,7 @@
public void setStr(HSSFRichTextString str) {
_text = str;
}
-
+
public Ptg getLinkRefPtg() {
return _linkRefPtg;
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java Thu Oct 8 22:29:41 2009
@@ -30,11 +30,11 @@
*/
public final class ColumnInfoRecordsAggregate extends RecordAggregate {
/**
- * List of {@link ColumnInfoRecord}s assumed to be in order
+ * List of {@link ColumnInfoRecord}s assumed to be in order
*/
private final List records;
-
-
+
+
private static final class CIRComparator implements Comparator {
public static final Comparator instance = new CIRComparator();
private CIRComparator() {
@@ -299,7 +299,7 @@
}
- public void setColumn(int targetColumnIx, Short xfIndex, Integer width,
+ public void setColumn(int targetColumnIx, Short xfIndex, Integer width,
Integer level, Boolean hidden, Boolean collapsed) {
ColumnInfoRecord ci = null;
int k = 0;
@@ -370,18 +370,18 @@
ColumnInfoRecord ciMid = copyColInfo(ci);
ColumnInfoRecord ciEnd = copyColInfo(ci);
int lastcolumn = ci.getLastColumn();
-
+
ciStart.setLastColumn(targetColumnIx - 1);
ciMid.setFirstColumn(targetColumnIx);
ciMid.setLastColumn(targetColumnIx);
setColumnInfoFields(ciMid, xfIndex, width, level, hidden, collapsed);
insertColumn(++k, ciMid);
-
+
ciEnd.setFirstColumn(targetColumnIx+1);
ciEnd.setLastColumn(lastcolumn);
insertColumn(++k, ciEnd);
- // no need to attemptMergeColInfoRecords because we
+ // no need to attemptMergeColInfoRecords because we
// know both on each side are different
}
}
@@ -389,7 +389,7 @@
/**
* Sets all non null fields into the <code>ci</code> parameter.
*/
- private static void setColumnInfoFields(ColumnInfoRecord ci, Short xfStyle, Integer width,
+ private static void setColumnInfoFields(ColumnInfoRecord ci, Short xfStyle, Integer width,
Integer level, Boolean hidden, Boolean collapsed) {
if (xfStyle != null) {
ci.setXFIndex(xfStyle.shortValue());
@@ -429,13 +429,13 @@
}
/**
- * Attempts to merge the col info record at the specified index
+ * Attempts to merge the col info record at the specified index
* with either or both of its neighbours
*/
private void attemptMergeColInfoRecords(int colInfoIx) {
int nRecords = records.size();
if (colInfoIx < 0 || colInfoIx >= nRecords) {
- throw new IllegalArgumentException("colInfoIx " + colInfoIx
+ throw new IllegalArgumentException("colInfoIx " + colInfoIx
+ " is out of range (0.." + (nRecords-1) + ")");
}
ColumnInfoRecord currentCol = getColInfo(colInfoIx);
@@ -466,7 +466,7 @@
* Creates an outline group for the specified columns, by setting the level
* field for each col info record in the range. {@link ColumnInfoRecord}s
* may be created, split or merged as a result of this operation.
- *
+ *
* @param fromColumnIx
* group from this column (inclusive)
* @param toColumnIx
@@ -493,7 +493,7 @@
level = Math.min(7, level);
colInfoSearchStartIdx = Math.max(0, colInfoIdx - 1); // -1 just in case this column is collapsed later.
}
- setColumn(i, null, null, new Integer(level), null, null);
+ setColumn(i, null, null, Integer.valueOf(level), null, null);
}
}
/**
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java?rev=823348&r1=823347&r2=823348&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java Thu Oct 8 22:29:41 2009
@@ -114,8 +114,8 @@
_unknownRecords.add(rec);
}
public void insertRow(RowRecord row) {
- // Integer integer = new Integer(row.getRowNumber());
- _rowRecords.put(new Integer(row.getRowNumber()), row);
+ // Integer integer = Integer.valueOf(row.getRowNumber());
+ _rowRecords.put(Integer.valueOf(row.getRowNumber()), row);
if ((row.getRowNumber() < _firstrow) || (_firstrow == -1)) {
_firstrow = row.getRowNumber();
}
@@ -127,7 +127,7 @@
public void removeRow(RowRecord row) {
int rowIndex = row.getRowNumber();
_valuesAgg.removeAllCellsValuesForRow(rowIndex);
- Integer key = new Integer(rowIndex);
+ Integer key = Integer.valueOf(rowIndex);
RowRecord rr = _rowRecords.remove(key);
if (rr == null) {
throw new RuntimeException("Invalid row index (" + key.intValue() + ")");
@@ -143,7 +143,7 @@
if (rowIndex < 0 || rowIndex > maxrow) {
throw new IllegalArgumentException("The row number must be between 0 and " + maxrow);
}
- return _rowRecords.get(new Integer(rowIndex));
+ return _rowRecords.get(Integer.valueOf(rowIndex));
}
public int getPhysicalNumberOfRows()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org