Browse Source

Replace trivial reference comparison of PacketLineIn.{DELIM,END}

Replace reference comparisons of PacketLineIn's DELIM and END strings
with usage of the helper methods isDelimiter() and isEnd().

Change-Id: I52dcfc4ee9097f1bd6970601c716701847d9eebd
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.5
David Pursehouse 6 years ago
parent
commit
7377b8dd01
  1. 3
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
  2. 4
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java
  3. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV0ParserTest.java
  4. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java
  5. 24
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java
  6. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefAdvertiserTest.java
  7. 63
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
  8. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java
  9. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
  10. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV0Parser.java
  11. 10
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java
  12. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
  13. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
  14. 4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

3
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java

@ -44,7 +44,6 @@
package org.eclipse.jgit.http.test;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.theInstance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@ -366,7 +365,7 @@ public class HttpClientTests extends HttpTestCase {
// Check that we get a v0 response.
assertThat(pckIn.readString(), is("# service=git-upload-pack"));
assertThat(pckIn.readString(), theInstance(PacketLineIn.END));
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
assertTrue(pckIn.readString().matches("[0-9a-f]{40} HEAD.*"));
}

4
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java

@ -44,7 +44,7 @@
package org.eclipse.jgit.http.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -157,7 +157,7 @@ public class ProtocolErrorTest extends HttpTestCase {
pckin.readString());
assertEquals("ng refs/objects/A n/a (unpacker error)",
pckin.readString());
assertSame(PacketLineIn.END, pckin.readString());
assertTrue(PacketLineIn.isEnd(pckin.readString()));
}
} finally {
c.disconnect();

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV0ParserTest.java

@ -64,9 +64,9 @@ public class ProtocolV0ParserTest {
ByteArrayOutputStream send = new ByteArrayOutputStream();
PacketLineOut pckOut = new PacketLineOut(send);
for (String line : inputLines) {
if (line == PacketLineIn.END) {
if (PacketLineIn.isEnd(line)) {
pckOut.end();
} else if (line == PacketLineIn.DELIM) {
} else if (PacketLineIn.isDelimiter(line)) {
pckOut.writeDelim();
} else {
pckOut.writeString(line);

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java

@ -123,9 +123,9 @@ public class ProtocolV2ParserTest {
ByteArrayOutputStream send = new ByteArrayOutputStream();
PacketLineOut pckOut = new PacketLineOut(send);
for (String line : inputLines) {
if (line == PacketLineIn.END) {
if (PacketLineIn.isEnd(line)) {
pckOut.end();
} else if (line == PacketLineIn.DELIM) {
} else if (PacketLineIn.isDelimiter(line)) {
pckOut.writeDelim();
} else {
pckOut.writeString(line);

24
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java

@ -306,11 +306,11 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas
int nul = master.indexOf('\0');
assertTrue("has capability list", nul > 0);
assertEquals(B.name() + ' ' + R_MASTER, master.substring(0, nul));
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
assertEquals("unpack error Missing commit " + P.name(), r.readString());
assertEquals("ng refs/heads/s n/a (unpacker error)", r.readString());
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
}
private static void receive(final ReceivePack rp,
@ -366,13 +366,13 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas
int nul = master.indexOf('\0');
assertTrue("has capability list", nul > 0);
assertEquals(B.name() + ' ' + R_MASTER, master.substring(0, nul));
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
assertEquals("unpack error Missing blob " + b.name(),
r.readString());
assertEquals("ng refs/heads/s n/a (unpacker error)",
r.readString());
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
}
}
@ -419,13 +419,13 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas
int nul = master.indexOf('\0');
assertTrue("has capability list", nul > 0);
assertEquals(B.name() + ' ' + R_MASTER, master.substring(0, nul));
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
assertEquals("unpack error Missing blob " + b.name(),
r.readString());
assertEquals("ng refs/heads/s n/a (unpacker error)",
r.readString());
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
}
}
@ -473,13 +473,13 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas
int nul = master.indexOf('\0');
assertTrue("has capability list", nul > 0);
assertEquals(B.name() + ' ' + R_MASTER, master.substring(0, nul));
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
assertEquals("unpack error Missing blob " + n.name(),
r.readString());
assertEquals("ng refs/heads/s n/a (unpacker error)",
r.readString());
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
}
}
@ -504,13 +504,13 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas
int nul = master.indexOf('\0');
assertTrue("has capability list", nul > 0);
assertEquals(B.name() + ' ' + R_MASTER, master.substring(0, nul));
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
String errorLine = r.readString();
assertTrue(errorLine.startsWith("unpack error"));
assertTrue(errorLine.contains("Invalid submodule URL '-"));
assertEquals("ng refs/heads/s n/a (unpacker error)", r.readString());
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
}
private TemporaryBuffer.Heap setupSourceRepoInvalidGitmodules()
@ -589,13 +589,13 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas
int nul = master.indexOf('\0');
assertTrue("has capability list", nul > 0);
assertEquals(B.name() + ' ' + R_MASTER, master.substring(0, nul));
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
assertEquals("unpack error Missing tree " + t.name(),
r.readString());
assertEquals("ng refs/heads/s n/a (unpacker error)",
r.readString());
assertSame(PacketLineIn.END, r.readString());
assertTrue(PacketLineIn.isEnd(r.readString()));
}
}

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefAdvertiserTest.java

