Пример #1
1
  private Throwable createTestException() {
    Exception exception =
        new Exception() {
          @Override
          public String toString() {
            return "custom msg";
          }
        };
    exception.setStackTrace(
        new StackTraceElement[] {
          new StackTraceElement("c1", "m1", "f1", 1), new StackTraceElement("c2", "m2", "f2", 2)
        });

    Exception cause =
        new Exception() {
          @Override
          public String toString() {
            return "custom msg cause";
          }
        };
    cause.setStackTrace(
        new StackTraceElement[] {
          new StackTraceElement("c3", "m3", "f3", 3), new StackTraceElement("c4", "m4", "f4", 4)
        });
    exception.initCause(cause);

    Exception supressed1 =
        new Exception() {
          @Override
          public String toString() {
            return "custom msg supressed 1";
          }
        };
    supressed1.setStackTrace(new StackTraceElement[] {new StackTraceElement("c5", "m5", "f5", 5)});

    Exception s1Cause =
        new Exception() {
          @Override
          public String toString() {
            return "custom msg supressed 1 cause";
          }
        };
    s1Cause.setStackTrace(new StackTraceElement[] {new StackTraceElement("c6", "m6", "f6", 6)});
    supressed1.initCause(s1Cause);

    exception.addSuppressed(supressed1);

    Exception s2 =
        new Exception() {
          @Override
          public String toString() {
            return "custom msg supressed 2";
          }
        };
    s2.setStackTrace(new StackTraceElement[] {new StackTraceElement("c7", "m7", "f7", 7)});
    exception.addSuppressed(s2);

    return exception;
  }
  @Test
  public void testMultistatusDuplicateChildFiltering() {

    Exception e1 = new Exception("Stack Trace");
    e1.setStackTrace(
        createStacktraceForClasses(
            "java.lang.Object",
            "org.eclipse.core.internal.jobs.WorkerPool",
            "org.eclipse.core.internal.jobs.WorkerPool",
            "org.eclipse.core.internal.jobs.Worker"));
    IStatus s1 =
        new Status(
            IStatus.ERROR,
            "org.eclipse.ui.monitoring",
            "Thread 'Worker-3' tid=39 (TIMED_WAITING)\n"
                + "Waiting for: org.eclipse.core.internal.jobs.WorkerPool@416dc7fc",
            e1);

    Exception e2 = new Exception("Stack Trace");
    e2.setStackTrace(
        TestReports.createStacktraceForClasses(
            "java.lang.Object",
            "org.eclipse.core.internal.jobs.WorkerPool",
            "org.eclipse.core.internal.jobs.WorkerPool",
            "org.eclipse.core.internal.jobs.Worker"));
    IStatus s2 =
        new Status(
            IStatus.ERROR,
            "org.eclipse.ui.monitoring",
            "Thread 'Worker-2' tid=36 (TIMED_WAITING)\n"
                + "Waiting for: org.eclipse.core.internal.jobs.WorkerPool@416dc7fc",
            e2);

    IStatus multi =
        new MultiStatus(
            "org.eclipse.ui.monitoring",
            0,
            new IStatus[] {s1, s2},
            "UI freeze of 10s at 08:09:02.936",
            new RuntimeException("stand-in-stacktrace"));
    org.eclipse.epp.internal.logging.aeri.ui.model.Status newStatus =
        Reports.newStatus(multi, configuration);
    assertThat(newStatus.getChildren().size(), is(1));
    assertThat(
        newStatus.getMessage(),
        is(
            "UI freeze of 10s at 08:09:02.936 [1 child-status duplicates removed by Error Reporting]"));
  }
Пример #3
0
 private void setStackTrace(Fault fault, Message msg) {
   Throwable cause = null;
   Map<String, String> ns = new HashMap<String, String>();
   XPathUtils xu = new XPathUtils(ns);
   ns.put("s", Fault.STACKTRACE_NAMESPACE);
   String ss =
       (String)
           xu.getValue(
               "//s:" + Fault.STACKTRACE + "/text()", fault.getDetail(), XPathConstants.STRING);
   List<StackTraceElement> stackTraceList = new ArrayList<StackTraceElement>();
   if (!StringUtils.isEmpty(ss)) {
     Iterator<String> linesIterator = Arrays.asList(CAUSE_SUFFIX_SPLITTER.split(ss)).iterator();
     while (linesIterator.hasNext()) {
       String oneLine = linesIterator.next();
       if (oneLine.startsWith("Caused by:")) {
         cause = getCause(linesIterator, oneLine);
         break;
       }
       stackTraceList.add(parseStackTrackLine(oneLine));
     }
     if (stackTraceList.size() > 0 || cause != null) {
       Exception e = msg.getContent(Exception.class);
       if (!stackTraceList.isEmpty()) {
         StackTraceElement[] stackTraceElement = new StackTraceElement[stackTraceList.size()];
         e.setStackTrace(stackTraceList.toArray(stackTraceElement));
       }
       if (cause != null) {
         e.initCause(cause);
       }
     }
   }
 }
