Skip to content

Commit

Permalink
Implemented better error reporting when an exception is caught while
Browse files Browse the repository at this point in the history
connecting to VNC server.
  • Loading branch information
iiordanov committed Aug 9, 2016
1 parent 49e407d commit 4fd839f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion eclipse_projects/bVNC/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iiordanov.bVNC" android:installLocation="auto"
android:versionCode="3810" android:versionName="v3.8.1">
android:versionCode="3820" android:versionName="v3.8.2">

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10"></uses-sdk>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
Expand Down
2 changes: 1 addition & 1 deletion eclipse_projects/bVNC/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<string name="arrow_right">Right Arrow</string>
<string name="arrow_up">Up Arrow</string>
<string name="auto">Auto</string>
<string name="auto_x_caption">EXPERIMENTAL: bVNC can automatically discover existing and create new X sessions on UNIX systems (like NX). You need x11vnc to find, and Xvfb, Xvnc, or Xdummy to create sessions.</string>
<string name="auto_x_caption">bVNC can automatically discover existing and create new X sessions on Linux/UNIX systems (similar to NX). You need x11vnc to find, and Xvfb, Xvnc, or Xdummy to create sessions. If you have trouble connecting, try selecting a specific Remote Session Type in the AutoX Advanced Settings.</string>
<string name="auto_x_cancel">Cancel</string>
<string name="auto_x_confirm">Confirm</string>
<string name="auto_x_descript_geom">Remote Desktop Size (WxH)</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
package com.iiordanov.bVNC;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.Socket;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -430,7 +432,9 @@ private void startVncConnection() throws Exception {
} catch (AnonCipherUnsupportedException e) {
showFatalMessageAndQuit (getContext().getString(R.string.error_anon_dh_unsupported));
} catch (Exception e) {
throw new Exception (getContext().getString(R.string.error_vnc_unable_to_connect) + e.getStackTrace().toString() + e.getLocalizedMessage());
e.printStackTrace();
throw new Exception (getContext().getString(R.string.error_vnc_unable_to_connect) +
Utils.messageAndStackTraceAsString(e));
}

rfbconn = rfb;
Expand Down
13 changes: 13 additions & 0 deletions eclipse_projects/bVNC/src/com/iiordanov/bVNC/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Field;
import java.net.Inet6Address;
Expand Down Expand Up @@ -211,4 +213,15 @@ public static boolean isValidIpv6Address(final String address) {
return false;
}
}

public static String messageAndStackTraceAsString (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String localizedMessage = e.getLocalizedMessage();
if (localizedMessage == null)
localizedMessage = "";

return "\n" + localizedMessage + "\n" + sw.toString();
}
}

0 comments on commit 4fd839f

Please sign in to comment.