Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content is not allowed in prolog #2938

Closed
basilevs opened this issue Oct 19, 2023 · 8 comments · Fixed by #2945
Closed

Content is not allowed in prolog #2938

basilevs opened this issue Oct 19, 2023 · 8 comments · Fixed by #2945

Comments

@basilevs
Copy link
Contributor

basilevs commented Oct 19, 2023

Tycho fails with SAXParseException: Content is not allowed in prolog when downloading target platform from a composite repository hosted on Github.

Test steps

unzip content-prolog.zip

cd content-prolog
mvn clean package

Expected result

Succesful execution of Maven

Actual result

Failure:

[INFO] Downloading from p2: https://www.pydev.org/update_sites/10.1.3/p2.index
[INFO] Downloading from p2: https://github.com/fabioz/Pydev/releases/download/pydev_10_1_3/p2.index
[Fatal Error] :1:1: Content is not allowed in prolog.
[ERROR] [02f91dfd-aa08-4b30-8106-3f04c5e1c7a4][extension>org.eclipse.tycho:tycho-maven-plugin:4.0.3] Provisioning exception
org.eclipse.equinox.p2.core.ProvisionException: Unable to read repository at file:/Users/vasiligulevich/.m2/repository/.cache/tycho/https/objects.githubusercontent.com/github-production-release-asset-2e65be/7935003/a5422aac-de32-40ef-a51c-5a186359ece6/X-Amz-Algorithm=AWS4-HMAC-SHA256/X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231019%2Fus-east-1%2Fs3%2Faws4_request/X-Amz-Date=20231019T204810Z/X-Amz-Expires=300/X-Amz-Signature=0488d6d3891792e1ab068729e69e7e12531808e4e1e4267f181fd8d5e774446e/X-Amz-SignedHeaders=host/actor_id=0/key_id=0/repo_id=7935003/response-content-disposition=attachment%3B%20filename%3Dcontent.jar/response-content-type=application%2Foctet-stream.
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryIO.read (MetadataRepositoryIO.java:84)
    at org.eclipse.equinox.internal.p2.metadata.repository.SimpleMetadataRepositoryFactory.load (SimpleMetadataRepositoryFactory.java:108)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.factoryLoad (MetadataRepositoryManager.java:63)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:787)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:685)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository (MetadataRepositoryManager.java:110)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:68)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:59)
    at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository.addChild (CompositeMetadataRepository.java:171)
    at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository.<init> (CompositeMetadataRepository.java:113)
    at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory.load (CompositeMetadataRepositoryFactory.java:124)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.factoryLoad (MetadataRepositoryManager.java:63)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:787)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:685)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository (MetadataRepositoryManager.java:110)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:68)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:59)
    at org.eclipse.tycho.p2.resolver.URITargetDefinitionContent.loadMetadataRepositories (URITargetDefinitionContent.java:113)
    at org.eclipse.tycho.p2.resolver.URITargetDefinitionContent.preload (URITargetDefinitionContent.java:77)
    at org.eclipse.tycho.p2.resolver.URITargetDefinitionContent.query (URITargetDefinitionContent.java:62)
    at org.eclipse.equinox.p2.query.CompoundQueryable.getIteratorFromQueryable (CompoundQueryable.java:178)
    at org.eclipse.equinox.p2.query.CompoundQueryable.everything (CompoundQueryable.java:124)
    at org.eclipse.equinox.internal.p2.metadata.expression.RepeatableIterator$IndexProviderIterator.<init> (RepeatableIterator.java:142)
    at org.eclipse.equinox.internal.p2.metadata.expression.RepeatableIterator.create (RepeatableIterator.java:60)
    at org.eclipse.equinox.internal.p2.metadata.expression.Everything.<init> (Everything.java:39)
    at org.eclipse.equinox.internal.p2.metadata.expression.ContextExpression.createContext (ContextExpression.java:48)
    at org.eclipse.equinox.p2.query.ExpressionQuery.perform (ExpressionQuery.java:51)
    at org.eclipse.equinox.internal.p2.metadata.index.IndexProvider.query (IndexProvider.java:26)
    at org.eclipse.equinox.internal.p2.metadata.index.IndexProvider.query (IndexProvider.java:36)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.findUnit (InstallableUnitResolver.java:281)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.findUnits (InstallableUnitResolver.java:261)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.getRootIUs (InstallableUnitResolver.java:254)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.addLocation (InstallableUnitResolver.java:88)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolver.resolveContentWithExceptions (TargetDefinitionResolver.java:151)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolver.resolveContent (TargetDefinitionResolver.java:107)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolverService.resolveFromArguments (TargetDefinitionResolverService.java:96)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent (ConcurrentHashMap.java:1708)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolverService.getTargetDefinitionContent (TargetDefinitionResolverService.java:70)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.resolveTargetDefinitions (TargetPlatformFactoryImpl.java:332)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:214)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:180)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:118)
    at org.eclipse.tycho.p2resolver.ReactorRepositoryManagerImpl.computePreliminaryTargetPlatform (ReactorRepositoryManagerImpl.java:71)
    at org.eclipse.tycho.p2resolver.P2DependencyResolver.computePreliminaryTargetPlatform (P2DependencyResolver.java:215)
    at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject (DefaultTychoResolver.java:101)
    at org.eclipse.tycho.core.maven.TychoProjectExecutionListener.beforeProjectLifecycleExecution (TychoProjectExecutionListener.java:108)
    at org.apache.maven.lifecycle.internal.CompoundProjectExecutionListener.beforeProjectLifecycleExecution (CompoundProjectExecutionListener.java:42)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:103)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: java.io.IOException: Content is not allowed in prolog.
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryIO$Parser.parse (MetadataRepositoryIO.java:212)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryIO.read (MetadataRepositoryIO.java:66)
    at org.eclipse.equinox.internal.p2.metadata.repository.SimpleMetadataRepositoryFactory.load (SimpleMetadataRepositoryFactory.java:108)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.factoryLoad (MetadataRepositoryManager.java:63)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:787)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:685)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository (MetadataRepositoryManager.java:110)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:68)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:59)
    at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository.addChild (CompositeMetadataRepository.java:171)
    at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository.<init> (CompositeMetadataRepository.java:113)
    at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory.load (CompositeMetadataRepositoryFactory.java:124)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.factoryLoad (MetadataRepositoryManager.java:63)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:787)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:685)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository (MetadataRepositoryManager.java:110)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:68)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:59)
    at org.eclipse.tycho.p2.resolver.URITargetDefinitionContent.loadMetadataRepositories (URITargetDefinitionContent.java:113)
    at org.eclipse.tycho.p2.resolver.URITargetDefinitionContent.preload (URITargetDefinitionContent.java:77)
    at org.eclipse.tycho.p2.resolver.URITargetDefinitionContent.query (URITargetDefinitionContent.java:62)
    at org.eclipse.equinox.p2.query.CompoundQueryable.getIteratorFromQueryable (CompoundQueryable.java:178)
    at org.eclipse.equinox.p2.query.CompoundQueryable.everything (CompoundQueryable.java:124)
    at org.eclipse.equinox.internal.p2.metadata.expression.RepeatableIterator$IndexProviderIterator.<init> (RepeatableIterator.java:142)
    at org.eclipse.equinox.internal.p2.metadata.expression.RepeatableIterator.create (RepeatableIterator.java:60)
    at org.eclipse.equinox.internal.p2.metadata.expression.Everything.<init> (Everything.java:39)
    at org.eclipse.equinox.internal.p2.metadata.expression.ContextExpression.createContext (ContextExpression.java:48)
    at org.eclipse.equinox.p2.query.ExpressionQuery.perform (ExpressionQuery.java:51)
    at org.eclipse.equinox.internal.p2.metadata.index.IndexProvider.query (IndexProvider.java:26)
    at org.eclipse.equinox.internal.p2.metadata.index.IndexProvider.query (IndexProvider.java:36)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.findUnit (InstallableUnitResolver.java:281)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.findUnits (InstallableUnitResolver.java:261)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.getRootIUs (InstallableUnitResolver.java:254)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.addLocation (InstallableUnitResolver.java:88)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolver.resolveContentWithExceptions (TargetDefinitionResolver.java:151)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolver.resolveContent (TargetDefinitionResolver.java:107)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolverService.resolveFromArguments (TargetDefinitionResolverService.java:96)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent (ConcurrentHashMap.java:1708)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolverService.getTargetDefinitionContent (TargetDefinitionResolverService.java:70)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.resolveTargetDefinitions (TargetPlatformFactoryImpl.java:332)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:214)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:180)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:118)
    at org.eclipse.tycho.p2resolver.ReactorRepositoryManagerImpl.computePreliminaryTargetPlatform (ReactorRepositoryManagerImpl.java:71)
    at org.eclipse.tycho.p2resolver.P2DependencyResolver.computePreliminaryTargetPlatform (P2DependencyResolver.java:215)
    at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject (DefaultTychoResolver.java:101)
    at org.eclipse.tycho.core.maven.TychoProjectExecutionListener.beforeProjectLifecycleExecution (TychoProjectExecutionListener.java:108)
    at org.apache.maven.lifecycle.internal.CompoundProjectExecutionListener.beforeProjectLifecycleExecution (CompoundProjectExecutionListener.java:42)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:103)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1251)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse (SAXParserImpl.java:637)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryIO$Parser.parse (MetadataRepositoryIO.java:206)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryIO.read (MetadataRepositoryIO.java:66)
    at org.eclipse.equinox.internal.p2.metadata.repository.SimpleMetadataRepositoryFactory.load (SimpleMetadataRepositoryFactory.java:108)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.factoryLoad (MetadataRepositoryManager.java:63)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:787)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:685)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository (MetadataRepositoryManager.java:110)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:68)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:59)
    at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository.addChild (CompositeMetadataRepository.java:171)
    at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository.<init> (CompositeMetadataRepository.java:113)
    at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory.load (CompositeMetadataRepositoryFactory.java:124)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.factoryLoad (MetadataRepositoryManager.java:63)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:787)
    at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository (AbstractRepositoryManager.java:685)
    at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository (MetadataRepositoryManager.java:110)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:68)
    at org.eclipse.tycho.p2maven.transport.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:59)
    at org.eclipse.tycho.p2.resolver.URITargetDefinitionContent.loadMetadataRepositories (URITargetDefinitionContent.java:113)
    at org.eclipse.tycho.p2.resolver.URITargetDefinitionContent.preload (URITargetDefinitionContent.java:77)
    at org.eclipse.tycho.p2.resolver.URITargetDefinitionContent.query (URITargetDefinitionContent.java:62)
    at org.eclipse.equinox.p2.query.CompoundQueryable.getIteratorFromQueryable (CompoundQueryable.java:178)
    at org.eclipse.equinox.p2.query.CompoundQueryable.everything (CompoundQueryable.java:124)
    at org.eclipse.equinox.internal.p2.metadata.expression.RepeatableIterator$IndexProviderIterator.<init> (RepeatableIterator.java:142)
    at org.eclipse.equinox.internal.p2.metadata.expression.RepeatableIterator.create (RepeatableIterator.java:60)
    at org.eclipse.equinox.internal.p2.metadata.expression.Everything.<init> (Everything.java:39)
    at org.eclipse.equinox.internal.p2.metadata.expression.ContextExpression.createContext (ContextExpression.java:48)
    at org.eclipse.equinox.p2.query.ExpressionQuery.perform (ExpressionQuery.java:51)
    at org.eclipse.equinox.internal.p2.metadata.index.IndexProvider.query (IndexProvider.java:26)
    at org.eclipse.equinox.internal.p2.metadata.index.IndexProvider.query (IndexProvider.java:36)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.findUnit (InstallableUnitResolver.java:281)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.findUnits (InstallableUnitResolver.java:261)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.getRootIUs (InstallableUnitResolver.java:254)
    at org.eclipse.tycho.p2resolver.InstallableUnitResolver.addLocation (InstallableUnitResolver.java:88)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolver.resolveContentWithExceptions (TargetDefinitionResolver.java:151)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolver.resolveContent (TargetDefinitionResolver.java:107)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolverService.resolveFromArguments (TargetDefinitionResolverService.java:96)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent (ConcurrentHashMap.java:1708)
    at org.eclipse.tycho.p2resolver.TargetDefinitionResolverService.getTargetDefinitionContent (TargetDefinitionResolverService.java:70)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.resolveTargetDefinitions (TargetPlatformFactoryImpl.java:332)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:214)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:180)
    at org.eclipse.tycho.p2resolver.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:118)
    at org.eclipse.tycho.p2resolver.ReactorRepositoryManagerImpl.computePreliminaryTargetPlatform (ReactorRepositoryManagerImpl.java:71)
    at org.eclipse.tycho.p2resolver.P2DependencyResolver.computePreliminaryTargetPlatform (P2DependencyResolver.java:215)
    at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject (DefaultTychoResolver.java:101)
    at org.eclipse.tycho.core.maven.TychoProjectExecutionListener.beforeProjectLifecycleExecution (TychoProjectExecutionListener.java:108)
    at org.apache.maven.lifecycle.internal.CompoundProjectExecutionListener.beforeProjectLifecycleExecution (CompoundProjectExecutionListener.java:42)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:103)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.837 s
