Bug 139056

Summary: Compile errors against Foundation 1.0: org.eclipse.update.core
Product: [Eclipse Project] Platform Reporter: DJ Houghton <dj.houghton>
Component: Update (deprecated - use Eclipse>Equinox>p2)Assignee: Branko Tripkovic <btripkov>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: dejan, jeffmcaffer
Version: 3.2   
Target Milestone: 3.2 RC3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 139488    
Attachments:
Description Flags
fix jarprocessor compile problems
none
vm 1.4 Exceptions removed
none
patch for org.eclipse.update.core none

Description DJ Houghton CLA 2006-04-27 15:57:50 EDT
n0426

When compiling the org.eclipse.update.core project with Foundation 1.0 class libraries, we get the following compile errors due to use of JDK 1.4 APIs.

Also there is use of java.nio, java.net.URI, and java.net.URISyntaxException which are only available in JDK 1.4 and greater. If this use is correct, then the code should protect against the code running when these classes are not available.



The method getCause() is undefined for the type CoreException
org.eclipse.update.core/src/org/eclipse/update/internal/mirror
MirrorSite.java
line 249

The method getCause() is undefined for the type CoreException
org.eclipse.update.core/src/org/eclipse/update/internal/mirror
MirrorSite.java
line 249

The method getCause() is undefined for the type CoreException
org.eclipse.update.core/src/org/eclipse/update/internal/mirror
MirrorSite.java
line 296

The method getCause() is undefined for the type CoreException
org.eclipse.update.core/src/org/eclipse/update/internal/mirror
MirrorSite.java
line 296

The method getCause() is undefined for the type Throwable
org.eclipse.update.core/src/org/eclipse/update/core
Utilities.java
line 225

The method getChannel() is undefined for the type FileInputStream
org.eclipse.update.core/src/org/eclipse/update/internal/core
JarDeltaInstallHandler.java
line 94

The method getChannel() is undefined for the type FileOutputStream
org.eclipse.update.core/src/org/eclipse/update/internal/core
JarDeltaInstallHandler.java
line 95

The method getStackTrace() is undefined for the type Throwable
org.eclipse.update.core/src/org/eclipse/update/core
Utilities.java
line 229

The method initCause(Throwable) is undefined for the type CoreException
org.eclipse.update.core/src/org/eclipse/update/core
Utilities.java
line 227

The method split(String) is undefined for the type String
org.eclipse.update.core/src/org/eclipse/update/internal/jarprocessor
PackStep.java
line 94

The method split(String) is undefined for the type String
org.eclipse.update.core/src/org/eclipse/update/internal/jarprocessor
Utils.java
line 154

The method split(String) is undefined for the type String
org.eclipse.update.core/src/org/eclipse/update/internal/jarprocessor
Utils.java
line 169
Comment 1 Andrew Niefer CLA 2006-05-03 10:28:26 EDT
Created attachment 40204 [details]
fix jarprocessor compile problems

This patch fixes the 3 compile problems in the jarprocessor package
Comment 2 Branko Tripkovic CLA 2006-05-03 14:39:29 EDT
Released
Comment 3 Jeff McAffer CLA 2006-05-03 21:00:50 EDT
retro +1.  would be good to get someone else...
Comment 4 Dejan Glozic CLA 2006-05-03 21:06:56 EDT
+1
Comment 5 Branko Tripkovic CLA 2006-05-04 13:57:08 EDT
Created attachment 40391 [details]
vm 1.4 Exceptions removed

This patch takes out getCause(), initCause(),  getStackTrace(), usage from exception handling in MirrorSite and Utilities.
This is the last patch this bug needs so please look at it soon.
Comment 6 DJ Houghton CLA 2006-05-04 14:31:54 EDT
What is the goal of the patch? There are still references to java.nio.* and java.net.* classes that don't exist in foundation. So we still have to compile against the foundation class libraries. Or is that ok and are we just trying to remove some of the references now and will fix the rest later?

The calls to the java.nio.* classes/methods are wrapped in a try/catch block to protect against calling them when they aren't there, but the other code is not protected.

As for the patch itself it looks good except the new class needs a copyright notice.
Comment 7 DJ Houghton CLA 2006-05-04 16:36:54 EDT
Created attachment 40424 [details]
patch for org.eclipse.update.core

Here is a new patch for the project. 

After Branko's changes to remove the references to URI, there were only 6 references to 1.4 APIs. (java.nio.* code) I looked into this and they were isolated to a single class which was just using FileChannel#transferTo.

Based on the comments in bug 137336 comment #19, and based on the fact that if we remove these nio references then we can compile against straight foundation (+xml), I have modified the code to do this.

I also added the copyright to the new exception class.
Comment 8 Dejan Glozic CLA 2006-05-04 17:20:34 EDT
+1 - I think we are ready to go here.
Comment 9 Branko Tripkovic CLA 2006-05-04 17:24:45 EDT
Committed.