summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-20 14:25:46 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-20 14:26:05 +0300
commite223589aae4ee77043ba156961a663b73ad3d8cb (patch)
treefe0c32155acc63599f9413521828c2a1dbad1ce1
parent2079e8525df2b12aa8f1103755c91ec2ab1fca95 (diff)
downloadvaadin-framework-e223589aae4ee77043ba156961a663b73ad3d8cb.tar.gz
vaadin-framework-e223589aae4ee77043ba156961a663b73ad3d8cb.zip
Remove ApplicationClassException (#9690)
-rw-r--r--server/src/com/vaadin/server/LegacyVaadinPortlet.java3
-rw-r--r--server/src/com/vaadin/server/LegacyVaadinServlet.java3
-rw-r--r--server/src/com/vaadin/server/ServiceException.java8
-rw-r--r--server/src/com/vaadin/server/ServletPortletHelper.java40
-rw-r--r--server/src/com/vaadin/server/VaadinService.java13
5 files changed, 23 insertions, 44 deletions
diff --git a/server/src/com/vaadin/server/LegacyVaadinPortlet.java b/server/src/com/vaadin/server/LegacyVaadinPortlet.java
index ef59615a29..6aa8fb7165 100644
--- a/server/src/com/vaadin/server/LegacyVaadinPortlet.java
+++ b/server/src/com/vaadin/server/LegacyVaadinPortlet.java
@@ -20,7 +20,6 @@ import javax.portlet.PortletException;
import javax.portlet.PortletRequest;
import com.vaadin.LegacyApplication;
-import com.vaadin.server.ServletPortletHelper.ApplicationClassException;
public class LegacyVaadinPortlet extends VaadinPortlet {
@@ -71,7 +70,7 @@ public class LegacyVaadinPortlet extends VaadinPortlet {
try {
return ServletPortletHelper
.getLegacyApplicationClass(getVaadinService());
- } catch (ApplicationClassException e) {
+ } catch (ServiceException e) {
throw new RuntimeException(e);
}
}
diff --git a/server/src/com/vaadin/server/LegacyVaadinServlet.java b/server/src/com/vaadin/server/LegacyVaadinServlet.java
index d9c84309fb..ace29e9e1f 100644
--- a/server/src/com/vaadin/server/LegacyVaadinServlet.java
+++ b/server/src/com/vaadin/server/LegacyVaadinServlet.java
@@ -21,7 +21,6 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import com.vaadin.LegacyApplication;
-import com.vaadin.server.ServletPortletHelper.ApplicationClassException;
public class LegacyVaadinServlet extends VaadinServlet {
@@ -71,7 +70,7 @@ public class LegacyVaadinServlet extends VaadinServlet {
try {
return ServletPortletHelper
.getLegacyApplicationClass(getVaadinService());
- } catch (ApplicationClassException e) {
+ } catch (ServiceException e) {
throw new RuntimeException(e);
}
}
diff --git a/server/src/com/vaadin/server/ServiceException.java b/server/src/com/vaadin/server/ServiceException.java
index 538e8b30ea..ac693e5747 100644
--- a/server/src/com/vaadin/server/ServiceException.java
+++ b/server/src/com/vaadin/server/ServiceException.java
@@ -18,12 +18,16 @@ package com.vaadin.server;
public class ServiceException extends Exception {
- public ServiceException(Exception e) {
- super(e);
+ public ServiceException(Throwable t) {
+ super(t);
}
public ServiceException(String message) {
super(message);
}
+ public ServiceException(String message, Throwable t) {
+ super(message, t);
+ }
+
}
diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java
index 7f4a05deef..3f2674392c 100644
--- a/server/src/com/vaadin/server/ServletPortletHelper.java
+++ b/server/src/com/vaadin/server/ServletPortletHelper.java
@@ -30,26 +30,15 @@ class ServletPortletHelper implements Serializable {
*/
static final SystemMessages DEFAULT_SYSTEM_MESSAGES = new SystemMessages();
- public static class ApplicationClassException extends Exception {
-
- public ApplicationClassException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ApplicationClassException(String message) {
- super(message);
- }
- }
-
static Class<? extends LegacyApplication> getLegacyApplicationClass(
- VaadinService vaadinService) throws ApplicationClassException {
+ VaadinService vaadinService) throws ServiceException {
Properties initParameters = vaadinService.getDeploymentConfiguration()
.getInitParameters();
String applicationParameter = initParameters.getProperty("application");
ClassLoader classLoader = vaadinService.getClassLoader();
if (applicationParameter == null) {
- throw new ApplicationClassException(
+ throw new ServiceException(
"No \"application\" init parameter found");
}
@@ -57,16 +46,15 @@ class ServletPortletHelper implements Serializable {
return classLoader.loadClass(applicationParameter).asSubclass(
LegacyApplication.class);
} catch (final ClassNotFoundException e) {
- throw new ApplicationClassException(
- "Failed to load application class: " + applicationParameter,
- e);
+ throw new ServiceException("Failed to load application class: "
+ + applicationParameter, e);
}
}
private static void verifyUIClass(String className, ClassLoader classLoader)
- throws ApplicationClassException {
+ throws ServiceException {
if (className == null) {
- throw new ApplicationClassException(VaadinSession.UI_PARAMETER
+ throw new ServiceException(VaadinSession.UI_PARAMETER
+ " init parameter not defined");
}
@@ -74,19 +62,17 @@ class ServletPortletHelper implements Serializable {
try {
Class<?> uiClass = classLoader.loadClass(className);
if (!UI.class.isAssignableFrom(uiClass)) {
- throw new ApplicationClassException(className
- + " does not implement UI");
+ throw new ServiceException(className + " does not implement UI");
}
// Try finding a default constructor, else throw exception
uiClass.getConstructor();
} catch (ClassNotFoundException e) {
- throw new ApplicationClassException(className
- + " could not be loaded", e);
+ throw new ServiceException(className + " could not be loaded", e);
} catch (SecurityException e) {
- throw new ApplicationClassException("Could not access " + className
+ throw new ServiceException("Could not access " + className
+ " class", e);
} catch (NoSuchMethodException e) {
- throw new ApplicationClassException(className
+ throw new ServiceException(className
+ " doesn't have a public no-args constructor");
}
}
@@ -132,7 +118,7 @@ class ServletPortletHelper implements Serializable {
}
public static void initDefaultUIProvider(VaadinSession application,
- VaadinService vaadinService) throws ApplicationClassException {
+ VaadinService vaadinService) throws ServiceException {
String uiProperty = vaadinService.getDeploymentConfiguration()
.getInitParameters().getProperty(VaadinSession.UI_PARAMETER);
if (uiProperty != null) {
@@ -142,9 +128,9 @@ class ServletPortletHelper implements Serializable {
}
public static void checkUiProviders(VaadinSession newApplication)
- throws ApplicationClassException {
+ throws ServiceException {
if (newApplication.getUIProviders().isEmpty()) {
- throw new ApplicationClassException(
+ throw new ServiceException(
"No UIProvider has been added to the application and there is no \""
+ VaadinSession.UI_PARAMETER + "\" init parameter.");
}
diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java
index 9977fa0da7..eb5d838b72 100644
--- a/server/src/com/vaadin/server/VaadinService.java
+++ b/server/src/com/vaadin/server/VaadinService.java
@@ -33,7 +33,6 @@ import javax.servlet.ServletException;
import com.vaadin.LegacyApplication;
import com.vaadin.event.EventRouter;
-import com.vaadin.server.ServletPortletHelper.ApplicationClassException;
import com.vaadin.server.VaadinSession.SessionStartEvent;
import com.vaadin.ui.UI;
import com.vaadin.util.CurrentInstance;
@@ -362,11 +361,7 @@ public abstract class VaadinService implements Serializable {
throws ServiceException {
VaadinSession session = createVaadinSession(request);
- try {
- ServletPortletHelper.initDefaultUIProvider(session, this);
- } catch (ApplicationClassException e) {
- throw new ServiceException(e);
- }
+ ServletPortletHelper.initDefaultUIProvider(session, this);
session.setVaadinService(this);
session.storeInSession(request.getWrappedSession());
@@ -436,11 +431,7 @@ public abstract class VaadinService implements Serializable {
eventRouter.fireEvent(new VaadinSessionInitializeEvent(this, session,
request));
- try {
- ServletPortletHelper.checkUiProviders(session);
- } catch (ApplicationClassException e) {
- throw new ServiceException(e);
- }
+ ServletPortletHelper.checkUiProviders(session);
}
private void closeApplication(VaadinSession application,