1
爲什麼Eclipse在下面的方法的第四行給我一個死代碼警告?它如何不可達?Eclipse的死代碼警告何時可達?
private void writeToSequenceFile() {
try {
CustomFileWriter nBatchWriter = new CustomFileWriter(sequeneceFileName, CONFIG_RESOURCE_NAME, "outputFile");
// The line below is a dead code?
lineBuilder.setString("Line", fileSequenceDate.concat(" ").concat(fileSequenceNo));
lineBuilder.setString("LineFeed", "\r");
nBatchWriter.writeRecord(lineBuilder.toRecord());
nBatchWriter.close();
} catch (Exception ex){
throw new NcoBusinessProgramException("Error Writing To Sequence File!");
}
}
保存,清理並重建。 – 2010-10-25 17:47:15
我的第一個想法是,你的構造函數中有一個'throw'行。 – Powerlord 2010-10-25 17:48:34
在另一點上,你應該在'finally'中關閉'nBatchWriter'。 – dogbane 2010-10-25 17:48:52