Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-07-14 13:58:43 -0400
committerEike Stepper2010-07-14 13:58:43 -0400
commit589d960fb68b8d85565cb5ba491209fc6d0d44ad (patch)
tree33cec580f68025c1cefb08b4507546664d42b03c /releng/org.eclipse.emf.cdo.releng.version.digest
parentee54d9124607a8de87bdfa505ee2a4a047b55c13 (diff)
downloadcdo-589d960fb68b8d85565cb5ba491209fc6d0d44ad.tar.gz
cdo-589d960fb68b8d85565cb5ba491209fc6d0d44ad.tar.xz
cdo-589d960fb68b8d85565cb5ba491209fc6d0d44ad.zip
ignore CR/LF for digests
Diffstat (limited to 'releng/org.eclipse.emf.cdo.releng.version.digest')
-rw-r--r--releng/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/releng/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java b/releng/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java
index ff6d90b317..54cc23e79b 100644
--- a/releng/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java
+++ b/releng/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java
@@ -30,10 +30,10 @@ import org.eclipse.pde.core.build.IBuildEntry;
import org.eclipse.pde.core.build.IBuildModel;
import org.eclipse.pde.core.plugin.IPluginModelBase;
+import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
-import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Collection;
@@ -276,25 +276,40 @@ public class DigestValidator extends VersionValidator
try
{
- MessageDigest digest = MessageDigest.getInstance("SHA-1");
- stream = new DigestInputStream(file.getContents(), digest)
+ final MessageDigest digest = MessageDigest.getInstance("SHA-1");
+ stream = new FilterInputStream(file.getContents())
{
@Override
public int read() throws IOException
{
- int read;
- while ((read = super.read()) == 10 || read == 13)
+ for (;;)
{
- // Read again
- }
+ int ch = super.read();
+ switch (ch)
+ {
+ case -1:
+ return -1;
- return read;
+ case 10:
+ case 13:
+ continue;
+
+ }
+
+ digest.update((byte)ch);
+ return ch;
+ }
}
@Override
public int read(byte[] b, int off, int len) throws IOException
{
int read = super.read(b, off, len);
+ if (read == -1)
+ {
+ return -1;
+ }
+
for (int i = off; i < off + read; i++)
{
byte c = b[i];
@@ -310,6 +325,7 @@ public class DigestValidator extends VersionValidator
}
}
+ digest.update(b, off, read);
return read;
}
};

Back to the top