[INFO] Finished at: 2023-10-20T00:48:34+04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to resolve target definition file:/Users/vasiligulevich/xored/itest/ws/pde_9.6/content-prolog/pydev.target: Failed to load p2 metadata repository from location https://www.pydev.org/update_sites/10.1.3/: Unable to read repository at https://www.pydev.org/update_sites/10.1.3. Unable to read repository at file:/Users/vasiligulevich/.m2/repository/.cache/tycho/https/objects.githubusercontent.com/github-production-release-asset-2e65be/7935003/a5422aac-de32-40ef-a51c-5a186359ece6/X-Amz-Algorithm=AWS4-HMAC-SHA256/X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231019%2Fus-east-1%2Fs3%2Faws4_request/X-Amz-Date=20231019T204810Z/X-Amz-Expires=300/X-Amz-Signature=0488d6d3891792e1ab068729e69e7e12531808e4e1e4267f181fd8d5e774446e/X-Amz-SignedHeaders=host/actor_id=0/key_id=0/repo_id=7935003/response-content-disposition=attachment%3B%20filename%3Dcontent.jar/response-content-type=application%2Foctet-stream. Content is not allowed in prolog.
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

Environment

% mvn -version
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
Maven home: /opt/homebrew/Cellar/maven/3.9.5/libexec
Java version: 17.0.4.1, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-17.0.4.1.jdk/Contents/Home
Default locale: en_GE, platform encoding: UTF-8
OS name: "mac os x", version: "12.7", arch: "aarch64", family: "mac"

