java - What is the best strategy to recover from an error - neglecting the record where error occurs -
i getting no implementation found native ldalvik/system/vmruntime;.pausegc
error, below logcat.
05-13 22:39:22.538: w/dalvikvm(8350): no implementation found native ldalvik/system/vmruntime;.pausegc:(ljava/lang/string;)i 05-13 22:39:22.543: e/mythread(8350): pause gc 05-13 22:39:22.543: e/mythread(8350): java.lang.reflect.invocationtargetexception 05-13 22:39:22.543: e/mythread(8350): @ java.lang.reflect.method.invokenative(native method) 05-13 22:39:22.543: e/mythread(8350): @ java.lang.reflect.method.invoke(method.java:515) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread.pausegc(mythread.java:5525) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread.performlaunchactivity(mythread.java:2324) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread.handlelaunchactivity(mythread.java:2471) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread.access$900(mythread.java:175) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread$h.handlemessage(mythread.java:1308) 05-13 22:39:22.543: e/mythread(8350): @ android.os.handler.dispatchmessage(handler.java:102) 05-13 22:39:22.543: e/mythread(8350): @ android.os.looper.loop(looper.java:146) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread.main(mythread.java:5602) 05-13 22:39:22.543: e/mythread(8350): @ java.lang.reflect.method.invokenative(native method) 05-13 22:39:22.543: e/mythread(8350): @ java.lang.reflect.method.invoke(method.java:515) 05-13 22:39:22.543: e/mythread(8350): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1283) 05-13 22:39:22.543: e/mythread(8350): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1099) 05-13 22:39:22.543: e/mythread(8350): @ dalvik.system.nativestart.main(native method) 05-13 22:39:22.543: e/mythread(8350): caused by: java.lang.unsatisfiedlinkerror: native method not found: dalvik.system.vmruntime.pausegc:(ljava/lang/string;)i 05-13 22:39:22.543: e/mythread(8350): @ dalvik.system.vmruntime.pausegc(native method) 05-13 22:39:22.543: e/mythread(8350): ... 15 more
i searched across various forums, bug related samsung 4.4.2 , above updates subset of note devices ( have 2 note devices same specs , bug occurs on 1 of them)
the idea here know causing bug, can change course of program avoid condition wherein bug can occur. credible or official answer sought after , putting bounty of 200 on question once eligible.
in case occurs when doing memory intense operation, knowledge (naive might be) tells me has got pausing gc, (manual)
call system.gc resolve things me?
how recover error? in loop reading 1 db table, address book , file 1 after other. these read values undergo calculation process , results stored in larger db. these statements in while loop, have put checks in try catch if any , not limited to
error occurs. start next iteration of loop using continue statement in catch clause- neglecting record crash occurs. execution not guaranteed using method, crash can keep happening forcing subsequent records omitted.
edit: here culprit block of code:
if(flag ==1){ toread=new file(getapplicationcontext().getfilesdir()+"/reminders/fileone.txt"); }else{ toread=new file(getapplicationcontext().getfilesdir()+"/reminders/output.txt"); } // copydirectoryonelocationtoanotherlocation(new file(getapplicationcontext().getfilesdir()+"/reminders/output.txt"), new file("mnt/sdcard/filecheck.txt")); fileinputstream fis=new fileinputstream(toread); scanner sc=new scanner(fis); string currentline; while(sc.hasnextline()){ try{ system.out.println("count in file"+i); currentline=sc.nextline(); // todo = gets concatnated stringtokenizer st=new stringtokenizer(currentline,"=",false); contact_name = totitlecase(st.nexttoken()); if(contact_name.contains("'")){ contact_name = contact_name.replace("'", ""); } // ********* string liststr = st.nexttoken(); string cut = liststr.substring(1, liststr.length() - 1); string[] array = cut.split(","); // system.out.println("array is: "+arrays.tostring(array)); contact_id = (array[0].trim()); string datestr = (array[1].trim()); simpledateformat format = new simpledateformat("yyyy-mm-dd"); date date = format.parse(datestr); java.sql.date dx = new java.sql.date(date.gettime()); date key = dx; datetoinsert = string.valueof(dx); contact_image_uri = (array[2].trim()); if(contact_image_uri.contains("?typ")){ contact_image_uri = contact_image_uri+"e=normal"; } if (iscancelled()) { break; } progress = ("" + character.touppercase(contact_name.charat(0)) + contact_name.substring(1) + "\n"+i + " of " + lines + " contacts"); // progress displayed here. years = getdiffyear(key); // years elapsed secon = seconds(key); // seconds elapsed min = seconds(key) / 60; // minutes elapsed hours = getdiffhour(key);// hours elapsed mon = months(string.valueof(key)); // months elapsed days = dayselapsed(key); // days elapsed weeks = dayselapsed(key) / 7; // weeks //=============================================================================================================== if (datetoinsert.contains("0001-") == true){ //special case, added 0001 birthdays have no year field. //=========================================================================================================== dbhelper.insert(datetoinsert, contact_name, "","", contact_image_uri, "", "", "", contact_id, "", "","1"); // other fields empty, because don't have year. int primary_id = dbhelper.getprimaryid(); string foreign_key = dbhelper.gethighestid(primary_id); //===================================================================================================== //in case interested in fetching year alert next birthday of contact --> //===================================================================================================== intcal.yearstonotify(years, datetoinsert); int yearsspecial = intcal.getyearsregular(); date dateyearsreg = intcal.getyearsregdate(); dbhelper.insertnotifications(5, convertdate(dateyearsreg), 0, yearsspecial,foreign_key,primary_id,contact_image_uri,datetoinsert ); } //========================================================================= //case when date fields exist , set notifications ---> //========================================================================= else if(datetoinsert != "null" && datetoinsert.contains("0001-") != true){ dbhelper.insert(datetoinsert, contact_name, string.valueof(days), string.valueof(hours), contact_image_uri, string.valueof(min),string.valueof(mon), string.valueof(secon), contact_id, string.valueof(weeks), string.valueof(years),"1"); int primary_id = dbhelper.getprimaryid(); // fetch primaryid (_id) of above inserted row, foreign key notification , specialnotifications table. string foreign_key = dbhelper.gethighestid(primary_id); // same above, fetches name field of last inserted row. //========================================================================= //**database insertions notifications table/ specialnotifications table** //========================================================================= //=======================================================================================// //regular intervals db insertions: //======================================================================================// //notification types: //1 months //2 weeks //3 days //4 minutes //5 years //6 seconds //7 hours //======================================================================================// //============================== //for months //============================== intcal.monthsnotify(mon, datetoinsert); int monspecial = intcal.getmonthregular(); date datemonreg = intcal.getmonregdate(); dbhelper.insertnotifications(1, convertdate(datemonreg), 0, monspecial,foreign_key,primary_id,contact_image_uri,datetoinsert ); //=============================== //for weeks //=============================== intcal.weekstonotify(weeks,datetoinsert); int weekspecial = intcal.getweekregular(); date dateweekreg =intcal.getweekregdate(); dbhelper.insertnotifications(2, convertdate(dateweekreg), 0, weekspecial,foreign_key,primary_id,contact_image_uri,datetoinsert ); //=============================== //for days //=============================== intcal.daystonotify(days, datetoinsert); int daysspecial= intcal.getdaysregular(); date datedaysreg = intcal.getdaysregdate(); dbhelper.insertnotifications(3, convertdate(datedaysreg), 0, daysspecial,foreign_key,primary_id,contact_image_uri,datetoinsert ); //=============================== //for minutes //=============================== intcal.minutestonotify(min,datetoinsert); long minutesspecial= intcal.getminutesregular(); date dateminsreg = intcal.getminutesregdate(); dbhelper.insertnotifications(4, convertdate(dateminsreg), 0,(int) minutesspecial,foreign_key,primary_id,contact_image_uri,datetoinsert ); //============================== //for years //============================== intcal.yearstonotify(years, datetoinsert); int yearsspecial = intcal.getyearsregular(); date dateyearsreg = intcal.getyearsregdate(); dbhelper.insertnotifications(5, convertdate(dateyearsreg), 0, yearsspecial,foreign_key,primary_id,contact_image_uri,datetoinsert ); //============================= //for seconds //============================= intcal.secondstonotify(secon, datetoinsert); long secondsspecial= intcal.getsecondsregular(); date datesecondsreg = intcal.getsecondsregdate(); dbhelper.insertnotifications(6, convertdate(datesecondsreg), 0, secondsspecial,foreign_key,primary_id,contact_image_uri,datetoinsert ); //============================= //for hours //============================= intcal.hourstonotify(hours, datetoinsert); int hoursspecial= intcal.gethoursregular(); date datehoursreg= intcal.gethoursregdate(); dbhelper.insertnotifications(7, convertdate(datehoursreg), 0, hoursspecial,foreign_key,primary_id,contact_image_uri,datetoinsert ); //============================================================================================// //special intervals //============================================================================================// //notification types: //1 months //2 weeks //3 days //4 minutes //5 years //6 seconds //7 hours //for years intcal.specialintervalyears(years, datetoinsert); int yearsoncespecial =intcal.getyearsspecial(); date dateyearsspecial = intcal.getyearsspdate(); dbhelper.insertspecialnotifications(5, convertdate(dateyearsspecial), yearsoncespecial,foreign_key,primary_id); //for months intcal.specialintervalmonths(mon,datetoinsert); int monthsoncespecial= intcal.getmonthsspecial(); date datemonthsspecial = intcal.getmonthsspdate(); dbhelper.insertspecialnotifications(1, convertdate(datemonthsspecial), monthsoncespecial,foreign_key,primary_id); //for weeks intcal.specialintervalsweeks(weeks,datetoinsert); int weeksoncespecial= intcal.getweeksspecial(); date dateweeksspecial = intcal.getweeksspdate(); dbhelper.insertspecialnotifications(2, convertdate(dateweeksspecial), weeksoncespecial,foreign_key,primary_id); //for days intcal.specialintervalsdays(days, datetoinsert); int daysoncespecial= intcal.getdaysspecial(); date datedaysspecial = intcal.getdaysspdate(); dbhelper.insertspecialnotifications(3, convertdate(datedaysspecial), daysoncespecial,foreign_key,primary_id); //for hours intcal.specialintervalshours(hours,datetoinsert); int hoursoncespecial= intcal.gethoursspecial(); date datehoursspecial = intcal.gethoursspdate(); dbhelper.insertspecialnotifications(7, convertdate(datehoursspecial), hoursoncespecial,foreign_key,primary_id); //for minutes intcal.specialintervalminutes(min,datetoinsert); long minutesoncespecial= intcal.getminutesspecial(); date dateminutesspecial= intcal.getminutesspdate(); dbhelper.insertspecialnotifications(4, convertdate(dateminutesspecial), (int)minutesoncespecial,foreign_key,primary_id); //for seconds intcal.specialintervalsseconds(secon,datetoinsert); long secondsoncespecial= intcal.getsecondsspecial(); date datesecondsspecial= intcal.getsecondsspdate(); dbhelper.insertspecialnotifications(6, convertdate(datesecondsspecial), secondsoncespecial,foreign_key,primary_id); } publishprogress(progress); asycdialog.setmax(lines); asycdialog.incrementprogressby(1); i++; }catch (exception e){ system.out.println("from catch 4"+e); continue; } }
edit 2:
i doing above process inside try catch wherein using transactions speed things. have implemented these transaction snippets @ opening of try block, start transaction , end them @ block , set them successful @ same place.
it seems samsung specific bug. has been reported to
- aosp issue tracker
- at samsung developer forum here , here
so far there not seem solution except updating android version (if got right).
Comments
Post a Comment