On Saturday 31 January 2009 01:57:40 [email protected] wrote:
> Author: xor
> Date: 2009-01-31 01:57:39 +0000 (Sat, 31 Jan 2009)
> New Revision: 25436
> 
> Modified:
>    trunk/freenet/src/freenet/keys/FreenetURI.java
> Log:
> Add a getEdition() function which works for both SSK and USK.
> 
> Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
> ===================================================================
> --- trunk/freenet/src/freenet/keys/FreenetURI.java    2009-01-31 01:43:07 UTC 
(rev 25435)
> +++ trunk/freenet/src/freenet/keys/FreenetURI.java    2009-01-31 01:57:39 UTC 
(rev 25436)
> @@ -882,4 +882,16 @@
>  
>               return new FreenetURI("USK", siteName, metaStr, routingKey, 
> cryptoKey, 
extra, edition);
>       }
> +     
> +     public long getEdition() {
> +             if(keyType.equalsIgnoreCase("USK"))
> +                     return suggestedEdition;
> +             else if(keyType.equalsIgnoreCase("SSK")) {
> +                     if (!docName.matches(".*\\-[0-9]+")) /* Taken from 
> uskForSSK, also 
modify there if necessary */

Should there be a $ at the end here?

> +                             throw new IllegalStateException();
> +                     
> +                     return 
> Long.valueOf(docName.substring(docName.lastIndexOf('-') + 1, 
docName.length()));
> +             } else
> +                     throw new IllegalStateException();
> +     }
>  }

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to