Same happens on Java 21
Reproducible on Tycho 4.0.3 and 3.0.5
Not reproducible on Tycho 2.7.5

@basilevs basilevs changed the title Content is not allowed in prolog. Content is not allowed in prolog Oct 19, 2023
@basilevs
Copy link
Contributor Author

I've debugged this down to https://github.com/eclipse-equinox/p2/blob/413c76a0100011607dab79d1acde7ac283a5c704/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/SimpleMetadataRepositoryFactory.java#L94
The JAR extension is not recognized as after redirects the URL is complex:

https://objects.githubusercontent.com/github-production-release-asset-2e65be/7935003/a5422aac-de32-40ef-a51c-5a186359ece6?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231019%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231019T220152Z&X-Amz-Expires=300&X-Amz-Signature=7eb7ccbbd0c4871c6d3337de6de58be22466c44bf4276565a61f839659335df5&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=7935003&response-content-disposition=attachment%3B%20filename%3Dcontent.jar&response-content-type=application%2Foctet-stream

instead of original

https://github.com/fabioz/Pydev/releases/download/pydev_10_1_3/content.jar

So this seems to be a P2 bug, but I do not understand why the same target definition works fine in PDE.

@basilevs
Copy link
Contributor Author

In Tycho 2.7.5 SimpleMetadataRepositoryFactory.getFile() returns a non-mangled file name when downloading https://github.com/fabioz/Pydev/releases/download/pydev_10_1_3

