You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2010/08/17 10:25:47 UTC
svn commit: r986237 -
/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java
Author: cziegeler
Date: Tue Aug 17 08:25:46 2010
New Revision: 986237
URL: http://svn.apache.org/viewvc?rev=986237&view=rev
Log:
SLING-1661 : compute the digest when a dictionary is read from the input stream
Modified:
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java
Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java?rev=986237&r1=986236&r2=986237&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java Tue Aug 17 08:25:46 2010
@@ -90,15 +90,12 @@ public class InstallableResource {
if ( dict == null ) {
throw new IllegalArgumentException("dictionary must not be null (or input stream must not be null).");
}
- digest = (digest != null ? digest : id + ":" + computeDigest(dict));
type = (type != null ? type : InstallableResource.TYPE_CONFIG);
}
- // TODO - compute digest if digest is null - for now we throw
- if ( digest == null || digest.length() == 0 ) {
- throw new IllegalArgumentException("digest must not be null");
- }
-
final String resourceType = (type != null ? type : computeResourceType(getExtension(id)));
+ if ( resourceType == null ) {
+ throw new IllegalArgumentException("Resource type must not be null");
+ }
if ( is != null && resourceType.equals(InstallableResource.TYPE_CONFIG ) ) {
dict = readDictionary(is, getExtension(id));
if ( dict == null ) {
@@ -106,8 +103,13 @@ public class InstallableResource {
}
is = null;
}
- if ( resourceType == null ) {
- throw new IllegalArgumentException("Resource type must not be null");
+ if ( resourceType.equals(InstallableResource.TYPE_CONFIG) ) {
+ digest = (digest != null ? digest : id + ":" + computeDigest(dict));
+ }
+
+ // TODO - compute digest if digest is null - for now we throw
+ if ( digest == null || digest.length() == 0 ) {
+ throw new IllegalArgumentException("digest must not be null");
}
this.id = id;