From 063b928e8fc3fbb7aa0bcf174fa59d953fc1adeb Mon Sep 17 00:00:00 2001 From: Jani Laakso Date: Tue, 13 Mar 2007 17:14:00 +0000 Subject: [PATCH] Better exception reporting for first time users on cases where themes or license file is missing or not installed properly. svn changeset:869/svn branch:trunk --- .../toolkit/terminal/web/ApplicationServlet.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java index 4ebb10a480..3974eb98e9 100644 --- a/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java +++ b/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java @@ -314,7 +314,10 @@ public class ApplicationServlet extends HttpServlet implements // Check that at least one themesource was loaded if (this.themeSource.getThemes().size() <= 0) { throw new ServletException( - "No themes found in specified themesources."); + "No themes found in specified themesources. " + + "You can provide themes by e.g. adding " + + "itmill-toolkit-x.y.z-themes.jar " + + "to WEB-INF/lib directory."); } // Initialize the transformer factory, if not initialized @@ -1364,8 +1367,15 @@ public class ApplicationServlet extends HttpServlet implements if (!license.hasBeenRead()) { InputStream lis; try { - lis = getServletContext().getResource( - "/WEB-INF/itmill-toolkit-license.xml").openStream(); + URL url = getServletContext().getResource( + "/WEB-INF/itmill-toolkit-license.xml"); + if (url == null) { + throw new RuntimeException( + "License file could not be read. " + + "You can install it to " + + "WEB-INF/itmill-toolkit-license.xml."); + } + lis = url.openStream(); license.readLicenseFile(lis); } catch (MalformedURLException e) { // This should not happen -- 2.39.5