Update of /cvsroot/monetdb/clients/src/java/src/nl/cwi/monetdb/mcl/net
In directory 
sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15550/src/nl/cwi/monetdb/mcl/net

Modified Files:
        MapiSocket.java 
Log Message:
Return a list of warnings, such that we get separate warnings as in:

Connection warning: Redirect by localhost:50000 to 
mapi:monetdb://127.0.0.1:50003/bla
Connection warning: server is running in maintenance mode

(instead of one string with newlines in it)



Index: MapiSocket.java
===================================================================
RCS file: 
/cvsroot/monetdb/clients/src/java/src/nl/cwi/monetdb/mcl/net/MapiSocket.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- MapiSocket.java     27 Aug 2007 12:52:10 -0000      1.8
+++ MapiSocket.java     28 Aug 2007 21:03:46 -0000      1.9
@@ -191,14 +191,14 @@
         * @param port the port number
         * @param user the username
         * @param pass the password
-        * @return A String with informational (warning) messages, or null
+        * @return A List with informational (warning) messages, or null
         *         if there aren't any
         * @throws IOException if an I/O error occurs when creating the
         *         socket
         * @throws MCLParseException if bogus data is received
         * @throws MCLException if an MCL related error occurs
         */
-       public String connect(String host, int port, String user, String pass) 
+       public List connect(String host, int port, String user, String pass) 
                throws IOException, MCLParseException, MCLException
        {
                if (ttl-- <= 0)
@@ -231,7 +231,8 @@
 
                // read monet response till prompt
                List redirects = null;
-               String err = "", warn = "", tmp;
+               ArrayList warns = new ArrayList();
+               String err = "", tmp;
                int lineType;
                do {
                        if ((tmp = reader.readLine()) == null)
@@ -239,7 +240,7 @@
                        if ((lineType = reader.getLineType()) == 
BufferedMCLReader.ERROR) {
                                err += "\n" + tmp.substring(1);
                        } else if (lineType == BufferedMCLReader.INFO) {
-                               warn += "\n" + tmp.substring(1);
+                               warns.add(tmp.substring(1));
                        } else if (lineType == BufferedMCLReader.REDIRECT) {
                                if (redirects == null)
                                        redirects = new ArrayList();
@@ -277,11 +278,10 @@
                                }
 
                                int p = u.getPort();
-                               String warnings =
-                                       connect(u.getHost(), p == -1 ? port : 
p, user, pass);
-                               if (warnings == null) warnings = "";
-                               warn += "\nRedirect by " + host + ":" + 
-                                       port + " to " + suri + "\n" + warnings;
+                               List w = connect(u.getHost(), p == -1 ? port : 
p, user, pass);
+                               warns.add("Redirect by " + host + ":" + port + 
" to " + suri);
+                               if (w != null)
+                                       warns.addAll(w);
                        } else {
                                String msg = "The server sent a redirect for 
this connection:";
                                for (Iterator it = redirects.iterator(); 
it.hasNext(); ) {
@@ -291,7 +291,7 @@
                        }
                }
 
-               return(warn != "" ? warn.trim() : null);
+               return(warns.size() == 0 ? null : warns);
        }
 
        /**


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to