aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew C. Oliver <acoliver@apache.org>2002-07-06 18:45:16 +0000
committerAndrew C. Oliver <acoliver@apache.org>2002-07-06 18:45:16 +0000
commitca57c7566960d1f8906de58f69e91aa5fb92ea6f (patch)
tree5965b29e932e49de7a7fa688e39e13612cf0e529
parentff19b52f7d5f33077a376c8e55099f11f0c430c7 (diff)
downloadpoi-ca57c7566960d1f8906de58f69e91aa5fb92ea6f.tar.gz
poi-ca57c7566960d1f8906de58f69e91aa5fb92ea6f.zip
removed thread safety stuff. We still need to revisit how this is being
done. I dislike "currentBook" and would prefer some kind of context mechanism or directly passing the book to the PTGs etc. Perhaps a "PTGWorkbookContextInterface" that defines set/getWorkbook etc etc. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352760 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/poi/hssf/model/Workbook.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/formula/FormulaParser.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java2
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFCell.java8
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFName.java4
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;