Skip to content

Commit

Permalink
Fix Channel.getAll to correctly convert results to Orc values.
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurp committed Feb 17, 2017
1 parent b8e3770 commit a84754f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion OrcScala/src/orc/lib/state/Channel.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

package orc.lib.state;

import java.util.ArrayList;
import java.util.LinkedList;

import orc.Handle;
Expand Down Expand Up @@ -152,7 +153,11 @@ public boolean nonBlocking() {
@Override
public Object evaluate(final Args args) throws TokenException {
synchronized (ChannelInstance.this) {
final Object out = scala.collection.JavaConversions.collectionAsScalaIterable(contents).toList();
ArrayList<Object> convertedContents = new ArrayList<>(contents.size());
for(Object o : contents) {
convertedContents.add(object2value(o));
}
final Object out = scala.collection.JavaConversions.collectionAsScalaIterable(convertedContents).toList();
contents.clear();
if (closer != null) {
closer.publish(signal());
Expand Down
4 changes: 3 additions & 1 deletion OrcScala/src/orc/run/core/Token.scala
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,9 @@ class Token protected (

def publish(v: Option[AnyRef]) {
v foreach { vv =>
assert(!vv.isInstanceOf[Binding])
assert(!vv.isInstanceOf[Binding], s"Interpreter bug. Triggered at $this")
assert(!vv.isInstanceOf[java.math.BigInteger], s"Type coercion error at $this")
assert(!vv.isInstanceOf[java.math.BigDecimal], s"Type coercion error at $this")
}
state match {
case Blocked(_: OtherwiseGroup) => throw new AssertionError("publish on a pending Token")
Expand Down

0 comments on commit a84754f

Please sign in to comment.