Author: jflesch
Date: 2007-07-22 22:40:23 +0000 (Sun, 22 Jul 2007)
New Revision: 14270

Modified:
   trunk/apps/Thaw/src/frost/util/FileAccess.java
   trunk/apps/Thaw/src/frost/util/XMLTools.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java
Log:
Fix the build

Modified: trunk/apps/Thaw/src/frost/util/FileAccess.java
===================================================================
--- trunk/apps/Thaw/src/frost/util/FileAccess.java      2007-07-22 22:26:05 UTC 
(rev 14269)
+++ trunk/apps/Thaw/src/frost/util/FileAccess.java      2007-07-22 22:40:23 UTC 
(rev 14270)
@@ -82,8 +82,8 @@
     /**
      * Returns all files starting from given directory/file that have a given 
extension.
      */
-    public static ArrayList<File> getAllEntries(File file, final String 
extension) {
-        ArrayList<File> files = new ArrayList<File>();
+    public static ArrayList getAllEntries(File file, final String extension) {
+        ArrayList files = new ArrayList();
         getAllFiles(file, extension, files);
         return files;
     }
@@ -91,7 +91,7 @@
     /**
      * Returns all files starting from given directory/file that have a given 
extension.
      */
-    private static void getAllFiles(File file, String extension, 
ArrayList<File> filesLst) {
+    private static void getAllFiles(File file, String extension, ArrayList 
filesLst) {
         if( file != null ) {
             if( file.isDirectory() ) {
                 File[] dirfiles = file.listFiles();
@@ -267,9 +267,9 @@
     /**
      * Reads an InputStream and returns a List of lines.
      */
-    public static ArrayList<String> readLines(InputStream is, String encoding) 
{
+    public static ArrayList readLines(InputStream is, String encoding) {
         String line;
-        ArrayList<String> data = new ArrayList<String>();
+        ArrayList data = new ArrayList();
         try {
             InputStreamReader iSReader = new InputStreamReader(is, encoding);
             BufferedReader reader = new BufferedReader(iSReader);
@@ -288,18 +288,25 @@
      * Reads a file and returns its contents in a String
      */
     public static String readFile(File file) {
-        String line;
-        StringBuilder sb = new StringBuilder();
-        try {
-            BufferedReader f = new BufferedReader(new FileReader(file));
-            while( (line = f.readLine()) != null ) {
-                sb.append(line).append("\n");
-            }
-            f.close();
-        } catch (IOException e) {
-            Logger.error(e, "Exception thrown in readFile(String path): 
"+e.toString());
-        }
-        return sb.toString();
+           String data = null;
+           try {
+                   FileInputStream stream = new FileInputStream(file);
+                   DataInputStream dis = new DataInputStream(stream);
+
+                   data = dis.readUTF();
+
+                   dis.close();
+                   stream.close();
+
+           } catch(java.io.FileNotFoundException e) {
+                   Logger.warning(e, "frost.util.FileAcces: Unable to read 
file : "+e.toString());
+                   return null;
+           } catch(java.io.IOException e) {
+                   Logger.warning(e, "frost.util.FileAcces: Unable to read 
file : "+e.toString());
+                   return null;
+           }
+
+           return data;
     }

     /**
@@ -310,19 +317,8 @@
      * @return the contents of the file
      */
     public static String readFile(File file, String encoding) {
-        String line;
-        StringBuilder sb = new StringBuilder();
-        try {
-            InputStreamReader iSReader = new InputStreamReader(new 
FileInputStream(file), encoding);
-            BufferedReader reader = new BufferedReader(iSReader);
-            while ((line = reader.readLine()) != null) {
-                sb.append(line).append("\n");
-            }
-            reader.close();
-        } catch (IOException e) {
-            Logger.error(e, "Exception thrown in readFile(String path, String 
encoding): "+ e.toString());
-        }
-        return sb.toString();
+           /* Jflesch> No really, I don't care of the encoding. */
+           return readFile(file);
     }

     /**

Modified: trunk/apps/Thaw/src/frost/util/XMLTools.java
===================================================================
--- trunk/apps/Thaw/src/frost/util/XMLTools.java        2007-07-22 22:26:05 UTC 
(rev 14269)
+++ trunk/apps/Thaw/src/frost/util/XMLTools.java        2007-07-22 22:40:23 UTC 
(rev 14270)
@@ -221,9 +221,9 @@
     /**
      * Returns a list containing all Elements of this parent with given tag 
name.
      */
-    public static List<Element> getChildElementsByTagName(Element parent, 
String name) {
+    public static List getChildElementsByTagName(Element parent, String name) {

-        LinkedList<Element> newList = new LinkedList<Element>();
+        LinkedList newList = new LinkedList();

         NodeList childs = parent.getChildNodes();
         for( int x=0; x<childs.getLength(); x++ ) {
@@ -276,7 +276,7 @@
             return txtname.getData();
         }

-        StringBuilder sb = new StringBuilder(txtname.getData());
+        StringBuffer sb = new StringBuffer(txtname.getData());
         while( txtname.getNextSibling() != null ) {
             txtname = (CDATASection)txtname.getNextSibling();
             sb.append(txtname.getData());

Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java 
2007-07-22 22:26:05 UTC (rev 14269)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java 
2007-07-22 22:40:23 UTC (rev 14270)
@@ -186,7 +186,7 @@
                return subject;
        }

-       public KSKAuthor getSender() {
+       public thaw.plugins.miniFrost.interfaces.Author getSender() {
                return author;
        }

@@ -371,8 +371,9 @@
                        if (v == null || (size = v.size()) <= 0) {
                                parsed = false;
                        } else {
-                               
((KSKSubMessage)v.get(size-1)).setAuthor(getSender());
-                               
((KSKSubMessage)v.get(size-1)).setDate(getDate());
+                               KSKSubMessage lastMsg = 
(KSKSubMessage)v.get(size-1);
+                               lastMsg.setAuthor((KSKAuthor)getSender());
+                               lastMsg.setDate(getDate());
                        }

                } catch(Exception e) { /* dirty, but should work */


Reply via email to