Examples of ConfigInvalidException


Examples of org.eclipse.jgit.errors.ConfigInvalidException

      throws ConfigInvalidException {
    final StringBuilder name = new StringBuilder();
    for (;;) {
      int c = in.read();
      if (c < 0)
        throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile);

      if ('=' == c)
        break;

      if (' ' == c || '\t' == c) {
        for (;;) {
          c = in.read();
          if (c < 0)
            throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile);

          if ('=' == c)
            break;

          if (';' == c || '#' == c || '\n' == c) {
            in.reset();
            break;
          }

          if (' ' == c || '\t' == c)
            continue; // Skipped...
          throw new ConfigInvalidException(JGitText.get().badEntryDelimiter);
        }
        break;
      }

      if (Character.isLetterOrDigit((char) c) || c == '-') {
        // From the git-config man page:
        // The variable names are case-insensitive and only
        // alphanumeric characters and - are allowed.
        name.append((char) c);
      } else if ('\n' == c) {
        in.reset();
        name.append((char) c);
        break;
      } else
        throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badEntryName, name));
    }
    return name.toString();
  }
View Full Code Here

Examples of org.eclipse.jgit.errors.ConfigInvalidException

    boolean space = false;
    for (;;) {
      int c = in.read();
      if (c < 0) {
        if (value.length() == 0)
          throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile);
        break;
      }

      if ('\n' == c) {
        if (quote)
          throw new ConfigInvalidException(JGitText.get().newlineInQuotesNotAllowed);
        in.reset();
        break;
      }

      if (eol == c)
        break;

      if (!quote) {
        if (Character.isWhitespace((char) c)) {
          space = true;
          continue;
        }
        if (';' == c || '#' == c) {
          in.reset();
          break;
        }
      }

      if (space) {
        if (value.length() > 0)
          value.append(' ');
        space = false;
      }

      if ('\\' == c) {
        c = in.read();
        switch (c) {
        case -1:
          throw new ConfigInvalidException(JGitText.get().endOfFileInEscape);
        case '\n':
          continue;
        case 't':
          value.append('\t');
          continue;
        case 'b':
          value.append('\b');
          continue;
        case 'n':
          value.append('\n');
          continue;
        case '\\':
          value.append('\\');
          continue;
        case '"':
          value.append('"');
          continue;
        default:
          throw new ConfigInvalidException(MessageFormat.format(
              JGitText.get().badEscape,
              Character.valueOf(((char) c))));
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.