On Tuesday 20 November 2007 19:15, [EMAIL PROTECTED] wrote:
> +    private void migrateOldBookmarks(String[] newVals) {
> +        //FIXME: for some reason that doesn't work... if someone wants to 
fix it ;)
> +        Pattern pattern = Pattern.compile("/(.*/)([^/]*)=(|=)*([A-Z]
[EMAIL PROTECTED]).*");

It doesn't work because the optional |= can be happily added to the first part 
of the regex. So the optional bit is never present. You need to get rid of 
it, and manually check for =| at the end of group(2). I wrote code to do this 
which was released in the last build.

> +        FreenetURI key;
> +        clear();
> +        for (int i = 0; i < newVals.length; i++) {
> +            try {
> +                Matcher matcher = pattern.matcher(newVals[i]);
> +                if (matcher.matches() && matcher.groupCount() == 4) {
> +                    makeParents(matcher.group(1));
> +                    key = new FreenetURI(matcher.group(4));
> +                    String title = matcher.group(2);
> +                    boolean hasAnActiveLink = matcher.group(3).indexOf('|') 
> -1;
> +                    addBookmark(matcher.group(1), new BookmarkItem(key,
> +                            title, hasAnActiveLink, node.alerts), false);
> +                }
> +            } catch (MalformedURLException e) {}
> +        }
> +    }

Attachment: pgpDa2MsMuXAN.pgp
Description: PGP signature

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

Reply via email to