Skip to content

Fix assert() condition in MessageBufferOutput subclasses - #119

Merged
xerial merged 1 commit into
v07-M1from
fix_message_buffer_output_assert
Jul 13, 2014
Merged

Fix assert() condition in MessageBufferOutput subclasses#119
xerial merged 1 commit into
v07-M1from
fix_message_buffer_output_assert

Conversation

@komamitsu

Copy link
Copy Markdown
Member

The assert() in ChannelBufferOutput/OutputStreamBufferOutput#flush() looks to have a wrong condition. With -ea option on IntelliJ, org.msgpack.core.MessagePackTest("pack/unpack binary") failed.

For sbt, I tried to reproduce but I didn't find a proper way. The following change didn't work...

diff --git a/project/Build.scala b/project/Build.scala
index 21d221b..ce1aba9 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -51,6 +51,7 @@ object Build extends Build {
       //resolvers += Resolver.mavenLocal,
       scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-target:jvm-1.6", "-feature"),
       javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.6", "-target", "1.6"),
+      javaOptions ++= Seq("-ea"),
       pomExtra := {
         <url>http://msgpack.org/</url>
           <licenses>

@xerial

xerial commented Jul 13, 2014

Copy link
Copy Markdown
Member

Good catch!

Regarding sbt, all test cases are running in Scala, so scalaOptions in Test should be modified.

xerial added a commit that referenced this pull request Jul 13, 2014
Fix assert() condition in MessageBufferOutput subclasses
@xerial
xerial merged commit 284b695 into v07-M1 Jul 13, 2014
xerial added a commit that referenced this pull request Jul 14, 2014
@xerial

xerial commented Jul 14, 2014

Copy link
Copy Markdown
Member

Sorry. There is no scalaOptions setting in sbt. And also simply setting javaOptions in Test doesn't work either, because sbt reuses the JVM running the sbt itself.

A bettter approach would be launching the sbt with -ea option.

@xerial
xerial deleted the fix_message_buffer_output_assert branch November 13, 2014 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants