Index: src/uk/co/westhawk/snmp/stack/SnmpContextv3Basis.java =================================================================== RCS file: /project/snmp/REPOS/src/uk/co/westhawk/snmp/stack/SnmpContextv3Basis.java,v retrieving revision 3.10 diff --unified -r3.10 SnmpContextv3Basis.java --- src/uk/co/westhawk/snmp/stack/SnmpContextv3Basis.java 23 Mar 2006 14:54:10 -0000 3.10 +++ src/uk/co/westhawk/snmp/stack/SnmpContextv3Basis.java 4 Apr 2006 10:36:10 -0000 @@ -235,19 +235,10 @@ * @param newUserAuthPassword The user authentication password */ public void setUserAuthenticationPassword(String newUserAuthPassword) -throws IllegalArgumentException { - if (newUserAuthPassword == null) - { - userAuthenticationPassword = null; - userAuthKeyMD5 = null; - userAuthKeySHA1 = null; - } - else if (newUserAuthPassword.length() == 0) - { - throw new IllegalArgumentException("UserAuthenticationPassword cannot be empty"); - } - else if (newUserAuthPassword.equals(userAuthenticationPassword) == false) + if (newUserAuthPassword != null + && + newUserAuthPassword.equals(userAuthenticationPassword) == false) { userAuthenticationPassword = newUserAuthPassword; userAuthKeyMD5 = null; @@ -376,19 +367,10 @@ * @param newUserPrivacyPassword The user privacy password */ public void setUserPrivacyPassword(String newUserPrivacyPassword) -throws IllegalArgumentException { - if (newUserPrivacyPassword == null) - { - userPrivacyPassword = null; - userPrivKeyMD5 = null; - userPrivKeySHA1 = null; - } - else if (newUserPrivacyPassword.length() == 0) - { - throw new IllegalArgumentException("UserPrivacyPassword cannot be empty"); - } - else if (newUserPrivacyPassword.equals(userPrivacyPassword) == false) + if (newUserPrivacyPassword != null + && + newUserPrivacyPassword.equals(userPrivacyPassword) == false) { userPrivacyPassword = newUserPrivacyPassword; userPrivKeyMD5 = null; @@ -744,17 +726,26 @@ { ret = "userPrivacyPassword is null, but usePrivacy is true"; } + else if (userPrivacyPassword.length() == 0) + { + ret = "userPrivacyPassword is empty, but usePrivacy is true"; + } else if (useAuthentication == false) { ret = "useAuthentication is false, but usePrivacy is true"; } } + if (useAuthentication == true) { if (userAuthenticationPassword == null) { ret = "userAuthenticationPassword is null, but useAuthentication is true"; } + else if (userAuthenticationPassword.length() == 0) + { + ret = "userAuthenticationPassword is empty, but useAuthentication is true"; + } } return ret; } @@ -772,7 +763,6 @@ { AsnEncoderv3 enc = new AsnEncoderv3(); String msg = checkContextSanity(); - System.out.println(getClass().getName() + ".checkContextSanity(): " + msg); if (msg != null) { throw new EncodingException(msg); Index: src/uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java =================================================================== RCS file: /project/snmp/REPOS/src/uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java,v retrieving revision 3.22 diff --unified -r3.22 SnmpContextv3Pool.java --- src/uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java 2 Mar 2006 12:27:27 -0000 3.22 +++ src/uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java 4 Apr 2006 10:13:14 -0000 @@ -254,19 +254,10 @@ } public void setUserAuthenticationPassword(String newUserAuthenticationPd) -throws IllegalArgumentException { - if (newUserAuthenticationPd == null) - { - userAuthenticationPassword = null; - hasChanged = true; - } - else if (newUserAuthenticationPd.length() == 0) - { - hasChanged = false; - throw new IllegalArgumentException("UserAuthenticationPassword cannot be empty"); - } - else if (newUserAuthenticationPd.equals(userAuthenticationPassword) == false) + if (newUserAuthenticationPd != null + && + newUserAuthenticationPd.equals(userAuthenticationPassword) == false) { userAuthenticationPassword = newUserAuthenticationPd; hasChanged = true; @@ -317,19 +308,10 @@ } public void setUserPrivacyPassword(String newUserPrivacyPd) -throws IllegalArgumentException { - if (newUserPrivacyPd == null) - { - userPrivacyPassword = null; - hasChanged = true; - } - else if (newUserPrivacyPd.length() == 0) - { - hasChanged = false; - throw new IllegalArgumentException("UserPrivacyPassword cannot be empty"); - } - else if (newUserPrivacyPd.equals(userPrivacyPassword) == false) + if (newUserPrivacyPd != null + && + newUserPrivacyPd.equals(userPrivacyPassword) == false) { userPrivacyPassword = newUserPrivacyPd; hasChanged = true;