Program: 34369
Project: 34369
Buggy source:
/** 
 * This method try to analyze the text and says whether the snapshot should be file
 * @param snapshot
 * @return whether the snapshot should be parsed
 */
private boolean isParsable(Snapshot snapshot){
  FileObject fo=snapshot.getSource().getFileObject();
  boolean isEmbeded=!getMimeType().equals(snapshot.getMimePath().getPath());
  Long size;
  CharSequence text=snapshot.getText();
  String scriptName;
  scriptName=(fo != null) ? snapshot.getSource().getFileObject().getNameExt() : getDefaultScriptName();
  size=(fo != null && !isEmbeded) ? fo.getSize() : (long)text.length();
  if (!PARSE_BIG_FILES) {
    if (size > MAX_FILE_SIZE_TO_PARSE) {
      if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.log(Level.FINE,"String_Node_Str",scriptName);
      }
      return false;
    }
    if (size > MAX_MINIMIZE_FILE_SIZE_TO_PARSE && !snapshot.getMimeType().equals(JsTokenId.JSON_MIME_TYPE)) {
      boolean isMinified=false;
      TokenSequence<? extends JsTokenId> ts=LexUtilities.getTokenSequence(snapshot,0,language);
      if (ts != null) {
        int offset=0;
        int countedLines=0;
        int countChars=0;
        while (!isMinified && ts.moveNext() && countedLines < 5) {
          LexUtilities.findNext(ts,Arrays.asList(JsTokenId.DOC_COMMENT,JsTokenId.BLOCK_COMMENT,JsTokenId.LINE_COMMENT,JsTokenId.EOL,JsTokenId.WHITESPACE));
          offset=ts.offset();
          LexUtilities.findNextToken(ts,Arrays.asList(JsTokenId.EOL));
          countChars+=(ts.offset() - offset);
          countedLines++;
        }
        if (countedLines > 0 && (countChars / countedLines) > 200) {
          if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE,"String_Node_Str",scriptName);
          }
          return false;
        }
      }
    }
 else     if (snapshot.getMimeType().equals(JsTokenId.JSON_MIME_TYPE)) {
      int index=text.length() - 1;
      char ch=text.charAt(index);
      while (index > 0 && ch != '}') {
        index--;
        ch=text.charAt(index);
      }
      int count=0;
      while (index > 0 && ch == '}' && count <= MAX_RIGHT_CURLY_BRACKETS) {
        index--;
        count++;
        ch=text.charAt(index);
      }
      if (count >= MAX_RIGHT_CURLY_BRACKETS) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * This method try to analyze the text and says whether the snapshot should be file
 * @param snapshot
 * @return whether the snapshot should be parsed
 */
private boolean isParsable(Snapshot snapshot){
  FileObject fo=snapshot.getSource().getFileObject();
  boolean isEmbeded=!getMimeType().equals(snapshot.getMimePath().getPath());
  Long size;
  CharSequence text=snapshot.getText();
  String scriptName;
  scriptName=(fo != null) ? snapshot.getSource().getFileObject().getNameExt() : getDefaultScriptName();
  size=(fo != null && !isEmbeded) ? fo.getSize() : (long)text.length();
  if (!PARSE_BIG_FILES) {
    if (size > MAX_FILE_SIZE_TO_PARSE) {
      if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.log(Level.FINE,"String_Node_Str",scriptName);
      }
      return false;
    }
    if (size > MAX_MINIMIZE_FILE_SIZE_TO_PARSE && !(snapshot.getMimeType().equals(JsTokenId.JSON_MIME_TYPE) || snapshot.getMimeType().equals(JsTokenId.PACKAGE_JSON_MIME_TYPE) || snapshot.getMimeType().equals(JsTokenId.BOWER_JSON_MIME_TYPE))) {
      boolean isMinified=false;
      TokenSequence<? extends JsTokenId> ts=LexUtilities.getTokenSequence(snapshot,0,language);
      if (ts != null) {
        int offset=0;
        int countedLines=0;
        int countChars=0;
        while (!isMinified && ts.moveNext() && countedLines < 5) {
          LexUtilities.findNext(ts,Arrays.asList(JsTokenId.DOC_COMMENT,JsTokenId.BLOCK_COMMENT,JsTokenId.LINE_COMMENT,JsTokenId.EOL,JsTokenId.WHITESPACE));
          offset=ts.offset();
          LexUtilities.findNextToken(ts,Arrays.asList(JsTokenId.EOL));
          countChars+=(ts.offset() - offset);
          countedLines++;
        }
        if (countedLines > 0 && (countChars / countedLines) > 200) {
          if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE,"String_Node_Str",scriptName);
          }
          return false;
        }
      }
    }
 else     if (snapshot.getMimeType().equals(JsTokenId.JSON_MIME_TYPE)) {
      int index=text.length() - 1;
      char ch=text.charAt(index);
      while (index > 0 && ch != '}') {
        index--;
        ch=text.charAt(index);
      }
      int count=0;
      while (index > 0 && ch == '}' && count <= MAX_RIGHT_CURLY_BRACKETS) {
        index--;
        count++;
        ch=text.charAt(index);
      }
      if (count >= MAX_RIGHT_CURLY_BRACKETS) {
        return false;
      }
    }
  }
  return true;
}