Execute template self and return how many characters it wrote to out. @return the number of characters written to out
(STWriter out, InstanceScope scope)
| 152 | */ |
| 153 | |
| 154 | public int exec(STWriter out, InstanceScope scope) { |
| 155 | final ST self = scope.st; |
| 156 | if ( trace ) System.out.println("exec("+self.getName()+")"); |
| 157 | try { |
| 158 | setDefaultArguments(out, scope); |
| 159 | return _exec(out, scope); |
| 160 | } |
| 161 | catch (Exception e) { |
| 162 | StringWriter sw = new StringWriter(); |
| 163 | PrintWriter pw = new PrintWriter(sw); |
| 164 | e.printStackTrace(pw); |
| 165 | pw.flush(); |
| 166 | errMgr.runTimeError(this, scope, ErrorType.INTERNAL_ERROR, "internal error: "+sw.toString()); |
| 167 | return 0; |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | protected int _exec(STWriter out, InstanceScope scope) { |
| 172 | final ST self = scope.st; |
no test coverage detected