]> source.dussan.org Git - poi.git/commitdiff
sort to int conversion sign extension fix
authorJosh Micich <josh@apache.org>
Fri, 21 Mar 2008 23:47:51 +0000 (23:47 +0000)
committerJosh Micich <josh@apache.org>
Fri, 21 Mar 2008 23:47:51 +0000 (23:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@639918 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFRow.java

index 66f79ffd8ad289621f686d73cad3d8796163a368..75452dd94555627ba91d4084d7514b0ab6affcb4 100644 (file)
@@ -296,9 +296,9 @@ public final class HSSFRow implements Comparable {
      * @param cellnum  0 based column number
      * @return HSSFCell representing that column or null if undefined.
      */
-    public HSSFCell getCell(short cellnum)
-    {
-               return getCell((int)cellnum);
+    public HSSFCell getCell(short cellnum) {
+        int ushortCellNum = cellnum & 0x0000FFFF; // avoid sign extension
+        return getCell(ushortCellNum);
     }
     /**
      * Get the hssfcell representing a given column (logical cell)