java - Why Sonar says Constructor Calls Overridable Method when there is no overridable method called? -
i getting following code issue in sonar . class implements basedatabase interface method not called constructor.
public class derbydatabasehelper implements basedatabase { private static boolean isinitializationdone; private static connection connection; private static final logger logger = logger .getlogger(derbydatabasehelper.class); /** * @param connection * connection set */ private static void setconnection(connection connection) { derbydatabasehelper.connection = connection; } public derbydatabasehelper() { deletederbyfolder(new file("newdb")); if (!isinitializationdone) { initializedb(); setinitializationdone(true); } } /** * method initializes derby schema. */ private void initializedb() { try { // scriptrunner of apache ibatis execute sql file // creating database schema in derbydb . new scriptrunner(getconnection()) .runscript(new inputstreamreader(new fileinputstream( configreader.getvalue("schemafilepath")), charset .defaultcharset())); } catch (exception e) { logger.error( "exception occurred during initialization of db. exception details :: ", e); } { closeconnection(); } } /** * method used derby database connection object */ @override public connection getconnection() { if (connection == null) { try { loadderbyclass(); // create jdbc connection setconnection(drivermanager.getconnection(configreader .getvalue("initialurl") + configreader.getvalue("dbname") + configreader.getvalue("createdb"))); } catch (sqlexception e) { logger.error( "exception occurred during creating connection. exception details :: ", e); } } return connection; } /** * method used close acquired derby database connection * object. */ @override public void closeconnection() { if (connection != null) { try { connection.close(); } catch (exception e) { logger.error( "exception occurred during closing connection. exception details :: ", e); } } } and interface
public interface basedatabase { connection getconnection(); void closeconnection(); } as can see there no overriden method called constructor,is sonar not able interpret issue.
Comments
Post a Comment