Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g255R-0002Ey-2X for pgsql-pkg-debian@arkaria.postgresql.org; Tue, 18 Sep 2018 01:45:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g255P-0006ot-BI for pgsql-pkg-debian@arkaria.postgresql.org; Tue, 18 Sep 2018 01:45:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g255O-0006o8-0D for pgsql-pkg-debian@lists.postgresql.org; Tue, 18 Sep 2018 01:45:55 +0000 Received: from bay.acenet.us ([173.230.252.50]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g255G-0003Rx-Kn for pgsql-pkg-debian@postgresql.org; Tue, 18 Sep 2018 01:45:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ikjgJLO6yqsJtcogwMeR3yHth1rkLSp/QcgGN6GlKmg=; b=qQ7Nxcvo1rxtQFZRaBZo3EJQIJ 83Y8Y03RUVaiVvMZv2tZ1ZhINYGdg8GUi0TfznF6vgr7dve5bhZrRkFkzpahh1JGWY59Rg+3wLjBt 1o80PhwQAFXoCxdQbEmKTJVaQXIw7o3+IuRnZdORujpEpfsUlx9iXuKAJuclsECFT1VIEnnyDzt8Z 76x1CFFfAlj36K3/e1XFFNXgLrSvRJ7H7n0yU8w4bmWHFjn2w6y5v+fF1nAEDUeZgPOPxHk9vuSn8 QrNktBnXeDMu/LrhBrNVrdVVqfkFUDr7GxAoNDBrTHlMptWKMHmAlpSxN9mhaQERnfRuhS/pASatU YaH7hhFQ==; Received: from [50.127.85.184] (port=55584) by bay.acenet.us with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1g255D-009gz1-2w; Mon, 17 Sep 2018 21:45:44 -0400 Subject: Re: PL/Java 1.5.1_BETA2 To: Christoph Berg , pgsql-pkg-debian@postgresql.org References: <5B96B226.2080803@anastigmatix.net> <20180915203221.GA19015@msg.df7cb.de> <5B9D73A2.2090402@anastigmatix.net> <20180916201808.GA30681@msg.df7cb.de> <20180916202733.GB30681@msg.df7cb.de> <5B9ED559.5080208@anastigmatix.net> <20180917144716.GF27331@msg.df7cb.de> From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5BA058C6.8010807@anastigmatix.net> Date: Mon, 17 Sep 2018 21:45:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <20180917144716.GF27331@msg.df7cb.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-96.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap+anastigmatix.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 09/17/18 10:47, Christoph Berg wrote: > Re: Chapman Flack 2018-09-17 <5B9ED559.5080208@anastigmatix.net> >> computedPath = replacement + computedPath.slice(plen); >> to >> computedPath = new java.lang.String(replacement + computedPath.slice(plen)); > > ClassCastException: sun.org.mozilla.javascript.NativeJavaObject cannot be cast to java.lang.String I have no words. :) One more (less intuitive) thing might be worth trying: computedPath = String(replacement + computedPath.slice(plen)); Would you have time to try it that way? I can't make the exception happen here, even with an Oracle jdk7 that is installed. Correction ... I can make it happen (prior to this change) in an icedtea-6 build installed here, with a dubious version of the Rhino-to-JSR223 adapter jar. And the change above to String(...) does seem to fix it (without breaking any of the other versions I can test). I was first guessing the issue would be the change of the bundled JavaScript implementation from Rhino in jdk6/7 to Nashorn in jdk8. But in both cases there is also an adapter layer so that the Java JSR223 API is the same whether Rhino or Nashorn is underneath. And the pre-jdk8 OpenJDK builds seem to have ended up with an older, incomplete version of the Rhino adapter (rhino-js-engine.jar) than what was in the Oracle builds, and it doesn't handle all of the data type conversions as it should. Apparently it will correctly convert a JavaScript String to a Java String. Apparently it does *not* know what to do with a JavaScript wrapper of an actual Java string. :) And it seems Rhino has a clever object, this ConsString, that is an implementation detail of a JavaScript string created efficiently by concatenation, and of course the adapter doesn't know what to do with that either. So using that to construct a brand new ordinary JavaScript String seems to be the one way to get a successful conversion. -Chap