test_class.declarator: logger = LoggerFactory.getLogger(GsmUtilTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger logger = LoggerFactory.getLogger(GsmUtilTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.file: ch-commons-gsm/src/test/java/com/cloudhopper/commons/gsm/GsmUtilTest.java
test_class.identifier: GsmUtilTest
test_case.body: @Test
      public void getShortMessageUserData() {
          Assert.assertNull(GsmUtil.getShortMessageUserData(null));
          Assert.assertArrayEquals(HexUtil.toByteArray(""), GsmUtil.getShortMessageUserData(HexUtil.toByteArray("")));
          Assert.assertArrayEquals(HexUtil.toByteArray("02"), GsmUtil.getShortMessageUserData(HexUtil.toByteArray("0002")));
          Assert.assertArrayEquals(HexUtil.toByteArray(""), GsmUtil.getShortMessageUserData(HexUtil.toByteArray("0102")));
          Assert.assertArrayEquals(HexUtil.toByteArray("0304050607"), GsmUtil.getShortMessageUserData(HexUtil.toByteArray("01020304050607")));
          // make sure "signed" byte of user data header works
          Assert.assertArrayEquals(HexUtil.toByteArray("08"), GsmUtil.getShortMessageUserData(HexUtil.toByteArray("80000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708")));
          try {
              // UDH length exceeds payload
              Assert.assertArrayEquals(HexUtil.toByteArray("01"), GsmUtil.getShortMessageUserData(HexUtil.toByteArray("01")));
              Assert.fail();
          } catch (IllegalArgumentException e) {
              // correct behavior
          }
      }
test_case.class_method_signature: GsmUtilTest.getShortMessageUserData()
test_case.full_signature: @Test public void getShortMessageUserData()
test_case.identifier: getShortMessageUserData
test_case.invocations: assertNull getShortMessageUserData assertArrayEquals toByteArray getShortMessageUserData toByteArray assertArrayEquals toByteArray getShortMessageUserData toByteArray assertArrayEquals toByteArray getShortMessageUserData toByteArray assertArrayEquals toByteArray getShortMessageUserData toByteArray assertArrayEquals toByteArray getShortMessageUserData toByteArray assertArrayEquals toByteArray getShortMessageUserData toByteArray fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getShortMessageUserData()
focal_class.file: ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/GsmUtil.java
focal_class.identifier: GsmUtil
focal_class.class_method_signature: GsmUtil.toBcd(String address)
focal_class.full_signature: public static byte[] toBcd(String address)
focal_class.identifier: toBcd
focal_class.modifiers: public static
focal_class.parameters: (String address)
focal_class.return: byte[]
focal_class.signature: byte[] toBcd(String address)
focal_class.class_method_signature: GsmUtil.toSubmitInfo(boolean replyPath, boolean udhIndicator,
              boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates)
focal_class.full_signature: public static byte toSubmitInfo(boolean replyPath, boolean udhIndicator,
              boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates)
focal_class.identifier: toSubmitInfo
focal_class.modifiers: public static
focal_class.parameters: (boolean replyPath, boolean udhIndicator,
              boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates)
focal_class.return: byte
focal_class.signature: byte toSubmitInfo(boolean replyPath, boolean udhIndicator,
              boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates)
focal_class.class_method_signature: GsmUtil.removeUserDataHeader(byte[] shortMessage)
focal_class.full_signature: static public byte[] removeUserDataHeader(byte[] shortMessage)
focal_class.identifier: removeUserDataHeader
focal_class.modifiers: static public
focal_class.parameters: (byte[] shortMessage)
focal_class.return: byte[]
focal_class.signature: byte[] removeUserDataHeader(byte[] shortMessage)
focal_class.class_method_signature: GsmUtil.getShortMessageUserData(byte[] shortMessage)
focal_class.full_signature: static public byte[] getShortMessageUserData(byte[] shortMessage)
focal_class.identifier: getShortMessageUserData
focal_class.modifiers: static public
focal_class.parameters: (byte[] shortMessage)
focal_class.return: byte[]
focal_class.signature: byte[] getShortMessageUserData(byte[] shortMessage)
focal_class.class_method_signature: GsmUtil.getShortMessageUserDataHeader(byte[] shortMessage)
focal_class.full_signature: static public byte[] getShortMessageUserDataHeader(byte[] shortMessage)
focal_class.identifier: getShortMessageUserDataHeader
focal_class.modifiers: static public
focal_class.parameters: (byte[] shortMessage)
focal_class.return: byte[]
focal_class.signature: byte[] getShortMessageUserDataHeader(byte[] shortMessage)
focal_class.class_method_signature: GsmUtil.createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum)
focal_class.full_signature: static public byte[][] createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum)
focal_class.identifier: createConcatenatedBinaryShortMessages
focal_class.modifiers: static public
focal_class.parameters: (byte[] binaryShortMessage, byte referenceNum)
focal_class.return: byte[][]
focal_class.signature: byte[][] createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum)
focal_method.body: static public byte[] getShortMessageUserData(byte[] shortMessage) throws IllegalArgumentException {
          if (shortMessage == null) {
              return null;
          }
  
          if (shortMessage.length == 0) {
              return shortMessage;
          }
  
          // the entire length of UDH is the first byte + the length
          int userDataHeaderLength = ByteUtil.decodeUnsigned(shortMessage[0]) + 1;
  
          // is there enough data?
          if (userDataHeaderLength > shortMessage.length) {
              throw new IllegalArgumentException("User data header length exceeds short message length [shortMessageLength=" + shortMessage.length + ", userDataHeaderLength=" + userDataHeaderLength + "]");
          }
  
          // create a new message with the header removed
          int newShortMessageLength = shortMessage.length - userDataHeaderLength;
          byte[] newShortMessage = new byte[newShortMessageLength];
  
          System.arraycopy(shortMessage, userDataHeaderLength, newShortMessage, 0, newShortMessageLength);
  
          return newShortMessage;
      }
focal_method.class_method_signature: GsmUtil.getShortMessageUserData(byte[] shortMessage)
focal_method.full_signature: static public byte[] getShortMessageUserData(byte[] shortMessage)
focal_method.identifier: getShortMessageUserData
focal_method.invocations: decodeUnsigned arraycopy
focal_method.modifiers: static public
focal_method.parameters: (byte[] shortMessage)
focal_method.return: byte[]
focal_method.signature: byte[] getShortMessageUserData(byte[] shortMessage)