glenn       2002/09/20 10:46:27

  Modified:    jasper2/src/share/org/apache/jasper/compiler Tag:
                        tomcat_4_branch JspRuntimeContext.java
  Log:
  Add read FilePermission for work directory, cleanup docs
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +17 -10    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java
  
  Index: JspRuntimeContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- JspRuntimeContext.java    21 Jun 2002 17:11:32 -0000      1.4
  +++ JspRuntimeContext.java    20 Sep 2002 17:46:27 -0000      1.4.2.1
  @@ -96,10 +96,6 @@
    * is dependent upon.  If a dpendent file changes the JSP page
    * which included it is recompiled.
    *
  - * Saves information about JSP dependincies to the file
  - * <code>JSP_DEPENDENCY.ser</code> in the web application context
  - * work directory.
  - *
    * Only used if a web application context is a directory.
    *
    * @author Glenn L. Nielsen
  @@ -373,23 +369,34 @@
           if( policy != null ) {
               try {          
                   // Get the permissions for the web app context
  -                String contextDir = context.getRealPath("/");
  +                String contextDir = options.getScratchDir().toString();
                   if( contextDir == null ) {
                       contextDir = options.getScratchDir().toString();
                   }
                   URL url = new URL("file:" + contextDir);
                   codeSource = new CodeSource(url,null);
                   permissionCollection = policy.getPermissions(codeSource);
  +
                   // Create a file read permission for web app context directory
                   if (contextDir.endsWith(File.separator)) {
                       contextDir = contextDir + "-";
                   } else {
                       contextDir = contextDir + File.separator + "-";
                   }
  -                permissionCollection.add(new FilePermission(contextDir,"read"));
  +
  +                // Create a file read permission for web app tempdir (work) 
directory
  +                String workDir = options.getScratchDir().toString();
  +                if (workDir.endsWith(File.separator)) {
  +                    workDir = workDir + "-";
  +                } else {
  +                    workDir = workDir + File.separator + "-";
  +                }
  +                permissionCollection.add(new FilePermission(workDir,"read"));
  +
                   // Allow the JSP to access org.apache.jasper.runtime.HttpJspBase
                   permissionCollection.add( new RuntimePermission(
                       "accessClassInPackage.org.apache.jasper.runtime") );
  +
                   if (parentClassLoader instanceof URLClassLoader) {
                       URL [] urls = parentClassLoader.getURLs();
                       String jarUrl = null;
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to