emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] bug fix in ob-groovy.el
@ 2018-02-23 23:16 Nick Dokos
  2018-02-24 20:40 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Dokos @ 2018-02-23 23:16 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 365 bytes --]

The problem was reported in

   https://stackoverflow.com/questions/48893994/groovy-in-org-mode-babel

I reproduced the problem locally. The basic error message is

  Caught: java.lang.ClassFormatError: Illegal class name "groovy-31624d60$isGolden"

The problem is the dash.

The patch replaces dashes with underscores when constructing temp file
names.

-- 
Nick


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ob-groovy.el: replace '-' with '_' in temp file names --]
[-- Type: text/x-patch, Size: 1423 bytes --]

From a4b64486c8f527b04ae915dcc45a3a2ec43d8e62 Mon Sep 17 00:00:00 2001
From: Nick Dokos <ndokos@redhat.com>
Date: Fri, 23 Feb 2018 17:58:27 -0500
Subject: [PATCH] Replace dash by underscore in temp file names.

* org-babel-groovy-evaluate: replace '-' by '_' in temp file names.

Apparently, the JVM uses file names in the construction of names of internal
objects and dashes are illegal in that context. See

   https://stackoverflow.com/questions/48893994/groovy-in-org-mode-babel

for an example.
---
 lisp/ob-groovy.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-groovy.el b/lisp/ob-groovy.el
index 67e7562fb..565b09754 100644
--- a/lisp/ob-groovy.el
+++ b/lisp/ob-groovy.el
@@ -84,12 +84,12 @@ in BODY as elisp."
   (when session (error "Sessions are not (yet) supported for Groovy"))
   (pcase result-type
     (`output
-     (let ((src-file (org-babel-temp-file "groovy-")))
+     (let ((src-file (org-babel-temp-file "groovy_")))
        (progn (with-temp-file src-file (insert body))
               (org-babel-eval
                (concat org-babel-groovy-command " " src-file) ""))))
     (`value
-     (let* ((src-file (org-babel-temp-file "groovy-"))
+     (let* ((src-file (org-babel-temp-file "groovy_"))
             (wrapper (format org-babel-groovy-wrapper-method body)))
        (with-temp-file src-file (insert wrapper))
        (let ((raw (org-babel-eval
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bug fix in ob-groovy.el
  2018-02-23 23:16 [PATCH] bug fix in ob-groovy.el Nick Dokos
@ 2018-02-24 20:40 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2018-02-24 20:40 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Hello,

Nick Dokos <ndokos@gmail.com> writes:

> The problem was reported in
>
>    https://stackoverflow.com/questions/48893994/groovy-in-org-mode-babel
>
> I reproduced the problem locally. The basic error message is
>
>   Caught: java.lang.ClassFormatError: Illegal class name "groovy-31624d60$isGolden"
>
> The problem is the dash.
>
> The patch replaces dashes with underscores when constructing temp file
> names.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-24 20:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-23 23:16 [PATCH] bug fix in ob-groovy.el Nick Dokos
2018-02-24 20:40 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).