DerValue not happy with zero length value
diff --git a/src/share/classes/sun/security/util/DerValue.java b/src/share/classes/sun/security/util/DerValue.java
--- a/src/share/classes/sun/security/util/DerValue.java
+++ b/src/share/classes/sun/security/util/DerValue.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -378,8 +378,6 @@
("Indefinite length encoding not supported");
length = DerInputStream.getLength(in);
}
- if (length == 0)
- return null;
if (fullyBuffered && in.available() != length)
throw new IOException("extra data given to DerValue constructor");
@@ -477,6 +475,9 @@
"DerValue.getOctetString, not an Octet String: " + tag);
}
bytes = new byte[length];
+ if (length == 0) {
+ return bytes;
+ }
if (buffer.read(bytes) != length)
throw new IOException("short read on DerValue buffer");
if (isConstructed()) {