Skip to content

Commit

Permalink
Revert "Google code issue 143: org.jsmpp.PDUStringException: C-Octet …
Browse files Browse the repository at this point in the history
…String value 'System ID' cannot more than 9. Actual length of string is 9"

This reverts commit abb4646.
  • Loading branch information
cmueller committed Sep 4, 2013
1 parent abb4646 commit 85400e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 98 deletions.
4 changes: 2 additions & 2 deletions jsmpp/src/main/java/org/jsmpp/util/StringValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void validateString(byte[] value, StringParameter param)
static boolean isCOctetStringValid(String value, int maxLength) {
if (value == null)
return true;
if (value.length() > maxLength)
if (value.length() >= maxLength)
return false;
return true;

Expand All @@ -96,7 +96,7 @@ static boolean isCOctetStringValid(String value, int maxLength) {
static boolean isCOctetStringValid(byte[] value, int maxLength) {
if (value == null)
return true;
if (value.length > maxLength)
if (value.length >= maxLength)
return false;
return true;

Expand Down
8 changes: 7 additions & 1 deletion jsmpp/src/test/java/org/jsmpp/bean/StringValidationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,16 @@ public void testValidation() {
fail("Should be okay inserting string that has length less than 16");
}

try {
StringValidator.validateString("smsgwsmsgwsmsgw", StringParameter.SYSTEM_ID);
} catch (PDUStringException e) {
fail("Should be okay inserting 15 char of string");
}

try {
StringValidator.validateString("smsgwsmsgwsmsgwe", StringParameter.SYSTEM_ID);
fail("Should fail inserting 16 char of string");
} catch (PDUStringException e) {
fail("Should be okay inserting 16 char of string");
}

try {
Expand Down
95 changes: 0 additions & 95 deletions jsmpp/src/test/java/org/jsmpp/util/StringValidatorTest.java

This file was deleted.

0 comments on commit 85400e0

Please sign in to comment.