Пример #4
0
  @Override
  public void run() {
    List<CompactionInfo> runningCompactions = Compactor.getRunningCompactions();

    Set<List<Long>> newKeys = new HashSet<>();

    long time = System.currentTimeMillis();

    for (CompactionInfo ci : runningCompactions) {
      List<Long> compactionKey =
          Arrays.asList(ci.getID(), ci.getEntriesRead(), ci.getEntriesWritten());
      newKeys.add(compactionKey);

      if (!observedCompactions.containsKey(compactionKey)) {
        observedCompactions.put(compactionKey, new ObservedCompactionInfo(ci, time));
      }
    }

    // look for compactions that finished or made progress and logged a warning
    HashMap<List<Long>, ObservedCompactionInfo> copy = new HashMap<>(observedCompactions);
    copy.keySet().removeAll(newKeys);

    for (ObservedCompactionInfo oci : copy.values()) {
      if (oci.loggedWarning) {
        LoggerFactory.getLogger(CompactionWatcher.class)
            .info("Compaction of " + oci.compactionInfo.getExtent() + " is no longer stuck");
      }
    }

    // remove any compaction that completed or made progress
    observedCompactions.keySet().retainAll(newKeys);

    long warnTime = config.getTimeInMillis(Property.TSERV_COMPACTION_WARN_TIME);

    // check for stuck compactions
    for (ObservedCompactionInfo oci : observedCompactions.values()) {
      if (time - oci.firstSeen > warnTime && !oci.loggedWarning) {
        Thread compactionThread = oci.compactionInfo.getThread();
        if (compactionThread != null) {
          StackTraceElement[] trace = compactionThread.getStackTrace();
          Exception e =
              new Exception(
                  "Possible stack trace of compaction stuck on " + oci.compactionInfo.getExtent());
          e.setStackTrace(trace);
          LoggerFactory.getLogger(CompactionWatcher.class)
              .warn(
                  "Compaction of "
                      + oci.compactionInfo.getExtent()
                      + " to "
                      + oci.compactionInfo.getOutputFile()
                      + " has not made progress for at least "
                      + (time - oci.firstSeen)
                      + "ms",
                  e);
          oci.loggedWarning = true;
        }
      }
    }
  }
Пример #5
0
 private void throwTimeoutException(StatementThread paramStatementThread) throws Exception {
   Exception localException =
       new Exception(
           String.format(
               "test timed out after %d milliseconds",
               new Object[] {Long.valueOf(this.fTimeout)}));
   localException.setStackTrace(paramStatementThread.getRecordedStackTrace());
   throw localException;
 }
Пример #6
0
  @Before
  public void setUp() {
    subCause = new IOException("subCauseMessage");
    cause = new Exception("causeMessage", subCause);
    stackTraceElements =
        new StackTraceElement[] {new StackTraceElement("class", "method", "file", 1)};
    cause.setStackTrace(stackTraceElements);

    caughtException = new CaughtException(cause);
  }
Пример #7
0
 protected void doException(final Exception e) throws Exception {
     if (parent.launchLocation != null) {
         final ArrayList<StackTraceElement> stack = new ArrayList<StackTraceElement>(Arrays.asList(e.getStackTrace()));
         stack.addAll(Arrays.asList(parent.launchLocation));
         e.setStackTrace(stack.toArray(new StackTraceElement[stack.size()]));
     }
     postToUiThreadAndWait(new Callable<Object>() {
         public Object call() throws Exception {
             if (e instanceof InterruptedException || e instanceof InterruptedIOException)
                 parent.onInterrupted(e);
             else
                 parent.onException(e);
             return null;
         }
     });
 }
Пример #8
0
  /**
   * Create a informative error message instead of plain 500.
   *
   * @param errorMessage
   * @param ex
   * @param status
   * @return
   */
  protected final WebApplicationException getError(
      final String errorMessage, final Exception ex, final Status status) {
    // This is necessary to avoid threading issues.
    final Exception cause = new Exception(ex.getMessage());
    cause.setStackTrace(ex.getStackTrace());
    final Exception wrapped = new IllegalStateException(errorMessage, cause);

    if (status == Response.Status.INTERNAL_SERVER_ERROR) {
      // Otherwise, 500.
      return new InternalServerErrorException(
          Response.status(status).type(MediaType.APPLICATION_JSON).entity(wrapped).build());
    } else {
      // All other types
      return new WebApplicationException(
          Response.status(status).type(MediaType.APPLICATION_JSON).entity(wrapped).build());
    }
  }
