summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDariusz Luksza2010-08-16 15:06:04 (EDT)
committer Dariusz Luksza2010-08-16 15:06:04 (EDT)
commit6ef63719a7e8c53b7627da17248398226f158b77 (patch)
tree4773aa8f9d2a70d2a20772364e2c2cc040a9d4f0
parent68d6e348c069d07d60a8ad44daf9aa6d93f55635 (diff)
downloadegit-6ef63719a7e8c53b7627da17248398226f158b77.zip
egit-6ef63719a7e8c53b7627da17248398226f158b77.tar.gz
egit-6ef63719a7e8c53b7627da17248398226f158b77.tar.bz2
Use InputStream instead of byte[] in GitBlobResourceVariantrefs/changes/17/1317/1
Using ObjectLoader.getBytes() causes LargeObjectException when we were dealing with object >1M use of ObjectLoader.openStream() should fix this issue. Bug: 322707 Change-Id: I58851193d50cef729333da12d556e345251c9e14 Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitBlobResourceVariant.java16
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitFolderResourceVariant.java4
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitResourceVariant.java4
3 files changed, 11 insertions, 13 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitBlobResourceVariant.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitBlobResourceVariant.java
index b9b3110..f496b49 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitBlobResourceVariant.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitBlobResourceVariant.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.egit.core.synchronize;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -38,14 +37,13 @@ public class GitBlobResourceVariant extends GitResourceVariant {
private IStorage storage;
- private byte[] bytes;
+ private final ObjectLoader blob;
GitBlobResourceVariant(Repository repo, ObjectId objectId, String path)
throws IOException {
super(repo, objectId, path);
- ObjectLoader blob = repo.open(getObjectId());
- bytes = blob.getBytes();
+ blob = repo.open(getObjectId());
}
public boolean isContainer() {
@@ -72,7 +70,11 @@ public class GitBlobResourceVariant extends GitResourceVariant {
}
public InputStream getContents() throws CoreException {
- return new ByteArrayInputStream(bytes);
+ try {
+ return blob.openStream();
+ } catch (IOException e) {
+ throw new TeamException(e.getMessage(), e);
+ }
}
public String getCharset() throws CoreException {
@@ -95,8 +97,4 @@ public class GitBlobResourceVariant extends GitResourceVariant {
return storage;
}
- public byte[] asBytes() {
- return bytes;
- }
-
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitFolderResourceVariant.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitFolderResourceVariant.java
index 7c5ed87..c6af7ef 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitFolderResourceVariant.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitFolderResourceVariant.java
@@ -50,10 +50,6 @@ public class GitFolderResourceVariant extends GitResourceVariant {
return null;
}
- public byte[] asBytes() {
- return getName().getBytes();
- }
-
/**
* @param progress
* @return members
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitResourceVariant.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitResourceVariant.java
index aa1ecd8..3de52bf 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitResourceVariant.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitResourceVariant.java
@@ -83,6 +83,10 @@ abstract class GitResourceVariant implements IResourceVariant {
return false;
}
+ public byte[] asBytes() {
+ return getObjectId().getName().getBytes();
+ }
+
@Override
public String toString() {
return path + "(" + objectId.getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$