/*
- * jSite2 - PersistentPut.java -
- * Copyright © 2008 David Roden
+ * jFCPlib - PersistentPut.java - Copyright © 2008 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* A “PersistentPut” message notifies a client about a persistent
* {@link ClientPut} request.
*
- * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
- * @version $Id$
+ * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class PersistentPut extends BaseMessage {
/**
* Returns the data length of the request.
*
- * @return The data length of the request, or <code>-1</code> if the
- * length could not be parsed
+ * @return The data length of the request, or <code>-1</code> if the length
+ * could not be parsed
*/
public long getDataLength() {
return FcpUtils.safeParseLong(getField("DataLength"));
* <code>-1</code> is returned each block is tried forever.
*
* @return The maximum number of retries for failed blocks, or
- * <code>-1</code> for unlimited retries, or <code>-2</code> if
- * the number of retries could not be parsed
+ * <code>-1</code> for unlimited retries, or <code>-2</code> if the
+ * number of retries could not be parsed
*/
public int getMaxRetries() {
return FcpUtils.safeParseInt(getField("MaxRetries"));
* 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())];
}
/**
* Returns whether this request has started.
*
- * @return <code>true</code> if the request has started,
- * <code>false</code> otherwise
+ * @return <code>true</code> if the request has started, <code>false</code>
+ * otherwise
*/
public boolean isStarted() {
return Boolean.valueOf(getField("Started"));