diff -r 2e49f6df239b j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/wsclient/AppClientProjectJAXWSClientSupport.java --- a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/wsclient/AppClientProjectJAXWSClientSupport.java Tue May 29 17:27:56 2012 +0400 +++ b/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/wsclient/AppClientProjectJAXWSClientSupport.java Fri Jun 01 16:10:36 2012 +0400 @@ -71,7 +71,7 @@ * Creates a new instance of AppClientProjectJAXWSClientSupport */ public AppClientProjectJAXWSClientSupport(AppClientProject project, AntProjectHelper antProjectHelper) { - super(project); + super(project, antProjectHelper); this.project=project; } diff -r 2e49f6df239b j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProject.java --- a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProject.java Tue May 29 17:27:56 2012 +0400 +++ b/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProject.java Fri Jun 01 16:10:36 2012 +0400 @@ -303,7 +303,7 @@ ejbJarWebServicesSupport = new EjbJarWebServicesSupport(this, helper, refHelper); jaxwsSupport = new EjbProjectJAXWSSupport(this, helper); ejbJarWebServicesClientSupport = new EjbJarWebServicesClientSupport(this, helper, refHelper); - jaxWsClientSupport = new EjbProjectJAXWSClientSupport(this); + jaxWsClientSupport = new EjbProjectJAXWSClientSupport(this,helper); apiWebServicesSupport = WebServicesSupportFactory.createWebServicesSupport(ejbJarWebServicesSupport); apiJaxwsSupport = JAXWSSupportFactory.createJAXWSSupport(jaxwsSupport); apiWebServicesClientSupport = WebServicesClientSupportFactory.createWebServicesClientSupport(ejbJarWebServicesClientSupport); diff -r 2e49f6df239b j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/jaxws/EjbProjectJAXWSClientSupport.java --- a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/jaxws/EjbProjectJAXWSClientSupport.java Tue May 29 17:27:56 2012 +0400 +++ b/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/jaxws/EjbProjectJAXWSClientSupport.java Fri Jun 01 16:10:36 2012 +0400 @@ -54,6 +54,7 @@ import org.netbeans.modules.j2ee.ejbjarproject.EjbJarProject; import org.netbeans.modules.websvc.api.jaxws.project.WSUtils; import org.netbeans.modules.websvc.spi.jaxws.client.ProjectJAXWSClientSupport; +import org.netbeans.spi.project.support.ant.AntProjectHelper; import org.openide.filesystems.FileObject; @@ -65,8 +66,8 @@ private EjbJarProject project; /** Creates a new instance of WebProjectJAXWSClientSupport */ - public EjbProjectJAXWSClientSupport(EjbJarProject project) { - super(project); + public EjbProjectJAXWSClientSupport(EjbJarProject project,AntProjectHelper helper) { + super(project,helper); this.project=project; } diff -r 2e49f6df239b web.project/src/org/netbeans/modules/web/project/WebProject.java --- a/web.project/src/org/netbeans/modules/web/project/WebProject.java Tue May 29 17:27:56 2012 +0400 +++ b/web.project/src/org/netbeans/modules/web/project/WebProject.java Fri Jun 01 16:10:36 2012 +0400 @@ -380,7 +380,7 @@ apiEjbJar = EjbJarFactory.createEjbJar(webEjbJarProvider); WebProjectWebServicesSupport webProjectWebServicesSupport = new WebProjectWebServicesSupport(this, helper, refHelper); WebProjectJAXWSSupport jaxwsSupport = new WebProjectJAXWSSupport(this, helper); - WebProjectJAXWSClientSupport jaxWsClientSupport = new WebProjectJAXWSClientSupport(this); + WebProjectJAXWSClientSupport jaxWsClientSupport = new WebProjectJAXWSClientSupport(this, helper); WebProjectWebServicesClientSupport webProjectWebServicesClientSupport = new WebProjectWebServicesClientSupport(this, helper, refHelper); apiWebServicesSupport = WebServicesSupportFactory.createWebServicesSupport (webProjectWebServicesSupport); apiJaxwsSupport = JAXWSSupportFactory.createJAXWSSupport(jaxwsSupport); diff -r 2e49f6df239b web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSClientSupport.java --- a/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSClientSupport.java Tue May 29 17:27:56 2012 +0400 +++ b/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSClientSupport.java Fri Jun 01 16:10:36 2012 +0400 @@ -59,6 +59,7 @@ import org.netbeans.modules.websvc.api.jaxws.project.WSUtils; import org.netbeans.modules.websvc.spi.jaxws.client.ProjectJAXWSClientSupport; import org.netbeans.spi.java.classpath.support.ClassPathSupport; +import org.netbeans.spi.project.support.ant.AntProjectHelper; import org.openide.filesystems.FileObject; /** @@ -69,8 +70,8 @@ WebProject project; /** Creates a new instance of WebProjectJAXWSClientSupport */ - public WebProjectJAXWSClientSupport(WebProject project) { - super(project); + public WebProjectJAXWSClientSupport(WebProject project,AntProjectHelper helper) { + super(project,helper); this.project=project; } diff -r 2e49f6df239b websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientSupport.java --- a/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientSupport.java Tue May 29 17:27:56 2012 +0400 +++ b/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientSupport.java Fri Jun 01 16:10:36 2012 +0400 @@ -54,6 +54,7 @@ import org.openide.filesystems.FileObject; import org.openide.util.Lookup; import org.netbeans.modules.websvc.spi.client.WebServicesClientSupportProvider; +import org.netbeans.spi.project.support.ant.AntProjectHelper; import org.openide.nodes.Node; /** JAXWSClientSupport should be used to manipulate representations @@ -192,4 +193,8 @@ public String getServiceRefName(Node clientNode){ return impl.getServiceRefName(clientNode); } + + public AntProjectHelper getAntProjectHelper(){ + return impl.getAntProjectHelper(); + } } diff -r 2e49f6df239b websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/JAXWSClientSupportImpl.java --- a/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/JAXWSClientSupportImpl.java Tue May 29 17:27:56 2012 +0400 +++ b/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/JAXWSClientSupportImpl.java Fri Jun 01 16:10:36 2012 +0400 @@ -47,6 +47,7 @@ import java.io.IOException; import java.net.URL; import java.util.List; +import org.netbeans.spi.project.support.ant.AntProjectHelper; import org.openide.filesystems.FileObject; import org.openide.nodes.Node; @@ -131,5 +132,10 @@ * (currently not used in projects) */ public String getServiceRefName(Node clientNode); + + /** + * Get the AntProjectHelper from the project + */ + public AntProjectHelper getAntProjectHelper(); } diff -r 2e49f6df239b websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java --- a/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java Tue May 29 17:27:56 2012 +0400 +++ b/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java Fri Jun 01 16:10:36 2012 +0400 @@ -51,6 +51,7 @@ import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; +import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.SwingUtilities; @@ -70,6 +71,7 @@ import org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlModeler; import org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlModelerFactory; import org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlService; +import org.netbeans.spi.project.support.ant.AntProjectHelper; import org.netbeans.spi.project.support.ant.GeneratedFilesHelper; import org.openide.DialogDisplayer; import org.openide.ErrorManager; @@ -104,11 +106,13 @@ protected static final String JAVA_EE_VERSION_16="java-ee-version-16"; //NOI18N Project project; + private AntProjectHelper helper; private FileObject clientArtifactsFolder; /** Creates a new instance of WebProjectJAXWSClientSupport */ - public ProjectJAXWSClientSupport(Project project) { + public ProjectJAXWSClientSupport(Project project, AntProjectHelper helper ) { this.project=project; + this.helper = helper; } public void removeServiceClient(String serviceName) { @@ -118,6 +122,10 @@ } } + public AntProjectHelper getAntProjectHelper() { + return helper; + } + public String getWsdlUrl(String serviceName) { JaxWsModel jaxWsModel = project.getLookup().lookup(JaxWsModel.class); if (jaxWsModel!=null) { @@ -326,8 +334,9 @@ try { ProjectManager.mutex().readAccess(new Mutex.ExceptionAction() { public Boolean run() throws IOException { + Properties props = WSUtils.identifyWsimport(helper); ExecutorTask wsimportTask = - ActionUtils.runTarget(buildImplFo,new String[]{"wsimport-client-"+finalName},null); //NOI18N + ActionUtils.runTarget(buildImplFo,new String[]{"wsimport-client-"+finalName},props); //NOI18N return Boolean.TRUE; } }).booleanValue(); diff -r 2e49f6df239b websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/ClientHandlerButtonListener.java --- a/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/ClientHandlerButtonListener.java Tue May 29 17:27:56 2012 +0400 +++ b/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/ClientHandlerButtonListener.java Fri Jun 01 16:10:36 2012 +0400 @@ -64,6 +64,7 @@ import java.net.URI; import java.util.Collection; import java.util.List; +import java.util.Properties; import java.util.logging.Level; import javax.lang.model.element.TypeElement; @@ -94,6 +95,7 @@ import org.netbeans.modules.websvc.api.jaxws.bindings.DefinitionsBindings; import org.netbeans.modules.websvc.api.jaxws.bindings.GlobalBindings; import org.netbeans.modules.websvc.spi.support.MessageHandlerPanel; +import org.netbeans.modules.websvc.api.jaxws.project.WSUtils; import org.netbeans.modules.websvc.api.jaxws.project.config.Binding; import org.netbeans.modules.websvc.api.jaxws.project.config.Client; import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel; @@ -440,9 +442,11 @@ FileObject buildImplFo = project.getProjectDirectory().getFileObject(GeneratedFilesHelper.BUILD_XML_PATH); try { String name = client.getName(); + JAXWSClientSupport support = JAXWSClientSupport.getJaxWsClientSupport(srcRoot); + Properties props = WSUtils.identifyWsimport(support.getAntProjectHelper()); ExecutorTask wsimportTask = ActionUtils.runTarget(buildImplFo, - new String[]{"wsimport-client-clean-" + name, "wsimport-client-" + name}, null); //NOI18N + new String[]{"wsimport-client-clean-" + name, "wsimport-client-" + name}, props); //NOI18N wsimportTask.waitFinished(); } catch (IOException ex) { ErrorManager.getDefault().log(ex.getLocalizedMessage()); diff -r 2e49f6df239b websvc.core/src/org/netbeans/modules/websvc/core/jaxws/projects/J2SEProjectJAXWSClientSupport.java --- a/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/projects/J2SEProjectJAXWSClientSupport.java Tue May 29 17:27:56 2012 +0400 +++ b/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/projects/J2SEProjectJAXWSClientSupport.java Fri Jun 01 16:10:36 2012 +0400 @@ -100,7 +100,7 @@ /** Creates a new instance of J2SEProjectJAXWSClientSupport */ public J2SEProjectJAXWSClientSupport(Project project) { - super(project); + super(project, null); this.project=project; } diff -r 2e49f6df239b websvc.design/nbproject/project.xml --- a/websvc.design/nbproject/project.xml Tue May 29 17:27:56 2012 +0400 +++ b/websvc.design/nbproject/project.xml Fri Jun 01 16:10:36 2012 +0400 @@ -146,6 +146,15 @@ + org.netbeans.modules.project.ant + + + + 1 + 1.48 + + + org.netbeans.modules.projectapi diff -r 2e49f6df239b websvc.design/src/org/netbeans/modules/websvc/design/javamodel/Utils.java --- a/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/Utils.java Tue May 29 17:27:56 2012 +0400 +++ b/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/Utils.java Fri Jun 01 16:10:36 2012 +0400 @@ -54,6 +54,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -102,6 +103,7 @@ import org.netbeans.api.project.FileOwnerQuery; import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectManager; +import org.netbeans.modules.websvc.api.jaxws.project.WSUtils; import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel; import org.netbeans.modules.websvc.api.jaxws.project.config.Service; import org.netbeans.modules.websvc.api.support.java.SourceUtils; @@ -911,7 +913,7 @@ } } - public static void invokeWsImport(Project project, final String serviceName) { + public static void invokeWsImport(final Project project, final String serviceName) { if (project!=null) { JaxWsModel jaxWsModel = project.getLookup().lookup(JaxWsModel.class); if (jaxWsModel != null) { @@ -922,9 +924,14 @@ try { ProjectManager.mutex().readAccess(new Mutex.ExceptionAction() { public Boolean run() throws IOException { + JAXWSSupport support = JAXWSSupport.getJAXWSSupport( + project.getProjectDirectory()); + Properties props = WSUtils.identifyWsimport( + support.getAntProjectHelper()); ExecutorTask wsimportTask = ActionUtils.runTarget(buildImplFo, - new String[]{"wsimport-service-clean-"+serviceName,"wsimport-service-"+serviceName},null); //NOI18N ActionUtils.runTarget(buildImplFo,new String[]{"wsimport-client-"+finalName,"wsimport-client-compile" },null); //NOI18N + new String[]{"wsimport-service-clean-"+serviceName, + "wsimport-service-"+serviceName},props); //NOI18N ActionUtils.runTarget(buildImplFo,new String[]{"wsimport-client-"+finalName,"wsimport-client-compile" },null); //NOI18N wsimportTask.waitFinished(); return Boolean.TRUE; } diff -r 2e49f6df239b websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java --- a/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java Tue May 29 17:27:56 2012 +0400 +++ b/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java Fri Jun 01 16:10:36 2012 +0400 @@ -53,6 +53,8 @@ import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; +import java.util.Properties; + import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.stream.StreamSource; import org.apache.tools.ant.module.api.support.ActionUtils; @@ -305,8 +307,11 @@ } FileObject buildImplFo = project.getProjectDirectory().getFileObject(GeneratedFilesHelper.BUILD_XML_PATH); try { + Properties props = WSUtils.identifyWsimport(antProjectHelper); ExecutorTask wsimportTask = - ActionUtils.runTarget(buildImplFo,new String[]{"wsimport-service-"+finalServiceName},null); //NOI18N + ActionUtils.runTarget(buildImplFo, + new String[]{"wsimport-service-"+finalServiceName}, //NOI18N + props); wsimportTask.waitFinished(); } catch (IOException ex) { ErrorManager.getDefault().log(ex.getLocalizedMessage()); diff -r 2e49f6df239b websvc.jaxwsmodel/src/org/netbeans/modules/websvc/api/jaxws/project/Bundle.properties --- a/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/api/jaxws/project/Bundle.properties Tue May 29 17:27:56 2012 +0400 +++ b/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/api/jaxws/project/Bundle.properties Fri Jun 01 16:10:36 2012 +0400 @@ -49,3 +49,6 @@ USG_WEBSVC_DETECTED=Web Service Detected [WS Stack: {0}, Project: {1}, Object: {2}] ERR_ModifyCatalog=Could not modify catalog: {0} +ERR_WsimportBadVersion=The wsimport ant task version {0} is known to have serious \ +bug in JAX-WS. This bug may cause NetBeans to stop responding. \ +The task is defined in the classpath {1}. Please update it with newer version. diff -r 2e49f6df239b websvc.jaxwsmodel/src/org/netbeans/modules/websvc/api/jaxws/project/WSUtils.java --- a/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/api/jaxws/project/WSUtils.java Tue May 29 17:27:56 2012 +0400 +++ b/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/api/jaxws/project/WSUtils.java Fri Jun 01 16:10:36 2012 +0400 @@ -60,8 +60,14 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; import java.util.StringTokenizer; +import java.util.jar.Attributes; +import java.util.jar.Manifest; +import java.util.logging.Level; +import java.util.logging.Logger; + import javax.xml.parsers.ParserConfigurationException; import org.netbeans.api.java.classpath.ClassPath; import org.netbeans.api.java.project.JavaProjectConstants; @@ -77,7 +83,10 @@ import org.netbeans.modules.websvc.jaxwsmodel.project.WsdlNamespaceHandler; import org.netbeans.modules.xml.retriever.RetrieveEntry; import org.netbeans.modules.xml.retriever.Retriever; +import org.netbeans.spi.java.classpath.support.ClassPathSupport; +import org.netbeans.spi.project.support.ant.AntProjectHelper; import org.netbeans.spi.project.support.ant.EditableProperties; +import org.netbeans.spi.project.support.ant.PropertyEvaluator; import org.openide.DialogDisplayer; import org.openide.ErrorManager; import org.openide.NotifyDescriptor; @@ -94,6 +103,7 @@ import org.openide.util.NbBundle; import org.xml.sax.SAXException; + /** * * @author mkuchtiak @@ -631,5 +641,79 @@ } return found; } + + public static Properties identifyWsimport( AntProjectHelper helper ){ + if ( helper == null ){ + return null; + } + EditableProperties props = helper.getProperties( + AntProjectHelper.PROJECT_PROPERTIES_PATH); + String wsImportCp = props.getProperty("j2ee.platform.wsimport.classpath"); // NOI18N + if ( wsImportCp ==null && wsImportCp.length() == 0 ){ + return null; + } + PropertyEvaluator evaluator = helper.getStandardPropertyEvaluator(); + String[] roots = wsImportCp.split(":"); + List cpItems = new ArrayList(roots.length); + for (String root : roots) { + String wsImportCpItem = evaluator.evaluate(root); + FileObject fileObject = FileUtil.toFileObject( + FileUtil.normalizeFile( new File(wsImportCpItem))); + if ( fileObject == null ){ + continue; + } + if ( fileObject.isFolder() ){ + cpItems.add( fileObject); + } + else if ( FileUtil.isArchiveFile(fileObject)){ + cpItems.add( FileUtil.getArchiveRoot(fileObject)); + } + } + + ClassPath classPath = ClassPathSupport.createClassPath(cpItems.toArray( + new FileObject[cpItems.size()])); + FileObject wsImport = classPath.findResource( + "com/sun/tools/ws/ant/WsImport.class"); // NOI18N + if ( wsImport == null ){ + return null; + } + FileObject wsImportRoot = classPath.findOwnerRoot(wsImport); + FileObject manifest = wsImportRoot.getFileObject("META-INF/MANIFEST.MF"); // NOI18N + try { + Manifest mnfst = new Manifest( manifest.getInputStream()); + String version = mnfst.getMainAttributes().getValue( + "Implementation-Version"); // NOI18N + if ( version.startsWith("2.2.")){ // NOI18N + /* + * version is 2.2 but it has minor release numbers so it is + * newer 2.2 version with fixed wsimport issue + */ + return null; + } + else if ( version.startsWith("2.2")){ // NOI18N + // buggy 2.2 version + FileObject badRoot = FileUtil.getArchiveFile(wsImport); + if ( badRoot== null){ + badRoot = classPath.findOwnerRoot(wsImport); + } + NotifyDescriptor notifyDescriptor = + new NotifyDescriptor.Message(NbBundle.getMessage(WSUtils.class, + "ERR_WsimportBadVersion", version, badRoot.getPath()), // NOI18N + NotifyDescriptor.ERROR_MESSAGE); + DialogDisplayer.getDefault().notify(notifyDescriptor); + Properties properties = new Properties(); + properties.put("wsimport.bad.version", Boolean.TRUE.toString()); // NOI18N + return properties; + } + else { + // version is not 2.2 ( older or newer ) + return null; + } + } + catch( IOException e ){ + Logger.getLogger(WSUtils.class.getName()).log(Level.INFO, null , e); + return null; + } + } } \ No newline at end of file diff -r 2e49f6df239b websvc.jaxwsmodel/src/org/netbeans/modules/websvc/jaxwsmodel/resources/jaxws-app-client.xsl --- a/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/jaxwsmodel/resources/jaxws-app-client.xsl Tue May 29 17:27:56 2012 +0400 +++ b/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/jaxwsmodel/resources/jaxws-app-client.xsl Fri Jun 01 16:10:36 2012 +0400 @@ -70,6 +70,7 @@ + diff -r 2e49f6df239b websvc.jaxwsmodel/src/org/netbeans/modules/websvc/jaxwsmodel/resources/jaxws-ejb.xsl --- a/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/jaxwsmodel/resources/jaxws-ejb.xsl Tue May 29 17:27:56 2012 +0400 +++ b/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/jaxwsmodel/resources/jaxws-ejb.xsl Fri Jun 01 16:10:36 2012 +0400 @@ -139,6 +139,7 @@ + diff -r 2e49f6df239b websvc.jaxwsmodel/src/org/netbeans/modules/websvc/jaxwsmodel/resources/jaxws-web.xsl --- a/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/jaxwsmodel/resources/jaxws-web.xsl Tue May 29 17:27:56 2012 +0400 +++ b/websvc.jaxwsmodel/src/org/netbeans/modules/websvc/jaxwsmodel/resources/jaxws-web.xsl Fri Jun 01 16:10:36 2012 +0400 @@ -134,6 +134,7 @@ +