Author: aadamchik
Date: Sun Dec 24 08:39:59 2006
New Revision: 490038

URL: http://svn.apache.org/viewvc?view=rev&rev=490038
Log:
no change - reformatting the code according to the project Eclipse defaults

Modified:
    
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/DriverDataSourceFactory.java

Modified: 
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/DriverDataSourceFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/DriverDataSourceFactory.java?view=diff&rev=490038&r1=490037&r2=490038
==============================================================================
--- 
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/DriverDataSourceFactory.java
 (original)
+++ 
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/DriverDataSourceFactory.java
 Sun Dec 24 08:39:59 2006
@@ -236,72 +236,68 @@
             super(parser, parentHandler);
         }
 
-        private String passwordFromInputStream(InputStream inputStream)
-        {
-          BufferedReader    bufferedReader    = null;
-          InputStreamReader inputStreamReader = null;
-          String            password          = null;
-          
-          try
-          {
-            inputStreamReader = new InputStreamReader(inputStream);
-            bufferedReader    = new BufferedReader(inputStreamReader);
-            password          = bufferedReader.readLine();
-          }
-          catch (IOException exception)
-          {
-            exception.printStackTrace();
-          }
-          finally
-          {
-            try
-            { bufferedReader.close(); }
-            catch (Exception exception)
-            { }
-
-            try
-            { inputStreamReader.close(); }
-            catch (Exception exception)
-            { }
-
-            try
-            { inputStream.close(); }
-            catch (IOException exception)
-            { }
-          }
+        private String passwordFromInputStream(InputStream inputStream) {
+            BufferedReader bufferedReader = null;
+            InputStreamReader inputStreamReader = null;
+            String password = null;
+
+            try {
+                inputStreamReader = new InputStreamReader(inputStream);
+                bufferedReader = new BufferedReader(inputStreamReader);
+                password = bufferedReader.readLine();
+            }
+            catch (IOException exception) {
+                exception.printStackTrace();
+            }
+            finally {
+                try {
+                    bufferedReader.close();
+                }
+                catch (Exception exception) {
+                }
 
-          return password;
+                try {
+                    inputStreamReader.close();
+                }
+                catch (Exception exception) {
+                }
+
+                try {
+                    inputStream.close();
+                }
+                catch (IOException exception) {
+                }
+            }
+
+            return password;
         }
 
-        private String passwordFromURL(URL url)
-        {
-          InputStream inputStream = null;
-          String      password    = null;
-
-          try
-          {
-            inputStream = url.openStream();
-            password    = passwordFromInputStream(inputStream);
-          }
-          catch (IOException exception)
-          {
-            // Log the error while trying to open the stream.  A null
-            // password will be returned as a result.
-            exception.printStackTrace();
-          }
+        private String passwordFromURL(URL url) {
+            InputStream inputStream = null;
+            String password = null;
+
+            try {
+                inputStream = url.openStream();
+                password = passwordFromInputStream(inputStream);
+            }
+            catch (IOException exception) {
+                // Log the error while trying to open the stream. A null
+                // password will be returned as a result.
+                exception.printStackTrace();
+            }
 
-          return password;
+            return password;
         }
 
         public void init(String name, Attributes atts, DataSourceInfo 
driverInfo) {
             logger.info("loading user name and password.");
 
-            String encoderClass     = atts.getValue("encoderClass");
-            String encoderSalt      = atts.getValue("encoderSalt");
-            String password         = atts.getValue("password");
+            String encoderClass = atts.getValue("encoderClass");
+            String encoderSalt = atts.getValue("encoderSalt");
+            String password = atts.getValue("password");
             String passwordLocation = atts.getValue("passwordLocation");
-            String passwordSource   = atts.getValue("passwordSource");
-            String username         = atts.getValue("userName");
+            String passwordSource = atts.getValue("passwordSource");
+            String username = atts.getValue("userName");
 
             driverInfo.setPasswordEncoderClass(encoderClass);
             driverInfo.setPasswordEncoderSalt(encoderSalt);
@@ -309,58 +305,56 @@
             driverInfo.setPasswordSource(passwordSource);
             driverInfo.setUserName(username);
 
-            // Replace {} in passwordSource with encoderSalt -- useful for 
EXECUTABLE & URL options
+            // Replace {} in passwordSource with encoderSalt -- useful for 
EXECUTABLE &
+            // URL options
             if (encoderSalt != null)
-              passwordSource = passwordSource.replace("\\{\\}", encoderSalt);
+                passwordSource = passwordSource.replace("\\{\\}", encoderSalt);
 
             PasswordEncoding passwordEncoder = driverInfo.getPasswordEncoder();
 
-            if (passwordLocation != null) // New style model (v1.2), process 
extra locations
+            if (passwordLocation != null) // New style model (v1.2), process 
extra
+                                            // locations
             {
-              if 
(passwordLocation.equals(DataSourceInfo.PASSWORD_LOCATION_CLASSPATH))
-              {
-                URL url = 
parentConfiguration.getResourceLocator().findResource(passwordSource);
-
-                if (url != null)
-                  password = passwordFromURL(url);
-                else
-                  logger.error("Could not find resource in CLASSPATH: " + 
passwordSource);
-              }
-              else if 
(passwordLocation.equals(DataSourceInfo.PASSWORD_LOCATION_URL))
-              {
-                try
-                {
-                  password = passwordFromURL(new URL(passwordSource));
-                }
-                catch (MalformedURLException exception)
-                {
-                  exception.printStackTrace();
-                }
-              }
-              else if 
(passwordLocation.equals(DataSourceInfo.PASSWORD_LOCATION_EXECUTABLE))
-              {
-                if (passwordSource != null)
-                {
-                  try
-                  {
-                    Process process = 
Runtime.getRuntime().exec(passwordSource);
-                    password = 
passwordFromInputStream(process.getInputStream());
-                    process.waitFor();
-                  }
-                  catch (IOException exception)
-                  {
-                    exception.printStackTrace();
-                  }
-                  catch (InterruptedException exception)
-                  {
-                    exception.printStackTrace();
-                  }
+                if 
(passwordLocation.equals(DataSourceInfo.PASSWORD_LOCATION_CLASSPATH)) {
+                    URL url = 
parentConfiguration.getResourceLocator().findResource(
+                            passwordSource);
+
+                    if (url != null)
+                        password = passwordFromURL(url);
+                    else
+                        logger.error("Could not find resource in CLASSPATH: "
+                                + passwordSource);
+                }
+                else if 
(passwordLocation.equals(DataSourceInfo.PASSWORD_LOCATION_URL)) {
+                    try {
+                        password = passwordFromURL(new URL(passwordSource));
+                    }
+                    catch (MalformedURLException exception) {
+                        exception.printStackTrace();
+                    }
+                }
+                else if (passwordLocation
+                        .equals(DataSourceInfo.PASSWORD_LOCATION_EXECUTABLE)) {
+                    if (passwordSource != null) {
+                        try {
+                            Process process = 
Runtime.getRuntime().exec(passwordSource);
+                            password = 
passwordFromInputStream(process.getInputStream());
+                            process.waitFor();
+                        }
+                        catch (IOException exception) {
+                            exception.printStackTrace();
+                        }
+                        catch (InterruptedException exception) {
+                            exception.printStackTrace();
+                        }
+                    }
                 }
-              }
             }
 
             if (password != null && passwordEncoder != null)
-              driverInfo.setPassword(passwordEncoder.decodePassword(password, 
encoderSalt));
+                driverInfo.setPassword(passwordEncoder.decodePassword(
+                        password,
+                        encoderSalt));
         }
     }
 


Reply via email to