You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2007/10/19 22:36:00 UTC

svn commit: r586599 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java

Author: kmarsden
Date: Fri Oct 19 13:36:00 2007
New Revision: 586599

URL: http://svn.apache.org/viewvc?rev=586599&view=rev
Log:
DERBY-857 Inline FileOutputStream privilege block. Fix javadoc warning


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java?rev=586599&r1=586598&r2=586599&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java Fri Oct 19 13:36:00 2007
@@ -398,9 +398,14 @@
                                 // creation fails. Perhaps that should be investigated as well.
                                 FileOutputStream fos = null;
                                 try {
-                                    fos = privNewFileOutputStream("DerbyLDAP.out");
-                                } catch (Exception e) {
-                                    // If file creation fails do not stop execution.
+                                    fos =  ((FileOutputStream)AccessController.doPrivileged(
+                                                new PrivilegedExceptionAction() {
+                                                    public Object run() throws SecurityException, java.io.IOException {
+                                                        return new  FileOutputStream("DerbyLDAP.out");
+                                                    }
+                                                }));
+                                } catch (PrivilegedActionException pae) {
+                                    // If trace file creation fails do not stop execution.                                    
                                 }
                                 if (fos != null)
                                     initDirContextEnv.put("com.sun.naming.ldap.trace.ber",fos);
@@ -410,25 +415,8 @@
 		}
 	}
 
-	/**
-     * Construct a new FileOutputStream in a privilege block.
-     * 
-	 * @param fileName Filename to create
-	 * @return 
-	 * @throws IOException
-	 */
-	private FileOutputStream privNewFileOutputStream(final String fileName) throws IOException{
-	    try {
-            return ((FileOutputStream)AccessController.doPrivileged(
-                        new PrivilegedExceptionAction() {
-                            public Object run() throws SecurityException, java.io.IOException {
-                                return new  FileOutputStream(fileName);
-                            }
-                        }));
-        } catch (PrivilegedActionException pae) {
-            throw (SecurityException)pae.getException();
-        }
-    }
+	
+	
 	
 
 	/**