Skip to content

Commit e671484

Browse files
committed
Issue #1 - Suppressed printing of pointer when there is no text line.
1 parent 93eed1c commit e671484

File tree

1 file changed

+12
-12
lines changed
  • org.modeldriven.alf/src/org/modeldriven/alf/execution

1 file changed

+12
-12
lines changed

org.modeldriven.alf/src/org/modeldriven/alf/execution/AlfBase.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,12 @@ public void printConstraintViolations(Collection<ConstraintViolation> violations
100100
}
101101
int prevLineNum = lineNum;
102102
lineNum = violation.getLine();
103-
this.println("");
104-
line = this.printLine(reader, line, prevLineNum, lineNum);
105-
this.printConstraintViolation(violation);
103+
line = this.getLine(reader, line, prevLineNum, lineNum);
104+
this.printConstraintViolation(line, violation);
106105
}
107106
}
108107

109-
protected String printLine(BufferedReader reader, String prevLine, int prevLineNum, int thisLineNum) {
108+
protected String getLine(BufferedReader reader, String prevLine, int prevLineNum, int thisLineNum) {
110109
String line = prevLine;
111110
if (reader != null) {
112111
try {
@@ -116,22 +115,23 @@ protected String printLine(BufferedReader reader, String prevLine, int prevLineN
116115
}
117116
line = reader.readLine();
118117
}
119-
if (line != null) {
120-
this.println(line);
121-
}
122118
} catch (IOException e) {
123119
line = null;
124120
}
125121
}
126122
return line;
127123
}
128124

129-
protected void printConstraintViolation(ConstraintViolation violation) {
130-
StringBuffer indent = new StringBuffer();
131-
for (int n = violation.getColumn(); n > 1; n--) {
132-
indent.append(" ");
125+
protected void printConstraintViolation(String line, ConstraintViolation violation) {
126+
this.println("");
127+
if (line != null) {
128+
this.println(line);
129+
StringBuffer indent = new StringBuffer();
130+
for (int n = violation.getColumn(); n > 1; n--) {
131+
indent.append(" ");
132+
}
133+
this.println(indent + "^");
133134
}
134-
this.println(indent + "^");
135135
this.println(violation.getErrorMessage());
136136
}
137137

0 commit comments

Comments
 (0)