getResourceAsStream causes misleading errorInfo wrong # args: should be either: socket ?-myaddr addr

14 views
Skip to first unread message

Brian Brooks

unread,
Feb 22, 2016, 2:20:16 PM2/22/16
to jtcl-project
First, thank you for JTCL.  We're migrating a TCL-based app from C to Java and would really be in a bind without JTCL.

While getting acquainted with JTCL, I just spent a few hours debugging a misleading error message

java.lang.Exception: wrong # args: should be either:
socket ?-myaddr addr? ?-myport myport? ?-async? host port
socket -server command ?-myaddr addr? port
    while executing
"socket"
while running tcltest

in which the root cause is really (sort of a "classpath" problem caused by testing in an bndtools OSGi test environment)

tcl.lang.TclException: cannot read resource "/tcl/lang/cmd/append.test"

Such a misleading error message could be avoided if when the getResourceAsStream fails in tcl.lang.Interp#evalResource(), evalResource() overwrote the errorInfo with something like

  Interp#setVar("errorInfo", "tcl.lang.TclException: cannot read resource \"/tcl/lang/cmd/append.test\"", TCL.GLOBAL_ONLY);

Would such a JTCL code change make sense?  If so, I can put together a Pull Request with the change.

Sincerely,
Brian Brooks

Dan Bodoh

unread,
Feb 28, 2016, 9:08:40 AM2/28/16
to Brian Brooks, jtcl-project
I haven't done anything on JTCL recently, but your suggestion sounds reasonable.  You'll want to make sure that the tests pass, which look for error messages.  I'd guess this particular type of error is not part of the test suite.

Dan Bodoh

--
You received this message because you are subscribed to the Google Groups "jtcl-project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jtcl-project...@googlegroups.com.
To post to this group, send email to jtcl-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/jtcl-project.
To view this discussion on the web visit https://groups.google.com/d/msgid/jtcl-project/489f30cd-f0be-423a-8c60-89887896e831%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages