+catch Exception

This commit is contained in:
2024-08-10 14:09:23 +05:00
parent f57fec4e27
commit 116f1e5606
16 changed files with 339 additions and 86 deletions

View File

@ -10,7 +10,6 @@ import android.util.Log;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import java.sql.SQLException;
import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputEditText;
import java.util.ArrayList; import java.util.ArrayList;
@ -75,6 +74,8 @@ public class DBGUITable
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb != null) { rdb.close(); } if(rdb != null) { rdb.close(); }
} }
@ -121,6 +122,8 @@ public class DBGUITable
}while (cursor.moveToNext()); }while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
if (rdb != null) { rdb.close(); } if (rdb != null) { rdb.close(); }
} }
@ -303,6 +306,8 @@ public class DBGUITable
} }
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb != null) { rdb.close(); } if(rdb != null) { rdb.close(); }
} }

View File

@ -1588,12 +1588,14 @@ public class DbOpenHelper extends SQLiteOpenHelper
} }
} catch (Exception e) { } catch (Exception e) {
Log.v(tableName, e.toString(), e); Log.v(tableName, e.toString(), e);
e.printStackTrace(); //e.printStackTrace();
} finally } finally
{ {
if (c != null) if (c != null)
c.close(); c.close();
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb != null) { rdb.close(); } if(rdb != null) { rdb.close(); }
} }
@ -1603,6 +1605,8 @@ public class DbOpenHelper extends SQLiteOpenHelper
/**Функция для обновления или вставки табличных данных*/ /**Функция для обновления или вставки табличных данных*/
public Boolean updateTable(TCTable tbl) public Boolean updateTable(TCTable tbl)
{ {
if(tbl==null) return false;
Cursor cursor; Cursor cursor;
if(tbl.name.equals("countries")) if(tbl.name.equals("countries"))
Log.i("igor", "tbl0=" + tbl.name); Log.i("igor", "tbl0=" + tbl.name);
@ -1624,88 +1628,102 @@ public class DbOpenHelper extends SQLiteOpenHelper
} }
} }
SQLiteDatabase wdb = null; //Переписываем значения существующих полей и выполняем запросы
try { while(tbl.ReadNextRecord())
wdb = this.getWritableDatabase(); {
//Переписываем значения существующих полей и выполняем запросы if(tbl.name.equals("frmlocustdel")){
while(tbl.ReadNextRecord()) Log.i("igor","tbl.name="+tbl.name);
}
String sql="select 1 from "+tbl.name+" where id = ?";
String[] par = new String[] { tbl.getRowByName("id").getStrVal() };
boolean exists=false;
SQLiteDatabase rdb=null;
try {
rdb = getReadableDatabase();
cursor = rdb.rawQuery(sql, par);
exists=cursor.moveToFirst();
cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{
if(rdb != null) { rdb.close(); }
}
ContentValues cv = new ContentValues();
for(int i=0;i<tbl.fields.size();i++)
{ {
if(tbl.name.equals("frmlocustdel")){ //if(b && tbl.fields.get(i).name.equals("id")) continue; //Если существует не записываем
Log.i("igor","tbl.name="+tbl.name); //Log.i("igor","fld="+tbl.fields.get(i).name+" val="+tbl.fields.get(i).getStrVal()+" type="+tbl.fields.get(i).type); //Для дебага
}
String sql="select 1 from "+tbl.name+" where id = ?";
String[] par = new String[] { tbl.getRowByName("id").getStrVal() };
boolean exists=false; if(fb[i]) //Присваиваем только поля существующие в локальной базе
SQLiteDatabase rdb=null; {
if(tbl.fields.get(i).value==null)
cv.putNull(tbl.fields.get(i).name);
else
cv.put(tbl.fields.get(i).name, tbl.fields.get(i).getStrVal());
}
}
if(!exists)
{
SQLiteDatabase wdb = null;
try { try {
rdb = getReadableDatabase(); wdb = this.getWritableDatabase();
cursor = rdb.rawQuery(sql, par);
exists=cursor.moveToFirst();
cursor.close();
}finally{
if(rdb != null) { rdb.close(); }
}
ContentValues cv = new ContentValues();
for(int i=0;i<tbl.fields.size();i++)
{
//if(b && tbl.fields.get(i).name.equals("id")) continue; //Если существует не записываем
Log.i("igor","fld="+tbl.fields.get(i).name+" val="+tbl.fields.get(i).getStrVal()+" type="+tbl.fields.get(i).type); //Для дебага
if(fb[i]) //Присваиваем только поля существующие в локальной базе
{
if(tbl.fields.get(i).value==null)
cv.putNull(tbl.fields.get(i).name);
else
cv.put(tbl.fields.get(i).name, tbl.fields.get(i).getStrVal());
}
}
if(!exists)
{
wdb.beginTransaction(); //Вроде как защита от многопоточности (для сервиса) wdb.beginTransaction(); //Вроде как защита от многопоточности (для сервиса)
try { try {
wdb.insert(tbl.name, null, cv); wdb.insert(tbl.name, null, cv);
wdb.setTransactionSuccessful(); wdb.setTransactionSuccessful();
}catch(SQLException ex){ }catch(Exception ex){
ex.printStackTrace(); ex.printStackTrace();
}finally { }finally {
wdb.endTransaction(); wdb.endTransaction();
} }
}else }catch(Exception e){
{ e.printStackTrace();
}finally{
if(wdb!=null){ wdb.close(); }
}
}else
{
SQLiteDatabase wdb = null;
try {
wdb = this.getWritableDatabase();
wdb.beginTransaction(); //Вроде как защита от многопоточности (для сервиса) wdb.beginTransaction(); //Вроде как защита от многопоточности (для сервиса)
try { try {
wdb.update(tbl.name, cv, "id = ?", new String[] { tbl.getRowByName("id").getStrVal() }); wdb.update(tbl.name, cv, "id = ?", new String[] { tbl.getRowByName("id").getStrVal() });
wdb.setTransactionSuccessful(); wdb.setTransactionSuccessful();
}catch(SQLException ex){ }catch(Exception ex){
ex.printStackTrace(); ex.printStackTrace();
} finally { } finally {
wdb.endTransaction(); wdb.endTransaction();
} }
}catch(Exception e){
e.printStackTrace();
}finally{
if(wdb!=null){ wdb.close(); }
} }
} }
}finally{
if(wdb!=null){ wdb.close(); }
} }
//Для дебага //Для дебага вывожу сколько строк в каждой таблице
SQLiteDatabase rdb=null; // SQLiteDatabase rdb=null;
try { // try {
rdb=getReadableDatabase(); // rdb = getReadableDatabase();
cursor = rdb.rawQuery("select sum(1) s from " + tbl.name, null); // cursor = rdb.rawQuery("select sum(1) cnt from " + tbl.name, null);
if (cursor.moveToFirst()) { // if (cursor.moveToFirst()) {
do { // do {
Log.i("igor", "tbl1=" + tbl.name + " cnt=" + cursor.getString(cursor.getColumnIndex("s"))); // Log.i("igor", "tbl1=" + tbl.name + " cnt=" + cursor.getString(0));
} while (cursor.moveToNext()); // } while (cursor.moveToNext());
} // }
cursor.close(); // cursor.close();
}finally{ // }catch(Exception e){
if(rdb!=null) rdb.close(); // e.printStackTrace();
} // }finally{
/**/ // if(rdb!=null) rdb.close();
// }
return true; return true;
} }
@ -1752,10 +1770,13 @@ public class DbOpenHelper extends SQLiteOpenHelper
} }
wdb.setTransactionSuccessful(); wdb.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("CCALM", "Error: ", e);
//e.printStackTrace();
} finally { } finally {
wdb.endTransaction(); wdb.endTransaction();
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
} }
@ -1775,6 +1796,8 @@ public class DbOpenHelper extends SQLiteOpenHelper
Cursor cursor = rdb.rawQuery("select 1 from _user where id = ?", new String[]{String.valueOf(id)}); Cursor cursor = rdb.rawQuery("select 1 from _user where id = ?", new String[]{String.valueOf(id)});
b = cursor.moveToFirst(); b = cursor.moveToFirst();
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null) rdb.close(); if(rdb!=null) rdb.close();
} }
@ -1797,9 +1820,13 @@ public class DbOpenHelper extends SQLiteOpenHelper
try { try {
wdb.insert("_user", null, cv); wdb.insert("_user", null, cv);
wdb.setTransactionSuccessful(); wdb.setTransactionSuccessful();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
wdb.endTransaction(); wdb.endTransaction();
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
} }
@ -1821,9 +1848,13 @@ public class DbOpenHelper extends SQLiteOpenHelper
try { try {
wdb.update("_user", cv, "id = ?", new String[] { String.valueOf(id) }); wdb.update("_user", cv, "id = ?", new String[] { String.valueOf(id) });
wdb.setTransactionSuccessful(); wdb.setTransactionSuccessful();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
wdb.endTransaction(); wdb.endTransaction();
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
} }
@ -2005,6 +2036,8 @@ public class DbOpenHelper extends SQLiteOpenHelper
try { try {
db.insert("frmlocustdel", null, cv); db.insert("frmlocustdel", null, cv);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }
@ -2253,7 +2286,8 @@ public class DbOpenHelper extends SQLiteOpenHelper
} }
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); Log.e("CCALM", "Error: ", e);
//e.printStackTrace();
} }
} while (cursor.moveToNext()); } while (cursor.moveToNext());

