Skip to content

Commit

Permalink
Merge 01b4a27 into 5e40998
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlenart committed Dec 27, 2019
2 parents 5e40998 + 01b4a27 commit 8f48faf
Show file tree
Hide file tree
Showing 37 changed files with 270 additions and 309 deletions.
Expand Up @@ -23,6 +23,7 @@
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.StrutsException;

import java.util.*;

Expand Down Expand Up @@ -212,7 +213,7 @@ public void execute(ActionInvocation invocation) throws Exception {

if (isInChainHistory(finalNamespace, finalActionName, finalMethodName)) {
addToHistory(finalNamespace, finalActionName, finalMethodName);
throw new XWorkException("Infinite recursion detected: " + ActionChainResult.getChainHistory().toString());
throw new StrutsException("Infinite recursion detected: " + ActionChainResult.getChainHistory().toString());
}

if (ActionChainResult.getChainHistory().isEmpty() && invocation != null && invocation.getProxy() != null) {
Expand Down
Expand Up @@ -21,6 +21,7 @@
import com.opensymphony.xwork2.conversion.impl.ConversionData;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.StrutsException;
import org.apache.struts2.dispatcher.HttpParameters;

import java.io.Serializable;
Expand Down Expand Up @@ -323,7 +324,7 @@ public <T> T getInstance(Class<T> type) {
if (cont != null) {
return cont.getInstance(type);
} else {
throw new XWorkException("Cannot find an initialized container for this request.");
throw new StrutsException("Cannot find an initialized container for this request.");
}
}

Expand Down
Expand Up @@ -34,6 +34,7 @@
import ognl.NoSuchPropertyException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.StrutsException;

import java.util.ArrayList;
import java.util.Iterator;
Expand Down Expand Up @@ -224,7 +225,7 @@ public Result createResult() throws Exception {
return objectFactory.buildResult(resultConfig, invocationContext.getContextMap());
} catch (Exception e) {
LOG.error("There was an exception while instantiating the result of type {}", resultConfig.getClassName(), e);
throw new XWorkException(e, resultConfig);
throw new StrutsException(e, resultConfig);
}
} else if (resultCode != null && !Action.NONE.equals(resultCode) && unknownHandlerManager.hasUnknownHandlers()) {
return unknownHandlerManager.handleUnknownResult(invocationContext, proxy.getActionName(), proxy.getConfig(), resultCode);
Expand Down Expand Up @@ -297,9 +298,9 @@ protected void createAction(Map<String, Object> contextMap) {
try {
action = objectFactory.buildAction(proxy.getActionName(), proxy.getNamespace(), proxy.getConfig(), contextMap);
} catch (InstantiationException e) {
throw new XWorkException("Unable to instantiate Action!", e, proxy.getConfig());
throw new StrutsException("Unable to instantiate Action!", e, proxy.getConfig());
} catch (IllegalAccessException e) {
throw new XWorkException("Illegal access to constructor, is it public?", e, proxy.getConfig());
throw new StrutsException("Illegal access to constructor, is it public?", e, proxy.getConfig());
} catch (Exception e) {
String gripe;

Expand All @@ -314,7 +315,7 @@ protected void createAction(Map<String, Object> contextMap) {
}

gripe += (((" -- " + e.getMessage()) != null) ? e.getMessage() : " [no message in exception]");
throw new XWorkException(gripe, e, proxy.getConfig());
throw new StrutsException(gripe, e, proxy.getConfig());
}

if (actionEventListener != null) {
Expand Down
Expand Up @@ -19,6 +19,7 @@
package com.opensymphony.xwork2;

import com.opensymphony.xwork2.config.entities.ActionConfig;
import org.apache.struts2.StrutsException;

/**
* Handles cases when the result or action is unknown.
Expand All @@ -36,9 +37,9 @@ public interface UnknownHandler {
* @param namespace The namespace
* @param actionName The action name
* @return An generated ActionConfig, can return <tt>null</tt>
* @throws XWorkException in case of errors
* @throws StrutsException in case of errors
*/
ActionConfig handleUnknownAction(String namespace, String actionName) throws XWorkException;
ActionConfig handleUnknownAction(String namespace, String actionName) throws StrutsException;

/**
* Handles the case when a result cannot be found for an action and result code.
Expand All @@ -48,9 +49,9 @@ public interface UnknownHandler {
* @param actionConfig The action config
* @param resultCode The returned result code
* @return A result to be executed, can return <tt>null</tt>
* @throws XWorkException in case of errors
* @throws StrutsException in case of errors
*/
Result handleUnknownResult(ActionContext actionContext, String actionName, ActionConfig actionConfig, String resultCode) throws XWorkException;
Result handleUnknownResult(ActionContext actionContext, String actionName, ActionConfig actionConfig, String resultCode) throws StrutsException;

/**
* Handles the case when an action method cannot be found. This method is responsible both for finding the method and executing it.
Expand Down
144 changes: 0 additions & 144 deletions core/src/main/java/com/opensymphony/xwork2/XWorkException.java

This file was deleted.

Expand Up @@ -18,15 +18,14 @@
*/
package com.opensymphony.xwork2.config;

import com.opensymphony.xwork2.XWorkException;

import org.apache.struts2.StrutsException;

/**
* ConfigurationException
*
* @author Jason Carreira
*/
public class ConfigurationException extends XWorkException {
public class ConfigurationException extends StrutsException {

/**
* Constructs a <code>ConfigurationException</code> with no detail message.
Expand All @@ -43,12 +42,12 @@ public ConfigurationException() {
public ConfigurationException(String s) {
super(s);
}

/**
* Constructs a <code>ConfigurationException</code> with the specified
* detail message.
*
* @param s the detail message.
* @param s the detail message.
* @param target the target object
*/
public ConfigurationException(String s, Object target) {
Expand All @@ -63,10 +62,11 @@ public ConfigurationException(String s, Object target) {
public ConfigurationException(Throwable cause) {
super(cause);
}

/**
* Constructs a <code>ConfigurationException</code> with no detail message.
* @param cause the cause of the exception
*
* @param cause the cause of the exception
* @param target the target object
*/
public ConfigurationException(Throwable cause, Object target) {
Expand All @@ -77,19 +77,19 @@ public ConfigurationException(Throwable cause, Object target) {
* Constructs a <code>ConfigurationException</code> with the specified
* detail message.
*
* @param s the detail message.
* @param s the detail message.
* @param cause the cause of the exception
*/
public ConfigurationException(String s, Throwable cause) {
super(s, cause);
}

/**
* Constructs a <code>ConfigurationException</code> with the specified
* detail message.
*
* @param s the detail message.
* @param cause the cause of the exception
* @param s the detail message.
* @param cause the cause of the exception
* @param target the target object
*/
public ConfigurationException(String s, Throwable cause, Object target) {
Expand Down
Expand Up @@ -22,7 +22,6 @@
import com.opensymphony.xwork2.FileManager;
import com.opensymphony.xwork2.FileManagerFactory;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.XWorkException;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationProvider;
Expand Down Expand Up @@ -52,6 +51,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.StrutsException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Expand Down Expand Up @@ -1080,7 +1080,7 @@ private List<Document> loadConfigurationFiles(String fileName, Element includeEl

docs.add(DomHelper.parse(in, dtdMappings));
loadedFileUrls.add(url.toString());
} catch (XWorkException e) {
} catch (StrutsException e) {
if (includeElement != null) {
throw new ConfigurationException("Unable to load " + url, e, includeElement);
} else {
Expand Down

0 comments on commit 8f48faf

Please sign in to comment.