Execute template self and return how many characters it wrote to out. @return the number of characters written to out
(STWriter out, InstanceScope scope)
| 149 | */ |
| 150 | |
| 151 | public int exec(STWriter out, InstanceScope scope) { |
| 152 | final ST self = scope.st; |
| 153 | if ( trace ) System.out.println("exec("+self.getName()+")"); |
| 154 | try { |
| 155 | setDefaultArguments(out, scope); |
| 156 | return _exec(out, scope); |
| 157 | } |
| 158 | catch (Exception e) { |
| 159 | StringWriter sw = new StringWriter(); |
| 160 | PrintWriter pw = new PrintWriter(sw); |
| 161 | e.printStackTrace(pw); |
| 162 | pw.flush(); |
| 163 | errMgr.runTimeError(this, |
| 164 | scope, |
| 165 | ErrorType.INTERNAL_ERROR, |
| 166 | "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