View File

@ -74,7 +74,6 @@ public class LocustActivity extends FragmentActivity implements LocationListener
public Long seq = null; // Дата изменения записи секунд с 1970 года public Long seq = null; // Дата изменения записи секунд с 1970 года
public StringDB m_Filled = new StringDB("1"); // 1- все обяз. поля заполнены, 0 - не все обяз. поля заполнены public StringDB m_Filled = new StringDB("1"); // 1- все обяз. поля заполнены, 0 - не все обяз. поля заполнены
//public Long created = null; // Дата создания записи секунд с 1970 года (только для не синхронизированных записей на планшете) //public Long created = null; // Дата создания записи секунд с 1970 года (только для не синхронизированных записей на планшете)
//public Integer user_id = null; //public Integer user_id = null;
public String ImageName = null; // Название файла рисунка public String ImageName = null; // Название файла рисунка
@ -263,6 +262,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -303,6 +304,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -446,6 +449,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -467,6 +472,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -487,6 +494,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -522,6 +531,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -558,6 +569,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -579,6 +592,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -599,6 +614,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -619,6 +636,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -640,6 +659,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -675,6 +696,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -695,6 +718,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -715,6 +740,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -740,6 +767,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -760,6 +789,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -822,6 +853,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -847,6 +880,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -866,6 +901,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -1462,7 +1499,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} catch (IOException e) } catch (IOException e)
{ {
e.printStackTrace(); Log.e("CCALM", "Error: ", e);
//e.printStackTrace();
} }
// Для сохранения названия рисунка в базу // Для сохранения названия рисунка в базу
break; break;
@ -1928,6 +1966,8 @@ public class LocustActivity extends FragmentActivity implements LocationListener
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -2595,11 +2635,15 @@ public class LocustActivity extends FragmentActivity implements LocationListener
stmt.bindDouble(4, list.get(i).lat); stmt.bindDouble(4, list.get(i).lat);
stmt.bindDouble(5, list.get(i).lon); stmt.bindDouble(5, list.get(i).lon);
stmt.executeInsert(); stmt.executeInsert();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
} }
} }
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -2656,19 +2700,19 @@ public class LocustActivity extends FragmentActivity implements LocationListener
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
DbOpenHelper dboh = new DbOpenHelper(this); DbOpenHelper dboh = new DbOpenHelper(this);
SQLiteDatabase rdb = null; String sql="select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';";
try { try(
rdb = dboh.getReadableDatabase(); SQLiteDatabase rdb = dboh.getReadableDatabase();
Cursor cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null); Cursor cursor = rdb.rawQuery(sql, null);
) {
if(!cursor.moveToFirst()) if(!cursor.moveToFirst())
{ {
Toast toast = Toast.makeText(getApplicationContext(), Toast toast = Toast.makeText(getApplicationContext(),
getResources().getString(R.string.Please_authorize_the_tablet), Toast.LENGTH_LONG); getResources().getString(R.string.Please_authorize_the_tablet), Toast.LENGTH_LONG);
toast.show(); toast.show();
} }
cursor.close(); } catch (Exception e) {
}finally{ Log.e("CCALM", "Database error occurred", e);
if(rdb!=null){ rdb.close(); }
} }
dboh.close(); dboh.close();
} }

