Backported fix for bug 281867.
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/jarpackager/JarPackageData.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/jarpackager/JarPackageData.java
index fb12464..68e2576 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/jarpackager/JarPackageData.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/jarpackager/JarPackageData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,6 +23,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.operation.IRunnableContext;
@@ -310,17 +311,19 @@
* @since 3.0
*/
public IPath getAbsoluteJarLocation() {
- if (!fJarLocation.isAbsolute() && fJarLocation.segmentCount() >= 2) {
- // reverse of AbstractJarDestinationWizardPage#handleDestinationBrowseButtonPressed()
- IFile file= ResourcesPlugin.getWorkspace().getRoot().getFile(fJarLocation);
- IPath absolutePath= file.getLocation();
- if (absolutePath != null) {
- return absolutePath;
- } else {
- // The path does not exist in the workspace (e.g. because there's no such project).
- // Fallback is to just append the path to the workspace root.
- return ResourcesPlugin.getWorkspace().getRoot().getLocation().append(fJarLocation);
+ if (!fJarLocation.isAbsolute()) {
+ IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
+ if (fJarLocation.segmentCount() >= 2 && !"..".equals(fJarLocation.segment(0))) { //$NON-NLS-1$
+ // reverse of AbstractJarDestinationWizardPage#handleDestinationBrowseButtonPressed()
+ IFile file= root.getFile(fJarLocation);
+ IPath absolutePath= file.getLocation();
+ if (absolutePath != null) {
+ return absolutePath;
+ }
}
+ // The path does not exist in the workspace (e.g. because there's no such project).
+ // Fallback is to just append the path to the workspace root.
+ return root.getLocation().append(fJarLocation);
}
return fJarLocation;
}