public void parseAllPatches() throws PatchSyntaxException {
    ListIterator<String> iterator = myLines.listIterator();
    if (!iterator.hasNext()) {
      myPatches = Collections.emptyList();
      throw new NotAPatchException();
    }

    String next;
    boolean containsAdditional = false;
    boolean isHeaderLine = true;
    int headerLineNum = 0;
    while (iterator.hasNext()) {
      next = iterator.next();
      final boolean containsAdditionalNow = myAdditionalInfoParser.testIsStart(next);
      if (containsAdditionalNow && containsAdditional) {
        myAdditionalInfoParser.acceptError(new PatchSyntaxException(iterator.previousIndex(), VcsBundle
          .message("patch.contains.additional.information.without.patch.itself")));
      }
      if (containsAdditionalNow) {
        isHeaderLine = false;
        containsAdditional = true;
        myAdditionalInfoParser.parse(next, iterator);
        if (!iterator.hasNext()) {
          myAdditionalInfoParser.acceptError(new PatchSyntaxException(iterator.previousIndex(), VcsBundle
            .message("patch.contains.additional.information.without.patch.itself")));
          break;
        }
        next = iterator.next();
      }

      if (myPatchContentParser.testIsStart(next)) {
        isHeaderLine = false;
        myPatchContentParser.parse(next, iterator);
        //iterator.previous();  // to correctly initialize next
        if (containsAdditional) {
          final String lastName = myPatchContentParser.getLastName();
          if (lastName == null) {
            myAdditionalInfoParser.acceptError(new PatchSyntaxException(iterator.previousIndex(), VcsBundle
              .message("patch.contains.additional.information.without.patch.itself")));
          }
          else {
            myAdditionalInfoParser.copyToResult(lastName);
          }
        }
        containsAdditional = false;
      }
      if (isHeaderLine) {
        headerLineNum++;
      }
    }
    myPatches = myPatchContentParser.getResult();
    if (myPatches.isEmpty()) {
      throw new NotAPatchException();
    }
    myPatchFileInfo = PatchFileHeaderParser.parseHeader(Iterables.limit(myLines, headerLineNum).iterator());
  }
public void parseAllPatches()