Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A7C5B200BA3 for ; Wed, 5 Oct 2016 14:15:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A660C160ADB; Wed, 5 Oct 2016 12:15:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E52E3160ADE for ; Wed, 5 Oct 2016 14:15:26 +0200 (CEST) Received: (qmail 30102 invoked by uid 500); 5 Oct 2016 12:15:20 -0000 Mailing-List: contact notifications-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list notifications@groovy.apache.org Received: (qmail 30078 invoked by uid 99); 5 Oct 2016 12:15:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2016 12:15:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 8C6712C0032 for ; Wed, 5 Oct 2016 12:15:20 +0000 (UTC) Date: Wed, 5 Oct 2016 12:15:20 +0000 (UTC) From: "Jochen Theodorou (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (GROOVY-7959) ResourceBundle.getBundle(String, Locale) fails inside Groovy constructor (MissingResourceException) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 05 Oct 2016 12:15:27 -0000 [ https://issues.apache.org/jira/browse/GROOVY-7959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jochen Theodorou resolved GROOVY-7959. -------------------------------------- Resolution: Won't Fix Assignee: Jochen Theodorou The problem is that the place of the call to getBundle decides over what classloader is used to actually look for the resource bundle. In Java this works, because there is nothing in between. In Groovy there might be the runtime in between. If the runtime is loaded in another classloader, you may get into trouble here. We cannot completely solve this unless the indy version of Groovy is used. So instead I suggest you use the getBundle method, which takes a class loader and give the current class loader (this.class.classloader or in a static context this.classloader) as third parameter. > ResourceBundle.getBundle(String, Locale) fails inside Groovy constructor (MissingResourceException) > --------------------------------------------------------------------------------------------------- > > Key: GROOVY-7959 > URL: https://issues.apache.org/jira/browse/GROOVY-7959 > Project: Groovy > Issue Type: Bug > Components: groovy-jdk > Affects Versions: 2.4.7 > Environment: Groovy Version: 2.4.7 > JVM: 1.8.0_102 > Reporter: Jonas Havers > Assignee: Jochen Theodorou > Priority: Minor > > Groovy throws a {{MissingResourceException}} when invoking {{ResourceBundle.getBundle(String, Locale)}} to get an existing {{ResourceBundle}} inside a constructor. > {code} > Caught: java.util.MissingResourceException: Can't find bundle for base name [...] > {code} > Please see *[this gist|https://gist.github.com/JonasHavers/45713ba48f85a4e6852d0565e111bca3]* for an example and the comparison to Java. > There might be an issue with the {{getBundle(ResourceBundle, String, Locale)}} method from the {{org.codehaus.groovy.runtime.DefaultGroovyStaticMethods}} class. -- This message was sent by Atlassian JIRA (v6.3.4#6332)