diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-10-25 10:11:04 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-10-25 10:11:04 +0000 |
commit | ecdd4fcb5518da487784cd6c664f4d76029e8d52 (patch) | |
tree | f18036445917c2a175f4b195b26fb4732d4b7340 /poi/src | |
parent | 6017327bae3201a96cdbcdc1d809453e9dba8182 (diff) | |
download | poi-ecdd4fcb5518da487784cd6c664f4d76029e8d52.tar.gz poi-ecdd4fcb5518da487784cd6c664f4d76029e8d52.zip |
revert github-267 due to broken tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894550 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src')
4 files changed, 11 insertions, 25 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java index 8be98c5656..94c88219e9 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java @@ -1171,11 +1171,10 @@ public final class FormulaParser { while(!done) { sb.appendCodePoint(look); GetChar(); - switch (look){ - case '\'' : - GetChar(); - case ':' : - done = true; + if(look == '\'') + { + Match('\''); + done = look != '\''; } } @@ -1201,9 +1200,6 @@ public final class FormulaParser { sb.appendCodePoint(look); GetChar(); } - if (look == '\'') { - GetChar(); - } NameIdentifier iden = new NameIdentifier(sb.toString(), false); SkipWhite(); if (look == '!') { @@ -1253,7 +1249,6 @@ public final class FormulaParser { switch(ch) { case '.': // dot is OK case '_': // underscore is OK - case ' ': // space is OK return true; } return false; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExternSheetNameResolver.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExternSheetNameResolver.java index 2a90ae6f44..3a35909cc2 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExternSheetNameResolver.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExternSheetNameResolver.java @@ -44,16 +44,7 @@ final class ExternSheetNameResolver { ExternalSheetRange r = (ExternalSheetRange)externalSheet; if (! r.getFirstSheetName().equals(r.getLastSheetName())) { sb.append(':'); - // quote should appear at the beginning and end. - StringBuilder innerBuilder = new StringBuilder(); - SheetNameFormatter.appendFormat(innerBuilder, r.getLastSheetName()); - char quote = '\''; - if (innerBuilder.charAt(0) == quote){ - sb.insert(0 , quote); - sb.append(innerBuilder.substring(1)); - } else { - sb.append(innerBuilder); - } + SheetNameFormatter.appendFormat(sb, r.getLastSheetName()); } } } else { diff --git a/poi/src/test/java/org/apache/poi/hssf/model/TestFormulaParser.java b/poi/src/test/java/org/apache/poi/hssf/model/TestFormulaParser.java index 0768cd713e..6c55d18224 100644 --- a/poi/src/test/java/org/apache/poi/hssf/model/TestFormulaParser.java +++ b/poi/src/test/java/org/apache/poi/hssf/model/TestFormulaParser.java @@ -535,9 +535,9 @@ final class TestFormulaParser { assertEquals("'Test Sheet'!A1", formula); // Now both - cell.setCellFormula("'Cash_Flow:Test Sheet'!A1"); + cell.setCellFormula("Cash_Flow:'Test Sheet'!A1"); formula = cell.getCellFormula(); - assertEquals("'Cash_Flow:Test Sheet'!A1", formula); + assertEquals("Cash_Flow:'Test Sheet'!A1", formula); // References to a range (area) of cells: @@ -553,9 +553,9 @@ final class TestFormulaParser { assertEquals("'Test Sheet'!A1:B2", formula); // Now both - cell.setCellFormula("'Cash_Flow:Test Sheet'!A1:B2"); + cell.setCellFormula("Cash_Flow:'Test Sheet'!A1:B2"); formula = cell.getCellFormula(); - assertEquals("'Cash_Flow:Test Sheet'!A1:B2", formula); + assertEquals("Cash_Flow:'Test Sheet'!A1:B2", formula); wb.close(); } diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestWorkbook.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestWorkbook.java index 1c952d2a60..eba86eadf3 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestWorkbook.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestWorkbook.java @@ -499,11 +499,11 @@ public abstract class BaseTestWorkbook { /** - * Test to validate that replacement for removed setRepeatingRowsAnsColumns() methods + * Test to validate that replacement for removed setRepeatingRowsAndColumns() methods * is still working correctly */ @Test - void setRepeatingRowsAnsColumns() throws IOException { + void setRepeatingRowsAndColumns() throws IOException { try (Workbook wb = _testDataProvider.createWorkbook()) { CellRangeAddress cra = new CellRangeAddress(0, 3, 0, 0); String expRows = "1:4", expCols = "A:A"; |