1
0
mirror of https://github.com/moparisthebest/SSLDroid synced 2024-11-15 13:35:04 -05:00

Indentation fixes

Signed-off-by: Balint Kovacs <blint@blint.hu>
This commit is contained in:
Balint Kovacs 2011-05-04 21:31:26 +02:00
parent 69c521c91e
commit aad79a8e5a
10 changed files with 963 additions and 960 deletions

View File

@ -7,7 +7,7 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
public class NetworkChangeReceiver extends BroadcastReceiver{
public class NetworkChangeReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

View File

@ -30,7 +30,7 @@ public class SSLDroid extends Service {
tp = new TcpProxy[tunnelcount];
int i;
for (i=0; i<tunnelcount; i++){
for (i=0; i<tunnelcount; i++) {
cursor.moveToPosition(i);
String tunnelName = cursor.getString(cursor
.getColumnIndexOrThrow(SSLDroidDbAdapter.KEY_NAME));
@ -89,7 +89,7 @@ public class SSLDroid extends Service {
Log.d(TAG, "SSLDroid Service Stopped");
}
public void removeNotification(int id){
public void removeNotification(int id) {
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.cancel(id);
}

View File

@ -11,7 +11,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class SSLDroidReadLogs extends Activity{
public class SSLDroidReadLogs extends Activity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
@ -33,7 +33,7 @@ public class SSLDroidReadLogs extends Activity{
refreshLogs();
}
public void refreshLogs(){
public void refreshLogs() {
TextView logcontainer = (TextView) findViewById(R.id.logTextView);
logcontainer.setText("");
Process mLogcatProc = null;
@ -47,7 +47,7 @@ public class SSLDroidReadLogs extends Activity{
String line;
String separator = System.getProperty("line.separator");
while ((line = reader.readLine()) != null){
while ((line = reader.readLine()) != null) {
logcontainer.append(line+separator);
}
} catch (IOException e) {

View File

@ -92,7 +92,7 @@ public class SSLDroidTunnelDetails extends Activity {
int cPort = 0;
try {
cPort = Integer.parseInt(localport.getText().toString());
} catch (NumberFormatException e){
} catch (NumberFormatException e) {
Toast.makeText(getBaseContext(), "Local port parameter has invalid number format", Toast.LENGTH_LONG).show();
return;
}
@ -105,17 +105,17 @@ public class SSLDroidTunnelDetails extends Activity {
dbHelper.open();
Cursor cursor = dbHelper.fetchAllLocalPorts();
startManagingCursor(cursor);
while (cursor.moveToNext()){
while (cursor.moveToNext()) {
String cDbName = cursor.getString(cursor.getColumnIndexOrThrow(SSLDroidDbAdapter.KEY_NAME));
int cDbPort = cursor.getInt(cursor.getColumnIndexOrThrow(SSLDroidDbAdapter.KEY_LOCALPORT));
if (cPort == cDbPort){
if (cPort == cDbPort) {
Toast.makeText(getBaseContext(), "Local port already configured in tunnel '"+cDbName+"', please change...", Toast.LENGTH_LONG).show();
return;
}
}
}
//remote host validation
if (remotehost.getText().length() == 0){
if (remotehost.getText().length() == 0) {
Toast.makeText(getBaseContext(), "Required remote host parameter not setup, skipping save", Toast.LENGTH_LONG).show();
return;
}
@ -126,13 +126,13 @@ public class SSLDroidTunnelDetails extends Activity {
if ( conMgr.getActiveNetworkInfo() != null || conMgr.getActiveNetworkInfo().isAvailable()) {
try {
InetAddress.getByName(remotehost.getText().toString());
} catch (UnknownHostException e){
} catch (UnknownHostException e) {
Toast.makeText(getBaseContext(), "Remote host not found, please recheck...", Toast.LENGTH_LONG).show();
}
}
}
//remote port validation
if (remoteport.getText().length() == 0){
if (remoteport.getText().length() == 0) {
Toast.makeText(getBaseContext(), "Required remote port parameter not setup, skipping save", Toast.LENGTH_LONG).show();
return;
}
@ -141,7 +141,7 @@ public class SSLDroidTunnelDetails extends Activity {
int cPort = 0;
try {
cPort = Integer.parseInt(remoteport.getText().toString());
} catch (NumberFormatException e){
} catch (NumberFormatException e) {
Toast.makeText(getBaseContext(), "Remote port parameter has invalid number format", Toast.LENGTH_LONG).show();
return;
}
@ -150,7 +150,7 @@ public class SSLDroidTunnelDetails extends Activity {
return;
}
}
if (pkcsfile.getText().length() == 0){
if (pkcsfile.getText().length() == 0) {
Toast.makeText(getBaseContext(), "Required PKCS12 file parameter not setup, skipping save", Toast.LENGTH_LONG).show();
return;
}
@ -159,7 +159,7 @@ public class SSLDroidTunnelDetails extends Activity {
String cPkcsFile = pkcsfile.getText().toString();
String cPkcsPass = pkcspass.getText().toString();
try {
if (checkKeys(cPkcsFile, cPkcsPass) == false){
if (checkKeys(cPkcsFile, cPkcsPass) == false) {
return;
}
} catch (Exception e) {
@ -180,7 +180,7 @@ public class SSLDroidTunnelDetails extends Activity {
final List<File> names = new LinkedList<File>();
File[] files = url.listFiles();
if (files != null && files.length > 0) {
for(File file : url.listFiles()) {
for (File file : url.listFiles()) {
if (file.getName().startsWith("."))
continue;
names.add(file);
@ -189,11 +189,11 @@ public class SSLDroidTunnelDetails extends Activity {
return names;
}
private void showFiles(final List<File> names, final File baseurl){
private void showFiles(final List<File> names, final File baseurl) {
final String[] namesList = new String[names.size()]; // = names.toArray(new String[] {});
ListIterator<File> filelist = names.listIterator();
int i = 0;
while (filelist.hasNext()){
while (filelist.hasNext()) {
File file = filelist.next();
if (file.isDirectory())
namesList[i] = file.getAbsolutePath().replaceFirst(baseurl+"/", "")+" (...)";
@ -209,7 +209,7 @@ public class SSLDroidTunnelDetails extends Activity {
.setItems(namesList, new OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
File name = names.get(arg1);
if (name.isDirectory()){
if (name.isDirectory()) {
List<File> names_ = getFileNames(name, baseurl);
Collections.sort(names_);
if (names_.size() > 0) {
@ -343,15 +343,15 @@ public class SSLDroidTunnelDetails extends Activity {
private void saveState() {
String sName = name.getText().toString();
int sLocalport = 0;
try{
try {
sLocalport = Integer.parseInt(localport.getText().toString());
} catch (NumberFormatException e){
} catch (NumberFormatException e) {
}
String sRemotehost = remotehost.getText().toString();
int sRemoteport = 0;
try{
try {
sRemoteport = Integer.parseInt(remoteport.getText().toString());
} catch (NumberFormatException e){
} catch (NumberFormatException e) {
}
String sPkcsfile = pkcsfile.getText().toString();
String sPkcspass = pkcspass.getText().toString();

View File

@ -43,7 +43,7 @@ public class TcpProxy {
}
public void stop() {
if (server != null){
if (server != null) {
try {
//close the server socket and interrupt the server thread
ss.close();
@ -56,7 +56,7 @@ public class TcpProxy {
}
//if the listening socket is still active, we're alive
public boolean isAlive(){
public boolean isAlive() {
return ss.isBound();
}

View File

@ -48,7 +48,7 @@ public class TcpProxyServerThread extends Thread {
// Create a trust manager that does not validate certificate chains
// TODO: handle this somehow properly (popup if cert is untrusted?)
// TODO: cacert + crl should be configurable
TrustManager[] trustAllCerts = new TrustManager[]{
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
@ -158,7 +158,7 @@ public class TcpProxyServerThread extends Thread {
Thread fromBrowserToServer = null;
Thread fromServerToBrowser = null;
if (isInterrupted()){
if (isInterrupted()) {
Log.d("SSLDroid", tunnelName+"/"+sessionid+": Interrupted server thread, closing sockets...");
ss.close();
if (fromBrowserToServer != null)
@ -172,7 +172,7 @@ public class TcpProxyServerThread extends Thread {
try {
sc = ss.accept();
sessionid++;
} catch (SocketException e){
} catch (SocketException e) {
Log.d("SSLDroid", "Accept failure: " + e.toString());
}
@ -180,7 +180,7 @@ public class TcpProxyServerThread extends Thread {
try {
st = (SSLSocket) getSocketFactory(this.keyFile, this.keyPass, this.sessionid).createSocket(this.tunnelHost, this.tunnelPort);
((SSLSocket) st).startHandshake();
} catch (IOException e){
} catch (IOException e) {
}
catch (Exception e) {
@ -189,7 +189,7 @@ public class TcpProxyServerThread extends Thread {
return;
}
if (sc == null || st == null){
if (sc == null || st == null) {
Log.d("SSLDroid", tunnelName+"/"+sessionid+": Trying socket operation on a null socket, returning");
return;
}

View File

@ -75,7 +75,8 @@ public class SSLDroidDbAdapter {
public Cursor fetchAllTunnels() {
return database.query(DATABASE_TABLE, new String[] { KEY_ROWID,
KEY_NAME, KEY_LOCALPORT, KEY_REMOTEHOST, KEY_REMOTEPORT, KEY_PKCSFILE,
KEY_PKCSPASS }, null, null, null, null, null);
KEY_PKCSPASS
}, null, null, null, null, null);
}
/**
@ -85,7 +86,8 @@ public class SSLDroidDbAdapter {
*/
public Cursor fetchAllLocalPorts() {
return database.query(DATABASE_TABLE, new String[] { KEY_NAME,
KEY_LOCALPORT }, null, null, null, null, null);
KEY_LOCALPORT
}, null, null, null, null, null);
}
/**
@ -94,7 +96,8 @@ public class SSLDroidDbAdapter {
public Cursor fetchTunnel(long rowId) throws SQLException {
Cursor mCursor = database.query(true, DATABASE_TABLE, new String[] {
KEY_ROWID, KEY_NAME, KEY_LOCALPORT, KEY_REMOTEHOST, KEY_REMOTEPORT,
KEY_PKCSFILE, KEY_PKCSPASS },
KEY_PKCSFILE, KEY_PKCSPASS
},
KEY_ROWID + "=" + rowId, null, null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();