Community
Participate
Working Groups
When publishArtifacts is not on the command line and no artifact repository exists, the following exception occurs: java.io.FileNotFoundException: d:\tmp\equinox.prov\servers\artifactRepository\artifacts.xml (The system cannot find the path specified) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(Unknown Source) at java.io.FileOutputStream.<init>(Unknown Source) at org.eclipse.equinox.internal.prov.artifact.repository.SimpleArtifactRepository.save(SimpleArtifactRepository.java:184) at org.eclipse.equinox.internal.prov.artifact.repository.SimpleArtifactRepository.addDescriptor(SimpleArtifactRepository.java:179) at org.eclipse.equinox.prov.metadata.generator.Generator.generateBundleIUs(Generator.java:214) at org.eclipse.equinox.prov.metadata.generator.Generator.generate(Generator.java:53) at org.eclipse.equinox.internal.prov.metadata.generator.EclipseGeneratorApplication.start(EclipseGeneratorApplication.java:87)
You no longer get that exception, but you get a different exception saying that the artifact repository is invalid. If -publishArtifacts is not specified, it should not complain if there is no artifact repository. If -publishArtifacts is true, it's reasonable to throw an exception when initializing to say that the artifact repository is missing. Pushing to M4.
I just got the initial exception again specifying -publishArtifacts.off on the command line.
Jeff, could you please confirm if this is still a problem?
You now get an NPE if you don't have an artifact repository listed. Interestingly, if you have an artifact repo listed, but don't have publishArtifacts specified, you still get the artifacts. I assume this is not the desired behaviour. Although, do we really need the "publishArtifacts" flag? Can we not just use the presence or absence of the artifactRepositoryflag for this? Maybe it is reasonable to list a artifactRepository without the expectation of publishing the artifacts.
Jeff, I'm going to assign this to myself. I hope that's ok.
Created attachment 125176 [details] Patch This patch fixes this problem. I added an InvalidConfigurationException that can be thrown whenever an invalid configuration is detected (for example, calling -publishArtifacts, but not having an artifact repo). This exception is caught in the AbstractionPublisherApplication#run method. The exception will contain a proper i18n string that is displayed to the user. ready for review.
comments on the patch: - The addition of an exception seems heavy handed in this case. can't we just call a validate method or something. or just use the ProvisionException. - There are a few sysout.printlns in there. They need to log I think. not sure what we do in applications in general.
I introduced the exception because I expect other ConfigurationExceptions to occur. By using the exception we can detect the configuration problem at the lowest level, as opposed to trying to validate all the parameters up front. I worried that if we try to validate up front, we may get into a nightmare of state management. There are other uses of Sysout in AbstractPublisherApplication, I just followed that pattern.
Created attachment 126064 [details] Updated patch This patch uses a provisioning exception instead of introducing a new one.
Created attachment 126065 [details] mylyn/context/zip
Thanks for the updated patch. Some further comments. - There is some very similar code in PublisherTask. Does it need to be addressed? - suggest stashing the status not the status.getMessage. We have the status, pulling out the message and keeping that is throwing away information that someone might want. Change getErrorMessage to getStatus. - nit: avoid type-based names like provisionException. "e" is the norm for exception vars
Created attachment 126206 [details] Updated patch This patch follows Jeff's suggestions: 1. I have added the same checks to the abstract publisher task 2. Stashed the status now (not just the message) 3. Changed the exception variable name to 'e'. ready for review.
patch committed. Thanks. closing.