You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/12/29 02:10:43 UTC

svn commit: r729821 [3/5] - in /webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon: ./ eclipse/plugin/ eclipse/ui/ idea/plugin/ idea/ui/

Modified: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketRR.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketRR.java?rev=729821&r1=729820&r2=729821&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketRR.java (original)
+++ webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketRR.java Sun Dec 28 17:10:41 2008
@@ -1,352 +1,352 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ws.commons.tcpmon;
-
-import javax.swing.JTextArea;
-import javax.swing.table.TableModel;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-
-/**
- * this class handles the pumping of data from the incoming socket to the
- * outgoing socket
- */
-class SocketRR extends Thread {
-
-	/**
-     * Field inSocket
-     */
-    Socket inSocket = null;
-
-    /**
-     * Field outSocket
-     */
-    Socket outSocket = null;
-
-    /**
-     * Field textArea
-     */
-    JTextArea textArea;
-
-    /**
-     * Field in
-     */
-    InputStream in = null;
-
-    /**
-     * Field out
-     */
-    OutputStream out = null;
-
-    /**
-     * Field xmlFormat
-     */
-    boolean xmlFormat;
-
-    /**
-     * Field done
-     */
-    volatile boolean done = false;
-
-    /**
-     * Field tmodel
-     */
-    volatile long elapsed = 0;
-    
-    /**
-     * Field tmodel
-     */
-    TableModel tmodel = null;
-
-    /**
-     * Field tableIndex
-     */
-    int tableIndex = 0;
-
-    /**
-     * Field type
-     */
-    String type = null;
-
-    /**
-     * Field myConnection
-     */
-    Connection myConnection = null;
-
-    /**
-     * Field slowLink
-     */
-    SlowLinkSimulator slowLink;
-
-    /**
-     * Constructor SocketRR
-     *
-     * @param c
-     * @param inputSocket
-     * @param inputStream
-     * @param outputSocket
-     * @param outputStream
-     * @param _textArea
-     * @param format
-     * @param tModel
-     * @param index
-     * @param type
-     * @param slowLink
-     */
-    public SocketRR(Connection c, Socket inputSocket,
-                    InputStream inputStream, Socket outputSocket,
-                    OutputStream outputStream, JTextArea _textArea,
-                    boolean format, TableModel tModel, int index,
-                    final String type, SlowLinkSimulator slowLink) {
-        inSocket = inputSocket;
-        in = inputStream;
-        outSocket = outputSocket;
-        out = outputStream;
-        textArea = _textArea;
-        xmlFormat = format;
-        tmodel = tModel;
-        tableIndex = index;
-        this.type = type;
-        myConnection = c;
-        this.slowLink = slowLink;
-        start();
-    }
-
-    /**
-     * Method isDone
-     *
-     * @return boolean
-     */
-    public boolean isDone() {
-        return done;
-    }
-
-    public String getElapsed() {
-    		return String.valueOf(elapsed);
-    }
-    
-    /**
-     * Method run
-     */
-    public void run() {
-        try {
-            byte[] buffer = new byte[4096];
-            byte[] tmpbuffer = new byte[8192];
-            int saved = 0;
-            int len;
-            int i1, i2;
-            int i;
-            int reqSaved = 0;
-            int tabWidth = 3;
-            boolean atMargin = true;
-            int thisIndent = -1, nextIndent = -1, previousIndent = -1;
-            if (tmodel != null) {
-                String tmpStr = (String) tmodel.getValueAt(tableIndex,
-                		TCPMon.REQ_COLUMN);
-                if (!"".equals(tmpStr)) {
-                    reqSaved = tmpStr.length();
-                }
-            }
-            long start = System.currentTimeMillis();
-            a:
-            for (; ;) {
-            	
-                elapsed = System.currentTimeMillis() - start;
-            	
-                if (done) {
-                    break;
-                }
-                
-                // try{
-                // len = in.available();
-                // }catch(Exception e){len=0;}
-                len = buffer.length;
-
-                // Used to be 1, but if we block it doesn't matter
-                // however 1 will break with some servers, including apache
-                if (len == 0) {
-                    len = buffer.length;
-                }
-                if (saved + len > buffer.length) {
-                    len = buffer.length - saved;
-                }
-                int len1 = 0;
-                while (len1 == 0) {
-                    try {
-                        len1 = in.read(buffer, saved, len);
-                    } catch (Exception ex) {
-                        if (done && (saved == 0)) {
-                            break a;
-                        }
-                        len1 = -1;
-                        break;
-                    }
-                }
-                len = len1;
-                if ((len == -1) && (saved == 0)) {
-                    break;
-                }
-                if (len == -1) {
-                    done = true;
-                }
-
-                // No matter how we may (or may not) format it, send it
-                // on unformatted - we don't want to mess with how its
-                // sent to the other side, just how its displayed
-                if ((out != null) && (len > 0)) {
-                    slowLink.pump(len);
-                    out.write(buffer, saved, len);
-                }
-                
-                if ((tmodel != null) && (reqSaved < 50)) {
-                    String old = (String) tmodel.getValueAt(tableIndex,
-                    		TCPMon.REQ_COLUMN);
-                    old = old + new String(buffer, saved, len);
-                    if (old.length() > 50) {
-                        old = old.substring(0, 50);
-                    }
-                    reqSaved = old.length();
-                    if ((i = old.indexOf('\n')) > 0) {
-                        old = old.substring(0, i - 1);
-                        reqSaved = 50;
-                    }
-                    tmodel.setValueAt(old, tableIndex, TCPMon.REQ_COLUMN);
-                }
-                
-                
-               if (xmlFormat) {
-
-                    // Do XML Formatting
-                    boolean inXML = false;
-                    int bufferLen = saved;
-                    if (len != -1) {
-                        bufferLen += len;
-                    }
-                    i1 = 0;
-                    i2 = 0;
-                    saved = 0;
-                    for (; i1 < bufferLen; i1++) {
-
-                        // Except when we're at EOF, saved last char
-                        if ((len != -1) && (i1 + 1 == bufferLen)) {
-                            saved = 1;
-                            break;
-                        }
-                        thisIndent = -1;
-                        if ((buffer[i1] == '<')
-                                && (buffer[i1 + 1] != '/')) {
-                            previousIndent = nextIndent++;
-                            thisIndent = nextIndent;
-                            inXML = true;
-                        }
-                        if ((buffer[i1] == '<')
-                                && (buffer[i1 + 1] == '/')) {
-                            if (previousIndent > nextIndent) {
-                                thisIndent = nextIndent;
-                            }
-                            previousIndent = nextIndent--;
-                            inXML = true;
-                        }
-                        if ((buffer[i1] == '/')
-                                && (buffer[i1 + 1] == '>')) {
-                            previousIndent = nextIndent--;
-                            inXML = true;
-                        }
-                        if (thisIndent != -1) {
-                            if (thisIndent > 0) {
-                                tmpbuffer[i2++] = (byte) '\n';
-                            }
-                            for (i = tabWidth * thisIndent; i > 0; i--) {
-                                tmpbuffer[i2++] = (byte) ' ';
-                            }
-                        }
-                        atMargin = ((buffer[i1] == '\n')
-                                || (buffer[i1] == '\r'));
-                        if (!inXML || !atMargin) {
-                            tmpbuffer[i2++] = buffer[i1];
-                        }
-                    }
-                    textArea.append(new String(tmpbuffer, 0, i2));
-
-                    // Shift saved bytes to the beginning
-                    for (i = 0; i < saved; i++) {
-                        buffer[i] = buffer[bufferLen - saved + i];
-                    }
-                } else {
-                    textArea.append(new String(buffer, 0, len));
-                }
-            }
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            done = true;
-            try {
-                if (out != null) {
-                    out.flush();
-                    if (null != outSocket) {
-                        outSocket.shutdownOutput();
-                    } else {
-                        out.close();
-                    }
-                    out = null;
-                }
-            } catch (Exception e) {
-            }
-            try {
-                if (in != null) {
-                    if (inSocket != null) {
-                        inSocket.shutdownInput();
-                    } else {
-                        in.close();
-                    }
-                    in = null;
-                }
-            } catch (Exception e) {
-            }
-            myConnection.wakeUp();
-        }
-    }
-
-    /**
-     * Method halt
-     */
-    public void halt() {
-        try {
-            if (inSocket != null) {
-                inSocket.close();
-            }
-            if (outSocket != null) {
-                outSocket.close();
-            }
-            inSocket = null;
-            outSocket = null;
-            if (in != null) {
-                in.close();
-            }
-            if (out != null) {
-                out.close();
-            }
-            in = null;
-            out = null;
-            done = true;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.tcpmon;
+
+import javax.swing.JTextArea;
+import javax.swing.table.TableModel;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+
+/**
+ * this class handles the pumping of data from the incoming socket to the
+ * outgoing socket
+ */
+class SocketRR extends Thread {
+
+	/**
+     * Field inSocket
+     */
+    Socket inSocket = null;
+
+    /**
+     * Field outSocket
+     */
+    Socket outSocket = null;
+
+    /**
+     * Field textArea
+     */
+    JTextArea textArea;
+
+    /**
+     * Field in
+     */
+    InputStream in = null;
+
+    /**
+     * Field out
+     */
+    OutputStream out = null;
+
+    /**
+     * Field xmlFormat
+     */
+    boolean xmlFormat;
+
+    /**
+     * Field done
+     */
+    volatile boolean done = false;
+
+    /**
+     * Field tmodel
+     */
+    volatile long elapsed = 0;
+    
+    /**
+     * Field tmodel
+     */
+    TableModel tmodel = null;
+
+    /**
+     * Field tableIndex
+     */
+    int tableIndex = 0;
+
+    /**
+     * Field type
+     */
+    String type = null;
+
+    /**
+     * Field myConnection
+     */
+    Connection myConnection = null;
+
+    /**
+     * Field slowLink
+     */
+    SlowLinkSimulator slowLink;
+
+    /**
+     * Constructor SocketRR
+     *
+     * @param c
+     * @param inputSocket
+     * @param inputStream
+     * @param outputSocket
+     * @param outputStream
+     * @param _textArea
+     * @param format
+     * @param tModel
+     * @param index
+     * @param type
+     * @param slowLink
+     */
+    public SocketRR(Connection c, Socket inputSocket,
+                    InputStream inputStream, Socket outputSocket,
+                    OutputStream outputStream, JTextArea _textArea,
+                    boolean format, TableModel tModel, int index,
+                    final String type, SlowLinkSimulator slowLink) {
+        inSocket = inputSocket;
+        in = inputStream;
+        outSocket = outputSocket;
+        out = outputStream;
+        textArea = _textArea;
+        xmlFormat = format;
+        tmodel = tModel;
+        tableIndex = index;
+        this.type = type;
+        myConnection = c;
+        this.slowLink = slowLink;
+        start();
+    }
+
+    /**
+     * Method isDone
+     *
+     * @return boolean
+     */
+    public boolean isDone() {
+        return done;
+    }
+
+    public String getElapsed() {
+    		return String.valueOf(elapsed);
+    }
+    
+    /**
+     * Method run
+     */
+    public void run() {
+        try {
+            byte[] buffer = new byte[4096];
+            byte[] tmpbuffer = new byte[8192];
+            int saved = 0;
+            int len;
+            int i1, i2;
+            int i;
+            int reqSaved = 0;
+            int tabWidth = 3;
+            boolean atMargin = true;
+            int thisIndent = -1, nextIndent = -1, previousIndent = -1;
+            if (tmodel != null) {
+                String tmpStr = (String) tmodel.getValueAt(tableIndex,
+                		TCPMon.REQ_COLUMN);
+                if (!"".equals(tmpStr)) {
+                    reqSaved = tmpStr.length();
+                }
+            }
+            long start = System.currentTimeMillis();
+            a:
+            for (; ;) {
+            	
+                elapsed = System.currentTimeMillis() - start;
+            	
+                if (done) {
+                    break;
+                }
+                
+                // try{
+                // len = in.available();
+                // }catch(Exception e){len=0;}
+                len = buffer.length;
+
+                // Used to be 1, but if we block it doesn't matter
+                // however 1 will break with some servers, including apache
+                if (len == 0) {
+                    len = buffer.length;
+                }
+                if (saved + len > buffer.length) {
+                    len = buffer.length - saved;
+                }
+                int len1 = 0;
+                while (len1 == 0) {
+                    try {
+                        len1 = in.read(buffer, saved, len);
+                    } catch (Exception ex) {
+                        if (done && (saved == 0)) {
+                            break a;
+                        }
+                        len1 = -1;
+                        break;
+                    }
+                }
+                len = len1;
+                if ((len == -1) && (saved == 0)) {
+                    break;
+                }
+                if (len == -1) {
+                    done = true;
+                }
+
+                // No matter how we may (or may not) format it, send it
+                // on unformatted - we don't want to mess with how its
+                // sent to the other side, just how its displayed
+                if ((out != null) && (len > 0)) {
+                    slowLink.pump(len);
+                    out.write(buffer, saved, len);
+                }
+                
+                if ((tmodel != null) && (reqSaved < 50)) {
+                    String old = (String) tmodel.getValueAt(tableIndex,
+                    		TCPMon.REQ_COLUMN);
+                    old = old + new String(buffer, saved, len);
+                    if (old.length() > 50) {
+                        old = old.substring(0, 50);
+                    }
+                    reqSaved = old.length();
+                    if ((i = old.indexOf('\n')) > 0) {
+                        old = old.substring(0, i - 1);
+                        reqSaved = 50;
+                    }
+                    tmodel.setValueAt(old, tableIndex, TCPMon.REQ_COLUMN);
+                }
+                
+                
+               if (xmlFormat) {
+
+                    // Do XML Formatting
+                    boolean inXML = false;
+                    int bufferLen = saved;
+                    if (len != -1) {
+                        bufferLen += len;
+                    }
+                    i1 = 0;
+                    i2 = 0;
+                    saved = 0;
+                    for (; i1 < bufferLen; i1++) {
+
+                        // Except when we're at EOF, saved last char
+                        if ((len != -1) && (i1 + 1 == bufferLen)) {
+                            saved = 1;
+                            break;
+                        }
+                        thisIndent = -1;
+                        if ((buffer[i1] == '<')
+                                && (buffer[i1 + 1] != '/')) {
+                            previousIndent = nextIndent++;
+                            thisIndent = nextIndent;
+                            inXML = true;
+                        }
+                        if ((buffer[i1] == '<')
+                                && (buffer[i1 + 1] == '/')) {
+                            if (previousIndent > nextIndent) {
+                                thisIndent = nextIndent;
+                            }
+                            previousIndent = nextIndent--;
+                            inXML = true;
+                        }
+                        if ((buffer[i1] == '/')
+                                && (buffer[i1 + 1] == '>')) {
+                            previousIndent = nextIndent--;
+                            inXML = true;
+                        }
+                        if (thisIndent != -1) {
+                            if (thisIndent > 0) {
+                                tmpbuffer[i2++] = (byte) '\n';
+                            }
+                            for (i = tabWidth * thisIndent; i > 0; i--) {
+                                tmpbuffer[i2++] = (byte) ' ';
+                            }
+                        }
+                        atMargin = ((buffer[i1] == '\n')
+                                || (buffer[i1] == '\r'));
+                        if (!inXML || !atMargin) {
+                            tmpbuffer[i2++] = buffer[i1];
+                        }
+                    }
+                    textArea.append(new String(tmpbuffer, 0, i2));
+
+                    // Shift saved bytes to the beginning
+                    for (i = 0; i < saved; i++) {
+                        buffer[i] = buffer[bufferLen - saved + i];
+                    }
+                } else {
+                    textArea.append(new String(buffer, 0, len));
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            done = true;
+            try {
+                if (out != null) {
+                    out.flush();
+                    if (null != outSocket) {
+                        outSocket.shutdownOutput();
+                    } else {
+                        out.close();
+                    }
+                    out = null;
+                }
+            } catch (Exception e) {
+            }
+            try {
+                if (in != null) {
+                    if (inSocket != null) {
+                        inSocket.shutdownInput();
+                    } else {
+                        in.close();
+                    }
+                    in = null;
+                }
+            } catch (Exception e) {
+            }
+            myConnection.wakeUp();
+        }
+    }
+
+    /**
+     * Method halt
+     */
+    public void halt() {
+        try {
+            if (inSocket != null) {
+                inSocket.close();
+            }
+            if (outSocket != null) {
+                outSocket.close();
+            }
+            inSocket = null;
+            outSocket = null;
+            if (in != null) {
+                in.close();
+            }
+            if (out != null) {
+                out.close();
+            }
+            in = null;
+            out = null;
+            done = true;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Propchange: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketRR.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketWaiter.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketWaiter.java?rev=729821&r1=729820&r2=729821&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketWaiter.java (original)
+++ webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketWaiter.java Sun Dec 28 17:10:41 2008
@@ -1,106 +1,106 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ws.commons.tcpmon;
-
-import javax.swing.JLabel;
-import java.awt.Color;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-/**
- * wait for incoming connections, spawn a connection thread when
- * stuff comes in.
- */
-class SocketWaiter extends Thread {
-
-   /**
-    * Field sSocket
-    */
-   ServerSocket sSocket = null;
-
-   /**
-    * Field listener
-    */
-   Listener listener;
-
-   /**
-    * Field port
-    */
-   int port;
-
-   /**
-    * Field pleaseStop
-    */
-   boolean pleaseStop = false;
-
-   /**
-    * Constructor SocketWaiter
-    *
-    * @param l
-    * @param p
-    */
-   public SocketWaiter(Listener l, int p) {
-       listener = l;
-       port = p;
-       start();
-   }
-
-   /**
-    * Method run
-    */
-   public void run() {
-       try {
-           listener.setLeft(
-                   new JLabel(
-                		   TCPMon.getMessage("wait00",
-                                   " Waiting for Connection...")));
-           listener.repaint();
-           sSocket = new ServerSocket(port);
-           for (; ;) {
-               Socket inSocket = sSocket.accept();
-               if (pleaseStop) {
-                   break;
-               }
-               new Connection(listener, inSocket);
-               inSocket = null;
-           }
-       } catch (Exception exp) {
-           if (!"socket closed".equals(exp.getMessage())) {
-               JLabel tmp = new JLabel(exp.toString());
-               tmp.setForeground(Color.red);
-               listener.setLeft(tmp);
-               listener.setRight(new JLabel(""));
-               listener.stop();
-           }
-       }
-   }
-
-   /**
-    * force a halt by connecting to self and then closing the server socket
-    */
-   public void halt() {
-       try {
-           pleaseStop = true;
-           new Socket("127.0.0.1", port);
-           if (sSocket != null) {
-               sSocket.close();
-           }
-       } catch (Exception e) {
-           e.printStackTrace();
-       }
-   }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.tcpmon;
+
+import javax.swing.JLabel;
+import java.awt.Color;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * wait for incoming connections, spawn a connection thread when
+ * stuff comes in.
+ */
+class SocketWaiter extends Thread {
+
+   /**
+    * Field sSocket
+    */
+   ServerSocket sSocket = null;
+
+   /**
+    * Field listener
+    */
+   Listener listener;
+
+   /**
+    * Field port
+    */
+   int port;
+
+   /**
+    * Field pleaseStop
+    */
+   boolean pleaseStop = false;
+
+   /**
+    * Constructor SocketWaiter
+    *
+    * @param l
+    * @param p
+    */
+   public SocketWaiter(Listener l, int p) {
+       listener = l;
+       port = p;
+       start();
+   }
+
+   /**
+    * Method run
+    */
+   public void run() {
+       try {
+           listener.setLeft(
+                   new JLabel(
+                		   TCPMon.getMessage("wait00",
+                                   " Waiting for Connection...")));
+           listener.repaint();
+           sSocket = new ServerSocket(port);
+           for (; ;) {
+               Socket inSocket = sSocket.accept();
+               if (pleaseStop) {
+                   break;
+               }
+               new Connection(listener, inSocket);
+               inSocket = null;
+           }
+       } catch (Exception exp) {
+           if (!"socket closed".equals(exp.getMessage())) {
+               JLabel tmp = new JLabel(exp.toString());
+               tmp.setForeground(Color.red);
+               listener.setLeft(tmp);
+               listener.setRight(new JLabel(""));
+               listener.stop();
+           }
+       }
+   }
+
+   /**
+    * force a halt by connecting to self and then closing the server socket
+    */
+   public void halt() {
+       try {
+           pleaseStop = true;
+           new Socket("127.0.0.1", port);
+           if (sSocket != null) {
+               sSocket.close();
+           }
+       } catch (Exception e) {
+           e.printStackTrace();
+       }
+   }
+}

Propchange: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketWaiter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TCPMon.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TCPMon.java?rev=729821&r1=729820&r2=729821&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TCPMon.java (original)
+++ webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TCPMon.java Sun Dec 28 17:10:41 2008
@@ -1,214 +1,214 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ws.commons.tcpmon;
-
-import javax.swing.JFrame;
-import javax.swing.JTabbedPane;
-import javax.swing.UIManager;
-import javax.swing.UnsupportedLookAndFeelException;
-import java.util.ResourceBundle;
-
-/**
- * Proxy that sniffs and shows HTTP messages and responses, both SOAP and plain HTTP.
- */
-
-public class TCPMon extends JFrame {
-
-    /**
-     * Field notebook
-     */
-    private JTabbedPane notebook = null;
-
-    /**
-     * Field STATE_COLUMN
-     */
-    static final int STATE_COLUMN = 0;
-
-    /**
-     * Field OUTHOST_COLUMN
-     */
-    static final int OUTHOST_COLUMN = 3;
-
-    /**
-     * Field REQ_COLUMN
-     */
-    static final int REQ_COLUMN = 4;
-
-    /**
-     * Field ELAPSED_COLUMN
-     */
-    static final int ELAPSED_COLUMN = 5;
-    
-    /**
-     * Field DEFAULT_HOST
-     */
-    static final String DEFAULT_HOST = "127.0.0.1";
-
-    /**
-     * Field DEFAULT_PORT
-     */
-    static final int DEFAULT_PORT = 8888;
-
-    /**
-     * Constructor
-     *
-     * @param listenPort
-     * @param targetHost
-     * @param targetPort
-     * @param embedded
-     */
-    public TCPMon(int listenPort, String targetHost, int targetPort, boolean embedded) {
-        super(getMessage("httptracer00","TCPMon"));
-        notebook = new JTabbedPane();
-        this.getContentPane().add(notebook);
-        new AdminPane(notebook, getMessage("admin00", "Admin"));
-        if (listenPort != 0) {
-            Listener l = null;
-            if (targetHost == null) {
-                l = new Listener(notebook, null, listenPort, targetHost, targetPort, true, null);
-            } else {
-                l = new Listener(notebook, null, listenPort, targetHost, targetPort, false, null);
-            }
-            notebook.setSelectedIndex(0);
-            l.HTTPProxyHost = System.getProperty("http.proxyHost");
-            if ((l.HTTPProxyHost != null) && l.HTTPProxyHost.equals("")) {
-                l.HTTPProxyHost = null;
-            }
-            if (l.HTTPProxyHost != null) {
-                String tmp = System.getProperty("http.proxyPort");
-                if ((tmp != null) && tmp.equals("")) {
-                    tmp = null;
-                }
-                if (tmp == null) {
-                    l.HTTPProxyPort = 80;
-                } else {
-                    l.HTTPProxyPort = Integer.parseInt(tmp);
-                }
-            }
-        }
-        if (!embedded) {
-            this.setDefaultCloseOperation(EXIT_ON_CLOSE);
-        }
-        this.pack();
-        this.setSize(1000, 700);
-        this.setVisible(true);
-    }
-
-    /**
-     * Constructor
-     *
-     * @param listenPort
-     * @param targetHost
-     * @param targetPort
-     */
-    public TCPMon(int listenPort, String targetHost, int targetPort) {
-        this(listenPort, targetHost, targetPort, false);
-    }
-
-    /**
-     * set up the L&F
-     *
-     * @param nativeLookAndFeel
-     * @throws Exception
-     */
-    private static void setupLookAndFeel(boolean nativeLookAndFeel) throws Exception {
-        String classname = UIManager.getCrossPlatformLookAndFeelClassName();
-        if (nativeLookAndFeel) {
-            classname = UIManager.getSystemLookAndFeelClassName();
-        }
-        String lafProperty = System.getProperty("httptracer.laf", "");
-        if (lafProperty.length() > 0) {
-            classname = lafProperty;
-        }
-        try {
-            UIManager.setLookAndFeel(classname);
-        } catch (ClassNotFoundException e) {
-            e.printStackTrace();
-        } catch (InstantiationException e) {
-            e.printStackTrace();
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        } catch (UnsupportedLookAndFeelException e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * this is our main method
-     *
-     * @param args
-     */
-    public static void main(String[] args) {
-        try {
-
-            // switch between swing L&F here
-            setupLookAndFeel(true);
-            if (args.length == 3) {
-                int p1 = Integer.parseInt(args[0]);
-                int p2 = Integer.parseInt(args[2]);
-                new TCPMon(p1, args[1], p2);
-            } else if (args.length == 1) {
-                int p1 = Integer.parseInt(args[0]);
-                new TCPMon(p1, null, 0);
-            } else if (args.length != 0) {
-                System.err.println(
-                        getMessage("usage00", "Usage:")
-                        + " TCPMon [listenPort targetHost targetPort]\n");
-            } else {
-                new TCPMon(0, null, 0);
-            }
-        } catch (Throwable exp) {
-            exp.printStackTrace();
-        }
-    }
-
-    /**
-     * Field messages
-     */
-    private static ResourceBundle messages = null;
-
-    /**
-     * Get the message with the given key.  There are no arguments for this message.
-     *
-     * @param key
-     * @param defaultMsg
-     * @return string
-     */
-    public static String getMessage(String key, String defaultMsg) {
-        try {
-            if (messages == null) {
-                initializeMessages();
-            }
-            return messages.getString(key);
-        } catch (Throwable t) {
-
-            // If there is any problem whatsoever getting the internationalized
-            // message, return the default.
-            return defaultMsg;
-        }
-    }
-
-    /**
-     * Load the resource bundle messages from the properties file.  This is ONLY done when it is
-     * needed.  If no messages are printed (for example, only Wsdl2java is being run in non-
-     * verbose mode) then there is no need to read the properties file.
-     */
-    private static void initializeMessages() {
-        messages = ResourceBundle.getBundle("org.apache.ws.commons.tcpmon.tcpmon");
-    }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.tcpmon;
+
+import javax.swing.JFrame;
+import javax.swing.JTabbedPane;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import java.util.ResourceBundle;
+
+/**
+ * Proxy that sniffs and shows HTTP messages and responses, both SOAP and plain HTTP.
+ */
+
+public class TCPMon extends JFrame {
+
+    /**
+     * Field notebook
+     */
+    private JTabbedPane notebook = null;
+
+    /**
+     * Field STATE_COLUMN
+     */
+    static final int STATE_COLUMN = 0;
+
+    /**
+     * Field OUTHOST_COLUMN
+     */
+    static final int OUTHOST_COLUMN = 3;
+
+    /**
+     * Field REQ_COLUMN
+     */
+    static final int REQ_COLUMN = 4;
+
+    /**
+     * Field ELAPSED_COLUMN
+     */
+    static final int ELAPSED_COLUMN = 5;
+    
+    /**
+     * Field DEFAULT_HOST
+     */
+    static final String DEFAULT_HOST = "127.0.0.1";
+
+    /**
+     * Field DEFAULT_PORT
+     */
+    static final int DEFAULT_PORT = 8888;
+
+    /**
+     * Constructor
+     *
+     * @param listenPort
+     * @param targetHost
+     * @param targetPort
+     * @param embedded
+     */
+    public TCPMon(int listenPort, String targetHost, int targetPort, boolean embedded) {
+        super(getMessage("httptracer00","TCPMon"));
+        notebook = new JTabbedPane();
+        this.getContentPane().add(notebook);
+        new AdminPane(notebook, getMessage("admin00", "Admin"));
+        if (listenPort != 0) {
+            Listener l = null;
+            if (targetHost == null) {
+                l = new Listener(notebook, null, listenPort, targetHost, targetPort, true, null);
+            } else {
+                l = new Listener(notebook, null, listenPort, targetHost, targetPort, false, null);
+            }
+            notebook.setSelectedIndex(0);
+            l.HTTPProxyHost = System.getProperty("http.proxyHost");
+            if ((l.HTTPProxyHost != null) && l.HTTPProxyHost.equals("")) {
+                l.HTTPProxyHost = null;
+            }
+            if (l.HTTPProxyHost != null) {
+                String tmp = System.getProperty("http.proxyPort");
+                if ((tmp != null) && tmp.equals("")) {
+                    tmp = null;
+                }
+                if (tmp == null) {
+                    l.HTTPProxyPort = 80;
+                } else {
+                    l.HTTPProxyPort = Integer.parseInt(tmp);
+                }
+            }
+        }
+        if (!embedded) {
+            this.setDefaultCloseOperation(EXIT_ON_CLOSE);
+        }
+        this.pack();
+        this.setSize(1000, 700);
+        this.setVisible(true);
+    }
+
+    /**
+     * Constructor
+     *
+     * @param listenPort
+     * @param targetHost
+     * @param targetPort
+     */
+    public TCPMon(int listenPort, String targetHost, int targetPort) {
+        this(listenPort, targetHost, targetPort, false);
+    }
+
+    /**
+     * set up the L&F
+     *
+     * @param nativeLookAndFeel
+     * @throws Exception
+     */
+    private static void setupLookAndFeel(boolean nativeLookAndFeel) throws Exception {
+        String classname = UIManager.getCrossPlatformLookAndFeelClassName();
+        if (nativeLookAndFeel) {
+            classname = UIManager.getSystemLookAndFeelClassName();
+        }
+        String lafProperty = System.getProperty("httptracer.laf", "");
+        if (lafProperty.length() > 0) {
+            classname = lafProperty;
+        }
+        try {
+            UIManager.setLookAndFeel(classname);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        } catch (UnsupportedLookAndFeelException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * this is our main method
+     *
+     * @param args
+     */
+    public static void main(String[] args) {
+        try {
+
+            // switch between swing L&F here
+            setupLookAndFeel(true);
+            if (args.length == 3) {
+                int p1 = Integer.parseInt(args[0]);
+                int p2 = Integer.parseInt(args[2]);
+                new TCPMon(p1, args[1], p2);
+            } else if (args.length == 1) {
+                int p1 = Integer.parseInt(args[0]);
+                new TCPMon(p1, null, 0);
+            } else if (args.length != 0) {
+                System.err.println(
+                        getMessage("usage00", "Usage:")
+                        + " TCPMon [listenPort targetHost targetPort]\n");
+            } else {
+                new TCPMon(0, null, 0);
+            }
+        } catch (Throwable exp) {
+            exp.printStackTrace();
+        }
+    }
+
+    /**
+     * Field messages
+     */
+    private static ResourceBundle messages = null;
+
+    /**
+     * Get the message with the given key.  There are no arguments for this message.
+     *
+     * @param key
+     * @param defaultMsg
+     * @return string
+     */
+    public static String getMessage(String key, String defaultMsg) {
+        try {
+            if (messages == null) {
+                initializeMessages();
+            }
+            return messages.getString(key);
+        } catch (Throwable t) {
+
+            // If there is any problem whatsoever getting the internationalized
+            // message, return the default.
+            return defaultMsg;
+        }
+    }
+
+    /**
+     * Load the resource bundle messages from the properties file.  This is ONLY done when it is
+     * needed.  If no messages are printed (for example, only Wsdl2java is being run in non-
+     * verbose mode) then there is no need to read the properties file.
+     */
+    private static void initializeMessages() {
+        messages = ResourceBundle.getBundle("org.apache.ws.commons.tcpmon.tcpmon");
+    }
+
+}

Propchange: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TCPMon.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TcpTunnel.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TcpTunnel.java?rev=729821&r1=729820&r2=729821&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TcpTunnel.java (original)
+++ webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TcpTunnel.java Sun Dec 28 17:10:41 2008
@@ -1,61 +1,61 @@
-/**
- *
- * Copyright 2000-2004 The Apache Software Foundation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.ws.commons.tcpmon;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-/**
- * A <code>TcpTunnel</code> object listens on the given port,
- * and once <code>Start</code> is pressed, will forward all bytes
- * to the given host and port.
- *
- * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
- */
-public class TcpTunnel {
-    public static void main(String args[]) throws IOException {
-        if (args.length != 3 && args.length != 4) {
-            System.err.println("Usage: java TcpTunnel listenport tunnelhost tunnelport [encoding]");
-            System.exit(1);
-        }
-        int listenport = Integer.parseInt(args[0]);
-        String tunnelhost = args[1];
-        int tunnelport = Integer.parseInt(args[2]);
-        String enc;
-        if (args.length == 4) {
-            enc = args[3];
-        } else {
-            enc = "8859_1";
-        }
-        System.out.println("TcpTunnel: ready to rock and roll on port " + listenport);
-        ServerSocket ss = new ServerSocket(listenport);
-        while (true) {
-            // accept the connection from my client
-            Socket sc = ss.accept();
-
-            // connect to the thing I'm tunnelling for
-            Socket st = new Socket(tunnelhost, tunnelport);
-            System.out.println("TcpTunnel: tunnelling port " + listenport + " to port " + tunnelport + " on host " + tunnelhost);
-
-            // relay the stuff thru
-            new Relay(sc.getInputStream(), st.getOutputStream(), System.out, enc).start();
-            new Relay(st.getInputStream(), sc.getOutputStream(), System.out, enc).start();
-            // that's it .. they're off; now I go back to my stuff.
-        }
-    }
-}
+/**
+ *
+ * Copyright 2000-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.commons.tcpmon;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * A <code>TcpTunnel</code> object listens on the given port,
+ * and once <code>Start</code> is pressed, will forward all bytes
+ * to the given host and port.
+ *
+ * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
+ */
+public class TcpTunnel {
+    public static void main(String args[]) throws IOException {
+        if (args.length != 3 && args.length != 4) {
+            System.err.println("Usage: java TcpTunnel listenport tunnelhost tunnelport [encoding]");
+            System.exit(1);
+        }
+        int listenport = Integer.parseInt(args[0]);
+        String tunnelhost = args[1];
+        int tunnelport = Integer.parseInt(args[2]);
+        String enc;
+        if (args.length == 4) {
+            enc = args[3];
+        } else {
+            enc = "8859_1";
+        }
+        System.out.println("TcpTunnel: ready to rock and roll on port " + listenport);
+        ServerSocket ss = new ServerSocket(listenport);
+        while (true) {
+            // accept the connection from my client
+            Socket sc = ss.accept();
+
+            // connect to the thing I'm tunnelling for
+            Socket st = new Socket(tunnelhost, tunnelport);
+            System.out.println("TcpTunnel: tunnelling port " + listenport + " to port " + tunnelport + " on host " + tunnelhost);
+
+            // relay the stuff thru
+            new Relay(sc.getInputStream(), st.getOutputStream(), System.out, enc).start();
+            new Relay(st.getInputStream(), sc.getOutputStream(), System.out, enc).start();
+            // that's it .. they're off; now I go back to my stuff.
+        }
+    }
+}

Propchange: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TcpTunnel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/plugin/TcpmonitorPlugin.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/plugin/TcpmonitorPlugin.java?rev=729821&r1=729820&r2=729821&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/plugin/TcpmonitorPlugin.java (original)
+++ webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/plugin/TcpmonitorPlugin.java Sun Dec 28 17:10:41 2008
@@ -1,69 +1,69 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ws.commons.tcpmon.eclipse.plugin;
-
-import org.eclipse.ui.plugin.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class TcpmonitorPlugin extends AbstractUIPlugin {
-
-	//The shared instance.
-	private static TcpmonitorPlugin plugin;
-	
-	/**
-	 * The constructor.
-	 */
-	public TcpmonitorPlugin() {
-		plugin = this;
-	}
-
-	/**
-	 * This method is called upon plug-in activation
-	 */
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-	}
-
-	/**
-	 * This method is called when the plug-in is stopped
-	 */
-	public void stop(BundleContext context) throws Exception {
-		super.stop(context);
-		plugin = null;
-	}
-
-	/**
-	 * Returns the shared instance.
-	 */
-	public static TcpmonitorPlugin getDefault() {
-		return plugin;
-	}
-
-	/**
-	 * Returns an image descriptor for the image file at the given
-	 * plug-in relative path.
-	 *
-	 * @param path the path
-	 * @return the image descriptor
-	 */
-	public static ImageDescriptor getImageDescriptor(String path) {
-		return AbstractUIPlugin.imageDescriptorFromPlugin("tcpmonitor", path);
-	}
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.commons.tcpmon.eclipse.plugin;
+
+import org.eclipse.ui.plugin.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class TcpmonitorPlugin extends AbstractUIPlugin {
+
+	//The shared instance.
+	private static TcpmonitorPlugin plugin;
+	
+	/**
+	 * The constructor.
+	 */
+	public TcpmonitorPlugin() {
+		plugin = this;
+	}
+
+	/**
+	 * This method is called upon plug-in activation
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/**
+	 * This method is called when the plug-in is stopped
+	 */
+	public void stop(BundleContext context) throws Exception {
+		super.stop(context);
+		plugin = null;
+	}
+
+	/**
+	 * Returns the shared instance.
+	 */
+	public static TcpmonitorPlugin getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path.
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return AbstractUIPlugin.imageDescriptorFromPlugin("tcpmonitor", path);
+	}
+}

Propchange: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/plugin/TcpmonitorPlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/ui/Connection.java
------------------------------------------------------------------------------
    svn:eol-style = native