Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
maybeec authored and hashar committed Apr 9, 2024
1 parent 561972c commit 73c878f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public ConsoleAnnotator annotate(Object context, MarkupText text) {
return null;
}

SectionDefinition currentSection = currentSections.peek();
while (!currentSections.empty()) {
SectionDefinition currentSection = currentSections.peek();
if (currentSection.getSectionEndPattern().matcher(text.getText().trim()).matches()) {
popSection(text);
if (currentSection.isCollapseOnlyOneLevel()) {
Expand All @@ -74,11 +74,12 @@ public ConsoleAnnotator annotate(Object context, MarkupText text) {
} else {
break;
}
currentSection = currentSections.peek();
}

for (SectionDefinition section : sections) {
if(currentSection.getSectionDisplayName().equals(section.getSectionDisplayName()) && !section.isAllowNesting()) {
if(!currentSections.empty()
&& currentSections.peek().getSectionDisplayName().equals(section.getSectionDisplayName())
&& !section.isAllowNesting()) {
continue;

Check warning on line 83 in src/main/java/org/jvnet/hudson/plugins/collapsingconsolesections/CollapsingSectionAnnotator.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 80-83 are not covered by tests
}
Matcher m = section.getSectionStartPattern().matcher(text.getText().trim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,28 @@ public class SectionDefinition implements Serializable {
private boolean allowNesting;

/**
* @deprecated Use {@link #SectionDefinition(java.lang.String, java.lang.String, java.lang.String, boolean, boolean)} instead.
* @deprecated Use {@link #SectionDefinition(java.lang.String, java.lang.String, java.lang.String, boolean, boolean, boolean)} instead.
*/
@Deprecated
public SectionDefinition(String sectionName, String sectionStartPattern, String sectionEndPattern) {
this(sectionName, sectionStartPattern, sectionEndPattern, false, false, false);
}

/**
* @deprecated Use {@link #SectionDefinition(java.lang.String, java.lang.String, java.lang.String, boolean, boolean)} instead.
* @deprecated Use {@link #SectionDefinition(java.lang.String, java.lang.String, java.lang.String, boolean, boolean, boolean)} instead.
*/
@Deprecated
public SectionDefinition(String sectionName, String sectionStartPattern, String sectionEndPattern, boolean collapseOnlyOneLevel) {
this(sectionName, sectionStartPattern, sectionEndPattern, collapseOnlyOneLevel, false, false);
}

/**
* @deprecated Use {@link #SectionDefinition(java.lang.String, java.lang.String, java.lang.String, boolean, boolean, boolean)} instead.
*/
@Deprecated
public SectionDefinition(String sectionName, String sectionStartPattern, String sectionEndPattern, boolean collapseOnlyOneLevel, boolean collapseSection) {
this(sectionName, sectionStartPattern, sectionEndPattern, collapseOnlyOneLevel, collapseSection, false);

Check warning on line 66 in src/main/java/org/jvnet/hudson/plugins/collapsingconsolesections/SectionDefinition.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 58-66 are not covered by tests
}

/**
* Creates a new section definition.
Expand Down

0 comments on commit 73c878f

Please sign in to comment.