@ -45,7 +45,7 @@ package org.eclipse.jgit.transport;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@ -95,7 +95,7 @@ public class RefAdvertiserTest {
assertEquals(id(3).name() + " refs/Iñtërnâtiônàlizætiøn☃💩\n", s);
s = pckIn.readStringRaw();
assertSame(PacketLineIn.END, s);
assertTrue(PacketLineIn.isEnd(s));
}
private static ObjectId id(int i) {

63
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java

@ -4,7 +4,6 @@ import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.theInstance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@ -428,9 +427,9 @@ public class UploadPackTest {
try (ByteArrayOutputStream send = new ByteArrayOutputStream()) {
PacketLineOut pckOut = new PacketLineOut(send);
for (String line : inputLines) {
if (line == PacketLineIn.END) {
if (PacketLineIn.isEnd(line)) {
pckOut.end();
} else if (line == PacketLineIn.DELIM) {
} else if (PacketLineIn.isDelimiter(line)) {
pckOut.writeDelim();
} else {
pckOut.writeString(line);
@ -453,7 +452,7 @@ public class UploadPackTest {
PacketLineIn pckIn = new PacketLineIn(recvStream);
// drain capabilities
while (pckIn.readString() != PacketLineIn.END) {
while (!PacketLineIn.isEnd(pckIn.readString())) {
// do nothing
}
return recvStream;
@ -504,7 +503,7 @@ public class UploadPackTest {
// and additional capabilities to be added to existing
// commands without requiring test changes.
hasItems("ls-refs", "fetch=shallow", "server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -521,7 +520,7 @@ public class UploadPackTest {
// TODO(jonathantanmy) This check overspecifies the
// order of the capabilities of "fetch".
hasItems("ls-refs", "fetch=filter shallow", "server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -539,7 +538,7 @@ public class UploadPackTest {
// order of the capabilities of "fetch".
hasItems("ls-refs", "fetch=ref-in-want shallow",
"server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -554,7 +553,7 @@ public class UploadPackTest {
Arrays.asList(pckIn.readString(), pckIn.readString(),
pckIn.readString()),
hasItems("ls-refs", "fetch=shallow", "server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -570,7 +569,7 @@ public class UploadPackTest {
Arrays.asList(pckIn.readString(), pckIn.readString(),
pckIn.readString()),
hasItems("ls-refs", "fetch=shallow", "server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -598,7 +597,7 @@ public class UploadPackTest {
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " HEAD"));
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/master"));
assertThat(pckIn.readString(), is(tag.toObjectId().getName() + " refs/tags/tag"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -615,7 +614,7 @@ public class UploadPackTest {
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " HEAD symref-target:refs/heads/master"));
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/master"));
assertThat(pckIn.readString(), is(tag.toObjectId().getName() + " refs/tags/tag"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -635,7 +634,7 @@ public class UploadPackTest {
pckIn.readString(),
is(tag.toObjectId().getName() + " refs/tags/tag peeled:"
+ tip.toObjectId().getName()));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -657,11 +656,11 @@ public class UploadPackTest {
pckIn.readString(),
is(tag.toObjectId().getName() + " refs/tags/tag peeled:"
+ tip.toObjectId().getName()));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " HEAD"));
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/master"));
assertThat(pckIn.readString(), is(tag.toObjectId().getName() + " refs/tags/tag"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -681,7 +680,7 @@ public class UploadPackTest {
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/master"));
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/other"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -700,7 +699,7 @@ public class UploadPackTest {
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/master"));
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/other"));
assertTrue(pckIn.readString() == PacketLineIn.END);
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -908,7 +907,7 @@ public class UploadPackTest {
assertThat(pckIn.readString(), is("acknowledgments"));
assertThat(pckIn.readString(), is("ACK " + fooParent.toObjectId().getName()));
assertThat(pckIn.readString(), theInstance(PacketLineIn.END));
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -937,7 +936,7 @@ public class UploadPackTest {
"ACK " + fooParent.toObjectId().getName(),
"ACK " + barParent.toObjectId().getName()));
assertThat(pckIn.readString(), is("ready"));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
assertFalse(client.getObjectDatabase().has(fooParent.toObjectId()));
@ -1160,7 +1159,7 @@ public class UploadPackTest {
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is("shallow-info"));
assertThat(pckIn.readString(), is("shallow " + child.toObjectId().getName()));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
assertTrue(client.getObjectDatabase().has(child.toObjectId()));
@ -1198,7 +1197,7 @@ public class UploadPackTest {
// sent only if a packfile is sent.
assertThat(pckIn.readString(), is("acknowledgments"));
assertThat(pckIn.readString(), is("NAK"));
assertThat(pckIn.readString(), theInstance(PacketLineIn.END));
assertTrue(PacketLineIn.isEnd(pckIn.readString()));
}
@Test
@ -1237,7 +1236,7 @@ public class UploadPackTest {
// later than the given deepen-since time.
assertThat(pckIn.readString(), is("unshallow " + boundary.toObjectId().getName()));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
@ -1286,7 +1285,7 @@ public class UploadPackTest {
"shallow " + child1.toObjectId().getName(),
"shallow " + child2.toObjectId().getName()));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
@ -1353,7 +1352,7 @@ public class UploadPackTest {
// "three" is unshallow because its parent "two" is now available.
assertThat(pckIn.readString(), is("unshallow " + three.toObjectId().getName()));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
@ -1413,7 +1412,7 @@ public class UploadPackTest {
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is("shallow-info"));
assertThat(pckIn.readString(), is("shallow " + three.toObjectId().getName()));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
assertFalse(client.getObjectDatabase().has(one.toObjectId()));
@ -1455,7 +1454,7 @@ public class UploadPackTest {
"shallow " + child1.toObjectId().getName(),
"shallow " + child2.toObjectId().getName()));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
@ -1899,7 +1898,7 @@ public class UploadPackTest {
hasItems(
one.toObjectId().getName() + " refs/heads/one",
two.toObjectId().getName() + " refs/heads/two"));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
@ -1955,7 +1954,7 @@ public class UploadPackTest {
assertThat(
pckIn.readString(),
is(one.toObjectId().getName() + " refs/heads/one"));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
@ -1987,7 +1986,7 @@ public class UploadPackTest {
assertThat(
pckIn.readString(),
is(one.toObjectId().getName() + " refs/heads/one"));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
// ... but the client does not need the object itself.
assertThat(pckIn.readString(), is("packfile"));
@ -2015,10 +2014,10 @@ public class UploadPackTest {
// shallow-info appears first, then wanted-refs.
assertThat(pckIn.readString(), is("shallow-info"));
assertThat(pckIn.readString(), is("shallow " + child.toObjectId().getName()));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("wanted-refs"));
assertThat(pckIn.readString(), is(child.toObjectId().getName() + " refs/heads/branch1"));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);
assertTrue(client.getObjectDatabase().has(child.toObjectId()));
@ -2050,11 +2049,11 @@ public class UploadPackTest {
is("shallow " + one.toObjectId().getName()));
assertThat(pckIn.readString(),
is("unshallow " + two.toObjectId().getName()));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("wanted-refs"));
assertThat(pckIn.readString(),
is(three.toObjectId().getName() + " refs/heads/three"));
assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
assertTrue(PacketLineIn.isDelimiter(pckIn.readString()));
assertThat(pckIn.readString(), is("packfile"));
parsePack(recvStream);

2
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java

@ -201,7 +201,7 @@ abstract class BasePackConnection extends BaseConnection {
throw noRepository();
throw eof;
}
if (line == PacketLineIn.END)
if (PacketLineIn.isEnd(line))
break;
if (line.startsWith("ERR ")) { //$NON-NLS-1$

2
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

@ -1282,7 +1282,7 @@ public abstract class BaseReceivePack {
return;
throw eof;
}
if (line == PacketLineIn.END) {
if (PacketLineIn.isEnd(line)) {
break;
}

2
org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV0Parser.java

@ -99,7 +99,7 @@ final class ProtocolV0Parser {
throw eof;
}
if (line == PacketLineIn.END) {
if (PacketLineIn.isEnd(line)) {
break;
}

10
org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java

@ -92,7 +92,7 @@ final class ProtocolV2Parser {
String agentPrefix = OPTION_AGENT + '=';
String line = pckIn.readString();
while (line != PacketLineIn.DELIM && line != PacketLineIn.END) {
while (!PacketLineIn.isDelimiter(line) && !PacketLineIn.isEnd(line)) {
if (line.startsWith(serverOptionPrefix)) {
serverOptionConsumer
.accept(line.substring(serverOptionPrefix.length()));
@ -133,11 +133,11 @@ final class ProtocolV2Parser {
serverOption -> reqBuilder.addServerOption(serverOption),
agent -> reqBuilder.setAgent(agent));
if (line == PacketLineIn.END) {
if (PacketLineIn.isEnd(line)) {
return reqBuilder.build();
}
if (line != PacketLineIn.DELIM) {
if (!PacketLineIn.isDelimiter(line)) {
throw new PackProtocolException(
MessageFormat.format(JGitText.get().unexpectedPacketLine,
line));
@ -244,11 +244,11 @@ final class ProtocolV2Parser {
serverOption -> builder.addServerOption(serverOption),
agent -> builder.setAgent(agent));
if (line == PacketLineIn.END) {
if (PacketLineIn.isEnd(line)) {
return builder.build();
}
if (line != PacketLineIn.DELIM) {
if (!PacketLineIn.isDelimiter(line)) {
throw new PackProtocolException(MessageFormat
.format(JGitText.get().unexpectedPacketLine, line));
}

2
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

@ -348,7 +348,7 @@ public class ReceivePack extends BaseReceivePack {
pushOptions = new ArrayList<>(4);
for (;;) {
String option = in.readString();
if (option == PacketLineIn.END) {
if (PacketLineIn.isEnd(option)) {
break;
}
pushOptions.add(option);

2
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java

@ -902,7 +902,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
JGitText.get().expectedGot, exp, act));
}
while (pckIn.readString() != PacketLineIn.END) {
while (!PacketLineIn.isEnd(pckIn.readString())) {
// for now, ignore the remaining header lines
}
}

4
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

@ -1229,7 +1229,7 @@ public class UploadPack {
/* EOF when awaiting command is fine */
return true;
}
if (command == PacketLineIn.END) {
if (PacketLineIn.isEnd(command)) {
// A blank request is valid according
// to the protocol; do nothing in this
// case.
@ -1600,7 +1600,7 @@ public class UploadPack {
throw eof;
}
if (line == PacketLineIn.END) {
if (PacketLineIn.isEnd(line)) {
last = processHaveLines(peerHas, last, pckOut);
if (commonBase.isEmpty() || multiAck != MultiAck.OFF)
pckOut.writeString("NAK\n"); //$NON-NLS-1$

Loading…
Cancel
Save