javaee / metro-jaxws-commons

Metro has been contributed to Eclipse Foundation. This repository is for legacy review only. Please refer to the Eclipse EE4J Metro project for the very latest
https://eclipse-ee4j.github.io/metro-wsit/
Other
10 stars 9 forks source link

Exception swallowing in wsImport() #22

Closed glassfishrobot closed 13 years ago

glassfishrobot commented 16 years ago

In WsImportMojo.java we have exception handling that swallows useful info on root causes which makes life difficult for users.

private void wsImport( ArrayList args ) throws MojoExecutionException { try { final ClassLoader cl = Invoker.createClassLoader(Thread.currentThread ().getContextClassLoader()); Class c = cl.loadClass("com.sun.tools.ws.wscompile.WsimportTool"); Object tool = c.getConstructor(OutputStream.class).newInstance (System.out); String[] ar = args.toArray( new String[args.size()] ); Boolean result = (Boolean)c.getMethod("run", ar.getClass()).invoke (tool, new Object[]

{ar}

); if ( !result )

{ throw new MojoExecutionException( "Error executing: wsimport " + args); }

// New handler complementing thrown exception above } catch (MojoExecutionException e)

{ throw e; }

catch (Exception e)

{ // Corrected throw to include second param 'e' (chaining) throw new MojoExecutionException( "Error executing: wsimport " + args, e ); }

}

Without this we cannot see the reasons why the function is failing. See also ... http://forums.java.net/jive/thread.jspa?messageID=293732&#293732

PS I would contribute if I knew how.

Environment

Operating System: All Platform: All

Affected Versions

[current]

glassfishrobot commented 16 years ago

Reported by johnlon@java.net

glassfishrobot commented 15 years ago

rustamabd@java.net said: Created an attachment (id=14) the proposed change in patch format

glassfishrobot commented 15 years ago

euxx@java.net said: This is duplicated by issue #32 and it would be really nice to have it fixed in the next release

glassfishrobot commented 15 years ago

johnlon@java.net said: Created an attachment (id=17) The patch needs to look more like this.

glassfishrobot commented 13 years ago

@lukasj said: looks fixed in 1.13-SNAPSHOT

glassfishrobot commented 11 years ago

@lukasj said: closing old and already fixed issues

glassfishrobot commented 15 years ago

File: correction.java Attached By: johnlon@java.net

glassfishrobot commented 15 years ago

File: wsimport.exception.patch Attached By: rustamabd@java.net

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAX_WS_COMMONS-22

glassfishrobot commented 13 years ago

Marked as fixed on Thursday, October 6th 2011, 10:30:12 am