aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObject.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaStream.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/RepositoryResolver.java17
9 files changed, 43 insertions, 26 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java
index f13b543f5e..419e1e8729 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java
@@ -395,7 +395,7 @@ public final class DfsPackFile {
int headerCnt = 1;
while ((c & 0x80) != 0) {
c = buf[headerCnt++] & 0xff;
- inflatedLength += (c & 0x7f) << shift;
+ inflatedLength += ((long) (c & 0x7f)) << shift;
shift += 7;
}
@@ -676,7 +676,7 @@ public final class DfsPackFile {
int p = 1;
while ((c & 0x80) != 0) {
c = ib[p++] & 0xff;
- sz += (c & 0x7f) << shift;
+ sz += ((long) (c & 0x7f)) << shift;
shift += 7;
}
@@ -907,7 +907,7 @@ public final class DfsPackFile {
int p = 1;
while ((c & 0x80) != 0) {
c = ib[p++] & 0xff;
- sz += (c & 0x7f) << shift;
+ sz += ((long) (c & 0x7f)) << shift;
shift += 7;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
index 9965c0e526..95ca4a41f0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
@@ -345,7 +345,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
int headerCnt = 1;
while ((c & 0x80) != 0) {
c = buf[headerCnt++] & 0xff;
- inflatedLength += (c & 0x7f) << shift;
+ inflatedLength += ((long) (c & 0x7f)) << shift;
shift += 7;
}
@@ -684,7 +684,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
int p = 1;
while ((c & 0x80) != 0) {
c = ib[p++] & 0xff;
- sz += (c & 0x7f) << shift;
+ sz += ((long) (c & 0x7f)) << shift;
shift += 7;
}
@@ -929,7 +929,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
int p = 1;
while ((c & 0x80) != 0) {
c = ib[p++] & 0xff;
- sz += (c & 0x7f) << shift;
+ sz += ((long) (c & 0x7f)) << shift;
shift += 7;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObject.java
index e3be206825..d059869451 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObject.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObject.java
@@ -151,7 +151,7 @@ public class UnpackedObject {
int p = 1;
while ((c & 0x80) != 0) {
c = hdr[p++] & 0xff;
- size += (c & 0x7f) << shift;
+ size += ((long) (c & 0x7f)) << shift;
shift += 7;
}
@@ -224,7 +224,7 @@ public class UnpackedObject {
int p = 1;
while ((c & 0x80) != 0) {
c = hdr[p++] & 0xff;
- size += (c & 0x7f) << shift;
+ size += ((long) (c & 0x7f)) << shift;
shift += 7;
}
return size;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java
index 4c87e87f1b..9e1cbd0e16 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java
@@ -70,7 +70,7 @@ public class BinaryDelta {
int c, shift = 0;
do {
c = delta[p++] & 0xff;
- baseLen |= (c & 0x7f) << shift;
+ baseLen |= ((long) (c & 0x7f)) << shift;
shift += 7;
} while ((c & 0x80) != 0);
return baseLen;
@@ -97,7 +97,7 @@ public class BinaryDelta {
int shift = 0;
do {
c = delta[p++] & 0xff;
- resLen |= (c & 0x7f) << shift;
+ resLen |= ((long) (c & 0x7f)) << shift;
shift += 7;
} while ((c & 0x80) != 0);
return resLen;
@@ -142,7 +142,7 @@ public class BinaryDelta {
int c, shift = 0;
do {
c = delta[deltaPtr++] & 0xff;
- baseLen |= (c & 0x7f) << shift;
+ baseLen |= ((long) (c & 0x7f)) << shift;
shift += 7;
} while ((c & 0x80) != 0);
if (base.length != baseLen)
@@ -155,7 +155,7 @@ public class BinaryDelta {
shift = 0;
do {
c = delta[deltaPtr++] & 0xff;
- resLen |= (c & 0x7f) << shift;
+ resLen |= ((long) (c & 0x7f)) << shift;
shift += 7;
} while ((c & 0x80) != 0);
@@ -243,7 +243,7 @@ public class BinaryDelta {
int c, shift = 0;
do {
c = delta[deltaPtr++] & 0xff;
- baseLen |= (c & 0x7f) << shift;
+ baseLen |= ((long) (c & 0x7f)) << shift;
shift += 7;
} while ((c & 0x80) != 0);
@@ -251,7 +251,7 @@ public class BinaryDelta {
shift = 0;
do {
c = delta[deltaPtr++] & 0xff;
- resLen |= (c & 0x7f) << shift;
+ resLen |= ((long) (c & 0x7f)) << shift;
shift += 7;
} while ((c & 0x80) != 0);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaStream.java
index 3c3df90b73..7275729f63 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaStream.java
@@ -114,7 +114,7 @@ public abstract class DeltaStream extends InputStream {
int c, shift = 0;
do {
c = cmdbuf[cmdptr++] & 0xff;
- baseSize |= (c & 0x7f) << shift;
+ baseSize |= ((long) (c & 0x7f)) << shift;
shift += 7;
} while ((c & 0x80) != 0);
@@ -123,7 +123,7 @@ public abstract class DeltaStream extends InputStream {
shift = 0;
do {
c = cmdbuf[cmdptr++] & 0xff;
- resultSize |= (c & 0x7f) << shift;
+ resultSize |= ((long) (c & 0x7f)) << shift;
shift += 7;
} while ((c & 0x80) != 0);
@@ -286,7 +286,7 @@ public abstract class DeltaStream extends InputStream {
if ((cmd & 0x04) != 0)
copyOffset |= (cmdbuf[cmdptr++] & 0xff) << 16;
if ((cmd & 0x08) != 0)
- copyOffset |= (cmdbuf[cmdptr++] & 0xff) << 24;
+ copyOffset |= ((long) (cmdbuf[cmdptr++] & 0xff)) << 24;
copySize = 0;
if ((cmd & 0x10) != 0)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
index e301f4242f..78306766d8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
@@ -366,7 +366,8 @@ public class Daemon {
return null;
}
- Repository openRepository(DaemonClient client, String name) {
+ Repository openRepository(DaemonClient client, String name)
+ throws ServiceMayNotContinueException {
// Assume any attempt to use \ was by a Windows client
// and correct to the more typical / used in Git URIs.
//
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java
index e88b4abb7a..a9481c4d22 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java
@@ -130,7 +130,16 @@ public abstract class DaemonService {
throws IOException, ServiceNotEnabledException,
ServiceNotAuthorizedException {
final String name = commandLine.substring(command.length() + 1);
- Repository db = client.getDaemon().openRepository(client, name);
+ Repository db;
+ try {
+ db = client.getDaemon().openRepository(client, name);
+ } catch (ServiceMayNotContinueException e) {
+ // An error when opening the repo means the client is expecting a ref
+ // advertisement, so use that style of error.
+ PacketLineOut pktOut = new PacketLineOut(client.getOutputStream());
+ pktOut.writeString("ERR " + e.getMessage() + "\n");
+ db = null;
+ }
if (db == null)
return;
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
index 84de99d588..584d9337e1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
@@ -681,7 +681,7 @@ public abstract class PackParser {
while ((c & 0x80) != 0) {
c = readFrom(Source.DATABASE);
hdrBuf[hdrPtr++] = (byte) c;
- sz += (c & 0x7f) << shift;
+ sz += ((long) (c & 0x7f)) << shift;
shift += 7;
}
info.size = sz;
@@ -892,7 +892,7 @@ public abstract class PackParser {
while ((c & 0x80) != 0) {
c = readFrom(Source.INPUT);
hdrBuf[hdrPtr++] = (byte) c;
- sz += (c & 0x7f) << shift;
+ sz += ((long) (c & 0x7f)) << shift;
shift += 7;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/RepositoryResolver.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/RepositoryResolver.java
index b2354193e1..c7f0d32cb4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/RepositoryResolver.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/RepositoryResolver.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.transport.resolver;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.transport.ServiceMayNotContinueException;
/**
* Locate a Git {@link Repository} by name from the URL.
@@ -76,12 +77,18 @@ public interface RepositoryResolver<C> {
* the repository does not exist or the name is incorrectly
* formatted as a repository name.
* @throws ServiceNotAuthorizedException
- * the repository exists, but HTTP access is not allowed for the
- * current user.
+ * the repository may exist, but HTTP access is not allowed
+ * without authentication, i.e. this corresponds to an HTTP 401
+ * Unauthorized.
* @throws ServiceNotEnabledException
- * the repository exists, but HTTP access is not allowed on the
- * target repository, by any user.
+ * the repository may exist, but HTTP access is not allowed on the
+ * target repository, for the current user.
+ * @throws ServiceMayNotContinueException
+ * the repository may exist, but HTTP access is not allowed for
+ * the current request. The exception message contains a detailed
+ * message that should be shown to the user.
*/
Repository open(C req, String name) throws RepositoryNotFoundException,
- ServiceNotAuthorizedException, ServiceNotEnabledException;
+ ServiceNotAuthorizedException, ServiceNotEnabledException,
+ ServiceMayNotContinueException;
}