Commit:    b6de073b00b1d80f479641d96e8edd5c6f9dc253
Author:    krakjoe <joe.watk...@live.co.uk>         Sat, 30 Nov 2013 00:25:05 
+0000
Parents:   af3d792c7844b682cec53d0ef60c14bea2306409
Branches:  PHP-5.6

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=b6de073b00b1d80f479641d96e8edd5c6f9dc253

Log:
...

Changed paths:
  M  tutorials/java/dist/phpdbg-ui.jar
  M  tutorials/java/src/phpdbg/ui/DebugSocket.java
  M  tutorials/java/src/phpdbg/ui/JTerminalPane.java


Diff:
diff --git a/tutorials/java/dist/phpdbg-ui.jar 
b/tutorials/java/dist/phpdbg-ui.jar
index b98dace..b5b6364 100644
Binary files a/tutorials/java/dist/phpdbg-ui.jar and 
b/tutorials/java/dist/phpdbg-ui.jar differ
diff --git a/tutorials/java/src/phpdbg/ui/DebugSocket.java 
b/tutorials/java/src/phpdbg/ui/DebugSocket.java
index bbd7d34a..4542cbf 100644
--- a/tutorials/java/src/phpdbg/ui/DebugSocket.java
+++ b/tutorials/java/src/phpdbg/ui/DebugSocket.java
@@ -76,37 +76,33 @@ public class DebugSocket implements Runnable {
             if (reader) {
                 /* The reader thread part will wait() until there is input */
                 Socket socket = new Socket(this.host, this.port);
-                try {
-                    do {
-                        String command;
-                        OutputStream output = socket.getOutputStream();
+                do {
+                    String command;
+                    OutputStream output = socket.getOutputStream();
 
-                        synchronized(this) {
-                            wait();
+                    synchronized(this) {
+                        wait();
 
-                            if (!quit) {
-                                command = main.getInputField().getText();
-                                /* send command to stdin socket */
-                                if (command != null) {
-                                    if (main.isEchoing()) {
-                                        
main.getOutputField().appendANSI("remote> ");
-                                        
main.getOutputField().appendANSI(command);
-                                        main.getOutputField().appendANSI("\n");
-                                    }
-                                    output.write(
-                                       command.getBytes());
-                                    output.write("\n".getBytes());
-                                    output.flush();
+                        if (!quit) {
+                            command = main.getInputField().getText();
+                            /* send command to stdin socket */
+                            if (command != null) {
+                                if (main.isEchoing()) {
+                                    main.getOutputField().appendANSI("remote> 
");
+                                    main.getOutputField().appendANSI(command);
+                                    main.getOutputField().appendANSI("\n");
                                 }
-                                main.getInputField().setText(null);
+                                output.write(
+                                   command.getBytes());
+                                output.write("\n".getBytes());
+                                output.flush();
                             }
+                            main.getInputField().setText(null);
                         }
-                    } while (!quit);
-                } catch (IOException ex) {
-                    if (!quit) {
-                        main.messageBox(ex.getMessage(), MessageType.ERROR);
                     }
-                }
+                } while (!quit);
+                
+                socket.close();
             } else {
                 /*
                 * The writer thread will use non-blocking i/o consuming
@@ -144,6 +140,7 @@ public class DebugSocket implements Runnable {
                         }
                     }
                 }
+                channel.close();
             }
         } catch (IOException | InterruptedException ex) {
             if (!quit) {
diff --git a/tutorials/java/src/phpdbg/ui/JTerminalPane.java 
b/tutorials/java/src/phpdbg/ui/JTerminalPane.java
index c616d2a..ae63c22 100644
--- a/tutorials/java/src/phpdbg/ui/JTerminalPane.java
+++ b/tutorials/java/src/phpdbg/ui/JTerminalPane.java
@@ -72,11 +72,10 @@ public class JTerminalPane extends JTextPane {
             SimpleAttributeSet.EMPTY, StyleConstants.Foreground, c);
     setCharacterAttributes(aset, false);
     replaceSelection(s);
-    setCaretPosition(
-            (getDocument().getLength() > 0) ? (getDocument().getLength() - 1) 
: 0);
+    setCaretPosition(getDocument().getLength());
   }
 
-  public void appendANSI(String s) {
+  public synchronized void appendANSI(String s) {
     int aPos = 0;
     int aIndex;
     int mIndex;


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to