jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject svn commit: r944814 - in /incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH: ./ src/com/ecyrd/jspwiki/ src/com/ecyrd/jspwiki/auth/
Date Sun, 16 May 2010 12:16:08 GMT
Author: metskem
Date: Sun May 16 12:16:08 2010
New Revision: 944814

URL: http://svn.apache.org/viewvc?rev=944814&view=rev
Log:
2.8.4-svn-13   JSPWIKI-646 JSPWiki cannot run without unpacking the war file

Modified:
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthenticationManager.java
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthorizationManager.java

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog?rev=944814&r1=944813&r2=944814&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog Sun May 16 12:16:08 2010
@@ -1,3 +1,9 @@
+2010-05-09  Harry Metske <metskem@apache.org>
+
+        * 2.8.4-svn-13
+        
+        * JSPWIKI-646 JSPWiki cannot run without unpacking the war file
+        
 2010-05-08  Harry Metske <metskem@apache.org>
 
         * 2.8.4-svn-12

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java?rev=944814&r1=944813&r2=944814&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java Sun May
16 12:16:08 2010
@@ -77,7 +77,7 @@ public final class Release
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "12";
+    public static final String     BUILD         = "13";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java?rev=944814&r1=944813&r2=944814&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java Sun
May 16 12:16:08 2010
@@ -347,6 +347,7 @@ public class WikiEngine
             catch( Exception e )
             {
                 context.log( "ERROR: Failed to create a Wiki engine: "+e.getMessage() );
+                log.error( "ERROR: Failed to create a Wiki engine, stacktrace follows " ,
e);
                 throw new InternalWikiException( "No wiki engine, check logs." );
             }
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthenticationManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthenticationManager.java?rev=944814&r1=944813&r2=944814&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthenticationManager.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthenticationManager.java
Sun May 16 12:16:08 2010
@@ -20,7 +20,7 @@
  */
 package com.ecyrd.jspwiki.auth;
 
-import java.io.File;
+import java.io.*;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.Principal;
@@ -605,7 +605,7 @@ public final class AuthenticationManager
         {
             try
             {
-                return defaultFile.toURL();
+                return defaultFile.toURI().toURL();
             }
             catch ( MalformedURLException e)
             {
@@ -616,29 +616,43 @@ public final class AuthenticationManager
         }
 
         // Ok, the absolute path didn't work; try other methods
-        ClassLoader cl = AuthenticationManager.class.getClassLoader();
 
-        URL path = cl.getResource("/WEB-INF/"+name);
-
-        if( path == null )
-            path = cl.getResource("/"+name);
-
-        if( path == null )
-            path = cl.getResource(name);
-
-        if( path == null && engine.getServletContext() != null )
+        URL path = null;
+        
+        if( engine.getServletContext() != null )
         {
             try
             {
-                path = engine.getServletContext().getResource("/WEB-INF/"+name);
+                //  create a tmp file of the policy loaded as an InputStream and return the
URL to it
+                //  
+                InputStream is = engine.getServletContext().getResourceAsStream("/WEB-INF/"
+ name);
+                File tmpFile = File.createTempFile("temp." + name, "");
+                tmpFile.deleteOnExit();
+
+                OutputStream os = new FileOutputStream(tmpFile);
+
+                byte[] buff = new byte[1024];
+
+                while (is.read(buff) != -1)
+                {
+                    os.write(buff);
+                }
+
+                os.close();
+
+                path = tmpFile.toURI().toURL();
+
             }
             catch( MalformedURLException e )
             {
                 // This should never happen unless I screw up
                 log.fatal("Your code is b0rked.  You are a bad person.");
             }
+            catch (IOException e)
+            {
+               log.error("failed to load security policy from " + name + ",stacktrace follows",
e);
+            }
         }
-
         return path;
     }
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthorizationManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthorizationManager.java?rev=944814&r1=944813&r2=944814&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthorizationManager.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/auth/AuthorizationManager.java
Sun May 16 12:16:08 2010
@@ -412,6 +412,7 @@ public final class AuthorizationManager
             if (policyURL != null) 
             {
                 File policyFile = new File( policyURL.getPath() );
+                log.info("We found security policy URL: " + policyURL + " and transformed
it to file " + policyFile.getAbsolutePath());
                 m_localPolicy = new LocalPolicy( policyFile, engine.getContentEncoding()
);
                 m_localPolicy.refresh();
                 log.info( "Initialized default security policy: " + policyFile.getAbsolutePath()
);



Mime
View raw message