cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r125954 - /cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java
Date Fri, 21 Jan 2005 19:24:24 GMT
Author: antonio
Date: Fri Jan 21 11:24:22 2005
New Revision: 125954

URL: http://svn.apache.org/viewcvs?view=rev&rev=125954
Log:
Formatting code
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java?view=diff&rev=125954&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java&r1=125953&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java&r2=125954
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java
Fri Jan 21 11:24:22 2005
@@ -38,11 +38,7 @@
 
 public class EsqlHelper {
 
-    private static Boolean TRUE;
-
-    static {
-        EsqlHelper.TRUE = Boolean.TRUE;
-    }
+    //private static Boolean TRUE = Boolean.TRUE;
 
     /** returns byte array from BLOB
      */
@@ -73,9 +69,7 @@
                 buffer = new byte[length];
                 reader.read(buffer);
                 reader.close();
-                if (buffer == null)
-                    return null;
-                return buffer;
+                return buffer != null ? buffer : null;
             } else {
                 return set.getString(column).getBytes();
             }
@@ -88,7 +82,7 @@
                     .getClass()
                     .getMethod("isTemporary", new Class[0])
                     .invoke(dbBlob, new Object[0])
-                    .equals(TRUE))
+                    .equals(Boolean.TRUE))
                     dbBlob.getClass().getMethod("freeTemporary", new Class[0]).invoke(
                         dbBlob,
                         new Object[0]);
@@ -113,12 +107,13 @@
             buffer = new byte[length];
             reader.read(buffer);
             reader.close();
-            if (buffer != null)
+            if (buffer != null) {
                 result = buffer;
-            else if (defaultString != null && !defaultString.equals("_null_"))
+            } else if (defaultString != null && !defaultString.equals("_null_"))
{
                 result = defaultString.getBytes();
-            else
+            } else {
                 result = null;
+            }
         } catch (Exception e) {
             throw new CascadingRuntimeException("Error getting blob data for column " + column,
e);
         } finally {
@@ -128,10 +123,11 @@
                     .getClass()
                     .getMethod("isTemporary", new Class[0])
                     .invoke(dbBlob, new Object[0])
-                    .equals(TRUE))
+                    .equals(Boolean.TRUE)) {
                     dbBlob.getClass().getMethod("freeTemporary", new Class[0]).invoke(
                         dbBlob,
                         new Object[0]);
+                }
             }
         }
         return result;
@@ -169,14 +165,16 @@
                 buffer = new char[length];
                 reader.read(buffer);
                 reader.close();
-                if (reader != null)
+                if (reader != null) {
                     reader.close();
-                if (buffer != null)
+                }
+                if (buffer != null) {
                     result = new String(buffer);
-                else if (defaultString != null && !defaultString.equals("_null_"))
+                } else if (defaultString != null && !defaultString.equals("_null_"))
{
                     result = defaultString;
-                else
+                } else {
                     result = null;
+                }
             } else {
                 result = set.getString(column);
                 if (result == null && defaultString != null && !defaultString.equals("_null_"))
@@ -192,10 +190,11 @@
                         .getClass()
                         .getMethod("isTemporary", new Class[0])
                         .invoke(dbClob, new Object[0])
-                        .equals(TRUE))
+                        .equals(Boolean.TRUE)) {
                         dbClob.getClass().getMethod("freeTemporary", new Class[0]).invoke(
                             dbClob,
                             new Object[0]);
+                    }
                 } catch (Exception e1) {
                     // swallow
                 }
@@ -224,14 +223,16 @@
             buffer = new char[length];
             reader.read(buffer);
             reader.close();
-            if (reader != null)
+            if (reader != null) {
                 reader.close();
-            if (buffer != null)
+            }
+            if (buffer != null) {
                 result = new String(buffer);
-            else if (defaultString != null && !defaultString.equals("_null_"))
+            } else if (defaultString != null && !defaultString.equals("_null_"))
{
                 result = defaultString;
-            else
+            } else {
                 result = null;
+            }
         } catch (Exception e) {
             throw new CascadingRuntimeException("Error getting text from column " + column,
e);
         } finally {
@@ -242,7 +243,7 @@
                         .getClass()
                         .getMethod("isTemporary", new Class[0])
                         .invoke(dbClob, new Object[0])
-                        .equals(TRUE))
+                        .equals(Boolean.TRUE))
                         dbClob.getClass().getMethod("freeTemporary", new Class[0]).invoke(
                             dbClob,
                             new Object[0]);
@@ -284,21 +285,22 @@
                 buffer = new byte[length];
                 asciiStream.read(buffer);
                 asciiStream.close();
-                if (buffer != null)
+                if (buffer != null) {
                     result = new String(buffer);
-                else if (defaultString != null && !defaultString.equals("_null_"))
+                } else if (defaultString != null && !defaultString.equals("_null_"))
{
                     result = defaultString;
-                else
+                } else {
                     result = null;
+                }
             } else {
                 result = set.getString(column);
-                if (result == null && defaultString != null && !defaultString.equals("_null_"))
+                if (result == null && defaultString != null && !defaultString.equals("_null_"))
{
                     result = defaultString;
+                }
             }
         } catch (Exception e) {
             throw new CascadingRuntimeException(
-                "Error getting ascii data from column " + column,
-                e);
+                "Error getting ascii data from column " + column, e);
         } finally {
             if (asciiStream != null) {
                 try {
@@ -314,17 +316,17 @@
                         .getClass()
                         .getMethod("isTemporary", new Class[0])
                         .invoke(dbClob, new Object[0])
-                        .equals(TRUE))
+                        .equals(Boolean.TRUE)) {
                         dbClob.getClass().getMethod("freeTemporary", new Class[0]).invoke(
                             dbClob,
                             new Object[0]);
+                    }
                 } catch (Exception e1) {
                     // swallow
                 }
             }
 
         }
-
         return result;
     }
 
@@ -343,12 +345,13 @@
             buffer = new byte[length];
             asciiStream.read(buffer);
             asciiStream.close();
-            if (buffer != null)
+            if (buffer != null) {
                 result = new String(buffer);
-            else if (defaultString != null && !defaultString.equals("_null_"))
+            } else if (defaultString != null && !defaultString.equals("_null_"))
{
                 result = defaultString;
-            else
+            } else {
                 result = null;
+            }
         } catch (Exception e) {
             throw new CascadingRuntimeException("Error getting ascii data for column " +
column, e);
         } finally {
@@ -366,16 +369,16 @@
                         .getClass()
                         .getMethod("isTemporary", new Class[0])
                         .invoke(dbClob, new Object[0])
-                        .equals(TRUE))
+                        .equals(Boolean.TRUE)) {
                         dbClob.getClass().getMethod("freeTemporary", new Class[0]).invoke(
                             dbClob,
                             new Object[0]);
+                    }
                 } catch (Exception e1) {
                     // swallow
                 }
             }
         }
-
         return result;
     }
 
@@ -390,10 +393,11 @@
                 throw new CascadingRuntimeException("Unsupported Encoding Exception", uee);
             }
         } else {
-            if (defaultString != null && !defaultString.equals("_null_"))
+            if (defaultString != null && !defaultString.equals("_null_")) {
                 return defaultString;
-            else
+            } else {
                 return null; /* before was "" but null is more consequent */
+            }
         }
     }
 

Mime
View raw message