Clean up warnings.

This commit is contained in:
Brian Pellin
2009-02-02 19:27:26 -06:00
parent 7ce7bdf8e3
commit e7abac9faf
9 changed files with 42 additions and 57 deletions

View File

@@ -66,9 +66,9 @@ public class Database {
private static void populateGlobals(PwGroup currentGroup) {
if (currentGroup == null) {
Vector rootChildGroups = mPM.getGrpRoots();
Vector<PwGroup> rootChildGroups = mPM.getGrpRoots();
for (int i = 0; i < rootChildGroups.size(); i++ ){
PwGroup cur = (PwGroup) rootChildGroups.elementAt(i);
PwGroup cur = rootChildGroups.elementAt(i);
gRoot = cur.parent;
gGroups.put(cur.groupId, new WeakReference<PwGroup>(cur));
populateGlobals(cur);
@@ -77,16 +77,16 @@ public class Database {
return;
}
Vector childGroups = currentGroup.childGroups;
Vector childEntries = currentGroup.childEntries;
Vector<PwGroup> childGroups = currentGroup.childGroups;
Vector<PwEntry> childEntries = currentGroup.childEntries;
for (int i = 0; i < childEntries.size(); i++ ) {
PwEntry cur = (PwEntry) childEntries.elementAt(i);
PwEntry cur = childEntries.elementAt(i);
gEntries.put(UUID.nameUUIDFromBytes(cur.uuid), new WeakReference<PwEntry>(cur));
}
for (int i = 0; i < childGroups.size(); i++ ) {
PwGroup cur = (PwGroup) childGroups.elementAt(i);
PwGroup cur = childGroups.elementAt(i);
gGroups.put(cur.groupId, new WeakReference<PwGroup>(cur));
populateGlobals(cur);
}

View File

@@ -19,16 +19,13 @@
*/
package com.android.keepass;
import java.net.URI;
import java.util.UUID;
import org.phoneid.keepassj2me.PwEntry;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.ClipboardManager;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
@@ -52,7 +49,6 @@ public class EntryActivity extends Activity {
}
private PwEntry mEntry;
private int mId;
private boolean showPassword = true;
@Override

View File

@@ -20,7 +20,6 @@
package com.android.keepass;
import java.lang.ref.WeakReference;
import java.util.Vector;
import org.phoneid.keepassj2me.PwEntry;
import org.phoneid.keepassj2me.PwGroup;
@@ -33,7 +32,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
public class GroupActivity extends ListActivity {

View File

@@ -19,14 +19,7 @@
*/
package com.android.keepass;
import org.bouncycastle1.crypto.InvalidCipherTextException;
import org.phoneid.keepassj2me.ImporterV3;
import org.phoneid.keepassj2me.PwEntry;
import org.phoneid.keepassj2me.PwGroup;
import org.phoneid.keepassj2me.PwManager;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
@@ -36,12 +29,6 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.io.*;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.UUID;
import java.util.Vector;
public class KeePass extends Activity {
public static final int EXIT_NORMAL = 0;

View File

@@ -23,8 +23,6 @@ import org.phoneid.keepassj2me.PwGroup;
import android.app.Activity;
import android.graphics.Color;
import android.util.TypedValue;
import android.widget.TextView;
public class PwGroupView extends PwItemView {

View File

@@ -21,15 +21,13 @@ package com.android.keepass;
import java.util.Vector;
import org.phoneid.keepassj2me.PwEntry;
import org.phoneid.keepassj2me.PwGroup;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import org.phoneid.keepassj2me.PwEntry;
import org.phoneid.keepassj2me.PwGroup;
public class PwListAdapter extends BaseAdapter {

View File

@@ -24,18 +24,26 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
package org.phoneid.keepassj2me;
import java.io.IOException;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import org.bouncycastle1.crypto.*;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.ShortBufferException;
import org.bouncycastle1.crypto.BufferedBlockCipher;
import org.bouncycastle1.crypto.InvalidCipherTextException;
import org.bouncycastle1.crypto.digests.SHA256Digest;
import org.bouncycastle1.crypto.engines.AESEngine;
import org.bouncycastle1.crypto.modes.CBCBlockCipher;
import org.bouncycastle1.crypto.paddings.PKCS7Padding;
import org.bouncycastle1.crypto.params.KeyParameter;
import org.bouncycastle1.crypto.params.ParametersWithIV;
import org.phoneid.PhoneIDException;
import org.phoneid.PhoneIDUtil;
/**

View File

@@ -44,8 +44,8 @@ public class PwGroup {
public static final int BUF_SIZE = 124;
// for tree traversing
public Vector childGroups = null;
public Vector childEntries = null;
public Vector<PwGroup> childGroups = null;
public Vector<PwEntry> childEntries = null;
public PwGroup parent = null;
public int groupId;

View File

@@ -62,9 +62,9 @@ public class PwManager {
public PwEntry metaInfo;
// all entries
public Vector entries = new Vector();
public Vector<PwEntry> entries = new Vector<PwEntry>();
// all groups
public Vector groups = new Vector();
public Vector<PwGroup> groups = new Vector<PwGroup>();
// Last modified entry, use GetLastEditedEntry() to get it
// PwEntry lastEditedEntry = null;
// Pseudo-random number generator
@@ -100,23 +100,23 @@ public class PwManager {
*/
public Vector getGrpRoots() {
public Vector<PwGroup> getGrpRoots() {
int target = 0;
Vector kids = new Vector();
Vector<PwGroup> kids = new Vector<PwGroup>();
for( int i=0; i < groups.size(); i++ ) {
PwGroup grp = (PwGroup)groups.elementAt( i );
PwGroup grp = groups.elementAt( i );
if( grp.level == target )
kids.addElement( grp );
}
return kids;
}
public Vector getGrpChildren( PwGroup parent ) {
public Vector<PwGroup> getGrpChildren( PwGroup parent ) {
int idx = groups.indexOf( parent );
int target = parent.level + 1;
Vector kids = new Vector();
Vector<PwGroup> kids = new Vector<PwGroup>();
while( ++idx < groups.size() ) {
PwGroup grp = (PwGroup)groups.elementAt( idx );
PwGroup grp = groups.elementAt( idx );
if( grp.level < target )
break;
else
@@ -126,15 +126,15 @@ public class PwManager {
return kids;
}
public Vector getEntries( PwGroup parent ) {
Vector kids = new Vector();
public Vector<PwEntry> getEntries( PwGroup parent ) {
Vector<PwEntry> kids = new Vector<PwEntry>();
/*for( Iterator i = entries.iterator(); i.hasNext(); ) {
PwEntry ent = (PwEntry)i.next();
if( ent.groupId == parent.groupId )
kids.add( ent );
}*/
for (int i=0; i<entries.size(); i++) {
PwEntry ent = (PwEntry)entries.elementAt(i);
PwEntry ent = entries.elementAt(i);
if( ent.groupId == parent.groupId )
kids.addElement( ent );
}
@@ -147,12 +147,12 @@ public class PwManager {
public void addGroup(Object group)
public void addGroup(PwGroup group)
{
groups.addElement(group);
}
public void addEntry(Object entry)
public void addEntry(PwEntry entry)
{
entries.addElement(entry);
}
@@ -163,12 +163,12 @@ public class PwManager {
if (currentGroup == null) {
rootGroup = new PwGroup();
Vector rootChildGroups = getGrpRoots();
Vector<PwGroup> rootChildGroups = getGrpRoots();
rootGroup.childGroups = rootChildGroups;
rootGroup.childEntries = new Vector();
rootGroup.childEntries = new Vector<PwEntry>();
for (int i=0; i<rootChildGroups.size(); i++) {
((PwGroup)rootChildGroups.elementAt(i)).parent = rootGroup;
constructTree((PwGroup)rootChildGroups.elementAt(i));
rootChildGroups.elementAt(i).parent = rootGroup;
constructTree(rootChildGroups.elementAt(i));
}
return;
}
@@ -180,12 +180,12 @@ public class PwManager {
// set parent in child entries
for (int i=0; i<currentGroup.childEntries.size(); i++) {
((PwEntry)currentGroup.childEntries.elementAt(i)).parent = currentGroup;
currentGroup.childEntries.elementAt(i).parent = currentGroup;
}
// recursively construct child groups
for (int i=0; i<currentGroup.childGroups.size(); i++) {
((PwGroup)currentGroup.childGroups.elementAt(i)).parent = currentGroup;
constructTree((PwGroup)currentGroup.childGroups.elementAt(i));
currentGroup.childGroups.elementAt(i).parent = currentGroup;
constructTree(currentGroup.childGroups.elementAt(i));
}
return;
}