You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/12/05 04:26:55 UTC
[1/6] camel git commit: CAMEL-8001: Add javadoc comments about the
expectation that the argument is ISO-8859-1 encoded
Repository: camel
Updated Branches:
refs/heads/camel-2.13.x e4d47e7f9 -> 2c4b0f986
refs/heads/camel-2.14.x 09051a452 -> 2923038d7
CAMEL-8001: Add javadoc comments about the expectation that the argument is ISO-8859-1 encoded
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6784d8d8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6784d8d8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6784d8d8
Branch: refs/heads/camel-2.14.x
Commit: 6784d8d85a0cbef5a3f5bbd1f4b55fba8c21b95a
Parents: 09051a4
Author: Daniel Pocock <da...@pocock.pro>
Authored: Mon Nov 24 19:11:31 2014 +0100
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Dec 5 11:25:46 2014 +0800
----------------------------------------------------------------------
.../java/org/apache/camel/component/smpp/SmppUtils.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6784d8d8/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
index 0158a80..9a427f6 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
@@ -125,6 +125,13 @@ public final class SmppUtils {
: Alphabet.valueOf((byte)(dataCoding & Alphabet.MASK_ALPHABET));
}
+ /**
+ * Decides if the characters in the argument are GSM 3.38 encodeable.
+ * @param aMessage must be a set of characters encoded in ISO-8859-1
+ * or a compatible character set. In particular,
+ * UTF-8 encoded text should not be passed to this method.
+ * @return true if the characters can be represented in GSM 3.38
+ */
public static boolean isGsm0338Encodeable(byte[] aMessage) {
outer:
for (int i = 0; i < aMessage.length; i++) {
@@ -265,4 +272,4 @@ public final class SmppUtils {
}
return dest;
}
-}
\ No newline at end of file
+}
[4/6] camel git commit: CAMEL-8001: Add javadoc comments about the
expectation that the argument is ISO-8859-1 encoded
Posted by ni...@apache.org.
CAMEL-8001: Add javadoc comments about the expectation that the argument is ISO-8859-1 encoded
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8a033a94
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8a033a94
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8a033a94
Branch: refs/heads/camel-2.13.x
Commit: 8a033a946c1992de92593bfcc29765bbc9934498
Parents: e4d47e7
Author: Daniel Pocock <da...@pocock.pro>
Authored: Mon Nov 24 19:11:31 2014 +0100
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Dec 5 11:26:20 2014 +0800
----------------------------------------------------------------------
.../java/org/apache/camel/component/smpp/SmppUtils.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8a033a94/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
index 0158a80..9a427f6 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppUtils.java
@@ -125,6 +125,13 @@ public final class SmppUtils {
: Alphabet.valueOf((byte)(dataCoding & Alphabet.MASK_ALPHABET));
}
+ /**
+ * Decides if the characters in the argument are GSM 3.38 encodeable.
+ * @param aMessage must be a set of characters encoded in ISO-8859-1
+ * or a compatible character set. In particular,
+ * UTF-8 encoded text should not be passed to this method.
+ * @return true if the characters can be represented in GSM 3.38
+ */
public static boolean isGsm0338Encodeable(byte[] aMessage) {
outer:
for (int i = 0; i < aMessage.length; i++) {
@@ -265,4 +272,4 @@ public final class SmppUtils {
}
return dest;
}
-}
\ No newline at end of file
+}
[3/6] camel git commit: CAMEL-8001 Fixed the CS error of camel-smpp
Posted by ni...@apache.org.
CAMEL-8001 Fixed the CS error of camel-smpp
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2923038d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2923038d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2923038d
Branch: refs/heads/camel-2.14.x
Commit: 2923038d74fa654ff2e63563c8573668b65d7830
Parents: d733e32
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Dec 2 10:48:38 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Dec 5 11:26:01 2014 +0800
----------------------------------------------------------------------
.../main/java/org/apache/camel/component/smpp/SmppSmCommand.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2923038d/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
index a9d8456..f38a57d 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
@@ -104,7 +104,7 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
Alphabet alphabetObj;
if (alphabet == SmppConstants.UNKNOWN_ALPHABET) {
alphabetObj = Alphabet.ALPHA_UCS2;
- if(isLatin1Compatible(charset)) {
+ if (isLatin1Compatible(charset)) {
byte[] messageBytes = body.getBytes(charset);
if (SmppUtils.isGsm0338Encodeable(messageBytes)) {
alphabetObj = Alphabet.ALPHA_DEFAULT;
@@ -118,7 +118,7 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
}
private boolean isLatin1Compatible(Charset c) {
- if(c.equals(ascii) || c.equals(latin1)) {
+ if (c.equals(ascii) || c.equals(latin1)) {
return true;
}
return false;
[5/6] camel git commit: CAMEL-8001: only try to use
SmppUtils.isGsm0338Encodeable for content that can already be ISO-8859-1
encoded
Posted by ni...@apache.org.
CAMEL-8001: only try to use SmppUtils.isGsm0338Encodeable for content that can already be ISO-8859-1 encoded
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/daacf791
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/daacf791
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/daacf791
Branch: refs/heads/camel-2.13.x
Commit: daacf791e04533ca091fd9c69cf122ad53ed73d2
Parents: 8a033a9
Author: Daniel Pocock <da...@pocock.pro>
Authored: Mon Nov 24 19:12:34 2014 +0100
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Dec 5 11:26:27 2014 +0800
----------------------------------------------------------------------
.../camel/component/smpp/SmppSmCommand.java | 21 +++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/daacf791/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
index 175ac9c..a9d8456 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
@@ -24,6 +24,9 @@ import org.jsmpp.session.SMPPSession;
public abstract class SmppSmCommand extends AbstractSmppCommand {
+ protected Charset ascii = Charset.forName("US-ASCII");
+ protected Charset latin1 = Charset.forName("ISO-8859-1");
+
protected Charset charset;
public SmppSmCommand(SMPPSession session, SmppConfiguration config) {
@@ -100,11 +103,12 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
Alphabet alphabetObj;
if (alphabet == SmppConstants.UNKNOWN_ALPHABET) {
- byte[] messageBytes = body.getBytes(charset);
- if (SmppUtils.isGsm0338Encodeable(messageBytes)) {
- alphabetObj = Alphabet.ALPHA_DEFAULT;
- } else {
- alphabetObj = Alphabet.ALPHA_UCS2;
+ alphabetObj = Alphabet.ALPHA_UCS2;
+ if(isLatin1Compatible(charset)) {
+ byte[] messageBytes = body.getBytes(charset);
+ if (SmppUtils.isGsm0338Encodeable(messageBytes)) {
+ alphabetObj = Alphabet.ALPHA_DEFAULT;
+ }
}
} else {
alphabetObj = Alphabet.valueOf(alphabet);
@@ -112,4 +116,11 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
return alphabetObj;
}
+
+ private boolean isLatin1Compatible(Charset c) {
+ if(c.equals(ascii) || c.equals(latin1)) {
+ return true;
+ }
+ return false;
+ }
}
[2/6] camel git commit: CAMEL-8001: only try to use
SmppUtils.isGsm0338Encodeable for content that can already be ISO-8859-1
encoded
Posted by ni...@apache.org.
CAMEL-8001: only try to use SmppUtils.isGsm0338Encodeable for content that can already be ISO-8859-1 encoded
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d733e323
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d733e323
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d733e323
Branch: refs/heads/camel-2.14.x
Commit: d733e3235e8ae009453d21a1d0cb49c50e7387e3
Parents: 6784d8d
Author: Daniel Pocock <da...@pocock.pro>
Authored: Mon Nov 24 19:12:34 2014 +0100
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Dec 5 11:25:54 2014 +0800
----------------------------------------------------------------------
.../camel/component/smpp/SmppSmCommand.java | 21 +++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d733e323/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
index 175ac9c..a9d8456 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
@@ -24,6 +24,9 @@ import org.jsmpp.session.SMPPSession;
public abstract class SmppSmCommand extends AbstractSmppCommand {
+ protected Charset ascii = Charset.forName("US-ASCII");
+ protected Charset latin1 = Charset.forName("ISO-8859-1");
+
protected Charset charset;
public SmppSmCommand(SMPPSession session, SmppConfiguration config) {
@@ -100,11 +103,12 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
Alphabet alphabetObj;
if (alphabet == SmppConstants.UNKNOWN_ALPHABET) {
- byte[] messageBytes = body.getBytes(charset);
- if (SmppUtils.isGsm0338Encodeable(messageBytes)) {
- alphabetObj = Alphabet.ALPHA_DEFAULT;
- } else {
- alphabetObj = Alphabet.ALPHA_UCS2;
+ alphabetObj = Alphabet.ALPHA_UCS2;
+ if(isLatin1Compatible(charset)) {
+ byte[] messageBytes = body.getBytes(charset);
+ if (SmppUtils.isGsm0338Encodeable(messageBytes)) {
+ alphabetObj = Alphabet.ALPHA_DEFAULT;
+ }
}
} else {
alphabetObj = Alphabet.valueOf(alphabet);
@@ -112,4 +116,11 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
return alphabetObj;
}
+
+ private boolean isLatin1Compatible(Charset c) {
+ if(c.equals(ascii) || c.equals(latin1)) {
+ return true;
+ }
+ return false;
+ }
}
[6/6] camel git commit: CAMEL-8001 Fixed the CS error of camel-smpp
Posted by ni...@apache.org.
CAMEL-8001 Fixed the CS error of camel-smpp
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2c4b0f98
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2c4b0f98
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2c4b0f98
Branch: refs/heads/camel-2.13.x
Commit: 2c4b0f9869dd1b0ee4c08a9e852cd61c52205326
Parents: daacf79
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Dec 2 10:48:38 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Dec 5 11:26:34 2014 +0800
----------------------------------------------------------------------
.../main/java/org/apache/camel/component/smpp/SmppSmCommand.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2c4b0f98/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
index a9d8456..f38a57d 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
@@ -104,7 +104,7 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
Alphabet alphabetObj;
if (alphabet == SmppConstants.UNKNOWN_ALPHABET) {
alphabetObj = Alphabet.ALPHA_UCS2;
- if(isLatin1Compatible(charset)) {
+ if (isLatin1Compatible(charset)) {
byte[] messageBytes = body.getBytes(charset);
if (SmppUtils.isGsm0338Encodeable(messageBytes)) {
alphabetObj = Alphabet.ALPHA_DEFAULT;
@@ -118,7 +118,7 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
}
private boolean isLatin1Compatible(Charset c) {
- if(c.equals(ascii) || c.equals(latin1)) {
+ if (c.equals(ascii) || c.equals(latin1)) {
return true;
}
return false;