Sets the buffer value. @param value The buffer value @param n The node @param err The error dispatcher @throws JasperException if the buffer value is invalid
(String value, Node n, ErrorDispatcher err)
| 607 | * @throws JasperException if the buffer value is invalid |
| 608 | */ |
| 609 | public void setBufferValue(String value, Node n, ErrorDispatcher err) throws JasperException { |
| 610 | |
| 611 | if ("none".equalsIgnoreCase(value)) { |
| 612 | buffer = 0; |
| 613 | } else { |
| 614 | if (value == null || !value.endsWith("kb")) { |
| 615 | if (n == null) { |
| 616 | err.jspError("jsp.error.page.invalid.buffer"); |
| 617 | } else { |
| 618 | err.jspError(n, "jsp.error.page.invalid.buffer"); |
| 619 | } |
| 620 | } |
| 621 | try { |
| 622 | @SuppressWarnings("null") // value can't be null here |
| 623 | int k = Integer.parseInt(value.substring(0, value.length() - 2)); |
| 624 | buffer = k * 1024; |
| 625 | } catch (NumberFormatException e) { |
| 626 | if (n == null) { |
| 627 | err.jspError("jsp.error.page.invalid.buffer"); |
| 628 | } else { |
| 629 | err.jspError(n, "jsp.error.page.invalid.buffer"); |
| 630 | } |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | bufferValue = value; |
| 635 | } |
| 636 | |
| 637 | /** |
| 638 | * Returns the buffer value. |
no test coverage detected