Repository: incubator-s2graph
Updated Branches:
  refs/heads/branch-0.2.0 cddbaa482 -> 917475b62


add "UTF-8" encoding on String.getBytes method.


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

Branch: refs/heads/branch-0.2.0
Commit: f290745dba9a2b4036eb1cda7443a487da0acc6b
Parents: cddbaa4
Author: DO YUNG YOON <steams...@apache.org>
Authored: Mon Aug 7 16:21:46 2017 +0900
Committer: DO YUNG YOON <steams...@apache.org>
Committed: Mon Aug 7 16:38:32 2017 +0900

----------------------------------------------------------------------
 .../org/apache/s2graph/loader/subscriber/TransferToHFile.scala   | 2 +-
 .../main/scala/org/apache/s2graph/core/storage/SKeyValue.scala   | 3 ++-
 .../scala/org/apache/s2graph/core/storage/Serializable.scala     | 4 ++--
 .../storage/serde/indexedge/tall/IndexEdgeSerializable.scala     | 2 +-
 .../storage/serde/indexedge/wide/IndexEdgeSerializable.scala     | 2 +-
 .../serde/snapshotedge/tall/SnapshotEdgeSerializable.scala       | 2 +-
 .../serde/snapshotedge/wide/SnapshotEdgeSerializable.scala       | 2 +-
 .../main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala   | 2 +-
 .../s2graph/rest/play/controllers/ApplicationController.scala    | 2 +-
 9 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f290745d/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala
----------------------------------------------------------------------
diff --git 
a/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala
 
b/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala
index dce085e..07fc908 100644
--- 
a/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala
+++ 
b/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala
@@ -194,7 +194,7 @@ object TransferToHFile extends SparkApp {
     }
     val familyOptions = new 
FamilyHFileWriteOptions(Algorithm.LZ4.getName.toUpperCase,
       BloomType.ROW.name().toUpperCase, 32768, 
DataBlockEncoding.FAST_DIFF.name().toUpperCase)
-    val familyOptionsMap = Map("e".getBytes() -> familyOptions, "v".getBytes() 
-> familyOptions)
+    val familyOptionsMap = Map("e".getBytes("UTF-8") -> familyOptions, 
"v".getBytes("UTF-8") -> familyOptions)
 
     hbaseSc.bulkLoad(merged, TableName.valueOf(tableName), flatMap, tmpPath, 
familyOptionsMap)
   }

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f290745d/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala
index 403ceeb..bde7f3a 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala
@@ -19,12 +19,13 @@
 
 package org.apache.s2graph.core.storage
 
+import java.nio.charset.StandardCharsets
 import org.apache.hadoop.hbase.util.Bytes
 import org.hbase.async.KeyValue
 
 
 object SKeyValue {
-  val EdgeCf = "e".getBytes()
+  val EdgeCf = "e".getBytes("UTF-8")
   val Put = 1
   val Delete = 2
   val Increment = 3

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f290745d/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala
index bd5e3d3..6de0b30 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala
@@ -20,8 +20,8 @@
 package org.apache.s2graph.core.storage
 
 object Serializable {
-  val vertexCf = "v".getBytes()
-  val edgeCf = "e".getBytes()
+  val vertexCf = "v".getBytes("UTF-8")
+  val edgeCf = "e".getBytes("UTF-8")
 }
 
 trait Serializable[E] extends StorageSerializable[E]

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f290745d/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala
 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala
index 2d49c11..632eefa 100644
--- 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala
+++ 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala
@@ -30,7 +30,7 @@ class IndexEdgeSerializable(indexEdge: IndexEdge, 
longToBytes: Long => Array[Byt
    import StorageSerializable._
 
    override def ts = indexEdge.version
-   override def table = indexEdge.label.hbaseTableName.getBytes()
+   override def table = indexEdge.label.hbaseTableName.getBytes("UTF-8")
 
    def idxPropsMap = indexEdge.orders.toMap
    def idxPropsBytes = propsToBytes(indexEdge.orders)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f290745d/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala
 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala
index f85159b..434db02 100644
--- 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala
+++ 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala
@@ -30,7 +30,7 @@ class IndexEdgeSerializable(indexEdge: IndexEdge, 
longToBytes: Long => Array[Byt
    import StorageSerializable._
 
    override def ts = indexEdge.version
-   override def table = indexEdge.label.hbaseTableName.getBytes()
+   override def table = indexEdge.label.hbaseTableName.getBytes("UTF-8")
 
    def idxPropsMap = indexEdge.orders.toMap
    def idxPropsBytes = propsToBytes(indexEdge.orders)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f290745d/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala
 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala
index e71760d..76fb74d 100644
--- 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala
+++ 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala
@@ -30,7 +30,7 @@ class SnapshotEdgeSerializable(snapshotEdge: SnapshotEdge) 
extends Serializable[
   import StorageSerializable._
 
   override def ts = snapshotEdge.version
-  override def table = snapshotEdge.label.hbaseTableName.getBytes()
+  override def table = snapshotEdge.label.hbaseTableName.getBytes("UTF-8")
 
   def statusCodeWithOp(statusCode: Byte, op: Byte): Array[Byte] = {
     val byte = (((statusCode << 4) | op).toByte)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f290745d/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala
 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala
index ee2645a..d2544e0 100644
--- 
a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala
+++ 
b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala
@@ -35,7 +35,7 @@ class SnapshotEdgeSerializable(snapshotEdge: SnapshotEdge) 
extends Serializable[
   import StorageSerializable._
 
   override def ts = snapshotEdge.version
-  override def table = snapshotEdge.label.hbaseTableName.getBytes()
+  override def table = snapshotEdge.label.hbaseTableName.getBytes("UTF-8")
 
   def statusCodeWithOp(statusCode: Byte, op: Byte): Array[Byte] = {
     val byte = (((statusCode << 4) | op).toByte)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f290745d/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala 
b/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala
index 9d9bdf2..e206a83 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala
@@ -112,7 +112,7 @@ case class InnerVal(value: Any) extends HBaseSerializable 
with InnerValLike {
         val len = OrderedBytes.encodeNumeric(pbr, b.bigDecimal, order)
         pbr.getBytes().take(len)
       case s: String =>
-        val pbr = new SimplePositionedMutableByteRange(s.getBytes.length + 3)
+        val pbr = new 
SimplePositionedMutableByteRange(s.getBytes("UTF-8").length + 3)
         val len = OrderedBytes.encodeString(pbr, s, order)
         pbr.getBytes().take(len)
       case blob: Array[Byte] =>

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f290745d/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala
----------------------------------------------------------------------
diff --git 
a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala
 
b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala
index b32c16a..b997356 100644
--- 
a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala
+++ 
b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala
@@ -86,7 +86,7 @@ object ApplicationController extends Controller {
     } else {
       Result(
         header = ResponseHeader(OK),
-        body = HttpEntity.Strict(ByteString(json.toString.getBytes()), 
Some(applicationJsonHeader))
+        body = HttpEntity.Strict(ByteString(json.toString.getBytes("UTF-8")), 
Some(applicationJsonHeader))
       ).as(applicationJsonHeader).withHeaders((CONNECTION -> "close") +: 
headers: _*)
     }
 

Reply via email to