camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r1401469 - in /camel/branches/camel-2.9.x/components/camel-smpp/src: main/java/org/apache/camel/component/smpp/SmppUtils.java test/java/org/apache/camel/component/smpp/SmppUtilsTest.java
Date Tue, 23 Oct 2012 20:58:54 GMT
Author: cmueller
Date: Tue Oct 23 20:58:53 2012
New Revision: 1401469

URL: http://svn.apache.org/viewvc?rev=1401469&view=rev
Log:
CAMEL-5732: Data coding of 0x02 not considered 8-bit

Modified:
    camel/branches/camel-2.9.x/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
    camel/branches/camel-2.9.x/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUtilsTest.java

Modified: camel/branches/camel-2.9.x/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java?rev=1401469&r1=1401468&r2=1401469&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
Tue Oct 23 20:58:53 2012
@@ -116,7 +116,13 @@ public final class SmppUtils {
     }
 
     public static Alphabet parseAlphabetFromDataCoding(byte dataCoding) {
-        return Alphabet.valueOf((byte) (dataCoding & Alphabet.MASK_ALPHABET));
+        /* Both the 3.4 and 5.0 SMPP specs clearly state that 0x02 is
+         * 'Octet-unspecified (8-bit)', but jsmpp doesn't account for this for
+         * some reason.
+         */
+        return dataCoding == 0x02
+            ? Alphabet.ALPHA_8_BIT
+            : Alphabet.valueOf((byte)(dataCoding & Alphabet.MASK_ALPHABET));
     }
 
     public static boolean isGsm0338Encodeable(byte[] aMessage) {

Modified: camel/branches/camel-2.9.x/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUtilsTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUtilsTest.java?rev=1401469&r1=1401468&r2=1401469&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUtilsTest.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUtilsTest.java
Tue Oct 23 20:58:53 2012
@@ -70,15 +70,16 @@ public class SmppUtilsTest {
         assertEquals(Alphabet.ALPHA_DEFAULT, SmppUtils.parseAlphabetFromDataCoding((byte)
0x00));
         assertEquals(Alphabet.ALPHA_DEFAULT, SmppUtils.parseAlphabetFromDataCoding((byte)
0x01));
         assertEquals(Alphabet.ALPHA_DEFAULT, SmppUtils.parseAlphabetFromDataCoding((byte)
0x03));
-        
+
+        assertEquals(Alphabet.ALPHA_8_BIT, SmppUtils.parseAlphabetFromDataCoding((byte) 0x02));
         assertEquals(Alphabet.ALPHA_8_BIT, SmppUtils.parseAlphabetFromDataCoding((byte) 0x04));
         assertEquals(Alphabet.ALPHA_8_BIT, SmppUtils.parseAlphabetFromDataCoding((byte) 0x05));
         assertEquals(Alphabet.ALPHA_8_BIT, SmppUtils.parseAlphabetFromDataCoding((byte) 0x07));
-        
+
         assertEquals(Alphabet.ALPHA_UCS2, SmppUtils.parseAlphabetFromDataCoding((byte) 0x08));
         assertEquals(Alphabet.ALPHA_UCS2, SmppUtils.parseAlphabetFromDataCoding((byte) 0x09));
         assertEquals(Alphabet.ALPHA_UCS2, SmppUtils.parseAlphabetFromDataCoding((byte) 0x0b));
-        
+
         assertEquals(Alphabet.ALPHA_RESERVED, SmppUtils.parseAlphabetFromDataCoding((byte)
0x0c));
         assertEquals(Alphabet.ALPHA_RESERVED, SmppUtils.parseAlphabetFromDataCoding((byte)
0x0d));
         assertEquals(Alphabet.ALPHA_RESERVED, SmppUtils.parseAlphabetFromDataCoding((byte)
0xff));



Mime
View raw message