poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1748313 - in /poi/trunk/src: examples/src/org/apache/poi/ss/examples/formula/ java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/ss/formula/atp/ java/org/apache/poi/ss/formula/udf/ ooxml/java/org/apache/poi/xssf/usermodel/ testcases/o...
Date Mon, 13 Jun 2016 21:18:50 GMT
Author: kiwiwings
Date: Mon Jun 13 21:18:50 2016
New Revision: 1748313

URL: http://svn.apache.org/viewvc?rev=1748313&view=rev
Log:
reverted changes of r1747942 and deprecated instead

Modified:
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/formula/SettingExternalFunction.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
    poi/trunk/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java
    poi/trunk/src/java/org/apache/poi/ss/formula/udf/AggregatingUDFFinder.java
    poi/trunk/src/java/org/apache/poi/ss/formula/udf/DefaultUDFFinder.java
    poi/trunk/src/java/org/apache/poi/ss/formula/udf/UDFFinder.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
    poi/trunk/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/formula/SettingExternalFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/formula/SettingExternalFunction.java?rev=1748313&r1=1748312&r2=1748313&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/formula/SettingExternalFunction.java
(original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/formula/SettingExternalFunction.java
Mon Jun 13 21:18:50 2016
@@ -48,7 +48,7 @@ public class SettingExternalFunction {
     /**
      * wrap external functions in a plugin
      */
-    public static class BloombergAddIn extends UDFFinder {
+    public static class BloombergAddIn implements UDFFinder {
         private final Map<String, FreeRefFunction> _functionsByName;
 
         public BloombergAddIn() {
@@ -89,7 +89,6 @@ public class SettingExternalFunction {
         wb.write(out);
         out.close();
 
-        wb.close();
     }
 
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?rev=1748313&r1=1748312&r2=1748313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java Mon Jun 13 21:18:50
2016
@@ -31,6 +31,7 @@ import java.io.PrintWriter;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -38,7 +39,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.regex.Pattern;
-import java.util.Collections;
 
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.poi.EncryptedDocumentException;
@@ -181,7 +181,7 @@ public final class HSSFWorkbook extends
      * The locator of user-defined functions.
      * By default includes functions from the Excel Analysis Toolpack
      */
-    private UDFFinder _udfFinder = new IndexedUDFFinder(UDFFinder.getDefault());
+    private UDFFinder _udfFinder = new IndexedUDFFinder(AggregatingUDFFinder.DEFAULT);
 
     public static HSSFWorkbook create(InternalWorkbook book) {
     	return new HSSFWorkbook(book);

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java?rev=1748313&r1=1748312&r2=1748313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java Mon Jun 13 21:18:50
2016
@@ -44,7 +44,7 @@ import org.apache.poi.ss.formula.udf.UDF
 /**
  * Analysis Toolpack Function Definitions
  */
-public final class AnalysisToolPak extends UDFFinder {
+public final class AnalysisToolPak implements UDFFinder {
 
     public static final UDFFinder instance = new AnalysisToolPak();
 

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/udf/AggregatingUDFFinder.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/udf/AggregatingUDFFinder.java?rev=1748313&r1=1748312&r2=1748313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/udf/AggregatingUDFFinder.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/udf/AggregatingUDFFinder.java Mon Jun 13
21:18:50 2016
@@ -17,6 +17,7 @@
 
 package org.apache.poi.ss.formula.udf;
 
+import org.apache.poi.ss.formula.atp.AnalysisToolPak;
 import org.apache.poi.ss.formula.functions.FreeRefFunction;
 
 import java.util.ArrayList;
@@ -25,8 +26,15 @@ import java.util.Collection;
 
 /**
  * Collects add-in libraries and VB macro functions together into one UDF finder
+ *
+ * @author PUdalau
  */
-public class AggregatingUDFFinder extends UDFFinder {
+public class AggregatingUDFFinder implements UDFFinder {
+    
+    /**
+     * Default UDFFinder implementation
+     */ 
+    public static final UDFFinder DEFAULT = new AggregatingUDFFinder(AnalysisToolPak.instance);
 
     private final Collection<UDFFinder> _usedToolPacks;
 

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/udf/DefaultUDFFinder.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/udf/DefaultUDFFinder.java?rev=1748313&r1=1748312&r2=1748313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/udf/DefaultUDFFinder.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/udf/DefaultUDFFinder.java Mon Jun 13 21:18:50
2016
@@ -25,8 +25,10 @@ import org.apache.poi.ss.formula.functio
 
 /**
  * Default UDF finder - for adding your own user defined functions.
+ *
+ * @author PUdalau
  */
-public final class DefaultUDFFinder extends UDFFinder {
+public final class DefaultUDFFinder implements UDFFinder {
     private final Map<String, FreeRefFunction> _functionsByName;
 
     public DefaultUDFFinder(String[] functionNames, FreeRefFunction[] functionImpls) {

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/udf/UDFFinder.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/udf/UDFFinder.java?rev=1748313&r1=1748312&r2=1748313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/udf/UDFFinder.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/udf/UDFFinder.java Mon Jun 13 21:18:50 2016
@@ -21,12 +21,18 @@ import org.apache.poi.ss.formula.atp.Ana
 import org.apache.poi.ss.formula.functions.FreeRefFunction;
 
 /**
- * Common abstract class for "Add-in" libraries and user defined function libraries.
+ * Common interface for "Add-in" libraries and user defined function libraries.
  */
-public abstract class UDFFinder {
-    public static UDFFinder getDefault() {
-        return new AggregatingUDFFinder(AnalysisToolPak.instance);
-    }
+public interface UDFFinder {
+    // FIXME: Findbugs error: IC_SUPERCLASS_USES_SUBCLASS_DURING_INITIALIZATION
+    /**
+     * Default UDFFinder implementation
+     * 
+     * @deprecated use AggregatingUDFFinder.DEFAULT instead, deprecated in POI 3.15,
+     *     scheduled for removable in POI 3.17 
+     */
+    @Deprecated
+    public static final UDFFinder DEFAULT = new AggregatingUDFFinder(AnalysisToolPak.instance);
 
     /**
      * Returns executor by specified name. Returns <code>null</code> if the function
name is unknown.
@@ -34,5 +40,5 @@ public abstract class UDFFinder {
      * @param name Name of function.
      * @return Function executor.
      */
-    public abstract FreeRefFunction findFunction(String name);
+    FreeRefFunction findFunction(String name);
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java?rev=1748313&r1=1748312&r2=1748313&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java Mon Jun 13 21:18:50
2016
@@ -33,7 +33,6 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.regex.Pattern;
@@ -57,6 +56,7 @@ import org.apache.poi.openxml4j.opc.Targ
 import org.apache.poi.poifs.crypt.HashAlgorithm;
 import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.formula.SheetNameFormatter;
+import org.apache.poi.ss.formula.udf.AggregatingUDFFinder;
 import org.apache.poi.ss.formula.udf.IndexedUDFFinder;
 import org.apache.poi.ss.formula.udf.UDFFinder;
 import org.apache.poi.ss.usermodel.Row;
@@ -160,7 +160,7 @@ public class XSSFWorkbook extends POIXML
      * The locator of user-defined functions.
      * By default includes functions from the Excel Analysis Toolpack
      */
-    private IndexedUDFFinder _udfFinder = new IndexedUDFFinder(UDFFinder.getDefault());
+    private IndexedUDFFinder _udfFinder = new IndexedUDFFinder(AggregatingUDFFinder.DEFAULT);
 
     /**
      * TODO

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java?rev=1748313&r1=1748312&r2=1748313&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java Mon Jun 13 21:18:50
2016
@@ -106,7 +106,7 @@ public final class TestWorkbook {
     public void testAddNameX() throws IOException {
         HSSFWorkbook hwb = new HSSFWorkbook();
         InternalWorkbook wb = TestHSSFWorkbook.getInternalWorkbook(hwb);
-        assertNotNull(wb.getNameXPtg("ISODD", UDFFinder.getDefault()));
+        assertNotNull(wb.getNameXPtg("ISODD", AggregatingUDFFinder.DEFAULT));
 
         FreeRefFunction NotImplemented = new FreeRefFunction() {
             public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {



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


Mime
View raw message