Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 21974 invoked from network); 14 May 2007 17:46:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 May 2007 17:46:42 -0000 Received: (qmail 94164 invoked by uid 500); 14 May 2007 17:46:47 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 93807 invoked by uid 500); 14 May 2007 17:46:45 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 93761 invoked by uid 99); 14 May 2007 17:46:44 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 May 2007 10:46:44 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 May 2007 10:46:37 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4B65A714068 for ; Mon, 14 May 2007 10:46:17 -0700 (PDT) Message-ID: <6180131.1179164777305.JavaMail.jira@brutus> Date: Mon, 14 May 2007 10:46:17 -0700 (PDT) From: "Myrna van Lunteren (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-2265) bad logic in jvm:guessWSHome() in old test harness affects j9 runs In-Reply-To: <9788527.1169579449048.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Myrna van Lunteren updated DERBY-2265: -------------------------------------- Component/s: Test > bad logic in jvm:guessWSHome() in old test harness affects j9 runs > ------------------------------------------------------------------ > > Key: DERBY-2265 > URL: https://issues.apache.org/jira/browse/DERBY-2265 > Project: Derby > Issue Type: Bug > Components: Test > Affects Versions: 10.3.0.0 > Environment: wctme5.7_foundation (j2ME 1.0) or weme6.1 (foundation, j2ME 1.1) > Reporter: Myrna van Lunteren > Assigned To: Myrna van Lunteren > Priority: Minor > Fix For: 10.3.0.0 > > Attachments: DERBY-2265_20070123.diff > > > Running derbyall using either wcmte5.7_foundation or weme6.1 results in the following stack trace. > Exception in thread "main" java.lang.StringIndexOutOfBoundsException > at java.lang.String.substring(String.java:1043) > at org.apache.derbyTesting.functionTests.harness.jvm.guessWSHome(jvm.java:301) > at org.apache.derbyTesting.functionTests.harness.jvm.getSecurityProps(jvm.java:356) > at org.apache.derbyTesting.functionTests.harness.jvm.setSecurityProps(jvm.java:336) > at org.apache.derbyTesting.functionTests.harness.RunTest.buildTestCommand(RunTest.java:2350) > at org.apache.derbyTesting.functionTests.harness.RunTest.testRun(RunTest.java:498) > at org.apache.derbyTesting.functionTests.harness.RunTest.main(RunTest.java:368) > I think this code was not reached until various security related changes recently, but the code is just bad. > I think this code was used at one point to attempt to kick off another jvm to run a server with, but that is now defunct. > Rather than try to make the code work, or try to clean it up, I'd rather spend time converting tests to the junit framework, so I will just fix this up so we don't hit the error. > The bad code is: > wshome = jhome.substring(0,jhome.indexOf(sep + "jre")); > wshome = wshome.substring(0,wshome.lastIndexOf(sep)); > If the jhome ( System.getProperty("java.home")) does not contain 'jre', we will get -1 as the 2nd parameter in jhome.substring, and thus cause the ArrayIndexOutOfBounds. > I propose to fix this piece of code as follows: > int havejre=jhome.indexOf(sep + "jre"); > if (havejre > 0) > { > wshome = jhome.substring(0,jhome.indexOf(sep + "jre")); > wshome = wshome.substring(0,wshome.lastIndexOf(sep)); > } > else > wshome = jhome.substring(0,jhome.lastIndexOf(sep)); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.