Author: lcorneliussen
Date: Tue Dec 20 19:46:52 2011
New Revision: 1221459
URL: http://svn.apache.org/viewvc?rev=1221459&view=rev
Log:
Improved error handling / logging
Modified:
incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/AbstractMojo.java
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java
incubator/npanday/trunk/plugins/maven-link-plugin/src/main/java/npanday/plugin/link/LinkerMojo.java
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NetDependencyResolverMojo.java
incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java
Modified:
incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/AbstractMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/AbstractMojo.java?rev=1221459&r1=1221458&r2=1221459&view=diff
==============================================================================
---
incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/AbstractMojo.java
(original)
+++
incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/AbstractMojo.java
Tue Dec 20 19:46:52 2011
@@ -96,7 +96,7 @@ public abstract class AbstractMojo
}
catch ( ParserConfigurationException e )
{
- throw new MojoExecutionException( "NPANDAY-115-000", e );
+ throw new MojoExecutionException( "NPANDAY-115-000: Unable to
create document builder", e );
}
Document document = builder.newDocument();
@@ -109,7 +109,9 @@ public abstract class AbstractMojo
}
catch ( IOException e )
{
- throw new MojoExecutionException( "NPANDAY-115-001", e );
+ throw new MojoExecutionException(
+ "NPANDAY-115-001: IO error on creating or accessing Plugin.xml
temp file", e
+ );
}
StreamResult result = new StreamResult();
@@ -136,7 +138,8 @@ public abstract class AbstractMojo
}
catch ( IOException e )
{
- throw new MojoExecutionException( "NPANDAY-115-004: Unable to
write file", e );
+ throw new MojoExecutionException( "NPANDAY-115-004: Unable to
write file "
+ +
paramFile.getAbsolutePath(), e );
}
}
@@ -145,10 +148,11 @@ public abstract class AbstractMojo
File targetDir = PathUtil.getPrivateApplicationBaseDirectory( project
);
ArtifactContext artifactContext = null;
+
+ VendorRequirement vendorRequirement = new VendorRequirement(
getVendor(), getVendorVersion(), getFrameworkVersion());
+
try
{
- VendorRequirement vendorRequirement = new VendorRequirement(
getVendor(), getVendorVersion(), getFrameworkVersion());
-
String localRepository = getLocalRepository();
artifactContext = (ArtifactContext)
container.lookup(ArtifactContext.ROLE);
@@ -162,13 +166,16 @@ public abstract class AbstractMojo
}
catch ( PlatformUnsupportedException e )
{
- throw new MojoExecutionException( "NPANDAY-115-005", e );
+ throw new MojoExecutionException( "NPANDAY-115-005: Vendor
configuration seems to be unsupported: "
+ + vendorRequirement, e );
}
catch ( ExecutionException e )
{
- throw new MojoExecutionException( "NPANDAY-115-006", e );
- } catch (ComponentLookupException e) {
- throw new MojoExecutionException( "NPANDAY-xxx-000", e );
+ throw new MojoExecutionException( "NPANDAY-115-006: Error occurred
while running the .NET plugin", e );
+ }
+ catch ( ComponentLookupException e )
+ {
+ throw new MojoFailureException( "NPANDAY-115-007: Internal
component composition error", e );
}
finally
{
@@ -207,11 +214,12 @@ public abstract class AbstractMojo
}
catch( NPandayArtifactResolutionException e )
{
- throw new MojoExecutionException( e.getMessage(), e );
+ throw new MojoExecutionException( "NPANDAY-115-008: Error on
resolving " + dependency, e );
+ }
+ catch (IOException e)
+ {
+ throw new MojoExecutionException( "NPANDAY-115-008: IO error on
resolving " + dependency, e );
}
- }
- catch (IOException e) {
- throw new MojoExecutionException(e.getMessage(), e);
}
finally {
release(assemblyResolver);
Modified:
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java?rev=1221459&r1=1221458&r2=1221459&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java
(original)
+++
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java
Tue Dec 20 19:46:52 2011
@@ -18,22 +18,15 @@
*/
package npanday.plugin.compile;
+import npanday.InitializationException;
+import npanday.artifact.AssemblyResolver;
import npanday.artifact.NPandayArtifactResolutionException;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.Dependency;
+import npanday.assembler.AssemblerContext;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
-import npanday.InitializationException;
-import npanday.assembler.AssemblerContext;
-import npanday.artifact.AssemblyResolver;
-
-
import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
/**
@@ -84,11 +77,11 @@ public class ComponentInitializerMojo
}
catch ( java.io.IOException e )
{
- throw new MojoExecutionException( e.getMessage(), e );
+ throw new MojoExecutionException( "NPANDAY-901-003: IO error on
resolving project dependencies", e );
}
catch( NPandayArtifactResolutionException e )
{
- throw new MojoExecutionException( e.getMessage(), e );
+ throw new MojoExecutionException( "NPANDAY-901-004: error on
resolving project dependencies", e );
}
try
Modified:
incubator/npanday/trunk/plugins/maven-link-plugin/src/main/java/npanday/plugin/link/LinkerMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-link-plugin/src/main/java/npanday/plugin/link/LinkerMojo.java?rev=1221459&r1=1221458&r2=1221459&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/maven-link-plugin/src/main/java/npanday/plugin/link/LinkerMojo.java
(original)
+++
incubator/npanday/trunk/plugins/maven-link-plugin/src/main/java/npanday/plugin/link/LinkerMojo.java
Tue Dec 20 19:46:52 2011
@@ -106,7 +106,7 @@ public class LinkerMojo
{
return;
}
- getLog().info( "NPANDAY-000-000: Linking modules to assembly: Output
File = " + outputFile.getAbsolutePath() );
+ getLog().info( "NPANDAY-1400-002: Linking modules to assembly: Output
File = " + outputFile.getAbsolutePath() );
SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry,
settingsPath );
Modified:
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NetDependencyResolverMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NetDependencyResolverMojo.java?rev=1221459&r1=1221458&r2=1221459&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NetDependencyResolverMojo.java
(original)
+++
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NetDependencyResolverMojo.java
Tue Dec 20 19:46:52 2011
@@ -34,6 +34,7 @@ import org.apache.maven.artifact.Artifac
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import java.io.File;
@@ -119,8 +120,7 @@ public class NetDependencyResolverMojo
*/
private boolean skip;
- public void execute()
- throws MojoExecutionException
+ public void execute() throws MojoExecutionException, MojoFailureException
{
long startTime = System.currentTimeMillis();
@@ -159,11 +159,15 @@ public class NetDependencyResolverMojo
}
catch ( NPandayArtifactResolutionException e )
{
- throw new MojoExecutionException( e.getMessage(), e );
+ throw new MojoExecutionException(
+ "NPANDAY-1600-007: Error on resolving configured .NET
dependencies (param netDependencies)", e
+ );
}
catch ( IOException e )
{
- throw new MojoExecutionException( e.getMessage(), e );
+ throw new MojoFailureException(
+ "NPANDAY-1600-008: IO-error on resolving configured .NET
dependencies (param netDependencies)", e
+ );
}
new File( localRepository, "npanday.artifacts.resolved" ).mkdir();
Modified:
incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java?rev=1221459&r1=1221458&r2=1221459&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java
(original)
+++
incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java
Tue Dec 20 19:46:52 2011
@@ -34,6 +34,7 @@ import org.apache.maven.plugin.MojoExecu
import org.apache.maven.plugin.MojoFailureException;
import org.codehaus.plexus.util.IOUtil;
+import javax.swing.filechooser.FileSystemView;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -42,7 +43,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.swing.filechooser.FileSystemView;
/**
* Installs Visual Studio 2005 addin.
@@ -128,11 +128,15 @@ public class VsInstallerMojo
}
catch ( NPandayArtifactResolutionException e )
{
- throw new MojoExecutionException( e.getMessage(), e );
+ throw new MojoExecutionException(
+ "NPANDAY-121-002: Error resolving dependencies for
'VisualStudio2005'", e
+ );
}
- catch( IOException e )
+ catch ( IOException e )
{
- throw new MojoExecutionException( e.getMessage(), e );
+ throw new MojoExecutionException(
+ "NPANDAY-121-003: IO error on resolving dependencies for
'VisualStudio2005'", e
+ );
}
collectDefaultVSAddinDirectories();
@@ -223,7 +227,7 @@ public class VsInstallerMojo
}
catch ( IOException e )
{
- throw new MojoExecutionException( "Unable to write to Visual
Studio AddIns directory: " + e.getMessage() );
+ throw new MojoExecutionException( "NPANDAY-121-001: Unable to
write to Visual Studio AddIns directory: " + e.getMessage() );
}
finally
{
@@ -246,7 +250,7 @@ public class VsInstallerMojo
catch ( IOException e )
{
- throw new MojoExecutionException( e.getMessage(), e );
+ throw new MojoExecutionException( "NPANDAY-121-004: Error on
copying dll-dependencies to bin", e );
}
}