You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by pa...@apache.org on 2018/10/08 14:37:04 UTC

svn commit: r1843153 - /turbine/core/trunk/src/java/org/apache/turbine/Turbine.java

Author: painter
Date: Mon Oct  8 14:37:03 2018
New Revision: 1843153

URL: http://svn.apache.org/viewvc?rev=1843153&view=rev
Log:
Resolved findbug issues, only remaining are in test cases

Modified:
    turbine/core/trunk/src/java/org/apache/turbine/Turbine.java

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=1843153&r1=1843152&r2=1843153&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/Turbine.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/Turbine.java Mon Oct  8 14:37:03 2018
@@ -142,7 +142,7 @@ public class Turbine extends HttpServlet
      * sometimes even concurrently. This causes bad things to happen,
      * so we use this flag to prevent it.
      */
-    private static boolean firstInit = true;
+    private boolean firstInit = true;
 
     /**
      * The pipeline to use when processing requests.
@@ -155,7 +155,7 @@ public class Turbine extends HttpServlet
     /**
      * Should initialization activities be performed during doGet() execution?
      */
-    private static boolean firstDoGet = true;
+    private boolean firstDoGet = true;
 
     /**
      * Keep all the properties of the web server in a convenient data
@@ -353,8 +353,21 @@ public class Turbine extends HttpServlet
         Path targetPath = Paths.get( confPath.toURI() );
         targetPath = targetPath.resolve( confFileRelativePath );
 
-        confPath = targetPath.getParent().normalize().toFile();// base part, normally conf folder
-        confFile = targetPath.getFileName().toString();
+        // Get the target path directory
+        Path targetPathDirectory = targetPath.getParent();
+        if ( targetPathDirectory != null )
+        {
+        	// set the configuration path
+    		confPath = targetPathDirectory.normalize().toFile();
+
+            Path targetFilePath = targetPath.getFileName();
+            if ( targetFilePath != null )
+            {
+            	// set the configuration file name
+            	confFile = targetFilePath.toString();
+            }
+    		
+        }
 
         switch (confStyle)
         {
@@ -459,7 +472,16 @@ public class Turbine extends HttpServlet
             log4jFile = log4jFile.substring( 1 );
         }
         // log4j must either share path with configuration path or resolved relatively
-        Path log4jTarget = targetPath.getParent().resolve( log4jFile ).normalize();
+        Path log4jTarget = null;
+        Path logConfPath = targetPath.getParent();
+        if ( logConfPath != null )
+        {
+        	Path logFilePath = logConfPath.resolve( log4jFile );
+        	if ( logFilePath != null )
+        	{
+        		log4jTarget = logFilePath.normalize();
+            }
+        }
 
         if (StringUtils.isNotEmpty(log4jFile) &&
                 !log4jFile.equalsIgnoreCase("none") && Files.exists( log4jTarget ))



Re: svn commit: r1843153 - /turbine/core/trunk/src/java/org/apache/turbine/Turbine.java

Posted by Jeffery Painter <je...@jivecast.com>.
Thanks Thomas,

Findbugs wasn't happy, but I will change it back :-)

On 10/09/2018 12:13 PM, Thomas Vandahl wrote:
> On 08.10.18 16:37, painter@apache.org wrote:
>> -    private static boolean firstInit = true;
>> +    private boolean firstInit = true;
> See https://rules.sonarsource.com/java/RSPEC-2226 on why these fields
> are static.
>
> Bye, Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
> For additional commands, e-mail: dev-help@turbine.apache.org
>

-- 
Jeff Painter



Re: svn commit: r1843153 - /turbine/core/trunk/src/java/org/apache/turbine/Turbine.java

Posted by Thomas Vandahl <tv...@apache.org>.
On 08.10.18 16:37, painter@apache.org wrote:
> -    private static boolean firstInit = true;
> +    private boolean firstInit = true;

See https://rules.sonarsource.com/java/RSPEC-2226 on why these fields
are static.

Bye, Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org