Skip to content

Commit

Permalink
Google code issue 140: org.jsmpp.bean.OptionalParameter.COctetString.…
Browse files Browse the repository at this point in the history
…getValueAsString() returns a String which miss the last character
  • Loading branch information
cmueller committed Sep 1, 2013
1 parent 9c9c28a commit dfccd92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 1 addition & 2 deletions jsmpp/src/main/java/org/jsmpp/bean/OptionalParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ public COctetString(short tag, byte[] value) {

@Override
public String getValueAsString() {
byte[] value = getValue();
return new String(value, 0, value.length - 1);
return new String(getValue());
}

}
Expand Down
11 changes: 11 additions & 0 deletions jsmpp/src/test/java/org/jsmpp/bean/OptionalParameterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

import org.jsmpp.bean.OptionalParameter.COctetString;
import org.jsmpp.bean.OptionalParameter.Callback_num_pres_ind.Presentation_Indicator;
import org.jsmpp.bean.OptionalParameter.Callback_num_pres_ind.Screening_Indicator;
import org.jsmpp.bean.OptionalParameter.Ms_msg_wait_facilities;
Expand Down Expand Up @@ -144,4 +148,11 @@ public void Network_error_code() {
assertEquals(o.getErrorCode(), (short)60000);

}

@Test(groups="checkintest")
public void cOctetStringGetValueAsString() throws UnsupportedEncodingException {
COctetString string = new OptionalParameter.COctetString(Tag.ADDITIONAL_STATUS_INFO_TEXT.code(), "urgent");

assertEquals(string.getValueAsString(), "urgent");
}
}

0 comments on commit dfccd92

Please sign in to comment.