@basilevs
Copy link
Contributor Author

I've found the problem.
Custom CacheManager in modern Tycho uses caches HTTP redirections with custom names, but fails to restore the original file name.

if (isRedirected(code)) {
return SharedHttpCacheStorage.this.getCacheEntry(getRedirect(uri), logger)
.getCacheFile(transportFactory);
}

@laeubi
Copy link
Member

laeubi commented Oct 20, 2023

but fails to restore the original file name.

What do you mean by " fails to restore the original file name" a redirection is a redirection to a different file, so there is no "original name"....

@basilevs
Copy link
Contributor Author

basilevs commented Oct 20, 2023

@laeubi By original filename I mean the last segment of original request URL.
SimpleMetadataRepositoryFactory expects the return value of this method to match the original URL and should end with "content.jar" instead it receives a file name that ends in "octet-stream".

@basilevs
Copy link
Contributor Author

basilevs commented Oct 20, 2023

Until P2 contract for cached file names is changed there is a following solution:

     if (isRedirected(code)) {
         CacheEntry redirected =  SharedHttpCacheStorage.this.getCacheEntry(getRedirect(uri), logger);
         FileUtils.copyTo(redirected.getCacheFile(transportFactory), file);
         return file;
     } 

@laeubi
Copy link
Member

laeubi commented Oct 20, 2023

@basilevs do you like to propose a PR at best together with an integration-test to demonstrate the issue?
Also please note the issue in the code so we can fix that later on when P2 is improved...

@basilevs
Copy link
Contributor Author

