Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UnsupportedOperationException bug #3

Merged
merged 2 commits into from
Nov 16, 2012
Merged

Fix UnsupportedOperationException bug #3

merged 2 commits into from
Nov 16, 2012

Conversation

xuwei-k
Copy link
Contributor

@xuwei-k xuwei-k commented Nov 16, 2012

このtree

ef10b40

の状態でtestすると以下のようなエラーがでます

[info] - test normal 1 *** FAILED ***                                                                     
[info]   java.lang.UnsupportedOperationException:                                                         
[info]   at java.util.AbstractMap.put(AbstractMap.java:186)                                               
[info]   at org.fluentd.logger.scala.FluentLogger.log(FluentLogger.scala:17)                              
[info]   at org.fluentd.logger.scala.FluentLogger.log(FluentLogger.scala:12)                              
[info]   at org.fluentd.logger.scala.FluentLoggerSuite$$anonfun$1.apply$mcV$sp(FluentLoggerSuite.scala:46)
[info]   at org.fluentd.logger.scala.FluentLoggerSuite$$anonfun$1.apply(FluentLoggerSuite.scala:32)       
[info]   at org.fluentd.logger.scala.FluentLoggerSuite$$anonfun$1.apply(FluentLoggerSuite.scala:32)       
[info]   at org.scalatest.FunSuite$$anon$1.apply(FunSuite.scala:1265)                                     
[info]   at org.scalatest.Suite$class.withFixture(Suite.scala:1974)                                       
[info]   at org.fluentd.logger.scala.FluentLoggerSuite.withFixture(FluentLoggerSuite.scala:29)            
[info]   at org.scalatest.FunSuite$class.invokeWithFixture$1(FunSuite.scala:1262)                         

ここ

https://github.com/oza/fluent-logger-scala/blob/4915e4e34e1a94af92623db24c7cf27c26a4297a/src/main/scala/org/fluentd/logger/scala/FluentLogger.scala#L16-L18

で、まず scala の immutable な Map に対して put を呼ぶ => つまり java.util.Map に暗黙変換して、そのメソッドを呼んでますが、 scalaのimmutableな Map から java.util.Map に暗黙変換しても、型がjava.util.Map になっただけで実態はimmutableなので、これでは 必ず UnsupportedOperationException がでます。

oza added a commit that referenced this pull request Nov 16, 2012
Fixed UnsupportedOperationException when treating immutable Map object.
@oza oza merged commit 7adda5f into fluent:master Nov 16, 2012
@oza
Copy link
Member

oza commented Nov 16, 2012

Thanks for your pull request! I got it and merged it.

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.

None yet

2 participants