@@ -60,10 +60,10 @@ public void update(TaskWorkerImpl.Message message) {
6060 // Provide context to PythonProvider
6161 try (PythonProvider ignored = PythonProvider .create (getApplicationContext ())) {
6262 boolean result = workerImpl .execute (id ,arg );
63- if (!result ){
64- if (updateTaskStatus (getArgument (), JobStorage .Jobs .State .FAILED .toString ())== 0 ) {
63+ if (!result ) {
64+ if (updateTaskStatus (getArgument (), JobStorage .Jobs .State .FAILED .toString ()) == 0 ) {
6565 Log .e (TAG , "Failed to update TaskStatus for remote Task " + getId ());
66- };
66+ }
6767 }
6868 r = result ? Result .success () : Result .failure ();
6969 }
@@ -79,25 +79,25 @@ public void update(TaskWorkerImpl.Message message) {
7979 public void onStopped () {
8080 Log .d (TAG , "Stopping background remote task " + getId ());
8181 // Here we need to update the task in the database to be marked as failed
82- if (updateTaskStatus (getArgument (), JobStorage .Jobs .State .CANCELED .toString ())== 0 ) {
82+ if (updateTaskStatus (getArgument (), JobStorage .Jobs .State .CANCELED .toString ()) == 0 ) {
8383 Log .e (TAG , "Failed to update TaskStatus for remote Task " + getId ());
84- };
84+ }
8585 hideNotification ();
8686 super .onStopped ();
8787 }
8888
8989 protected int updateTaskStatus (String id , String stateToBeUpdatedTo ) {
9090 int result = 0 ;
91- try (JobStorage db = JobStorage .readwrite (getApplicationContext ())){
92- if (db !=null ){
91+ try (JobStorage db = JobStorage .readwrite (getApplicationContext ())) {
92+ if (db !=null ) {
9393 Log .d (TAG , "Updating Task Status for job " + id );
9494 UpdateQuery q = new UpdateQuery (JobStorage .Jobs .TABLE_NAME )
9595 .where (JobStorage .Jobs .id , id )
9696 .set (JobStorage .Jobs .state , stateToBeUpdatedTo );
9797 result = q .execute (db );
9898 }
9999 Log .e (TAG , "Failed to initialize JobStorage" );
100- }catch (Exception e ){
100+ }catch (Exception e ) {
101101 Log .e (TAG , "Error managing JobStorage" , e );
102102 }
103103 return result ;
0 commit comments