mirror of https://github.com/apache/poi.git
Improve error message if formula cannot be parsed
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1899075 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
306dc69105
commit
98fbe88d3a
|
@ -97,6 +97,7 @@ import org.apache.poi.util.Internal;
|
||||||
@Internal
|
@Internal
|
||||||
public final class FormulaParser {
|
public final class FormulaParser {
|
||||||
private static final Logger LOGGER = LogManager.getLogger(FormulaParser.class);
|
private static final Logger LOGGER = LogManager.getLogger(FormulaParser.class);
|
||||||
|
|
||||||
private final String _formulaString;
|
private final String _formulaString;
|
||||||
private final int _formulaLength;
|
private final int _formulaLength;
|
||||||
/** points at the next character to be read (after the {@link #look} codepoint) */
|
/** points at the next character to be read (after the {@link #look} codepoint) */
|
||||||
|
@ -681,11 +682,10 @@ public final class FormulaParser {
|
||||||
GetChar();
|
GetChar();
|
||||||
}
|
}
|
||||||
// parse column quantifier
|
// parse column quantifier
|
||||||
String startColumnName;
|
|
||||||
String endColumnName = null;
|
String endColumnName = null;
|
||||||
int nColQuantifiers = 0;
|
int nColQuantifiers = 0;
|
||||||
int savePtr1 = _pointer;
|
int savePtr1 = _pointer;
|
||||||
startColumnName = parseAsColumnQuantifier();
|
String startColumnName = parseAsColumnQuantifier();
|
||||||
if (startColumnName == null) {
|
if (startColumnName == null) {
|
||||||
resetPointer(savePtr1);
|
resetPointer(savePtr1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -799,7 +799,7 @@ public final class FormulaParser {
|
||||||
|
|
||||||
if (nColQuantifiers == 2) {
|
if (nColQuantifiers == 2) {
|
||||||
if (startColumnName == null || endColumnName == null) {
|
if (startColumnName == null || endColumnName == null) {
|
||||||
throw new IllegalStateException("Fatal error");
|
throw new IllegalStateException("Cannot parse column: " + startColumnName + " and " + endColumnName + " with formula " + _formulaString);
|
||||||
}
|
}
|
||||||
int startIdx = tbl.findColumnIndex(startColumnName);
|
int startIdx = tbl.findColumnIndex(startColumnName);
|
||||||
int endIdx = tbl.findColumnIndex(endColumnName);
|
int endIdx = tbl.findColumnIndex(endColumnName);
|
||||||
|
@ -811,7 +811,7 @@ public final class FormulaParser {
|
||||||
|
|
||||||
} else if (nColQuantifiers == 1 && !isThisRow) {
|
} else if (nColQuantifiers == 1 && !isThisRow) {
|
||||||
if (startColumnName == null) {
|
if (startColumnName == null) {
|
||||||
throw new IllegalStateException("Fatal error");
|
throw new IllegalStateException("Cannot parse column: " + startColumnName + " with formula " + _formulaString);
|
||||||
}
|
}
|
||||||
int idx = tbl.findColumnIndex(startColumnName);
|
int idx = tbl.findColumnIndex(startColumnName);
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
|
|
Loading…
Reference in New Issue