2013-04-15 28 views
1

下面的代碼:阿帕奇公地StringEscapeUtils.unescapeJava( 「\」)返回 「」

final String INVALID_ESCAPE="\\"; 
System.out.println(String.format("'%s' -> '%s'", INVALID_ESCAPE, 
    StringEscapeUtils.unescapeJava(INVALID_ESCAPE))); 

...生產:

'\' -> '' 

在控制檯上。由於'\'不是有效的轉義,我期望在運行時發生異常。我錯過了什麼?

UPDATE: 填寫Apache jira

+0

我會建議你要麼提交Bug HTTPS ://issues.apache.org/jira/browse/LANG或發佈到郵件列表。有人應該很快就能告訴你該方法的預期目的是什麼,以及是否發現了一個錯誤。 –

回答

2

bug報告從source(?):在

// TODO: throw "illegal character: \92" as an Exception if a \ on the end of the Java (as per the compiler)? 

發送補丁;-)