我有一个管理RTF文档的创建和在该类调用的,用于显示一个XML文件中的RTF编辑器方法的类。
所有但一个用户可以没有任何问题访问此编辑器。 这一个用户始终运行到哪里他们的应用程序只是挂起的问题。 在任何的日志中没有错误。 通常,这样的问题是很容易识别,复制和纠正,但是,我不能为我再生的生命就这样我在尝试调试失败了。
基本代码如下:
int exitVal = CUBSRTFEditor.runRTFEditor("c:\\tmp\\control"+ap_doc_id+".xml", xml,"I:\\AppealsLetters.exe /process \"c:\\tmp\\control"+ap_doc_id+".xml\"");
public static int runRTFEditor(String xmlLocation, String xmlContent, String executePath)
{
int exitVal = 0;
createLocalFile(xmlLocation, xmlContent);
try
{
System.out.println("executePath must = "+executePath);
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(executePath);
System.out.println("after executePath runs");
//exhaust that stream before waiting for the process to exit
InputStream inputstream = proc.getInputStream();
InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
BufferedReader bufferedreader = new BufferedReader(inputstreamreader);
// read the ls output
String line;
while ((line = bufferedreader.readLine())!= null)
{
System.out.println(line);
}
exitVal = proc.waitFor();
}
catch (Throwable t)
{
t.printStackTrace();
}
CUBSRTFEditor.deleteTempFile(xmlLocation);
return exitVal;
}
最后的输出是第一的System.out。 当我把XML文件并执行此任何其他PC上执行没有问题。 我看到proc.getErrorStream()或proc.getOutputStream()没有任何有用的信息。
在这个问题上(EXEC吊)JDK的Javadoc文档: 由于某些本地平台只为标准输入和输出流提供有限的缓存器大小,未能及时写输入流或读出的子过程的输出流可能会导致子阻塞,甚至死锁。
我尝试排出该流等待进程退出之前似乎并没有帮助,因为它似乎从来就没到这一点(不显示第二的System.out)
有我实现了这个错误? 我失去了一些重要的东西? 如何获得更多的信息出来的过程中的任何想法将是巨大的。
我坚持....