Пример #9
0
  /** {@inheritDoc} */
  @Override
  public Object execute(String method, @SuppressWarnings("rawtypes") Vector params)
      throws Exception {

    LOG.debug("calling: {}({})", method, toArgList(params));

    MethodInvoker invoker = new ArgumentConvertingMethodInvoker();
    invoker.setTargetObject(this.proxy);
    invoker.setTargetMethod(getMethodName(method));
    invoker.setArguments(params.toArray());
    invoker.prepare();

    try {
      Object returnValue = invoker.invoke();

      if (returnValue == null && invoker.getPreparedMethod().getReturnType() == Void.TYPE) {
        returnValue = "void";
      } else if (returnValue instanceof Map<?, ?> && !(returnValue instanceof Hashtable<?, ?>)) {
        returnValue = new Hashtable<Object, Object>((Map<?, ?>) returnValue);
      } else if (returnValue instanceof Collection<?> && !(returnValue instanceof Vector<?>)) {
        returnValue = new Vector<Object>((Collection<?>) returnValue);
      }

      LOG.debug("returning from: {}({}) result = {}", method, toArgList(params), returnValue);
      return returnValue;

    } catch (InvocationTargetException e) {
      Throwable targetException = e.getTargetException();
      if (targetException instanceof IllegalArgumentException) {
        throw new MsgPreservingXmlRpcException(
            XmlRpcConstants.FAULT_INVALID_DATA, targetException.getMessage());
      } else if (targetException instanceof MalformedURLException) {
        throw new MsgPreservingXmlRpcException(
            XmlRpcConstants.FAULT_INVALID_URL, targetException.getMessage());
      } else if (targetException instanceof Exception && targetException.toString() != null) {
        throw (Exception) targetException;
      }

      String msg = targetException.toString();
      if (msg == null) msg = targetException.getClass().getName();

      Exception ex = new Exception(msg, targetException);
      ex.setStackTrace(targetException.getStackTrace());
      throw ex;
    }
  }
  private void handleInitializationError(
      final boolean developmentMode,
      final List<TestClassResult> result,
      final String klassName,
      final Class<?> klass,
      final InitializationError e) {
    TestClass testClass = new TestClass(klass);

    boolean allMethods =
        (!developmentMode) || (klass.getAnnotation(TestDuringDevelopment.class) != null);

    List<Throwable> causes = e.getCauses();
    long now = System.currentTimeMillis();
    List<TestCaseResult> testCaseResults = new ArrayList<TestCaseResult>();
    List<FrameworkMethod> annotatedMethods = testClass.getAnnotatedMethods(Test.class);

    Exception wrapperException = new Exception("Error during initialization. See log for details");
    wrapperException.setStackTrace(new StackTraceElement[0]);

    for (FrameworkMethod frameworkMethod : annotatedMethods) {
      if (allMethods || (frameworkMethod.getAnnotation(TestDuringDevelopment.class) != null)) {
        TestCaseResult testCaseResult =
            new TestCaseResult(frameworkMethod.getName(), now, now, wrapperException);

        testCaseResults.add(testCaseResult);
      }
    }

    TestClassResult classResult =
        new TestClassResult(klassName, 0, testCaseResults.size(), 0, 0, now, now, testCaseResults);

    result.add(classResult);

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    pw.write("Error during initialization of test class '" + klassName + "':\n");
    for (Throwable throwable : causes) {
      throwable.printStackTrace(pw);
    }
    LOGGER.log(Level.SEVERE, sw.toString());
  }
