Examples of errors detected by the V6067 diagnostic


V6067. Two or more case-branches perform the same actions.


Apache Dubbo

V6067 Two or more case-branches perform the same actions. JVMUtil.java(67), JVMUtil.java(71)


private static String getThreadDumpString(ThreadInfo threadInfo) {
  ....
  if (i == 0 && threadInfo.getLockInfo() != null) {
    Thread.State ts = threadInfo.getThreadState();
    switch (ts) {
      case BLOCKED:
        sb.append("\t-  blocked on " + threadInfo.getLockInfo());
        sb.append('\n');
        break;
      case WAITING:                                                     // <=
        sb.append("\t-  waiting on " + threadInfo.getLockInfo());
        sb.append('\n');
        break;
      case TIMED_WAITING:                                               // <=
        sb.append("\t-  waiting on " + threadInfo.getLockInfo());
        sb.append('\n');
        break;
      default:
    }
  }
  ....
}

Apache Hadoop

V6067 Two or more case-branches perform the same actions. TimelineEntityV2Converter.java(386), TimelineEntityV2Converter.java(389)


 public static ApplicationReport
 convertToApplicationReport(TimelineEntity entity)
{
  ....
  Set<TimelineMetric> metrics = entity.getMetrics();
  if (metrics != null) {
    long vcoreSeconds = 0;
    long memorySeconds = 0;
    long preemptedVcoreSeconds = 0;
    long preemptedMemorySeconds = 0;

    for (TimelineMetric metric : metrics) {
      switch (metric.getId()) {
      case ApplicationMetricsConstants.APP_CPU_METRICS:
        vcoreSeconds = getAverageValue(metric.getValues().values());
        break;
      case ApplicationMetricsConstants.APP_MEM_METRICS:
        memorySeconds = getAverageValue(metric.getValues().values());
        break;
      case ApplicationMetricsConstants.APP_MEM_PREEMPT_METRICS:
        preemptedVcoreSeconds = getAverageValue(metric.getValues().values());
        break;
      case ApplicationMetricsConstants.APP_CPU_PREEMPT_METRICS:
        preemptedVcoreSeconds = getAverageValue(metric.getValues().values());
        break;
      default:
        // Should not happen..
        break;
      }
    }
    ....
  }
  ....
}


Bugs Found

Checked Projects
381
Collected Errors
13 764