camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: camel-snmp - should use xml encoder from camel-core as the current one was buggy. Thanks to Dmitry Zolotukhin for reporting.
Date Sun, 04 Oct 2015 09:28:02 GMT
camel-snmp - should use xml encoder from camel-core as the current one was buggy. Thanks to
Dmitry Zolotukhin for reporting.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f5dda9c6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f5dda9c6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f5dda9c6

Branch: refs/heads/camel-2.14.x
Commit: f5dda9c63c1959d5523eaf31e9d41d1c3214777e
Parents: f685c99
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Oct 4 11:26:18 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Oct 4 11:29:55 2015 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/snmp/SnmpConverters.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f5dda9c6/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpConverters.java
----------------------------------------------------------------------
diff --git a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpConverters.java
b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpConverters.java
index 990cbc8..93e13c0 100644
--- a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpConverters.java
+++ b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpConverters.java
@@ -20,6 +20,7 @@ import java.util.StringTokenizer;
 
 import org.apache.camel.Converter;
 import org.apache.camel.Exchange;
+import org.apache.camel.util.StringHelper;
 import org.snmp4j.PDU;
 import org.snmp4j.PDUv1;
 import org.snmp4j.smi.OID;
@@ -51,7 +52,7 @@ public final class SnmpConverters {
         try {
             OIDList list = new OIDList();
 
-            if (s != null && s.indexOf(",") != -1) {
+            if (s != null && s.contains(",")) {
                 // seems to be a comma separated oid list
                 StringTokenizer strTok = new StringTokenizer(s, ",");
                 while (strTok.hasMoreTokens()) {
@@ -121,7 +122,7 @@ public final class SnmpConverters {
             sb.append(b.getOid().toString());
             sb.append(OID_TAG_CLOSE);
             sb.append(VALUE_TAG_OPEN);
-            sb.append(getXmlSafeString(b.getVariable().toString()));
+            sb.append(StringHelper.xmlEncode(b.getVariable().toString()));
             sb.append(VALUE_TAG_CLOSE);
             sb.append(ENTRY_TAG_CLOSE);
         }
@@ -132,7 +133,4 @@ public final class SnmpConverters {
         return sb.toString();
     }
 
-    private static String getXmlSafeString(String string) {
-        return string.replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("&",
"&amp;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
-    }
 }


Mime
View raw message