Mercurial > hg > Applications > TreeVNC
changeset 77:cdf7bbe45885
remove some warnings
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 29 Apr 2014 18:00:34 +0900 |
parents | ef3586035d25 |
children | fc984746f958 |
files | src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java src/main/java/jp/ac/u_ryukyu/treevnc/client/EchoClient.java src/main/java/jp/ac/u_ryukyu/treevnc/client/GetDataClient.java src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java |
diffstat | 6 files changed, 33 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Tue Apr 29 13:30:39 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Tue Apr 29 18:00:34 2014 +0900 @@ -1,12 +1,6 @@ package jp.ac.u_ryukyu.treevnc; -import java.util.Map; - -import com.glavsoft.viewer.Viewer; import com.glavsoft.viewer.ViewerImpl; -import com.glavsoft.viewer.mvp.View; -import com.glavsoft.viewer.swing.ConnectionParams; - import jp.ac.u_ryukyu.treevnc.client.EchoClient; import jp.ac.u_ryukyu.treevnc.client.GetDataClient; import jp.ac.u_ryukyu.treevnc.client.GetHostClient;
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Tue Apr 29 13:30:39 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Tue Apr 29 18:00:34 2014 +0900 @@ -237,6 +237,7 @@ //os.writeBytes(String.valueOf(echo.client.getFrameWidth())+"\n"); temp comment out for rebuild //os.writeBytes(String.valueOf(echo.client.getFrameHeight())+"\n"); temp comment out for rebuild os.close(); + echoSocket.close(); } private void sendProxyFlag(Writer writer) throws TransportException {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/EchoClient.java Tue Apr 29 13:30:39 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/EchoClient.java Tue Apr 29 18:00:34 2014 +0900 @@ -3,7 +3,6 @@ import java.io.*; import java.net.*; -import com.glavsoft.viewer.Viewer; import com.glavsoft.viewer.ViewerImpl; public class EchoClient {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/GetDataClient.java Tue Apr 29 13:30:39 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/GetDataClient.java Tue Apr 29 18:00:34 2014 +0900 @@ -6,8 +6,6 @@ import java.net.ServerSocket; import java.net.Socket; -import com.glavsoft.viewer.mvp.View; - public class GetDataClient implements Runnable { private ServerSocket server = null; @@ -16,10 +14,7 @@ private boolean stopFlag; private TextBoxClient text = new TextBoxClient(); private String proxyAddr; - private View v; - - - + public String textAddress() { return text.getAddress(); }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Tue Apr 29 13:30:39 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Tue Apr 29 18:00:34 2014 +0900 @@ -12,28 +12,12 @@ import jp.ac.u_ryukyu.treevnc.server.state.ChangeHost; import com.glavsoft.core.SettingsChangedEvent; -import com.glavsoft.exceptions.AuthenticationFailedException; -import com.glavsoft.exceptions.FatalException; -import com.glavsoft.exceptions.TransportException; -import com.glavsoft.exceptions.UnsupportedProtocolVersionException; -import com.glavsoft.exceptions.UnsupportedSecurityTypeException; import com.glavsoft.rfb.IChangeSettingsListener; import com.glavsoft.rfb.IRfbSessionListener; -import com.glavsoft.rfb.protocol.Protocol; import com.glavsoft.rfb.protocol.ProtocolSettings; -import com.glavsoft.transport.Reader; -import com.glavsoft.transport.Writer; -import com.glavsoft.viewer.ConnectionPresenter; import com.glavsoft.viewer.Viewer; import com.glavsoft.viewer.cli.Parser; -import com.glavsoft.viewer.mvp.View; -import com.glavsoft.viewer.swing.ClipboardControllerImpl; -import com.glavsoft.viewer.swing.ConnectionParams; import com.glavsoft.viewer.swing.ParametersHandler; -import com.glavsoft.viewer.swing.Surface; -import com.glavsoft.viewer.swing.SwingConnectionWorkerFactory; -import com.glavsoft.viewer.swing.SwingViewerWindowFactory; -import com.glavsoft.viewer.swing.gui.ConnectionView; public class VncProxyService extends Viewer implements Runnable, IRfbSessionListener, IChangeSettingsListener { @@ -47,31 +31,17 @@ public static Logger logger = Logger.getLogger("com.glavsoft"); private boolean forceReconnection; private String reconnectionReason; - private final ProtocolSettings settings; private AcceptThread acceptThread; private GetBroadCastProxy getCast; public AcceptClient aClient; public int opendPort; - private Viewer view; - - private VncProxyService prevVps; static VncProxyService currentVps; private int fbWidth = 0; - private int fbHeight = 0; private boolean firstTime = true; + private ServerSocket echoServerSocket; - private void initProxy(Parser parser) { - aClient = new AcceptClient(); - ParametersHandler.completeSettingsFromCLI(parser, connectionParams, - settings, uiSettings); - passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD); - logger.info("TightVNC Viewer version " + ver()); - isApplet = false; - } - public VncProxyService() { - // connectionParams = new ConnectionParams(); - settings = ProtocolSettings.getDefaultSettings(); + ProtocolSettings.getDefaultSettings(); uiSettings = super.uiSettings; } @@ -85,7 +55,6 @@ getCast = vps.getCast; aClient = vps.aClient; opendPort = vps.opendPort; - prevVps = vps; } public static void main(String[] argv) { @@ -136,7 +105,6 @@ public void createConnectionAndStart() { Thread thread; opendPort = myRfb.selectPort(5999); - //acceptThread = new AcceptThread(myRfb, opendPort); acceptThread = new AcceptThread(myRfb, opendPort); thread = new Thread(acceptThread); thread.start(); @@ -151,7 +119,6 @@ public void proxyStart(String[] argv, int width, int height) { fbWidth = width; - fbHeight = height; proxyStart(argv); } @@ -192,34 +159,35 @@ private void getChangeScreenRequest() { Thread th = new Thread(new Runnable() { - @Override + + @Override public void run() { while (true) { - try { - Socket clientSocket = null; - ServerSocket echoServer = new ServerSocket(10002); - while (true) { - clientSocket = echoServer.accept(); - BufferedReader is = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); - String newHostName = is.readLine(); - if("checkdelay".equals(newHostName)) { - Long delay = System.currentTimeMillis()-Long.parseLong(is.readLine()); - DataOutputStream os = new DataOutputStream(clientSocket.getOutputStream()); - os.writeBytes(String.valueOf(delay)+"\n"); - } else { - //int width = Integer.parseInt(is.readLine()); - //int height = Integer.parseInt(is.readLine()); - // String screenSize = is.readLine(); - System.out.println(newHostName); - if (permitChangeScreen()) { - changeVNCServer(newHostName, 3200, 1980); - } else { - continue; - } - clientSocket.close(); - } - } - } catch (IOException e) { + try { + Socket clientSocket = null; + echoServerSocket = new ServerSocket(10002); + while (true) { + clientSocket = echoServerSocket.accept(); + BufferedReader is = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); + String newHostName = is.readLine(); + if("checkdelay".equals(newHostName)) { + Long delay = System.currentTimeMillis()-Long.parseLong(is.readLine()); + DataOutputStream os = new DataOutputStream(clientSocket.getOutputStream()); + os.writeBytes(String.valueOf(delay)+"\n"); + } else { + //int width = Integer.parseInt(is.readLine()); + //int height = Integer.parseInt(is.readLine()); + // String screenSize = is.readLine(); + System.out.println(newHostName); + if (permitChangeScreen()) { + changeVNCServer(newHostName, 3200, 1980); + } else { + continue; + } + clientSocket.close(); + } + } + } catch (IOException e) { continue; // log } } @@ -255,8 +223,8 @@ os.writeBytes(port + "\n"); else os.writeBytes(5999 + "\n"); - os.close(); + echoSocket.close(); } passFlag = true; }
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Tue Apr 29 13:30:39 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Tue Apr 29 18:00:34 2014 +0900 @@ -74,7 +74,7 @@ } } - private boolean setWidthAndHeight(String[] args, int i) { + public boolean setWidthAndHeight(String[] args, int i) { if(isInteger(args[++i])&&isInteger(args[++i])) { width = Integer.parseInt(args[--i]); height = Integer.parseInt(args[++i]);