從我們最近從WSED 5.2轉向RAD 7.5的過程中,我們的代碼中出現了應用程序破壞的問題。StaticWriter和Writer類之間的衝突
RAD7.5馬克它正是如此,所有的類頭的聲明(public類FoStringWriter擴展的StringWriter實現FoWriter {)
- Exception IOException in throws clause of Writer.append(CharSequence, int, int) is not compatable with StringWriter.append(CharSequence, int, int)
- Exception IOException in throws clause of Writer.append(char) is not compatable with StringWriter.append(char)
- Exception IOException in throws clause of Writer.append(CharSequence) is not compatable with StringWriter.append(CharSequence)
每一塊文學的我已經能夠找到在網絡上點這是Eclipse中的一個'錯誤',但我的開發人員應該已經擁有最新版本的Eclipse軟件。所以我不知道該怎麼做這個錯誤。有沒有我剛剛尚未更新的IBM修復程序?還是有一個代碼修復可以糾正這個錯誤?
public class FoStringWriter extends StringWriter implements FoWriter {
public void filteredWrite(String str) throws IOException {
FoStringWriter.filteredWrite(str,this);
}
public static void filteredWrite(String str, StringWriter writer) throws IOException {
if (str == null) str = "";
TagUtils tagUtils = TagUtils.getInstance();
str = tagUtils.filter(str);
HashMap dictionary = new HashMap();
dictionary.put("&#","&#");
str = GeneralUtils.translate(str,dictionary);
writer.write(str);
}
}
Editory注:
,這種運行產生的PDF文檔爲我們的應用程序的過程。在WSED 5.5中,它工作,出現了一些錯誤,但沒有任何東西阻止了PDF的寫入。
是否有任何理由讓'FoStringWriter'成爲'StringWriter'的一個子類?使它成爲FilterWriter的子類,它委託給一個任意的Writer(它可能是一個StringWriter)似乎更自然。它可能會解決您的編譯問題,作爲一個副作用。 – Holger
@Holger我按照你的建議試過這個,但它似乎爲我創造了一個完全不同的問題。在應用程序wpm中的servlet操作的服務方法之一中創建的未捕獲異常。創建的異常:javax.servlet.ServletException:java.lang.NoSuchMethodError:ny/dol/wpm/pdf/FoStringWriter。請注意,我不得不在其他類中調用FoStringWriter,因爲沒有構造函數的FilterWrite沒有參數,這是FoStringwriter之前被調用的方式。我還必須添加一個(作家)構造函數。 – Zibbobz
'NoSuchMethodError'指示並非所有類都已正確更新。順便說一句,添加一個默認的構造函數到新的'FoStringWriter'中並不難,因爲這個''FoStringWriter'創建一個'StringWriter'作爲目標'Writer'並將其傳遞給超級構造函數。但是更大的問題是錯誤表明沒有找到編寫器的構造函數,所以它是沒有更新的'FoStringWriter'類本身。 – Holger