projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
14d84b8
)
Don’t fail when the trust can not be retrieved.
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Tue, 4 Jan 2011 06:08:25 +0000
(07:08 +0100)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Tue, 4 Jan 2011 06:08:25 +0000
(07:08 +0100)
src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java
patch
|
blob
|
history
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java
index
7bc9aa9
..
1a6d28f
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.java
@@
-19,6
+19,7
@@
package net.pterodactylus.sone.web.ajax;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.freenet.wot.Trust;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.json.JsonObject;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.json.JsonObject;
@@
-55,7
+56,11
@@
public class DistrustAjaxPage extends JsonPage {
return createErrorJsonObject("invalid-sone-id");
}
webInterface.getCore().distrustSone(currentSone, sone);
return createErrorJsonObject("invalid-sone-id");
}
webInterface.getCore().distrustSone(currentSone, sone);
- return createSuccessJsonObject().put("trustValue", webInterface.getCore().getTrust(currentSone, sone).getExplicit());
+ Trust trust = webInterface.getCore().getTrust(currentSone, sone);
+ if (trust == null) {
+ return createErrorJsonObject("wot-plugin");
+ }
+ return createSuccessJsonObject().put("trustValue", trust.getExplicit());
}
}
}
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java
index
e298a50
..
d6e2750
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java
@@
-19,6
+19,7
@@
package net.pterodactylus.sone.web.ajax;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.freenet.wot.Trust;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.json.JsonObject;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.json.JsonObject;
@@
-55,7
+56,11
@@
public class TrustAjaxPage extends JsonPage {
return createErrorJsonObject("invalid-sone-id");
}
webInterface.getCore().trustSone(currentSone, sone);
return createErrorJsonObject("invalid-sone-id");
}
webInterface.getCore().trustSone(currentSone, sone);
- return createSuccessJsonObject().put("trustValue", webInterface.getCore().getTrust(currentSone, sone).getExplicit());
+ Trust trust = webInterface.getCore().getTrust(currentSone, sone);
+ if (trust == null) {
+ return createErrorJsonObject("wot-plugin");
+ }
+ return createSuccessJsonObject().put("trustValue", trust.getExplicit());
}
}
}
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java
index
3fe8599
..
32c6229
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.java
@@
-19,6
+19,7
@@
package net.pterodactylus.sone.web.ajax;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.freenet.wot.Trust;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.json.JsonObject;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.json.JsonObject;
@@
-55,7
+56,11
@@
public class UntrustAjaxPage extends JsonPage {
return createErrorJsonObject("invalid-sone-id");
}
webInterface.getCore().untrustSone(currentSone, sone);
return createErrorJsonObject("invalid-sone-id");
}
webInterface.getCore().untrustSone(currentSone, sone);
- return createSuccessJsonObject().put("trustValue", (String) null);
+ Trust trust = webInterface.getCore().getTrust(currentSone, sone);
+ if (trust == null) {
+ return createErrorJsonObject("wot-plugin");
+ }
+ return createSuccessJsonObject().put("trustValue", trust.getExplicit());
}
}
}
}