Skip to content

Commit

Permalink
Merge pull request #230 from ozangunalp/fix_log_segment_init
Browse files Browse the repository at this point in the history
Fix LogSegment static init after 3.8.0
  • Loading branch information
ozangunalp authored Sep 11, 2024
2 parents 1371adb + 605d344 commit a21975f
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.objectweb.asm.Opcodes.ACONST_NULL;

import java.util.Set;
import java.util.regex.Pattern;

import javax.security.auth.spi.LoginModule;

Expand Down Expand Up @@ -352,6 +353,17 @@ public void visitCode() {
visitMethodInsn(INVOKESTATIC, "org/slf4j/LoggerFactory", "getLogger", "(Ljava/lang/Class;)Lorg/slf4j/Logger;", false);
// Store the result in the LOGGER field
visitFieldInsn(PUTSTATIC, Type.getInternalName(LogSegment.class), "LOGGER", "Lorg/slf4j/Logger;");

// Load the string "-future"
visitLdcInsn("-future");
visitFieldInsn(PUTSTATIC, Type.getInternalName(LogSegment.class), "FUTURE_DIR_SUFFIX", "Ljava/lang/String;");
// Load the string "^(\\S+)-(\\S+)\\.(\\S+)-future"
visitLdcInsn("^(\\S+)-(\\S+)\\.(\\S+)-future");
// Call Pattern.compile with the string
visitMethodInsn(INVOKESTATIC, Type.getInternalName(Pattern.class), "compile", "(Ljava/lang/String;)Ljava/util/regex/Pattern;", false);
// Store the result in FUTURE_DIR_PATTERN
visitFieldInsn(PUTSTATIC, Type.getInternalName(LogSegment.class), "FUTURE_DIR_PATTERN", Type.getDescriptor(Pattern.class));

// Load null onto the stack
visitInsn(ACONST_NULL);
// Store null into LOG_FLUSH_TIMER field
Expand Down

0 comments on commit a21975f

Please sign in to comment.