| Summary: | Platform#asLocalURL(..) does not work in automated testing framework | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Markus Keller <markus.kell.r> |
| Component: | Runtime | Assignee: | platform-runtime-inbox <platform-runtime-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | critical | ||
| Priority: | P3 | CC: | daniel_megert, martinae |
| Version: | 3.2 | ||
| Target Milestone: | 3.3 M7 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Some additional comments that might help: 1) it started to happen with M20060816-0800 2) M20060816-0800 is the first build containing branched JDT UI test projects. The projects are tagged with "r321_v20060816" (and "r321_v20060824"). 3) the JDT test projects do not have a MANIFEST.MF (i.e. still old style) I could reproduce it in the debugger:
- Extract the binary test plugins from eclipse-Automated-Tests-M20060823-1200.zip into the plugin folder of the M20060823 install.
- Run with this install on an empty workspace
- PDE will use the own install as target platform (default setting).
- create a plugin 'test' that requires org.eclipse.jdt.ui.tests, org.junit, org.eclipse.jdt.core
- create a test in 'test' that calls
JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/rtstubs15.jar"));
Problem is in
PlatformURLPluginConnection(PlatformURLConnection).getId(String) line: 324
To compute the plugin id from 'org.eclipse.jdt.ui.tests_3.2.1.r321_v20060816'
spec.lastIndexOf('_'); is used.
-> id evaluated as 'org.eclipse.jdt.ui.tests_3.2.1.r321'
PlatformURLPluginConnection(PlatformURLConnection).getId(String) line: 324
PlatformURLPluginConnection.resolve() line: 55
PlatformURLHandler.openConnection(URL) line: 67
URLStreamHandlerProxy.openConnection(URL) line: 109
URL.openConnection() line: 943 [local variables unavailable]
PlatformURLConverter.toFileURL(URL) line: 33
FileLocator.toFileURL(URL) line: 126
Platform.asLocalURL(URL) line: 525
JavaTestPlugin.getFileInPlugin(IPath) line: 58
The problematic URL is the result of plugin.getDescriptor().getInstallURL(). If works with 'plugin.getBundle().getEntry("/")'
Tom and I looked into this and its similar to the problems we were having in bug 135180. Bug 135180 comment #24 contains an interesting algorithm that we should consider adopting in PlatformURLPluginConnection. I have written a test case for this and verified that it fails not only in 3.2, but in previous releases including 3.0.2. Markus, we would like to fix this in 3.3 unless you really want to push for 3.2.1. Thoughts? We changed all our tests to use plugin.getBundle().getEntry("/")
In 3.2.1 and 3.3.
Markus is away this week. JDT Text an JDT UI released a workaround for this problem into 3.2.1 and a rebuild is currently taking place. Whether to put this into 3.2.1 should depend on whether other clients are affected by this. Since this has been a problem for a couple of years now and you guys are the first client to come across this, I'm going to mark it as 3.3. Thanks. Fixed in HEAD. |
M20060823-1200 org.eclipse.jdt.text.tests, org.eclipse.jdt.ui.tests.refactoring, and org.eclipse.jdt.ui.tests produce failures in this build when run with the automated testing framework. The same tests are running fine when they are executed locally. Unfortunately, the cause of the failure is not visible in the test results, since our test code swallows the original exception. I have a fix for that and I'll release the improved code to R3_2_maintenance of org.eclipse.jdt.ui.tests in a minute. With the improvement in JavaTestPlugin#getFileInPlugin(..), the exception below is logged. My fix also adds a fallback that replaces the deprecated... URL installURL= new URL(getDescriptor().getInstallURL(), path.toString()); URL localURL= Platform.asLocalURL(installURL); return new File(localURL.getFile()); ... by a non-deprecated version. I think my fallback should make our tests work again, but the original problem with the deprecated core.runtime code needs to be investigated. A possible cause for the exception could be that we've branched org.eclipse.jdt.ui.tests and used the tag r321_v20060816, which includes an '_'. Note that the (deprecated) code used to work fine for years before. !SESSION 2006-08-24 19:07:28.501 ----------------------------------------------- eclipse.buildId=M20060823-1200 java.version=1.5.0_07 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_CH Framework arguments: -application org.eclipse.test.uitestapplication formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,org.eclipse.jdt.text.tests.JdtTextTestSuite.xml -testPluginName org.eclipse.jdt.text.tests -className org.eclipse.jdt.text.tests.JdtTextTestSuite Command-line arguments: -application org.eclipse.test.uitestapplication -dev bin -data C:\e\i\test\eclipse-testing/test-eclipse/eclipse/jdt_text_folder formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,org.eclipse.jdt.text.tests.JdtTextTestSuite.xml -testPluginName org.eclipse.jdt.text.tests -className org.eclipse.jdt.text.tests.JdtTextTestSuite -os win32 -ws win32 -arch x86 -consolelog !ENTRY org.eclipse.jdt.ui.tests 4 4 2006-08-24 19:07:49.476 !MESSAGE Unable to resolve plug-in "platform:/plugin/org.eclipse.jdt.ui.tests_3.2.1.r321_v20060816/testresources/rtstubs15.jar". !STACK 0 java.io.IOException: Unable to resolve plug-in "platform:/plugin/org.eclipse.jdt.ui.tests_3.2.1.r321_v20060816/testresources/rtstubs15.jar". at org.eclipse.core.internal.runtime.PlatformURLPluginConnection.resolve(PlatformURLPluginConnection.java:61) at org.eclipse.core.internal.boot.PlatformURLHandler.openConnection(PlatformURLHandler.java:67) at org.eclipse.osgi.framework.internal.protocol.URLStreamHandlerProxy.openConnection(URLStreamHandlerProxy.java:109) at java.net.URL.openConnection(URL.java:943) at org.eclipse.core.internal.runtime.PlatformURLConverter.toFileURL(PlatformURLConverter.java:33) at org.eclipse.core.runtime.FileLocator.toFileURL(FileLocator.java:126) at org.eclipse.core.runtime.Platform.asLocalURL(Platform.java:525) at org.eclipse.jdt.testplugin.JavaTestPlugin.getFileInPlugin(JavaTestPlugin.java:59) at org.eclipse.jdt.testplugin.JavaProjectHelper.findRtJar(JavaProjectHelper.java:674) at org.eclipse.jdt.testplugin.JavaProjectHelper.addVariableRTJar(JavaProjectHelper.java:596) at org.eclipse.jdt.testplugin.JavaProjectHelper.addVariableRTJar(JavaProjectHelper.java:579) at org.eclipse.jdt.testplugin.JavaProjectHelper.createJavaProjectWithJUnitSource(JavaProjectHelper.java:162) at org.eclipse.jdt.text.tests.JUnitProjectTestSetup.setUp(JUnitProjectTestSetup.java:50) at junit.extensions.TestSetup$1.protect(TestSetup.java:18) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.extensions.TestSetup.run(TestSetup.java:23) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) ..