@@ -931,26 +931,26 @@ private void pdb_COMPND_Handler(String line) {
931931
932932 String [] fieldList = line .trim ().split ("\\ s+" );
933933 int fl = fieldList .length ;
934- if ((fl >0 ) && compndFieldValues .contains (fieldList [0 ])) {
935-
936- continuationField = fieldList [0 ];
937- if (previousContinuationField .equals ("" )) {
938- previousContinuationField = continuationField ;
939- }
940-
941- } else if (fl >0 ) {
942- // the ':' character indicates the end of a field name and should be invalid as part the first data token
943- // e.g. obsolete file 1hhb has a malformed COMPND line that can only be caught with this kind of check
944- if (fieldList [0 ].contains (":" ) ) {
934+ if (fl > 0 ) {
935+ String field0 = fieldList [0 ];
936+ if (compndFieldValues .contains (field0 )) {
937+ continuationField = field0 ;
938+ if (previousContinuationField .equals ("" )) {
939+ previousContinuationField = continuationField ;
940+ }
941+ } else if (field0 .endsWith (";" ) && compndFieldValues .contains (field0 .substring (0 , field0 .length ()-1 )) ) {
942+ // the ':' character indicates the end of a field name and should be invalid as part the first data token
943+ // e.g. obsolete file 1hhb has a malformed COMPND line that can only be caught with this kind of check
944+ // UPDATE: There is no harm of having a ':' in the first data token. e.g. 3fdj contains a ':'.
945+ // The intended case occurs only if the token is a key followed by a colon and a semicolon without spaces, e.g. "COMPND 2 MOLECULE:;"
945946 logger .info ("COMPND line does not follow the PDB 3.0 format. Note that COMPND parsing is not supported any longer in format 2.3 or earlier" );
946947 return ;
947948 }
948-
949949 } else {
950-
951950 // the line will be added as data to the previous field
952951 }
953952
953+
954954 line = line .replace (continuationField , "" ).trim ();
955955
956956 StringTokenizer compndTokens = new StringTokenizer (line );
0 commit comments