I'm going to try writing an integration test.

basilevs added a commit to basilevs/tycho that referenced this issue Oct 21, 2023
P2 relies on correct file extensions to parse cached files.

Fixes eclipse-tycho#2938

See
eclipse-equinox/p2#355
basilevs added a commit to basilevs/tycho that referenced this issue Oct 21, 2023
URLs returned from HttpServer.getAccessedUrls() are now stripped of
context prefix. No callers have used these values until now.
Fix concurrency bug in test utility class HttpServer request logging.
Add verification of request logs to ensure that metadata repository does
indeed unjars fresh, non-cached artifact. Ensure that cached XML file
does not produce false negative in tests.
Refactor tests.
basilevs added a commit to basilevs/tycho that referenced this issue Oct 21, 2023
P2 relies on correct file extensions to parse cached files.

Fixes eclipse-tycho#2938

See P2 bug:
eclipse-equinox/p2#355

Integration test infrastructure touch-ups:

Fix HttpServer concurrency bug.
URLs returned from HttpServer.getAccessedUrls() are now stripped of
context prefix. No callers have used these values until now.
Fix concurrency bug in test utility class HttpServer request logging.
basilevs added a commit to basilevs/tycho that referenced this issue Oct 22, 2023
OfflineModeTest fails with UnsupportedOperationException as HttpServer
no longer allows direct access to access logs. Change OfflineModeTest to
dedicated and limited mutation API for access logs.
basilevs added a commit to basilevs/tycho that referenced this issue Oct 22, 2023
Improve variable locality.
Make error log assertion first, to facilitate investigation of
non-network failures.
basilevs added a commit to basilevs/tycho that referenced this issue Oct 22, 2023
MultiMap.get() may return null.
laeubi pushed a commit that referenced this issue Oct 22, 2023
P2 relies on correct file extensions to parse cached files.

Fixes #2938

See P2 bug:
eclipse-equinox/p2#355

Integration test infrastructure touch-ups:

Fix HttpServer concurrency bug.
URLs returned from HttpServer.getAccessedUrls() are now stripped of
context prefix. No callers have used these values until now.
Fix concurrency bug in test utility class HttpServer request logging.
laeubi pushed a commit that referenced this issue Oct 22, 2023
OfflineModeTest fails with UnsupportedOperationException as HttpServer
no longer allows direct access to access logs. Change OfflineModeTest to
dedicated and limited mutation API for access logs.
laeubi pushed a commit that referenced this issue Oct 22, 2023
Improve variable locality.
Make error log assertion first, to facilitate investigation of
non-network failures.
laeubi pushed a commit that referenced this issue Oct 22, 2023
MultiMap.get() may return null.
basilevs added a commit to basilevs/tycho that referenced this issue Oct 22, 2023
OfflineModeTest fails with UnsupportedOperationException as HttpServer
no longer allows direct access to access logs. Change OfflineModeTest to
dedicated and limited mutation API for access logs.
basilevs added a commit to basilevs/tycho that referenced this issue Oct 22, 2023
Improve variable locality.
Make error log assertion first, to facilitate investigation of
non-network failures.
basilevs added a commit to basilevs/tycho that referenced this issue Oct 22, 2023
MultiMap.get() may return null.
basilevs added a commit to basilevs/tycho that referenced this issue Oct 22, 2023
This is a backport from 5.0.0

P2 relies on correct file extensions to parse cached files.
This change prevents cached file name from changing over HTTP redirect.

See
eclipse-equinox/p2#355

Fix HttpServer concurrency bug.
URLs returned from HttpServer.getAccessedUrls() are now stripped of
context prefix. No callers have used these values until now.
Fix concurrency bug in test utility class HttpServer request logging.
Add verification of request logs to ensure that metadata repository does
indeed unjars fresh, non-cached artifact. Ensure that cached XML file
does not produce false negative in tests.
Refactor tests.
laeubi pushed a commit that referenced this issue Oct 28, 2023
This is a backport from 5.0.0

P2 relies on correct file extensions to parse cached files.
This change prevents cached file name from changing over HTTP redirect.

See
eclipse-equinox/p2#355

Fix HttpServer concurrency bug.
URLs returned from HttpServer.getAccessedUrls() are now stripped of
context prefix. No callers have used these values until now.
Fix concurrency bug in test utility class HttpServer request logging.
Add verification of request logs to ensure that metadata repository does
indeed unjars fresh, non-cached artifact. Ensure that cached XML file
does not produce false negative in tests.
Refactor tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants