diff options
author | Josh Micich <josh@apache.org> | 2009-10-08 22:29:41 +0000 |
---|---|---|
committer | Josh Micich <josh@apache.org> | 2009-10-08 22:29:41 +0000 |
commit | 78e643fe2184d931b08120ee5f29e2b2e9daf3c1 (patch) | |
tree | de68356537068f7231623438ee80cd456046a35b /src/contrib | |
parent | 8f4139a9a6041ec05a30223f84f39e0939bc863b (diff) | |
download | poi-78e643fe2184d931b08120ee5f29e2b2e9daf3c1.tar.gz poi-78e643fe2184d931b08120ee5f29e2b2e9daf3c1.zip |
Bugzilla 47962 - Fixed some potential NPEs. Avoided unnecessary creation of box instances. Applied patch with mods
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@823348 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/contrib')
4 files changed, 8 insertions, 12 deletions
diff --git a/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableCellEditor.java b/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableCellEditor.java index 8b421ceaf1..e7a2a5ded3 100644 --- a/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableCellEditor.java +++ b/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableCellEditor.java @@ -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 @@ import org.apache.poi.hssf.util.HSSFColor; * 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 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd * */ 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 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd short[] rgb = clr.getTriplet(); return new Color(rgb[0],rgb[1],rgb[2]); } - } diff --git a/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableUtils.java b/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableUtils.java index 954dc68e6e..5815ea0a59 100644 --- a/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableUtils.java +++ b/src/contrib/src/org/apache/poi/hssf/contrib/view/SVTableUtils.java @@ -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 @@ import org.apache.poi.hssf.util.*; * 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 @@ public class SVTableUtils { * @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 @@ public class SVTableUtils { short[] rgb = clr.getTriplet(); return new Color(rgb[0], rgb[1], rgb[2]); } - } diff --git a/src/contrib/src/org/apache/poi/ss/usermodel/contrib/CellUtil.java b/src/contrib/src/org/apache/poi/ss/usermodel/contrib/CellUtil.java index 337c987d24..d18cd4159b 100644 --- a/src/contrib/src/org/apache/poi/ss/usermodel/contrib/CellUtil.java +++ b/src/contrib/src/org/apache/poi/ss/usermodel/contrib/CellUtil.java @@ -154,7 +154,7 @@ public final class CellUtil { * @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 @@ public final class CellUtil { * @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 @@ public final class CellUtil { * @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)); } /** diff --git a/src/contrib/src/org/apache/poi/ss/usermodel/contrib/RegionUtil.java b/src/contrib/src/org/apache/poi/ss/usermodel/contrib/RegionUtil.java index 9654eb6ffd..612d72aac1 100644 --- a/src/contrib/src/org/apache/poi/ss/usermodel/contrib/RegionUtil.java +++ b/src/contrib/src/org/apache/poi/ss/usermodel/contrib/RegionUtil.java @@ -48,7 +48,7 @@ public final class RegionUtil { public CellPropertySetter(Workbook workbook, String propertyName, int value) { _workbook = workbook; _propertyName = propertyName; - _propertyValue = new Short((short) value); + _propertyValue = Short.valueOf((short) value); } |