Author: toad
Date: 2008-03-10 14:31:58 +0000 (Mon, 10 Mar 2008)
New Revision: 18436
Modified:
trunk/freenet/src/freenet/keys/FreenetURI.java
Log:
Doh, last commit was logging. Throw an erorr on an unrecognised keyType.
Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- trunk/freenet/src/freenet/keys/FreenetURI.java 2008-03-10 14:22:29 UTC
(rev 18435)
+++ trunk/freenet/src/freenet/keys/FreenetURI.java 2008-03-10 14:31:58 UTC
(rev 18436)
@@ -80,6 +80,8 @@
private final long suggestedEdition; // for USKs
private boolean hasHashCode;
private int hashCode;
+ static final String[] VALID_KEY_TYPES =
+ new String[] { "CHK", "SSK", "KSK", "USK" };
public int hashCode() {
if(hasHashCode) return hashCode;
@@ -246,6 +248,12 @@
}
URI = URI.substring(atchar + 1);
+ boolean validKeyType = false;
+ for(int i=0;i<VALID_KEY_TYPES.length;i++) {
+ if(keyType.equals(VALID_KEY_TYPES[i])) validKeyType =
true;
+ }
+ if(!validKeyType) throw new MalformedURLException("Invalid key
type: "+keyType);
+
// decode metaString
Vector sv = null;
int slash2;