Пример #11
0
 private static void finalizerTimedOut(Object object) {
   // The current object has exceeded the finalization deadline; abort!
   String message =
       object.getClass().getName()
           + ".finalize() timed out after "
           + (MAX_FINALIZE_NANOS / NANOS_PER_SECOND)
           + " seconds";
   Exception syntheticException = new TimeoutException(message);
   // We use the stack from where finalize() was running to show where it was stuck.
   syntheticException.setStackTrace(FinalizerDaemon.INSTANCE.getStackTrace());
   Thread.UncaughtExceptionHandler h = Thread.getDefaultUncaughtExceptionHandler();
   if (h == null) {
     // If we have no handler, log and exit.
     System.logE(message, syntheticException);
     System.exit(2);
   }
   // Otherwise call the handler to do crash reporting.
   // We don't just throw because we're not the thread that
   // timed out; we're the thread that detected it.
   h.uncaughtException(Thread.currentThread(), syntheticException);
 }
 private List<TestCaseResult> createErrorTestCaseResults(
     final Class<?> klass, final boolean developmentMode, final long now) {
   TestClass testClass = new TestClass(klass);
   boolean allMethods =
       (!developmentMode) || (klass.getAnnotation(TestDuringDevelopment.class) != null);
   List<FrameworkMethod> annotatedMethods = testClass.getAnnotatedMethods(Test.class);
   List<TestCaseResult> result = new ArrayList<TestCaseResult>();
   for (FrameworkMethod frameworkMethod : annotatedMethods) {
     if (allMethods || (frameworkMethod.getAnnotation(TestDuringDevelopment.class) != null)) {
       Exception exception =
           new Exception(
               "Service object behind the reference was null. We experienced this when the activate"
                   + " method of a DS component threw an exception but there can be other causes. Please"
                   + " check the log! Please note, that in Equinox sometimes such exceptions are"
                   + " written only into different files in the configuration folder.");
       exception.setStackTrace(new StackTraceElement[0]);
       result.add(new TestCaseResult(frameworkMethod.getName(), now, now, exception));
     }
   }
   return result;
 }
  @Test
  public void testMultistatusChildFilteringHandlesEmptyStacktrace() {

    Exception e1 = new Exception("Stack Trace 1");
    e1.setStackTrace(new java.lang.StackTraceElement[0]);
    IStatus s1 =
        new Status(
            IStatus.ERROR,
            "org.eclipse.ui.monitoring",
            "Thread 'Signal Dispatcher' tid=4 (RUNNABLE)",
            e1);

    IStatus multi =
        new MultiStatus(
            "org.eclipse.ui.monitoring",
            0,
            new IStatus[] {s1},
            "UI freeze of 10s at 08:09:02.936",
            new RuntimeException("stand-in-stacktrace"));
    org.eclipse.epp.internal.logging.aeri.ui.model.Status newStatus =
        Reports.newStatus(multi, configuration);
    assertThat(newStatus.getChildren().size(), is(0));
  }
