*/
package net.pterodactylus.util.fcp;
-
/**
* Some convenience methods for parsing a “NodeHello” message from the node.
*
* @param receivedMessage
* The received FCP message
*/
- public NodeHello(FcpMessage receivedMessage) {
+ NodeHello(FcpMessage receivedMessage) {
super(receivedMessage);
}
* number could not be determined
*/
public int getBuildNumber() {
- String build = getBuild();
- try {
- return Integer.valueOf(build);
- } catch (NumberFormatException nfe1) {
- /* ignore. */
- }
- return -1;
+ return FcpUtils.safeParseInt(getBuild());
}
/**
* number of compression codecs could not be determined
*/
public int getCompressionCodecsNumber() {
- String compressionCodecs = getCompressionCodecs();
- try {
- return Integer.valueOf(compressionCodecs);
- } catch (NumberFormatException nfe1) {
- /* ignore. */
- }
- return -1;
+ return FcpUtils.safeParseInt(getCompressionCodecs());
}
/**
* if the build number could not be determined
*/
public int getExtBuildNumber() {
- String extBuild = getExtBuild();
- try {
- return Integer.valueOf(extBuild);
- } catch (NumberFormatException nfe1) {
- /* ignore. */
- }
- return -1;
+ return FcpUtils.safeParseInt(getExtBuild());
}
/**
* <code>-1</code> if the revision number could not be determined
*/
public int getExtRevisionNumber() {
- String extRevision = getExtRevision();
- try {
- return Integer.valueOf(extRevision);
- } catch (NumberFormatException nfe1) {
- /* ignore. */
- }
- return -1;
+ return FcpUtils.safeParseInt(getExtRevision());
}
/**
* revision number coult not be determined
*/
public int getRevisionNumber() {
- String revision = getRevision();
- try {
- return Integer.valueOf(revision);
- } catch (NumberFormatException nfe1) {
- /* ignore. */
- }
- return -1;
+ return FcpUtils.safeParseInt(getRevision());
}
/**