Skip to content
Permalink
Browse files
JEXL-362: avoid 0 positions in JexlInfo
  • Loading branch information
henrib committed Mar 14, 2022
1 parent 9086824 commit 38e1e99a685e8c91fc1acf881fcfd713fa6a9754
Showing 1 changed file with 9 additions and 15 deletions.
@@ -72,8 +72,8 @@ public interface Detail {
*/
public JexlInfo(final String source, final int l, final int c) {
name = source;
line = l;
column = c;
line = l <= 0? 1: l;
column = c <= 0? 1 : c;
}

/**
@@ -99,8 +99,8 @@ public JexlInfo() {
}
}
this.name = se != null ? se.getClassName() + "." + se.getMethodName() + ":" + se.getLineNumber() : "?";
this.line = 0;
this.column = 0;
this.line = 1;
this.column = 1;
}

/**
@@ -120,9 +120,7 @@ public JexlInfo at(final int l, final int c) {
* @param copy the instance to copy
*/
protected JexlInfo(final JexlInfo copy) {
name = copy.getName();
line = copy.getLine();
column = copy.getColumn();
this(copy.getName(), copy.getLine(), copy.getColumn());
}

/**
@@ -133,14 +131,10 @@ protected JexlInfo(final JexlInfo copy) {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(name != null? name : "");
if (line > 0) {
sb.append("@");
sb.append(line);
if (column > 0) {
sb.append(":");
sb.append(column);
}
}
sb.append("@");
sb.append(line);
sb.append(":");
sb.append(column);
final JexlInfo.Detail dbg = getDetail();
if (dbg!= null) {
sb.append("![");

0 comments on commit 38e1e99

Please sign in to comment.