Пример #14
0
  @Override
  public boolean nextKeyValue() throws IOException, InterruptedException {

    // we only pull for a specified time. unfinished work will be
    // rescheduled in the next
    // run.
    if (System.currentTimeMillis() > maxPullTime) {
      if (reader != null) {
        closeReader();
      }
      return false;
    }

    while (true) {
      try {
        if (reader == null || reader.hasNext() == false) {
          EtlRequest request = split.popRequest();
          if (request == null) {
            return false;
          }

          if (maxPullHours > 0) {
            endTimeStamp = 0;
          }

          key.set(
              request.getTopic(),
              request.getNodeId(),
              request.getPartition(),
              request.getOffset(),
              request.getOffset(),
              0);
          value = new AvroWrapper<Object>(new Object());

          System.out.println(
              "topic:"
                  + request.getTopic()
                  + " partition:"
                  + request.getPartition()
                  + " beginOffset:"
                  + request.getOffset()
                  + " estimatedLastOffset:"
                  + request.getLastOffset());

          statusMsg += statusMsg.length() > 0 ? "; " : "";
          statusMsg +=
              request.getTopic() + ":" + request.getNodeId() + ":" + request.getPartition();
          context.setStatus(statusMsg);

          if (reader != null) {
            closeReader();
          }
          reader =
              new KafkaReader(
                  request,
                  EtlInputFormat.getKafkaClientTimeout(mapperContext),
                  EtlInputFormat.getKafkaClientBufferSize(mapperContext));

          decoder =
              (MessageDecoder<Message, Record>)
                  MessageDecoderFactory.createMessageDecoder(context, request.getTopic());
        }

        while (reader.getNext(key, msgValue)) {
          context.progress();
          mapperContext.getCounter("total", "data-read").increment(msgValue.getLength());
          mapperContext.getCounter("total", "event-count").increment(1);
          byte[] bytes = getBytes(msgValue);

          // check the checksum of message
          Message message = new Message(bytes);
          long checksum = key.getChecksum();
          if (checksum != message.checksum()) {
            throw new ChecksumException(
                "Invalid message checksum "
                    + message.checksum()
                    + ". Expected "
                    + key.getChecksum(),
                key.getOffset());
          }

          long tempTime = System.currentTimeMillis();
          CamusWrapper wrapper;
          try {
            wrapper = getWrappedRecord(key.getTopic(), message);
          } catch (Exception e) {
            mapperContext.write(key, new ExceptionWritable(e));
            continue;
          }

          if (wrapper == null) {
            mapperContext.write(key, new ExceptionWritable(new RuntimeException("null record")));
            continue;
          }

          long timeStamp = wrapper.getTimestamp();
          try {
            key.setTime(timeStamp);
            key.setServer(wrapper.getServer());
            key.setService(wrapper.getService());
          } catch (Exception e) {
            mapperContext.write(key, new ExceptionWritable(e));
            continue;
          }

          if (timeStamp < beginTimeStamp) {
            mapperContext.getCounter("total", "skip-old").increment(1);
          } else if (endTimeStamp == 0) {
            DateTime time = new DateTime(timeStamp);
            statusMsg += " begin read at " + time.toString();
            context.setStatus(statusMsg);
            System.out.println(key.getTopic() + " begin read at " + time.toString());
            endTimeStamp = (time.plusHours(this.maxPullHours)).getMillis();
          } else if (timeStamp > endTimeStamp || System.currentTimeMillis() > maxPullTime) {
            statusMsg += " max read at " + new DateTime(timeStamp).toString();
            context.setStatus(statusMsg);
            System.out.println(
                key.getTopic() + " max read at " + new DateTime(timeStamp).toString());
            mapperContext.getCounter("total", "request-time(ms)").increment(reader.getFetchTime());
            closeReader();
          }

          long secondTime = System.currentTimeMillis();
          value.datum(wrapper.getRecord());
          long decodeTime = ((secondTime - tempTime));

          mapperContext.getCounter("total", "decode-time(ms)").increment(decodeTime);

          if (reader != null) {
            mapperContext.getCounter("total", "request-time(ms)").increment(reader.getFetchTime());
          }
          return true;
        }
        reader = null;
      } catch (Throwable t) {
        Exception e = new Exception(t.getLocalizedMessage(), t);
        e.setStackTrace(t.getStackTrace());
        mapperContext.write(key, new ExceptionWritable(e));
        reader = null;
        continue;
      }
    }
  }
 private static Exception createExceptionWithoutTrace() {
   final Exception exception = new Exception();
   exception.setStackTrace(new StackTraceElement[0]);
   return exception;
 }
 public TransformerValidationException(Exception e) {
   super(e);
   super.setStackTrace(e.getStackTrace());
 }
