Executes the compilation.
()
| 1498 | * Executes the compilation. |
| 1499 | */ |
| 1500 | @Override |
| 1501 | public void execute() { |
| 1502 | if (log.isDebugEnabled()) { |
| 1503 | log.debug(Localizer.getMessage("jspc.start", Integer.toString(pages.size()))); |
| 1504 | } |
| 1505 | |
| 1506 | try { |
| 1507 | if (uriRoot == null) { |
| 1508 | if (pages.isEmpty()) { |
| 1509 | throw new JasperException(Localizer.getMessage("jsp.error.jspc.missingTarget")); |
| 1510 | } |
| 1511 | String firstJsp = pages.get(0); |
| 1512 | File firstJspF = new File(firstJsp); |
| 1513 | if (!firstJspF.exists()) { |
| 1514 | throw new JasperException(Localizer.getMessage("jspc.error.fileDoesNotExist", firstJsp)); |
| 1515 | } |
| 1516 | locateUriRoot(firstJspF); |
| 1517 | } |
| 1518 | |
| 1519 | if (uriRoot == null) { |
| 1520 | throw new JasperException(Localizer.getMessage("jsp.error.jspc.no_uriroot")); |
| 1521 | } |
| 1522 | |
| 1523 | File uriRootF = new File(uriRoot); |
| 1524 | if (!uriRootF.isDirectory()) { |
| 1525 | throw new JasperException(Localizer.getMessage("jsp.error.jspc.uriroot_not_dir")); |
| 1526 | } |
| 1527 | |
| 1528 | if (loader == null) { |
| 1529 | loader = initClassLoader(); |
| 1530 | } |
| 1531 | if (context == null) { |
| 1532 | initServletContext(loader); |
| 1533 | } |
| 1534 | |
| 1535 | // No explicit pages, we'll process all .jsp in the webapp |
| 1536 | if (pages.isEmpty()) { |
| 1537 | scanFiles(); |
| 1538 | } else { |
| 1539 | // Ensure pages are all relative to the uriRoot. |
| 1540 | // Those that are not will trigger an error later. The error |
| 1541 | // could be detected earlier but isn't to support the use case |
| 1542 | // when failFast is not used. |
| 1543 | for (int i = 0; i < pages.size(); i++) { |
| 1544 | String nextjsp = pages.get(i); |
| 1545 | |
| 1546 | File fjsp = new File(nextjsp); |
| 1547 | if (!fjsp.isAbsolute()) { |
| 1548 | fjsp = new File(uriRootF, nextjsp); |
| 1549 | } |
| 1550 | if (!fjsp.exists()) { |
| 1551 | if (log.isWarnEnabled()) { |
| 1552 | log.warn(Localizer.getMessage("jspc.error.fileDoesNotExist", fjsp.toString())); |
| 1553 | } |
| 1554 | continue; |
| 1555 | } |
| 1556 | String s = fjsp.getAbsolutePath(); |
| 1557 | if (s.startsWith(uriRoot)) { |
no test coverage detected