提交 4fe5f8ca 编写于 作者: L lagergren

8022454: Fixed various serializations and deprecation warnings in java.util, java.net and sun.tools

Reviewed-by: darcy
Contributed-by: marcus.lagergren@oracle.com
上级 11ce7543
...@@ -39,4 +39,7 @@ package java.net; ...@@ -39,4 +39,7 @@ package java.net;
* @since 1.4 * @since 1.4
*/ */
public abstract class SocketAddress implements java.io.Serializable { public abstract class SocketAddress implements java.io.Serializable {
static final long serialVersionUID = 5215720748342549866L;
} }
...@@ -47,7 +47,7 @@ public class XMLFormatter extends Formatter { ...@@ -47,7 +47,7 @@ public class XMLFormatter extends Formatter {
private LogManager manager = LogManager.getLogManager(); private LogManager manager = LogManager.getLogManager();
// Append a two digit number. // Append a two digit number.
private void a2(StringBuffer sb, int x) { private void a2(StringBuilder sb, int x) {
if (x < 10) { if (x < 10) {
sb.append('0'); sb.append('0');
} }
...@@ -55,25 +55,26 @@ public class XMLFormatter extends Formatter { ...@@ -55,25 +55,26 @@ public class XMLFormatter extends Formatter {
} }
// Append the time and date in ISO 8601 format // Append the time and date in ISO 8601 format
private void appendISO8601(StringBuffer sb, long millis) { private void appendISO8601(StringBuilder sb, long millis) {
Date date = new Date(millis); GregorianCalendar cal = new GregorianCalendar();
sb.append(date.getYear() + 1900); cal.setTimeInMillis(millis);
sb.append(cal.get(Calendar.YEAR) + 1900);
sb.append('-'); sb.append('-');
a2(sb, date.getMonth() + 1); a2(sb, cal.get(Calendar.MONTH) + 1);
sb.append('-'); sb.append('-');
a2(sb, date.getDate()); a2(sb, cal.get(Calendar.DAY_OF_MONTH));
sb.append('T'); sb.append('T');
a2(sb, date.getHours()); a2(sb, cal.get(Calendar.HOUR_OF_DAY));
sb.append(':'); sb.append(':');
a2(sb, date.getMinutes()); a2(sb, cal.get(Calendar.MINUTE));
sb.append(':'); sb.append(':');
a2(sb, date.getSeconds()); a2(sb, cal.get(Calendar.SECOND));
} }
// Append to the given StringBuffer an escaped version of the // Append to the given StringBuilder an escaped version of the
// given text string where XML special characters have been escaped. // given text string where XML special characters have been escaped.
// For a null string we append "<null>" // For a null string we append "<null>"
private void escape(StringBuffer sb, String text) { private void escape(StringBuilder sb, String text) {
if (text == null) { if (text == null) {
text = "<null>"; text = "<null>";
} }
...@@ -102,7 +103,7 @@ public class XMLFormatter extends Formatter { ...@@ -102,7 +103,7 @@ public class XMLFormatter extends Formatter {
* @return a formatted log record * @return a formatted log record
*/ */
public String format(LogRecord record) { public String format(LogRecord record) {
StringBuffer sb = new StringBuffer(500); StringBuilder sb = new StringBuilder(500);
sb.append("<record>\n"); sb.append("<record>\n");
sb.append(" <date>"); sb.append(" <date>");
...@@ -224,7 +225,7 @@ public class XMLFormatter extends Formatter { ...@@ -224,7 +225,7 @@ public class XMLFormatter extends Formatter {
* @return a valid XML string * @return a valid XML string
*/ */
public String getHead(Handler h) { public String getHead(Handler h) {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
String encoding; String encoding;
sb.append("<?xml version=\"1.0\""); sb.append("<?xml version=\"1.0\"");
......
...@@ -29,6 +29,9 @@ import java.io.IOException; ...@@ -29,6 +29,9 @@ import java.io.IOException;
public public
class JarException extends IOException { class JarException extends IOException {
static final long serialVersionUID = -4351820108009811497L;
public JarException() { public JarException() {
super(); super();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册