debug noise. coding style
authormh <mh>
Sat, 23 Mar 2002 22:07:00 +0000 (22:07 +0000)
committermh <mh>
Sat, 23 Mar 2002 22:07:00 +0000 (22:07 +0000)
source/mir/misc/FileUtil.java
source/mircoders/entity/EntityImages.java

index f9b3e7e..e655879 100755 (executable)
@@ -21,18 +21,19 @@ import javax.servlet.http.*;
  */
 public final class FileUtil {
 
-    private static boolean fileNameMapLoaded = false;
-    private static FileNameMap fileNameMap;
-    private static String producerStorageRoot;
-
-    //
-    // Initialisierung
-
-    static {
-      System.setProperty("content.types.user.table", MirConfig.getProp("Home")+"content-types.properties");
-      fileNameMap = sun.net.www.MimeTable.loadTable();
-      producerStorageRoot = MirConfig.getProp("Producer.StorageRoot");
-    }
+  private static boolean fileNameMapLoaded = false;
+  private static FileNameMap fileNameMap;
+  private static String producerStorageRoot;
+
+  //
+  // Initialisierung
+
+  static {
+    System.setProperty("content.types.user.table", MirConfig.getProp("Home")+
+                        "content-types.properties");
+    fileNameMap = sun.net.www.MimeTable.loadTable();
+    producerStorageRoot = MirConfig.getProp("Producer.StorageRoot");
+  }
 
   /**
    * Privater Konstruktor, um versehentliche Instantiierung zu verhindern
@@ -47,8 +48,8 @@ public final class FileUtil {
 
                if (in!=null) {
                        try {
-                File f = null;
-                f = new File(filename);
+        File f = null;
+        f = new File(filename);
                                File dir = new File(f.getParent());
                                dir.mkdirs();
 
@@ -58,72 +59,72 @@ public final class FileUtil {
                                outStream.close();
                                retVal = true;
                        } catch(IOException e) {
-                throw new IOException(e.toString());
-            }
-        }
+        throw new IOException(e.toString());
+      }
+    }
                return retVal;
        }
 
   public static boolean read(String filename, byte out[])
     throws IOException {
 
-        File f = null;
-        f = new File(filename);
+    File f = null;
+    f = new File(filename);
 
                if (f.exists()) {
                        try {
-                if (out.length != f.length())
-                    return false;
+        if (out.length != f.length())
+          return false;
                                FileInputStream inStream;
                                inStream = new FileInputStream(f);
                                inStream.read(out);
                                inStream.close();
                        } catch(IOException e) {
-                throw new IOException(e.toString());
-            }
-        } else {
-            return false;
-        }
-               return true;
-       }
+        throw new IOException(e.toString());
+      }
+    } else {
+      return false;
+    }
+    return true;
+  }
     
-    public static long getSize(String filename) {
-        File f = null;
-        f = new File(filename);
-        long l=0;
-
-               if (f.exists()) {
-                return f.length();
-        } else {
-            return -1;
-        }
+  public static long getSize(String filename) {
+    File f = null;
+    f = new File(filename);
+    long l=0;
+
+    if (f.exists()) {
+      return f.length();
+    } else {
+      return -1;
     }
+  }
 
-    private static FileNameMap getFileNameMap() {
-        if ((fileNameMap == null) && !fileNameMapLoaded) {
-            fileNameMap = sun.net.www.MimeTable.loadTable();
-            fileNameMapLoaded = true;
-        }
-
-        return new FileNameMap() {
-            private FileNameMap map = fileNameMap;
-            public String getContentTypeFor(String fileName) {
-                return map.getContentTypeFor(fileName);
-            }
-        };
+  private static FileNameMap getFileNameMap() {
+    if ((fileNameMap == null) && !fileNameMapLoaded) {
+      fileNameMap = sun.net.www.MimeTable.loadTable();
+      fileNameMapLoaded = true;
     }
 
-    public static void setFileNameMap(FileNameMap map) {
-        fileNameMap = map;
-    }
+    return new FileNameMap() {
+      private FileNameMap map = fileNameMap;
+      public String getContentTypeFor(String fileName) {
+        return map.getContentTypeFor(fileName);
+      }
+    };
+  }
 
-    public static String guessContentTypeFromName(String fname) {
-        String contentType = null;
-                    
-        contentType = getFileNameMap().getContentTypeFor(fname);
-                                    
-        return contentType;
-    }
+  public static void setFileNameMap(FileNameMap map) {
+    fileNameMap = map;
+  }
+
+  public static String guessContentTypeFromName(String fname) {
+    String contentType = null;
+                  
+    contentType = getFileNameMap().getContentTypeFor(fname);
+                                  
+    return contentType;
+  }
 
 
  
index d495f0b..977902e 100755 (executable)
@@ -64,9 +64,7 @@ public class EntityImages extends EntityUploadedMedia
               if (rs.next()) {
                 LargeObject lob = lom.open(rs.getInt(1));
                 img_data = lob.read(lob.size());
-                System.err.println("LOB IMG SIZE: "+lob.size());
                 lob.close();
-                System.err.println("res set img NOT NULL2");
                 //img_data = rs.getBytes(1);
               }
             rs.close();
@@ -106,6 +104,7 @@ public class EntityImages extends EntityUploadedMedia
                                byte[] iconData = webdbImage.getIcon();
                                theLog.printDebugInfo("settimage :: getIcon");
 
+
                                if (iconData!=null && imageData!=null) {
                                        con = theStorageObject.getPooledCon();
                                        con.setAutoCommit(false);
@@ -184,15 +183,11 @@ public class EntityImages extends EntityUploadedMedia
                     .getNativeConnection();
             lom = ((org.postgresql.Connection)jCon).getLargeObjectAPI();
                        if(rs!=null) {
-                System.err.println("res set NOT NULL");
                                if (rs.next()) {
                   LargeObject lob = lom.open(rs.getInt(1));
                   img_data = lob.read(lob.size());
-                  System.err.println("LOB SIZE: "+lob.size());
                   lob.close();
-                  System.err.println("res set NOT NULL2");
                   //img_data = rs.getBytes(1);
-                  System.err.println("res set NOT NULL3");
                                }
                 rs.close();
                        }