You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/08/01 20:12:52 UTC
svn commit: r427666 -
/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
Author: ammulder
Date: Tue Aug 1 11:12:52 2006
New Revision: 427666
URL: http://svn.apache.org/viewvc?rev=427666&view=rev
Log:
More work on GERONIMO-1869 -- use file size when copying, size of
contents when unpacking.
Modified:
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java?rev=427666&r1=427665&r2=427666&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java Tue Aug 1 11:12:52 2006
@@ -190,7 +190,7 @@
if (!source.exists() || !source.canRead() || source.isDirectory()) {
throw new IllegalArgumentException("Cannot read source file at " + source.getAbsolutePath());
}
- int size = 0;
+ int size = (int) source.length();
boolean forceConfiguration = false;
if(FileUtils.isZipFile(source)) {
ZipFile zip = new ZipFile(source);
@@ -205,7 +205,7 @@
}
FileInputStream is = new FileInputStream(source);
try {
- copyToRepository(is, size, destination, monitor, forceConfiguration);
+ copyToRepository(is, (int)source.length(), size, destination, monitor, forceConfiguration);
} finally {
try {
is.close();
@@ -216,10 +216,10 @@
}
public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException {
- copyToRepository(source, size, destination, monitor, false);
+ copyToRepository(source, size, size, destination, monitor, false);
}
- private void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor, boolean isConfiguration) throws IOException {
+ private void copyToRepository(InputStream source, int packedSize, int unpackedSize, Artifact destination, FileWriteMonitor monitor, boolean isConfiguration) throws IOException {
if(!destination.isResolved()) {
throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved");
}
@@ -243,7 +243,8 @@
typeHandler = (ArtifactTypeHandler) typeHandlers.get(destination.getType());
}
if (typeHandler == null) typeHandler = DEFAULT_TYPE_HANDLER;
- typeHandler.install(source, size, destination, monitor, location);
+ typeHandler.install(source, typeHandler instanceof UnpackArtifactTypeHandler ? unpackedSize : packedSize,
+ destination, monitor, location);
if (isConfiguration || destination.getType().equalsIgnoreCase("car")) {
System.out.println("############################################################");