Details
-
Type:
CSR
-
Status: Closed
-
Priority:
P4
-
Resolution: Approved
-
Fix Version/s: 13
-
Component/s: core-libs
-
Labels:None
-
Subcomponent:
-
Compatibility Kind:behavioral
-
Compatibility Risk:minimal
-
Compatibility Risk Description:Only adds a @throws clause so no compatibility problems should present.
-
Interface Kind:Java API
-
Scope:SE
Description
Summary
DataOutputStream::writeUTF
should explicitly document that a UTFDataFormatException
is thrown if the input string is too long.
Problem
DataOutputStream::writeUTF
will throw a UTFDataFormatException
exception if the encoded UTF-8 character string is longer than 65535.
Solution
Document that DataOutputStream::writeUTF
will throw a UTFDataFormatException
exception if the encoded UTF-8 character string is longer than 65535.
Specification
java.io.DataOutputStream
:
@@ -317,7 +317,10 @@
* thrice the length of <code>str</code>.
*
* @param str a string to be written.
- * @exception IOException if an I/O error occurs.
+ * @throws UTFDataFormatException if the modified UTF-8 encoding of
+ * {@code str} would exceed 65535 bytes in length
+ * @throws IOException if some other I/O error occurs.
+ * @see #writeChars(String)
*/
public final void writeUTF(String str) throws IOException {}
Attachments
Issue Links
- csr of
-
JDK-8219196 DataOutputStream.writeUTF may throw unexpected exceptions
-
- Resolved
-