poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1761376 [2/4] - in /poi/branches/hssf_cryptoapi: ./ sonar/ sonar/examples/ sonar/excelant/ sonar/main/ sonar/ooxml-schema-encryption/ sonar/ooxml-schema-security/ sonar/ooxml-schema/ sonar/ooxml/ sonar/scratchpad/ src/examples/src/org/apac...
Date Mon, 19 Sep 2016 00:20:45 GMT
Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/formula/functions/DStarRunner.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/formula/functions/DStarRunner.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/formula/functions/DStarRunner.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/formula/functions/DStarRunner.java Mon Sep 19 00:20:44 2016
@@ -17,13 +17,13 @@
 
 package org.apache.poi.ss.formula.functions;
 
-import org.apache.poi.ss.formula.TwoDEval;
+import org.apache.poi.ss.formula.eval.AreaEval;
 import org.apache.poi.ss.formula.eval.BlankEval;
 import org.apache.poi.ss.formula.eval.ErrorEval;
 import org.apache.poi.ss.formula.eval.EvaluationException;
 import org.apache.poi.ss.formula.eval.NotImplementedException;
 import org.apache.poi.ss.formula.eval.NumericValueEval;
-import org.apache.poi.ss.formula.eval.RefEval;
+import org.apache.poi.ss.formula.eval.OperandResolver;
 import org.apache.poi.ss.formula.eval.StringEval;
 import org.apache.poi.ss.formula.eval.StringValueEval;
 import org.apache.poi.ss.formula.eval.ValueEval;
