2httpdocsoraclecomjavase7docsapijavalangThrowablehtml3httpswwwbugsensecom4httpwwwsplunkcom Figure1Identicationofriskymethods Figure2ExtractionofapiexceptionsTheinvestigatio ID: 450683
Download Pdf The PPT/PDF document "Ourndingsshowthat19%oftheexaminedstackt..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Ourndingsshowthat19%oftheexaminedstacktraceshadapimethodswithundocumentedexceptions.Thismeansthatthesecrashescouldhavebeenavoidediftheinvolvedmethodshaddocumentationforpossiblethrownexceptions.Also,contrarytoourexpectations,werealizedthat40%ofthedocumentedexceptionsintheAndroidsourcecodearespecicuncheckedexceptions,namely:IllegalArgumentEx-ception,NullPointerException,IllegalStateException.Inthefollowingsections,werstdescribeourdataset(Section2).Then,weoutlineourmethods(Section3).InSection4,wepresentourresultsandinSection5wemakeadiscussionandrefertothethreatstovalidityofourstudy.Finally,weendupwithrelatedwork(Section6)andourconclusions(Section7).2.DATAForthepurposesofthisstudyweusedadatasetof4,900Javastacktraces(seeprintStackTrace())2fromAndroidapplicationcrashes.TheproviderofthedatasetwasaGreekstartupcalledBugSense,3whichiscurrentlyacompanyofSplunk.4BugSenseoersacentralizedcrashreportmanage-mentservicethatcollectsstacktracesfromapplicationsthathavebeencrashedandhaveinstalledtheBugSensesdk.Specically,weanalyzed4,902distinctcrashreportsfrom1,800dierentAndroidapplicationsthatrunondeviceswiththeAndroidapilevel15(4.0.3{4.0.4).OurdatasetwascollectedontheMayof2012.Inaddition,wedownloadedtheAndroidsdkandusedthesourcecodeoftheAndroidapi(level15).Weparsed2,171Javaleswithonlinedocu-mentation.AndroidisanembeddeddevicebasedontheLinuxoperat-ingsystemthatcanhostmobileapplications.Brie y,inthebottomlayerofAndroidframeworkthereistheLinuxkernel.Thekernelistheborderbetweenthedeviceandthesoftwareanditprovidesservicessuchasmemorymanagement,net-working,andpowermanagement.InthemiddlelayerthereistheDalvikvirtualmachineandtheJavaNativeInterface.Dalviksupportstheexecutionofmultipleapplicationsonthesystem.TheJavaNativeInterfaceisusedtoperformcallsfromJavacodeintonativecode.Finally,onthetoplayerthereareseveralJavaclassesfrom:1)coreapplications(contacts,phone,browser),2)third-partyapplications,and3)theJavaPlatform(J2SE).3.METHODSToidentifymethodsfromtheAndroidapithatlackcriti-caldocumentation,weworkedintwodirections.First,wepinpointedapimethodspossiblyresponsibleforcrashesandlinkedthemethodswiththethrownstacktraceexceptions(Figure1).Second,weparsedthesourcecodeoftheAn-droidapianddrewmethodswithdocumentedexceptions(Figure2).Thus,havingasetofriskyapimethodsandknowingthedocumentedexceptionsoftheAndroidapi,wewereabletolistmethodsthatareinvolvedincrashesandhaveundocumentedexceptions.Followingweexplainourtechniquesindetails.3.1IdenticationofRiskyMethods 2http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html3https://www.bugsense.com/4http://www.splunk.com/ Figure1:Identicationofriskymethods Figure2:ExtractionofapiexceptionsTheinvestigationofriskyapiscanbemadeinseveralways.Forinstance,examiningthedocumentationandndingcomplicatedapisthatleaddeveloperstotheviolationoftheapis'invariantsorpreconditions.Also,throughfuzztestingbypassingrandomvaluesasmethodinputs[3].Here,weempiricallyidentiedriskyapisbasedontheirfrequentmanifestationonapplicationcrashes.Inoursample,stacktracesconsistofmethodcallsfromtheAndroidframeworkthatleadtoanexception,possiblythroughanapplicationandanapi.Weassertthatthelastinstanceonanapplication|apipairisanapicallthatcanleadtoanapplicationcrash.Thus,bylocatingsuchapicallswecanndapimethodsthatpossiblycontributetoapplicationcrashes.InListing1,setContentViewissuchanexample.Then,takingalsointoaccounttherootexceptionandtheexceptionsfromtherestframes(forchainedstacktraces),wecouldhavemoreconciseinformationaboutthereasonofacrash.Listing1:Methodcallssequencecom.example.Serialize$Looper.runandroid.os.Looper.loopandroid.os.Handler.dispatchMessagecom.example.SerializeHandler.onMessagecom.example.app.Activity$1.workandroid.app.Activity.setContentViewFinally,inthebeginningofourstudy,weappliedsomebasiclteringtoconformourdatasetinanappropriateformatforanalysisandremovedmetadatafromourcrashreports.3.2ExtractionofDocumentedExceptionsToidentifymethodswithdocumentedexceptions(checkedandunchecked),wedownloadedandparsedtheAndroidsourcecodeoftheapi(version15).FromtheJavaleswekeptonlytheclassesthathaveonlinedocumentationintheAndroidreference.5Then,wewroteaJavadoclet6thatidentiesmethodswith@throwscommentsanddeclaredex-ceptionsintheirsignatures;weexcludedtheprivatemethodsastheydonotappearintheonlinedocumentation.Thus,wegotasetofmethodswithdocumentedexceptions.Finally,wereadthelesproducedbythedocletandorganizedthemethodsinadictionarybasedontheirnames.4.RESULTSFromtheanalysisoftheAndroidsourcecode,wefoundthatonly18%ofdistinctnon-privateapimethods(groupedbyname)haddocumentedexceptions(56%checkedand 5http://developer.android.com/reference/classes.html6http://docs.oracle.com/javase/6/docs/technotes-/guides/javadoc/doclet/overview.html Table1:Top10methodsinvolvedincrashesMethods Exceptions dismiss IllegalArgumentException,NullPointerExceptionshow WindowsManager.BadTokenException,IllegalStateException,In ateExceptionsetContentView In ateExceptioncreateScaledBitmap IllegalArgumentException,NullPointerExceptiononKeyDown IllegalStateExceptionisPlaying IllegalStateExceptionunregisterReceiver IllegalArgumentExceptiononBackPressed IllegalStateExceptionshowDialog WindowManager.BadTokenExceptioncreate Resources.NotFoundExceptionexceptionssuchasOutOfMemoryErrorinthedocumentation.6.RELATEDWORKAlthoughtherearepracticalguidelinesforwell-writtenapis[1,6],thereisstillgroundforempiricalstudiesthatdistinguishgoodfrombadapiparadigms.Currentstudiesfocusonapilearnability[9,8].Here,wearguedaboutexcep-tionsthatcouldhavebeenincludedinthedocumentationofapimethods.Acrashreportcanincludeastacktraceandmetadata:applicationname,operatingsystem,dateandtimeofthecrash.Thesedataprovidevaluableinformationforcrashcauseunderstandingandsoftwarereliability.Ganapathietal.[4]analyzedcrashreportsfromtheWindowsxpkernelandidentifybasiccrashcausetypes.Kimetal.[7]conductedanempiricalinvestigationontheFirefoxandThunderbirdcrashreportdatabasestopredict\topcrashes"fornewsoftwarereleases.Inaddition,stacktracesareusefulfortheminingandqualityevaluationofcrashreports[10,2],aswellasforbuglocalization[11].Contrarytotheexistingworks,weanalyzedstacktracesfromcrashreportsandidentiedAndroidapimethodswithundocumentedexceptions.7.CONCLUSIONSWeanalyzedstacktracesfromAndroidapplicationcrashestoidentifymethodsfromtheAndroidapithathavemissingdocumentationconcerningexceptionalcases.Wefoundthat18%ofnon-privatemethodsintheAndroidapihadundoc-umentedexceptions.Fromthemethodswithdocumentedexceptions,56%werecheckedand44%unchecked.Also,wefoundthat69%ofthemethods|fromAndroidpackages|inourstacktraceshadundocumentedexceptionsintheAn-droidapi.Then,19%ofourcrashescouldhavebeencausedbyinsucientdocumentation.8.ACKNOWLEDGMENTSWewouldliketothankBugSense(whichisnowaSplunkcompany),andmorespecicallyitsfoundersPanosPa-padopoulosandJohnVlachogiannisforthedataandin-formationtheyprovidedus.Inaddition,wewouldliketothankDimitrisMitropoulosforhisideasandinternalreviews.Thisresearchhasbeenco-nancedbytheEuropeanUnion(EuropeanSocialFund|esf)andGreeknationalfundsthroughtheOperationalProgram\EducationandLifelongLearning"oftheNationalStrategicReferenceFramework(nsrf)|ResearchFundingProgram:Thalis|AthensUni-versityofEconomicsandBusiness|SoftwareEngineeringResearchPlatform.9.REFERENCES[1]J.Bloch.HowtodesignagoodAPIandwhyitmatters.InCompaniontothe21stACMSIGPLANsymposiumonObject{OrientedProgrammingSystems,Languages,andApplications,OOPSLA'06,pages506{507,NewYork,NY,USA,2006.ACM.[2]Y.Dang,R.Wu,H.Zhang,D.Zhang,andP.Nobel.ReBucket:amethodforclusteringduplicatecrashreportsbasedoncallstacksimilarity.InProceedingsofthe2012InternationalConferenceonSoftwareEngineering,ICSE2012,pages1084{1093,Piscataway,NJ,USA,2012.IEEEPress.[3]J.E.ForresterandB.P.Miller.AnempiricalstudyoftherobustnessofwindowsNTapplicationsusingrandomtesting.InProceedingsofthe4thUSENIXWindowsSystemSymposium,pages59{68,2000.[4]A.Ganapathi,V.Ganapathi,andD.A.Patterson.WindowsXPkernelcrashanalysis.InLISA,volume6,pages49{159,2006.[5]S.Garnkel,D.Weise,andS.Strassmann,editors.TheUNIXHater'sHandbook.IDGBooksWorldwide,Inc.,SanMateo,CA,USA,1994.[6]M.Henning.APIdesignmatters.Commun.ACM,52(5):46{56,May2009.[7]D.Kim,X.Wang,S.Kim,A.Zeller,S.Cheung,andS.Park.WhichcrashesshouldIxrst?:Predictingtopcrashesatanearlystagetoprioritizedebuggingeorts.SoftwareEngineering,IEEETransactionson,37(3):430{447,2011.[8]W.MaalejandM.P.Robillard.PatternsofknowledgeinAPIreferencedocumentation.IEEETransactionsonSoftwareEngineering,99(PrePrints):1,2013.[9]M.RobillardandR.DeLine.AeldstudyofAPIlearningobstacles.EmpiricalSoftwareEngineering,16(6):703{732,2011.[10]A.Schroter,N.Bettenburg,andR.Premraj.Dostacktraceshelpdevelopersxbugs?InMiningSoftwareRepositories(MSR),20107thIEEEWorkingConferenceon,pages118{121,May2010.[11]S.Wang,F.Khomh,andY.Zou.Improvingbuglocalizationusingcorrelationsincrashreports.InProceedingsoftheTenthInternationalWorkshoponMiningSoftwareRepositories,MSR'13,pages247{256,Piscataway,NJ,USA,2013.IEEEPress.