removing some obvious warnings as first step to -Werror

This commit is contained in:
Bartek Przybylski 2012-09-29 23:17:39 +02:00
parent c7dc135987
commit aa14479e5b
15 changed files with 20 additions and 77 deletions

View file

@ -38,7 +38,6 @@ import android.content.ContentValues;
import android.content.OperationApplicationException; import android.content.OperationApplicationException;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Environment;
import android.os.RemoteException; import android.os.RemoteException;
import android.util.Log; import android.util.Log;

View file

@ -19,13 +19,7 @@
package com.owncloud.android.datamodel; package com.owncloud.android.datamodel;
import java.io.File; import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import com.owncloud.android.files.services.FileDownloader;
import android.net.Uri;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;

View file

@ -1,5 +1,5 @@
/* ownCloud Android client application /* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski * Copyright (C) 2011-2012 Bartek Przybylski
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,11 +17,6 @@
*/ */
package com.owncloud.android.db; package com.owncloud.android.db;
import java.util.Vector;
import com.owncloud.android.OwnCloudSession;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
@ -38,7 +33,6 @@ public class DbHandler {
private SQLiteDatabase mDB; private SQLiteDatabase mDB;
private OpenerHepler mHelper; private OpenerHepler mHelper;
private final String mDatabaseName = "ownCloud"; private final String mDatabaseName = "ownCloud";
private final String TABLE_SESSIONS = "sessions";
private final int mDatabaseVersion = 1; private final int mDatabaseVersion = 1;
private final String TABLE_INSTANT_UPLOAD = "instant_upload"; private final String TABLE_INSTANT_UPLOAD = "instant_upload";

View file

@ -2,7 +2,6 @@ package com.owncloud.android.extensions;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Vector;
import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.GetMethod;
@ -14,7 +13,6 @@ import com.owncloud.android.utils.OwnCloudVersion;
import android.R; import android.R;
import android.app.Activity;
import android.app.ListActivity; import android.app.ListActivity;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@ -115,20 +113,25 @@ public class ExtensionsListActivity extends ListActivity {
return mDescription; return mDescription;
} }
@SuppressWarnings("unused")
public String getIcon() { public String getIcon() {
return mIcon; return mIcon;
} }
@SuppressWarnings("unused")
public String getDownload() { public String getDownload() {
return mDownload; return mDownload;
} }
@SuppressWarnings("unused")
public String getPlayId() { public String getPlayId() {
return mPlayId; return mPlayId;
} }
@SuppressWarnings("unused")
public OwnCloudVersion getVersion() { public OwnCloudVersion getVersion() {
return mVersion; return mVersion;
} }
} }
} }

View file

@ -5,14 +5,12 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.owncloud.android.authenticator.AccountAuthenticator;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta; import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import eu.alefzero.webdav.OnDatatransferProgressListener; import eu.alefzero.webdav.OnDatatransferProgressListener;
import com.owncloud.android.network.OwnCloudClientUtils; import com.owncloud.android.network.OwnCloudClientUtils;
import android.accounts.Account; import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;

View file

@ -17,7 +17,6 @@ import com.owncloud.android.operations.RemoteOperationResult;
import com.owncloud.android.operations.UploadFileOperation; import com.owncloud.android.operations.UploadFileOperation;
import com.owncloud.android.utils.OwnCloudVersion; import com.owncloud.android.utils.OwnCloudVersion;
import eu.alefzero.webdav.ChunkFromFileChannelRequestEntity;
import eu.alefzero.webdav.OnDatatransferProgressListener; import eu.alefzero.webdav.OnDatatransferProgressListener;
import com.owncloud.android.network.OwnCloudClientUtils; import com.owncloud.android.network.OwnCloudClientUtils;
@ -38,7 +37,6 @@ import android.os.Process;
import android.util.Log; import android.util.Log;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import com.owncloud.android.AccountUtils;
import com.owncloud.android.R; import com.owncloud.android.R;
import eu.alefzero.webdav.WebdavClient; import eu.alefzero.webdav.WebdavClient;

