From issues-return-68871-archive-asf-public=cust-asf.ponee.io@commons.apache.org Sat Jul 28 07:02:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 41661180600 for ; Sat, 28 Jul 2018 07:02:04 +0200 (CEST) Received: (qmail 92733 invoked by uid 500); 28 Jul 2018 05:02:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 92719 invoked by uid 99); 28 Jul 2018 05:02:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Jul 2018 05:02:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 7EBB8180448 for ; Sat, 28 Jul 2018 05:02:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ZCvXlAWr0DEW for ; Sat, 28 Jul 2018 05:02:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 8D50A5F1F7 for ; Sat, 28 Jul 2018 05:02:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id F0038E2600 for ; Sat, 28 Jul 2018 05:02:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 27B3C27756 for ; Sat, 28 Jul 2018 05:02:00 +0000 (UTC) Date: Sat, 28 Jul 2018 05:02:00 +0000 (UTC) From: "Gary Gregory (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (BCEL-304) ClassPath.getClassFile does not work with JDK 9 and higher MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/BCEL-304?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Gary Gregory resolved BCEL-304. ------------------------------- Resolution: Fixed Assignee: Gary Gregory Fix Version/s: 6.3 I applied a=C2=A0quite reworked version of the patch and changed this ticke= t description to say "JDK" instead of "Java". Dealing with a JRE will be in= a new ticket. > ClassPath.getClassFile does not work with JDK 9 and higher > ---------------------------------------------------------- > > Key: BCEL-304 > URL: https://issues.apache.org/jira/browse/BCEL-304 > Project: Commons BCEL > Issue Type: Bug > Components: Main > Affects Versions: 6.2 > Reporter: Ed Pavlak > Assignee: Gary Gregory > Priority: Major > Fix For: 6.3 > > > When trying to get the class file for Java classes (ie. java.lang.String)= , an IOException is thrown: > Exception in thread "main" java.io.IOException: Couldn't find: java.lang.= String.class > at org.apache.bcel.util.ClassPath.getClassFile(ClassPath.java:279) > at org.apache.bcel.util.ClassPath.getClassFile(ClassPath.java:301) > at bcel.test.GetClassFileTest.main(GetClassFileTest.java:12) > =C2=A0 > The root cause appears to be the restructuring of Java starting with Java= 9. Specifically, the removal of the rt.jar. The above excpetion can be rep= roduced using a simple application: > package bcel.test; > import java.io.IOException; > import org.apache.bcel.util.ClassPath; > public class GetClassFileTest { > =C2=A0 =C2=A0public static void main(String[] args) throws IOException { > =C2=A0 =C2=A0 =C2=A0 String className =3D "java.lang.String"; > =C2=A0 =C2=A0 =C2=A0 System.out.println("Looking up ClassPath.ClassFile f= or: " + className); > =C2=A0 =C2=A0 =C2=A0 ClassPath.ClassFile classFile =3D ClassPath.SYSTEM_C= LASS_PATH.getClassFile(className); > =C2=A0 =C2=A0 =C2=A0 if (classFile !=3D null) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0System.out.println("Class file base: " = + classFile.getBase()); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0System.out.println("Class file path: " = + classFile.getPath()); > =C2=A0 =C2=A0 =C2=A0 } > =C2=A0 =C2=A0} > } > =C2=A0 > Running this on Java 8 produces the following output, whereas running it = on Java 9+ produces the IOException: > Class file base: C:\jdk1.8.0_161\jre\lib\rt.jar > Class file path: java/lang/String.class -- This message was sent by Atlassian JIRA (v7.6.3#76005)