Пример #17
0
  public boolean parserCpYieldTxt(File txtFile) throws Exception {
    FileInputStream fIn = null;
    String fileNameUid = "";
    try {
      Calendar calendar = Calendar.getInstance();
      SimpleDateFormat df2 = new SimpleDateFormat("yyyyMM");

      // Using Find Target "|=124" or ",=44" Count
      DateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);

      logger.debug(
          "File "
              + txtFile.getAbsolutePath()
              + "  "
              + txtFile.getName()
              + "  "
              + new MimetypesFileTypeMap().getContentType(txtFile));

      // 1.0 讀入檔案, 建立資料流
      fIn = new FileInputStream(txtFile);
      // FileInputStream fIn2 = new FileInputStream(csvFile);
      InputStreamReader isr = null;
      BufferedReader br = null;
      isr = new InputStreamReader(fIn, "UTF-8");
      br = new BufferedReader(isr);

      // byte[] byteArray = new byte[new Long(csvFile.length()).intValue()];
      // 讀入File Data Byte.....
      // fIn2.read(byteArray);
      logger.debug(txtFile.getName() + "<--讀入資料檔...成功");
      // Using get sign  "\n" 抓行數...

      // 1.1 讀入行數資料, 略過行數
      int l = -1;
      List<String> lineDataList = new ArrayList<String>();
      for (int i = 0; i <= l; i++) {
        br.readLine();
      }
      while (br.ready()) {
        String line = br.readLine();
        line = null != line ? line : "";
        // logger.debug(line);
        if (!line.trim().equals("")) {
          lineDataList.add(line);
        }
      }

      // 1.2 確認有資料開使處理
      if (lineDataList != null) {
        CpYieldParserDao cpYieldParserDao = new CpYieldParserDao();

        CpYieldLotTo cpYieldLotTo = new CpYieldLotTo();

        String cpYieldUuid = UUID.randomUUID().toString().toUpperCase();
        logger.debug("lineDataList.size() " + lineDataList.size());

        fileNameUid =
            FilenameUtils.getBaseName(txtFile.getName())
                + "_"
                + cpYieldUuid
                + "."
                + FilenameUtils.getExtension(txtFile.getName());

        File bkFolder =
            new File(fileOutUrl + File.separator + df2.format(calendar.getTime()).toString());

        bkFolder.mkdir();

        File bkFile = new File(bkFolder.getPath().toString() + File.separator + fileNameUid);
        // 1.2.1 處理每行資料
        String tmpWaferID = lineDataList.get(1);
        String arrayWafer[] = tmpWaferID.split("=")[1].trim().split("-");

        // logger.debug("arrayWafer[] " + arrayWafer.length);

        // 1.3 Prepare Data
        String cpLot = arrayWafer[0].trim();
        String waferId = arrayWafer[1].trim();
        String machineId = arrayWafer[2].trim();
        Integer cpTestTimes = cpYieldParserDao.getMaxCpTestTimes(cpLot, waferId);

        String xMaxCoor = lineDataList.get(2).split("=")[1].trim();
        String yMaxCoor = lineDataList.get(3).split("=")[1].trim();
        String flat = lineDataList.get(4).split("=")[1].trim();

        logger.debug("xMaxCoor " + xMaxCoor);
        logger.debug("yMaxCoor " + yMaxCoor);
        logger.debug("flat " + flat);

        // 1.3 Find Bin Data
        int sb = 0, eb = 0;
        for (int i = 0; i < lineDataList.size(); i++) {
          if (lineDataList.get(i).indexOf("Wafer Bin Summary") >= 0) {
            sb = i + 1;
            break;
          }
        }
        for (int i = sb; i < lineDataList.size(); i++) {
          if (lineDataList.get(i).indexOf("bin") < 0) {
            eb = i - 1;
            break;
          }
        }

        logger.debug("sb " + sb);
        logger.debug(lineDataList.get(sb).trim());
        logger.debug("eb " + eb);
        logger.debug(lineDataList.get(eb).trim());
        // 1.3.1 Get Bin Data
        List<CpYieldLotBinTo> cpYieldLotBins = new ArrayList<CpYieldLotBinTo>();
        String cpYieldBinUuid;

        String bin;
        Integer die;
        String percentage;
        String binString;

        for (int j = sb; j <= eb; j++) {
          cpYieldBinUuid = UUID.randomUUID().toString().toUpperCase();
          CpYieldLotBinTo cpYieldLotBinTo = new CpYieldLotBinTo();

          cpYieldLotBinTo.setCpYieldBinUuid(cpYieldBinUuid);
          cpYieldLotBinTo.setCpYieldUuid(cpYieldUuid);

          binString = lineDataList.get(j).trim();
          binString = binString.replaceAll("bin", "").trim();
          // Get Bin
          bin = binString.substring(0, binString.indexOf(" "));
          logger.debug("bin " + bin);
          // Get Die
          bin = binString.substring(0, binString.indexOf(" "));
          binString = binString.replaceAll(bin, "").trim();
          die = Integer.parseInt(binString.substring(0, binString.indexOf(" ")));
          logger.debug("die " + die);
          // Get Percentage
          binString = binString.replaceAll(die.toString(), "").trim();
          percentage = binString.substring(0, binString.length() - 1);
          logger.debug("percentage " + percentage);

          cpYieldLotBinTo.setBin(bin);
          cpYieldLotBinTo.setDie(die);
          cpYieldLotBinTo.setPercentage(percentage);

          cpYieldLotBins.add(cpYieldLotBinTo);
        }

        // 1.4 Die Data
        Integer passDie;
        Integer failDie;
        Integer totelDie;
        for (int i = eb + 1; i < lineDataList.size(); i++) {
          // pass die
          if (lineDataList.get(i).trim().indexOf("pass die") >= 0) {
            passDie = Integer.parseInt(lineDataList.get(i).trim().split(":")[1].trim());
            logger.debug("passDie " + passDie);
            cpYieldLotTo.setPassDie(passDie);
            continue;
          }
          // fail die
          if (lineDataList.get(i).trim().indexOf("fail die") >= 0) {
            failDie = Integer.parseInt(lineDataList.get(i).trim().split(":")[1].trim());
            logger.debug("failDie " + failDie);
            cpYieldLotTo.setFailDie(failDie);
            continue;
          }
          // totel die
          if (lineDataList.get(i).trim().indexOf("totel die") >= 0) {
            totelDie = Integer.parseInt(lineDataList.get(i).trim().split(":")[1].trim());
            logger.debug("totelDie " + totelDie);
            cpYieldLotTo.setTotelDie(totelDie);
            continue;
          }
        }

        // 1.5 Set data in To
        cpYieldLotTo.setCpYieldUuid(cpYieldUuid);
        cpYieldLotTo.setCpTestTimes(cpTestTimes);
        cpYieldLotTo.setCpLot(cpLot);
        cpYieldLotTo.setWaferId(waferId);
        cpYieldLotTo.setMachineId(machineId);
        cpYieldLotTo.setxMaxCoor(xMaxCoor);
        cpYieldLotTo.setyMaxCoor(yMaxCoor);
        cpYieldLotTo.setFlat(flat);

        String fileMimeType = new MimetypesFileTypeMap().getContentType(txtFile);
        cpYieldLotTo.setFileName(
            df2.format(calendar.getTime()).toString() + File.separator + fileNameUid);
        cpYieldLotTo.setFileMimeType(fileMimeType);
        cpYieldLotTo.setFtpFlag("N");

        fIn.close();
        br.close();

        Methods.copyFile(txtFile, bkFile);
        txtFile.delete();
        // 1.6 DataBasse
        // 1.6.1 Insert CP Lot Table
        cpYieldParserDao.insertCpYieldLot(cpYieldLotTo);
        cpYieldParserDao.insertCpYieldLotBin(cpYieldLotBins);
      }

      fIn.close();
      br.close();

      logger.info(txtFile.getName() + " is Parser complete");
      logger.info(fileNameUid + " is Parser complete");

      // logger.debug(tapeList.size());
      logger.info("---------------------------------");
    } catch (Exception e) {
      if (fIn != null) {
        fIn.close();
      }
      logger.info("ERROR MOVE FILE");
      Methods.copyFile(txtFile, new File(fileErrorUrl + "\\" + txtFile.getName()));
      txtFile.delete();

      StackTraceElement[] messages = e.getStackTrace();
      Exception ex = new Exception(txtFile.getName());
      ex.setStackTrace(messages);
      ex.printStackTrace();
      throw ex;
    } finally {
      try {
        if (fIn != null) {
          fIn.close();
        }
      } catch (IOException ie) {
        StackTraceElement[] messages = ie.getStackTrace();
        int length = messages.length;
        String error = "";
        for (int i = 0; i < length; i++) {
          error = error + "toString:" + messages[i].toString() + "\r\n";
        }
        ie.printStackTrace();
        logger.error(error);
        return false;
      }
    }
    return true;
  }
 public TransformerValidationException(String message, Exception e) {
   super(message, e);
   super.setStackTrace(e.getStackTrace());
 }
	@Override
	public boolean handleCommand(final CommandSender sender, final Command command, final String commandLabel, final String[] args)
	{
		boolean disabled = false;
		boolean overridden = false;
		ISettings settings = ess.getSettings();
		settings.acquireReadLock();
		try
		{
			disabled = settings.getData().getCommands().isDisabled(command.getName());
			overridden = !disabled || settings.getData().getCommands().isOverridden(command.getName());
		}
		finally
		{
			settings.unlock();
		}
		// Allow plugins to override the command via onCommand
		if (!overridden && (!commandLabel.startsWith("e") || commandLabel.equalsIgnoreCase(command.getName())))
		{
			final PluginCommand pc = getAlternative(commandLabel);
			if (pc != null)
			{
				
				executed(commandLabel, pc.getLabel());
				try
				{
					return pc.execute(sender, commandLabel, args);
				}
				catch (final Exception ex)
				{
					final ArrayList<StackTraceElement> elements = new ArrayList<StackTraceElement>(Arrays.asList(ex.getStackTrace()));
					elements.remove(0);
					final ArrayList<StackTraceElement> toRemove = new ArrayList<StackTraceElement>();
					for (final StackTraceElement e : elements)
					{
						if (e.getClassName().equals("net.ess3.Essentials"))
						{
							toRemove.add(e);
						}
					}
					elements.removeAll(toRemove);
					final StackTraceElement[] trace = elements.toArray(new StackTraceElement[elements.size()]);
					ex.setStackTrace(trace);
					ex.printStackTrace();
					sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
					return true;
				}
			}
		}

		try
		{
			IUser user = null;
			if (sender instanceof Player)
			{
				user = ess.getUserMap().getUser((Player)sender);
				LOGGER.log(Level.INFO, String.format("[PLAYER_COMMAND] %s: /%s %s ", ((Player)sender).getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)));
			}

			// Check for disabled commands
			if (disabled)
			{
				return true;
			}

			final String commandName = command.getName().toLowerCase(Locale.ENGLISH);
			IEssentialsCommand cmd = commands.get(commandName);
			if (cmd == null)
			{
				try
				{
					cmd = (IEssentialsCommand)classLoader.loadClass(commandPath + commandName).newInstance();
					cmd.init(ess, commandName);
					cmd.setEssentialsModule(module);
					commands.put(commandName, cmd);
				}
				catch (Exception ex)
				{
					sender.sendMessage(_("commandNotLoaded", commandName));
					LOGGER.log(Level.SEVERE, _("commandNotLoaded", commandName), ex);
					return true;
				}
			}

			// Check authorization
			if (sender != null && !cmd.isAuthorized(sender))
			{
				LOGGER.log(Level.WARNING, _("deniedAccessCommand", user.getName()));
				user.sendMessage(_("noAccessCommand"));
				return true;
			}

			// Run the command
			try
			{
				if (user == null)
				{
					cmd.run(sender, command, commandLabel, args);
				}
				else
				{
					user.acquireReadLock();
					try
					{
						cmd.run(user, command, commandLabel, args);
					}
					finally
					{
						user.unlock();
					}
				}
				return true;
			}
			catch (NoChargeException ex)
			{
				return true;
			}
			catch (NotEnoughArgumentsException ex)
			{
				sender.sendMessage(command.getDescription());
				sender.sendMessage(command.getUsage().replaceAll("<command>", commandLabel));
				if (!ex.getMessage().isEmpty())
				{
					sender.sendMessage(ex.getMessage());
				}
				return true;
			}
			catch (Throwable ex)
			{
				showCommandError(sender, commandLabel, ex);
				return true;
			}
		}
		catch (Throwable ex)
		{
			LOGGER.log(Level.SEVERE, _("commandFailed", commandLabel), ex);
			return true;
		}
	}
  @Test
  public void testMultistatusMainStacktracesNotFiltered() {

    Exception e1 = new Exception("Stack Trace");
    java.lang.StackTraceElement[] stackTrace =
        createStacktraceForClasses(
            "java.lang.Thread",
            "org.eclipse.epp.logging.aeri.ui.actions.UiFreezeAction",
            "org.eclipse.ui.internal.PluginAction",
            "org.eclipse.ui.internal.WWinPluginAction",
            "org.eclipse.jface.action.ActionContributionItem",
            "org.eclipse.jface.action.ActionContributionItem",
            "org.eclipse.jface.action.ActionContributionItem",
            "org.eclipse.swt.widgets.EventTable",
            "org.eclipse.swt.widgets.Display",
            "org.eclipse.swt.widgets.Widget",
            "org.eclipse.swt.widgets.Display",
            "org.eclipse.swt.widgets.Display",
            "org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine",
            "org.eclipse.core.databinding.observable.Realm",
            "org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine",
            "org.eclipse.e4.ui.internal.workbench.E4Workbench",
            "org.eclipse.ui.internal.Workbench",
            "org.eclipse.core.databinding.observable.Realm",
            "org.eclipse.ui.internal.Workbench",
            "org.eclipse.ui.PlatformUI",
            "org.eclipse.ui.internal.ide.application.IDEApplication",
            "org.eclipse.equinox.internal.app.EclipseAppHandle",
            "org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher",
            "org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher",
            "org.eclipse.core.runtime.adaptor.EclipseStarter",
            "org.eclipse.core.runtime.adaptor.EclipseStarter",
            "sun.reflect.NativeMethodAccessorImpl",
            "sun.reflect.NativeMethodAccessorImpl",
            "sun.reflect.DelegatingMethodAccessorImpl",
            "java.lang.reflect.Method",
            "org.eclipse.equinox.launcher.Main",
            "org.eclipse.equinox.launcher.Main",
            "org.eclipse.equinox.launcher.Main",
            "org.eclipse.equinox.launcher.Main",
            "org.eclipse.equinox.launcher.Main");
    e1.setStackTrace(stackTrace);
    IStatus s1 =
        new Status(
            IStatus.ERROR,
            "org.eclipse.ui.monitoring",
            "Sample at 11:25:04.447 (+1,331s)\n" + "Thread 'main' tid=1 (TIMED_WAITING)",
            e1);

    IStatus multi =
        new MultiStatus(
            "org.eclipse.ui.monitoring",
            0,
            new IStatus[] {s1},
            "UI freeze of 6,0s at 11:24:59.108",
            new RuntimeException("stand-in-stacktrace"));
    org.eclipse.epp.internal.logging.aeri.ui.model.Status newStatus =
        Reports.newStatus(multi, configuration);
    assertThat(newStatus.getChildren().size(), is(1));
    assertThat(
        newStatus.getChildren().get(0).getException().getStackTrace().size(),
        is(stackTrace.length));
  }