Author: dennyxu
Date: 2008-07-09 01:27:58 -0400 (Wed, 09 Jul 2008)
New Revision: 9102
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
Log:
JBIDE-2491: fix the bug that unable to generate code from a wsdl document that has a
reference to a xsd file
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2008-07-08
21:56:22 UTC (rev 9101)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2008-07-09
05:27:58 UTC (rev 9102)
@@ -29,6 +29,7 @@
protected ServiceModel model;
private String cmdFileName_linux;
private String cmdFileName_win;
+
public AbstractGenerateCodeCommand(ServiceModel model){
this.model = model;
@@ -66,24 +67,30 @@
command += " -k " + args + " " + model.getWsdlURI();
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(command, null, new File(commandLocation));
+ StringBuffer errorResult = new StringBuffer();
+ StringBuffer inputResult = new StringBuffer();
+
+ convertInputStreamToString(errorResult, proc.getErrorStream());
+ convertInputStreamToString(errorResult, proc.getInputStream());
+
int exitValue = proc.waitFor();
if(exitValue != 0){
- return
StatusUtils.errorStatus(convertInputStreamToString(proc.getErrorStream()));
+ return StatusUtils.errorStatus(errorResult.toString());
+ }else{
+ String resultInput = inputResult.toString();
+ if(resultInput != null &&
resultInput.indexOf("[ERROR]") >= 0){
+ JBossWSCreationCore.getDefault().logError(resultInput);
+ IStatus errorStatus = StatusUtils.errorStatus(resultInput);
+ status = StatusUtils
+ .errorStatus(
+ JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
+ new CoreException(errorStatus));
+ }else{
+ JBossWSCreationCore.getDefault().logInfo(resultInput);
+ }
}
- // log the result of the command execution
- String resultOutput = convertInputStreamToString(proc.getInputStream());
- if(resultOutput != null && resultOutput.indexOf("[ERROR]")
>= 0){
- JBossWSCreationCore.getDefault().logError(resultOutput);
- IStatus errorStatus = StatusUtils.errorStatus(resultOutput);
- status = StatusUtils
- .errorStatus(
- JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
- new CoreException(errorStatus));
- }else{
- JBossWSCreationCore.getDefault().logInfo(resultOutput);
- }
} catch (IOException e) {
JBossWSCreationCore.getDefault().logError(e);
@@ -101,18 +108,32 @@
return status;
}
- private String convertInputStreamToString(InputStream input) throws IOException{
- InputStreamReader ir = new InputStreamReader(input);
- LineNumberReader reader = new LineNumberReader(ir);
- String str = reader.readLine();
- StringBuffer result = new StringBuffer();
- while(str != null){
- result.append(str).append("\t\r");
- str = reader.readLine();
-
- }
- return result.toString();
+ private void convertInputStreamToString(final StringBuffer result, final InputStream
input) {
+
+ Thread thread = new Thread() {
+ public void run() {
+
+ try {
+ InputStreamReader ir = new InputStreamReader(input);
+ LineNumberReader reader = new LineNumberReader(ir);
+ String str;
+ str = reader.readLine();
+ while (str != null) {
+ result.append(str).append("\t\r");
+ str = reader.readLine();
+
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ };
+
+ thread.start();
+
}
+
private void refreshProject(String project, IProgressMonitor monitor){
try {
JBossWSCreationUtils.getProjectByName(project).refreshLocal(2, monitor);
@@ -127,5 +148,6 @@
abstract protected String getCommandLineFileName_linux();
abstract protected String getCommandLineFileName_win();
+
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-07-08
21:56:22 UTC (rev 9101)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-07-09
05:27:58 UTC (rev 9102)
@@ -1,4 +1,4 @@
-Label_Custom_Package_Name=Custom package name
+Label_Custom_Package_Name=Package name
Label_Catalog_File=Catalog file
Label_Button_Text_Seletion= &Add
Label_Generate_Impelemtation=Generate default Web Service Implementation classes
@@ -31,7 +31,7 @@
Error_Create_Client_Sample=When create a client sample, a error comes up. Please check
the generated files.
WebEndpoint=WebEndpoint
-Error_WS_Chose_runtime=Select an JBoss Web Service runtime. If a server supplied JBoss
Web Service runtime is chosen , the chosen server adapter must be capable of providing the
JBoss Web Service runtime
+Error_WS_Chose_runtime=Select an JBoss Web Service runtime. If a server supplied JBoss
Web Service runtime is chosen ,\r\n the chosen server adapter must be capable of providing
the JBoss Web Service runtime
Error_WS_No_Runtime_Specifed=A JBossWS runtime has not been chosen
JBossWSFacetInstallPage_Title=JBossWS Facet
JBossWSFacetInstallPage_Description=Select JBossWS Web Service runtime
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2008-07-08
21:56:22 UTC (rev 9101)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2008-07-09
05:27:58 UTC (rev 9102)
@@ -33,5 +33,5 @@
JBossWS_SWT_Field_Editor_Factory_Browse=Browse...
JBossWS_SWT_Field_Editor_Factory_Select_Home_Folder=Select JBossWS Home Folder
JBossWS_Runtime_List_Field_Editor_Name2=Name:
-JBossWS_Runtime_Check_Field_Default_Classpath=Configure JBoss Web Service Classpath
+JBossWS_Runtime_Check_Field_Default_Classpath=Customize JBoss Web Service runtime jars
JBossWS_Preference_Page_Runtimes=JBossWS Runtimes
\ No newline at end of file
Show replies by date