Skip to content

Commit

Permalink
add printing for the bug-fix study
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiming Tang committed Jun 22, 2020
1 parent 381101a commit c5b1020
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
public abstract class AbstractLogInvocation {

protected boolean inCatchBlock;
protected boolean inBranchingStatement;
protected boolean havingNonLoweringKeywords;
protected boolean havingNonRasingKeywords;
protected boolean loggingWrapping;

private float degreeOfInterestValue;

Expand All @@ -53,6 +57,38 @@ public float getDegreeOfInterestValue() {
return this.degreeOfInterestValue;
}

public void setInBranchingStatement(boolean inBranchingStatement) {
this.inBranchingStatement = inBranchingStatement;
}

public boolean getInBranchingStatement() {
return this.inBranchingStatement;
}

public void setHavingNonLoweringKeywords(boolean havingNonLoweringKeywords) {
this.havingNonLoweringKeywords = havingNonLoweringKeywords;
}

public boolean getHavingNonLoweringKeywords() {
return this.havingNonLoweringKeywords;
}

public void setHavingNonRasingKeywords(boolean havingNonRasingKeywords) {
this.havingNonRasingKeywords = havingNonRasingKeywords;
}

public boolean getHavingNonRasingKeywords() {
return this.havingNonRasingKeywords;
}

public void setLoggingWrapping(boolean loggingWrapping) {
this.loggingWrapping = loggingWrapping;
}

public boolean getLoggingWrapping() {
return this.loggingWrapping;
}

public void setInCatchBlock(boolean inCatchBlock) {
this.inCatchBlock = inCatchBlock;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ private void analyzeLogInvs(Set<MethodDeclaration> methodDecsForAnalyzedMethod)
LOGGER.info("Do action: " + logInvocation.getAction() + "! The changed log expression is "
+ logInvocation.getExpression());
}
this.loggingInfo(logInvocation);
}

for (LogInvocationSlf4j logInvocationSlf4j : this.logInvocationSlf4j) {
Expand All @@ -193,12 +194,28 @@ private void analyzeLogInvs(Set<MethodDeclaration> methodDecsForAnalyzedMethod)
LOGGER.info("Do action: " + logInvocationSlf4j.getAction() + "! The changed log expression is "
+ logInvocationSlf4j.getExpression());
}
this.loggingInfo(logInvocationSlf4j);
}

this.inheritanceChecking(this.logInvocationSet, this.monitor);
this.inheritanceCheckingSlf4j(this.logInvocationSlf4j, this.monitor);
}

private void loggingInfo(AbstractLogInvocation logInvocation) {
if (checkIfConditionHavingLevel(logInvocation.getExpression())
|| checkCaseHavingLevel(logInvocation.getExpression()))
logInvocation.setLoggingWrapping(true);

if (Util.isLogMessageWithKeywords(logInvocation.getExpression(), KEYWORDS_IN_LOG_MESSAGES_FOR_LOWERING))
logInvocation.setHavingNonLoweringKeywords(true);

if (Util.isLogMessageWithKeywords(logInvocation.getExpression(), KEYWORDS_IN_LOG_MESSAGES_FOR_RAISING))
logInvocation.setHavingNonRasingKeywords(true);

if (checkIfBlock(logInvocation.getExpression()))
logInvocation.setInBranchingStatement(true);
}

private boolean doAction(LogInvocationSlf4j logInvocationSlf4j) {
if (this.checkEnclosingMethod(logInvocationSlf4j))
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
"enclosing method", "DOI value", "action", "new level", "logging framework" });
inputLogInvPrinter = EvaluationUtil.createCSVPrinter("input_log_invocations.csv",
new String[] { "subject", "log expression", "start pos", "log level", "type FQN",
"enclosing method", "logging framework", "DOI value" });
"enclosing method", "logging framework", "DOI value", "catch block",
"branching statement", "non-lowering keywords", "raising keywords",
"logging wrapping" });

nonenclosingMethodPrinter = EvaluationUtil.createCSVPrinter("nonenclosing_methods.csv",
new String[] { "subject", "type FQN", "method", "DOI" });
Expand Down Expand Up @@ -284,7 +286,11 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
logInvocation.getEnclosingType().getFullyQualifiedName(),
Util.getMethodIdentifier(logInvocation.getEnclosingEclipseMethod()),
LoggingFramework.JAVA_UTIL_LOGGING,
logInvocation.getDegreeOfInterestValue());
logInvocation.getDegreeOfInterestValue(), logInvocation.getInCatchBlock(),
logInvocation.getInBranchingStatement(),
logInvocation.getHavingNonLoweringKeywords(),
logInvocation.getHavingNonRasingKeywords(),
logInvocation.getLoggingWrapping());
}

// print input log invocations for slf4j.
Expand Down

0 comments on commit c5b1020

Please sign in to comment.