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:
76a966d
)
Declare potentially-static methods as static.
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Thu, 13 Sep 2012 12:11:39 +0000
(14:11 +0200)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Thu, 13 Sep 2012 12:11:39 +0000
(14:11 +0200)
12 files changed:
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/freenet/fcp/AbstractCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/template/IdentityAccessor.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/EditProfilePage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/SearchPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/UploadImagePage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java
patch
|
blob
|
history
diff --git
a/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
b/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
index
490a05c
..
1944570
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
+++ b/
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
@@
-110,7
+110,7
@@
public abstract class AbstractSoneCommand extends AbstractCommand {
* The text to encode
* @return The encoded text
*/
* The text to encode
* @return The encoded text
*/
- protected String encodeString(String text) {
+ protected
static
String encodeString(String text) {
return text.replaceAll("\\\\", "\\\\").replaceAll("\n", "\\\\n").replaceAll("\r", "\\\\r");
}
return text.replaceAll("\\\\", "\\\\").replaceAll("\n", "\\\\n").replaceAll("\r", "\\\\r");
}
@@
-233,7
+233,7
@@
public abstract class AbstractSoneCommand extends AbstractCommand {
* such as if the Sone is followed by the local Sone
* @return The simple field set containing the given Sone
*/
* such as if the Sone is followed by the local Sone
* @return The simple field set containing the given Sone
*/
- protected SimpleFieldSet encodeSone(Sone sone, String prefix, Sone localSone) {
+ protected
static
SimpleFieldSet encodeSone(Sone sone, String prefix, Sone localSone) {
SimpleFieldSetBuilder soneBuilder = new SimpleFieldSetBuilder();
soneBuilder.put(prefix + "Name", sone.getName());
SimpleFieldSetBuilder soneBuilder = new SimpleFieldSetBuilder();
soneBuilder.put(prefix + "Name", sone.getName());
@@
-264,7
+264,7
@@
public abstract class AbstractSoneCommand extends AbstractCommand {
* {@code null})
* @return The simple field set containing the given Sones
*/
* {@code null})
* @return The simple field set containing the given Sones
*/
- protected SimpleFieldSet encodeSones(Collection<? extends Sone> sones, String prefix) {
+ protected
static
SimpleFieldSet encodeSones(Collection<? extends Sone> sones, String prefix) {
SimpleFieldSetBuilder soneBuilder = new SimpleFieldSetBuilder();
int soneIndex = 0;
SimpleFieldSetBuilder soneBuilder = new SimpleFieldSetBuilder();
int soneIndex = 0;
@@
-352,7
+352,7
@@
public abstract class AbstractSoneCommand extends AbstractCommand {
* {@code null})
* @return The simple field set containing the replies
*/
* {@code null})
* @return The simple field set containing the replies
*/
- protected SimpleFieldSet encodeReplies(Collection<? extends PostReply> replies, String prefix) {
+ protected
static
SimpleFieldSet encodeReplies(Collection<? extends PostReply> replies, String prefix) {
SimpleFieldSetBuilder replyBuilder = new SimpleFieldSetBuilder();
int replyIndex = 0;
SimpleFieldSetBuilder replyBuilder = new SimpleFieldSetBuilder();
int replyIndex = 0;
@@
-379,7
+379,7
@@
public abstract class AbstractSoneCommand extends AbstractCommand {
* {@code null})
* @return The simple field set containing the likes
*/
* {@code null})
* @return The simple field set containing the likes
*/
- protected SimpleFieldSet encodeLikes(Collection<? extends Sone> likes, String prefix) {
+ protected
static
SimpleFieldSet encodeLikes(Collection<? extends Sone> likes, String prefix) {
SimpleFieldSetBuilder likesBuilder = new SimpleFieldSetBuilder();
int likeIndex = 0;
SimpleFieldSetBuilder likesBuilder = new SimpleFieldSetBuilder();
int likeIndex = 0;
diff --git
a/src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java
b/src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java
index
128d46a
..
b3222be
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java
+++ b/
src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java
@@
-197,7
+197,7
@@
public class FcpInterface {
* @throws PluginNotFoundException
* if the plugin can not be found
*/
* @throws PluginNotFoundException
* if the plugin can not be found
*/
- private void sendReply(PluginReplySender pluginReplySender, String identifier, Response response) throws PluginNotFoundException {
+ private
static
void sendReply(PluginReplySender pluginReplySender, String identifier, Response response) throws PluginNotFoundException {
SimpleFieldSet replyParameters = response.getReplyParameters();
if (identifier != null) {
replyParameters.putOverwrite("Identifier", identifier);
SimpleFieldSet replyParameters = response.getReplyParameters();
if (identifier != null) {
replyParameters.putOverwrite("Identifier", identifier);
diff --git
a/src/main/java/net/pterodactylus/sone/freenet/fcp/AbstractCommand.java
b/src/main/java/net/pterodactylus/sone/freenet/fcp/AbstractCommand.java
index
6e13a32
..
b73fb1d
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/freenet/fcp/AbstractCommand.java
+++ b/
src/main/java/net/pterodactylus/sone/freenet/fcp/AbstractCommand.java
@@
-44,7
+44,7
@@
public abstract class AbstractCommand implements Command {
* if there is no value for the given key in the simple field
* set, or the value can not be converted to a String
*/
* if there is no value for the given key in the simple field
* set, or the value can not be converted to a String
*/
- protected String getString(SimpleFieldSet simpleFieldSet, String key) throws FcpException {
+ protected
static
String getString(SimpleFieldSet simpleFieldSet, String key) throws FcpException {
try {
return simpleFieldSet.getString(key);
} catch (FSParseException fspe1) {
try {
return simpleFieldSet.getString(key);
} catch (FSParseException fspe1) {
@@
-64,7
+64,7
@@
public abstract class AbstractCommand implements Command {
* if there is no value for the given key in the simple field
* set, or the value can not be converted to an int
*/
* if there is no value for the given key in the simple field
* set, or the value can not be converted to an int
*/
- protected int getInt(SimpleFieldSet simpleFieldSet, String key) throws FcpException {
+ protected
static
int getInt(SimpleFieldSet simpleFieldSet, String key) throws FcpException {
try {
return simpleFieldSet.getInt(key);
} catch (FSParseException fspe1) {
try {
return simpleFieldSet.getInt(key);
} catch (FSParseException fspe1) {
@@
-84,7
+84,7
@@
public abstract class AbstractCommand implements Command {
* The default value
* @return The int value
*/
* The default value
* @return The int value
*/
- protected int getInt(SimpleFieldSet simpleFieldSet, String key, int defaultValue) {
+ protected
static
int getInt(SimpleFieldSet simpleFieldSet, String key, int defaultValue) {
return simpleFieldSet.getInt(key, defaultValue);
}
return simpleFieldSet.getInt(key, defaultValue);
}
@@
-100,7
+100,7
@@
public abstract class AbstractCommand implements Command {
* if there is no value for the given key in the simple field
* set, or the value can not be converted to a boolean
*/
* if there is no value for the given key in the simple field
* set, or the value can not be converted to a boolean
*/
- protected boolean getBoolean(SimpleFieldSet simpleFieldSet, String key) throws FcpException {
+ protected
static
boolean getBoolean(SimpleFieldSet simpleFieldSet, String key) throws FcpException {
try {
return simpleFieldSet.getBoolean(key);
} catch (FSParseException fspe1) {
try {
return simpleFieldSet.getBoolean(key);
} catch (FSParseException fspe1) {
@@
-120,7
+120,7
@@
public abstract class AbstractCommand implements Command {
* The default value
* @return The boolean value
*/
* The default value
* @return The boolean value
*/
- protected boolean getBoolean(SimpleFieldSet simpleFieldSet, String key, boolean defaultValue) {
+ protected
static
boolean getBoolean(SimpleFieldSet simpleFieldSet, String key, boolean defaultValue) {
return simpleFieldSet.getBoolean(key, defaultValue);
}
return simpleFieldSet.getBoolean(key, defaultValue);
}
diff --git
a/src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java
b/src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java
index
7a5d6d3
..
e22e00b
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java
+++ b/
src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java
@@
-68,7
+68,7
@@
public class AlbumAccessor extends ReflectionAccessor {
* The name of the link
* @return The created map containing the mappings
*/
* The name of the link
* @return The created map containing the mappings
*/
- private Map<String, String> createLink(String target, String name) {
+ private
static
Map<String, String> createLink(String target, String name) {
Map<String, String> link = new HashMap<String, String>();
link.put("target", target);
link.put("name", name);
Map<String, String> link = new HashMap<String, String>();
link.put("target", target);
link.put("name", name);
diff --git
a/src/main/java/net/pterodactylus/sone/template/IdentityAccessor.java
b/src/main/java/net/pterodactylus/sone/template/IdentityAccessor.java
index
4602188
..
4fbe74c
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/template/IdentityAccessor.java
+++ b/
src/main/java/net/pterodactylus/sone/template/IdentityAccessor.java
@@
-93,7
+93,7
@@
public class IdentityAccessor extends ReflectionAccessor {
* append to the nickname
* @return The nickname with optional ID appendage
*/
* append to the nickname
* @return The nickname with optional ID appendage
*/
- private String getAbbreviatedNickname(Identity identity, int length) {
+ private
static
String getAbbreviatedNickname(Identity identity, int length) {
return identity.getNickname() + ((length > 0) ? "@" + identity.getId().substring(0, length) : "");
}
return identity.getNickname() + ((length > 0) ? "@" + identity.getId().substring(0, length) : "");
}
diff --git
a/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java
b/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java
index
30c90bc
..
a1b759b
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/EditProfilePage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/EditProfilePage.java
@@
-158,7
+158,7
@@
public class EditProfilePage extends SoneTemplatePage {
* @return The parsed ID, or {@code null} if there was no part matching the
* given string
*/
* @return The parsed ID, or {@code null} if there was no part matching the
* given string
*/
- private String getFieldId(FreenetRequest request, String partNameStart) {
+ private
static
String getFieldId(FreenetRequest request, String partNameStart) {
for (String partName : request.getHttpRequest().getParts()) {
if (partName.startsWith(partNameStart)) {
return partName.substring(partNameStart.length());
for (String partName : request.getHttpRequest().getParts()) {
if (partName.startsWith(partNameStart)) {
return partName.substring(partNameStart.length());
diff --git
a/src/main/java/net/pterodactylus/sone/web/SearchPage.java
b/src/main/java/net/pterodactylus/sone/web/SearchPage.java
index
a4da9f4
..
4f307fe
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/SearchPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/SearchPage.java
@@
-168,7
+168,7
@@
public class SearchPage extends SoneTemplatePage {
* The string generator for the objects
* @return The hits for the given phrases
*/
* The string generator for the objects
* @return The hits for the given phrases
*/
- private <T> Set<Hit<T>> getHits(Collection<T> objects, List<Phrase> phrases, StringGenerator<T> stringGenerator) {
+ private
static
<T> Set<Hit<T>> getHits(Collection<T> objects, List<Phrase> phrases, StringGenerator<T> stringGenerator) {
Set<Hit<T>> hits = new HashSet<Hit<T>>();
for (T object : objects) {
String objectString = stringGenerator.generateString(object);
Set<Hit<T>> hits = new HashSet<Hit<T>>();
for (T object : objects) {
String objectString = stringGenerator.generateString(object);
@@
-189,7
+189,7
@@
public class SearchPage extends SoneTemplatePage {
* The query to parse
* @return The parsed phrases
*/
* The query to parse
* @return The parsed phrases
*/
- private List<Phrase> parseSearchPhrases(String query) {
+ private
static
List<Phrase> parseSearchPhrases(String query) {
List<String> parsedPhrases = null;
try {
parsedPhrases = StringEscaper.parseLine(query);
List<String> parsedPhrases = null;
try {
parsedPhrases = StringEscaper.parseLine(query);
@@
-229,7
+229,7
@@
public class SearchPage extends SoneTemplatePage {
* The expression to search
* @return The score of the expression
*/
* The expression to search
* @return The score of the expression
*/
- private double calculateScore(List<Phrase> phrases, String expression) {
+ private
static
double calculateScore(List<Phrase> phrases, String expression) {
logger.log(Level.FINEST, String.format("Calculating Score for “%s”…", expression));
double optionalHits = 0;
double requiredHits = 0;
logger.log(Level.FINEST, String.format("Calculating Score for “%s”…", expression));
double optionalHits = 0;
double requiredHits = 0;
diff --git
a/src/main/java/net/pterodactylus/sone/web/UploadImagePage.java
b/src/main/java/net/pterodactylus/sone/web/UploadImagePage.java
index
9045cdf
..
559a8ff
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/UploadImagePage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/UploadImagePage.java
@@
-145,7
+145,7
@@
public class UploadImagePage extends SoneTemplatePage {
* @return The MIME type of the image, or “application/octet-stream” if the
* image type could not be detected
*/
* @return The MIME type of the image, or “application/octet-stream” if the
* image type could not be detected
*/
- private String getMimeType(byte[] imageData) {
+ private
static
String getMimeType(byte[] imageData) {
ByteArrayInputStream imageDataInputStream = new ByteArrayInputStream(imageData);
try {
ImageInputStream imageInputStream = ImageIO.createImageInputStream(imageDataInputStream);
ByteArrayInputStream imageDataInputStream = new ByteArrayInputStream(imageData);
try {
ImageInputStream imageInputStream = ImageIO.createImageInputStream(imageDataInputStream);
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
index
83fa15b
..
293b4b0
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.java
@@
-94,7
+94,7
@@
public class GetLikesAjaxPage extends JsonPage {
* The Sones to convert to an array
* @return The Sones, sorted by name
*/
* The Sones to convert to an array
* @return The Sones, sorted by name
*/
- private JsonArray getSones(Set<Sone> sones) {
+ private
static
JsonArray getSones(Set<Sone> sones) {
JsonArray soneArray = new JsonArray();
List<Sone> sortedSones = new ArrayList<Sone>(sones);
Collections.sort(sortedSones, Sone.NICE_NAME_COMPARATOR);
JsonArray soneArray = new JsonArray();
List<Sone> sortedSones = new ArrayList<Sone>(sones);
Collections.sort(sortedSones, Sone.NICE_NAME_COMPARATOR);
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.java
index
4e9a879
..
98a204b
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.java
@@
-142,7
+142,7
@@
public class GetNotificationsAjaxPage extends JsonPage {
* The current Sone (may be {@code null})
* @return The current options
*/
* The current Sone (may be {@code null})
* @return The current options
*/
- private JsonObject createJsonOptions(Sone currentSone) {
+ private
static
JsonObject createJsonOptions(Sone currentSone) {
JsonObject options = new JsonObject();
if (currentSone != null) {
options.put("ShowNotification/NewSones", currentSone.getOptions().getBooleanOption("ShowNotification/NewSones").get());
JsonObject options = new JsonObject();
if (currentSone != null) {
options.put("ShowNotification/NewSones", currentSone.getOptions().getBooleanOption("ShowNotification/NewSones").get());
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java
index
0466098
..
4c61f89
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java
@@
-193,7
+193,7
@@
public class GetStatusAjaxPage extends JsonPage {
* The current Sone (may be {@code null})
* @return The current options
*/
* The current Sone (may be {@code null})
* @return The current options
*/
- private JsonObject createJsonOptions(Sone currentSone) {
+ private
static
JsonObject createJsonOptions(Sone currentSone) {
JsonObject options = new JsonObject();
if (currentSone != null) {
options.put("ShowNotification/NewSones", currentSone.getOptions().getBooleanOption("ShowNotification/NewSones").get());
JsonObject options = new JsonObject();
if (currentSone != null) {
options.put("ShowNotification/NewSones", currentSone.getOptions().getBooleanOption("ShowNotification/NewSones").get());
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java
index
c6b7738
..
8f074fb
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/JsonPage.java
@@
-162,7
+162,7
@@
public abstract class JsonPage implements FreenetPage {
*
* @return A reply signaling success
*/
*
* @return A reply signaling success
*/
- protected JsonObject createSuccessJsonObject() {
+ protected
static
JsonObject createSuccessJsonObject() {
return new JsonObject().put("success", true);
}
return new JsonObject().put("success", true);
}
@@
-173,7
+173,7
@@
public abstract class JsonPage implements FreenetPage {
* The error that has occured
* @return The JSON object, signalling failure and the error code
*/
* The error that has occured
* @return The JSON object, signalling failure and the error code
*/
- protected JsonObject createErrorJsonObject(String error) {
+ protected
static
JsonObject createErrorJsonObject(String error) {
return new JsonObject().put("success", false).put("error", error);
}
return new JsonObject().put("success", false).put("error", error);
}