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

Repeated cause getting in ModuleSerializationProxy #12553

Closed
djspiewak opened this issue Mar 13, 2022 · 2 comments · Fixed by scala/scala#9970
Closed

Repeated cause getting in ModuleSerializationProxy #12553

djspiewak opened this issue Mar 13, 2022 · 2 comments · Fixed by scala/scala#9970
Assignees
Milestone

Comments

@djspiewak
Copy link

Specifically, note the following:

    override protected def computeValue(cls: Class[_]): Object =
      try getModule(cls)
      catch {
        case e: PrivilegedActionException =>
          rethrowRuntime(e.getCause)
      }

And then in rethrowRuntime:

  private def rethrowRuntime(e: Throwable): Object = {
    val cause = e.getCause
    cause match {
      case exception: RuntimeException => throw exception
      case _ => throw new RuntimeException(cause)
    }
  }

You'll note that we're doing getCause twice here. I'm not sure that this is actually correct, since it would seem to mask the inner exception. Poking @retronym for clarification. I can definitely confirm that, when this code path is hit, the exception it generates is very unhelpful and does not contain the initial cause.

@lrytz
Copy link
Member

lrytz commented Mar 14, 2022

PR that added this code: scala/scala#7297

@lrytz
Copy link
Member

lrytz commented Mar 14, 2022

Pretty sure it's "just" an oversight

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 a pull request may close this issue.

2 participants