@@ -62,11 +62,17 @@ public final class DStarRunner implement
     public ValueEval evaluate(int srcRowIndex, int srcColumnIndex,
             ValueEval database, ValueEval filterColumn, ValueEval conditionDatabase) {
         // Input processing and error checks.
-        if(!(database instanceof TwoDEval) || !(conditionDatabase instanceof TwoDEval)) {
+        if(!(database instanceof AreaEval) || !(conditionDatabase instanceof AreaEval)) {
             return ErrorEval.VALUE_INVALID;
         }
-        TwoDEval db = (TwoDEval)database;
-        TwoDEval cdb = (TwoDEval)conditionDatabase;
+        AreaEval db = (AreaEval)database;
+        AreaEval cdb = (AreaEval)conditionDatabase;
+        
+        try {
+            filterColumn = OperandResolver.getSingleValue(filterColumn, srcRowIndex, srcColumnIndex);
+        } catch (EvaluationException e) {
+            return e.getErrorEval();
+        }
 
         int fc;
         try {
@@ -100,15 +106,11 @@ public final class DStarRunner implement
             }
             // Filter each entry.
             if(matches) {
-                try {
-                    ValueEval currentValueEval = solveReference(db.getValue(row, fc));
-                    // Pass the match to the algorithm and conditionally abort the search.
-                    boolean shouldContinue = algorithm.processMatch(currentValueEval);
-                    if(! shouldContinue) {
-                        break;
-                    }
-                } catch (EvaluationException e) {
-                    return e.getErrorEval();
+                ValueEval currentValueEval = resolveReference(db, row, fc);
+                // Pass the match to the algorithm and conditionally abort the search.
+                boolean shouldContinue = algorithm.processMatch(currentValueEval);
+                if(! shouldContinue) {
+                    break;
                 }
             }
         }
@@ -126,56 +128,16 @@ public final class DStarRunner implement
     }
 
     /**
-     * Resolve reference(-chains) until we have a normal value.
+     * 
      *
-     * @param field a ValueEval which can be a RefEval.
-     * @return a ValueEval which is guaranteed not to be a RefEval
-     * @throws EvaluationException If a multi-sheet reference was found along the way.
-     */
-    private static ValueEval solveReference(ValueEval field) throws EvaluationException {
-        if (field instanceof RefEval) {
-            RefEval refEval = (RefEval)field;
-            if (refEval.getNumberOfSheets() > 1) {
-                throw new EvaluationException(ErrorEval.VALUE_INVALID);
-            }
-            return solveReference(refEval.getInnerValueEval(refEval.getFirstSheetIndex()));
-        }
-        else {
-            return field;
-        }
-    }
-
-    /**
-     * Returns the first column index that matches the given name. The name can either be
-     * a string or an integer, when it's an integer, then the respective column
-     * (1 based index) is returned.
-     * @param nameValueEval
-     * @param db
-     * @return the first column index that matches the given name (or int)
+     * @param nameValueEval Must not be a RefEval or AreaEval. Thus make sure resolveReference() is called on the value first!
+     * @param db Database
+     * @return Corresponding column number.
      * @throws EvaluationException
      */
-    @SuppressWarnings("unused")
-    private static int getColumnForTag(ValueEval nameValueEval, TwoDEval db)
+    private static int getColumnForName(ValueEval nameValueEval, AreaEval db)
             throws EvaluationException {
-        int resultColumn = -1;
-
-        // Numbers as column indicator are allowed, check that.
-        if(nameValueEval instanceof NumericValueEval) {
-            double doubleResultColumn = ((NumericValueEval)nameValueEval).getNumberValue();
-            resultColumn = (int)doubleResultColumn;
-            // Floating comparisions are usually not possible, but should work for 0.0.
-            if(doubleResultColumn - resultColumn != 0.0)
-                throw new EvaluationException(ErrorEval.VALUE_INVALID);
-            resultColumn -= 1; // Numbers are 1-based not 0-based.
-        } else {
-            resultColumn = getColumnForName(nameValueEval, db);
-        }
-        return resultColumn;
-    }
-
-    private static int getColumnForName(ValueEval nameValueEval, TwoDEval db)
-            throws EvaluationException {
-        String name = getStringFromValueEval(nameValueEval);
+        String name = OperandResolver.coerceValueToString(nameValueEval);
         return getColumnForString(db, name);
     }
 
@@ -187,16 +149,19 @@ public final class DStarRunner implement
      * @return Corresponding column number.
      * @throws EvaluationException If it's not possible to turn all headings into strings.
      */
-    private static int getColumnForString(TwoDEval db,String name)
+    private static int getColumnForString(AreaEval db,String name)
             throws EvaluationException {
         int resultColumn = -1;
         final int width = db.getWidth();
         for(int column = 0; column < width; ++column) {
-            ValueEval columnNameValueEval = db.getValue(0, column);
-            if(solveReference(columnNameValueEval) instanceof BlankEval) {
+            ValueEval columnNameValueEval = resolveReference(db, 0, column);
+            if(columnNameValueEval instanceof BlankEval) {
                 continue;
             }
-            String columnName = getStringFromValueEval(columnNameValueEval);
+            if(columnNameValueEval instanceof ErrorEval) {
+                continue;
+            }
+            String columnName = OperandResolver.coerceValueToString(columnNameValueEval);
             if(name.equals(columnName)) {
                 resultColumn = column;
                 break;
@@ -215,7 +180,7 @@ public final class DStarRunner implement
      * @throws EvaluationException If references could not be resolved or comparison
      * operators and operands didn't match.
      */
-    private static boolean fullfillsConditions(TwoDEval db, int row, TwoDEval cdb)
+    private static boolean fullfillsConditions(AreaEval db, int row, AreaEval cdb)
             throws EvaluationException {
         // Only one row must match to accept the input, so rows are ORed.
         // Each row is made up of cells where each cell is a condition,
@@ -229,20 +194,15 @@ public final class DStarRunner implement
                 // special column that accepts formulas.
                 boolean columnCondition = true;
                 ValueEval condition = null;
-                try {
-                    // The condition to apply.
-                    condition = solveReference(cdb.getValue(conditionRow, column));
-                } catch (java.lang.RuntimeException e) {
-                    // It might be a special formula, then it is ok if it fails.
-                    columnCondition = false;
-                }
+                
+                // The condition to apply.
+                condition = resolveReference(cdb, conditionRow, column);
+                
                 // If the condition is empty it matches.
                 if(condition instanceof BlankEval)
                     continue;
                 // The column in the DB to apply the condition to.
-                ValueEval targetHeader = solveReference(cdb.getValue(0, column));
-                targetHeader = solveReference(targetHeader);
-
+                ValueEval targetHeader = resolveReference(cdb, 0, column);
 
                 if(!(targetHeader instanceof StringValueEval)) {
                     throw new EvaluationException(ErrorEval.VALUE_INVALID);
@@ -254,14 +214,14 @@ public final class DStarRunner implement
 
                 if(columnCondition == true) { // normal column condition
                     // Should not throw, checked above.
-                    ValueEval value = db.getValue(
-                            row, getColumnForName(targetHeader, db));
+                    ValueEval value = resolveReference(db, row, getColumnForName(targetHeader, db));
                     if(!testNormalCondition(value, condition)) {
                         matches = false;
                         break;
                     }
                 } else { // It's a special formula condition.
-                    if(getStringFromValueEval(condition).isEmpty()) {
+                    // TODO: Check whether the condition cell contains a formula and return #VALUE! if it doesn't.
+                    if(OperandResolver.coerceValueToString(condition).isEmpty()) {
                         throw new EvaluationException(ErrorEval.VALUE_INVALID);
                     }
                     throw new NotImplementedException(
@@ -328,7 +288,7 @@ public final class DStarRunner implement
                 if(itsANumber) {
                     return testNumericCondition(value, operator.equal, stringOrNumber);
                 } else { // It's a string.
-                    String valueString = value instanceof BlankEval ? "" : getStringFromValueEval(value);
+                    String valueString = value instanceof BlankEval ? "" : OperandResolver.coerceValueToString(value);
                     return stringOrNumber.equals(valueString);
                 }
             } else { // It's a text starts-with condition.
@@ -336,7 +296,7 @@ public final class DStarRunner implement
                     return value instanceof StringEval;
                 }
                 else {
-                    String valueString = value instanceof BlankEval ? "" : getStringFromValueEval(value);
+                    String valueString = value instanceof BlankEval ? "" : OperandResolver.coerceValueToString(value);
                     return valueString.startsWith(conditionString);
                 }
             }
@@ -424,20 +384,20 @@ public final class DStarRunner implement
             return null;
         }
     }
-
+    
     /**
-     * Takes a ValueEval and tries to retrieve a String value from it.
-     * It tries to resolve references if there are any.
+     * Resolve a ValueEval that's in an AreaEval.
      *
-     * @param value ValueEval to retrieve the string from.
-     * @return String corresponding to the given ValueEval.
-     * @throws EvaluationException If it's not possible to retrieve a String value.
+     * @param db AreaEval from which the cell to resolve is retrieved. 
+     * @param dbRow Relative row in the AreaEval.
+     * @param dbCol Relative column in the AreaEval.
+     * @return A ValueEval that is a NumberEval, StringEval, BoolEval, BlankEval or ErrorEval.
      */
-    private static String getStringFromValueEval(ValueEval value)
-            throws EvaluationException {
-        value = solveReference(value);
-        if(!(value instanceof StringValueEval))
-            throw new EvaluationException(ErrorEval.VALUE_INVALID);
-        return ((StringValueEval)value).getStringValue();
+    private static ValueEval resolveReference(AreaEval db, int dbRow, int dbCol) {
+        try {
+            return OperandResolver.getSingleValue(db.getValue(dbRow, dbCol), db.getFirstRow()+dbRow, db.getFirstColumn()+dbCol);
+        } catch (EvaluationException e) {
+            return e.getErrorEval();
+        }
     }
 }

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java Mon Sep 19 00:20:44 2016
@@ -19,6 +19,8 @@
 
 package org.apache.poi.ss.usermodel;
 
+import org.apache.poi.util.Removal;
+
 /**
  * High level representation for Border Formatting component
  * of Conditional Formatting settings
@@ -27,84 +29,128 @@ public interface BorderFormatting {
     /** No border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#NONE}
      */
+    @Removal(version="3.17")
     short BORDER_NONE                = 0x0;
     
     /** Thin border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#THIN}
      */
+    @Removal(version="3.17")
     short BORDER_THIN                = 0x1;
     
     /** Medium border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM}
      */
+    @Removal(version="3.17")
     short BORDER_MEDIUM              = 0x2;
     
     /** dash border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DASHED}
      */
+    @Removal(version="3.17")
     short BORDER_DASHED              = 0x3;
     
     /** dot border 
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DOTTED}
      */
+    @Removal(version="3.17")
     short BORDER_DOTTED              = 0x4;
     
     /** Thick border 
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#THICK}
      */
+    @Removal(version="3.17")
     short BORDER_THICK               = 0x5;
     
     /** double-line border 
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DOUBLE}
      */
+    @Removal(version="3.17")
     short BORDER_DOUBLE              = 0x6;
     
     /** hair-line border 
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#HAIR}
      */
+    @Removal(version="3.17")
     short BORDER_HAIR                = 0x7;
     
     /** Medium dashed border 
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASHED}
      */
+    @Removal(version="3.17")
     short BORDER_MEDIUM_DASHED       = 0x8;
     
-    
     /** dash-dot border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DASH_DOT}
      */
+    @Removal(version="3.17")
     short BORDER_DASH_DOT            = 0x9;
     
     /** medium dash-dot border 
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASH_DOT}
      */
+    @Removal(version="3.17")
     short BORDER_MEDIUM_DASH_DOT     = 0xA;
     
     /** dash-dot-dot border 
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DASH_DOT_DOT}
      */
+    @Removal(version="3.17")
     short BORDER_DASH_DOT_DOT        = 0xB;
     
     /** medium dash-dot-dot border 
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASH_DOT_DOT}
      */
+    @Removal(version="3.17")
     short BORDER_MEDIUM_DASH_DOT_DOT = 0xC;
     
     /** slanted dash-dot border 
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#SLANTED_DASH_DOT}
      */
+    @Removal(version="3.17")
     short BORDER_SLANTED_DASH_DOT    = 0xD;
 
-    BorderStyle getBorderBottom();
-
-    BorderStyle getBorderDiagonal();
-
-    BorderStyle getBorderLeft();
-
-    BorderStyle getBorderRight();
-
-    BorderStyle getBorderTop();
+    /**
+     * @deprecated POI 3.15. Use {@link #getBorderBottomEnum()}.
+     * This method will return an BorderStyle enum in the future.
+     */
+    short getBorderBottom();
+    /** @since POI 3.15 */
+    BorderStyle getBorderBottomEnum();
+
+    /**
+     * @deprecated POI 3.15. Use {@link #getBorderDiagonalEnum()}.
+     * This method will return an BorderStyle enum in the future.
+     */
+    short getBorderDiagonal();
+    /** @since POI 3.15 */
+    BorderStyle getBorderDiagonalEnum();
+
+    /**
+     * @deprecated POI 3.15. Use {@link #getBorderLeftEnum()}.
+     * This method will return an BorderStyle enum in the future.
+     */
+    short getBorderLeft();
+    /** @since POI 3.15 */
+    BorderStyle getBorderLeftEnum();
+
+    /**
+     * @deprecated POI 3.15. Use {@link #getBorderRightEnum()}.
+     * This method will return an BorderStyle enum in the future.
+     */
+    short getBorderRight();
+    /** @since POI 3.15 */
+    BorderStyle getBorderRightEnum();
+
+    /**
+     * @deprecated POI 3.15. Use {@link #getBorderTopEnum()}.
+     * This method will return an BorderStyle enum in the future.
+     */
+    short getBorderTop();
+    /** @since POI 3.15 */
+    BorderStyle getBorderTopEnum();
 
+    
     short getBottomBorderColor();
     Color getBottomBorderColorColor();
 

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/BuiltinFormats.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/BuiltinFormats.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/BuiltinFormats.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/BuiltinFormats.java Mon Sep 19 00:20:44 2016
@@ -75,7 +75,7 @@ public final class BuiltinFormats {
         "#,##0.00",
         "\"$\"#,##0_);(\"$\"#,##0)",
         "\"$\"#,##0_);[Red](\"$\"#,##0)",
-        "\"$\"#,##,00_);(\"$\"#,##0.00)",
+        "\"$\"#,##0.00_);(\"$\"#,##0.00)",
         "\"$\"#,##0.00_);[Red](\"$\"#,##0.00)",
         "0%",
         "0.00%",

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/Cell.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/Cell.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/Cell.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/Cell.java Mon Sep 19 00:20:44 2016
@@ -24,6 +24,7 @@ import org.apache.poi.ss.formula.Formula
 import org.apache.poi.ss.util.CellAddress;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.Internal;
+import org.apache.poi.util.Removal;
 
 /**
  * High level representation of a cell in a row of a spreadsheet.
@@ -46,7 +47,8 @@ public interface Cell {
      * @see #getCellType()
      * @deprecated POI 3.15 beta 3. Use {@link CellType#NUMERIC} instead.
      */
-    CellType CELL_TYPE_NUMERIC = CellType.NUMERIC;
+    @Removal(version="4.0")
+    int CELL_TYPE_NUMERIC = 0; //CellType.NUMERIC.getCode();
 
     /**
      * String Cell type (1)
@@ -54,7 +56,8 @@ public interface Cell {
      * @see #getCellType()
      * @deprecated POI 3.15 beta 3. Use {@link CellType#STRING} instead.
      */
-    CellType CELL_TYPE_STRING = CellType.STRING;
+    @Removal(version="4.0")
+    int CELL_TYPE_STRING = 1; //CellType.STRING.getCode();
 
     /**
      * Formula Cell type (2)
@@ -62,7 +65,8 @@ public interface Cell {
      * @see #getCellType()
      * @deprecated POI 3.15 beta 3. Use {@link CellType#FORMULA} instead.
      */
-    CellType CELL_TYPE_FORMULA = CellType.FORMULA;
+    @Removal(version="4.0")
+    int CELL_TYPE_FORMULA = 2; //CellType.FORMULA.getCode();
 
     /**
      * Blank Cell type (3)
@@ -70,7 +74,8 @@ public interface Cell {
      * @see #getCellType()
      * @deprecated POI 3.15 beta 3. Use {@link CellType#BLANK} instead.
      */
-    CellType CELL_TYPE_BLANK = CellType.BLANK;
+    @Removal(version="4.0")
+    int CELL_TYPE_BLANK = 3; //CellType.BLANK.getCode();
 
     /**
      * Boolean Cell type (4)
@@ -78,7 +83,8 @@ public interface Cell {
      * @see #getCellType()
      * @deprecated POI 3.15 beta 3. Use {@link CellType#BOOLEAN} instead.
      */
-    CellType CELL_TYPE_BOOLEAN = CellType.BOOLEAN;
+    @Removal(version="4.0")
+    int CELL_TYPE_BOOLEAN = 4; //CellType.BOOLEAN.getCode();
 
     /**
      * Error Cell type (5)
@@ -86,7 +92,8 @@ public interface Cell {
      * @see #getCellType()
      * @deprecated POI 3.15 beta 3. Use {@link CellType#ERROR} instead.
      */
-    CellType CELL_TYPE_ERROR = CellType.ERROR;
+    @Removal(version="4.0")
+    int CELL_TYPE_ERROR = 5; //CellType.ERROR.getCode();
 
     /**
      * Returns column index of this cell
@@ -136,6 +143,7 @@ public interface Cell {
      * @see CellType#ERROR
      * @deprecated POI 3.15 beta 3. Use {@link #setCellType(CellType)} instead.
      */
+    @Removal(version="4.0")
     void setCellType(int cellType);
     /**
      * Set the cells type (numeric, formula or string).
@@ -155,10 +163,11 @@ public interface Cell {
     /**
      * Return the cell type.
      * 
-     * Will return {@link CellType} in a future version of POI.
+     * Will return {@link CellType} in version 4.0 of POI.
      * For forwards compatibility, do not hard-code cell type literals in your code.
      *
      * @return the cell type
+     * @deprecated POI 3.15. Will return a {@link CellType} enum in the future.
      */
     int getCellType();
     
@@ -168,9 +177,9 @@ public interface Cell {
      * @return the cell type
      * @since POI 3.15 beta 3
      * @deprecated POI 3.15 beta 3
-     * Will be deleted when we make the CellType enum transition. See bug 59791.
+     * Will be renamed to <code>getCellType()</code> when we make the CellType enum transition in POI 4.0. See bug 59791.
      */
-    @Internal(since="POI 3.15 beta 3")
+    @Removal(version="4.2")
     CellType getCellTypeEnum();
     
     /**
@@ -182,6 +191,7 @@ public interface Cell {
      * @return one of ({@link CellType#NUMERIC}, {@link CellType#STRING},
      *     {@link CellType#BOOLEAN}, {@link CellType#ERROR}) depending
      * on the cached value of the formula
+     * @deprecated 3.15. Will return a {@link CellType} enum in the future.
      */
     int getCachedFormulaResultType();
 
@@ -192,9 +202,8 @@ public interface Cell {
      * on the cached value of the formula
      * @since POI 3.15 beta 3
      * @deprecated POI 3.15 beta 3
-     * Will be deleted when we make the CellType enum transition. See bug 59791.
+     * Will be renamed to <code>getCachedFormulaResultType()</code> when we make the CellType enum transition in POI 4.0. See bug 59791.
      */
-    @Internal(since="POI 3.15 beta 3")
     CellType getCachedFormulaResultTypeEnum();
 
     /**

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CellStyle.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CellStyle.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CellStyle.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CellStyle.java Mon Sep 19 00:20:44 2016
@@ -17,270 +17,316 @@
 
 package org.apache.poi.ss.usermodel;
 
+import org.apache.poi.util.Removal;
+
 public interface CellStyle {
 
     /**
      * general (normal) horizontal alignment
      * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#GENERAL} instead.
      */
+    @Removal(version="3.17")
     static final short ALIGN_GENERAL = 0x0; //HorizontalAlignment.GENERAL.getCode();
 
     /**
      * left-justified horizontal alignment
      * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#LEFT} instead.
      */
+    @Removal(version="3.17")
     static final short ALIGN_LEFT = 0x1; //HorizontalAlignment.LEFT.getCode();
 
     /**
      * center horizontal alignment
      * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#CENTER} instead.
      */
+    @Removal(version="3.17")
     static final short ALIGN_CENTER = 0x2; //HorizontalAlignment.CENTER.getCode();
 
     /**
      * right-justified horizontal alignment
      * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#RIGHT} instead.
      */
+    @Removal(version="3.17")
     static final short ALIGN_RIGHT = 0x3; //HorizontalAlignment.RIGHT.getCode();
 
     /**
      * fill? horizontal alignment
      * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#FILL} instead.
      */
+    @Removal(version="3.17")
     static final short ALIGN_FILL = 0x4; //HorizontalAlignment.FILL.getCode();
 
     /**
      * justified horizontal alignment
      * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#JUSTIFY} instead.
      */
+    @Removal(version="3.17")
     static final short ALIGN_JUSTIFY = 0x5; //HorizontalAlignment.JUSTIFY.getCode();
 
     /**
      * center-selection? horizontal alignment
      * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#CENTER_SELECTION} instead.
      */
+    @Removal(version="3.17")
     static final short ALIGN_CENTER_SELECTION = 0x6; //HorizontalAlignment.CENTER_SELECTION.getCode();
 
     /**
      * top-aligned vertical alignment
      * @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#TOP} instead.
      */
+    @Removal(version="3.17")
     static final short VERTICAL_TOP = 0x0; //VerticalAlignment.TOP.getCode();
 
     /**
      * center-aligned vertical alignment
      * @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#CENTER} instead.
      */
+    @Removal(version="3.17")
     static final short VERTICAL_CENTER = 0x1; //VerticalAlignment.CENTER.getCode();
 
     /**
      * bottom-aligned vertical alignment
      * @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#BOTTOM} instead.
      */
+    @Removal(version="3.17")
     static final short VERTICAL_BOTTOM = 0x2; //VerticalAlignment.BOTTOM.getCode();
 
     /**
      * vertically justified vertical alignment
      * @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#JUSTIFY} instead.
      */
+    @Removal(version="3.17")
     static final short VERTICAL_JUSTIFY = 0x3; //VerticalAlignment.JUSTIFY.getCode();
 
     /**
      * No border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#NONE} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_NONE = 0x0; //BorderStyle.NONE.getCode();
 
     /**
      * Thin border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#THIN} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_THIN = 0x1; //BorderStyle.THIN.getCode();
 
     /**
      * Medium border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_MEDIUM = 0x2; //BorderStyle.MEDIUM.getCode();
 
     /**
      * dash border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DASHED} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_DASHED = 0x3; //BorderStyle.DASHED.getCode();
 
     /**
      * dot border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DOTTED} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_DOTTED = 0x4; //BorderStyle.DOTTED.getCode();
 
     /**
      * Thick border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#THICK} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_THICK = 0x5; //BorderStyle.THICK.getCode();
 
     /**
      * double-line border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DOUBLE} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_DOUBLE = 0x6; //BorderStyle.DOUBLE.getCode();
 
     /**
      * hair-line border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#HAIR} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_HAIR = 0x7; //BorderStyle.HAIR.getCode();
 
     /**
      * Medium dashed border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASHED} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_MEDIUM_DASHED = 0x8; //BorderStyle.MEDIUM_DASHED.getCode();
 
     /**
      * dash-dot border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DASH_DOT} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_DASH_DOT = 0x9; //BorderStyle.DASH_DOT.getCode();
 
     /**
      * medium dash-dot border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASH_DOT} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_MEDIUM_DASH_DOT = 0xA; //BorderStyle.MEDIUM_DASH_DOT.getCode();
 
     /**
      * dash-dot-dot border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#DASH_DOT_DOT} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_DASH_DOT_DOT = 0xB; //BorderStyle.DASH_DOT_DOT.getCode();
 
     /**
      * medium dash-dot-dot border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASH_DOT_DOT} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_MEDIUM_DASH_DOT_DOT = 0xC; //BorderStyle.MEDIUM_DASH_DOT_DOT.getCode();
 
     /**
      * slanted dash-dot border
      * @deprecated 3.15 beta 2. Use {@link BorderStyle#SLANTED_DASH_DOT} instead.
      */
+    @Removal(version="3.17")
     static final short BORDER_SLANTED_DASH_DOT = 0xD; //BorderStyle.SLANTED_DASH_DOT.getCode();
 
     /** 
      * Fill Pattern: No background
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#NO_FILL} instead.
      */
+    @Removal(version="3.17")
     static final short NO_FILL = 0; //FillPatternType.NO_FILL.getCode();
 
     /**
      * Fill Pattern: Solidly filled
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#SOLID_FOREGROUND} instead.
      */
+    @Removal(version="3.17")
     static final short SOLID_FOREGROUND = 1; //FillPatternType.SOLID_FOREGROUND.getCode();
 
     /**
      * Fill Pattern: Small fine dots
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#FINE_DOTS} instead.
      */
+    @Removal(version="3.17")
     static final short FINE_DOTS = 2; //FillPatternType.FINE_DOTS.getCode();
 
     /**
      * Fill Pattern: Wide dots
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#ALT_BARS} instead.
      */
+    @Removal(version="3.17")
     static final short ALT_BARS = 3; //FillPatternType.ALT_BARS.getCode();
 
     /**
      * Fill Pattern: Sparse dots
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#SPARSE_DOTS} instead.
      */
+    @Removal(version="3.17")
     static final short SPARSE_DOTS = 4; //FillPatternType.SPARSE_DOTS.getCode();
 
     /**
      * Fill Pattern: Thick horizontal bands
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_HORZ_BANDS} instead.
      */
+    @Removal(version="3.17")
     static final short THICK_HORZ_BANDS = 5; //FillPatternType.THICK_HORZ_BANDS.getCode();
 
     /**
      * Fill Pattern: Thick vertical bands
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_VERT_BANDS} instead.
      */
+    @Removal(version="3.17")
     static final short THICK_VERT_BANDS = 6; //FillPatternType.THICK_VERT_BANDS.getCode();
 
     /**
      * Fill Pattern: Thick backward facing diagonals
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_BACKWARD_DIAG} instead.
      */
+    @Removal(version="3.17")
     static final short THICK_BACKWARD_DIAG = 7; //FillPatternType.THICK_BACKWARD_DIAG.getCode();
 
     /**
      * Fill Pattern: Thick forward facing diagonals
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_FORWARD_DIAG} instead.
      */
+    @Removal(version="3.17")
     static final short THICK_FORWARD_DIAG = 8; //FillPatternType.THICK_FORWARD_DIAG.getCode();
 
     /**
      * Fill Pattern: Large spots
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#BIG_SPOTS} instead.
      */
+    @Removal(version="3.17")
     static final short BIG_SPOTS = 9; //FillPatternType.BIG_SPOTS.getCode();
 
     /**
      * Fill Pattern: Brick-like layout
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#BRICKS} instead.
      */
+    @Removal(version="3.17")
     static final short BRICKS = 10; //FillPatternType.BRICKS.getCode();
 
     /**
      * Fill Pattern: Thin horizontal bands
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_HORZ_BANDS} instead.
      */
+    @Removal(version="3.17")
     static final short THIN_HORZ_BANDS = 11; //FillPatternType.THIN_HORZ_BANDS.getCode();
 
     /**
      * Fill Pattern: Thin vertical bands
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_VERT_BANDS} instead.
      */
+    @Removal(version="3.17")
     static final short THIN_VERT_BANDS = 12; //FillPatternType.THIN_VERT_BANDS.getCode();
 
     /**
      * Fill Pattern: Thin backward diagonal
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_BACKWARD_DIAG} instead.
      */
+    @Removal(version="3.17")
     static final short THIN_BACKWARD_DIAG = 13; //FillPatternType.THIN_BACKWARD_DIAG.getCode();
 
     /**
      * Fill Pattern: Thin forward diagonal
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_FORWARD_DIAG} instead.
      */
+    @Removal(version="3.17")
     static final short THIN_FORWARD_DIAG = 14; //FillPatternType.THIN_FORWARD_DIAG.getCode();
 
     /**
      * Fill Pattern: Squares
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#SQUARES} instead.
      */
+    @Removal(version="3.17")
     static final short SQUARES = 15; //FillPatternType.SQUARES.getCode();
 
     /**
      * Fill Pattern: Diamonds
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#DIAMONDS} instead.
      */
+    @Removal(version="3.17")
     static final short DIAMONDS = 16; //FillPatternType.DIAMONDS.getCode();
 
     /**
      * Fill Pattern: Less Dots
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#LESS_DOTS} instead.
      */
+    @Removal(version="3.17")
     static final short LESS_DOTS = 17; //FillPatternType.LESS_DOTS.getCode();
 
     /**
      * Fill Pattern: Least Dots
      * @deprecated 3.15 beta 3. Use {@link FillPatternType#LEAST_DOTS} instead.
      */
+    @Removal(version="3.17")
     static final short LEAST_DOTS = 18; //FillPatternType.LEAST_DOTS.getCode();
 
     /**
@@ -495,19 +541,29 @@ public interface CellStyle {
      * @see #BORDER_SLANTED_DASH_DOT
      * @deprecated 3.15 beta 2. Use {@link #setBorderLeft(BorderStyle)} instead
      */
+    @Removal(version="3.17")
     void setBorderLeft(short border);
     
     /**
      * set the type of border to use for the left border of the cell
      * @param border type
+     * @since POI 3.15
      */
     void setBorderLeft(BorderStyle border);
 
     /**
      * get the type of border to use for the left border of the cell
      * @return border type
+     * @deprecated POI 3.15. Use {@link #getBorderLeftEnum()} instead.
+     * This will return a BorderStyle enum in the future.
+     */
+    short getBorderLeft();
+    /**
+     * get the type of border to use for the left border of the cell
+     * @return border type
+     * @since POI 3.15
      */
-    BorderStyle getBorderLeft();
+    BorderStyle getBorderLeftEnum();
 
     /**
      * set the type of border to use for the right border of the cell
@@ -528,19 +584,29 @@ public interface CellStyle {
      * @see #BORDER_SLANTED_DASH_DOT
      * @deprecated 3.15 beta 2. Use {@link #setBorderRight(BorderStyle)} instead
      */
+    @Removal(version="3.17")
     void setBorderRight(short border);
     
     /**
      * set the type of border to use for the right border of the cell
      * @param border type
+     * @since POI 3.15
      */
     void setBorderRight(BorderStyle border);
 
     /**
      * get the type of border to use for the right border of the cell
      * @return border type
+     * @deprecated POI 3.15. Use {@link #getBorderRightEnum()} instead.
+     * This will return a BorderStyle enum in the future.
+     */
+    short getBorderRight();
+    /**
+     * get the type of border to use for the right border of the cell
+     * @return border type
+     * @since POI 3.15
      */
-    BorderStyle getBorderRight();
+    BorderStyle getBorderRightEnum();
 
     /**
      * set the type of border to use for the top border of the cell
@@ -561,19 +627,29 @@ public interface CellStyle {
      * @see #BORDER_SLANTED_DASH_DOT
      * @deprecated 3.15 beta 2. Use {@link #setBorderTop(BorderStyle)} instead
      */
+    @Removal(version="3.17")
     void setBorderTop(short border);
     
     /**
      * set the type of border to use for the top border of the cell
      * @param border type
+     * @since POI 3.15
      */
     void setBorderTop(BorderStyle border);
 
     /**
      * get the type of border to use for the top border of the cell
      * @return border type
+     * @deprecated POI 3.15. Use {@link #getBorderTopEnum()} instead.
+     * This will return a BorderStyle enum in the future.
      */
-    BorderStyle getBorderTop();
+    short getBorderTop();
+    /**
+     * get the type of border to use for the top border of the cell
+     * @return border type
+     * @since POI 3.15
+     */
+    BorderStyle getBorderTopEnum();
 
     /**
      * set the type of border to use for the bottom border of the cell
@@ -594,19 +670,29 @@ public interface CellStyle {
      * @see #BORDER_SLANTED_DASH_DOT
      * @deprecated 3.15 beta 2. Use {@link #setBorderBottom(BorderStyle)} instead.
      */
+    @Removal(version="3.17")
     void setBorderBottom(short border);
     
     /**
      * set the type of border to use for the bottom border of the cell
      * @param border type
+     * @since POI 3.15
      */
     void setBorderBottom(BorderStyle border);
 
     /**
      * get the type of border to use for the bottom border of the cell
      * @return border type
+     * @deprecated POI 3.15. Use {@link #getBorderBottomEnum()} instead.
+     * This will return a BorderStyle enum in the future.
+     */
+    short getBorderBottom();
+    /**
+     * get the type of border to use for the bottom border of the cell
+     * @return border type
+     * @since POI 3.15
      */
-    BorderStyle getBorderBottom();
+    BorderStyle getBorderBottomEnum();
 
     /**
      * set the color to use for the left border

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CellValue.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CellValue.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CellValue.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CellValue.java Mon Sep 19 00:20:44 2016
@@ -78,11 +78,23 @@ public final class CellValue {
 	}
 	/**
 	 * @return Returns the cellType.
+	 * @since POI 3.15
 	 */
-	public CellType getCellType() {
+	public CellType getCellTypeEnum() {
 		return _cellType;
 	}
 	/**
+	 * @return Returns the cellType.
+	 * @deprecated POI 3.15. Use {@link #getCellTypeEnum()} instead.
+	 * In the future, the signature of this method will be changed to return a
+	 * {@link CellType}.
+	 */
+	@Deprecated
+	public int getCellType() {
+		return _cellType.getCode();
+	}
+
+	/**
 	 * @return Returns the errorValue.
 	 */
 	public byte getErrorValue() {

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java Mon Sep 19 00:20:44 2016
@@ -17,6 +17,7 @@
 package org.apache.poi.ss.usermodel;
 
 import org.apache.poi.util.Internal;
+import org.apache.poi.util.Removal;
 
 /**
  * A client anchor is attached to an excel worksheet.  It anchors against a
@@ -35,6 +36,7 @@ public interface ClientAnchor {
      * </p>
      * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType#MOVE_AND_RESIZE} instead.
      */
+    @Removal(version="3.17")
     public static final AnchorType MOVE_AND_RESIZE = AnchorType.MOVE_AND_RESIZE;
     
     /**
@@ -50,6 +52,7 @@ public interface ClientAnchor {
      * </p>
      * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType#MOVE_DONT_RESIZE} instead.
      */
+    @Removal(version="3.17")
     public static final AnchorType MOVE_DONT_RESIZE = AnchorType.MOVE_DONT_RESIZE;
 
     /**
@@ -66,6 +69,7 @@ public interface ClientAnchor {
      * </p>
      * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType#DONT_MOVE_AND_RESIZE} instead.
      */
+    @Removal(version="3.17")
     public static final AnchorType DONT_MOVE_AND_RESIZE = AnchorType.DONT_MOVE_AND_RESIZE;
     
     /**
@@ -288,11 +292,20 @@ public interface ClientAnchor {
     /**
      * Sets the anchor type
      * @param anchorType the anchor type to set
+     * @since POI 3.14
      */
     public void setAnchorType( AnchorType anchorType );
+    /**
+     * Sets the anchor type
+     * @param anchorType the anchor type to set
+     * @deprecated POI 3.15. Use {@link #setAnchorType(AnchorType)} instead.
+     */
+    @Removal(version="3.17")
+    public void setAnchorType( int anchorType );
 
     /**
      * Gets the anchor type
+     * Changed from returning an int to an enum in POI 3.14 beta 1.
      * @return the anchor type
      */
     public AnchorType getAnchorType();

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CreationHelper.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CreationHelper.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CreationHelper.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/CreationHelper.java Mon Sep 19 00:20:44 2016
@@ -17,18 +17,18 @@
 package org.apache.poi.ss.usermodel;
 
 import org.apache.poi.common.usermodel.HyperlinkType;
+import org.apache.poi.util.Removal;
 
 /**
  * An object that handles instantiating concrete
  *  classes of the various instances one needs for
  *  HSSF and XSSF.
- * Works around a major shortcoming in Java, where we
- *  can't have static methods on interfaces or abstract
+ * Works around a limitation in Java where we
+ *  cannot have static methods on interfaces or abstract
  *  classes.
  * This allows you to get the appropriate class for
  *  a given interface, without you having to worry
- *  about if you're dealing with HSSF or XSSF, despite
- *  Java being quite rubbish.
+ *  about if you're dealing with HSSF or XSSF.
  */
 public interface CreationHelper {
     /**
@@ -46,6 +46,7 @@ public interface CreationHelper {
      * Creates a new Hyperlink, of the given type
      * @deprecated POI 3.15 beta 3. Use {@link #createHyperlink(HyperlinkType)} instead.
      */
+    @Removal(version="3.17")
     @Deprecated
     Hyperlink createHyperlink(int type);
     

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/DataConsolidateFunction.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/DataConsolidateFunction.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/DataConsolidateFunction.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/DataConsolidateFunction.java Mon Sep 19 00:20:44 2016
@@ -38,8 +38,8 @@ public enum DataConsolidateFunction {
     VAR(10, "Var"),
     VARP(11, "Varp");
 
-    private int value;
-    private String name;
+    private final int value;
+    private final String name;
 
     DataConsolidateFunction(int value, String name) {
         this.value = value;

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/DataFormatter.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/DataFormatter.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/DataFormatter.java Mon Sep 19 00:20:44 2016
@@ -895,7 +895,7 @@ public class DataFormatter implements Ob
                 return cell.getRichStringCellValue().getString();
 
             case BOOLEAN :
-                return String.valueOf(cell.getBooleanCellValue());
+                return cell.getBooleanCellValue() ? "TRUE" : "FALSE";
             case BLANK :
                 return "";
             case ERROR:

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/FormulaError.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/FormulaError.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/FormulaError.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/FormulaError.java Mon Sep 19 00:20:44 2016
@@ -166,19 +166,19 @@ public enum FormulaError {
         return false;
     }
 
-    public static FormulaError forInt(byte type){
+    public static FormulaError forInt(byte type) throws IllegalArgumentException {
         FormulaError err = bmap.get(type);
         if(err == null) throw new IllegalArgumentException("Unknown error type: " + type);
         return err;
     }
-    public static FormulaError forInt(int type){
+    public static FormulaError forInt(int type) throws IllegalArgumentException {
         FormulaError err = imap.get(type);
         if(err == null) err = bmap.get((byte)type);
         if(err == null) throw new IllegalArgumentException("Unknown error type: " + type);
         return err;
     }
 
-    public static FormulaError forString(String code){
+    public static FormulaError forString(String code) throws IllegalArgumentException {
         FormulaError err = smap.get(code);
         if(err == null) throw new IllegalArgumentException("Unknown error code: " + code);
         return err;

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java Mon Sep 19 00:20:44 2016
@@ -101,6 +101,7 @@ public interface FormulaEvaluator {
      *      or one of {@link CellType#NUMERIC}, {@link CellType#STRING},
      *      {@link CellType#BOOLEAN}, {@link CellType#ERROR}
      *      Note: the cell's type remains as CellType.FORMULA however.
+     * @deprecated 3.15. Will return a {@link CellType} enum in the future
      */
     int evaluateFormulaCell(Cell cell);
     

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/Row.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/Row.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/Row.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/Row.java Mon Sep 19 00:20:44 2016
@@ -19,6 +19,8 @@ package org.apache.poi.ss.usermodel;
 
 import java.util.Iterator;
 
+import org.apache.poi.util.Removal;
+
 /**
  * High level representation of a row of a spreadsheet.
  */
@@ -240,8 +242,10 @@ public interface Row extends Iterable<Ce
         CREATE_NULL_AS_BLANK(3);
         
         /**
-         * @deprecated as of POI 3.15-beta2, scheduled for removal in 3.17 - the id has no function and will be removed 
+         * @deprecated as of POI 3.15-beta2, scheduled for removal in 3.17 - the id has no function and will be removed.
+         * The {@code id} is only kept only for backwards compatibility with applications that hard-coded the number
          */
+        @Removal(version="3.17")
         @Deprecated
         public final int id;
         private MissingCellPolicy(int id) {
@@ -254,6 +258,7 @@ public interface Row extends Iterable<Ce
      * 
      * @deprecated as of POI 3.15-beta2, scheduled for removal in 3.17 - use the MissingCellPolicy enum
      **/
+    @Removal(version="3.17")
     @Deprecated
     public static final MissingCellPolicy RETURN_NULL_AND_BLANK = MissingCellPolicy.RETURN_NULL_AND_BLANK;
     /**
@@ -261,6 +266,7 @@ public interface Row extends Iterable<Ce
      * 
      * @deprecated as of POI 3.15-beta2, scheduled for removal in 3.17 - use the MissingCellPolicy enum
      **/
+    @Removal(version="3.17")
     @Deprecated
     public static final MissingCellPolicy RETURN_BLANK_AS_NULL = MissingCellPolicy.RETURN_BLANK_AS_NULL;
     /**
@@ -268,6 +274,7 @@ public interface Row extends Iterable<Ce
      * 
      * @deprecated as of POI 3.15-beta2, scheduled for removal in 3.17 - use the MissingCellPolicy enum
      **/
+    @Removal(version="3.17")
     @Deprecated
     public static final MissingCellPolicy CREATE_NULL_AS_BLANK = MissingCellPolicy.CREATE_NULL_AS_BLANK;
     

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java Mon Sep 19 00:20:44 2016
@@ -42,7 +42,7 @@ public class DataSources {
         return new AbstractCellRangeDataSource<Number>(sheet, cellRangeAddress) {
             public Number getPointAt(int index) {
                 CellValue cellValue = getCellValueAt(index);
-                if (cellValue != null && cellValue.getCellType() == CellType.NUMERIC) {
+                if (cellValue != null && cellValue.getCellTypeEnum() == CellType.NUMERIC) {
                     return Double.valueOf(cellValue.getNumberValue());
                 } else {
                     return null;
@@ -59,7 +59,7 @@ public class DataSources {
         return new AbstractCellRangeDataSource<String>(sheet, cellRangeAddress) {
             public String getPointAt(int index) {
                 CellValue cellValue = getCellValueAt(index);
-                if (cellValue != null && cellValue.getCellType() == CellType.STRING) {
+                if (cellValue != null && cellValue.getCellTypeEnum() == CellType.STRING) {
                     return cellValue.getStringValue();
                 } else {
                     return null;

Modified: poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/util/CellUtil.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/util/CellUtil.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/util/CellUtil.java (original)
+++ poi/branches/hssf_cryptoapi/src/java/org/apache/poi/ss/util/CellUtil.java Mon Sep 19 00:20:44 2016
@@ -405,10 +405,10 @@ public final class CellUtil {
         Map<String, Object> properties = new HashMap<String, Object>();
         put(properties, ALIGNMENT, style.getAlignmentEnum());
         put(properties, VERTICAL_ALIGNMENT, style.getVerticalAlignmentEnum());
-        put(properties, BORDER_BOTTOM, style.getBorderBottom());
-        put(properties, BORDER_LEFT, style.getBorderLeft());
-        put(properties, BORDER_RIGHT, style.getBorderRight());
-        put(properties, BORDER_TOP, style.getBorderTop());
+        put(properties, BORDER_BOTTOM, style.getBorderBottomEnum());
+        put(properties, BORDER_LEFT, style.getBorderLeftEnum());
+        put(properties, BORDER_RIGHT, style.getBorderRightEnum());
+        put(properties, BORDER_TOP, style.getBorderTopEnum());
         put(properties, BOTTOM_BORDER_COLOR, style.getBottomBorderColor());
         put(properties, DATA_FORMAT, style.getDataFormat());
         put(properties, FILL_PATTERN, style.getFillPatternEnum());

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/POIXMLDocument.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/POIXMLDocument.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/POIXMLDocument.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/POIXMLDocument.java Mon Sep 19 00:20:44 2016
@@ -40,6 +40,7 @@ import org.apache.xmlbeans.impl.common.S
 /**
  * This holds the common functionality for all POI OOXML Document classes.
  */
+// TODO: implements AutoCloseable in Java 7+ when POI drops support for Java 6.
 public abstract class POIXMLDocument extends POIXMLDocumentPart implements Closeable {
     public static final String DOCUMENT_CREATOR = "Apache POI";
 
@@ -230,6 +231,11 @@ public abstract class POIXMLDocument ext
      */
     @SuppressWarnings("resource")
     public final void write(OutputStream stream) throws IOException {
+        OPCPackage p = getPackage();
+        if(p == null) {
+            throw new IOException("Cannot write data, document seems to have been closed already");
+        }
+        
         //force all children to commit their changes into the underlying OOXML Package
         // TODO Shouldn't they be committing to the new one instead?
         Set<PackagePart> context = new HashSet<PackagePart>();
@@ -239,10 +245,6 @@ public abstract class POIXMLDocument ext
         //save extended and custom properties
         getProperties().commit();
 
-        OPCPackage p = getPackage();
-        if(p == null) {
-            throw new IOException("Cannot write data, document seems to have been closed already");
-        }
         p.save(stream);
     }
 }

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java Mon Sep 19 00:20:44 2016
@@ -248,9 +248,10 @@ public abstract class OPCPackage impleme
 	 * @throws InvalidFormatException
 	 *             If the specified file doesn't exist, and a parsing error
 	 *             occur.
+	 * @throws InvalidOperationException
 	 */
 	public static OPCPackage open(String path, PackageAccess access)
-			throws InvalidFormatException {
+			throws InvalidFormatException, InvalidOperationException {
 		if (path == null || "".equals(path.trim())) {
 			throw new IllegalArgumentException("'path' must be given");
 		}
@@ -261,8 +262,20 @@ public abstract class OPCPackage impleme
 		}
 
 		OPCPackage pack = new ZipPackage(path, access);
+		boolean success = false;
 		if (pack.partList == null && access != PackageAccess.WRITE) {
-			pack.getParts();
+			try {
+				pack.getParts();
+				success = true;
+			} finally {
+				if (! success) {
+					try {
+						pack.close();
+					} catch (final IOException e) {
+						throw new InvalidOperationException("Could not close OPCPackage while cleaning up", e);
+					}
+				}
+			}
 		}
 		pack.originalPackagePath = new File(path).getAbsolutePath();
 		return pack;

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java Mon Sep 19 00:20:44 2016
@@ -19,6 +19,7 @@ package org.apache.poi.openxml4j.opc;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -52,7 +53,10 @@ import org.apache.poi.util.TempFile;
  * Physical zip package.
  */
 public final class ZipPackage extends OPCPackage {
-    private static POILogger logger = POILogFactory.getLogger(ZipPackage.class);
+    private static final String MIMETYPE = "mimetype";
+    private static final String SETTINGS_XML = "settings.xml";
+
+    private static final POILogger logger = POILogFactory.getLogger(ZipPackage.class);
 
     /**
      * Zip archive, as either a file on disk,
@@ -85,12 +89,22 @@ public final class ZipPackage extends OP
      * @throws IllegalArgumentException
      *             If the specified input stream not an instance of
      *             ZipInputStream.
+     * @throws IOException
+     *            if input stream cannot be opened, read, or closed
      */
     ZipPackage(InputStream in, PackageAccess access) throws IOException {
         super(access);
-        @SuppressWarnings("resource")
         ThresholdInputStream zis = ZipHelper.openZipStream(in);
-        this.zipArchive = new ZipInputStreamZipEntrySource(zis);
+        try {
+            this.zipArchive = new ZipInputStreamZipEntrySource(zis);
+        } catch (final IOException e) {
+            try {
+                zis.close();
+            } catch (final IOException e2) {
+                throw new IOException("Failed to close zip input stream while cleaning up. " + e.getMessage(), e2);
+            }
+            throw new IOException("Failed to read zip entry source", e);
+        }
     }
 
     /**
@@ -100,8 +114,9 @@ public final class ZipPackage extends OP
      *            The path of the file to open or create.
      * @param access
      *            The package access mode.
+     * @throws InvalidOperationException
      */
-    ZipPackage(String path, PackageAccess access) {
+    ZipPackage(String path, PackageAccess access) throws InvalidOperationException {
         this(new File(path), access);
     }
 
@@ -112,9 +127,9 @@ public final class ZipPackage extends OP
      *            The file to open or create.
      * @param access
      *            The package access mode.
+     * @throws InvalidOperationException
      */
-    @SuppressWarnings("resource")
-    ZipPackage(File file, PackageAccess access) {
+    ZipPackage(File file, PackageAccess access) throws InvalidOperationException {
         super(access);
 
         ZipEntrySource ze;
@@ -127,35 +142,71 @@ public final class ZipPackage extends OP
                 throw new InvalidOperationException("Can't open the specified file: '" + file + "'", e);
             }
             logger.log(POILogger.ERROR, "Error in zip file "+file+" - falling back to stream processing (i.e. ignoring zip central directory)");
-            // some zips can't be opened via ZipFile in JDK6, as the central directory
-            // contains either non-latin entries or the compression type can't be handled
-            // the workaround is to iterate over the stream and not the directory
-            FileInputStream fis = null;
-            ThresholdInputStream zis = null;
+            ze = openZipEntrySourceStream(file);
+        }
+        this.zipArchive = ze;
+    }
+    
+    private static ZipEntrySource openZipEntrySourceStream(File file) throws InvalidOperationException {
+        final FileInputStream fis;
+        // Acquire a resource that is needed to read the next level of openZipEntrySourceStream
+        try {
+            // open the file input stream
+            fis = new FileInputStream(file);
+        } catch (final FileNotFoundException e) {
+            // If the source cannot be acquired, abort (no resources to free at this level)
+            throw new InvalidOperationException("Can't open the specified file input stream from file: '" + file + "'", e);
+        }
+        
+        // If an error occurs while reading the next level of openZipEntrySourceStream, free the acquired resource
+        try {
+            // read from the file input stream
+            return openZipEntrySourceStream(fis);
+        } catch (final Exception e) {
             try {
-                fis = new FileInputStream(file);
-                zis = ZipHelper.openZipStream(fis);
-                ze = new ZipInputStreamZipEntrySource(zis);
-            } catch (IOException e2) {
-                if (zis != null) {
-                    try {
-                        zis.close();
-                    } catch (IOException e3) {
-                        throw new InvalidOperationException("Can't open the specified file: '" + file + "'"+
-                                " and couldn't close the file input stream", e);
-                    }
-                } else if (fis != null) {
-                    try {
-                        fis.close();
-                    } catch (IOException e3) {
-                        throw new InvalidOperationException("Can't open the specified file: '" + file + "'"+
-                                " and couldn't close the file input stream", e);
-                    }
-                }
-                throw new InvalidOperationException("Can't open the specified file: '" + file + "'", e);
+                // abort: close the file input stream
+                fis.close();
+            } catch (final IOException e2) {
+                throw new InvalidOperationException("Could not close the specified file input stream from file: '" + file + "'", e2);
             }
+            throw new InvalidOperationException("Failed to read the file input stream from file: '" + file + "'", e);
+        }
+    }
+    
+    private static ZipEntrySource openZipEntrySourceStream(FileInputStream fis) throws InvalidOperationException {
+        final ThresholdInputStream zis;
+        // Acquire a resource that is needed to read the next level of openZipEntrySourceStream
+        try {
+            // open the zip input stream
+            zis = ZipHelper.openZipStream(fis);
+        } catch (final IOException e) {
+            // If the source cannot be acquired, abort (no resources to free at this level)
+            throw new InvalidOperationException("Could not open the file input stream", e);
+        }
+        
+        // If an error occurs while reading the next level of openZipEntrySourceStream, free the acquired resource
+        try {
+            // read from the zip input stream
+            return openZipEntrySourceStream(zis);
+        } catch (final Exception e) {
+            try {
+                // abort: close the zip input stream
+                zis.close();
+            } catch (final IOException e2) {
+                throw new InvalidOperationException("Failed to read the zip entry source stream and could not close the zip input stream", e2);
+            }
+            throw new InvalidOperationException("Failed to read the zip entry source stream", e);
+        }
+    }
+    
+    private static ZipEntrySource openZipEntrySourceStream(ThresholdInputStream zis) throws InvalidOperationException {
+        // Acquire the final level resource. If this is acquired successfully, the zip package was read successfully from the input stream
+        try {
+            // open the zip entry source stream
+            return new ZipInputStreamZipEntrySource(zis);
+        } catch (IOException e) {
+            throw new InvalidOperationException("Could not open the specified zip entry source stream", e);
         }
-        this.zipArchive = ze;
     }
 
     /**
@@ -206,7 +257,7 @@ public final class ZipPackage extends OP
                     this.contentTypeManager = new ZipContentTypeManager(
                             getZipArchive().getInputStream(entry), this);
                 } catch (IOException e) {
-                    throw new InvalidFormatException(e.getMessage());
+                    throw new InvalidFormatException(e.getMessage(), e);
                 }
                 break;
             }
@@ -220,11 +271,12 @@ public final class ZipPackage extends OP
             boolean hasSettingsXML = false;
             entries = this.zipArchive.getEntries();
             while (entries.hasMoreElements()) {
-                ZipEntry entry = entries.nextElement();
-                if (entry.getName().equals("mimetype")) {
+                final ZipEntry entry = entries.nextElement();
+                final String name = entry.getName();
+                if (MIMETYPE.equals(name)) {
                     hasMimetype = true;
                 }
-                if (entry.getName().equals("settings.xml")) {
+                if (SETTINGS_XML.equals(name)) {
                     hasSettingsXML = true;
                 }
                 numEntries++;
@@ -259,10 +311,10 @@ public final class ZipPackage extends OP
             String contentType = contentTypeManager.getContentType(partName);
             if (contentType != null && contentType.equals(ContentTypes.RELATIONSHIPS_PART)) {
                 try {
-                    partList.put(partName, new ZipPackagePart(this, entry,
-                                                              partName, contentType));
+                    PackagePart part = new ZipPackagePart(this, entry, partName, contentType);
+                    partList.put(partName, part);
                 } catch (InvalidOperationException e) {
-                    throw new InvalidFormatException(e.getMessage());
+                    throw new InvalidFormatException(e.getMessage(), e);
                 }
             }
         }
@@ -274,17 +326,16 @@ public final class ZipPackage extends OP
             PackagePartName partName = buildPartName(entry);
             if(partName == null) continue;
 
-            String contentType = contentTypeManager
-                    .getContentType(partName);
+            String contentType = contentTypeManager.getContentType(partName);
             if (contentType != null && contentType.equals(ContentTypes.RELATIONSHIPS_PART)) {
                 // Already handled
             }
             else if (contentType != null) {
                 try {
-                    partList.put(partName, new ZipPackagePart(this, entry,
-                            partName, contentType));
+                    PackagePart part = new ZipPackagePart(this, entry, partName, contentType);
+                    partList.put(partName, part);
                 } catch (InvalidOperationException e) {
-                    throw new InvalidFormatException(e.getMessage());
+                    throw new InvalidFormatException(e.getMessage(), e);
                 }
             } else {
                 throw new InvalidFormatException(
@@ -392,20 +443,22 @@ public final class ZipPackage extends OP
 				// Save the final package to a temporary file
 				try {
 					save(tempFile);
-					
-					// Close the current zip file, so we can
-					//  overwrite it on all platforms
-					this.zipArchive.close();
-					// Copy the new file over the old one
-					FileHelper.copyFile(tempFile, targetFile);
 				} finally {
-					// Either the save operation succeed or not, we delete the
-					// temporary file
-					if (!tempFile.delete()) {
-						logger
-								.log(POILogger.WARN,"The temporary file: '"
-										+ targetFile.getAbsolutePath()
-										+ "' cannot be deleted ! Make sure that no other application use it.");
+					try {
+						// Close the current zip file, so we can
+						//  overwrite it on all platforms
+						this.zipArchive.close();
+						// Copy the new file over the old one
+						FileHelper.copyFile(tempFile, targetFile);
+					} finally {
+						// Either the save operation succeed or not, we delete the
+						// temporary file
+						if (!tempFile.delete()) {
+							logger
+									.log(POILogger.WARN,"The temporary file: '"
+											+ targetFile.getAbsolutePath()
+											+ "' cannot be deleted ! Make sure that no other application use it.");
+						}
 					}
 				}
 			} else {

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java Mon Sep 19 00:20:44 2016
@@ -19,6 +19,7 @@ package org.apache.poi.openxml4j.opc.int
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PushbackInputStream;
@@ -239,10 +240,15 @@ public final class ZipHelper {
      * @param file
      *            The file to open.
      * @return The zip archive freshly open.
+     * @throws IOException if the zip file cannot be opened or closed to read the header signature
+     * @throws NotOfficeXmlFileException if stream does not start with zip header signature
      */
-    public static ZipFile openZipFile(File file) throws IOException {
+    public static ZipFile openZipFile(File file) throws IOException, NotOfficeXmlFileException {
         if (!file.exists()) {
-            return null;
+            throw new FileNotFoundException("File does not exist");
+        }
+        if (file.isDirectory()) {
+            throw new IOException("File is a directory");
         }
         
         // Peek at the first few bytes to sanity check

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipEntrySource.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipEntrySource.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipEntrySource.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipEntrySource.java Mon Sep 19 00:20:44 2016
@@ -45,4 +45,9 @@ public interface ZipEntrySource {
 	 *  resources may be freed
 	 */
 	public void close() throws IOException;
+	
+	/**
+	 * Has close been called already?
+	 */
+	public boolean isClosed();
 }

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipFileZipEntrySource.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipFileZipEntrySource.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipFileZipEntrySource.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipFileZipEntrySource.java Mon Sep 19 00:20:44 2016
@@ -39,6 +39,9 @@ public class ZipFileZipEntrySource imple
       }
       zipArchive = null;
    }
+   public boolean isClosed() {
+       return (zipArchive == null);
+   }
 
    public Enumeration<? extends ZipEntry> getEntries() {
       if (zipArchive == null)

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java Mon Sep 19 00:20:44 2016
@@ -76,6 +76,9 @@ public class ZipInputStreamZipEntrySourc
 		// Free the memory
 		zipEntries = null;
 	}
+	public boolean isClosed() {
+	    return (zipEntries == null);
+	}
 	
 	/**
 	 * Why oh why oh why are Iterator and Enumeration

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipSecureFile.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipSecureFile.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipSecureFile.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/openxml4j/util/ZipSecureFile.java Mon Sep 19 00:20:44 2016
@@ -134,15 +134,15 @@ public class ZipSecureFile extends ZipFi
         return MAX_TEXT_SIZE;
     }
 
-    public ZipSecureFile(File file, int mode) throws IOException {
+    public ZipSecureFile(File file, int mode) throws ZipException, IOException {
         super(file, mode);
     }
 
-    public ZipSecureFile(File file) throws IOException {
+    public ZipSecureFile(File file) throws ZipException, IOException {
         super(file);
     }
 
-    public ZipSecureFile(String name) throws IOException {
+    public ZipSecureFile(String name) throws ZipException, IOException {
         super(name);
     }
 

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java Mon Sep 19 00:20:44 2016
@@ -471,6 +471,7 @@ implements SlideShow<XSLFShape,XSLFTextP
      * @param format              The format of the picture
      *
      * @return the picture data
+     * @since 3.15 beta 2
      */
     @Override
     public XSLFPictureData addPicture(InputStream is, PictureType format) throws IOException
@@ -486,6 +487,7 @@ implements SlideShow<XSLFShape,XSLFTextP
      * @param format           The format of the picture.
      *
      * @return the picture data
+     * @since 3.15 beta 2
      */
     @Override
     public XSLFPictureData addPicture(File pict, PictureType format) throws IOException
@@ -507,6 +509,7 @@ implements SlideShow<XSLFShape,XSLFTextP
      * 
      * @param pictureData The picture data to find in the SlideShow
      * @return {@code null} if picture data is not found in this slideshow
+     * @since 3.15 beta 2
      */
     @Override
     public XSLFPictureData findPictureData(byte[] pictureData) {

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFHyperlink.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFHyperlink.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFHyperlink.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFHyperlink.java Mon Sep 19 00:20:44 2016
@@ -69,6 +69,10 @@ public class XSLFHyperlink implements Hy
         _link.setTooltip(label);
     }
 
+    /* (non-Javadoc)
+     * @deprecated POI 3.15. Use {@link #getTypeEnum()} instead.
+     * Will return a HyperlinkType enum in the future
+     */
     @Override
     public int getType() {
         return getTypeEnum().getCode();

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableRow.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableRow.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableRow.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableRow.java Mon Sep 19 00:20:44 2016
@@ -32,9 +32,9 @@ import org.openxmlformats.schemas.drawin
  * Represents a table in a .pptx presentation
  */
 public class XSLFTableRow implements Iterable<XSLFTableCell> {
-    private CTTableRow _row;
-    private List<XSLFTableCell> _cells;
-    private XSLFTable _table;
+    private final CTTableRow _row;
+    private final List<XSLFTableCell> _cells;
+    private final XSLFTable _table;
 
     /*package*/ XSLFTableRow(CTTableRow row, XSLFTable table){
         _row = row;
@@ -78,6 +78,29 @@ public class XSLFTableRow implements Ite
         _table.updateRowColIndexes();
         return cell;
     }
+    
+    /**
+     * Merge cells of a table row, inclusive.
+     * Indices are 0-based.
+     *
+     * @param firstCol 0-based index of first column to merge, inclusive
+     * @param lastCol 0-based index of last column to merge, inclusive
+     */
+    public void mergeCells(int firstCol, int lastCol)
+    {
+        if (firstCol >= lastCol) {
+            throw new IllegalArgumentException(
+                "Cannot merge, first column >= last column : "
+                + firstCol + " >= " + lastCol
+            );
+        }
+
+        final int colSpan = (lastCol - firstCol) + 1;
 
+        _cells.get(firstCol).setGridSpan(colSpan);
+        for (final XSLFTableCell cell : _cells.subList(firstCol+1, lastCol+1)) {
+            cell.setHMerge(true);
+        }
+    }
 
 }

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java Mon Sep 19 00:20:44 2016
@@ -43,6 +43,7 @@ import org.apache.poi.util.LocaleUtil;
 import org.apache.poi.util.NotImplemented;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
+import org.apache.poi.util.Removal;
 import org.apache.poi.xssf.usermodel.XSSFHyperlink;
 import org.apache.poi.xssf.usermodel.XSSFRichTextString;
 
@@ -61,6 +62,8 @@ public class SXSSFCell implements Cell {
      * @deprecated POI 3.15 beta 3.
      * Will be deleted when we make the CellType enum transition. See bug 59791.
      */
+    @Removal(version="3.17")
+    @Deprecated
     public SXSSFCell(SXSSFRow row, int cellType)
     {
         this(row, CellType.forInt((cellType)));

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java Mon Sep 19 00:20:44 2016
@@ -26,6 +26,7 @@ import org.apache.poi.ss.usermodel.Hyper
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
+import org.apache.poi.util.Removal;
 import org.apache.poi.xssf.usermodel.XSSFCreationHelper;
 import org.apache.poi.xssf.usermodel.XSSFRichTextString;
 
@@ -72,6 +73,7 @@ public class SXSSFCreationHelper impleme
      * @deprecated POI 3.15 beta 3. Use {@link #createHyperlink(HyperlinkType)} instead.
      */
     @Deprecated
+    @Removal(version="3.17")
     @Override
     public Hyperlink createHyperlink(int type) {
         return helper.createHyperlink(type);

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFFormulaEvaluator.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFFormulaEvaluator.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFFormulaEvaluator.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFFormulaEvaluator.java Mon Sep 19 00:20:44 2016
@@ -72,24 +72,9 @@ public final class SXSSFFormulaEvaluator
         return new SXSSFEvaluationCell((SXSSFCell)cell);
     }
     
-    /**
-     * If cell contains formula, it evaluates the formula, and
-     *  puts the formula result back into the cell, in place
-     *  of the old formula.
-     * Else if cell does not contain formula, this method leaves
-     *  the cell unchanged.
-     * Note that the same instance of SXSSFCell is returned to
-     * allow chained calls like:
-     * <pre>
-     * int evaluatedCellType = evaluator.evaluateInCell(cell).getCellType();
-     * </pre>
-     * Be aware that your cell value will be changed to hold the
-     *  result of the formula. If you simply want the formula
-     *  value computed for you, use {@link #evaluateFormulaCellEnum(org.apache.poi.ss.usermodel.Cell)} }
-     */
+    @Override
     public SXSSFCell evaluateInCell(Cell cell) {
-        doEvaluateInCell(cell);
-        return (SXSSFCell)cell;
+        return (SXSSFCell) super.evaluateInCell(cell);
     }
     
     /**

Modified: poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java
URL: http://svn.apache.org/viewvc/poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java?rev=1761376&r1=1761375&r2=1761376&view=diff
==============================================================================
--- poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java (original)
+++ poi/branches/hssf_cryptoapi/src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java Mon Sep 19 00:20:44 2016
@@ -28,7 +28,7 @@ import org.apache.poi.ss.formula.eval.Va
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.ss.usermodel.CellValue;
-import org.apache.poi.util.Internal;
+import org.apache.poi.ss.usermodel.RichTextString;
 
 /**
  * Internal POI use only - parent of XSSF and SXSSF formula evaluators
@@ -37,6 +37,10 @@ public abstract class BaseXSSFFormulaEva
     protected BaseXSSFFormulaEvaluator(WorkbookEvaluator bookEvaluator) {
         super(bookEvaluator);
     }
+    @Override
+    protected RichTextString createRichTextString(String str) {
+        return new XSSFRichTextString(str);
+    }
 
     public void notifySetFormula(Cell cell) {
         _bookEvaluator.notifyUpdateCell(new XSSFEvaluationCell((XSSFCell)cell));
@@ -49,78 +53,6 @@ public abstract class BaseXSSFFormulaEva
     }
 
     /**
-     * If cell contains formula, it evaluates the formula,
-     *  and saves the result of the formula. The cell
-     *  remains as a formula cell.
-     * Else if cell does not contain formula, this method leaves
-     *  the cell unchanged.
-     * Note that the type of the formula result is returned,
-     *  so you know what kind of value is also stored with
-     *  the formula.
-     * <pre>
-     * CellType evaluatedCellType = evaluator.evaluateFormulaCellEnum(cell);
-     * </pre>
-     * Be aware that your cell will hold both the formula,
-     *  and the result. If you want the cell replaced with
-     *  the result of the formula, use {@link #evaluate(org.apache.poi.ss.usermodel.Cell)} }
-     * @param cell The cell to evaluate
-     * @return The type of the formula result (the cell's type remains as CellType.FORMULA however)
-     *         If cell is not a formula cell, returns {@link CellType#_NONE} rather than throwing an exception.
-     * @since POI 3.15 beta 3
-     * @deprecated POI 3.15 beta 3. Will be deleted when we make the CellType enum transition. See bug 59791.
-     */
-    @Internal(since="POI 3.15 beta 3")
-    public CellType evaluateFormulaCellEnum(Cell cell) {
-        if (cell == null || cell.getCellTypeEnum() != CellType.FORMULA) {
-            return CellType._NONE;
-        }
-        CellValue cv = evaluateFormulaCellValue(cell);
-        // cell remains a formula cell, but the cached value is changed
-        setCellValue(cell, cv);
-        return cv.getCellType();
-    }
-
-    /**
-     * If cell contains formula, it evaluates the formula, and
-     *  puts the formula result back into the cell, in place
-     *  of the old formula.
-     * Else if cell does not contain formula, this method leaves
-     *  the cell unchanged.
-     */
-    protected void doEvaluateInCell(Cell cell) {
-        if (cell == null) return;
-        if (cell.getCellTypeEnum() == CellType.FORMULA) {
-            CellValue cv = evaluateFormulaCellValue(cell);
-            setCellType(cell, cv); // cell will no longer be a formula cell
-            setCellValue(cell, cv);
-        }
-    }
-
-    private static void setCellValue(Cell cell, CellValue cv) {
-        CellType cellType = cv.getCellType();
-        switch (cellType) {
-            case BOOLEAN:
-                cell.setCellValue(cv.getBooleanValue());
-                break;
-            case ERROR:
-                cell.setCellErrorValue(cv.getErrorValue());
-                break;
-            case NUMERIC:
-                cell.setCellValue(cv.getNumberValue());
-                break;
-            case STRING:
-                cell.setCellValue(new XSSFRichTextString(cv.getStringValue()));
-                break;
-            case BLANK:
-                // never happens - blanks eventually get translated to zero
-            case FORMULA:
-                // this will never happen, we have already evaluated the formula
-            default:
-                throw new IllegalStateException("Unexpected cell value type (" + cellType + ")");
-        }
-    }
-
-    /**
      * Turns a XSSFCell / SXSSFCell into a XSSFEvaluationCell
      */
     protected abstract EvaluationCell toEvaluationCell(Cell cell);




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


Mime
View raw message