gp-4641 - MDMang fix infinite loop

This commit is contained in:
ghizard 2024-05-29 16:13:14 +00:00
parent b5e6782db6
commit 2efe1b9e62

View File

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -97,9 +97,16 @@ public class MDQualification extends MDParsableItem implements Iterable<MDQualif
@Override
protected void parseInternal() throws MDException {
while ((dmang.peek() != MDMang.DONE) && (dmang.peek() != '@')) {
int loc = dmang.getIndex();
MDQualifier qual = new MDQualifier(dmang);
qual.parse();
quals.add(qual);
// This is a quick fix to prevent infinite looping when the next character is not
// expected. TODO: need to work on code the breaks symbols on these other
// characters that we have seen such as '.' and '`'.
if (dmang.getIndex() == loc) {
break;
}
}
if (dmang.peek() == '@') {
dmang.increment(); // Skip past @.