Author: batosai
Date: 2008-08-23 17:25:22 +0000 (Sat, 23 Aug 2008)
New Revision: 22120
Modified:
trunk/apps/WoT/src/plugins/WoT/Identity.java
trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java
trunk/apps/WoT/src/plugins/WoT/WoT.java
Log:
Only store unique part of keys in the database (bug #2526).
Modified: trunk/apps/WoT/src/plugins/WoT/Identity.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/Identity.java 2008-08-23 16:52:48 UTC
(rev 22119)
+++ trunk/apps/WoT/src/plugins/WoT/Identity.java 2008-08-23 17:25:22 UTC
(rev 22120)
@@ -78,9 +78,10 @@
FreenetURI key;
try {
- key = new FreenetURI(requestURI+"/WoT/"+edition);
+ key = new FreenetURI("USK@" + requestURI +
"/WoT/"+edition);
} catch (MalformedURLException e) {
// Can't happen, the key is tested on creation
+ System.out.println(e.getMessage());
return null;
}
return key.setMetaString(new String [] {"identity.xml"});
@@ -112,7 +113,7 @@
setEdition(key.getSuggestedEdition());
- this.requestURI = key.toString().substring(0,
key.toString().indexOf("/"));
+ this.requestURI =
key.toString().substring(key.toString().indexOf("@") + 1,
key.toString().indexOf("/"));
}
/**
Modified: trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java 2008-08-23 16:52:48 UTC
(rev 22119)
+++ trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java 2008-08-23 17:25:22 UTC
(rev 22120)
@@ -154,7 +154,7 @@
FreenetURI key;
try {
- key = new FreenetURI(insertURI+"/WoT/"+edition);
+ key = new FreenetURI("USK@" + insertURI +
"/WoT/"+edition);
} catch (MalformedURLException e) {
// TODO Remove this as soon as the creation is checked
e.printStackTrace();
@@ -183,7 +183,7 @@
if(key.getKeyType().equals("SSK")) key = key.setKeyType("USK");
if(!key.getKeyType().equals("USK")) throw new
InvalidParameterException("Key type not supported");
- this.insertURI = key.toString().substring(0,
key.toString().indexOf("/"));
+ this.insertURI =
key.toString().substring(key.toString().indexOf("@") + 1,
key.toString().indexOf("/"));
}
/**
Modified: trunk/apps/WoT/src/plugins/WoT/WoT.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoT.java 2008-08-23 16:52:48 UTC (rev
22119)
+++ trunk/apps/WoT/src/plugins/WoT/WoT.java 2008-08-23 17:25:22 UTC (rev
22120)
@@ -223,7 +223,7 @@
Query query = db.query();
query.constrain(Identity.class);
-
query.descend("requestURI").constrain(uri.toString().substring(0,
uri.toString().indexOf("/")));
+
query.descend("requestURI").constrain(uri.toString().substring(uri.toString().indexOf("@")
+ 1, uri.toString().indexOf("/")));
// This is generating warnings about unchecked conversion.
// Google is not my friend on this one, if you have an idea...