You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@apache.org on 2005/09/29 20:46:30 UTC
svn commit: r292504 - in /cocoon/trunk/src/java/org/apache/cocoon/core:
Core.java CoreException.java CoreFatalException.java
CoreInitializationException.java CoreResourceNotFoundException.java
CoreUtil.java
Author: bloritsch
Date: Thu Sep 29 11:46:26 2005
New Revision: 292504
URL: http://svn.apache.org/viewcvs?rev=292504&view=rev
Log:
add core exceptions--and choose not to ignore the fatal exception
Added:
cocoon/trunk/src/java/org/apache/cocoon/core/CoreException.java
cocoon/trunk/src/java/org/apache/cocoon/core/CoreFatalException.java
cocoon/trunk/src/java/org/apache/cocoon/core/CoreInitializationException.java
cocoon/trunk/src/java/org/apache/cocoon/core/CoreResourceNotFoundException.java
Modified:
cocoon/trunk/src/java/org/apache/cocoon/core/Core.java
cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
Modified: cocoon/trunk/src/java/org/apache/cocoon/core/Core.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/Core.java?rev=292504&r1=292503&r2=292504&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/Core.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/Core.java Thu Sep 29 11:46:26 2005
@@ -22,7 +22,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.service.ServiceManager;
@@ -140,7 +139,7 @@
try {
return (org.apache.cocoon.environment.Context)this.context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
} catch (ContextException ce) {
- throw new CascadingRuntimeException("Unable to get the environment object from the context.", ce);
+ throw new CoreResourceNotFoundException("Unable to get the environment object from the context.", ce);
}
}
@@ -167,7 +166,7 @@
try {
return (File)this.context.get(Constants.CONTEXT_WORK_DIR);
} catch (ContextException ce) {
- throw new CascadingRuntimeException("Unable to get the working directory from the context.", ce);
+ throw new CoreResourceNotFoundException("Unable to get the working directory from the context.", ce);
}
}
@@ -178,7 +177,7 @@
try {
return (File)this.context.get(Constants.CONTEXT_UPLOAD_DIR);
} catch (ContextException ce) {
- throw new CascadingRuntimeException("Unable to get the upload directory from the context.", ce);
+ throw new CoreResourceNotFoundException("Unable to get the upload directory from the context.", ce);
}
}
@@ -189,7 +188,7 @@
try {
return (File)this.context.get(Constants.CONTEXT_CACHE_DIR);
} catch (ContextException ce) {
- throw new CascadingRuntimeException("Unable to get the cache directory from the context.", ce);
+ throw new CoreResourceNotFoundException("Unable to get the cache directory from the context.", ce);
}
}
Added: cocoon/trunk/src/java/org/apache/cocoon/core/CoreException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/CoreException.java?rev=292504&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreException.java Thu Sep 29 11:46:26 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.core;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+
+public class CoreException extends CascadingRuntimeException
+{
+ public CoreException(String message)
+ {
+ super(message, null);
+ }
+
+ public CoreException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added: cocoon/trunk/src/java/org/apache/cocoon/core/CoreFatalException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/CoreFatalException.java?rev=292504&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreFatalException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreFatalException.java Thu Sep 29 11:46:26 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.core;
+
+public final class CoreFatalException extends CoreException
+{
+ public CoreFatalException(String message)
+ {
+ super(message, null);
+ }
+
+ public CoreFatalException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added: cocoon/trunk/src/java/org/apache/cocoon/core/CoreInitializationException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/CoreInitializationException.java?rev=292504&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreInitializationException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreInitializationException.java Thu Sep 29 11:46:26 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.core;
+
+public final class CoreInitializationException extends CoreException
+{
+ public CoreInitializationException(String message)
+ {
+ super(message, null);
+ }
+
+ public CoreInitializationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added: cocoon/trunk/src/java/org/apache/cocoon/core/CoreResourceNotFoundException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/CoreResourceNotFoundException.java?rev=292504&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreResourceNotFoundException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreResourceNotFoundException.java Thu Sep 29 11:46:26 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.core;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+
+public final class CoreResourceNotFoundException extends CoreException
+{
+ public CoreResourceNotFoundException(String message)
+ {
+ super(message, null);
+ }
+
+ public CoreResourceNotFoundException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Modified: cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java?rev=292504&r1=292503&r2=292504&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java Thu Sep 29 11:46:26 2005
@@ -30,7 +30,6 @@
import org.apache.avalon.excalibur.logger.Log4JConfLoggerManager;
import org.apache.avalon.excalibur.logger.LoggerManager;
-import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -271,9 +270,9 @@
public Core getCore() {
try {
return (Core)this.parentManager.lookup(Core.ROLE);
- } catch (ServiceException ignore) {
- // this can never happen!
- throw new RuntimeException("Fatal error: no Cocoon core available.");
+ } catch (ServiceException neverIgnore) {
+ // this should never happen!
+ throw new CoreFatalException("Fatal exception: no Cocoon core available.", neverIgnore);
}
}
@@ -460,7 +459,7 @@
try {
resolver.contextualize(this.appContext);
} catch (ContextException ce) {
- throw new CascadingRuntimeException(
+ throw new CoreInitializationException(
"Cannot setup source resolver.", ce);
}
return resolver;