From 58c84ffdfc5b57fc39552991459919d4287981a1 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 23 Mar 2002 22:07:00 +0000 Subject: [PATCH] debug noise. coding style --- source/mir/misc/FileUtil.java | 121 +++++++++++++++--------------- source/mircoders/entity/EntityImages.java | 7 +- 2 files changed, 62 insertions(+), 66 deletions(-) diff --git a/source/mir/misc/FileUtil.java b/source/mir/misc/FileUtil.java index f9b3e7e2..e6558795 100755 --- a/source/mir/misc/FileUtil.java +++ b/source/mir/misc/FileUtil.java @@ -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; + } diff --git a/source/mircoders/entity/EntityImages.java b/source/mircoders/entity/EntityImages.java index d495f0b7..977902ea 100755 --- a/source/mircoders/entity/EntityImages.java +++ b/source/mircoders/entity/EntityImages.java @@ -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(); } -- 2.11.0