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 [1/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...
Author: tv
Date: Sun Mar 3 10:36:42 2019
New Revision: 1854688
URL: http://svn.apache.org/viewvc?rev=1854688&view=rev
Log:
Replace all commons-logging references with log4j2
Modified:
turbine/core/trunk/pom.xml
turbine/core/trunk/src/changes/changes.xml
turbine/core/trunk/src/java/org/apache/turbine/Turbine.java
turbine/core/trunk/src/java/org/apache/turbine/annotation/AnnotationProcessor.java
turbine/core/trunk/src/java/org/apache/turbine/modules/actions/AccessController.java
turbine/core/trunk/src/java/org/apache/turbine/modules/actions/LoginUser.java
turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/DefaultSessionValidator.java
turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSecureSessionValidator.java
turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSessionValidator.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/pages/DefaultPage.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java
turbine/core/trunk/src/java/org/apache/turbine/om/security/DefaultUserImpl.java
turbine/core/trunk/src/java/org/apache/turbine/om/security/TurbineUserDelegate.java
turbine/core/trunk/src/java/org/apache/turbine/om/security/User.java
turbine/core/trunk/src/java/org/apache/turbine/pipeline/DefaultSetEncodingValve.java
turbine/core/trunk/src/java/org/apache/turbine/pipeline/DetermineActionValve.java
turbine/core/trunk/src/java/org/apache/turbine/pipeline/DetermineRedirectRequestedValve.java
turbine/core/trunk/src/java/org/apache/turbine/pipeline/DetermineTargetValve.java
turbine/core/trunk/src/java/org/apache/turbine/services/BaseInitableBroker.java
turbine/core/trunk/src/java/org/apache/turbine/services/BaseServiceBroker.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaBaseFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonBaseFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/avaloncomponent/TurbineYaafiComponentService.java
turbine/core/trunk/src/java/org/apache/turbine/services/intake/IntakeTool.java
turbine/core/trunk/src/java/org/apache/turbine/services/jsonrpc/JSONProcessor.java
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJspService.java
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/util/JspNavigation.java
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/util/JspScreenPlaceholder.java
turbine/core/trunk/src/java/org/apache/turbine/services/localization/LocalizationTool.java
turbine/core/trunk/src/java/org/apache/turbine/services/naming/TurbineNamingService.java
turbine/core/trunk/src/java/org/apache/turbine/services/pull/TurbinePullService.java
turbine/core/trunk/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java
turbine/core/trunk/src/java/org/apache/turbine/services/pull/tools/UITool.java
turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
turbine/core/trunk/src/java/org/apache/turbine/services/schedule/AbstractJobEntry.java
turbine/core/trunk/src/java/org/apache/turbine/services/schedule/AbstractSchedulerService.java
turbine/core/trunk/src/java/org/apache/turbine/services/schedule/QuartzSchedulerService.java
turbine/core/trunk/src/java/org/apache/turbine/services/schedule/SchedulerTool.java
turbine/core/trunk/src/java/org/apache/turbine/services/schedule/WorkerThread.java
turbine/core/trunk/src/java/org/apache/turbine/services/security/DefaultSecurityService.java
turbine/core/trunk/src/java/org/apache/turbine/services/security/DefaultUserManager.java
turbine/core/trunk/src/java/org/apache/turbine/services/servlet/TurbineServletService.java
turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
turbine/core/trunk/src/java/org/apache/turbine/services/template/mapper/ClassMapper.java
turbine/core/trunk/src/java/org/apache/turbine/services/template/mapper/LayoutTemplateMapper.java
turbine/core/trunk/src/java/org/apache/turbine/services/template/mapper/ScreenDefaultTemplateMapper.java
turbine/core/trunk/src/java/org/apache/turbine/services/ui/TurbineUIService.java
turbine/core/trunk/src/java/org/apache/turbine/services/uniqueid/TurbineUniqueIdService.java
turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java
turbine/core/trunk/src/java/org/apache/turbine/util/InputFilterUtils.java
turbine/core/trunk/src/java/org/apache/turbine/util/LocaleUtils.java
turbine/core/trunk/src/java/org/apache/turbine/util/ServerData.java
turbine/core/trunk/src/java/org/apache/turbine/util/ServletUtils.java
turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java
turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateNavigation.java
turbine/core/trunk/src/java/org/apache/turbine/util/template/TemplateScreen.java
turbine/core/trunk/src/java/org/apache/turbine/util/uri/BaseURI.java
turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java
turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityEmail.java
turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java
turbine/core/trunk/src/test/org/apache/turbine/pipeline/DefaultLoginValveTest.java
turbine/core/trunk/src/test/org/apache/turbine/services/pull/tools/UIToolTest.java
turbine/core/trunk/src/test/org/apache/turbine/services/security/SecurityServiceTest.java
Modified: turbine/core/trunk/pom.xml
URL: http://svn.apache.org/viewvc/turbine/core/trunk/pom.xml?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/pom.xml (original)
+++ turbine/core/trunk/pom.xml Sun Mar 3 10:36:42 2019
@@ -910,12 +910,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.4</version>
- <exclusions>
- <exclusion><!-- will we mapped in jcl-over-slf4j -->
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -937,17 +931,11 @@
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
- <exclusions>
- <exclusion><!-- will we mapped in jcl-over-slf4j -->
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
- <groupId>net.sf.uadetector</groupId>
- <artifactId>uadetector-resources</artifactId>
- <version>2014.10</version>
+ <groupId>nl.basjes.parse.useragent</groupId>
+ <artifactId>yauaa</artifactId>
+ <version>5.8</version>
</dependency>
<dependency>
<groupId>org.apache.fulcrum</groupId>
@@ -1018,22 +1006,12 @@
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</exclusion>
- <exclusion><!-- will we mapped in jcl-over-slf4j -->
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
</exclusions>
</dependency>
<dependency> <!-- include more modern version just for torque-runtime v4.0 -->
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.10</version>
- <exclusions>
- <exclusion><!-- will we mapped in jcl-over-slf4j -->
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<!-- using snapshot, until released -->
<dependency>
@@ -1071,7 +1049,7 @@
<artifactId>jabsorb</artifactId>
<version>1.3.2</version>
<optional>true</optional>
- <!-- reqires maven version >= 3, exclude old versions: org.slf4j:slf4j-jdk14,slf4j-api,(renamed)cl104-over-slf4j,org.mortbay.jetty:jsp-2.1, commons-httpclient:commons-httpclient,
+ <!-- requires maven version >= 3, exclude old versions: org.slf4j:slf4j-jdk14,slf4j-api,(renamed)cl104-over-slf4j,org.mortbay.jetty:jsp-2.1, commons-httpclient:commons-httpclient,
mvn eclipse:eclipse still no wildcard exclude (mvn version 3.3.9)
-->
<exclusions>
@@ -1100,6 +1078,12 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j2.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
Modified: turbine/core/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/changes/changes.xml?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/changes/changes.xml (original)
+++ turbine/core/trunk/src/changes/changes.xml Sun Mar 3 10:36:42 2019
@@ -26,7 +26,16 @@
<body>
<release version="5.0" date="in Subversion">
<action type="update" dev="tv">
- Direct Avalon logging to Log4j2
+ Change Assembler to interface
+ </action>
+ <action type="update" dev="tv">
+ Replace unmaintained UADetetctor with YAUAA
+ </action>
+ <action type="update" dev="tv">
+ Replace all commons-logging references with log4j2
+ </action>
+ <action type="update" dev="tv">
+ Direct Avalon logging to log4j2
</action>
<action type="update" dev="tv">
Update jython to jython-standalone 2.7.1
Modified: turbine/core/trunk/src/java/org/apache/turbine/Turbine.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/Turbine.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/Turbine.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/Turbine.java Sun Mar 3 10:36:42 2019
@@ -74,24 +74,25 @@ import org.apache.turbine.util.uri.URICo
/**
* <p>
- * Turbine is the main servlet for the entire system. If you
- * need to perform initialization of a service, then you should implement the
- * Services API and let your code be initialized by it.
+ * Turbine is the main servlet for the entire system. If you need to perform
+ * initialization of a service, then you should implement the Services API and
+ * let your code be initialized by it.
* </p>
- *
+ *
* <p>
* Turbine servlet recognizes the following initialization parameters.
* </p>
- *
+ *
* <ul>
- * <li><code>properties</code> the path to TurbineResources.properties file
- * used to configure Turbine, relative to the application root.</li>
- * <li><code>configuration</code> the path to TurbineConfiguration.xml file
- * used to configure Turbine from various sources, relative
- * to the application root.</li>
+ * <li><code>properties</code> the path to TurbineResources.properties file used
+ * to configure Turbine, relative to the application root.</li>
+ * <li><code>configuration</code> the path to TurbineConfiguration.xml file used
+ * to configure Turbine from various sources, relative to the application
+ * root.</li>
* <li><code>applicationRoot</code> this parameter defaults to the web context
* of the servlet container. You can use this parameter to specify the directory
- * within the server's filesystem, that is the base of your web application.</li>
+ * within the server's filesystem, that is the base of your web
+ * application.</li>
* </ul>
*
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
@@ -110,14 +111,9 @@ import org.apache.turbine.util.uri.URICo
* @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
* @version $Id$
*/
-@WebServlet(
- name = "Turbine",
- urlPatterns = {"/app"},
- loadOnStartup = 1,
- initParams={ @WebInitParam(name = TurbineConstants.APPLICATION_ROOT_KEY,
- value = TurbineConstants.APPLICATION_ROOT_DEFAULT),
- @WebInitParam(name = TurbineConfig.PROPERTIES_PATH_KEY,
- value = TurbineConfig.PROPERTIES_PATH_DEFAULT) } )
+@WebServlet(name = "Turbine", urlPatterns = { "/app" }, loadOnStartup = 1, initParams = {
+ @WebInitParam(name = TurbineConstants.APPLICATION_ROOT_KEY, value = TurbineConstants.APPLICATION_ROOT_DEFAULT),
+ @WebInitParam(name = TurbineConfig.PROPERTIES_PATH_KEY, value = TurbineConfig.PROPERTIES_PATH_DEFAULT) })
@MultipartConfig
public class Turbine extends HttpServlet
{
@@ -125,22 +121,24 @@ public class Turbine extends HttpServlet
private static final long serialVersionUID = -6317118078613623990L;
/**
- * Name of path info parameter used to indicate the redirected stage of
- * a given user's initial Turbine request
+ * Name of path info parameter used to indicate the redirected stage of a
+ * given user's initial Turbine request
+ *
* @deprecated
*/
@Deprecated // not used
public static final String REDIRECTED_PATHINFO_NAME = "redirected";
- /** The base directory key @deprecated
- * */
+ /**
+ * The base directory key @deprecated
+ */
@Deprecated // not used
public static final String BASEDIR_KEY = "basedir";
/**
* In certain situations the init() method is called more than once,
- * sometimes even concurrently. This causes bad things to happen,
- * so we use this flag to prevent it.
+ * sometimes even concurrently. This causes bad things to happen, so we use
+ * this flag to prevent it.
*/
private static boolean firstInit = true;
@@ -158,8 +156,7 @@ public class Turbine extends HttpServlet
private static boolean firstDoGet = true;
/**
- * Keep all the properties of the web server in a convenient data
- * structure
+ * Keep all the properties of the web server in a convenient data structure
*/
private static volatile ServerData serverData = null;
@@ -173,9 +170,8 @@ public class Turbine extends HttpServlet
private static ServletContext servletContext;
/**
- * The webapp root where the Turbine application
- * is running in the servlet container.
- * This might differ from the application root.
+ * The webapp root where the Turbine application is running in the servlet
+ * container. This might differ from the application root.
*/
private static String webappRoot;
@@ -185,24 +181,18 @@ public class Turbine extends HttpServlet
/** Which configuration method is being used */
private enum ConfigurationStyle
{
- XML,
- PROPERTIES,
- JSON,
- YAML,
- UNSET
+ XML, PROPERTIES, JSON, YAML, UNSET
}
- /** Logging class from commons.logging - this may still work, due to jcl-over-slf4j */
- //private static Log log = LogFactory.getLog(Turbine.class);
- public static Logger log = LogManager.getLogger();
+ private static final Logger log = LogManager.getLogger(Turbine.class);
/**
- * This init method will load the default resources from a
- * properties file.
+ * This init method will load the default resources from a properties file.
*
* This method is called by init(ServletConfig config)
*
- * @throws ServletException a servlet exception.
+ * @throws ServletException
+ * a servlet exception.
*/
@Override
public void init() throws ServletException
@@ -227,8 +217,7 @@ public class Turbine extends HttpServlet
configure(config, context);
- TemplateService templateService =
- (TemplateService)getServiceManager().getService(TemplateService.SERVICE_NAME);
+ TemplateService templateService = (TemplateService) getServiceManager().getService(TemplateService.SERVICE_NAME);
if (templateService == null)
{
throw new TurbineException("No Template Service configured!");
@@ -243,7 +232,7 @@ public class Turbine extends HttpServlet
{
// save the exception to complain loudly later :-)
initFailure = e;
- log.fatal("Turbine: init() failed: ", e);
+ log.fatal("Turbine: init() failed", e);
throw new ServletException("Turbine: init() failed", e);
}
@@ -252,13 +241,17 @@ public class Turbine extends HttpServlet
}
/**
- * Read the master configuration file in, configure logging
- * and start up any early services.
- *
- * @param config The Servlet Configuration supplied by the container
- * @param context The Servlet Context supplied by the container
+ * Read the master configuration file in, configure logging and start up any
+ * early services.
*
- * @throws Exception A problem occurred while reading the configuration or performing early startup
+ * @param config
+ * The Servlet Configuration supplied by the container
+ * @param context
+ * The Servlet Context supplied by the container
+ *
+ * @throws Exception
+ * A problem occurred while reading the configuration or
+ * performing early startup
*/
protected void configure(ServletConfig config, ServletContext context)
@@ -270,15 +263,16 @@ public class Turbine extends HttpServlet
applicationRoot = findInitParameter(context, config,
TurbineConstants.APPLICATION_ROOT_KEY,
TurbineConstants.APPLICATION_ROOT_DEFAULT);
-
+
webappRoot = context.getRealPath("/");
// log.info("Web Application root is " + webappRoot);
- // log.info("Application root is " + applicationRoot);
+ // log.info("Application root is " + applicationRoot);
if (applicationRoot == null || applicationRoot.equals(TurbineConstants.WEB_CONTEXT))
{
applicationRoot = webappRoot;
- // log.info("got empty or 'webContext' Application root. Application root now: " + applicationRoot);
+ // log.info("got empty or 'webContext' Application root. Application
+ // root now: " + applicationRoot);
}
// Set the applicationRoot for this webapp.
@@ -291,8 +285,8 @@ public class Turbine extends HttpServlet
// a) By supplying an web.xml init parameter called "configuration"
//
// <init-param>
- // <param-name>configuration</param-name>
- // <param-value>/WEB-INF/conf/turbine.xml</param-value>
+ // <param-name>configuration</param-name>
+ // <param-value>/WEB-INF/conf/turbine.xml</param-value>
// </init-param>
//
// This loads an XML based configuration file.
@@ -300,8 +294,8 @@ public class Turbine extends HttpServlet
// b) By supplying an web.xml init parameter called "properties"
//
// <init-param>
- // <param-name>properties</param-name>
- // <param-value>/WEB-INF/conf/TurbineResources.properties</param-value>
+ // <param-name>properties</param-name>
+ // <param-value>/WEB-INF/conf/TurbineResources.properties</param-value>
// </init-param>
//
// This loads a Properties based configuration file. Actually, these are
@@ -311,15 +305,14 @@ public class Turbine extends HttpServlet
// known behaviour of loading a properties file called
// /WEB-INF/conf/TurbineResources.properties relative to the
// web application root.
-
- Path confPath = configureApplication( config, context );
+ Path confPath = configureApplication(config, context);
configureLogging(confPath);
-
+
//
// Logging with log4j 2 is done via convention, finding in path
-
+
setTurbineServletConfig(config);
setTurbineServletContext(context);
@@ -341,22 +334,19 @@ public class Turbine extends HttpServlet
// the service manager is initialized.
getServiceManager().init();
- // Retrieve the pipeline class and then initialize it. The pipeline
+ // Retrieve the pipeline class and then initialize it. The pipeline
// handles the processing of a webrequest/response cycle.
- String descriptorPath =
- configuration.getString(
- "pipeline.default.descriptor",
- TurbinePipeline.CLASSIC_PIPELINE);
+ String descriptorPath = configuration.getString(
+ "pipeline.default.descriptor",
+ TurbinePipeline.CLASSIC_PIPELINE);
- if (log.isDebugEnabled())
- {
- log.debug("Using descriptor path: " + descriptorPath);
- }
+ log.debug("Using descriptor path: {}", descriptorPath);
- // context resource path has to begin with slash, cft. context.getResource
- if (!descriptorPath.startsWith( "/" ))
+ // context resource path has to begin with slash, cft.
+ // context.getResource
+ if (!descriptorPath.startsWith("/"))
{
- descriptorPath = "/" + descriptorPath;
+ descriptorPath = "/" + descriptorPath;
}
try (InputStream reader = context.getResourceAsStream(descriptorPath))
@@ -372,21 +362,26 @@ public class Turbine extends HttpServlet
}
/**
- * Checks configuraton style, resolves the location of the configuration and loads it to
- * internal {@link Configuration} object ({@link #configuration}).
- *
- * @param config the Servlet Configuration
- * @param context Servlet Context
- * @return The resolved Configuration Path
- * @throws IOException if configuration path not found
- * @throws ConfigurationException if failed to configure
+ * Checks configuraton style, resolves the location of the configuration and
+ * loads it to internal {@link Configuration} object
+ * ({@link #configuration}).
+ *
+ * @param config
+ * the Servlet Configuration
+ * @param context
+ * Servlet Context
+ * @return The resolved Configuration Path
+ * @throws IOException
+ * if configuration path not found
+ * @throws ConfigurationException
+ * if failed to configure
*/
- protected Path configureApplication( ServletConfig config, ServletContext context )
- throws IOException, ConfigurationException
+ protected Path configureApplication(ServletConfig config, ServletContext context)
+ throws IOException, ConfigurationException
{
ConfigurationStyle confStyle = ConfigurationStyle.UNSET;
// first test
- String confFile= findInitParameter(context, config,
+ String confFile = findInitParameter(context, config,
TurbineConfig.CONFIGURATION_PATH_KEY,
null);
if (StringUtils.isNotEmpty(confFile))
@@ -397,8 +392,8 @@ public class Turbine extends HttpServlet
{
confFile = findInitParameter(context, config,
TurbineConfig.PROPERTIES_PATH_KEY,
- null);
- if (StringUtils.isNotEmpty((confFile)) )
+ null);
+ if (StringUtils.isNotEmpty((confFile)))
{
confStyle = ConfigurationStyle.PROPERTIES;
}
@@ -406,104 +401,113 @@ public class Turbine extends HttpServlet
// more tests ..
// last test
if (confStyle == ConfigurationStyle.UNSET)
- { // last resort
- confFile = findInitParameter(context, config,
+ { // last resort
+ confFile = findInitParameter(context, config,
TurbineConfig.PROPERTIES_PATH_KEY,
TurbineConfig.PROPERTIES_PATH_DEFAULT);
- confStyle = ConfigurationStyle.PROPERTIES;
+ confStyle = ConfigurationStyle.PROPERTIES;
}
-
+
// First report
- log.debug("Loading configuration (" + confStyle + ") from " + confFile);
+ log.debug("Loading configuration ({}) from {}", confStyle, confFile);
// now begin loading
Parameters params = new Parameters();
- File confPath = getApplicationRootAsFile();
+ File confPath = getApplicationRootAsFile();
- if (confFile.startsWith( "/" ))
+ if (confFile.startsWith("/"))
{
- confFile = confFile.substring( 1 ); // cft. RFC2396 should not start with a slash, if not absolute path
+ confFile = confFile.substring(1); // cft. RFC2396 should not start
+ // with a slash, if not absolute
+ // path
}
- Path confFileRelativePath = Paths.get( confFile );// relative to later join
- Path targetPath = Paths.get( confPath.toURI() );
- targetPath = targetPath.resolve( confFileRelativePath );
+ Path confFileRelativePath = Paths.get(confFile);// relative to later
+ // join
+ Path targetPath = Paths.get(confPath.toURI());
+ targetPath = targetPath.resolve(confFileRelativePath);
// Get the target path directory
Path targetPathDirectory = targetPath.getParent();
- if ( targetPathDirectory != null )
+ if (targetPathDirectory != null)
{
// set the configuration path
confPath = targetPathDirectory.normalize().toFile();
Path targetFilePath = targetPath.getFileName();
- if ( targetFilePath != null )
+ if (targetFilePath != null)
{
// set the configuration file name
confFile = targetFilePath.toString();
}
-
+
}
switch (confStyle)
{
case XML:
- // relative base path used for this and child configuration files
+ // relative base path used for this and child configuration
+ // files
CombinedConfigurationBuilder combinedBuilder = new CombinedConfigurationBuilder()
- .configure(params.fileBased()
- .setFileName(confFile)
- .setListDelimiterHandler(new DefaultListDelimiterHandler(','))
- .setLocationStrategy(new HomeDirectoryLocationStrategy(confPath.getCanonicalPath(), false)));
+ .configure(params.fileBased()
+ .setFileName(confFile)
+ .setListDelimiterHandler(new DefaultListDelimiterHandler(','))
+ .setLocationStrategy(new HomeDirectoryLocationStrategy(confPath.getCanonicalPath(), false)));
configuration = combinedBuilder.getConfiguration();
break;
case PROPERTIES:
- FileBasedConfigurationBuilder<PropertiesConfiguration> propertiesBuilder =
- new FileBasedConfigurationBuilder<>(
- PropertiesConfiguration.class)
- .configure(params.properties()
- .setFileName(confFile)
- .setListDelimiterHandler(new DefaultListDelimiterHandler(','))
- .setLocationStrategy(new HomeDirectoryLocationStrategy(confPath.getCanonicalPath(), false)));
+ FileBasedConfigurationBuilder<PropertiesConfiguration> propertiesBuilder = new FileBasedConfigurationBuilder<>(
+ PropertiesConfiguration.class)
+ .configure(params.properties()
+ .setFileName(confFile)
+ .setListDelimiterHandler(new DefaultListDelimiterHandler(','))
+ .setLocationStrategy(new HomeDirectoryLocationStrategy(confPath.getCanonicalPath(), false)));
configuration = propertiesBuilder.getConfiguration();
break;
- case JSON: case YAML:
+ case JSON:
+ case YAML:
throw new NotImplementedException("JSON or XAML configuration style not yet implemented!");
default:
break;
}
// Now report our successful configuration to the world
- log.info("Loaded configuration (" + confStyle + ") from " + confFile + " style: " + configuration.toString());
+ log.info("Loaded configuration ({}) from {} style: {}",
+ confStyle, confFile, configuration.toString());
return targetPath;
}
/**
- * Finds the specified servlet configuration/initialization
- * parameter, looking first for a servlet-specific parameter, then
- * for a global parameter, and using the provided default if not
- * found.
- *
- * @param context the servlet context
- * @param config configuration object
- * @param name name of parameter
- * @param defaultValue of the parameter
+ * Finds the specified servlet configuration/initialization parameter,
+ * looking first for a servlet-specific parameter, then for a global
+ * parameter, and using the provided default if not found.
+ *
+ * @param context
+ * the servlet context
+ * @param config
+ * configuration object
+ * @param name
+ * name of parameter
+ * @param defaultValue
+ * of the parameter
* @return String value of the parameter
*/
protected String findInitParameter(ServletContext context,
ServletConfig config, String name, String defaultValue)
{
String path = null;
+ String parameterName = name;
// Try the name as provided first.
- boolean usingNamespace = name.startsWith(TurbineConstants.CONFIG_NAMESPACE);
+ boolean usingNamespace = parameterName.startsWith(TurbineConstants.CONFIG_NAMESPACE);
while (true)
{
- path = config.getInitParameter(name);
+ path = config.getInitParameter(parameterName);
if (StringUtils.isEmpty(path))
{
- path = context.getInitParameter(name);
+ path = context.getInitParameter(parameterName);
if (StringUtils.isEmpty(path))
{
// The named parameter didn't yield a value.
@@ -514,7 +518,7 @@ public class Turbine extends HttpServlet
else
{
// Try again using Turbine's namespace.
- name = TurbineConstants.CONFIG_NAMESPACE + '.' + name;
+ parameterName = TurbineConstants.CONFIG_NAMESPACE + '.' + parameterName;
usingNamespace = true;
continue;
}
@@ -530,7 +534,8 @@ public class Turbine extends HttpServlet
* Initializes the services which need <code>PipelineData</code> to
* initialize themselves (post startup).
*
- * @param data The first <code>GET</code> request.
+ * @param data
+ * The first <code>GET</code> request.
*/
public void init(PipelineData data)
{
@@ -546,7 +551,7 @@ public class Turbine extends HttpServlet
saveServletInfo(data);
// Initialize services with the PipelineData instance
- TurbineServices services = (TurbineServices)getServiceManager();
+ TurbineServices services = (TurbineServices) getServiceManager();
for (Iterator<String> i = services.getServiceNames(); i.hasNext();)
{
@@ -557,11 +562,11 @@ public class Turbine extends HttpServlet
{
try
{
- ((Initable)service).init(data);
+ ((Initable) service).init(data);
}
catch (InitializationException e)
{
- log.warn("Could not initialize Initable " + serviceName + " with PipelineData", e);
+ log.warn("Could not initialize Initable {} with PipelineData", serviceName, e);
}
}
}
@@ -614,9 +619,8 @@ public class Turbine extends HttpServlet
}
/**
- * Get the script name. This is the initial script name.
- * Actually this is probably not needed any more. I'll
- * check. jvz.
+ * Get the script name. This is the initial script name. Actually this is
+ * probably not needed any more. I'll check. jvz.
*
* @return String initial script name.
*/
@@ -636,13 +640,13 @@ public class Turbine extends HttpServlet
}
/**
- * Return all the Turbine Servlet information (Server Name, Port,
- * Scheme in a ServerData structure. This is generated from the
- * values set when initializing the Turbine and may not be correct
- * if you're running in a clustered structure. You can provide default
- * values in your configuration for cases where access is requied before
- * your application is first accessed by a user. This might be used
- * if you need a DataURI and have no RunData object handy.
+ * Return all the Turbine Servlet information (Server Name, Port, Scheme in
+ * a ServerData structure. This is generated from the values set when
+ * initializing the Turbine and may not be correct if you're running in a
+ * clustered structure. You can provide default values in your configuration
+ * for cases where access is requied before your application is first
+ * accessed by a user. This might be used if you need a DataURI and have no
+ * RunData object handy.
*
* @return An initialized ServerData object
*/
@@ -650,8 +654,7 @@ public class Turbine extends HttpServlet
{
if (serverData == null)
{
- String serverName
- = configuration.getString(TurbineConstants.DEFAULT_SERVER_NAME_KEY);
+ String serverName = configuration.getString(TurbineConstants.DEFAULT_SERVER_NAME_KEY);
if (serverName == null)
{
log.error("ServerData Information requested from Turbine before first request!");
@@ -675,7 +678,8 @@ public class Turbine extends HttpServlet
/**
* Set the servlet config for this turbine webapp.
*
- * @param config New servlet config
+ * @param config
+ * New servlet config
*/
public static void setTurbineServletConfig(ServletConfig config)
{
@@ -695,7 +699,8 @@ public class Turbine extends HttpServlet
/**
* Set the servlet context for this turbine webapp.
*
- * @param context New servlet context.
+ * @param context
+ * New servlet context.
*/
public static void setTurbineServletContext(ServletContext context)
{
@@ -713,7 +718,7 @@ public class Turbine extends HttpServlet
}
/**
- * The <code>Servlet</code> destroy method. Invokes
+ * The <code>Servlet</code> destroy method. Invokes
* <code>ServiceBroker</code> tear down method.
*/
@Override
@@ -730,10 +735,14 @@ public class Turbine extends HttpServlet
/**
* The primary method invoked when the Turbine servlet is executed.
*
- * @param req Servlet request.
- * @param res Servlet response.
- * @throws IOException a servlet exception.
- * @throws ServletException a servlet exception.
+ * @param req
+ * Servlet request.
+ * @param res
+ * Servlet response.
+ * @throws IOException
+ * a servlet exception.
+ * @throws ServletException
+ * a servlet exception.
*/
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
@@ -758,7 +767,7 @@ public class Turbine extends HttpServlet
pipelineData.put(RunData.class, runDataMap);
// If this is the first invocation, perform some
- // initialization. Certain services need RunData to initialize
+ // initialization. Certain services need RunData to initialize
// themselves.
if (firstDoGet)
{
@@ -784,10 +793,14 @@ public class Turbine extends HttpServlet
/**
* In this application doGet and doPost are the same thing.
*
- * @param req Servlet request.
- * @param res Servlet response.
- * @throws IOException a servlet exception.
- * @throws ServletException a servlet exception.
+ * @param req
+ * Servlet request.
+ * @param res
+ * Servlet response.
+ * @throws IOException
+ * a servlet exception.
+ * @throws ServletException
+ * a servlet exception.
*/
@Override
public void doPost(HttpServletRequest req, HttpServletResponse res)
@@ -808,20 +821,22 @@ public class Turbine extends HttpServlet
}
/**
- * This method is about making sure that we catch and display
- * errors to the screen in one fashion or another. What happens is
- * that it will attempt to show the error using your user defined
- * Error Screen. If that fails, then it will resort to just
- * displaying the error and logging it all over the place
- * including the servlet engine log file, the Turbine log file and
- * on the screen.
- *
- * @param pipelineData A Turbine PipelineData object.
- * @param res Servlet response.
- * @param t The exception to report.
+ * This method is about making sure that we catch and display errors to the
+ * screen in one fashion or another. What happens is that it will attempt to
+ * show the error using your user defined Error Screen. If that fails, then
+ * it will resort to just displaying the error and logging it all over the
+ * place including the servlet engine log file, the Turbine log file and on
+ * the screen.
+ *
+ * @param pipelineData
+ * A Turbine PipelineData object.
+ * @param res
+ * Servlet response.
+ * @param t
+ * The exception to report.
*/
protected void handleException(PipelineData pipelineData, HttpServletResponse res,
- Throwable t)
+ Throwable t)
{
RunData data = (RunData) pipelineData;
// make sure that the stack trace makes it the log
@@ -842,9 +857,9 @@ public class Turbine extends HttpServlet
if (data.getTemplateInfo() != null)
{
data.getTemplateInfo()
- .setScreenTemplate(configuration.getString(
- TurbineConstants.TEMPLATE_ERROR_KEY,
- TurbineConstants.TEMPLATE_ERROR_VM));
+ .setScreenTemplate(configuration.getString(
+ TurbineConstants.TEMPLATE_ERROR_KEY,
+ TurbineConstants.TEMPLATE_ERROR_VM));
}
// Make sure to not execute an action.
@@ -867,14 +882,16 @@ public class Turbine extends HttpServlet
/**
* This method handles exception cases where no PipelineData object exists
*
- * @param res Servlet response.
- * @param t The exception to report.
+ * @param res
+ * Servlet response.
+ * @param t
+ * The exception to report.
*/
protected void handleHorribleException(HttpServletResponse res, Throwable t)
{
try
{
- res.setContentType( TurbineConstants.DEFAULT_TEXT_CONTENT_TYPE );
+ res.setContentType(TurbineConstants.DEFAULT_TEXT_CONTENT_TYPE);
res.setStatus(200);
PrintWriter writer = res.getWriter();
writer.println("Horrible Exception: ");
@@ -889,11 +906,11 @@ public class Turbine extends HttpServlet
}
/**
- * Save some information about this servlet so that
- * it can be utilized by object instances that do not
- * have direct access to PipelineData.
+ * Save some information about this servlet so that it can be utilized by
+ * object instances that do not have direct access to PipelineData.
*
- * @param data Turbine request data
+ * @param data
+ * Turbine request data
*/
public static synchronized void saveServletInfo(PipelineData data)
{
@@ -909,55 +926,70 @@ public class Turbine extends HttpServlet
}
/**
- * Checks Log4j 2 Context, loads log4File, if configured and configuration is not already located.
- * @param logConf Configuration file path
- * @throws IOException if path not found
+ * Checks Log4j 2 Context, loads log4File, if configured and configuration
+ * is not already located.
+ *
+ * @param logConf
+ * Configuration file path
+ * @throws IOException
+ * if path not found
*/
protected void configureLogging(Path logConf) throws IOException
- {
+ {
LoggerContext context = (LoggerContext) LogManager.getContext(false);
-
- if (context.getConfiguration().getConfigurationSource().getLocation() == null) {
- Path log4jFile = resolveLog4j2( logConf.getParent() );
+
+ if (context.getConfiguration().getConfigurationSource().getLocation() == null)
+ {
+ Path log4jFile = resolveLog4j2(logConf.getParent());
// configured + no other log4j configuration already found
- if (log4jFile != null) {
+ if (log4jFile != null)
+ {
LogManager.getContext(null, false, log4jFile.toUri());
}
}
- log.info( "resolved log4j2 location: {}", context.getConfiguration().getConfigurationSource().getLocation() );
+ log.info("resolved log4j2 location: {}", context.getConfiguration().getConfigurationSource().getLocation());
}
-
+
/**
- * Check {@value TurbineConstants#LOG4J2_CONFIG_FILE} in Turbine configuration.
- *
- * @param logConfPath configuration directory
- * @return Resolved log4j2 {@link Path} or null, if not found or configured "none".
+ * Check {@value TurbineConstants#LOG4J2_CONFIG_FILE} in Turbine
+ * configuration.
+ *
+ * @param logConfPath
+ * configuration directory
+ * @return Resolved log4j2 {@link Path} or null, if not found or configured
+ * "none".
*/
- protected Path resolveLog4j2( Path logConfPath )
+ protected Path resolveLog4j2(Path logConfPath)
{
String log4jFile = configuration.getString(TurbineConstants.LOG4J2_CONFIG_FILE,
- TurbineConstants.LOG4J2_CONFIG_FILE_DEFAULT);
-
- if (log4jFile.startsWith( "/" ))
+ TurbineConstants.LOG4J2_CONFIG_FILE_DEFAULT);
+
+ if (log4jFile.startsWith("/"))
{
- log4jFile = log4jFile.substring( 1 );
+ log4jFile = log4jFile.substring(1);
}
Path log4jTarget = null;
- if (StringUtils.isNotEmpty(log4jFile) && !log4jFile.equalsIgnoreCase("none")) {
- // log4j must either share path with configuration path or resolved relatively
-
- if ( logConfPath != null )
+ if (StringUtils.isNotEmpty(log4jFile) && !log4jFile.equalsIgnoreCase("none"))
+ {
+ // log4j must either share path with configuration path or resolved
+ // relatively
+
+ if (logConfPath != null)
{
Path log4jFilePath = Paths.get(log4jFile);
- Path logFilePath = logConfPath.resolve( log4jFilePath );
- if ( logFilePath != null && logFilePath.toFile().exists() )
+ Path logFilePath = logConfPath.resolve(log4jFilePath);
+ if (logFilePath != null && logFilePath.toFile().exists())
{
log4jTarget = logFilePath.normalize();
- } else {
+ }
+ else
+ {
// fall back just using the filename, if path match
- if (log4jFilePath != null && log4jFilePath.getParent() != null && logConfPath.endsWith(log4jFilePath.getParent() )) {
- logFilePath = logConfPath.resolve( log4jFilePath.getFileName());
- if ( logFilePath != null && logFilePath.toFile().exists() ) {
+ if (log4jFilePath != null && log4jFilePath.getParent() != null && logConfPath.endsWith(log4jFilePath.getParent()))
+ {
+ logFilePath = logConfPath.resolve(log4jFilePath.getFileName());
+ if (logFilePath != null && logFilePath.toFile().exists())
+ {
log4jTarget = logFilePath.normalize();
}
}
@@ -966,10 +998,12 @@ public class Turbine extends HttpServlet
}
return log4jTarget;
}
+
/**
* Set the application root for the webapp.
*
- * @param val New app root.
+ * @param val
+ * New app root.
*/
public static void setApplicationRoot(String val)
{
@@ -987,8 +1021,7 @@ public class Turbine extends HttpServlet
}
/**
- * Get the application root for this Turbine webapp as a
- * file object.
+ * Get the application root for this Turbine webapp as a file object.
*
* @return File applicationRootFile
*/
@@ -998,11 +1031,11 @@ public class Turbine extends HttpServlet
}
/**
- * Used to get the real path of configuration and resource
- * information. This can be used by an app being
- * developed in a standard CVS layout.
+ * Used to get the real path of configuration and resource information. This
+ * can be used by an app being developed in a standard CVS layout.
*
- * @param path path translated to the application root
+ * @param path
+ * path translated to the application root
* @return the real path
*/
public static String getRealPath(String path)
@@ -1030,7 +1063,9 @@ public class Turbine extends HttpServlet
*
* @return the default input encoding.
*
- * @deprecated Use {@link org.apache.turbine.pipeline.DefaultSetEncodingValve} to set default encoding
+ * @deprecated Use
+ * {@link org.apache.turbine.pipeline.DefaultSetEncodingValve}
+ * to set default encoding
*/
@Deprecated
public static String getDefaultInputEncoding()
@@ -1040,6 +1075,7 @@ public class Turbine extends HttpServlet
/**
* Static Helper method for looking up the RunDataService
+ *
* @return A RunDataService
*/
private RunDataService getRunDataService()
Modified: turbine/core/trunk/src/java/org/apache/turbine/annotation/AnnotationProcessor.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/annotation/AnnotationProcessor.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/annotation/AnnotationProcessor.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/annotation/AnnotationProcessor.java Sun Mar 3 10:36:42 2019
@@ -28,9 +28,9 @@ import java.util.concurrent.ConcurrentMa
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.fulcrum.security.model.turbine.TurbineAccessControlList;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.modules.Loader;
import org.apache.turbine.services.ServiceManager;
@@ -48,7 +48,7 @@ import org.apache.turbine.util.TurbineEx
public class AnnotationProcessor
{
/** Logging */
- private static Log log = LogFactory.getLog(AnnotationProcessor.class);
+ private static Logger log = LogManager.getLogger(AnnotationProcessor.class);
/** Annotation cache */
private static ConcurrentMap<String, Annotation[]> annotationCache = new ConcurrentHashMap<String, Annotation[]>();
@@ -75,19 +75,19 @@ public class AnnotationProcessor
}
return annotations;
}
-
+
public enum ConditionType
{
- COMPOUND, ANY;
+ COMPOUND, ANY;
}
-
+
/**
* Check if the object given is authorized to be executed based on its annotations
- *
+ *
* The method will return false if one of the annotations denies execution
- *
+ *
* @see #isAuthorized(AccessibleObject, TurbineAccessControlList, ConditionType)
- *
+ *
* @param <A> ACL instance
* @param object accessible object to test
* @param acl access control list
@@ -100,7 +100,7 @@ public class AnnotationProcessor
/**
* Check if the object given is authorized to be executed based on its annotations
- * The method's return value depends on the conditonType, refer to the ConditionType
+ * The method's return value depends on the conditonType, refer to the ConditionType
*
* @param <A> ACL instance
* @param object the object
@@ -120,7 +120,7 @@ public class AnnotationProcessor
TurbineRequiredRole trr = (TurbineRequiredRole) annotation;
String[] roleNames = trr.value();
String group = trr.group();
-
+
if (StringUtils.isEmpty(group)) // global group
{
for (String roleName : roleNames)
@@ -170,7 +170,7 @@ public class AnnotationProcessor
TurbineRequiredPermission trp = (TurbineRequiredPermission) annotation;
String[] permissionNames = trp.value();
String group = trp.group();
-
+
if (StringUtils.isEmpty(group)) // global group
{
for (String permissionName : permissionNames)
@@ -214,10 +214,10 @@ public class AnnotationProcessor
}
}
}
-
+
return true;
}
-
+
/**
* Search for annotated fields of the object and inject the appropriate
* objects
@@ -291,19 +291,11 @@ public class AnnotationProcessor
try
{
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + loader + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", loader, object);
field.set(object, loader);
}
- catch (IllegalArgumentException e)
- {
- throw new TurbineException("Could not inject loader "
- + loader + " into object " + object, e);
- }
- catch (IllegalAccessException e)
+ catch (IllegalArgumentException | IllegalAccessException e)
{
throw new TurbineException("Could not inject loader "
+ loader + " into object " + object, e);
@@ -320,6 +312,7 @@ public class AnnotationProcessor
*
* @throws TurbineException if configuration cannot be set
*/
+ @SuppressWarnings("boxing")
private static void injectTurbineConfiguration(Object object, Configuration conf, Field field, TurbineConfiguration annotation) throws TurbineException
{
Class<?> type = field.getType();
@@ -329,29 +322,28 @@ public class AnnotationProcessor
{
if (Configuration.class.isAssignableFrom(type))
{
+ final Configuration injectConfiguration;
// Check for annotation value
if (StringUtils.isNotEmpty(key))
{
- conf = conf.subset(key);
+ injectConfiguration = conf.subset(key);
}
-
- if (log.isDebugEnabled())
+ else
{
- log.debug("Injection of " + conf + " into object " + object);
+ injectConfiguration = conf;
}
+ log.debug("Injection of {} into object {}", injectConfiguration, object);
+
field.setAccessible(true);
- field.set(object, conf);
+ field.set(object, injectConfiguration);
}
else if (conf.containsKey(key))
{
if ( String.class.isAssignableFrom( type ) )
{
String value = conf.getString(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + value + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", value, object);
field.setAccessible(true);
field.set(object, value);
@@ -359,10 +351,7 @@ public class AnnotationProcessor
else if ( Boolean.TYPE.isAssignableFrom( type ) )
{
boolean value = conf.getBoolean(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + value + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", value, object);
field.setAccessible(true);
field.setBoolean(object, value);
@@ -370,10 +359,7 @@ public class AnnotationProcessor
else if ( Integer.TYPE.isAssignableFrom( type ) )
{
int value = conf.getInt(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + value + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", value, object);
field.setAccessible(true);
field.setInt(object, value);
@@ -381,10 +367,7 @@ public class AnnotationProcessor
else if ( Long.TYPE.isAssignableFrom( type ) )
{
long value = conf.getLong(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + value + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", value, object);
field.setAccessible(true);
field.setLong(object, value);
@@ -392,10 +375,7 @@ public class AnnotationProcessor
else if ( Short.TYPE.isAssignableFrom( type ) )
{
short value = conf.getShort(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + value + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", value, object);
field.setAccessible(true);
field.setShort(object, value);
@@ -403,10 +383,7 @@ public class AnnotationProcessor
else if ( Long.TYPE.isAssignableFrom( type ) )
{
long value = conf.getLong(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + value + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", value, object);
field.setAccessible(true);
field.setLong(object, value);
@@ -414,10 +391,7 @@ public class AnnotationProcessor
else if ( Float.TYPE.isAssignableFrom( type ) )
{
float value = conf.getFloat(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + value + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", value, object);
field.setAccessible(true);
field.setFloat(object, value);
@@ -425,10 +399,7 @@ public class AnnotationProcessor
else if ( Double.TYPE.isAssignableFrom( type ) )
{
double value = conf.getDouble(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + value + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", value, object);
field.setAccessible(true);
field.setDouble(object, value);
@@ -436,10 +407,7 @@ public class AnnotationProcessor
else if ( Byte.TYPE.isAssignableFrom( type ) )
{
byte value = conf.getByte(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + value + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", value, object);
field.setAccessible(true);
field.setByte(object, value);
@@ -447,22 +415,14 @@ public class AnnotationProcessor
else if ( List.class.isAssignableFrom( type ) )
{
List<Object> values = conf.getList(key);
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + values + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", values, object);
field.setAccessible(true);
field.set(object, values);
}
}
}
- catch (IllegalArgumentException e)
- {
- throw new TurbineException("Could not inject configuration "
- + conf + " into object " + object, e);
- }
- catch (IllegalAccessException e)
+ catch (IllegalArgumentException | IllegalAccessException e)
{
throw new TurbineException("Could not inject configuration "
+ conf + " into object " + object, e);
@@ -499,7 +459,7 @@ public class AnnotationProcessor
{
serviceName = (String)f.get(null);
}
- catch (Exception e)
+ catch (IllegalArgumentException | IllegalAccessException e)
{
continue;
}
@@ -511,7 +471,7 @@ public class AnnotationProcessor
{
serviceName = (String)f.get(null);
}
- catch (Exception e)
+ catch (IllegalArgumentException | IllegalAccessException e)
{
continue;
}
@@ -526,29 +486,18 @@ public class AnnotationProcessor
serviceName = field.getType().getName();
}
- if (log.isDebugEnabled())
- {
- log.debug("Looking up service for injection: " + serviceName + " for object " + object);
- }
+ log.debug("Looking up service for injection: {} for object {}", serviceName, object);
Object service = manager.getService(serviceName); // throws Exception on unknown service
field.setAccessible(true);
try
{
- if (log.isDebugEnabled())
- {
- log.debug("Injection of " + serviceName + " into object " + object);
- }
+ log.debug("Injection of {} into object {}", serviceName, object);
field.set(object, service);
}
- catch (IllegalArgumentException e)
- {
- throw new TurbineException("Could not inject service "
- + serviceName + " into object " + object, e);
- }
- catch (IllegalAccessException e)
+ catch (IllegalArgumentException | IllegalAccessException e)
{
throw new TurbineException("Could not inject service "
+ serviceName + " into object " + object, e);
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/actions/AccessController.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/actions/AccessController.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/actions/AccessController.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/actions/AccessController.java Sun Mar 3 10:36:42 2019
@@ -1,5 +1,10 @@
package org.apache.turbine.modules.actions;
+import org.apache.fulcrum.security.acl.AccessControlList;
+import org.apache.fulcrum.security.model.turbine.TurbineAccessControlList;
+import org.apache.fulcrum.security.util.FulcrumSecurityException;
+import org.apache.logging.log4j.LogManager;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,11 +24,7 @@ package org.apache.turbine.modules.actio
* under the License.
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.fulcrum.security.acl.AccessControlList;
-import org.apache.fulcrum.security.model.turbine.TurbineAccessControlList;
-import org.apache.fulcrum.security.util.FulcrumSecurityException;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.annotation.TurbineService;
@@ -72,7 +73,7 @@ public class AccessController
{
/** Logging */
- private static Log log = LogFactory.getLog(AccessController.class);
+ private static Logger log = LogManager.getLogger(AccessController.class);
/** Injected service instance */
@TurbineService
@@ -98,7 +99,7 @@ public class AccessController
if (!security.isAnonymousUser(user)
&& user.hasLoggedIn())
{
- log.debug("Fetching ACL for " + user.getName());
+ log.debug("Fetching ACL for {}", user::getName);
AccessControlList acl = (AccessControlList)
data.getSession().getAttribute(
TurbineConstants.ACL_SESSION_KEY);
@@ -109,7 +110,7 @@ public class AccessController
data.getSession().setAttribute(
TurbineConstants.ACL_SESSION_KEY, acl);
- log.debug("ACL is " + acl);
+ log.debug("ACL is {}", acl);
}
data.setACL(acl);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/actions/LoginUser.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/actions/LoginUser.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/actions/LoginUser.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/actions/LoginUser.java Sun Mar 3 10:36:42 2019
@@ -20,8 +20,8 @@ package org.apache.turbine.modules.actio
*/
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import org.apache.fulcrum.security.util.DataBackendException;
import org.apache.fulcrum.security.util.FulcrumSecurityException;
import org.apache.turbine.TurbineConstants;
@@ -55,7 +55,7 @@ public class LoginUser
public static final String CGI_PASSWORD = "password";
/** Logging */
- private static Log log = LogFactory.getLog(LoginUser.class);
+ private static Logger log = LogManager.getLogger(LoginUser.class);
/** Injected service instance */
@TurbineService
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/DefaultSessionValidator.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/DefaultSessionValidator.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/DefaultSessionValidator.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/DefaultSessionValidator.java Sun Mar 3 10:36:42 2019
@@ -20,8 +20,8 @@ package org.apache.turbine.modules.actio
*/
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.annotation.TurbineConfiguration;
@@ -58,7 +58,7 @@ public class DefaultSessionValidator
extends SessionValidator
{
/** Logging */
- private static Log log = LogFactory.getLog(DefaultSessionValidator.class);
+ private static Logger log = LogManager.getLogger(DefaultSessionValidator.class);
@TurbineConfiguration( TurbineConstants.LOGIN_MESSAGE )
private String loginMessage;
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSecureSessionValidator.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSecureSessionValidator.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSecureSessionValidator.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSecureSessionValidator.java Sun Mar 3 10:36:42 2019
@@ -20,8 +20,8 @@ package org.apache.turbine.modules.actio
*/
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.annotation.TurbineConfiguration;
@@ -57,7 +57,7 @@ public class TemplateSecureSessionValida
extends SessionValidator
{
/** Logging */
- private static Log log = LogFactory.getLog(
+ private static Logger log = LogManager.getLogger(
TemplateSecureSessionValidator.class);
@@ -110,8 +110,7 @@ public class TemplateSecureSessionValida
}
// Set the screen template to the login page.
- log.debug("Sending User to the Login Screen ("
- + templateLogin + ")");
+ log.debug("Sending User to the Login Screen ({})", templateLogin);
data.getTemplateInfo().setScreenTemplate(templateLogin);
// We're not doing any actions buddy! (except action.login which
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSessionValidator.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSessionValidator.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSessionValidator.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSessionValidator.java Sun Mar 3 10:36:42 2019
@@ -20,8 +20,8 @@ package org.apache.turbine.modules.actio
*/
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import org.apache.turbine.Turbine;
import org.apache.turbine.om.security.User;
import org.apache.turbine.pipeline.PipelineData;
@@ -50,7 +50,7 @@ public class TemplateSessionValidator
extends SessionValidator
{
/** Logging */
- private static Log log = LogFactory.getLog(TemplateSessionValidator.class);
+ private static Logger log = LogManager.getLogger(TemplateSessionValidator.class);
/**
* Execute the action.
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java Sun Mar 3 10:36:42 2019
@@ -1,5 +1,7 @@
package org.apache.turbine.modules.layouts;
+import org.apache.logging.log4j.LogManager;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,8 +21,7 @@ package org.apache.turbine.modules.layou
* under the License.
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.modules.Layout;
@@ -51,7 +52,7 @@ public class VelocityCachedLayout
extends Layout
{
/** Logging */
- private static Log log = LogFactory.getLog(VelocityCachedLayout.class);
+ private static Logger log = LogManager.getLogger(VelocityCachedLayout.class);
/** The prefix for lookup up layout pages */
private String prefix = getPrefix() + "/";
@@ -92,7 +93,7 @@ public class VelocityCachedLayout
data.getResponse().setLocale(data.getLocale());
data.getResponse().setContentType(data.getContentType());
- log.debug("Now trying to render layout " + templateName);
+ log.debug("Now trying to render layout {}", templateName);
// Finally, generate the layout template and send it to the browser
velocityService.handleRequest(context,
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java Sun Mar 3 10:36:42 2019
@@ -1,6 +1,8 @@
package org.apache.turbine.modules.layouts;
+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.modules.layou
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.modules.Layout;
@@ -51,7 +52,7 @@ public class VelocityDirectLayout
extends Layout
{
/** Logging */
- private static Log log = LogFactory.getLog(VelocityDirectLayout.class);
+ private static Logger log = LogManager.getLogger(VelocityDirectLayout.class);
/** The prefix for lookup up layout pages */
private String prefix = Layout.PREFIX + "/";
@@ -92,7 +93,7 @@ public class VelocityDirectLayout
data.getResponse().setLocale(data.getLocale());
data.getResponse().setContentType(data.getContentType());
- log.debug("Now trying to render layout " + templateName);
+ log.debug("Now trying to render layout {}", templateName);
// Finally, generate the layout template and send it to the browser
velocityService.handleRequest(context,
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java Sun Mar 3 10:36:42 2019
@@ -22,8 +22,8 @@ package org.apache.turbine.modules.layou
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.TurbineConstants;
import org.apache.turbine.annotation.TurbineLoader;
import org.apache.turbine.annotation.TurbineService;
@@ -72,7 +72,7 @@ public class VelocityOnlyLayout
extends Layout
{
/** Logging */
- private static Log log = LogFactory.getLog(VelocityOnlyLayout.class);
+ private static Logger log = LogManager.getLogger(VelocityOnlyLayout.class);
/** The prefix for lookup up layout pages */
private final String prefix = Layout.PREFIX + "/";
@@ -103,7 +103,7 @@ public class VelocityOnlyLayout
String screenName = data.getScreen();
- log.debug("Loading Screen " + screenName);
+ log.debug("Loading Screen {}", screenName);
// First, generate the screen and put it in the context so
// we can grab it the layout template.
@@ -126,7 +126,7 @@ public class VelocityOnlyLayout
data.getResponse().setLocale(data.getLocale());
data.getResponse().setContentType(data.getContentType());
- log.debug("Now trying to render layout " + templateName);
+ log.debug("Now trying to render layout {}", templateName);
// Finally, generate the layout template and send it to the browser
velocityService.handleRequest(context,
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java Sun Mar 3 10:36:42 2019
@@ -24,9 +24,9 @@ package org.apache.turbine.modules.layou
import java.io.StringReader;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.fulcrum.xslt.XSLTService;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.annotation.TurbineLoader;
import org.apache.turbine.annotation.TurbineService;
@@ -61,7 +61,7 @@ import org.apache.velocity.context.Conte
public class VelocityXslLayout extends Layout
{
/** Logging */
- private static Log log = LogFactory.getLog(VelocityXslLayout.class);
+ private static Logger log = LogManager.getLogger(VelocityXslLayout.class);
/** The prefix for lookup up layout pages */
private final String prefix = Layout.PREFIX + "/";
@@ -97,7 +97,7 @@ public class VelocityXslLayout extends L
String screenName = data.getScreen();
- log.debug("Loading Screen " + screenName);
+ log.debug("Loading Screen {}", screenName);
// First, generate the screen and put it in the context so
// we can grab it the layout template.
@@ -116,7 +116,7 @@ public class VelocityXslLayout extends L
// (done by the TemplateInfo object)
String templateName = data.getTemplateInfo().getLayoutTemplate();
- log.debug("Now trying to render layout " + templateName);
+ log.debug("Now trying to render layout {}", templateName);
// Now, generate the layout template.
String temp = velocityService.handleRequest(context,
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/pages/DefaultPage.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/pages/DefaultPage.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/pages/DefaultPage.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/pages/DefaultPage.java Sun Mar 3 10:36:42 2019
@@ -22,8 +22,8 @@ package org.apache.turbine.modules.pages
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.annotation.TurbineLoader;
import org.apache.turbine.modules.Action;
import org.apache.turbine.modules.ActionLoader;
@@ -93,7 +93,7 @@ public class DefaultPage
extends Page
{
/** Logging */
- protected Log log = LogFactory.getLog(this.getClass());
+ protected Logger log = LogManager.getLogger(this.getClass());
/** Injected loader instance */
@TurbineLoader( Action.class )
@@ -141,7 +141,7 @@ public class DefaultPage
String screenName = data.getScreen();
- log.debug("Building " + screenName);
+ log.debug("Building {}", screenName);
// Ask the Screen for its Layout and then execute the Layout.
// The Screen can override the getLayout() method to re-define
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java Sun Mar 3 10:36:42 2019
@@ -1,5 +1,7 @@
package org.apache.turbine.modules.screens;
+import org.apache.logging.log4j.LogManager;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,8 +21,7 @@ package org.apache.turbine.modules.scree
* under the License.
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
import org.apache.turbine.annotation.TurbineLoader;
import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.modules.Screen;
@@ -52,7 +53,7 @@ public abstract class TemplateScreen
extends Screen
{
/** Logging */
- protected Log log = LogFactory.getLog(this.getClass());
+ protected Logger log = LogManager.getLogger(this.getClass());
/** Injected service instance */
@TurbineService
@@ -173,7 +174,7 @@ public abstract class TemplateScreen
public void doRedirect(PipelineData pipelineData, String screen, String template)
throws Exception
{
- log.debug("doRedirect(data, " + screen + ", " + template + ")");
+ log.debug("doRedirect(data, {}, {})", screen, template);
setTemplate(pipelineData, template);
screenLoader.exec(pipelineData, screen);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/om/security/DefaultUserImpl.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/om/security/DefaultUserImpl.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/om/security/DefaultUserImpl.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/om/security/DefaultUserImpl.java Sun Mar 3 10:36:42 2019
@@ -1,26 +1,5 @@
package org.apache.turbine.om.security;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -99,7 +78,9 @@ public class DefaultUserImpl implements
{
if (hasLoggedIn())
{
- SecurityService securityService = (SecurityService)TurbineServices.getInstance().getService(SecurityService.SERVICE_NAME);
+ SecurityService securityService =
+ (SecurityService)TurbineServices.getInstance()
+ .getService(SecurityService.SERVICE_NAME);
securityService.saveOnSessionUnbind(this);
}
}
@@ -110,10 +91,7 @@ public class DefaultUserImpl implements
// To prevent messages being lost in case the logging system
// goes away before sessions get unbound on servlet container
// shutdown, print the stacktrace to the container's console.
- ByteArrayOutputStream ostr = new ByteArrayOutputStream();
- e.printStackTrace(new PrintWriter(ostr, true));
- String stackTrace = ostr.toString();
- System.out.println(stackTrace);
+ e.printStackTrace(System.out);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/om/security/TurbineUserDelegate.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/om/security/TurbineUserDelegate.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/om/security/TurbineUserDelegate.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/om/security/TurbineUserDelegate.java Sun Mar 3 10:36:42 2019
@@ -33,13 +33,12 @@ public interface TurbineUserDelegate {
*
* @return the userDelegate
*/
- public abstract TurbineUser getUserDelegate();
+ TurbineUser getUserDelegate();
/**
* Set the delegated user
*
* @param userDelegate the userDelegate to set
*/
- public abstract void setUserDelegate(TurbineUser userDelegate);
-
+ void setUserDelegate(TurbineUser userDelegate);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/om/security/User.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/om/security/User.java?rev=1854688&r1=1854687&r2=1854688&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/om/security/User.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/om/security/User.java Sun Mar 3 10:36:42 2019
@@ -1,5 +1,7 @@
package org.apache.turbine.om.security;
+import java.util.Date;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -83,7 +85,7 @@ public interface User
*
* @return A Java Date with the last access date for the user.
*/
- java.util.Date getLastAccessDate();
+ Date getLastAccessDate();
/**
* Gets the create date for this User. This is the time at which
@@ -91,14 +93,14 @@ public interface User
*
* @return A Java Date with the date of creation for the user.
*/
- java.util.Date getCreateDate();
+ Date getCreateDate();
/**
* Returns the user's last login date.
*
* @return A Java Date with the last login date for the user.
*/
- java.util.Date getLastLogin();
+ Date getLastLogin();
/**
* Get an object from permanent storage.
@@ -211,7 +213,7 @@ public interface User
*
* @param lastLogin The last login date.
*/
- void setLastLogin(java.util.Date lastLogin);
+ void setLastLogin(Date lastLogin);
/**
* Put an object into permanent storage.
@@ -251,7 +253,7 @@ public interface User
*
* @param date Creation date
*/
- void setCreateDate(java.util.Date date);
+ void setCreateDate(Date date);
/**
* This method reports whether or not the user has been confirmed