1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +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());
list = helper.getNotificationConfigurations();
} catch (GBException e) {
e.printStackTrace();
GB.log("error getting configurations", GB.ERROR, e);
GB.toast("error getting configurations", Toast.LENGTH_SHORT, GB.ERROR, e);
list = new ArrayList<>();
}
@ -219,7 +219,8 @@ public class ConfigActivity extends AbstractGBActivity {
helper.saveNotificationConfiguration(config);
LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED));
} catch (GBException e) {
e.printStackTrace();
GB.log("error saving configuration", GB.ERROR, e);
GB.toast("error saving notification", Toast.LENGTH_SHORT, GB.ERROR, e);
}
refreshList();
@ -246,7 +247,7 @@ public class ConfigActivity extends AbstractGBActivity {
helper.deleteNotificationConfiguration((NotificationConfiguration) adapterView.getItemAtPosition(i));
LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED));
} catch (GBException e) {
e.printStackTrace();
GB.log("error deleting configuration", GB.ERROR, e);
GB.toast("error deleting setting", Toast.LENGTH_SHORT, GB.ERROR, e);
}
refreshList();
@ -446,7 +447,7 @@ public class ConfigActivity extends AbstractGBActivity {
buttonIntent.putExtra(FossilWatchAdapter.ITEM_BUTTONS, buttonConfig.toString());
LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(buttonIntent);
} catch (JSONException e) {
e.printStackTrace();
GB.log("error", GB.ERROR, e);
}
}
})
@ -459,7 +460,7 @@ public class ConfigActivity extends AbstractGBActivity {
buttonLayout.addView(buttonTextView);
}
} 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);
}
}
@ -493,7 +494,7 @@ public class ConfigActivity extends AbstractGBActivity {
try {
list.addAll(helper.getNotificationConfigurations());
} catch (GBException e) {
e.printStackTrace();
GB.log("error getting configurations", 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
@ -571,7 +572,7 @@ public class ConfigActivity extends AbstractGBActivity {
try {
((ImageView) view.findViewById(R.id.packageIcon)).setImageDrawable(manager.getApplicationIcon(settings.getPackageName()));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
GB.log("error", GB.ERROR, e);
}
final int width = 100;
((TextView) view.findViewById(R.id.packageName)).setText(settings.getAppName());

View File

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

View File

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

View File

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

View File

@ -170,7 +170,7 @@ public class MisfitWatchAdapter extends WatchAdapter {
FileOutputStream fos = new FileOutputStream(charLog, true);
fos.write((new Date().toString() + ": " + characteristic.getUuid().toString() + ": " + arrayToString(characteristic.getValue())).getBytes());
} catch (IOException e) {
e.printStackTrace();
GB.log("error", GB.ERROR, e);
}
break;
}
@ -242,7 +242,7 @@ public class MisfitWatchAdapter extends WatchAdapter {
fos.close();
logger.debug("file written.");
} catch (Exception e) {
e.printStackTrace();
GB.log("error", GB.ERROR, e);
}
gbDevice.addDeviceInfo(new GenericItem(ITEM_STEP_COUNT, String.valueOf(((GetCurrentStepCountRequest) request).steps)));
} 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.requests.fossil.file.FileCloseAndPutRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FilePutRequest;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class ConfigurationPutRequest extends FilePutRequest {
private static HashMap<Short, Class<? extends ConfigItem>> itemsById = new HashMap<>();
@ -45,7 +46,7 @@ public class ConfigurationPutRequest extends FilePutRequest {
try {
item = configClass.newInstance();
} catch (IllegalAccessException | InstantiationException e) {
e.printStackTrace();
GB.log("error", GB.ERROR, e);
continue;
}