1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-30 22:12:55 +01:00

removed printStackTrace

This commit is contained in:
dakhnod 2019-12-04 00:36:42 +01:00
parent 75b886be10
commit 8e27556cd4
6 changed files with 25 additions and 22 deletions

View File

@ -191,7 +191,7 @@ public class ConfigActivity extends AbstractGBActivity {
helper = new PackageConfigHelper(getApplicationContext()); helper = new PackageConfigHelper(getApplicationContext());
list = helper.getNotificationConfigurations(); list = helper.getNotificationConfigurations();
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("error getting configurations", GB.ERROR, e);
GB.toast("error getting configurations", Toast.LENGTH_SHORT, GB.ERROR, e); GB.toast("error getting configurations", Toast.LENGTH_SHORT, GB.ERROR, e);
list = new ArrayList<>(); list = new ArrayList<>();
} }
@ -219,7 +219,8 @@ public class ConfigActivity extends AbstractGBActivity {
helper.saveNotificationConfiguration(config); helper.saveNotificationConfiguration(config);
LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED)); LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED));
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("error saving configuration", GB.ERROR, e);
GB.toast("error saving notification", Toast.LENGTH_SHORT, GB.ERROR, e); GB.toast("error saving notification", Toast.LENGTH_SHORT, GB.ERROR, e);
} }
refreshList(); refreshList();
@ -246,7 +247,7 @@ public class ConfigActivity extends AbstractGBActivity {
helper.deleteNotificationConfiguration((NotificationConfiguration) adapterView.getItemAtPosition(i)); helper.deleteNotificationConfiguration((NotificationConfiguration) adapterView.getItemAtPosition(i));
LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED)); LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED));
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("error deleting configuration", GB.ERROR, e);
GB.toast("error deleting setting", Toast.LENGTH_SHORT, GB.ERROR, e); GB.toast("error deleting setting", Toast.LENGTH_SHORT, GB.ERROR, e);
} }
refreshList(); refreshList();
@ -446,7 +447,7 @@ public class ConfigActivity extends AbstractGBActivity {
buttonIntent.putExtra(FossilWatchAdapter.ITEM_BUTTONS, buttonConfig.toString()); buttonIntent.putExtra(FossilWatchAdapter.ITEM_BUTTONS, buttonConfig.toString());
LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(buttonIntent); LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(buttonIntent);
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
} }
} }
}) })
@ -459,7 +460,7 @@ public class ConfigActivity extends AbstractGBActivity {
buttonLayout.addView(buttonTextView); buttonLayout.addView(buttonTextView);
} }
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); GB.log("error parsing button config", GB.ERROR, e);
GB.toast("error parsing button config", Toast.LENGTH_LONG, GB.ERROR); GB.toast("error parsing button config", Toast.LENGTH_LONG, GB.ERROR);
} }
} }
@ -493,7 +494,7 @@ public class ConfigActivity extends AbstractGBActivity {
try { try {
list.addAll(helper.getNotificationConfigurations()); list.addAll(helper.getNotificationConfigurations());
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("error getting configurations", GB.ERROR, e);
GB.toast("error getting configurations", Toast.LENGTH_SHORT, GB.ERROR, e); GB.toast("error getting configurations", Toast.LENGTH_SHORT, GB.ERROR, e);
} }
// null is added to indicate the plus button added handled in PackageAdapter#getView // null is added to indicate the plus button added handled in PackageAdapter#getView
@ -571,7 +572,7 @@ public class ConfigActivity extends AbstractGBActivity {
try { try {
((ImageView) view.findViewById(R.id.packageIcon)).setImageDrawable(manager.getApplicationIcon(settings.getPackageName())); ((ImageView) view.findViewById(R.id.packageIcon)).setImageDrawable(manager.getApplicationIcon(settings.getPackageName()));
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
} }
final int width = 100; final int width = 100;
((TextView) view.findViewById(R.id.packageName)).setText(settings.getAppName()); ((TextView) view.findViewById(R.id.packageName)).setText(settings.getAppName());

View File

@ -46,7 +46,7 @@ public class QHybridAppChoserActivity extends AbstractGBActivity {
try { try {
helper = new PackageConfigHelper(getApplicationContext()); helper = new PackageConfigHelper(getApplicationContext());
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("database error", GB.ERROR, e);
GB.toast("error getting database helper", Toast.LENGTH_SHORT, GB.ERROR, e); GB.toast("error getting database helper", Toast.LENGTH_SHORT, GB.ERROR, e);
finish(); finish();
return; return;
@ -125,7 +125,7 @@ public class QHybridAppChoserActivity extends AbstractGBActivity {
helper.saveNotificationConfiguration(config); helper.saveNotificationConfiguration(config);
LocalBroadcastManager.getInstance(QHybridAppChoserActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED)); LocalBroadcastManager.getInstance(QHybridAppChoserActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED));
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("error saving config", GB.ERROR, e);
GB.toast("error saving configuration", Toast.LENGTH_SHORT, GB.ERROR, e); GB.toast("error saving configuration", Toast.LENGTH_SHORT, GB.ERROR, e);
} }
finish(); finish();

View File

@ -195,8 +195,8 @@ public class QHybridSupport extends QHybridBaseSupport {
try { try {
helper = new PackageConfigHelper(GBApplication.getContext()); helper = new PackageConfigHelper(GBApplication.getContext());
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("error getting database", GB.ERROR, e);
GB.toast("erroe getting database", Toast.LENGTH_SHORT, GB.ERROR, e); GB.toast("error getting database", Toast.LENGTH_SHORT, GB.ERROR, e);
try { try {
throw e; throw e;
} catch (GBException ex) { } catch (GBException ex) {
@ -224,7 +224,7 @@ public class QHybridSupport extends QHybridBaseSupport {
PlayNotificationRequest.VibrationType.NO_VIBE PlayNotificationRequest.VibrationType.NO_VIBE
)); ));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); GB.log("wrong number format", GB.ERROR, e);
logger.debug("trash extra should be number 0.0-1.0"); logger.debug("trash extra should be number 0.0-1.0");
} }
break; break;
@ -300,7 +300,7 @@ public class QHybridSupport extends QHybridBaseSupport {
try { try {
config = helper.getNotificationConfiguration(packageName); config = helper.getNotificationConfiguration(packageName);
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("error getting notification configuration", GB.ERROR, e);
GB.toast("error getting notification configuration", Toast.LENGTH_SHORT, GB.ERROR, e); GB.toast("error getting notification configuration", Toast.LENGTH_SHORT, GB.ERROR, e);
} }
if (config == null) return; if (config == null) return;
@ -353,7 +353,8 @@ public class QHybridSupport extends QHybridBaseSupport {
configs.put(config, false); configs.put(config, false);
} }
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("error getting notification configuration", GB.ERROR, e);
GB.toast("error getting notification configs", Toast.LENGTH_SHORT, GB.ERROR, e); GB.toast("error getting notification configs", Toast.LENGTH_SHORT, GB.ERROR, e);
} }
@ -422,7 +423,7 @@ public class QHybridSupport extends QHybridBaseSupport {
try { try {
Thread.sleep(2500); Thread.sleep(2500);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
} }
} }
} }
@ -458,7 +459,7 @@ public class QHybridSupport extends QHybridBaseSupport {
//TODO file stuff //TODO file stuff
// queueWrite(new EraseFileRequest((short) request.fileHandle)); // queueWrite(new EraseFileRequest((short) request.fileHandle));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
if (request.fileHandle > 257) { if (request.fileHandle > 257) {
// queueWrite(new DownloadFileRequest((short) (request.fileHandle - 1))); // queueWrite(new DownloadFileRequest((short) (request.fileHandle - 1)));
} }

View File

@ -208,7 +208,7 @@ public class FossilWatchAdapter extends WatchAdapter {
}; };
queueWrite(fileUploadRequets); queueWrite(fileUploadRequets);
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
} }
} }
@ -311,7 +311,7 @@ public class FossilWatchAdapter extends WatchAdapter {
} }
}, false); }, false);
} catch (GBException e) { } catch (GBException e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
} }
} }
@ -442,7 +442,7 @@ public class FossilWatchAdapter extends WatchAdapter {
fossilRequest.handleResponse(characteristic); fossilRequest.handleResponse(characteristic);
requestFinished = fossilRequest.isFinished(); requestFinished = fossilRequest.isFinished();
} catch (RuntimeException e) { } catch (RuntimeException e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
getDeviceSupport().notifiyException(e); getDeviceSupport().notifiyException(e);
GB.toast(fossilRequest.getName() + " failed", Toast.LENGTH_SHORT, GB.ERROR); GB.toast(fossilRequest.getName() + " failed", Toast.LENGTH_SHORT, GB.ERROR);
requestFinished = true; requestFinished = true;

View File

@ -170,7 +170,7 @@ public class MisfitWatchAdapter extends WatchAdapter {
FileOutputStream fos = new FileOutputStream(charLog, true); FileOutputStream fos = new FileOutputStream(charLog, true);
fos.write((new Date().toString() + ": " + characteristic.getUuid().toString() + ": " + arrayToString(characteristic.getValue())).getBytes()); fos.write((new Date().toString() + ": " + characteristic.getUuid().toString() + ": " + arrayToString(characteristic.getValue())).getBytes());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
} }
break; break;
} }
@ -242,7 +242,7 @@ public class MisfitWatchAdapter extends WatchAdapter {
fos.close(); fos.close();
logger.debug("file written."); logger.debug("file written.");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
} }
gbDevice.addDeviceInfo(new GenericItem(ITEM_STEP_COUNT, String.valueOf(((GetCurrentStepCountRequest) request).steps))); gbDevice.addDeviceInfo(new GenericItem(ITEM_STEP_COUNT, String.valueOf(((GetCurrentStepCountRequest) request).steps)));
} else if (request instanceof OTAEnterRequest) { } else if (request instanceof OTAEnterRequest) {

View File

@ -10,6 +10,7 @@ import java.util.HashMap;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileCloseAndPutRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileCloseAndPutRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FilePutRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FilePutRequest;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class ConfigurationPutRequest extends FilePutRequest { public class ConfigurationPutRequest extends FilePutRequest {
private static HashMap<Short, Class<? extends ConfigItem>> itemsById = new HashMap<>(); private static HashMap<Short, Class<? extends ConfigItem>> itemsById = new HashMap<>();
@ -45,7 +46,7 @@ public class ConfigurationPutRequest extends FilePutRequest {
try { try {
item = configClass.newInstance(); item = configClass.newInstance();
} catch (IllegalAccessException | InstantiationException e) { } catch (IllegalAccessException | InstantiationException e) {
e.printStackTrace(); GB.log("error", GB.ERROR, e);
continue; continue;
} }