When this node was created from a JSP page in JSP syntax, its text was stored as a String in the "text" field, whereas when this node was created from a JSP document, its text was stored as one or more TemplateText nodes in its body. This method handles either case. @return The text string
()
| 953 | * @return The text string |
| 954 | */ |
| 955 | @Override |
| 956 | public String getText() { |
| 957 | String ret = text; |
| 958 | if (ret == null) { |
| 959 | if (body != null) { |
| 960 | StringBuilder buf = new StringBuilder(); |
| 961 | for (int i = 0; i < body.size(); i++) { |
| 962 | buf.append(body.getNode(i).getText()); |
| 963 | } |
| 964 | ret = buf.toString(); |
| 965 | } else { |
| 966 | // Nulls cause NPEs further down the line |
| 967 | ret = ""; |
| 968 | } |
| 969 | } |
| 970 | return ret; |
| 971 | } |
| 972 | |
| 973 | /** |
| 974 | * For the same reason as above, the source line information in the contained TemplateText node should be used. |