Skip to content

Commit

Permalink
FLUME-1729. Better Flume-Spark integration.
Browse files Browse the repository at this point in the history
Use readFully instead of read in EventTransformer.
  • Loading branch information
harishreedharan committed Jun 16, 2014
1 parent 3c23c18 commit 0d69604
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ object EventTransformer extends Logging {
Array[Byte]) = {
val bodyLength = in.readInt()
val bodyBuff = new Array[Byte](bodyLength)
in.read(bodyBuff)
in.readFully(bodyBuff)

val numHeaders = in.readInt()
val headers = new java.util.HashMap[CharSequence, CharSequence]

for (i <- 0 until numHeaders) {
val keyLength = in.readInt()
val keyBuff = new Array[Byte](keyLength)
in.read(keyBuff)
in.readFully(keyBuff)
val key: String = Utils.deserialize(keyBuff)

val valLength = in.readInt()
val valBuff = new Array[Byte](valLength)
in.read(valBuff)
in.readFully(valBuff)
val value: String = Utils.deserialize(valBuff)

headers.put(key, value)
Expand Down

0 comments on commit 0d69604

Please sign in to comment.