diff options
6 files changed, 9 insertions, 11 deletions
diff --git a/src/java/org/apache/poi/hssf/model/Workbook.java b/src/java/org/apache/poi/hssf/model/Workbook.java index 8ae0822a54..b0ddec207b 100644 --- a/src/java/org/apache/poi/hssf/model/Workbook.java +++ b/src/java/org/apache/poi/hssf/model/Workbook.java @@ -88,7 +88,7 @@ import org.apache.poi.util.POILogFactory; public class Workbook { private static final int DEBUG = POILogger.DEBUG; - public static ThreadLocal currentBook = new ThreadLocal(); + public static Workbook currentBook = null; /** * constant used to set the "codepage" wherever "codepage" is set in records diff --git a/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java b/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java index c68ab72643..b310a0531c 100644 --- a/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java @@ -289,7 +289,7 @@ public class Area3DPtg extends Ptg public String toFormulaString() { StringBuffer retval = new StringBuffer(); - Object book = Workbook.currentBook.get(); + Object book = Workbook.currentBook; if (book != null) { retval.append(((Workbook) book).findSheetNameFromExternSheet(this.field_1_index_extern_sheet)); retval.append('!'); diff --git a/src/java/org/apache/poi/hssf/record/formula/FormulaParser.java b/src/java/org/apache/poi/hssf/record/formula/FormulaParser.java index 49aae2d32b..e8f5d848fd 100644 --- a/src/java/org/apache/poi/hssf/record/formula/FormulaParser.java +++ b/src/java/org/apache/poi/hssf/record/formula/FormulaParser.java @@ -107,8 +107,6 @@ public class FormulaParser { * later call the parse() method to return ptg list in rpn order * then call the getRPNPtg() to retrive the parse results * This class is recommended only for single threaded use - * The parse and getPRNPtg are internally synchronized for safety, thus - * while it is safe to use in a multithreaded environment, you will get long lock waits. */ public FormulaParser(String formula, Workbook book){ formulaString = formula; diff --git a/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java b/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java index b8db3ba666..e251cc2cbc 100644 --- a/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java @@ -192,7 +192,7 @@ public class Ref3DPtg extends Ptg { public String toFormulaString() { StringBuffer retval = new StringBuffer(); - Object book = Workbook.currentBook.get(); + Object book = Workbook.currentBook; if (book != null) { retval.append(((Workbook) book).findSheetNameFromExternSheet(this.field_1_index_extern_sheet)); retval.append('!'); diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java index e19e54d002..1ccb1ca462 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java @@ -693,7 +693,7 @@ public class HSSFCell } public void setCellFormula(String formula) { - Workbook.currentBook.set(book); + Workbook.currentBook=book; if (formula==null) { setCellType(CELL_TYPE_BLANK,false); } else { @@ -712,14 +712,14 @@ public class HSSFCell rec.pushExpressionToken(ptg[ k ]); } rec.setExpressionLength(( short ) size); - Workbook.currentBook.set(null); + Workbook.currentBook = null; } } public String getCellFormula() { - Workbook.currentBook.set(book); + Workbook.currentBook=book; String retval = FormulaParser.toFormulaString(((FormulaRecord)record).getParsedExpression()); - Workbook.currentBook.set(null); + Workbook.currentBook=null; return retval; } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFName.java b/src/java/org/apache/poi/hssf/usermodel/HSSFName.java index 1ca4acfe12..f2f284732f 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFName.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFName.java @@ -257,14 +257,14 @@ public class HSSFName { */ public String getReference() { - Workbook.currentBook.set(book); + Workbook.currentBook=book; String result; result = name.getAreaReference(); - Workbook.currentBook.set(null); + Workbook.currentBook=null; return result; |