Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.PackProtocolException


        continue;
      case CH_ERROR:
        eof = true;
        throw new TransportException(PFX_REMOTE + readString(available));
      default:
        throw new PackProtocolException(MessageFormat.format(JGitText.get().invalidChannel, channel));
      }
    }
  }
View Full Code Here


      }

      if (line == PacketLineIn.END)
        break;
      if (!line.startsWith("want ") || line.length() < 45)
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line));

      if (isFirst && line.length() > 45) {
        String opt = line.substring(45);
        if (opt.startsWith(" "))
          opt = opt.substring(1);
        for (String c : opt.split(" "))
          options.add(c);
        line = line.substring(0, 45);
      }

      wantIds.add(ObjectId.fromString(line.substring(5)));
      isFirst = false;
    }

    if (wantIds.isEmpty())
      return;

    AsyncRevObjectQueue q = walk.parseAny(wantIds, true);
    try {
      for (;;) {
        RevObject o;
        try {
          o = q.next();
        } catch (IOException error) {
          throw new PackProtocolException(MessageFormat.format(
              JGitText.get().notValid, error.getMessage()), error);
        }
        if (o == null)
          break;
        if (o.has(WANT)) {
          // Already processed, the client repeated itself.

        } else if (advertised.contains(o)) {
          o.add(WANT);
          wantAll.add(o);

          if (o instanceof RevTag) {
            o = walk.peel(o);
            if (o instanceof RevCommit) {
              if (!o.has(WANT)) {
                o.add(WANT);
                wantAll.add(o);
              }
            }
          }
        } else {
          throw new PackProtocolException(MessageFormat.format(
              JGitText.get().notValid, o.name()));
        }
      }
    } finally {
      q.release();
View Full Code Here

          pckOut.writeString("ACK " + last.name() + "\n");

        return true;

      } else {
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "have", line));
      }
    }
  }
View Full Code Here

        if (wantSatisfied(obj))
          return false;
      }
      return true;
    } catch (IOException e) {
      throw new PackProtocolException(JGitText.get().internalRevisionError, e);
    }
  }
View Full Code Here

      }

      if (line.length() < 83) {
        final String m = JGitText.get().errorInvalidProtocolWantedOldNewRef;
        sendError(m);
        throw new PackProtocolException(m);
      }

      final ObjectId oldId = ObjectId.fromString(line.substring(0, 40));
      final ObjectId newId = ObjectId.fromString(line.substring(41, 81));
      final String name = line.substring(82);
View Full Code Here

      }

      if (line == PacketLineIn.END)
        break;
      if (!line.startsWith("want ") || line.length() < 45)
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line));

      if (isFirst && line.length() > 45) {
        String opt = line.substring(45);
        if (opt.startsWith(" "))
          opt = opt.substring(1);
View Full Code Here

          pckOut.writeString("ACK " + last.name() + "\n");

        return true;

      } else {
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "have", line));
      }
    }
  }
View Full Code Here

          ObjectId id = notFound.getObjectId();
          if (wantIds.contains(id)) {
            String msg = MessageFormat.format(
                JGitText.get().wantNotValid, id.name());
            pckOut.writeString("ERR " + msg);
            throw new PackProtocolException(msg, notFound);
          }
          continue;
        }
        if (obj == null)
          break;

        // If the object is still found in wantIds, the want
        // list wasn't parsed earlier, and was done in this batch.
        //
        if (wantIds.remove(obj)) {
          if (!advertised.contains(obj)) {
            String msg = MessageFormat.format(
                JGitText.get().wantNotValid, obj.name());
            pckOut.writeString("ERR " + msg);
            throw new PackProtocolException(msg);
          }

          if (!obj.has(WANT)) {
            obj.add(WANT);
            wantAll.add(obj);
View Full Code Here

        if (!wantSatisfied(obj))
          return false;
      }
      return true;
    } catch (IOException e) {
      throw new PackProtocolException(JGitText.get().internalRevisionError, e);
    }
  }
View Full Code Here

      }

      if (line.length() < 83) {
        final String m = JGitText.get().errorInvalidProtocolWantedOldNewRef;
        sendError(m);
        throw new PackProtocolException(m);
      }

      final ObjectId oldId = ObjectId.fromString(line.substring(0, 40));
      final ObjectId newId = ObjectId.fromString(line.substring(41, 81));
      final String name = line.substring(82);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.errors.PackProtocolException

Copyright © 2018 www.massapicom. 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.