View File

@ -26,6 +26,7 @@ import android.provider.Settings;
import android.provider.Settings.Secure; import android.provider.Settings.Secure;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -309,6 +310,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -339,6 +342,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -410,6 +415,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -436,6 +443,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -463,6 +472,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -497,6 +508,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -522,6 +535,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -575,6 +590,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -597,6 +614,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -621,6 +640,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -645,6 +666,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -669,6 +692,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -691,6 +716,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -746,6 +773,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -770,6 +799,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -792,6 +823,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -816,6 +849,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -840,6 +875,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -864,6 +901,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -923,6 +962,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -982,6 +1023,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -1012,6 +1055,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -1217,6 +1262,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -1751,7 +1798,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} catch (IOException e) } catch (IOException e)
{ {
e.printStackTrace(); Log.e("CCALM", "Error: ", e);
//e.printStackTrace();
} }
// Для сохранения названия рисунка в базу // Для сохранения названия рисунка в базу
break; break;
@ -1871,11 +1919,15 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
stmt.bindString(5, list.get(i).uid); stmt.bindString(5, list.get(i).uid);
stmt.executeInsert(); stmt.executeInsert();
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
} }
} }
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -1957,6 +2009,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -2484,6 +2538,8 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
toast.show(); toast.show();
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }

View File

