projects
/
jFCPlib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0ea7214
)
improve priority parsing
author
David ‘Bombe’ Roden
<bombe@freenetproject.org>
Sun, 25 May 2008 21:26:57 +0000
(23:26 +0200)
committer
David ‘Bombe’ Roden
<bombe@freenetproject.org>
Sun, 25 May 2008 21:26:57 +0000
(23:26 +0200)
src/net/pterodactylus/fcp/PersistentGet.java
patch
|
blob
|
history
src/net/pterodactylus/fcp/PersistentPut.java
patch
|
blob
|
history
src/net/pterodactylus/fcp/PersistentPutDir.java
patch
|
blob
|
history
diff --git
a/src/net/pterodactylus/fcp/PersistentGet.java
b/src/net/pterodactylus/fcp/PersistentGet.java
index
81919cd
..
0d5a6f4
100644
(file)
--- a/
src/net/pterodactylus/fcp/PersistentGet.java
+++ b/
src/net/pterodactylus/fcp/PersistentGet.java
@@
-19,6
+19,7
@@
package net.pterodactylus.fcp;
package net.pterodactylus.fcp;
+
/**
* The “PersistentGet” message is sent to the client to inform it about a
* persistent download, either in the client-local queue or in the global queue.
/**
* The “PersistentGet” message is sent to the client to inform it about a
* persistent download, either in the client-local queue or in the global queue.
@@
-112,7
+113,7
@@
public class PersistentGet extends BaseMessage {
* @return The priority of the request
*/
public Priority getPriority() {
* @return The priority of the request
*/
public Priority getPriority() {
- return Priority.values()[FcpUtils.safeParseInt(getField("PriorityClass"),
7
)];
+ return Priority.values()[FcpUtils.safeParseInt(getField("PriorityClass"),
Priority.unknown.ordinal()
)];
}
/**
}
/**
diff --git
a/src/net/pterodactylus/fcp/PersistentPut.java
b/src/net/pterodactylus/fcp/PersistentPut.java
index
8a1aae5
..
1457146
100644
(file)
--- a/
src/net/pterodactylus/fcp/PersistentPut.java
+++ b/
src/net/pterodactylus/fcp/PersistentPut.java
@@
-112,11
+112,7
@@
public class PersistentPut extends BaseMessage {
* priority could not be parsed
*/
public Priority getPriority() {
* priority could not be parsed
*/
public Priority getPriority() {
- try {
- return Priority.values()[Integer.valueOf(getField("PriorityClass"))];
- } catch (NumberFormatException nfe1) {
- return Priority.unknown;
- }
+ return Priority.values()[FcpUtils.safeParseInt(getField("PriorityClass"), Priority.unknown.ordinal())];
}
/**
}
/**
diff --git
a/src/net/pterodactylus/fcp/PersistentPutDir.java
b/src/net/pterodactylus/fcp/PersistentPutDir.java
index
324f9b8
..
569ca21
100644
(file)
--- a/
src/net/pterodactylus/fcp/PersistentPutDir.java
+++ b/
src/net/pterodactylus/fcp/PersistentPutDir.java
@@
-71,7
+71,7
@@
public class PersistentPutDir extends BaseMessage {
* @return The priority of the request
*/
public Priority getPriority() {
* @return The priority of the request
*/
public Priority getPriority() {
- return Priority.value
Of(getField("PriorityClass"))
;
+ return Priority.value
s()[FcpUtils.safeParseInt(getField("PriorityClass"), Priority.unknown.ordinal())]
;
}
/**
}
/**