mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-3619: Check LogLevel for all debug, info and warning messages
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1099157 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -167,7 +167,9 @@ public class ActionComponent extends ContextBean {
|
||||
try {
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
LOG.warn("error while trying to flush writer ", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("error while trying to flush writer ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
executeAction();
|
||||
|
||||
@@ -141,7 +141,9 @@ public class AppendIterator extends ContextBean implements UnnamedParametric {
|
||||
|
||||
Object iteratorEntryObj = paramEntries.next();
|
||||
if (! MakeIterator.isIterable(iteratorEntryObj)) {
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
appendIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj));
|
||||
|
||||
@@ -75,13 +75,17 @@ public class File extends UIBean {
|
||||
String encType = (String) form.getParameters().get("enctype");
|
||||
if (!"multipart/form-data".equals(encType)) {
|
||||
// uh oh, this isn't good! Let's warn the developer
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!");
|
||||
}
|
||||
}
|
||||
|
||||
String method = (String) form.getParameters().get("method");
|
||||
if (!"post".equalsIgnoreCase(method)) {
|
||||
// uh oh, this isn't good! Let's warn the developer
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,9 @@ public class Include extends Component {
|
||||
try {
|
||||
urlBuf.append(URLEncoder.encode(values.get(i).toString(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
LOG.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored");
|
||||
}
|
||||
}
|
||||
|
||||
concat = "&";
|
||||
@@ -164,7 +166,9 @@ public class Include extends Component {
|
||||
try {
|
||||
include(result, writer, req, res, defaultEncoding);
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Exception thrown during include of " + result, e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Exception thrown during include of " + result, e);
|
||||
}
|
||||
}
|
||||
|
||||
return super.end(writer, body);
|
||||
|
||||
@@ -201,7 +201,9 @@ public class InputTransferSelect extends ListUIBean {
|
||||
|
||||
}
|
||||
else {
|
||||
LOG.warn("form enclosing inputtransferselect "+this+" not found, auto select upon form submit of inputtransferselect will not work");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("form enclosing inputtransferselect "+this+" not found, auto select upon form submit of inputtransferselect will not work");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,9 @@ public class MergeIterator extends ContextBean implements UnnamedParametric {
|
||||
for (Iterator parametersIterator = _parameters.iterator(); parametersIterator.hasNext(); ) {
|
||||
Object iteratorEntryObj = parametersIterator.next();
|
||||
if (! MakeIterator.isIterable(iteratorEntryObj)) {
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
mergeIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj));
|
||||
|
||||
@@ -332,7 +332,9 @@ public class OptionTransferSelect extends DoubleListUIBean {
|
||||
|
||||
}
|
||||
else {
|
||||
LOG.warn("form enclosing optiontransferselect "+this+" not found, auto select upon form submit of optiontransferselect will not work");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("form enclosing optiontransferselect "+this+" not found, auto select upon form submit of optiontransferselect will not work");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,9 @@ public class Property extends Component {
|
||||
writer.write(prepare(defaultValue));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.info("Could not print out value '" + value + "'", e);
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Could not print out value '" + value + "'", e);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -182,7 +182,7 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
|
||||
// Warn user that the specified namespace/action combo
|
||||
// was not found in the configuration.
|
||||
if (namespace != null) {
|
||||
if (namespace != null && LOG.isWarnEnabled()) {
|
||||
LOG.warn("No configuration found for the specified action: '" + actionName + "' in namespace: '" + namespace + "'. Form action defaulting to 'action' attribute's literal value.");
|
||||
}
|
||||
|
||||
@@ -246,10 +246,14 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
includeGetParameters(urlComponent);
|
||||
includeExtraParameters(urlComponent);
|
||||
} else if (includeParams != null) {
|
||||
LOG.warn("Unknown value for includeParams parameter to URL tag: " + includeParams);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unknown value for includeParams parameter to URL tag: " + includeParams);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Unable to put request parameters (" + urlComponent.getHttpServletRequest().getQueryString() + ") into parameter map.", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to put request parameters (" + urlComponent.getHttpServletRequest().getQueryString() + ") into parameter map.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -817,7 +817,9 @@ public abstract class UIBean extends Component {
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG.warn("No ancestor Form found, javascript based tooltip will not work, however standard HTML tooltip using alt and title attribute will still work ");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("No ancestor Form found, javascript based tooltip will not work, however standard HTML tooltip using alt and title attribute will still work ");
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: this is to keep backward compatibility, remove once when tooltipConfig is dropped
|
||||
@@ -902,7 +904,9 @@ public abstract class UIBean extends Component {
|
||||
if (form != null) {
|
||||
form.addParameter("customOnsubmitEnabled", Boolean.TRUE);
|
||||
} else {
|
||||
LOG.warn("Cannot find an Ancestor form, custom onsubmit is NOT enabled");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Cannot find an Ancestor form, custom onsubmit is NOT enabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -932,7 +936,9 @@ public abstract class UIBean extends Component {
|
||||
tooltipConfig.put(key, value);
|
||||
}
|
||||
else {
|
||||
LOG.warn("component "+component+" tooltip config param "+key+" has no value defined, skipped");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("component "+component+" tooltip config param "+key+" has no value defined, skipped");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,9 @@ public class UpDownSelect extends Select {
|
||||
ancestorForm.getParameters().put("updownselectIds", m);
|
||||
}
|
||||
else {
|
||||
LOG.warn("no ancestor form found for updownselect "+this+", therefore autoselect of all elements upon form submission will not work ");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("no ancestor form found for updownselect "+this+", therefore autoselect of all elements upon form submission will not work ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,9 @@ public abstract class BaseTemplateEngine implements TemplateEngine {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException io) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +124,9 @@ public abstract class BaseTemplateEngine implements TemplateEngine {
|
||||
try {
|
||||
return createFileInputStream(propFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOG.warn("Unable to find file in filesystem [" + propFile.getAbsolutePath() + "]");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to find file in filesystem [" + propFile.getAbsolutePath() + "]");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,9 @@ public class BeanSelectionProvider implements ConfigurationProvider {
|
||||
while (customBundles.hasMoreTokens()) {
|
||||
String name = customBundles.nextToken();
|
||||
try {
|
||||
LOG.info("Loading global messages from " + name);
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Loading global messages from " + name);
|
||||
}
|
||||
LocalizedTextUtil.addDefaultResourceBundle(name);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not find messages file " + name + ".properties. Skipping");
|
||||
@@ -268,7 +270,7 @@ public class BeanSelectionProvider implements ConfigurationProvider {
|
||||
if (!builder.contains(type)) {
|
||||
String foundName = props.getProperty(key, DEFAULT_BEAN_NAME);
|
||||
if (builder.contains(type, foundName)) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Choosing bean ("+foundName+") for "+type);
|
||||
}
|
||||
builder.alias(type, foundName, Container.DEFAULT_NAME);
|
||||
@@ -296,7 +298,9 @@ public class BeanSelectionProvider implements ConfigurationProvider {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Unable to alias bean type "+type+", default mapping already assigned.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to alias bean type "+type+", default mapping already assigned.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -89,7 +89,9 @@ public class LegacyPropertiesConfigurationProvider implements ConfigurationProvi
|
||||
}
|
||||
locale = new Locale(lang, country);
|
||||
} else {
|
||||
LOG.info("No locale define, substituting the default VM locale");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("No locale define, substituting the default VM locale");
|
||||
}
|
||||
locale = Locale.getDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ class PropertiesSettings extends Settings {
|
||||
URL settingsUrl = ClassLoaderUtils.getResource(name + ".properties", getClass());
|
||||
|
||||
if (settingsUrl == null) {
|
||||
LOG.debug(name + ".properties missing");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(name + ".properties missing");
|
||||
}
|
||||
settings = new LocatableProperties();
|
||||
return;
|
||||
}
|
||||
@@ -76,7 +78,9 @@ class PropertiesSettings extends Settings {
|
||||
try {
|
||||
in.close();
|
||||
} catch(IOException io) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +258,9 @@ public class Dispatcher {
|
||||
// clean up ObjectFactory
|
||||
ObjectFactory objectFactory = getContainer().getInstance(ObjectFactory.class);
|
||||
if (objectFactory == null) {
|
||||
LOG.warn("Object Factory is null, something is seriously wrong, no clean up will be performed");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Object Factory is null, something is seriously wrong, no clean up will be performed");
|
||||
}
|
||||
}
|
||||
if (objectFactory instanceof ObjectFactoryDestroyable) {
|
||||
try {
|
||||
@@ -395,7 +397,9 @@ public class Dispatcher {
|
||||
// test whether param-access workaround needs to be enabled
|
||||
if (servletContext != null && servletContext.getServerInfo() != null
|
||||
&& servletContext.getServerInfo().indexOf("WebLogic") >= 0) {
|
||||
LOG.info("WebLogic server detected. Enabling Struts parameter access work-around.");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("WebLogic server detected. Enabling Struts parameter access work-around.");
|
||||
}
|
||||
paramsWorkaroundEnabled = true;
|
||||
} else {
|
||||
paramsWorkaroundEnabled = "true".equals(container.getInstance(String.class,
|
||||
@@ -512,7 +516,9 @@ public class Dispatcher {
|
||||
LOG.error("Could not find action or result\n" + reqStr, e);
|
||||
}
|
||||
else {
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not find action or result", e);
|
||||
}
|
||||
}
|
||||
sendError(request, response, context, HttpServletResponse.SC_NOT_FOUND, e);
|
||||
} catch (Exception e) {
|
||||
@@ -616,7 +622,9 @@ public class Dispatcher {
|
||||
|
||||
if (saveDir.equals("")) {
|
||||
File tempdir = (File) servletContext.getAttribute("javax.servlet.context.tempdir");
|
||||
LOG.info("Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir");
|
||||
}
|
||||
|
||||
if (tempdir != null) {
|
||||
saveDir = tempdir.toString();
|
||||
@@ -637,7 +645,9 @@ public class Dispatcher {
|
||||
LOG.error(logMessage);
|
||||
}
|
||||
else {
|
||||
LOG.warn(logMessage);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(logMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -754,7 +764,9 @@ public class Dispatcher {
|
||||
|
||||
if ((currentFile != null) && currentFile.isFile()) {
|
||||
if (!currentFile.delete()) {
|
||||
LOG.warn("Resource Leaking: Could not remove uploaded file '" + currentFile.getCanonicalPath() + "'.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Resource Leaking: Could not remove uploaded file '" + currentFile.getCanonicalPath() + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,9 @@ public class PlainTextResult extends StrutsResultSupport {
|
||||
charset = Charset.forName(charSet);
|
||||
}
|
||||
else {
|
||||
LOG.warn("charset ["+charSet+"] is not recognized ");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("charset ["+charSet+"] is not recognized ");
|
||||
}
|
||||
charset = null;
|
||||
}
|
||||
}
|
||||
@@ -148,7 +150,9 @@ public class PlainTextResult extends StrutsResultSupport {
|
||||
reader = new InputStreamReader(resourceAsStream);
|
||||
}
|
||||
if (resourceAsStream == null) {
|
||||
LOG.warn("resource at location ["+finalLocation+"] cannot be obtained (return null) from ServletContext !!! ");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("resource at location ["+finalLocation+"] cannot be obtained (return null) from ServletContext !!! ");
|
||||
}
|
||||
} else {
|
||||
char[] buffer = new char[BUFFER_SIZE];
|
||||
int charRead;
|
||||
|
||||
@@ -259,7 +259,9 @@ public class StreamResult extends StrutsResultSupport {
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
LOG.warn("failed to recongnize "+_contentLength+" as a number, contentLength header will not be set", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("failed to recongnize "+_contentLength+" as a number, contentLength header will not be set", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,14 +285,18 @@ public class StreamResult extends StrutsResultSupport {
|
||||
}
|
||||
|
||||
// Copy input to output
|
||||
LOG.debug("Streaming to output buffer +++ START +++");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Streaming to output buffer +++ START +++");
|
||||
}
|
||||
byte[] oBuff = new byte[bufferSize];
|
||||
int iSize;
|
||||
while (-1 != (iSize = inputStream.read(oBuff))) {
|
||||
oOutput.write(oBuff, 0, iSize);
|
||||
}
|
||||
LOG.debug("Streaming to output buffer +++ END +++");
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Streaming to output buffer +++ END +++");
|
||||
}
|
||||
|
||||
// Flush
|
||||
oOutput.flush();
|
||||
}
|
||||
|
||||
@@ -206,7 +206,9 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics {
|
||||
return URLEncoder.encode(parsedValue.toString(), "UTF-8");
|
||||
}
|
||||
catch(UnsupportedEncodingException e) {
|
||||
LOG.warn("error while trying to encode ["+parsedValue+"]", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("error while trying to encode ["+parsedValue+"]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +210,9 @@ public class Restful2ActionMapper extends DefaultActionMapper {
|
||||
mapping.getParams().putAll(parameters);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Unable to determine parameters from the url", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to determine parameters from the url", e);
|
||||
}
|
||||
}
|
||||
mapping.setName(actionName.substring(actionSlashPos+1));
|
||||
}
|
||||
|
||||
@@ -106,7 +106,9 @@ public class RestfulActionMapper implements ActionMapper {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Cannot determine url parameters", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Cannot determine url parameters", e);
|
||||
}
|
||||
}
|
||||
|
||||
return new ActionMapping(actionName, "", "", parameters);
|
||||
|
||||
+9
-3
@@ -79,7 +79,9 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
|
||||
try {
|
||||
processUpload(request, saveDir);
|
||||
} catch (FileUploadException e) {
|
||||
LOG.warn("Unable to parse request", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to parse request", e);
|
||||
}
|
||||
errors.add(e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -98,7 +100,9 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
|
||||
}
|
||||
|
||||
private void processFileField(FileItem item) {
|
||||
LOG.debug("Item is a file upload");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Item is a file upload");
|
||||
}
|
||||
|
||||
// Skip file uploads that don't have a file name - meaning that no file was selected.
|
||||
if (item.getName() == null || item.getName().trim().length() < 1) {
|
||||
@@ -118,7 +122,9 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
|
||||
}
|
||||
|
||||
private void processNormalFormField(FileItem item, String charset) throws UnsupportedEncodingException {
|
||||
LOG.debug("Item is a normal form field");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Item is a normal form field");
|
||||
}
|
||||
List<String> values;
|
||||
if (params.get(item.getFieldName()) != null) {
|
||||
values = params.get(item.getFieldName());
|
||||
|
||||
@@ -77,7 +77,9 @@ public class CheckboxInterceptor implements Interceptor {
|
||||
Object values = entry.getValue();
|
||||
iterator.remove();
|
||||
if (values != null && values instanceof String[] && ((String[])values).length > 1) {
|
||||
LOG.debug("Bypassing automatic checkbox detection due to multiple checkboxes of the same name: #1", name);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Bypassing automatic checkbox detection due to multiple checkboxes of the same name: #1", name);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,10 @@ public class ClearSessionInterceptor extends AbstractInterceptor {
|
||||
* @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation)
|
||||
*/
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
LOG.debug("Clearing HttpSession");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Clearing HttpSession");
|
||||
}
|
||||
|
||||
ActionContext ac = invocation.getInvocationContext();
|
||||
Map session = ac.getSession();
|
||||
|
||||
|
||||
@@ -188,9 +188,10 @@ public class CookieInterceptor extends AbstractInterceptor {
|
||||
}
|
||||
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("start interception");
|
||||
|
||||
}
|
||||
|
||||
// contains selected cookies
|
||||
final Map<String, String> cookiesMap = new LinkedHashMap<String, String>();
|
||||
|
||||
@@ -203,8 +204,9 @@ public class CookieInterceptor extends AbstractInterceptor {
|
||||
String value = cookie.getValue();
|
||||
|
||||
if (cookiesNameSet.contains("*")) {
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("contains cookie name [*] in configured cookies name set, cookie with name [" + name + "] with value [" + value + "] will be injected");
|
||||
}
|
||||
populateCookieValueIntoStack(name, value, cookiesMap, stack);
|
||||
} else if (cookiesNameSet.contains(cookie.getName())) {
|
||||
populateCookieValueIntoStack(name, value, cookiesMap, stack);
|
||||
@@ -246,8 +248,10 @@ public class CookieInterceptor extends AbstractInterceptor {
|
||||
// if cookiesValues is specified, the cookie's value must match before we
|
||||
// inject them into Struts' action
|
||||
if (cookiesValueSet.contains(cookieValue)) {
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("both configured cookie name and value matched, cookie ["+cookieName+"] with value ["+cookieValue+"] will be injected");
|
||||
}
|
||||
|
||||
cookiesMap.put(cookieName, cookieValue);
|
||||
stack.setValue(cookieName, cookieValue);
|
||||
}
|
||||
@@ -263,8 +267,9 @@ public class CookieInterceptor extends AbstractInterceptor {
|
||||
*/
|
||||
protected void injectIntoCookiesAwareAction(Object action, Map<String, String> cookiesMap) {
|
||||
if (action instanceof CookiesAware) {
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("action ["+action+"] implements CookiesAware, injecting cookies map ["+cookiesMap+"]");
|
||||
}
|
||||
((CookiesAware)action).setCookiesMap(cookiesMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,10 @@ public class CreateSessionInterceptor extends AbstractInterceptor {
|
||||
* @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation)
|
||||
*/
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
LOG.debug("Creating HttpSession");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Creating HttpSession");
|
||||
}
|
||||
|
||||
ServletActionContext.getRequest().getSession(true);
|
||||
return invocation.invoke();
|
||||
}
|
||||
|
||||
@@ -263,10 +263,12 @@ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor {
|
||||
|
||||
Map results = proxy.getConfig().getResults();
|
||||
if (!results.containsKey(WAIT)) {
|
||||
LOG.warn("ExecuteAndWait interceptor has detected that no result named 'wait' is available. " +
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("ExecuteAndWait interceptor has detected that no result named 'wait' is available. " +
|
||||
"Defaulting to a plain built-in wait page. It is highly recommend you " +
|
||||
"provide an action-specific or global result named '" + WAIT +
|
||||
"'.");
|
||||
}
|
||||
// no wait result? hmm -- let's try to do dynamically put it in for you!
|
||||
|
||||
//we used to add a fake "wait" result here, since the configuration is unmodifiable, that is no longer
|
||||
|
||||
@@ -259,7 +259,9 @@ public class FileUploadInterceptor extends AbstractInterceptor {
|
||||
validation.addActionError(error);
|
||||
}
|
||||
|
||||
LOG.warn(error);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,10 +305,14 @@ public class FileUploadInterceptor extends AbstractInterceptor {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG.warn(getTextMessage(action, "struts.messages.invalid.file", new Object[]{inputName}, ac.getLocale()));
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(getTextMessage(action, "struts.messages.invalid.file", new Object[]{inputName}, ac.getLocale()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG.warn(getTextMessage(action, "struts.messages.invalid.content.type", new Object[]{inputName}, ac.getLocale()));
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(getTextMessage(action, "struts.messages.invalid.content.type", new Object[]{inputName}, ac.getLocale()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,28 +342,36 @@ public class FileUploadInterceptor extends AbstractInterceptor {
|
||||
validation.addFieldError(inputName, errMsg);
|
||||
}
|
||||
|
||||
LOG.warn(errMsg);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(errMsg);
|
||||
}
|
||||
} else if (maximumSize != null && maximumSize < file.length()) {
|
||||
String errMsg = getTextMessage(action, "struts.messages.error.file.too.large", new Object[]{inputName, filename, file.getName(), "" + file.length()}, locale);
|
||||
if (validation != null) {
|
||||
validation.addFieldError(inputName, errMsg);
|
||||
}
|
||||
|
||||
LOG.warn(errMsg);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(errMsg);
|
||||
}
|
||||
} else if ((!allowedTypesSet.isEmpty()) && (!containsItem(allowedTypesSet, contentType))) {
|
||||
String errMsg = getTextMessage(action, "struts.messages.error.content.type.not.allowed", new Object[]{inputName, filename, file.getName(), contentType}, locale);
|
||||
if (validation != null) {
|
||||
validation.addFieldError(inputName, errMsg);
|
||||
}
|
||||
|
||||
LOG.warn(errMsg);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(errMsg);
|
||||
}
|
||||
} else if ((!allowedExtensionsSet.isEmpty()) && (!hasAllowedExtension(allowedExtensionsSet, filename))) {
|
||||
String errMsg = getTextMessage(action, "struts.messages.error.file.extension.not.allowed", new Object[]{inputName, filename, file.getName(), contentType}, locale);
|
||||
if (validation != null) {
|
||||
validation.addFieldError(inputName, errMsg);
|
||||
}
|
||||
|
||||
LOG.warn(errMsg);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(errMsg);
|
||||
}
|
||||
} else {
|
||||
fileIsAcceptable = true;
|
||||
}
|
||||
|
||||
@@ -198,13 +198,18 @@ public class MessageStoreInterceptor implements Interceptor {
|
||||
}
|
||||
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
LOG.debug("entering MessageStoreInterceptor ...");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("entering MessageStoreInterceptor ...");
|
||||
}
|
||||
|
||||
before(invocation);
|
||||
String result = invocation.invoke();
|
||||
after(invocation, result);
|
||||
|
||||
LOG.debug("exit executing MessageStoreInterceptor");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("exit executing MessageStoreInterceptor");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -228,7 +233,9 @@ public class MessageStoreInterceptor implements Interceptor {
|
||||
Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION);
|
||||
ValidationAware validationAwareAction = (ValidationAware) action;
|
||||
|
||||
LOG.debug("retrieve error / message from session to populate into action ["+action+"]");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("retrieve error / message from session to populate into action ["+action+"]");
|
||||
}
|
||||
|
||||
Collection actionErrors = (Collection) session.get(actionErrorsSessionKey);
|
||||
Collection actionMessages = (Collection) session.get(actionMessagesSessionKey);
|
||||
@@ -276,15 +283,17 @@ public class MessageStoreInterceptor implements Interceptor {
|
||||
// store error / messages into session
|
||||
Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION);
|
||||
|
||||
LOG.debug("store action ["+action+"] error/messages into session ");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("store action ["+action+"] error/messages into session ");
|
||||
}
|
||||
|
||||
ValidationAware validationAwareAction = (ValidationAware) action;
|
||||
session.put(actionErrorsSessionKey, validationAwareAction.getActionErrors());
|
||||
session.put(actionMessagesSessionKey, validationAwareAction.getActionMessages());
|
||||
session.put(fieldErrorsSessionKey, validationAwareAction.getFieldErrors());
|
||||
}
|
||||
else {
|
||||
LOG.debug("Action ["+action+"] is not ValidationAware, no message / error that are storeable");
|
||||
else if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Action ["+action+"] is not ValidationAware, no message / error that are storeable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -118,7 +118,9 @@ public class JSONValidationInterceptor extends MethodFilterInterceptor {
|
||||
|
||||
private void setupEncoding(HttpServletResponse response, HttpServletRequest request) {
|
||||
if (isSetEncoding(request)) {
|
||||
LOG.debug("Default encoding not set!");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Default encoding not set!");
|
||||
}
|
||||
} else {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Setting up encoding to: [" + DEFAULT_ENCODING + "]!");
|
||||
|
||||
@@ -93,7 +93,9 @@ public class IteratorGenerator implements Iterator, Action {
|
||||
values.add(convertedObj);
|
||||
}
|
||||
catch(Exception e) { // make sure things, goes on, we just ignore the bad ones
|
||||
LOG.warn("unable to convert ["+token+"], skipping this token, it will not appear in the generated iterator", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("unable to convert ["+token+"], skipping this token, it will not appear in the generated iterator", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -167,7 +167,9 @@ public class SubsetIteratorFilter extends IteratorFilterSupport implements Itera
|
||||
return okToAdd;
|
||||
}
|
||||
catch(Exception e) {
|
||||
LOG.warn("decider ["+decider+"] encountered an error while decide adding element ["+element+"], element will be ignored, it will not appeared in subseted iterator", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("decider ["+decider+"] encountered an error while decide adding element ["+element+"], element will be ignored, it will not appeared in subseted iterator", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,14 +94,22 @@ public class TextProviderHelper {
|
||||
|
||||
if (LOG.isWarnEnabled()) {
|
||||
if (tp != null) {
|
||||
LOG.warn("The first TextProvider in the ValueStack ("+tp.getClass().getName()+") could not locate the message resource with key '"+key+"'");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("The first TextProvider in the ValueStack ("+tp.getClass().getName()+") could not locate the message resource with key '"+key+"'");
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Could not locate the message resource '"+key+"' as there is no TextProvider in the ValueStack.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not locate the message resource '"+key+"' as there is no TextProvider in the ValueStack.");
|
||||
}
|
||||
}
|
||||
if (msg.equals(defaultMessage)) {
|
||||
LOG.warn("The default value expression '"+defaultMessage+"' was evaluated and did not match a property. The literal value '"+defaultMessage+"' will be used.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("The default value expression '"+defaultMessage+"' was evaluated and did not match a property. The literal value '"+defaultMessage+"' will be used.");
|
||||
}
|
||||
} else {
|
||||
LOG.warn("The default value expression '"+defaultMessage+"' evaluated to '"+msg+"'");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("The default value expression '"+defaultMessage+"' evaluated to '"+msg+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,9 @@ public class TokenHelper {
|
||||
String token;
|
||||
|
||||
if ((tokens == null) || (tokens.length < 1)) {
|
||||
LOG.warn("Could not find token mapped to token name " + tokenName);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not find token mapped to token name " + tokenName);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -124,7 +126,9 @@ public class TokenHelper {
|
||||
Map params = ActionContext.getContext().getParameters();
|
||||
|
||||
if (!params.containsKey(TOKEN_NAME_FIELD)) {
|
||||
LOG.warn("Could not find token name in params.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not find token name in params.");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -133,7 +137,9 @@ public class TokenHelper {
|
||||
String tokenName;
|
||||
|
||||
if ((tokenNames == null) || (tokenNames.length < 1)) {
|
||||
LOG.warn("Got a null or empty token name.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Got a null or empty token name.");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -153,16 +159,18 @@ public class TokenHelper {
|
||||
String tokenName = getTokenName();
|
||||
|
||||
if (tokenName == null) {
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("no token name found -> Invalid token ");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
String token = getToken(tokenName);
|
||||
|
||||
if (token == null) {
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("no token found for token name "+tokenName+" -> Invalid token ");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -170,9 +178,11 @@ public class TokenHelper {
|
||||
String sessionToken = (String) session.get(tokenName);
|
||||
|
||||
if (!token.equals(sessionToken)) {
|
||||
LOG.warn(LocalizedTextUtil.findText(TokenHelper.class, "struts.internal.invalid.token", ActionContext.getContext().getLocale(), "Form token {0} does not match the session token {1}.", new Object[]{
|
||||
token, sessionToken
|
||||
}));
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(LocalizedTextUtil.findText(TokenHelper.class, "struts.internal.invalid.token", ActionContext.getContext().getLocale(), "Form token {0} does not match the session token {1}.", new Object[]{
|
||||
token, sessionToken
|
||||
}));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -450,7 +450,9 @@ public class FreemarkerManager {
|
||||
try {
|
||||
in.close();
|
||||
} catch(IOException io) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to close input stream", io);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,9 @@ public class IteratorGeneratorTag extends StrutsBodyTagSupport {
|
||||
count = Integer.parseInt((String)countObj);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
LOG.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +223,9 @@ public class SubsetIteratorTag extends StrutsBodyTagSupport {
|
||||
count = Integer.parseInt((String)countObj);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
LOG.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -249,7 +251,9 @@ public class SubsetIteratorTag extends StrutsBodyTagSupport {
|
||||
start = Integer.parseInt((String)startObj);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
LOG.warn("unable to convert count attribute ["+startObj+"] to number, ignore count attribute", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("unable to convert count attribute ["+startObj+"] to number, ignore count attribute", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +266,9 @@ public class UrlHelper {
|
||||
try {
|
||||
return URLEncoder.encode(translatedInput, encoding);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
LOG.warn("Could not encode URL parameter '" + input + "', returning value un-encoded");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not encode URL parameter '" + input + "', returning value un-encoded");
|
||||
}
|
||||
return translatedInput;
|
||||
}
|
||||
}
|
||||
@@ -278,7 +280,9 @@ public class UrlHelper {
|
||||
try {
|
||||
return URLDecoder.decode(translatedInput, encoding);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
LOG.warn("Could not encode URL parameter '" + input + "', returning value un-encoded");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not encode URL parameter '" + input + "', returning value un-encoded");
|
||||
}
|
||||
return translatedInput;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,9 @@ public class VelocityManager {
|
||||
VelocityContext velocityContext = (VelocityContext) objectFactory.buildBean(className, null);
|
||||
contextList.add(velocityContext);
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Warning. " + e.getClass().getName() + " caught while attempting to instantiate a chained VelocityContext, " + className + " -- skipping");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Warning. " + e.getClass().getName() + " caught while attempting to instantiate a chained VelocityContext, " + className + " -- skipping");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (contextList.size() > 0) {
|
||||
@@ -299,11 +301,15 @@ public class VelocityManager {
|
||||
|
||||
// if we've got something, load 'er up
|
||||
if (in != null) {
|
||||
LOG.info("Initializing velocity using " + resourceLocation);
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Initializing velocity using " + resourceLocation);
|
||||
}
|
||||
properties.load(in);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Unable to load velocity configuration " + resourceLocation, e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to load velocity configuration " + resourceLocation, e);
|
||||
}
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
|
||||
@@ -358,7 +358,9 @@ public class XSLTResult implements Result {
|
||||
|
||||
public void warning(TransformerException exception)
|
||||
throws TransformerException {
|
||||
LOG.warn(exception.getMessage(), exception);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn(exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -384,7 +386,9 @@ public class XSLTResult implements Result {
|
||||
Source xmlSource = getDOMSourceForStack(result);
|
||||
|
||||
// Transform the source XML to System.out.
|
||||
LOG.debug("xmlSource = " + xmlSource);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("xmlSource = " + xmlSource);
|
||||
}
|
||||
transformer.transform(xmlSource, new StreamResult(writer));
|
||||
|
||||
writer.flush(); // ...and flush...
|
||||
@@ -437,7 +441,9 @@ public class XSLTResult implements Result {
|
||||
throw new TransformerException("Stylesheet " + path + " not found in resources.");
|
||||
}
|
||||
|
||||
LOG.debug("Preparing XSLT stylesheet templates: " + path);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Preparing XSLT stylesheet templates: " + path);
|
||||
}
|
||||
|
||||
TransformerFactory factory = TransformerFactory.newInstance();
|
||||
factory.setURIResolver(getURIResolver());
|
||||
|
||||
+3
-1
@@ -112,7 +112,9 @@ public class ShowValidatorAction extends ListValidatorsAction {
|
||||
properties.add(new PropertyInfo(name, pd.getPropertyType(), value));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Unable to retrieve properties.", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to retrieve properties.", e);
|
||||
}
|
||||
addActionError("Unable to retrieve properties: " + e.toString());
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -309,7 +309,9 @@ public class JasperReportsResult extends StrutsResultSupport implements JasperRe
|
||||
// Add any report parameters from action to param map.
|
||||
Map reportParams = (Map) stack.findValue(reportParameters);
|
||||
if (reportParams != null) {
|
||||
LOG.debug("Found report parameters; adding to parameters...");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Found report parameters; adding to parameters...");
|
||||
}
|
||||
parameters.putAll(reportParams);
|
||||
}
|
||||
|
||||
@@ -382,7 +384,9 @@ public class JasperReportsResult extends StrutsResultSupport implements JasperRe
|
||||
|
||||
Map exportParams = (Map) stack.findValue(exportParameters);
|
||||
if (exportParams != null) {
|
||||
LOG.debug("Found export parameters; adding to exporter parameters...");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Found export parameters; adding to exporter parameters...");
|
||||
}
|
||||
exporter.getParameters().putAll(exportParams);
|
||||
}
|
||||
|
||||
|
||||
+9
-3
@@ -70,7 +70,9 @@ public class ValueStackDataSource implements JRDataSource {
|
||||
iterator = MakeIterator.convert(array);
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Data source value for data source " + dataSource + " was null");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Data source value for data source " + dataSource + " was null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,11 +130,15 @@ public class ValueStackDataSource implements JRDataSource {
|
||||
|
||||
if ((iterator != null) && (iterator.hasNext())) {
|
||||
valueStack.push(iterator.next());
|
||||
LOG.debug("Pushed next value: " + valueStack.findValue("."));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Pushed next value: " + valueStack.findValue("."));
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
LOG.debug("No more values");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("No more values");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
+3
-2
@@ -86,8 +86,9 @@ public class JavaTemplateEngine extends BaseTemplateEngine {
|
||||
while (customThemes.hasMoreTokens()) {
|
||||
String themeClass = customThemes.nextToken().trim();
|
||||
try {
|
||||
LOG.info("Registering custom theme '" + themeClass + "' to javatemplates engine");
|
||||
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Registering custom theme '" + themeClass + "' to javatemplates engine");
|
||||
}
|
||||
|
||||
//FIXME: This means Themes must have no-arg constructor - should use object factory here
|
||||
//ObjectFactory.getObjectFactory().buildBean(ClassLoaderUtil.loadClass(themeClass, getClass()), null);
|
||||
|
||||
@@ -95,7 +95,9 @@ public abstract class JSONCleaner {
|
||||
if (allow(key)) {
|
||||
e.setValue(clean(key, e.getValue()));
|
||||
} else {
|
||||
LOG.debug("blocked: " + key);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("blocked: " + key);
|
||||
}
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,8 +387,10 @@ class JSONWriter {
|
||||
}
|
||||
hasData = true;
|
||||
if (!warnedNonString && !(key instanceof String)) {
|
||||
LOG.warn("JavaScript doesn't support non-String keys, using toString() on "
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("JavaScript doesn't support non-String keys, using toString() on "
|
||||
+ key.getClass().getName());
|
||||
}
|
||||
warnedNonString = true;
|
||||
}
|
||||
this.value(key.toString(), method);
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
*/
|
||||
package org.apache.struts2.json;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class SerializationParams {
|
||||
private static final String DEFAULT_CONTENT_TYPE = "application/json";
|
||||
|
||||
|
||||
@@ -69,9 +69,8 @@ public class SMDGenerator {
|
||||
// find params for this method
|
||||
processMethodsParameters(method, smdMethod);
|
||||
|
||||
} else {
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Ignoring property " + method.getName());
|
||||
} else if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Ignoring property " + method.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -228,8 +228,9 @@ public class FelixOsgiHost implements OsgiHost {
|
||||
//add all the bundles to the list
|
||||
for (File bundle : bundles) {
|
||||
String externalForm = bundle.toURI().toURL().toExternalForm();
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Adding bundle [#0]", externalForm);
|
||||
}
|
||||
bundleJars.add(externalForm);
|
||||
}
|
||||
|
||||
|
||||
@@ -107,8 +107,9 @@ public class OsgiConfigurationProvider implements PackageProvider, BundleListene
|
||||
*/
|
||||
protected void loadConfigFromBundle(Bundle bundle) {
|
||||
String bundleName = bundle.getSymbolicName();
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Loading packages from bundle [#0]", bundleName);
|
||||
}
|
||||
|
||||
//init action context
|
||||
ActionContext ctx = ActionContext.getContext();
|
||||
@@ -123,8 +124,9 @@ public class OsgiConfigurationProvider implements PackageProvider, BundleListene
|
||||
ctx.put(ClassLoaderInterface.CLASS_LOADER_INTERFACE, new BundleClassLoaderInterface());
|
||||
ctx.put(BundleAccessor.CURRENT_BUNDLE_NAME, bundleName);
|
||||
|
||||
if (LOG.isTraceEnabled())
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Loading XML config from bundle [#0]", bundleName);
|
||||
}
|
||||
|
||||
//XML config
|
||||
PackageLoader loader = new BundlePackageLoader();
|
||||
|
||||
+5
-3
@@ -55,8 +55,9 @@ public class DefaultOValValidationManager implements OValValidationManager {
|
||||
configurers.add(annotationsConfigurer);
|
||||
|
||||
if (validateJPAAnnotations) {
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Adding support for JPA annotations validations in OVal");
|
||||
}
|
||||
configurers.add(new JPAAnnotationsConfigurer());
|
||||
}
|
||||
}
|
||||
@@ -139,8 +140,9 @@ public class DefaultOValValidationManager implements OValValidationManager {
|
||||
is = FileManager.loadFile(fileName, clazz);
|
||||
|
||||
if (is != null) {
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Loading validation xml file [#0]", fileName);
|
||||
}
|
||||
XMLConfigurer configurer = new XMLConfigurer();
|
||||
configurer.fromXML(is);
|
||||
validatorFileCache.put(fileName, configurer);
|
||||
@@ -161,4 +163,4 @@ public class DefaultOValValidationManager implements OValValidationManager {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-3
@@ -128,7 +128,9 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
|
||||
} catch (Exception e) {
|
||||
// If any exception occurred while doing reflection, we want
|
||||
// validate() to be executed
|
||||
LOG.warn("An exception occured while executing the prefix method", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("An exception occured while executing the prefix method", e);
|
||||
}
|
||||
exception = e;
|
||||
}
|
||||
|
||||
@@ -157,8 +159,9 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
|
||||
String[] profileNames = profiles.value();
|
||||
if (profileNames != null && profileNames.length > 0) {
|
||||
validator.disableAllProfiles();
|
||||
if (LOG.isDebugEnabled())
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Enabling profiles [#0]", StringUtils.join(profileNames, ","));
|
||||
}
|
||||
for (String profileName : profileNames)
|
||||
validator.enableProfile(profileName);
|
||||
}
|
||||
@@ -187,7 +190,9 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
|
||||
}
|
||||
|
||||
if (isActionError(violation)) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Adding action error '#0'", message);
|
||||
}
|
||||
validatorContext.addActionError(message);
|
||||
} else {
|
||||
ValidationError validationError = buildValidationError(violation, message);
|
||||
@@ -198,7 +203,9 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
|
||||
fieldName = parentFieldname + "." + fieldName;
|
||||
}
|
||||
|
||||
LOG.debug("Adding field error [#0] with message '#1'", fieldName, validationError.getMessage());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Adding field error [#0] with message '#1'", fieldName, validationError.getMessage());
|
||||
}
|
||||
validatorContext.addFieldError(fieldName, validationError.getMessage());
|
||||
|
||||
// don't add "model." prefix to fields of model in model driven action
|
||||
|
||||
+3
-1
@@ -158,7 +158,9 @@ public class PellMultiPartRequest implements MultiPartRequest {
|
||||
http.utils.multipartrequest.MultipartRequest.setEncoding("UTF-8");
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
LOG.info("Could not get encoding property 'struts.i18n.encoding' for file upload. Using system default");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Could not get encoding property 'struts.i18n.encoding' for file upload. Using system default");
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
LOG.error("Encoding " + encoding + " is not a valid encoding. Please check your struts.properties file.");
|
||||
}
|
||||
|
||||
@@ -82,7 +82,9 @@ public class PlexusFilter implements Filter {
|
||||
}
|
||||
|
||||
if (parent.hasChildContainer(CHILD_CONTAINER_NAME)) {
|
||||
LOG.warn("Plexus container (scope: request) alredy exist.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Plexus container (scope: request) alredy exist.");
|
||||
}
|
||||
child = parent.getChildContainer(CHILD_CONTAINER_NAME);
|
||||
} else {
|
||||
child = parent.createChildContainer(CHILD_CONTAINER_NAME, Collections.EMPTY_LIST, Collections.EMPTY_MAP);
|
||||
|
||||
@@ -294,7 +294,9 @@ public class PlexusObjectFactory extends ObjectFactory {
|
||||
return pc.lookup(role, roleHint);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.debug("Can't load component (" + role + "/" + roleHint + ") with plexus, try now with struts.", e);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Can't load component (" + role + "/" + roleHint + ") with plexus, try now with struts.", e);
|
||||
}
|
||||
Object o = super.buildBean(super.getClassInstance(role), extraContext);
|
||||
pc.autowire(o);
|
||||
return o;
|
||||
|
||||
@@ -47,7 +47,9 @@ public class PlexusUtils {
|
||||
public static void configure(PlexusContainer pc, String file) throws PlexusConfigurationResourceException {
|
||||
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
|
||||
if (is == null) {
|
||||
LOG.info("Could not find " + file + ", skipping");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Could not find " + file + ", skipping");
|
||||
}
|
||||
is = new ByteArrayInputStream("<plexus><components></components></plexus>".getBytes());
|
||||
}
|
||||
pc.setConfigurationResource(new InputStreamReader(is));
|
||||
|
||||
+2
@@ -44,7 +44,9 @@ public class PreparatorServlet extends HttpServlet implements StrutsStatics {
|
||||
|
||||
@Override
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("The preparator servlet has been deprecated. It can safely be removed from your web.xml file");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -53,7 +53,9 @@ public class ServletContextHolderListener implements ServletContextListener {
|
||||
* @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
|
||||
*/
|
||||
public void contextInitialized(ServletContextEvent event) {
|
||||
LOG.warn("The ServletContextHolderListener has been deprecated. It can safely be removed from your web.xml file");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("The ServletContextHolderListener has been deprecated. It can safely be removed from your web.xml file");
|
||||
}
|
||||
context = event.getServletContext();
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -442,8 +442,9 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
|
||||
sessionMap, applicationMap, request, response, servletRequest, servletResponse,
|
||||
servletContext, getPortletConfig(), phase);
|
||||
extraContext.put(PortletActionConstants.ACTION_MAPPING, mapping);
|
||||
LOG.debug("Creating action proxy for name = " + actionName
|
||||
+ ", namespace = " + namespace);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Creating action proxy for name = " + actionName + ", namespace = " + namespace);
|
||||
}
|
||||
ActionProxy proxy = factory.createActionProxy(namespace,
|
||||
actionName, mapping.getMethod(), extraContext);
|
||||
request.setAttribute("struts.valueStack", proxy.getInvocation()
|
||||
@@ -609,7 +610,9 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
|
||||
|
||||
public void destroy() {
|
||||
if (dispatcherUtils == null) {
|
||||
LOG.warn("something is seriously wrong, DispatcherUtil is not initialized (null) ");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("something is seriously wrong, DispatcherUtil is not initialized (null) ");
|
||||
}
|
||||
} else {
|
||||
dispatcherUtils.cleanup();
|
||||
}
|
||||
|
||||
+3
-1
@@ -79,7 +79,9 @@ public class PortletAwareInterceptor extends AbstractInterceptor implements Port
|
||||
|
||||
// Check if running in a servlet environment
|
||||
if (request == null) {
|
||||
LOG.warn("This portlet preferences implementation should only be used during development");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("This portlet preferences implementation should only be used during development");
|
||||
}
|
||||
((PortletPreferencesAware)action).setPortletPreferences(new ServletPortletPreferences(ActionContext.getContext().getSession()));
|
||||
} else {
|
||||
((PortletPreferencesAware)action).setPortletPreferences(request.getPreferences());
|
||||
|
||||
@@ -78,8 +78,10 @@ public class PortletUrlHelper {
|
||||
StringBuffer resultingAction = new StringBuffer();
|
||||
RenderRequest request = PortletActionContext.getRenderRequest();
|
||||
RenderResponse response = PortletActionContext.getRenderResponse();
|
||||
LOG.debug("Creating url. Action = " + action + ", Namespace = "
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Creating url. Action = " + action + ", Namespace = "
|
||||
+ namespace + ", Type = " + type);
|
||||
}
|
||||
namespace = prependNamespace(namespace, portletMode);
|
||||
if (StringUtils.isEmpty(portletMode)) {
|
||||
portletMode = PortletActionContext.getRenderRequest().getPortletMode().toString();
|
||||
|
||||
@@ -358,11 +358,10 @@ public class RestActionInvocation extends DefaultActionInvocation {
|
||||
ResultConfig resultConfig = this.proxy.getConfig().getResults()
|
||||
.get(defaultErrorResultName);
|
||||
if (resultConfig != null) {
|
||||
this.result = objectFactory.buildResult(resultConfig,
|
||||
invocationContext.getContextMap());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Found default error result.");
|
||||
}
|
||||
this.result = objectFactory.buildResult(resultConfig, invocationContext.getContextMap());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Found default error result.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,7 +445,9 @@ public class RestActionInvocation extends DefaultActionInvocation {
|
||||
message += "] took " + total + " ms (execution: " + executionTime
|
||||
+ " ms, result: " + processResult + " ms)";
|
||||
|
||||
LOG.info(message);
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,9 @@ public class SiteGraph {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
LOG.info("SiteGraph starting...");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("SiteGraph starting...");
|
||||
}
|
||||
|
||||
if (args.length != 8 && args.length != 6) {
|
||||
InputStream is = SiteGraph.class.getResourceAsStream("sitegraph-usage.txt");
|
||||
|
||||
+3
-1
@@ -104,7 +104,9 @@ public abstract class FileBasedView implements View {
|
||||
|
||||
return buffer.toString();
|
||||
} catch (FileNotFoundException e) {
|
||||
LOG.warn("File not found");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("File not found");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("Cannot read file: "+file, e);
|
||||
}
|
||||
|
||||
+6
-2
@@ -109,7 +109,9 @@ public class ClassReloadingXMLWebApplicationContext extends XmlWebApplicationCon
|
||||
classLoader.addResourceStore(new JarResourceStore(file));
|
||||
//register with the fam
|
||||
fam.addListener(file, this);
|
||||
LOG.debug("Watching [#0] for changes", file.getAbsolutePath());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Watching [#0] for changes", file.getAbsolutePath());
|
||||
}
|
||||
} else {
|
||||
//get all subdirs
|
||||
List<File> dirs = new ArrayList<File>();
|
||||
@@ -120,7 +122,9 @@ public class ClassReloadingXMLWebApplicationContext extends XmlWebApplicationCon
|
||||
for (File dir : dirs) {
|
||||
//register with the fam
|
||||
fam.addListener(dir, this);
|
||||
LOG.debug("Watching [#0] for changes", dir.getAbsolutePath());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Watching [#0] for changes", dir.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-3
@@ -73,7 +73,9 @@ public class StrutsSpringObjectFactory extends SpringObjectFactory {
|
||||
|
||||
super();
|
||||
boolean useClassCache = "true".equals(useClassCacheStr);
|
||||
LOG.info("Initializing Struts-Spring integration...");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Initializing Struts-Spring integration...");
|
||||
}
|
||||
|
||||
Object rootWebApplicationContext = servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
|
||||
|
||||
@@ -109,7 +111,9 @@ public class StrutsSpringObjectFactory extends SpringObjectFactory {
|
||||
|
||||
ClassReloadingXMLWebApplicationContext reloadingContext = (ClassReloadingXMLWebApplicationContext) appContext;
|
||||
reloadingContext.setupReloading(watchList.split(","), acceptClasses, servletContext, "true".equals(reloadConfig));
|
||||
LOG.info("Class reloading is enabled. Make sure this is not used on a production environment!", watchList);
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Class reloading is enabled. Make sure this is not used on a production environment!", watchList);
|
||||
}
|
||||
|
||||
setClassLoader(reloadingContext.getReloadingClassLoader());
|
||||
|
||||
@@ -137,6 +141,8 @@ public class StrutsSpringObjectFactory extends SpringObjectFactory {
|
||||
|
||||
this.setAlwaysRespectAutowireStrategy("true".equalsIgnoreCase(alwaysAutoWire));
|
||||
|
||||
LOG.info("... initialized Struts-Spring integration successfully");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("... initialized Struts-Spring integration successfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,9 @@ public class StrutsTilesListener extends TilesListener {
|
||||
context = decorate(context);
|
||||
}
|
||||
else {
|
||||
LOG.warn("Tiles container factory is explicitly set. Not injecting struts configuration.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Tiles container factory is explicitly set. Not injecting struts configuration.");
|
||||
}
|
||||
}
|
||||
return super.createContainer(context);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,9 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex
|
||||
if (ctx != null) {
|
||||
return ctx.getLocale();
|
||||
} else {
|
||||
LOG.debug("Action context not initialized");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Action context not initialized");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,9 @@ public class ConfigurationManager {
|
||||
containerProvider.destroy();
|
||||
}
|
||||
catch(Exception e) {
|
||||
LOG.warn("error while destroying container provider ["+containerProvider+"]", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("error while destroying container provider ["+containerProvider+"]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
containerProviders.clear();
|
||||
@@ -261,7 +263,9 @@ public class ConfigurationManager {
|
||||
containerProvider.destroy();
|
||||
}
|
||||
catch(Exception e) {
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("error while destroying configuration provider ["+containerProvider+"]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
packageProviders = configuration.reloadContainer(providers);
|
||||
|
||||
+1
-1
@@ -467,7 +467,7 @@ public class DefaultConfiguration implements Configuration {
|
||||
@Override
|
||||
public Object setProperty(String key, String value) {
|
||||
String oldValue = getProperty(key);
|
||||
if (oldValue != null && !oldValue.equals(value) && !defaultFrameworkBeanName.equals(oldValue)) {
|
||||
if (LOG.isInfoEnabled() && oldValue != null && !oldValue.equals(value) && !defaultFrameworkBeanName.equals(oldValue)) {
|
||||
LOG.info("Overriding property "+key+" - old value: "+oldValue+" new value: "+value);
|
||||
}
|
||||
return super.setProperty(key, value);
|
||||
|
||||
+6
-2
@@ -70,9 +70,11 @@ public class InterceptorBuilder {
|
||||
inter = objectFactory.buildInterceptor(config, refParams);
|
||||
result.add(new InterceptorMapping(refName, inter));
|
||||
} catch (ConfigurationException ex) {
|
||||
LOG.warn("Unable to load config class " + config.getClassName() + " at " +
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unable to load config class " + config.getClassName() + " at " +
|
||||
ex.getLocation() + " probably due to a missing jar, which might " +
|
||||
"be fine if you never plan to use the " + config.getName() + " interceptor");
|
||||
}
|
||||
LOG.error("Actual exception", ex);
|
||||
}
|
||||
|
||||
@@ -147,7 +149,9 @@ public class InterceptorBuilder {
|
||||
params.put(name, map);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.warn("No interceptor found for name = " + key);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("No interceptor found for name = " + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+21
-7
@@ -160,7 +160,9 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
|
||||
}
|
||||
|
||||
public void register(ContainerBuilder containerBuilder, LocatableProperties props) throws ConfigurationException {
|
||||
LOG.info("Parsing configuration file [" + configFileName + "]");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Parsing configuration file [" + configFileName + "]");
|
||||
}
|
||||
Map<String, Node> loadedBeans = new HashMap<String, Node>();
|
||||
for (Document doc : documents) {
|
||||
Element rootElement = doc.getDocumentElement();
|
||||
@@ -346,7 +348,9 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
|
||||
Location location = DomHelper.getLocationObject(actionElement);
|
||||
|
||||
if (location == null) {
|
||||
LOG.warn("location null for " + className);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("location null for " + className);
|
||||
}
|
||||
}
|
||||
//methodName should be null if it's not set
|
||||
methodName = (methodName.trim().length() > 0) ? methodName.trim() : null;
|
||||
@@ -425,7 +429,9 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
|
||||
throw new ConfigurationException("Action class [" + className + "] does not have a public no-arg constructor", e, loc);
|
||||
} catch (RuntimeException ex) {
|
||||
// Probably not a big deal, like request or session-scoped Spring 2 beans that need a real request
|
||||
LOG.info("Unable to verify action class [" + className + "] exists at initialization");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Unable to verify action class [" + className + "] exists at initialization");
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Action verification cause", ex);
|
||||
}
|
||||
@@ -529,11 +535,15 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
|
||||
try {
|
||||
return objectFactory.getClassInstance(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
LOG.warn("Result class [" + className + "] doesn't exist (ClassNotFoundException) at " +
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Result class [" + className + "] doesn't exist (ClassNotFoundException) at " +
|
||||
loc.toString() + ", ignoring", e);
|
||||
}
|
||||
} catch (NoClassDefFoundError e) {
|
||||
LOG.warn("Result class [" + className + "] doesn't exist (NoClassDefFoundError) at " +
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Result class [" + className + "] doesn't exist (NoClassDefFoundError) at " +
|
||||
loc.toString() + ", ignoring", e);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -665,7 +675,9 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
|
||||
resultParams.put(paramName, val);
|
||||
}
|
||||
} else {
|
||||
LOG.warn("no default parameter defined for result of type " + config.getName());
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("no default parameter defined for result of type " + config.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -885,8 +897,10 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
|
||||
if (errorIfMissing) {
|
||||
throw new ConfigurationException("Could not open files of the name " + fileName, ioException);
|
||||
} else {
|
||||
LOG.info("Unable to locate configuration files of the name "
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Unable to locate configuration files of the name "
|
||||
+ fileName + ", skipping");
|
||||
}
|
||||
return docs;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ public class DefaultObjectTypeDeterminer implements ObjectTypeDeterminer {
|
||||
clazz = (Class) xworkConverter
|
||||
.getConverter(parentClass, DEPRECATED_ELEMENT_PREFIX + property);
|
||||
|
||||
if (clazz != null) {
|
||||
if (LOG.isInfoEnabled() && clazz != null) {
|
||||
LOG.info("The Collection_xxx pattern for collection type conversion is deprecated. Please use Element_xxx!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,9 @@ public class AliasInterceptor extends AbstractInterceptor {
|
||||
if (clearableStack && (stack.getContext() != null) && (newStack.getContext() != null))
|
||||
stack.getContext().put(ActionContext.CONVERSION_ERRORS, newStack.getContext().get(ActionContext.CONVERSION_ERRORS));
|
||||
} else {
|
||||
LOG.debug("invalid alias expression:" + aliasesKey);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("invalid alias expression:" + aliasesKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -79,7 +79,9 @@ public class LoggingInterceptor extends AbstractInterceptor {
|
||||
}
|
||||
|
||||
message.append(invocation.getProxy().getActionName());
|
||||
LOG.info(message.toString());
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info(message.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +244,9 @@ public class OgnlUtil {
|
||||
*/
|
||||
public void copy(Object from, Object to, Map<String, Object> context, Collection<String> exclusions, Collection<String> inclusions) {
|
||||
if (from == null || to == null) {
|
||||
LOG.warn("Attempting to copy from or to a null source. This is illegal and is bein skipped. This may be due to an error in an OGNL expression, action chaining, or some other event.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Attempting to copy from or to a null source. This is illegal and is bein skipped. This may be due to an error in an OGNL expression, action chaining, or some other event.");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
+11
-3
@@ -81,7 +81,9 @@ public class XWorkCollectionPropertyAccessor extends SetPropertyAccessor {
|
||||
public Object getProperty(Map context, Object target, Object key)
|
||||
throws OgnlException {
|
||||
|
||||
LOG.debug("Entering getProperty()");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Entering getProperty()");
|
||||
}
|
||||
|
||||
//check if it is a generic type property.
|
||||
//if so, return the value from the
|
||||
@@ -185,13 +187,19 @@ public class XWorkCollectionPropertyAccessor extends SetPropertyAccessor {
|
||||
*/
|
||||
private Map getSetMap(Map context, Collection collection, String property, Class valueClass)
|
||||
throws OgnlException {
|
||||
LOG.debug("getting set Map");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("getting set Map");
|
||||
}
|
||||
|
||||
String path = ReflectionContextState.getCurrentPropertyPath(context);
|
||||
Map map = ReflectionContextState.getSetMap(context,
|
||||
path);
|
||||
|
||||
if (map == null) {
|
||||
LOG.debug("creating set Map");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("creating set Map");
|
||||
}
|
||||
|
||||
map = new HashMap();
|
||||
map.put(null, new SurrugateList(collection));
|
||||
for (Object currTest : collection) {
|
||||
|
||||
@@ -74,23 +74,33 @@ public class SpringObjectFactory extends ObjectFactory implements ApplicationCon
|
||||
public void setAutowireStrategy(int autowireStrategy) {
|
||||
switch (autowireStrategy) {
|
||||
case AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT:
|
||||
LOG.info("Setting autowire strategy to autodetect");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Setting autowire strategy to autodetect");
|
||||
}
|
||||
this.autowireStrategy = autowireStrategy;
|
||||
break;
|
||||
case AutowireCapableBeanFactory.AUTOWIRE_BY_NAME:
|
||||
LOG.info("Setting autowire strategy to name");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Setting autowire strategy to name");
|
||||
}
|
||||
this.autowireStrategy = autowireStrategy;
|
||||
break;
|
||||
case AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE:
|
||||
LOG.info("Setting autowire strategy to type");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Setting autowire strategy to type");
|
||||
}
|
||||
this.autowireStrategy = autowireStrategy;
|
||||
break;
|
||||
case AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR:
|
||||
LOG.info("Setting autowire strategy to constructor");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Setting autowire strategy to constructor");
|
||||
}
|
||||
this.autowireStrategy = autowireStrategy;
|
||||
break;
|
||||
case AutowireCapableBeanFactory.AUTOWIRE_NO:
|
||||
LOG.info("Setting autowire strategy to none");
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Setting autowire strategy to none");
|
||||
}
|
||||
this.autowireStrategy = autowireStrategy;
|
||||
break;
|
||||
default:
|
||||
|
||||
+3
-1
@@ -66,7 +66,9 @@ public class SpringProxyableObjectFactory extends SpringObjectFactory {
|
||||
try {
|
||||
return anAppContext.getBean(beanName);
|
||||
} catch (NoSuchBeanDefinitionException e2) {
|
||||
LOG.warn("Could not register new bean definition for bean " + beanName);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not register new bean definition for bean " + beanName);
|
||||
}
|
||||
skipBeanNames.add(beanName);
|
||||
}
|
||||
} catch (ClassNotFoundException e1) {
|
||||
|
||||
+3
-1
@@ -97,7 +97,9 @@ public class ActionAutowiringInterceptor extends AbstractInterceptor implements
|
||||
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
|
||||
|
||||
if (applicationContext == null) {
|
||||
LOG.warn("ApplicationContext could not be found. Action classes will not be autowired.");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("ApplicationContext could not be found. Action classes will not be autowired.");
|
||||
}
|
||||
} else {
|
||||
setApplicationContext(applicationContext);
|
||||
factory = new SpringObjectFactory();
|
||||
|
||||
@@ -294,7 +294,9 @@ public class FileManager {
|
||||
separatorIndex = fileName.lastIndexOf(JAR_FILE_EXTENSION_END);
|
||||
}
|
||||
if (separatorIndex == -1) {
|
||||
LOG.warn("Could not find end of jar file!");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not find end of jar file!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// Split file name
|
||||
@@ -311,7 +313,9 @@ public class FileManager {
|
||||
return null;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
LOG.warn("Could not create JarEntryRevision for [" + jarFileName + "]!", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not create JarEntryRevision for [" + jarFileName + "]!", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +407,9 @@ public class LocalizedTextUtil {
|
||||
ValueStack valueStack) {
|
||||
String indexedTextName = null;
|
||||
if (aTextName == null) {
|
||||
LOG.warn("Trying to find text with null key!");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Trying to find text with null key!");
|
||||
}
|
||||
aTextName = "";
|
||||
}
|
||||
// calculate indexedTextName (collection[*]) if applicable
|
||||
@@ -537,7 +539,7 @@ public class LocalizedTextUtil {
|
||||
}
|
||||
|
||||
// could we find the text, if not log a warn
|
||||
if (unableToFindTextForKey(result)) {
|
||||
if (unableToFindTextForKey(result) && LOG.isDebugEnabled()) {
|
||||
String warn = "Unable to find text for key '" + aTextName + "' ";
|
||||
if (indexedTextName != null) {
|
||||
warn += " or indexed key '" + indexedTextName + "' ";
|
||||
@@ -632,7 +634,7 @@ public class LocalizedTextUtil {
|
||||
}
|
||||
|
||||
GetDefaultMessageReturnArg result = getDefaultMessage(aTextName, locale, valueStack, args, defaultMessage);
|
||||
if (unableToFindTextForKey(result)) {
|
||||
if (LOG.isWarnEnabled() && unableToFindTextForKey(result)) {
|
||||
LOG.warn("Unable to find text for key '" + aTextName + "' in ResourceBundles for locale '" + locale + "'");
|
||||
}
|
||||
return result != null ? result.message : null;
|
||||
@@ -803,7 +805,9 @@ public class LocalizedTextUtil {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("couldn't clear tomcat cache", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("couldn't clear tomcat cache", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -322,7 +322,9 @@ public class ResolverUtil<T> {
|
||||
urls = loader.getResources(packageName);
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
LOG.warn("Could not read package: " + packageName, ioe);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not read package: " + packageName, ioe);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -341,7 +343,9 @@ public class ResolverUtil<T> {
|
||||
urlPath = urlPath.substring(0, urlPath.indexOf('!'));
|
||||
}
|
||||
|
||||
LOG.info("Scanning for classes in [" + urlPath + "] matching criteria: " + test);
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Scanning for classes in [" + urlPath + "] matching criteria: " + test);
|
||||
}
|
||||
File file = new File(urlPath);
|
||||
if ( file.isDirectory() ) {
|
||||
loadImplementationsInDirectory(test, packageName, file);
|
||||
@@ -351,7 +355,9 @@ public class ResolverUtil<T> {
|
||||
}
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
LOG.warn("could not read entries", ioe);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("could not read entries", ioe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -451,8 +457,10 @@ public class ResolverUtil<T> {
|
||||
}
|
||||
}
|
||||
catch (Throwable t) {
|
||||
LOG.warn("Could not examine class '" + fqn + "' due to a " +
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Could not examine class '" + fqn + "' due to a " +
|
||||
t.getClass().getName() + " with message: " + t.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,7 +355,9 @@ public class UtilTimerStack
|
||||
{
|
||||
printTimes(currentTimer);
|
||||
current.set(null); //prevent printing multiple times
|
||||
LOG.warn("Unmatched Timer. Was expecting " + currentTimer.getResource() + ", instead got " + name);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("Unmatched Timer. Was expecting " + currentTimer.getResource() + ", instead got " + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,7 +371,9 @@ public class UtilTimerStack
|
||||
*/
|
||||
private static void printTimes(ProfilingTimerBean currentTimer)
|
||||
{
|
||||
LOG.info(currentTimer.getPrintable(getMinTime()));
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info(currentTimer.getPrintable(getMinTime()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-1
@@ -231,7 +231,9 @@ public class DefaultValidatorFileParser implements ValidatorFileParser {
|
||||
if (messageParams != null && (messageParams.size() > 0)) {
|
||||
// we are i18n message parameters defined but no i18n message,
|
||||
// let's warn the user.
|
||||
LOG.warn("validator of type ["+validatorType+"] have i18n message parameters defined but no i18n message key, it's parameters will be ignored");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("validator of type ["+validatorType+"] have i18n message parameters defined but no i18n message key, it's parameters will be ignored");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -240,7 +240,9 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
|
||||
catch(Exception e) {
|
||||
// If any exception occurred while doing reflection, we want
|
||||
// validate() to be executed
|
||||
LOG.warn("an exception occured while executing the prefix method", e);
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("an exception occured while executing the prefix method", e);
|
||||
}
|
||||
exception = e;
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -174,7 +174,9 @@ public abstract class RepopulateConversionErrorFieldValidatorSupport extends Fie
|
||||
doExprOverride = true;
|
||||
fakeParams.put(fullFieldName, "'" + tmpValue[0] + "'");
|
||||
} else {
|
||||
LOG.warn("value is an empty array of String or with first element in it as null [" + value + "], will not repopulate conversion error ");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("value is an empty array of String or with first element in it as null [" + value + "], will not repopulate conversion error ");
|
||||
}
|
||||
}
|
||||
} else if (value instanceof String) {
|
||||
String tmpValue = (String) value;
|
||||
@@ -182,7 +184,9 @@ public abstract class RepopulateConversionErrorFieldValidatorSupport extends Fie
|
||||
fakeParams.put(fullFieldName, "'" + tmpValue + "'");
|
||||
} else {
|
||||
// opps... it should be
|
||||
LOG.warn("conversion error value is not a String or array of String but instead is [" + value + "], will not repopulate conversion error");
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("conversion error value is not a String or array of String but instead is [" + value + "], will not repopulate conversion error");
|
||||
}
|
||||
}
|
||||
|
||||
if (doExprOverride) {
|
||||
|
||||
Reference in New Issue
Block a user