@ -28,7 +28,6 @@ import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.io.File; import java.io.File;
import java.sql.SQLException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -169,6 +168,8 @@ public class LocustDelListActivity extends AppCompatActivity
try { try {
wdb = dboh.getWritableDatabase(); wdb = dboh.getWritableDatabase();
wdb.execSQL("delete from frmlocustdel where send=1"); wdb.execSQL("delete from frmlocustdel where send=1");
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
} }
@ -685,6 +686,8 @@ public class LocustDelListActivity extends AppCompatActivity
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -711,6 +714,8 @@ public class LocustDelListActivity extends AppCompatActivity
toast.show(); toast.show();
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }

View File

@ -20,6 +20,7 @@ import android.os.Environment;
import android.provider.Settings.Secure; import android.provider.Settings.Secure;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -386,6 +387,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -415,6 +418,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -505,6 +510,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -533,6 +540,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -584,6 +593,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -611,6 +622,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -643,6 +656,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -689,6 +704,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -713,6 +730,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -738,6 +757,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -763,6 +784,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -788,6 +811,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -811,6 +836,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -838,6 +865,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -863,6 +892,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -888,6 +919,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -912,6 +945,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -937,6 +972,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -1005,6 +1042,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -1107,6 +1146,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -3206,7 +3247,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
} catch (IOException e) } catch (IOException e)
{ {
e.printStackTrace(); Log.e("CCALM", "Error: ", e);
//e.printStackTrace();
} }
// Для сохранения названия рисунка в базу // Для сохранения названия рисунка в базу
break; break;

View File

@ -165,6 +165,8 @@ public class LocustHealthListActivity extends AppCompatActivity
try { try {
rdb = dboh.getReadableDatabase(); rdb = dboh.getReadableDatabase();
rdb.execSQL("delete from frmlocusthealth where send=1"); rdb.execSQL("delete from frmlocusthealth where send=1");
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -746,6 +748,8 @@ public class LocustHealthListActivity extends AppCompatActivity
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -772,6 +776,8 @@ public class LocustHealthListActivity extends AppCompatActivity
toast.show(); toast.show();
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }

View File

@ -163,6 +163,8 @@ public class LocustListActivity extends AppCompatActivity
try { try {
rdb = dboh.getReadableDatabase(); rdb = dboh.getReadableDatabase();
rdb.execSQL("delete from frmlocust where send=1"); rdb.execSQL("delete from frmlocust where send=1");
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -650,6 +652,8 @@ public class LocustListActivity extends AppCompatActivity
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -674,6 +678,8 @@ public class LocustListActivity extends AppCompatActivity
toast.show(); toast.show();
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }

View File

@ -77,7 +77,8 @@ public class MainActivity extends Activity {
sslContext.createSSLEngine(); sslContext.createSSLEngine();
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException
| NoSuchAlgorithmException | KeyManagementException e) { | NoSuchAlgorithmException | KeyManagementException e) {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} }
//Загрузка сохранёного языка //Загрузка сохранёного языка
@ -144,7 +145,8 @@ public class MainActivity extends Activity {
e.printStackTrace(); e.printStackTrace();
} }
}*/ }*/
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -186,7 +188,8 @@ public class MainActivity extends Activity {
try { try {
((TextView) findViewById(R.id.tvVersion)).setText("v "+this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName); ((TextView) findViewById(R.id.tvVersion)).setText("v "+this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName);
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} }
//Для синхронизации справочников //Для синхронизации справочников
@ -214,6 +217,8 @@ public class MainActivity extends Activity {
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }

View File

@ -76,7 +76,8 @@ public class MainService extends Service
m_pi.send(MainService.this, SetupActivity.STATUS_FINISH, intent); m_pi.send(MainService.this, SetupActivity.STATUS_FINISH, intent);
} catch (CanceledException e) } catch (CanceledException e)
{ {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} }
} }
} }

