You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2019/03/03 10:36:42 UTC
svn commit: r1854688 [3/3] - in /turbine/core/trunk: ./ src/changes/
src/java/org/apache/turbine/ src/java/org/apache/turbine/annotation/
src/java/org/apache/turbine/modules/actions/
src/java/org/apache/turbine/modules/actions/sessionvalidator/ src/jav...
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/ui/TurbineUIService.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/ui/TurbineUIService.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/ui/TurbineUIService.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/ui/TurbineUIService.java Sun Mar 3 10:36:42 2019
@@ -27,8 +27,8 @@ import java.util.concurrent.ConcurrentHa
import org.apache.commons.configuration2.Configuration;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.TurbineBaseService;
@@ -60,7 +60,7 @@ public class TurbineUIService
implements UIService
{
/** Logging. */
- private static Log log = LogFactory.getLog(TurbineUIService.class);
+ private static final Logger log = LogManager.getLogger(TurbineUIService.class);
/**
* The location of the skins within the application resources directory.
@@ -271,8 +271,7 @@ public class TurbineUIService
skins.remove(SKIN_PROPERTY_DEFAULT);
}
skins.remove(skinName);
- log.debug("The skin \"" + skinName
- + "\" was cleared (will also clear \"default\" skin).");
+ log.debug("The skin \"{}\" was cleared (will also clear \"default\" skin).", skinName);
}
/**
@@ -300,10 +299,7 @@ public class TurbineUIService
sb.append('/').append(skinsDirectory);
sb.append('/').append(skinName);
sb.append('/').append(SKIN_PROPS_FILE);
- if (log.isDebugEnabled())
- {
- log.debug("Loading selected skin from: " + sb.toString());
- }
+ log.debug("Loading selected skin from: {}", sb::toString);
try (InputStream is = servletService.getResourceAsStream(sb.toString()))
{
@@ -313,18 +309,16 @@ public class TurbineUIService
}
catch (Exception e)
{
- log.error("Cannot load skin: " + skinName + ", from: "
- + sb.toString(), e);
+ log.error("Cannot load skin: {}, from: {}", skinName, sb.toString(), e);
if (!StringUtils.equals(skinName, getWebappSkinName())
&& !StringUtils.equals(skinName, SKIN_PROPERTY_DEFAULT))
{
- log.error("Attempting to return the skin configured for "
- + "webapp instead of " + skinName);
+ log.error("Attempting to return the skin configured for webapp instead of {}", skinName);
return getSkinProperties(getWebappSkinName());
}
else if (!StringUtils.equals(skinName, SKIN_PROPERTY_DEFAULT))
{
- log.error("Return the default skin instead of " + skinName);
+ log.error("Return the default skin instead of {}", skinName);
return skinProperties; // Already contains the default skin.
}
else
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/uniqueid/TurbineUniqueIdService.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/uniqueid/TurbineUniqueIdService.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/uniqueid/TurbineUniqueIdService.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/uniqueid/TurbineUniqueIdService.java Sun Mar 3 10:36:42 2019
@@ -23,11 +23,9 @@ package org.apache.turbine.services.uniq
import java.security.MessageDigest;
-
import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.TurbineBaseService;
@@ -45,7 +43,7 @@ public class TurbineUniqueIdService
implements UniqueIdService
{
/** Logging */
- private static Log log = LogFactory.getLog(TurbineUniqueIdService.class);
+ private static final Logger log = LogManager.getLogger(TurbineUniqueIdService.class);
/** The identifier of this instance of turbine. */
protected static String turbineId = "UNKNOWN";
@@ -77,8 +75,8 @@ public class TurbineUniqueIdService
byte [] bytesId = md.digest(url.getBytes("UTF-8"));
turbineId = new String(Base64.encodeBase64(bytesId),"UTF-8");
- log.info("This is Turbine instance running at: " + url);
- log.info("The instance id is #" + turbineId);
+ log.info("This is Turbine instance running at: {}", url);
+ log.info("The instance id is #{}", turbineId);
setInit(true);
}
catch (Exception e)
@@ -94,7 +92,7 @@ public class TurbineUniqueIdService
@Override
public void shutdown()
{
- log.info("Turbine instance running at " + turbineURL + " shutting down.");
+ log.info("Turbine instance running at {} shutting down.", turbineURL);
}
/**
@@ -107,6 +105,7 @@ public class TurbineUniqueIdService
*
* @return A String with the instance identifier.
*/
+ @Override
public String getInstanceId()
{
return turbineId;
@@ -119,6 +118,7 @@ public class TurbineUniqueIdService
* @return A String with the non-random looking instance
* identifier.
*/
+ @Override
public String getUniqueId()
{
int current;
@@ -142,6 +142,7 @@ public class TurbineUniqueIdService
*
* @return A String with the random looking instance identifier.
*/
+ @Override
public String getPseudorandomId()
{
return GenerateUniqueId.getIdentifier();
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java Sun Mar 3 10:36:42 2019
@@ -30,8 +30,8 @@ import java.util.List;
import org.apache.commons.configuration2.Configuration;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.InitializationException;
@@ -92,7 +92,7 @@ public class TurbineVelocityService
private static final String ABSOLUTE_PREFIX = "file://";
/** Logging */
- private static final Log log = LogFactory.getLog(TurbineVelocityService.class);
+ private static final Logger log = LogManager.getLogger(TurbineVelocityService.class);
/** Encoding used when reading the templates. */
private String defaultInputEncoding;
@@ -211,7 +211,7 @@ public class TurbineVelocityService
@Override
public Object methodException(Context context, @SuppressWarnings("rawtypes") Class clazz, String method, Exception e, Info info)
{
- log.error("Class " + clazz.getName() + "." + method + " threw Exception", e);
+ log.error("Class {}.{} threw Exception", clazz.getName(), method, e);
if (!catchErrors)
{
@@ -529,7 +529,7 @@ public class TurbineVelocityService
for (Object p : paths)
{
String path = (String)p;
- log.debug("Translating " + path);
+ log.debug("Translating {}", path);
if (path.startsWith(JAR_PREFIX))
{
@@ -545,7 +545,7 @@ public class TurbineVelocityService
// Add the path after the jar path separator again to the new url.
: (Turbine.getRealPath(path.substring(11, jarSepIndex)) + path.substring(jarSepIndex));
- log.debug("Result (absolute jar path): " + path);
+ log.debug("Result (absolute jar path): {}", path);
}
}
else if(path.startsWith(ABSOLUTE_PREFIX))
@@ -553,17 +553,17 @@ public class TurbineVelocityService
// skip file:// -> 7 chars
path = Turbine.getRealPath(path.substring(7));
- log.debug("Result (absolute URL Path): " + path);
+ log.debug("Result (absolute URL Path): {}", path);
}
// Test if this might be some sort of URL that we haven't encountered yet.
else if(path.indexOf("://") < 0)
{
path = Turbine.getRealPath(path);
- log.debug("Result (normal fs reference): " + path);
+ log.debug("Result (normal fs reference): {}", path);
}
- log.debug("Adding " + key + " -> " + path);
+ log.debug("Adding {} -> {}", key, path);
// Re-Add this property to the configuration object
velocity.addProperty(key, path);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java Sun Mar 3 10:36:42 2019
@@ -1,5 +1,7 @@
package org.apache.turbine.util;
+import java.util.ArrayList;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,7 +24,6 @@ package org.apache.turbine.util;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
-import java.util.ArrayList;
/**
* Used for adding and accessing messages that relate to a specific form and field. Allows to query for messages by form
@@ -73,11 +74,11 @@ public class FormMessages
*/
public void setMessage( String formName, String fieldName, String messageName )
{
- fieldName = formName + "-" + fieldName;
+ String formFieldName = formName + "-" + fieldName;
addValue( forms_messages, formName, messageName );
- addValue( fields_messages, fieldName, messageName );
- addValue( messages_fields, messageName, fieldName );
- addValue( forms_fields, formName, fieldName );
+ addValue( fields_messages, formFieldName, messageName );
+ addValue( messages_fields, messageName, formFieldName );
+ addValue( forms_fields, formName, formFieldName );
}
/**
@@ -101,7 +102,9 @@ public class FormMessages
{
values = table.get( key );
if ( !values.contains( value ) )
+ {
values.add( value );
+ }
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/InputFilterUtils.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/InputFilterUtils.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/InputFilterUtils.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/InputFilterUtils.java Sun Mar 3 10:36:42 2019
@@ -21,8 +21,8 @@ package org.apache.turbine.util;
*/
-import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringEscapeUtils;
/**
* Some filter methods that have been orphaned in the Screen class.
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/LocaleUtils.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/LocaleUtils.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/LocaleUtils.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/LocaleUtils.java Sun Mar 3 10:36:42 2019
@@ -22,9 +22,9 @@ package org.apache.turbine.util;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.fulcrum.mimetype.MimeTypeService;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.services.ServiceManager;
@@ -38,7 +38,7 @@ import org.apache.turbine.services.Turbi
public class LocaleUtils
{
/** Logging */
- private static Log log = LogFactory.getLog(LocaleUtils.class);
+ private static final Logger log = LogManager.getLogger(LocaleUtils.class);
/** The default locale. */
private static Locale defaultLocale = null;
@@ -58,10 +58,7 @@ public class LocaleUtils
.getString(TurbineConstants.PARAMETER_ENCODING_KEY,
TurbineConstants.PARAMETER_ENCODING_DEFAULT);
- if (log.isDebugEnabled())
- {
- log.debug("Input Encoding has been set to " + inputEncoding);
- }
+ log.debug("Input Encoding has been set to {}", inputEncoding);
return inputEncoding;
}
@@ -109,7 +106,7 @@ public class LocaleUtils
defaultCharSet = Turbine.getConfiguration()
.getString(TurbineConstants.LOCALE_DEFAULT_CHARSET_KEY,
TurbineConstants.LOCALE_DEFAULT_CHARSET_DEFAULT);
- log.debug("defaultCharSet = " + defaultCharSet + " (From Properties)");
+ log.debug("defaultCharSet = {} (From Properties)", defaultCharSet);
}
String charset = defaultCharSet;
@@ -119,7 +116,7 @@ public class LocaleUtils
log.debug("Default charset is empty!");
/* Default charset isn't specified, get the locale specific one. */
Locale locale = getDefaultLocale();
- log.debug("Locale is " + locale);
+ log.debug("Locale is {}", locale);
if (!locale.equals(Locale.US))
{
@@ -136,11 +133,11 @@ public class LocaleUtils
}
charset = mimeTypeService.getCharSet(locale);
- log.debug("Charset now " + charset);
+ log.debug("Charset now {}", charset);
}
}
- log.debug("Returning default Charset of " + charset);
+ log.debug("Returning default Charset of {}", charset);
return charset;
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/ServerData.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/ServerData.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/ServerData.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/ServerData.java Sun Mar 3 10:36:42 2019
@@ -24,10 +24,8 @@ package org.apache.turbine.util;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.util.uri.URIConstants;
/**
@@ -59,7 +57,7 @@ public class ServerData
private String contextPath = null;
/** Logging */
- private static Log log = LogFactory.getLog(ServerData.class);
+ private static final Logger log = LogManager.getLogger(ServerData.class);
/**
* Constructor.
@@ -78,19 +76,11 @@ public class ServerData
{
if (log.isDebugEnabled())
{
- StringBuilder sb = new StringBuilder();
- sb.append("Constructor(");
- sb.append(serverName);
- sb.append(", ");
- sb.append(serverPort);
- sb.append(", ");
- sb.append(serverScheme);
- sb.append(", ");
- sb.append(scriptName);
- sb.append(", ");
- sb.append(contextPath);
- sb.append(")");
- log.debug(sb.toString());
+ log.debug("Constructor({}, {}, {}, {}, {})", serverName,
+ Integer.valueOf(serverPort),
+ serverScheme,
+ scriptName,
+ contextPath);
}
setServerName(serverName);
@@ -107,7 +97,7 @@ public class ServerData
*/
public ServerData(ServerData serverData)
{
- log.debug("Copy Constructor(" + serverData + ")");
+ log.debug("Copy Constructor({})", serverData);
setServerName(serverData.getServerName());
setServerPort(serverData.getServerPort());
@@ -136,6 +126,7 @@ public class ServerData
*
* @return A cloned object.
*/
+ @Override
public Object clone()
{
log.debug("clone()");
@@ -159,7 +150,7 @@ public class ServerData
*/
public void setServerName(String serverName)
{
- log.debug("setServerName(" + serverName + ")");
+ log.debug("setServerName({})", serverName);
this.serverName = serverName;
}
@@ -180,7 +171,7 @@ public class ServerData
*/
public void setServerPort(int serverPort)
{
- log.debug("setServerPort(" + serverPort + ")");
+ log.debug("setServerPort({})", Integer.valueOf(serverPort));
this.serverPort = serverPort;
}
@@ -191,7 +182,7 @@ public class ServerData
*/
public String getServerScheme()
{
- return StringUtils.isEmpty(serverScheme) ? "" : serverScheme;
+ return StringUtils.defaultIfEmpty(serverScheme, "");
}
/**
@@ -201,7 +192,7 @@ public class ServerData
*/
public void setServerScheme(String serverScheme)
{
- log.debug("setServerScheme(" + serverScheme + ")");
+ log.debug("setServerScheme({})", serverScheme);
this.serverScheme = serverScheme;
}
@@ -212,7 +203,7 @@ public class ServerData
*/
public String getScriptName()
{
- return StringUtils.isEmpty(scriptName) ? "" : scriptName;
+ return StringUtils.defaultIfEmpty(scriptName, "");
}
/**
@@ -222,7 +213,7 @@ public class ServerData
*/
public void setScriptName(String scriptName)
{
- log.debug("setScriptName(" + scriptName + ")");
+ log.debug("setScriptName({})", scriptName);
this.scriptName = scriptName;
}
@@ -233,7 +224,7 @@ public class ServerData
*/
public String getContextPath()
{
- return StringUtils.isEmpty(contextPath) ? "" : contextPath;
+ return StringUtils.defaultIfEmpty(contextPath, "");
}
/**
@@ -243,7 +234,7 @@ public class ServerData
*/
public void setContextPath(String contextPath)
{
- log.debug("setContextPath(" + contextPath + ")");
+ log.debug("setContextPath({})", contextPath);
this.contextPath = contextPath;
}
@@ -274,6 +265,7 @@ public class ServerData
*
* @return The contents of this object as a String
*/
+ @Override
public String toString()
{
StringBuilder url = new StringBuilder();
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/ServletUtils.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/ServletUtils.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/ServletUtils.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/ServletUtils.java Sun Mar 3 10:36:42 2019
@@ -63,6 +63,8 @@ public class ServletUtils
return null;
}
+ final String expandedText;
+
// attempt to make it relative
if (!text.startsWith("/") && !text.startsWith("./")
&& !text.startsWith("\\") && !text.startsWith(".\\"))
@@ -70,22 +72,23 @@ public class ServletUtils
StringBuilder sb = new StringBuilder();
sb.append("./");
sb.append(text);
- text = sb.toString();
+ expandedText = sb.toString();
+ }
+ else
+ {
+ expandedText = text;
}
ServletContext context = config.getServletContext();
- String base = context.getRealPath("/");
-
- base = (StringUtils.isEmpty(base))
- ? Turbine.getApplicationRoot()
- : base;
+ String base = StringUtils.defaultIfEmpty(context.getRealPath("/"),
+ Turbine.getApplicationRoot());
if (StringUtils.isEmpty(base))
{
- return text;
+ return expandedText;
}
- StringTokenizer tokenizer = new StringTokenizer(text, File.pathSeparator);
+ StringTokenizer tokenizer = new StringTokenizer(expandedText, File.pathSeparator);
StringBuilder buffer = new StringBuilder();
while (tokenizer.hasMoreTokens())
{
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java Sun Mar 3 10:36:42 2019
@@ -50,8 +50,8 @@ import javax.servlet.descriptor.JspConfi
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.annotation.TurbineConfiguration;
@@ -62,11 +62,11 @@ import org.apache.turbine.annotation.Tur
* If you need to use Turbine outside of a servlet container, you can
* use this class for initialization of the Turbine servlet.
* </p>
- *
+ *
* <pre>
* TurbineConfig config = new TurbineConfig(".", "conf/TurbineResources.properties");
* </pre>
- *
+ *
* <p>
* All paths referenced in TurbineResources.properties and the path to
* the properties file itself (the second argument) will be resolved
@@ -75,7 +75,7 @@ import org.apache.turbine.annotation.Tur
* discarding the references to objects created above. They are not needed,
* once everything is initialized.
* </p>
- *
+ *
* <p>
* In order to initialize the Services Framework outside of the Turbine Servlet,
* you need to call the <code>init()</code> method. By default, this will
@@ -96,7 +96,7 @@ import org.apache.turbine.annotation.Tur
public class TurbineConfig
implements ServletConfig, ServletContext, Initializable, Disposable
{
-
+
@TurbineConfiguration( TurbineConstants.SESSION_TIMEOUT_KEY )
protected int timeout = TurbineConstants.SESSION_TIMEOUT_DEFAULT;
@@ -132,7 +132,7 @@ public class TurbineConfig
private Turbine turbine;
/** Logging */
- private final Log log = LogFactory.getLog(this.getClass());
+ private final Logger log = LogManager.getLogger(this.getClass());
/**
* Constructs a new TurbineConfig.
@@ -269,16 +269,8 @@ public class TurbineConfig
if (log.isDebugEnabled())
{
- StringBuilder sb = new StringBuilder();
-
- sb.append("TurbineConfig.getRealPath: path '");
- sb.append(path);
- sb.append("' translated to '");
- sb.append(f.getPath());
- sb.append("' ");
- sb.append(f.exists() ? "" : "not ");
- sb.append("found");
- log.debug(sb.toString());
+ log.debug("TurbineConfig.getRealPath: path '{}' translated to '{}' {}found",
+ path, f.getPath(), f.exists() ? "" : "not ");
}
if (f.exists())
@@ -287,7 +279,7 @@ public class TurbineConfig
}
else
{
- log.error("getRealPath(\"" + path + "\") is undefined, returning null");
+ log.error("getRealPath(\"{}\") is undefined, returning null", path);
}
return result;
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateNavigation.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateNavigation.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateNavigation.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateNavigation.java Sun Mar 3 10:36:42 2019
@@ -1,6 +1,8 @@
package org.apache.turbine.util.template;
+import org.apache.logging.log4j.LogManager;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,8 +23,7 @@ package org.apache.turbine.util.template
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.modules.NavigationLoader;
import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.services.template.TemplateService;
@@ -45,7 +46,7 @@ import org.apache.turbine.util.RunData;
public class TemplateNavigation
{
/** Logging */
- private static Log log = LogFactory.getLog(TemplateNavigation.class);
+ private static final Logger log = LogManager.getLogger(TemplateNavigation.class);
/* The RunData object. */
private RunData data;
@@ -72,7 +73,7 @@ public class TemplateNavigation
*/
public TemplateNavigation setTemplate(String template)
{
- log.debug("setTemplate(" + template + ")");
+ log.debug("setTemplate({})", template);
this.template = template;
return this;
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateScreen.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateScreen.java Sun Mar 3 10:36:42 2019
@@ -1,6 +1,8 @@
package org.apache.turbine.util.template;
+import org.apache.logging.log4j.LogManager;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,8 +23,7 @@ package org.apache.turbine.util.template
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.modules.Screen;
import org.apache.turbine.modules.ScreenLoader;
import org.apache.turbine.services.TurbineServices;
@@ -51,7 +52,7 @@ import org.apache.turbine.util.RunData;
public class TemplateScreen
{
/** Logging */
- private static Log log = LogFactory.getLog(TemplateScreen.class);
+ private static final Logger log = LogManager.getLogger(TemplateScreen.class);
/* The RunData object. */
private final RunData data;
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/uri/BaseURI.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/uri/BaseURI.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/uri/BaseURI.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/uri/BaseURI.java Sun Mar 3 10:36:42 2019
@@ -24,13 +24,10 @@ package org.apache.turbine.util.uri;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
-
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.ServerData;
@@ -51,7 +48,7 @@ public abstract class BaseURI
URIConstants
{
/** Logging */
- private static Log log = LogFactory.getLog(BaseURI.class);
+ private static final Logger log = LogManager.getLogger(BaseURI.class);
/** ServerData Object for scheme, name, port etc. */
private ServerData serverData =
@@ -150,9 +147,9 @@ public abstract class BaseURI
*/
private void init(ServerData serverData)
{
- log.debug("init(" + serverData + ")");
+ log.debug("init({})", serverData);
- if(serverData != null)
+ if (serverData != null)
{
// We must clone this, because if BaseURI is used in a pull tool,
// then the fields might be changed. If we don't clone, this might pull
@@ -202,6 +199,7 @@ public abstract class BaseURI
*
* @return A String with the script name.
*/
+ @Override
public String getScriptName()
{
return serverData.getScriptName();
@@ -222,6 +220,7 @@ public abstract class BaseURI
*
* @return A String with the context path.
*/
+ @Override
public String getContextPath()
{
return serverData.getContextPath();
@@ -242,6 +241,7 @@ public abstract class BaseURI
*
* @return A String with the server name.
*/
+ @Override
public String getServerName()
{
return serverData.getServerName();
@@ -262,6 +262,7 @@ public abstract class BaseURI
*
* @return A String with the server port.
*/
+ @Override
public int getServerPort()
{
int serverPort = serverData.getServerPort();
@@ -335,6 +336,7 @@ public abstract class BaseURI
* @return The current Server scheme
*
*/
+ @Override
public String getServerScheme()
{
String serverScheme = serverData.getServerScheme();
@@ -357,6 +359,7 @@ public abstract class BaseURI
*
* @return A String containing the reference.
*/
+ @Override
public String getReference()
{
return hasReference() ? reference : "";
@@ -384,7 +387,7 @@ public abstract class BaseURI
/**
* Set a Response Object to use when creating the
* response string.
- *
+ *
* @param response the servlet response
*/
protected void setResponse(HttpServletResponse response)
@@ -448,7 +451,7 @@ public abstract class BaseURI
* <p>
* This is a convenience method to be
* used in the Link output routines of derived classes to
- * easily append the correct server scheme.
+ * easily append the correct server scheme.
* </p>
*
* @param sb The StringBuilder to store the scheme and port information.
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java Sun Mar 3 10:36:42 2019
@@ -27,10 +27,10 @@ import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.fulcrum.parser.ParameterParser;
import org.apache.fulcrum.parser.ParserService;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.ServerData;
@@ -52,7 +52,7 @@ public class TurbineURI
extends BaseURI
{
/** Logging */
- private static Log log = LogFactory.getLog(TurbineURI.class);
+ private static final Logger log = LogManager.getLogger(TurbineURI.class);
/** Contains the PathInfo and QueryData vectors */
private List<URIParam> [] dataVectors = null;
@@ -794,10 +794,7 @@ public class TurbineURI
{
if (val == null)
{
- if (log.isWarnEnabled())
- {
- log.warn("Found a null value for " + key);
- }
+ log.warn("Found a null value for {}", key);
// For backwards compatibility:
val = "null";
}
@@ -815,7 +812,7 @@ public class TurbineURI
}
catch (UnsupportedEncodingException e)
{
- log.warn("Unsupported encoding " + encoding);
+ log.warn("Unsupported encoding {}", encoding);
}
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityEmail.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityEmail.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityEmail.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityEmail.java Sun Mar 3 10:36:42 2019
@@ -21,11 +21,11 @@ package org.apache.turbine.util.velocity
*/
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.text.WordUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
+import org.apache.commons.text.WordUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.services.TurbineServices;
@@ -104,7 +104,7 @@ import org.apache.velocity.context.Conte
public class VelocityEmail extends SimpleEmail
{
/** Logging */
- private static Log log = LogFactory.getLog(VelocityEmail.class);
+ private static final Logger log = LogManager.getLogger(VelocityEmail.class);
/** The column to word-wrap at. <code>0</code> indicates no wrap. */
private int wordWrap = 0;
@@ -286,7 +286,7 @@ public class VelocityEmail extends Simpl
{
send();
}
- catch (Exception e)
+ catch (EmailException e)
{
log.error("VelocityEmail error", e);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java Sun Mar 3 10:36:42 2019
@@ -1,6 +1,8 @@
package org.apache.turbine.util.velocity;
+import java.net.MalformedURLException;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -25,10 +27,10 @@ import java.net.URL;
import java.util.Hashtable;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.services.TurbineServices;
@@ -83,7 +85,7 @@ import org.apache.velocity.context.Conte
public class VelocityHtmlEmail extends HtmlEmail
{
/** Logging */
- private static Log log = LogFactory.getLog(VelocityHtmlEmail.class);
+ private static final Logger log = LogManager.getLogger(VelocityHtmlEmail.class);
/**
* The html template to process, relative to VM's template
@@ -247,9 +249,9 @@ public class VelocityHtmlEmail extends H
cid = super.embed(url, name);
embmap.put(name, cid);
}
- catch (Exception e)
+ catch (MalformedURLException | EmailException e)
{
- log.error("cannot embed " + surl + ": ", e);
+ log.error("cannot embed {}", surl, e);
}
return cid;
}
Modified: turbine/core/trunk/src/test/org/apache/turbine/pipeline/DefaultLoginValveTest.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/pipeline/DefaultLoginValveTest.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/test/org/apache/turbine/pipeline/DefaultLoginValveTest.java (original)
+++ turbine/core/trunk/src/test/org/apache/turbine/pipeline/DefaultLoginValveTest.java Sun Mar 3 10:36:42 2019
@@ -22,9 +22,9 @@ package org.apache.turbine.pipeline;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -44,7 +44,6 @@ import org.apache.turbine.test.BaseTestC
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.TurbineConfig;
import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -95,7 +94,7 @@ public class DefaultLoginValveTest exten
/**
* Tests the Valve.
*/
- @Test
+ @Test
public void testDefaults() throws Exception
{
Vector<String> v = new Vector<String>();
@@ -126,7 +125,7 @@ public class DefaultLoginValveTest exten
/**
* Tests the LogoutAction.
*/
- @Test
+ @Test
public void testLogout() throws Exception
{
User user = securityService.getUser("username");
Modified: turbine/core/trunk/src/test/org/apache/turbine/services/pull/tools/UIToolTest.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/services/pull/tools/UIToolTest.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/test/org/apache/turbine/services/pull/tools/UIToolTest.java (original)
+++ turbine/core/trunk/src/test/org/apache/turbine/services/pull/tools/UIToolTest.java Sun Mar 3 10:36:42 2019
@@ -141,7 +141,7 @@ public class UIToolTest extends BaseTest
String[] skinNames = ui.getSkinNames();
// Remove the ".svn" dir that may be present.
- skinNames = (String[]) ArrayUtils.removeElement(skinNames, ".svn");
+ skinNames = ArrayUtils.removeElement(skinNames, ".svn");
assertEquals(2, skinNames.length);
assertTrue(ArrayUtils.contains(skinNames, "myotherskin"));
Modified: turbine/core/trunk/src/test/org/apache/turbine/services/security/SecurityServiceTest.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/services/security/SecurityServiceTest.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/test/org/apache/turbine/services/security/SecurityServiceTest.java (original)
+++ turbine/core/trunk/src/test/org/apache/turbine/services/security/SecurityServiceTest.java Sun Mar 3 10:36:42 2019
@@ -157,7 +157,7 @@ public class SecurityServiceTest extends
boolean ugrFound = false;
TurbineUserGroupRole ugrTest = null;
- for (TurbineUserGroupRole ugr : ((TurbineUser) user).getUserGroupRoleSet())
+ for (TurbineUserGroupRole ugr : user.getUserGroupRoleSet())
{
if (ugr.getUser().equals(user) && ugr.getGroup().equals(group) && ugr.getRole().equals(role))
{