Skip to content

Commit

Permalink
Fix string encoding in ShellBolt protocol (send UTF-8).
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoo committed Feb 1, 2012
1 parent ee8eaa8 commit 9fad0f2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/jvm/backtype/storm/task/ShellBolt.java
Expand Up @@ -54,7 +54,7 @@ public class ShellBolt implements IBolt {
OutputCollector _collector;
Map<Long, Tuple> _inputs = new HashMap<Long, Tuple>();
String[] command;

public ShellBolt(ShellComponent component) {
this(component.get_execution_command(), component.get_script());
}
Expand Down Expand Up @@ -183,7 +183,9 @@ public void cleanup() {
}

private void sendToSubprocess(String str) throws IOException {
_processin.writeBytes(str + "\n");
byte[] strBytes = str.getBytes("UTF-8");
_processin.write(strBytes, 0, strBytes.length);
_processin.writeBytes("\n");
_processin.writeBytes("end\n");
_processin.flush();
}
Expand Down

0 comments on commit 9fad0f2

Please sign in to comment.