Bug 93030 [Import/Export] Tarfile Inputstream Broken
There appears to be issues with a InputSource created from a TarFile input stream. Steps to reproduce: 1. Export a project as a tar or tar.gz 2. Go File > Import > Import Existing Project, and select the archived project to be imported. Then click finish. 3. Fails The problem is the .project is not parsed correctly in the archived files. This is handled in org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage with the call, if (projectArchiveFile != null) { newDescription = IDEWorkbenchPlugin.getPluginWorkspace() .loadProjectDescription( provider.getContents(projectArchiveFile)); which goes to org.eclipse.core.internal.resources.Workspace result = new ProjectDescriptionReader().read(new InputSource(stream)); Here result is returned as null when is should be a ProjectDescription, this is because the SAXParser fails to parse the InputSource created from the InputStream of the TarFile as gotten with TarLeveledStructureProvider.getContents(Object element) Zip and Tar files seem to be dealt with identically which suggests the problem lies somewhere in the handling of the Tar format itself.
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/TarInputStream.java
* @throws TarException
	 * @throws IOException
	 */
	boolean skipToEntry(TarEntry entry) throws TarException, IOException {
		int bytestoskip = entry.filepos - bytesread;
		if(bytestoskip < 0) return false;
		while(bytestoskip > 0) {
			long ret = in.skip(bytestoskip);
			if(ret < 0) {
				throw new IOException("early end of stream"); 
			}
			bytestoskip -= ret;
			bytesread += ret;
		}
		filepos = entry.filepos;
		nextEntry = 0;
		nextEOF = 0;
		TarEntry foundEntry = getNextEntry();
		if(!foundEntry.getName().equals(entry.getName())) {
			throw new IOException("inconsistent file"); 
		}
		return true;
	}
	/**
	 * Returns true if the header checksum is correct.
	 * 
	 * @param header
	 * @return true if this header has a valid checksum
	 */
	private boolean isValidTarHeader(byte[] header) {