Incidencia #1073

Date#parse を消すパッチ
Abrir Fecha: 2003-01-20 19:35 Última actualización: 2003-01-21 12:56

Informador:
(Anónimo)
Propietario:
(Ninguno)
Tipo:
Estado:
Open
Componente:
(Ninguno)
Hito:
(Ninguno)
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Ninguno
Fichero:
1

Details

「メソッド parse(String) は型 Date で使用すべきではあり
ません。」がうざい方はどうぞ。

Ticket History (2/2 Histories)

2003-01-20 19:35 Updated by: None
  • File 302: dateparse.patch is attached
2003-01-21 12:56 Updated by: None
Comentario
Logged In: NO

すいません。
実行ファイルも黙ってしまいます。
修正パッチです。

Index: monalipse/server/LinkedObject.java
===================================================================
RCS file:
/cvsroot/monalipse/monalipse.plugin/src/monalipse/server/LinkedObject.java,v
retrieving revision 1.4
diff -u -r1.4 LinkedObject.java
--- monalipse/server/LinkedObject.java 21 Dec 2002
12:43:22 -0000 1.4
+++ monalipse/server/LinkedObject.java 21 Jan 2003 03:53:57
-0000
@@ -15,11 +15,14 @@
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.UnknownHostException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.logging.Logger;

@@ -29,6 +32,7 @@
import javax.imageio.stream.ImageInputStream;

import monalipse.MonalipsePlugin;
+
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.eclipse.core.resources.IFile;
@@ -219,12 +223,13 @@
out.close();
logger.finest("complete");
long mod = 0;
- try
- {
- mod =
Date.parse(get.getResponseHeader("Last-Modified").getValue());
- }
- catch (RuntimeException e)
- {
+ try {
+ String s =
get.getResponseHeader("Last-Modified").getValue();
+ DateFormat fmt = new SimpleDateFormat("EEE, d MMM
yyyy HH:mm:ss z", Locale.US);
+ Date d = fmt.parse(s);
+ mod = d.getTime();
+ } catch (Exception e) {
+ e.printStackTrace();
}
final long lastModified = mod;
final byte[] bytes = out.toByteArray();
Index: monalipse/server/giko/ThreadContentProvider.java
===================================================================
RCS file:
/cvsroot/monalipse/monalipse.plugin/src/monalipse/server/giko/ThreadContentProvider.java,v
retrieving revision 1.17
diff -u -r1.17 ThreadContentProvider.java
--- monalipse/server/giko/ThreadContentProvider.java 19 Jan
2003 15:26:47 -0000 1.17
+++ monalipse/server/giko/ThreadContentProvider.java 21 Jan
2003 03:53:59 -0000
@@ -14,10 +14,13 @@
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.logging.Logger;
import java.util.regex.Matcher;
@@ -883,12 +886,13 @@
contentRange = cin.getRange();
monitor.getRunner().run(null, this);

- try
- {
- serverTime =
Date.parse(method.getResponseHeader("Date").getValue()) / 1000;
- }
- catch (RuntimeException e)
- {
+ try {
+ String s = method.getResponseHeader("Date").getValue();
+ DateFormat fmt = new SimpleDateFormat("EEE, d MMM yyyy
HH:mm:ss z", Locale.US);
+ Date d = fmt.parse(s);
+ serverTime = d.getTime() / 1000;
+ } catch (Exception e) {
+ e.printStackTrace();
}
}

Attachment File List

Editar

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Entrar