java - Sonar dead store to local variable -
i have following code , sonar telling me following error message:
dead store descriptions1 in new com.dscsag.dsct2c.test.teststep(integer, string, model)
in follwing code:
for (integer count = 0; count < teststepcount; count++) { if (xmlreader.istestexistingforordernumber(count, ordernumber, version)) { if (xmlreader.checkforduplicatetest(ordernumber, count, version)) { globalvariables.logging_logger.error("### " + this.getclass().getsimplename() + ": there 1 or more duplicated order numbers test " + count + " under test step " + ordernumber + "."); model.setstatustext("status_duplicated_test", ordernumber.tostring(), statuscode.error); throw new exception(); } else { globalvariables.logging_logger.info("### " + this.getclass().getsimplename() + ": no duplicated found test " + count + " under test step " + ordernumber + "."); boolean functionneeded = xmlreader.isfunctionneededforordernumber(ordernumber, count, version); string[][] descriptions1 = new string[2][descriptions[0].length]; (int = 0; < this.descriptions[0].length; a++) { descriptions1[0][a] = descriptions[0][a]; descriptions1[1][a] = xmlreader.gettestdescription(descriptions[0][a], ordernumber, count, version); } arraylist<string> filesstring = xmlreader.gettestfilesforordernumber(ordernumber, count, version); arraylist<file> filesfile = new arraylist<file>(); iterator<string> = filesstring.iterator(); while (it.hasnext()) { file file = new file(globalvariables.path_testfiles + xmlreader.getvaluedocumentconfiguration(xmlelements.cad_appl, xmlelements.testing_environment, null) + "/" + it.next()); filesfile.add(file); globalvariables.logging_logger.info("### " + this.getclass().getsimplename() + ": added file test " + count + " under test step " + ordernumber + ": \"" + file.getname() + "\""); } testobjectslist.add(new testobject(functionneeded, xmlreader.getfunctionnameforordernumber(ordernumber, count, version), descriptions1, filesfile)); globalvariables.logging_logger.info("### " + this.getclass().getsimplename() + ": created test object test " + count + " under test step " + ordernumber + "."); } } else { model.setstatustext("status_no_test", count.tostring(), statuscode.warning); } } }
can see why store "dead" descriptions1
? think have use variable.
its false positive of sonar. sonar works on compiled code, not source. guess access descriptions1
optimized away or replaced compiler, sonar cant see it.
Comments
Post a Comment