[JBoss JIRA] (SHRINKRES-217) FileUtil.fileFromClassLoaderResource() creates non-unique temporary file
by Karel Piwko (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-217?page=com.atlassian.jira.plu... ]
Karel Piwko resolved SHRINKRES-217.
-----------------------------------
Assignee: Karel Piwko
Resolution: Done
> FileUtil.fileFromClassLoaderResource() creates non-unique temporary file
> ------------------------------------------------------------------------
>
> Key: SHRINKRES-217
> URL: https://issues.jboss.org/browse/SHRINKRES-217
> Project: ShrinkWrap Resolvers
> Issue Type: Bug
> Components: maven
> Affects Versions: 2.0.2
> Reporter: Falko M.
> Assignee: Karel Piwko
> Fix For: 2.2.0-beta-2
>
>
> {{org.jboss.shrinkwrap.resolver.impl.maven.util.FileUtil}} copies a classpath file to the system temp directory (defined by {{java.io.tmpdir}}) to be able to work with it as a plain file.
> The problem is that the file name is used *as is*.
> Now imagine multiple maven-surefire processes running Tests using the same classpath resource. They all and up trying to write a file with the same name in a (more or less) global temporary directory.
> Because of this we have seen multiple build failures on or Jenkins CI machine which uses {{-T...}} and {{-DforkCount=...}} liberally like this one:
> {noformat}Caused by: org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException: Found 1 problems while building POM model from /tmp/someproject-main-continuous-1.1.1/META-INF-maven-com.somecompany.someproject-middleware-common-test-pom.xml
> 1/ [FATAL] Non-readable POM /tmp/someproject-main-continuous-1.1.1/META-INF-maven-com.somecompany.someproject-middleware-common-test-pom.xml: no more data available - expected end tags </version></dependency></dependencies></project> to close start tag <version> from line 75 and start tag <dependency> from line 77 and start tag <dependencies> from line 48 and start tag <project> from line 2, parser stopped on TEXT seen ...<dependency>\n <gro... @78:17 @ /tmp/someproject-main-continuous-1.1.1/META-INF-maven-com.somecompany.someproject-middleware-common-test-pom.xml{noformat}
> Solution:
> Instead of:
> {noformat}File localResource = new File(tmpDir, resourceName.replace("/", "-").replace("\\", "-").replace(File.pathSeparator, "-").replaceAll("\\s", "-"));{noformat}
> use:
> {{File localResource = java.io.File.createTempFile(...)}}
> which generates a file name that will most likely be "unique" for a certain time.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 2 months
[JBoss JIRA] (SHRINKRES-217) FileUtil.fileFromClassLoaderResource() creates non-unique temporary file
by Karel Piwko (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-217?page=com.atlassian.jira.plu... ]
Karel Piwko commented on SHRINKRES-217:
---------------------------------------
Pushed upstream in https://github.com/shrinkwrap/resolver/commit/76a639ca860e2b109fc10561153.... Using an temp file using original file name as a prefix.
> FileUtil.fileFromClassLoaderResource() creates non-unique temporary file
> ------------------------------------------------------------------------
>
> Key: SHRINKRES-217
> URL: https://issues.jboss.org/browse/SHRINKRES-217
> Project: ShrinkWrap Resolvers
> Issue Type: Bug
> Components: maven
> Affects Versions: 2.0.2
> Reporter: Falko M.
> Fix For: 2.2.0-beta-2
>
>
> {{org.jboss.shrinkwrap.resolver.impl.maven.util.FileUtil}} copies a classpath file to the system temp directory (defined by {{java.io.tmpdir}}) to be able to work with it as a plain file.
> The problem is that the file name is used *as is*.
> Now imagine multiple maven-surefire processes running Tests using the same classpath resource. They all and up trying to write a file with the same name in a (more or less) global temporary directory.
> Because of this we have seen multiple build failures on or Jenkins CI machine which uses {{-T...}} and {{-DforkCount=...}} liberally like this one:
> {noformat}Caused by: org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException: Found 1 problems while building POM model from /tmp/someproject-main-continuous-1.1.1/META-INF-maven-com.somecompany.someproject-middleware-common-test-pom.xml
> 1/ [FATAL] Non-readable POM /tmp/someproject-main-continuous-1.1.1/META-INF-maven-com.somecompany.someproject-middleware-common-test-pom.xml: no more data available - expected end tags </version></dependency></dependencies></project> to close start tag <version> from line 75 and start tag <dependency> from line 77 and start tag <dependencies> from line 48 and start tag <project> from line 2, parser stopped on TEXT seen ...<dependency>\n <gro... @78:17 @ /tmp/someproject-main-continuous-1.1.1/META-INF-maven-com.somecompany.someproject-middleware-common-test-pom.xml{noformat}
> Solution:
> Instead of:
> {noformat}File localResource = new File(tmpDir, resourceName.replace("/", "-").replace("\\", "-").replace(File.pathSeparator, "-").replaceAll("\\s", "-"));{noformat}
> use:
> {{File localResource = java.io.File.createTempFile(...)}}
> which generates a file name that will most likely be "unique" for a certain time.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 2 months
[JBoss JIRA] (SHRINKRES-217) FileUtil.fileFromClassLoaderResource() creates non-unique temporary file
by Karel Piwko (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-217?page=com.atlassian.jira.plu... ]
Karel Piwko updated SHRINKRES-217:
----------------------------------
Fix Version/s: 2.2.0-beta-2
(was: 2.2.0-beta-3)
> FileUtil.fileFromClassLoaderResource() creates non-unique temporary file
> ------------------------------------------------------------------------
>
> Key: SHRINKRES-217
> URL: https://issues.jboss.org/browse/SHRINKRES-217
> Project: ShrinkWrap Resolvers
> Issue Type: Bug
> Components: maven
> Affects Versions: 2.0.2
> Reporter: Falko M.
> Fix For: 2.2.0-beta-2
>
>
> {{org.jboss.shrinkwrap.resolver.impl.maven.util.FileUtil}} copies a classpath file to the system temp directory (defined by {{java.io.tmpdir}}) to be able to work with it as a plain file.
> The problem is that the file name is used *as is*.
> Now imagine multiple maven-surefire processes running Tests using the same classpath resource. They all and up trying to write a file with the same name in a (more or less) global temporary directory.
> Because of this we have seen multiple build failures on or Jenkins CI machine which uses {{-T...}} and {{-DforkCount=...}} liberally like this one:
> {noformat}Caused by: org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException: Found 1 problems while building POM model from /tmp/someproject-main-continuous-1.1.1/META-INF-maven-com.somecompany.someproject-middleware-common-test-pom.xml
> 1/ [FATAL] Non-readable POM /tmp/someproject-main-continuous-1.1.1/META-INF-maven-com.somecompany.someproject-middleware-common-test-pom.xml: no more data available - expected end tags </version></dependency></dependencies></project> to close start tag <version> from line 75 and start tag <dependency> from line 77 and start tag <dependencies> from line 48 and start tag <project> from line 2, parser stopped on TEXT seen ...<dependency>\n <gro... @78:17 @ /tmp/someproject-main-continuous-1.1.1/META-INF-maven-com.somecompany.someproject-middleware-common-test-pom.xml{noformat}
> Solution:
> Instead of:
> {noformat}File localResource = new File(tmpDir, resourceName.replace("/", "-").replace("\\", "-").replace(File.pathSeparator, "-").replaceAll("\\s", "-"));{noformat}
> use:
> {{File localResource = java.io.File.createTempFile(...)}}
> which generates a file name that will most likely be "unique" for a certain time.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 2 months
[JBoss JIRA] (SHRINKRES-212) SAXParserFactory issues with JBoss AS and EAP
by Karel Piwko (JIRA)
[ https://issues.jboss.org/browse/SHRINKRES-212?page=com.atlassian.jira.plu... ]
Karel Piwko updated SHRINKRES-212:
----------------------------------
Fix Version/s: 2.2.0-beta-2
(was: 2.2.0-beta-3)
> SAXParserFactory issues with JBoss AS and EAP
> ---------------------------------------------
>
> Key: SHRINKRES-212
> URL: https://issues.jboss.org/browse/SHRINKRES-212
> Project: ShrinkWrap Resolvers
> Issue Type: Bug
> Components: gradle
> Affects Versions: 2.2.0-beta-1
> Reporter: Michal Matloka
> Assignee: Michal Matloka
> Fix For: 2.2.0-beta-2
>
>
> Running Embedded Gradle Importer on Jboss AS/EAP/early WildFly results in following exception
> {code}
> java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive org.jboss.shrinkwrap.resolver.example.FullGreeterTest.createDeployment()
> Caused by:
> java.lang.reflect.InvocationTargetException
> Caused by:
> org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.1-all.zip'.
> at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:53)
> at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
> at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
> at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:71)
> at org.jboss.shrinkwrap.impl.gradle.archive.importer.embedded.EmbeddedGradleImporterImpl.importBuildOutput(EmbeddedGradleImporterImpl.java:217)
> at org.jboss.shrinkwrap.resolver.example.FullGreeterTest.createDeployment(FullGreeterTest.java:23)
> Caused by:
> org.gradle.internal.exceptions.LocationAwareException: Could not resolve all dependencies for configuration ':compile'.
> Caused by:
> org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compile'.
> Caused by:
> org.gradle.api.internal.artifacts.ivyservice.ModuleVersionResolveException: Could not resolve javax:javaee-api:7.0.
> Required by:
> org.jboss.shrinkwrap.resolver.example:single-module:1.0.0
> Caused by:
> javax.xml.parsers.FactoryConfigurationError: Provider __redirected.__SAXParserFactory not found
> Caused by:
> java.lang.ClassNotFoundException: __redirected/__SAXParserFactory
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 2 months