Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339862

Summary: Ugly printout during creation of artifact repositories.
Product: [Eclipse Project] Equinox Reporter: Thomas Hallgren <thomas>
Component: p2Assignee: Pascal Rapicault <pascal>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: adreghiciu, kking1276, matthias.gradl, pascal, pwebster
Version: 3.7   
Target Milestone: 3.7   
Hardware: All   
OS: All   
Whiteboard:

Description Thomas Hallgren CLA 2011-03-14 06:29:37 EDT
When using the director to install a product into a non existing location, the install succeeds but it prints this message before it completes:

[Fatal Error] :1:1: Premature end of file.

This is what happens:

The directory application asks the ArtifactRepositoryManager if it contains the URI of a repository. The manager, instead of just returning false, creates a SimpleArtifactRepository in the cache. During that creation, the repository calls it's getRules() method. That method makes an attempt to load the repository that is about to be created. Since the file already exists (an OutputStream has been opened), it goes all the way down to parsing where it eventually fails with the given message. The failure is ignored by the doLoad() call and the processing continues.

The code that tries to parse the file that is already opened for output is flawed. Either the repository is about to be created or it's about to be parsed. Doing both in the same operation will always yield a parse failure since the opening for writing happens first and it truncates the file.

AFAICT, this is a regression in 3.7. I never saw this message when installing using the 3.6 director.

Full stack trace at the point where the message is printed:

Thread [main] (Suspended)	
	XMLDocumentScannerImpl$PrologDriver.next() line: 1034	
	XMLNSDocumentScannerImpl(XMLDocumentScannerImpl).next() line: 625	
	XMLNSDocumentScannerImpl.next() line: 116	
	XMLNSDocumentScannerImpl(XMLDocumentFragmentScannerImpl).scanDocument(boolean) line: 488	
	XIncludeAwareParserConfiguration(XML11Configuration).parse(boolean) line: 812	
	XIncludeAwareParserConfiguration(XML11Configuration).parse(XMLInputSource) line: 741	
	SAXParserImpl$JAXPSAXParser(XMLParser).parse(XMLInputSource) line: 123	
	SAXParserImpl$JAXPSAXParser(AbstractSAXParser).parse(InputSource) line: 1208	
	SAXParserImpl$JAXPSAXParser.parse(InputSource) line: 525	
	SimpleArtifactRepositoryIO$Parser.parse(InputStream) line: 316	
	SimpleArtifactRepositoryIO.read(URI, InputStream, IProgressMonitor, boolean) line: 100	
	SimpleArtifactRepositoryFactory.load(URI, int, IProgressMonitor, boolean) line: 107	
	SimpleArtifactRepository.doLoad(IProgressMonitor) line: 1457	
	SimpleArtifactRepository.load(IProgressMonitor) line: 1414	
	SimpleArtifactRepository.getRules() line: 906	
	SimpleArtifactRepositoryIO$Writer.write(SimpleArtifactRepository) line: 242	
	SimpleArtifactRepositoryIO.write(SimpleArtifactRepository, OutputStream) line: 63	
	SimpleArtifactRepository.save(boolean) line: 1149	
	SimpleArtifactRepository.save() line: 1116	
	SimpleArtifactRepository.<init>(IProvisioningAgent, String, URI, Map) line: 344	
	SimpleArtifactRepositoryFactory.create(URI, String, String, Map) line: 133	
	ArtifactRepositoryManager.factoryCreate(URI, String, String, Map, IExtension) line: 61	
	ArtifactRepositoryManager(AbstractRepositoryManager).doCreateRepository(URI, String, String, Map) line: 286	
	ArtifactRepositoryManager.createRepository(URI, String, String, Map) line: 49	
	ArtifactRepositoryManager.restoreSpecialRepositories() line: 133	
	ArtifactRepositoryManager(AbstractRepositoryManager).restoreRepositories() line: 992	
	ArtifactRepositoryManager(AbstractRepositoryManager).contains(URI) line: 254	
	DirectorApplication.initializeRepositories() line: 400	
	DirectorApplication.run(String[]) line: 852	
	DirectorApplication.start(IApplicationContext) line: 1036	
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 344	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
	Method.invoke(Object, Object...) line: 616	
	Main.invokeFramework(String[], URL[]) line: 622	
	Main.basicRun(String[]) line: 577	
	Main.run(String[]) line: 1410	
	Main.main(String[]) line: 1386
Comment 1 Thomas Hallgren CLA 2011-03-14 07:54:38 EDT
Changed the title since this problem isn't related to install at all. It manifests itself in many different ways. I think the printout comes whenever a SimpleArtifactRepository is created.
Comment 2 Kim Moir CLA 2011-03-14 08:26:50 EDT
*** Bug 339673 has been marked as a duplicate of this bug. ***
Comment 3 Thomas Hallgren CLA 2011-03-16 13:38:23 EDT
*** Bug 340197 has been marked as a duplicate of this bug. ***
Comment 4 Thomas Hallgren CLA 2011-04-02 02:40:19 EDT
This has been addressed in bug 341508.

*** This bug has been marked as a duplicate of bug 341508 ***