View File

@ -183,6 +183,8 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
} }
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }

View File

@ -125,7 +125,8 @@ public class MySynchronizationNew
mSemaphore.acquire(); mSemaphore.acquire();
mTList.add(tableName); mTList.add(tableName);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} finally } finally
{ mSemaphore.release(); { mSemaphore.release();
} }
@ -139,7 +140,8 @@ public class MySynchronizationNew
mSemaphore.acquire(); mSemaphore.acquire();
result=mTList.size(); result=mTList.size();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} finally } finally
{ mSemaphore.release(); { mSemaphore.release();
} }
@ -299,6 +301,8 @@ public class MySynchronizationNew
try { try {
db.update("frmlocust", cv, "uid = ?", new String[] { String.valueOf(cursor.getString(cursor.getColumnIndex("uid"))) }); db.update("frmlocust", cv, "uid = ?", new String[] { String.valueOf(cursor.getString(cursor.getColumnIndex("uid"))) });
db.setTransactionSuccessful(); db.setTransactionSuccessful();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }
@ -317,6 +321,8 @@ public class MySynchronizationNew
try { try {
db.update("frmlocust", cv, "uid = ?", new String[] { String.valueOf(cursor.getString(cursor.getColumnIndex("uid"))) }); db.update("frmlocust", cv, "uid = ?", new String[] { String.valueOf(cursor.getString(cursor.getColumnIndex("uid"))) });
db.setTransactionSuccessful(); db.setTransactionSuccessful();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }
@ -335,6 +341,8 @@ public class MySynchronizationNew
try { try {
db.update("frmlocust", cv, "uid = ?", new String[] { String.valueOf(cursor.getString(cursor.getColumnIndex("uid"))) }); db.update("frmlocust", cv, "uid = ?", new String[] { String.valueOf(cursor.getString(cursor.getColumnIndex("uid"))) });
db.setTransactionSuccessful(); db.setTransactionSuccessful();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }
@ -370,6 +378,8 @@ public class MySynchronizationNew
try { try {
db.update("frmlocust", cv, "uid = ?", new String[] { String.valueOf(uid) }); db.update("frmlocust", cv, "uid = ?", new String[] { String.valueOf(uid) });
db.setTransactionSuccessful(); db.setTransactionSuccessful();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }

View File

@ -250,6 +250,8 @@ public class MySynchronizationOld
}while (cursor.moveToNext()); }while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -358,6 +360,8 @@ public class MySynchronizationOld
}while (cursor.moveToNext()); }while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -417,6 +421,8 @@ public class MySynchronizationOld
}while (cursor.moveToNext()); }while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -437,6 +443,8 @@ public class MySynchronizationOld
} }
if (seq == null) seq = "0"; if (seq == null) seq = "0";
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -475,6 +483,8 @@ public class MySynchronizationOld
}while (cursor.moveToNext()); }while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -493,6 +503,8 @@ public class MySynchronizationOld
}while (cursor.moveToNext()); }while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -552,6 +564,8 @@ public class MySynchronizationOld
rid_frmlocustdel_locations = makeRequest("frmlocustdel_locations",String.valueOf(MySynchronizationOld.SyncDays),country_id); rid_frmlocustdel_locations = makeRequest("frmlocustdel_locations",String.valueOf(MySynchronizationOld.SyncDays),country_id);
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -665,6 +679,8 @@ public class MySynchronizationOld
try { try {
wdb.update("frmlocust", cv, "uid = ?", new String[]{String.valueOf(uid)}); wdb.update("frmlocust", cv, "uid = ?", new String[]{String.valueOf(uid)});
wdb.setTransactionSuccessful(); wdb.setTransactionSuccessful();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
wdb.endTransaction(); wdb.endTransaction();
} }
@ -693,6 +709,8 @@ public class MySynchronizationOld
pFile.renameTo(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/_" + cursor.getString(cursor.getColumnIndex("image_name3")))); pFile.renameTo(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/_" + cursor.getString(cursor.getColumnIndex("image_name3"))));
} }
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
@ -720,6 +738,8 @@ public class MySynchronizationOld
try { try {
wdb.update("frmlocustdel", cv, "uid = ?", new String[]{String.valueOf(uid)}); wdb.update("frmlocustdel", cv, "uid = ?", new String[]{String.valueOf(uid)});
wdb.setTransactionSuccessful(); wdb.setTransactionSuccessful();
}catch(Exception e){
e.printStackTrace();
} finally { } finally {
wdb.endTransaction(); wdb.endTransaction();
} }
@ -748,6 +768,8 @@ public class MySynchronizationOld
pFile.renameTo(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/_" + cursor.getString(cursor.getColumnIndex("image_name3")))); pFile.renameTo(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/_" + cursor.getString(cursor.getColumnIndex("image_name3"))));
} }
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
@ -832,8 +854,9 @@ class MyThread extends Thread
} }
} }
} catch (InterruptedException ex) } catch (InterruptedException e)
{ {
e.printStackTrace();
} finally } finally
{ mSemaphore.release(); { mSemaphore.release();
} }
@ -963,12 +986,14 @@ class MyThread extends Thread
try { try {
dos.write(buffer, 0, bytesRead); dos.write(buffer, 0, bytesRead);
} catch (OutOfMemoryError e) { } catch (OutOfMemoryError e) {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} }
bytesRead = fileInputStream.read(buffer); bytesRead = fileInputStream.read(buffer);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} }
fileInputStream.close(); fileInputStream.close();

