fix some exceptions
MODIFY
bither-android/src/net/bither/AdActivity.java
bither-android/src/net/bither/AdActivity.java
@@ -144,4 +144,11 @@ public class AdActivity extends Activity {
}
}
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (handler != null) {
+ handler.removeCallbacksAndMessages(null);
+ }
+ }
}

MODIFY
bither-android/src/net/bither/SendActivity.java
bither-android/src/net/bither/SendActivity.java
@@ -358,7 +358,9 @@ public class SendActivity extends SwipeRightActivity implements EntryKeyboardVie
@Override
protected void bitcoinRequest(final String address, final String addressLabel,
final long amount, final String bluetoothMac) {
+ if (address != null) {
etAddress.setText(address.toString());
+ }
if (amount > 0) {
amountCalculatorLink.setBtcAmount(amount);
etPassword.requestFocus();

MODIFY
bither-android/src/net/bither/fragment/hot/HotAddressFragment.java
bither-android/src/net/bither/fragment/hot/HotAddressFragment.java
@@ -379,6 +379,9 @@ public class HotAddressFragment extends Fragment implements Refreshable, Selecta
@Override
public void run() {
+ if (addressesToShowAdded == null) {
+ return;
+ }
for (int i = 0;
i < addressesToShowAdded.size();
i++) {

MODIFY
bither-android/src/net/bither/util/HDMKeychainRecoveryUtil.java
bither-android/src/net/bither/util/HDMKeychainRecoveryUtil.java
@@ -213,10 +213,14 @@ public class HDMKeychainRecoveryUtil implements IPasswordGetterDelegate {
if (requestCode == ColdRootRequestCode) {
if (resultCode == Activity.RESULT_OK) {
String result = data.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
+ if (result.length() % 2 == 0) {
coldRoot = Utils.hexStringToByteArray(result);
} else {
coldRoot = null;
}
+ } else {
+ coldRoot = null;
+ }
try {
lock.lock();
coldRootCondition.signal();

MODIFY
bither-android/src/net/bither/util/LogUtil.java
bither-android/src/net/bither/util/LogUtil.java
-/* * Copyright 2014 http://Bither.net * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.bither.util; import android.util.Log; import net.bither.bitherj.BitherjSettings; import java.io.File; import java.io.FileOutputStream; public class LogUtil { public static void i(String tag, String content) { if (BitherjSettings.LOG_DEBUG) { Log.i(tag, content); } } public static void d(String tag, String content) { if (BitherjSettings.LOG_DEBUG) { Log.d(tag, content); } } public static void w(String tag, String content) { if (BitherjSettings.LOG_DEBUG) { Log.w(tag, content); } } public static void e(String tag, String content) { if (BitherjSettings.LOG_DEBUG) { Log.e(tag, content); } } public static void recordLog(File savePath, String saveFileName, String data, boolean saveType) { FileOutputStream fos = null; try { if (!savePath.exists()) savePath.mkdirs(); File saveFile = new File(savePath, saveFileName); if (!saveType && saveFile.exists()) { saveFile.delete(); saveFile.createNewFile(); fos = new FileOutputStream(saveFile, saveType); } else if (saveType && saveFile.exists()) { fos = new FileOutputStream(saveFile, saveType); } else if (saveType && !saveFile.exists()) { saveFile.createNewFile(); fos = new FileOutputStream(saveFile, saveType); } else { fos = new FileOutputStream(saveFile, saveType); } fos.write(data.getBytes()); fos.close(); } catch (Exception e) { e.printStackTrace(); } finally { } } }
\ No newline at end of file
+/* * Copyright 2014 http://Bither.net * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.bither.util; import android.util.Log; import net.bither.bitherj.BitherjSettings; import java.io.File; import java.io.FileOutputStream; public class LogUtil { public static void i(String tag, String content) { if (BitherjSettings.LOG_DEBUG && tag != null && content != null) { Log.i(tag, content); } } public static void d(String tag, String content) { if (BitherjSettings.LOG_DEBUG && tag != null && content != null) { Log.d(tag, content); } } public static void w(String tag, String content) { if (BitherjSettings.LOG_DEBUG && tag != null && content != null) { Log.w(tag, content); } } public static void e(String tag, String content) { if (BitherjSettings.LOG_DEBUG && tag != null && content != null) { Log.e(tag, content); } } public static void recordLog(File savePath, String saveFileName, String data, boolean saveType) { FileOutputStream fos = null; try { if (!savePath.exists()) savePath.mkdirs(); File saveFile = new File(savePath, saveFileName); if (!saveType && saveFile.exists()) { saveFile.delete(); saveFile.createNewFile(); fos = new FileOutputStream(saveFile, saveType); } else if (saveType && saveFile.exists()) { fos = new FileOutputStream(saveFile, saveType); } else if (saveType && !saveFile.exists()) { saveFile.createNewFile(); fos = new FileOutputStream(saveFile, saveType); } else { fos = new FileOutputStream(saveFile, saveType); } fos.write(data.getBytes()); fos.close(); } catch (Exception e) { e.printStackTrace(); } finally { } } }
\ No newline at end of file

MODIFY
bither-android/src/net/bither/util/UpgradeUtil.java
bither-android/src/net/bither/util/UpgradeUtil.java
@@ -58,7 +58,8 @@ public class UpgradeUtil {
public static boolean needUpgrade() {
int verionCode = AppSharedPreference.getInstance().getVerionCode();
- return (verionCode < UPGRADE_ADDRESS_TO_DB && verionCode > 0) || getOldWatchOnlyCacheDir().exists();
+ File file = getOldWatchOnlyCacheDir();
+ return (verionCode < UPGRADE_ADDRESS_TO_DB && verionCode > 0) || (file == null ? false : file.exists());
}
public static void upgradeNewVerion(Handler handler) {
@@ -134,9 +135,14 @@ public class UpgradeUtil {
}
public static File getOldWatchOnlyCacheDir() {
+ try {
File file = Utils.getWalletRomCache();
file = new File(file, WALLET_WATCH_ONLY_OLD);
return file;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
}
private static List<ECKey> initPrivateWallet(

fix some exceptions