perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6003 - trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r6003 - trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6003 - trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie
- Date: Tue, 11 Sep 2012 08:41:44 +0100 (BST)
Author: nordunet.behrmann
Date: 2012-09-11 08:41:44 +0100 (Tue, 11 Sep 2012)
New Revision: 6003
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddressConvertor.java
Log:
perfsonar_base: Fix exception handling in IPAddressConverter
The class instanatiated exceptions in case of errors, but failed
to throw them.
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddressConvertor.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddressConvertor.java
2012-09-11 07:41:42 UTC (rev 6002)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddressConvertor.java
2012-09-11 07:41:44 UTC (rev 6003)
@@ -12,25 +12,28 @@
private String keyMappedToIPAddress;
String message = "Invalid IP address specified";
- public IPAddressConvertor(String ipAddress) {
+ public IPAddressConvertor(String ipAddress) throws
InvalidIPAddressException
+ {
this.ipAddress = ipAddress;
keyMappedToIPAddress = "";
splitIPAddressOnSubnetMask();
ipAddressValidityCheck();
}
- public void splitIPAddressOnSubnetMask() {
+ public void splitIPAddressOnSubnetMask() throws InvalidIPAddressException
+ {
String[] splitIP = ipAddress.split("/");
if(splitIP.length == 2){
subnetMask = Integer.parseInt(splitIP[1]);
ipAddress = splitIP[0];
}
else{
- new InvalidIPAddressException(message);
+ throw new InvalidIPAddressException(message);
}
}
- private void ipAddressValidityCheck() {
+ private void ipAddressValidityCheck() throws InvalidIPAddressException
+ {
ipAddress = this.ipAddress.replace(".", ":");
@@ -41,7 +44,7 @@
char ch = (char) addressPart;
keyMappedToIPAddress += ch;
if (!((addressPart >= 0) && (addressPart < 256))) {
- new InvalidIPAddressException(message);
+ throw new InvalidIPAddressException(message);
}
}
}
- [pS-dev] [GEANT/SA2/ps-java-services] r6003 - trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie, svn-noreply, 09/11/2012
Archive powered by MHonArc 2.6.16.