View File

@ -23,6 +23,7 @@ import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.provider.Settings; import android.provider.Settings;
import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.Display; import android.view.Display;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
@ -138,6 +139,8 @@ public class ScanActivity extends Activity {
tvName.setText(cursor.getString(cursor.getColumnIndex("name"))); tvName.setText(cursor.getString(cursor.getColumnIndex("name")));
} }
cursor.close(); cursor.close();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }
@ -201,7 +204,8 @@ public class ScanActivity extends Activity {
try { try {
inputStream = getContentResolver().openInputStream(data.getData()); inputStream = getContentResolver().openInputStream(data.getData());
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} }
if (inputStream != null) { if (inputStream != null) {
@ -276,6 +280,8 @@ public class ScanActivity extends Activity {
stmt.bindString(5, Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)); stmt.bindString(5, Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID));
stmt.executeInsert(); stmt.executeInsert();
} }
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
@ -298,7 +304,8 @@ public class ScanActivity extends Activity {
qrcode = ""; qrcode = "";
} }
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} }
} }
@ -327,7 +334,8 @@ public class ScanActivity extends Activity {
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); //e.printStackTrace();
Log.e("CCALM", "Error: ", e);
} }
} }

View File

@ -384,6 +384,8 @@ public class SetupActivity extends Activity {
wdb = dboh.getWritableDatabase(); wdb = dboh.getWritableDatabase();
dboh.dropAllTables(wdb); dboh.dropAllTables(wdb);
dboh.onCreate(wdb); dboh.onCreate(wdb);
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(wdb!=null){ wdb.close(); } if(wdb!=null){ wdb.close(); }
} }

View File

@ -25,6 +25,8 @@ public class SplashScreen extends Activity {
SQLiteDatabase rdb = null; SQLiteDatabase rdb = null;
try { try {
rdb = dboh.getReadableDatabase(); rdb = dboh.getReadableDatabase();
}catch(Exception e){
e.printStackTrace();
}finally{ }finally{
if(rdb!=null){ rdb.close(); } if(rdb!=null){ rdb.close(); }
} }