View file

@ -25,7 +25,6 @@ import java.net.Socket;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.Enumeration;
import javax.net.SocketFactory; import javax.net.SocketFactory;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
@ -33,7 +32,6 @@ import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSessionContext;
import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocket;
import org.apache.commons.httpclient.ConnectTimeoutException; import org.apache.commons.httpclient.ConnectTimeoutException;

View file

@ -25,7 +25,6 @@ import java.net.SocketTimeoutException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import javax.net.ssl.SSLException; import javax.net.ssl.SSLException;
import javax.net.ssl.SSLPeerUnverifiedException;
import org.apache.commons.httpclient.ConnectTimeoutException; import org.apache.commons.httpclient.ConnectTimeoutException;
import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpException;

View file

@ -3,14 +3,11 @@ package com.owncloud.android.syncadapter;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.ByteArrayEntity;
import com.owncloud.android.AccountUtils; import com.owncloud.android.AccountUtils;
import com.owncloud.android.authenticator.AccountAuthenticator; import com.owncloud.android.authenticator.AccountAuthenticator;
import com.owncloud.android.db.ProviderMeta;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import android.accounts.Account; import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
@ -24,7 +21,6 @@ import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.util.Log;
public class ContactSyncAdapter extends AbstractOwnCloudSyncAdapter { public class ContactSyncAdapter extends AbstractOwnCloudSyncAdapter {
private String mAddrBookUri; private String mAddrBookUri;
@ -53,7 +49,7 @@ public class ContactSyncAdapter extends AbstractOwnCloudSyncAdapter {
byte[] b = new byte[f.available()]; byte[] b = new byte[f.available()];
f.read(b); f.read(b);
query.setEntity(new ByteArrayEntity(b)); query.setEntity(new ByteArrayEntity(b));
HttpResponse response = fireRawRequest(query); fireRawRequest(query);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return; return;

View file

@ -19,9 +19,7 @@ import android.view.ContextMenu;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.CheckedTextView; import android.widget.CheckedTextView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.SimpleAdapter; import android.widget.SimpleAdapter;
@ -40,6 +38,8 @@ import com.owncloud.android.R;
public class AccountSelectActivity extends SherlockListActivity implements public class AccountSelectActivity extends SherlockListActivity implements
AccountManagerCallback<Boolean> { AccountManagerCallback<Boolean> {
private static final String TAG = "AccountSelectActivity";
private static final String PREVIOUS_ACCOUNT_KEY = "ACCOUNT"; private static final String PREVIOUS_ACCOUNT_KEY = "ACCOUNT";
private final Handler mHandler = new Handler(); private final Handler mHandler = new Handler();
@ -124,13 +124,20 @@ public class AccountSelectActivity extends SherlockListActivity implements
return false; return false;
} }
@SuppressWarnings("unchecked")
@Override @Override
public boolean onContextItemSelected(android.view.MenuItem item) { public boolean onContextItemSelected(android.view.MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo(); .getMenuInfo();
int index = info.position; int index = info.position;
HashMap<String, String> map = (HashMap<String, String>) getListAdapter() HashMap<String, String> map = null;
.getItem(index); try {
map = (HashMap<String, String>) getListAdapter().getItem(index);
} catch (ClassCastException e) {
Log.wtf(TAG, "getitem(index) from list adapter did not return hashmap, bailing out");
return false;
}
String accountName = map.get("NAME"); String accountName = map.get("NAME");
AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE); AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
Account accounts[] = am Account accounts[] = am

View file

@ -21,7 +21,6 @@ package com.owncloud.android.ui.activity;
import java.io.File; import java.io.File;
import android.accounts.Account; import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.app.AlertDialog.Builder; import android.app.AlertDialog.Builder;
@ -40,7 +39,6 @@ import android.content.res.Resources.NotFoundException;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.MediaStore; import android.provider.MediaStore;
@ -65,10 +63,7 @@ import com.owncloud.android.authenticator.AccountAuthenticator;
import com.owncloud.android.datamodel.DataStorageManager; import com.owncloud.android.datamodel.DataStorageManager;
import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.files.OwnCloudFileObserver;
import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.files.services.FileObserverService;
import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.network.OwnCloudClientUtils; import com.owncloud.android.network.OwnCloudClientUtils;
import com.owncloud.android.syncadapter.FileSyncService; import com.owncloud.android.syncadapter.FileSyncService;
@ -637,13 +632,11 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
private class DirectoryCreator implements Runnable { private class DirectoryCreator implements Runnable {
private String mTargetPath; private String mTargetPath;
private Account mAccount; private Account mAccount;
private AccountManager mAm;
private Handler mHandler; private Handler mHandler;
public DirectoryCreator(String targetPath, Account account, Handler handler) { public DirectoryCreator(String targetPath, Account account, Handler handler) {
mTargetPath = targetPath; mTargetPath = targetPath;
mAccount = account; mAccount = account;
mAm = (AccountManager) getSystemService(ACCOUNT_SERVICE);
mHandler = handler; mHandler = handler;
} }

View file

@ -27,25 +27,19 @@ import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.Editable; import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener; import android.view.View.OnFocusChangeListener;
import android.view.View.OnKeyListener; import android.view.View.OnKeyListener;
import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
public class PinCodeActivity extends SherlockFragmentActivity { public class PinCodeActivity extends SherlockFragmentActivity {
@ -238,8 +232,6 @@ public class PinCodeActivity extends SherlockFragmentActivity {
@Override @Override
public boolean onKey(View v, int keyCode, KeyEvent event) { public boolean onKey(View v, int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_DEL && bChange) { if (keyCode == KeyEvent.KEYCODE_DEL && bChange) {
mText1.setText(""); mText1.setText("");
@ -260,8 +252,6 @@ public class PinCodeActivity extends SherlockFragmentActivity {
@Override @Override
public void onFocusChange(View v, boolean hasFocus) { public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
mText2.setCursorVisible(true); mText2.setCursorVisible(true);
if (mText1.getText().toString().equals("")){ if (mText1.getText().toString().equals("")){
mText2.setSelected(false); mText2.setSelected(false);
@ -305,8 +295,6 @@ public class PinCodeActivity extends SherlockFragmentActivity {
@Override @Override
public boolean onKey(View v, int keyCode, KeyEvent event) { public boolean onKey(View v, int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_DEL && bChange) { if (keyCode == KeyEvent.KEYCODE_DEL && bChange) {
mText2.requestFocus(); mText2.requestFocus();
if (!confirmingPinCode) if (!confirmingPinCode)
@ -326,7 +314,6 @@ public class PinCodeActivity extends SherlockFragmentActivity {
@Override @Override
public void onFocusChange(View v, boolean hasFocus) { public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
mText3.setCursorVisible(true); mText3.setCursorVisible(true);
if (mText1.getText().toString().equals("")){ if (mText1.getText().toString().equals("")){
mText3.setSelected(false); mText3.setSelected(false);
@ -411,8 +398,6 @@ public class PinCodeActivity extends SherlockFragmentActivity {
@Override @Override
public boolean onKey(View v, int keyCode, KeyEvent event) { public boolean onKey(View v, int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_DEL && bChange) { if (keyCode == KeyEvent.KEYCODE_DEL && bChange) {
mText3.requestFocus(); mText3.requestFocus();
if (!confirmingPinCode) if (!confirmingPinCode)
@ -431,8 +416,6 @@ public class PinCodeActivity extends SherlockFragmentActivity {
@Override @Override
public void onFocusChange(View v, boolean hasFocus) { public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
mText4.setCursorVisible(true); mText4.setCursorVisible(true);
if (mText1.getText().toString().equals("")){ if (mText1.getText().toString().equals("")){
@ -503,7 +486,6 @@ public class PinCodeActivity extends SherlockFragmentActivity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub("");
return; return;
} }
@ -549,7 +531,6 @@ public class PinCodeActivity extends SherlockFragmentActivity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub("");
return; return;
} }
@ -583,7 +564,6 @@ public class PinCodeActivity extends SherlockFragmentActivity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub("");
finish(); finish();
return; return;
} }

View file

@ -19,8 +19,6 @@ package com.owncloud.android.ui.activity;
import java.util.Vector; import java.util.Vector;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
@ -36,9 +34,7 @@ import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockPreferenceActivity; import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import com.owncloud.android.AccountUtils;
import com.owncloud.android.OwnCloudSession; import com.owncloud.android.OwnCloudSession;
import com.owncloud.android.authenticator.AccountAuthenticator;
import com.owncloud.android.db.DbHandler; import com.owncloud.android.db.DbHandler;
import com.owncloud.android.R; import com.owncloud.android.R;

View file

@ -35,7 +35,6 @@ import org.apache.http.protocol.HTTP;
import org.apache.jackrabbit.webdav.client.methods.DavMethodBase; import org.apache.jackrabbit.webdav.client.methods.DavMethodBase;
import org.apache.jackrabbit.webdav.client.methods.DeleteMethod; import org.apache.jackrabbit.webdav.client.methods.DeleteMethod;
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod; import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import android.accounts.Account; import android.accounts.Account;
@ -79,7 +78,6 @@ import com.owncloud.android.authenticator.AccountAuthenticator;
import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.files.services.FileObserverService;
import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.network.OwnCloudClientUtils; import com.owncloud.android.network.OwnCloudClientUtils;
import com.owncloud.android.ui.activity.FileDetailActivity; import com.owncloud.android.ui.activity.FileDetailActivity;
@ -649,6 +647,7 @@ public class FileDetailFragment extends SherlockFragment implements
// this is a temporary class for sharing purposes, it need to be replaced in transfer service // this is a temporary class for sharing purposes, it need to be replaced in transfer service
@SuppressWarnings("unused")
private class ShareRunnable implements Runnable { private class ShareRunnable implements Runnable {
private String mPath; private String mPath;
@ -741,17 +740,7 @@ public class FileDetailFragment extends SherlockFragment implements
String uri = am.getUserData(account, AccountAuthenticator.KEY_OC_BASE_URL) + SHARED_PATH + token; String uri = am.getUserData(account, AccountAuthenticator.KEY_OC_BASE_URL) + SHARED_PATH + token;
Log.d("Actions:shareFile ok", "url: " + uri); Log.d("Actions:shareFile ok", "url: " + uri);
} catch (HttpException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -22,7 +22,6 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Random;
import org.apache.commons.httpclient.Credentials; import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpClient;
@ -102,12 +101,12 @@ public class WebdavClient extends HttpClient {
mDataTransferListener.transferProgress(readResult); mDataTransferListener.transferProgress(readResult);
fos.write(bytes, 0, readResult); fos.write(bytes, 0, readResult);
} }
fos.close();
ret = true; ret = true;
} else { } else {
exhaustResponse(get.getResponseBodyAsStream()); exhaustResponse(get.getResponseBodyAsStream());
} }
Log.e(TAG, "Download of " + remoteFilePath + " to " + targetFile + " finished with HTTP status " + status + (!ret?"(FAIL)":"")); Log.e(TAG, "Download of " + remoteFilePath + " to " + targetFile + " finished with HTTP status " + status + (!ret?"(FAIL)":""));
} catch (Exception e) { } catch (Exception e) {
logException(e, "dowloading " + remoteFilePath); logException(e, "dowloading " + remoteFilePath);