{"id":198938,"date":"2013-10-24T22:32:03","date_gmt":"2013-10-24T18:32:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=198938"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=198938","title":{"rendered":"<span class=\"post_title\">FindBugs \u043f\u0440\u043e\u0442\u0438\u0432 CDK<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041c\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u044b \u043e\u0442 <a href=\"http:\/\/habrahabr.ru\/company\/pvs-studio\/\">PVS-Studio<\/a> \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d\u0438 \u0438\u0449\u0443\u0442 \u0431\u0430\u0433\u0438 \u0432 \u043a\u0430\u043a\u043e\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u042f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u044f \u0442\u043e\u0436\u0435 \u0441\u043c\u043e\u0433\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0441\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e Java. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 Java-\u043a\u043e\u0434\u0430 <a href=\"http:\/\/findbugs.sourceforge.net\/\">FindBugs<\/a>. \u041e \u043d\u0451\u043c \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u043b\u043e \u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435.<\/p>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u043a\u0440\u043e\u043b\u0438\u043a. \u041d\u0443\u0436\u0435\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u043b\u0438\u0437\u044b\u0432\u0430\u043b\u0438 \u043a\u043e\u0434. \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"http:\/\/cdk.sourceforge.net\/\">Chemistry Development Kit <\/a> (\u0432\u0435\u0440\u0441\u0438\u044f 1.4.19), \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0434\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. FindBugs \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u043a\u0430\u043a \u043f\u043b\u0430\u0433\u0438\u043d \u043a Eclipse, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0435\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/376\/26f\/cea\/37626fcea4edb4663f10c3d384cbd78e.png\"\/><br \/>  <a name=\"habracut\"><\/a><br \/>  FindBugs \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b 338 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u0441\u0435, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445.<\/p>\n<h4>1. \u041d\u0435\u0443\u0434\u0430\u0447\u043d\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/h4>\n<p>\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 org.openscience.cdk.math.RandomNumbersTool:  <\/p>\n<pre><code class=\"java\">public static int randomInt(int lo, int hi) {     return (Math.abs(random.nextInt()) % (hi - lo + 1)) + lo; }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 Random.nextInt() \u0432\u044b\u0434\u0430\u0451\u0442 \u043b\u044e\u0431\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0432 int. \u041c\u0435\u0442\u043e\u0434 Math.abs \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0447\u0438\u0441\u043b\u0430. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Math.abs \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f Integer.MIN_VALUE, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0438\u0441\u043b\u043e, \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0435 \u044d\u0442\u043e\u043c\u0443, \u043d\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 int. \u041e\u0434\u043d\u0430\u043a\u043e Random.nextInt() \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0430\u0442\u044c \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e (\u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043d\u0430 4 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430), \u0442\u043e\u0433\u0434\u0430 \u0432\u0435\u0441\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u043e.<\/p>\n<h4>2. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 BufferedReader.readLine() \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 null<\/h4>\n<p>\u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 (org.openscience.cdk.io.CIFReader):  <\/p>\n<pre><code class=\"java\">private void skipUntilEmptyOrCommentLine(String line) throws IOException {     \/\/ skip everything until empty line, or comment line     while (line != null && line.length() &gt; 0 && line.charAt(0) != '#') {         line = input.readLine().trim();     } }<\/code><\/pre>\n<p>\u0412\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u043c ready(), \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 readLine() \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 null. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0432\u044b\u0437\u043e\u0432\u0435\u0442 NullPointerException.<\/p>\n<h4>3. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f &#038; \u0432\u043c\u0435\u0441\u0442\u043e &#038;&#038;<\/h4>\n<p>\u0422\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430 (org.openscience.cdk.atomtype.CDKAtomTypeMatcher):  <\/p>\n<pre><code class=\"java\">if (atom.getFormalCharge() != null &     atom.getFormalCharge().intValue() == 1) {...}<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e, \u0432\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a NullPointerException.<\/p>\n<h4>4. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 String, Integer \u0438\u043b\u0438 Double \u043f\u043e ==<\/h4>\n<p>\u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0443\u0442 (org.openscience.cdk.AtomType.compare):  <\/p>\n<pre><code class=\"java\">return (getAtomTypeName() == type.getAtomTypeName()) &&         (maxBondOrder == type.maxBondOrder) &&         (bondOrderSum == type.bondOrderSum);<\/code><\/pre>\n<p>getAtomTypeName() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 String, \u0430 bondOrderSum \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f Double. \u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442, \u0447\u0442\u043e \u0442\u0443\u0442 \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u0435, \u043d\u043e \u0440\u0430\u0432\u043d\u044b\u0435 \u043f\u043e equals \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b Integer, Double \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h4>5. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0437\u0430\u0431\u044b\u043b, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b<\/h4>\n<p>\u0412\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 String, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 (net.sf.cdk.tools.MakeJavafilesFiles.readBlackList):  <\/p>\n<pre><code class=\"java\">while (line != null) { \tline.trim(); \tif (line.length() &gt; 0)  \t\tblacklist.add(line); \tline = reader.readLine(); }<\/code><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432 line.trim() \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u0435\u043d, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0430\u043c\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 line \u043e\u043d \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442. \u0410\u0432\u0442\u043e\u0440 \u044f\u0432\u043d\u043e \u0438\u043c\u0435\u043b \u0432 \u0432\u0438\u0434\u0443 line = line.trim(). \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u044b String.substring \u0431\u0435\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<h4>6. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432<\/h4>\n<p>\u041d\u0435\u0440\u0435\u0434\u043a\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u0443\u0445\u0435 <code>if( atom.equals(&quot;H&quot;) )<\/code>, \u0433\u0434\u0435 atom \u0442\u0438\u043f\u0430 IAtom. \u041f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0432\u0438\u0434\u0438\u043c\u043e, <code>if( atom.getSymbol().equals(&quot;H&quot;) )<\/code>. \u0412\u043e\u043e\u0431\u0449\u0435 \u044d\u0442\u043e \u0437\u0430\u0433\u0430\u0434\u043e\u0447\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0435\u0441\u044f\u0442\u043a\u0430, \u0430, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443 \u0438 \u0438\u0441\u043a\u0430\u0436\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<h4>7. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f<\/h4>\n<p>org.openscience.cdk.dict.EntryReact:  <\/p>\n<pre><code class=\"java\">public void setReactionMetadata(String metadata) {     this.reactionInfo.add( metadata ); }<\/code><\/pre>\n<p>FindBugs \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 reactionInfo \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0434\u0430\u0441\u0442 NullPointerException.<\/p>\n<h4>8. \u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u044f<\/h4>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043a\u043b\u0430\u0441\u0441 org.openscience.cdk.qsar.AtomValenceTool:  <\/p>\n<pre><code class=\"java\">public class AtomValenceTool {     private static Map&lt;String,Integer&gt; valencesTable = null;     public static int getValence(IAtom atom) {         if (valencesTable == null) {             valencesTable = new HashMap&lt;String, Integer&gt;();             valencesTable.put(&quot;H&quot;, 1);             valencesTable.put(&quot;He&quot;, 8);             valencesTable.put(&quot;Ne&quot;, 8);             ...         }         return valencesTable.get(atom.getSymbol());     } }<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d race condition, \u043a\u043e\u0433\u0434\u0430 valencesTable \u0443\u0436\u0435 \u043d\u0435 null, \u043d\u043e \u0435\u0449\u0451 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0422\u043e\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0434\u0430\u0441\u0442 NullPointerException \u0434\u043b\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0430\u0442\u043e\u043c\u0430.<\/p>\n<h4>9. \u041d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432<\/h4>\n<p>\u041c\u0435\u0442\u043e\u0434 equals() \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c false, \u0435\u0441\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 null. \u041c\u0435\u0442\u043e\u0434 clone() \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c null. \u041c\u0435\u0442\u043e\u0434 clone() \u043d\u0435 \u0432 final-\u043a\u043b\u0430\u0441\u0441\u0435 \u0434\u043e\u043b\u0436\u0435\u043d super.clone(), \u0430 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e (\u0438\u043d\u0430\u0447\u0435 \u0435\u0441\u043b\u0438 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u0442\u043e clone() \u0441\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f). \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c, \u043d\u043e \u0432\u0441\u0451 \u0436\u0435 \u0438\u0445 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c.<\/p>\n<h4>10. \u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>net.sf.cdk.tools.doclets.CDKIOOptionsTaglet.getClassName:  <\/p>\n<pre><code class=\"java\">String path = file.getPath().replaceAll(File.separator, &quot;.&quot;);<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 replaceAll \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u041f\u043e\u0434 Windows File.separator \u2014 \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0441\u043b\u044d\u0448, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0443\u043f\u0430\u0434\u0451\u0442 \u0441 PatternSyntaxException.<\/p>\n<h4>11. \u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e<\/h4>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 org.openscience.cdk.debug.DebugAtomContainer. \u0422\u0430\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e \u043f\u043e\u043b\u0435  <\/p>\n<pre><code class=\"java\">ILoggingTool logger = LoggingToolFactory.createLoggingTool(DebugAtomContainer.class);<\/code><\/pre>\n<p>  \u0438 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434:  <\/p>\n<pre><code class=\"java\">public void addStereoElement(IStereoElement parity) {     logger.debug(&quot;Adding stereo element: &quot;, parity);     super.addStereoElement(parity); }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 logger \u0435\u0449\u0451 \u043d\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u043b\u0443\u0447\u0438\u0442\u0441\u044f NullPointerException.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0411\u044b\u043b\u0438 \u0438 \u0435\u0449\u0451 \u043e\u0448\u0438\u0431\u043a\u0438, \u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f. \u0425\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e CDK \u2014 \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0418 \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0433\u043b\u0443\u043f\u044b\u0435. \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b, \u0432\u0441\u0435 \u0442\u0430\u043a \u043f\u0438\u0448\u0443\u0442. \u041f\u0440\u043e\u0441\u0442\u043e \u043e\u043d\u0438, \u0432\u0438\u0434\u0438\u043c\u043e, \u0435\u0449\u0451 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430. \u0410 \u0432\u044b \u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c, \u044d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e!    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/198938\/\"> http:\/\/habrahabr.ru\/post\/198938\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041c\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u044b \u043e\u0442 <a href=\"http:\/\/habrahabr.ru\/company\/pvs-studio\/\">PVS-Studio<\/a> \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d\u0438 \u0438\u0449\u0443\u0442 \u0431\u0430\u0433\u0438 \u0432 \u043a\u0430\u043a\u043e\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u042f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u044f \u0442\u043e\u0436\u0435 \u0441\u043c\u043e\u0433\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0441\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e Java. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 Java-\u043a\u043e\u0434\u0430 <a href=\"http:\/\/findbugs.sourceforge.net\/\">FindBugs<\/a>. \u041e \u043d\u0451\u043c \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u043b\u043e \u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435.<\/p>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u043a\u0440\u043e\u043b\u0438\u043a. \u041d\u0443\u0436\u0435\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u043b\u0438\u0437\u044b\u0432\u0430\u043b\u0438 \u043a\u043e\u0434. \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"http:\/\/cdk.sourceforge.net\/\">Chemistry Development Kit <\/a> (\u0432\u0435\u0440\u0441\u0438\u044f 1.4.19), \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0434\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. FindBugs \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u043a\u0430\u043a \u043f\u043b\u0430\u0433\u0438\u043d \u043a Eclipse, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0435\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/376\/26f\/cea\/37626fcea4edb4663f10c3d384cbd78e.png\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-198938","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/198938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=198938"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/198938\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=198938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=198938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=198938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}