Просмотр исходного кода

Handle core date API changes.

pull/462/head
Chris Smith 8 лет назад
Родитель
Сommit
271919a875

+ 3
- 5
logging/src/com/dmdirc/addons/logging/LoggingManager.java Просмотреть файл

73
 import java.nio.file.Paths;
73
 import java.nio.file.Paths;
74
 import java.text.DateFormat;
74
 import java.text.DateFormat;
75
 import java.text.SimpleDateFormat;
75
 import java.text.SimpleDateFormat;
76
+import java.time.format.DateTimeFormatter;
76
 import java.util.ArrayList;
77
 import java.util.ArrayList;
77
 import java.util.Collection;
78
 import java.util.Collection;
78
 import java.util.Collections;
79
 import java.util.Collections;
275
     @Handler
276
     @Handler
276
     public void handleChannelGotTopic(final ChannelGotTopicEvent event) {
277
     public void handleChannelGotTopic(final ChannelGotTopicEvent event) {
277
         final String filename = locator.getLogFile(event.getChannel());
278
         final String filename = locator.getLogFile(event.getChannel());
278
-        final DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
279
-        final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
280
-
281
         appendLine(filename, "*** Topic is: %s", event.getTopic().getTopic());
279
         appendLine(filename, "*** Topic is: %s", event.getTopic().getTopic());
282
         appendLine(filename, "*** Set at: %s on %s by %s",
280
         appendLine(filename, "*** Set at: %s on %s by %s",
283
-                timeFormat.format(event.getTopic().getDate()),
284
-                dateFormat.format(event.getTopic().getDate()),
281
+                event.getTopic().getDate().format(DateTimeFormatter.ofPattern("HH:mm:ss")),
282
+                event.getTopic().getDate().format(DateTimeFormatter.ofPattern("dd/MM/yyyy")),
285
                         event.getTopic().getClient()
283
                         event.getTopic().getClient()
286
                                 .map(GroupChatUser::getNickname).orElse("Unknown"));
284
                                 .map(GroupChatUser::getNickname).orElse("Unknown"));
287
     }
285
     }

+ 2
- 2
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/errors/ErrorsDialogController.java Просмотреть файл

30
 import com.dmdirc.logger.ErrorReportStatus;
30
 import com.dmdirc.logger.ErrorReportStatus;
31
 import com.dmdirc.ui.core.errors.DisplayableError;
31
 import com.dmdirc.ui.core.errors.DisplayableError;
32
 
32
 
33
-import java.text.SimpleDateFormat;
33
+import java.time.format.DateTimeFormatter;
34
 import java.util.Optional;
34
 import java.util.Optional;
35
 
35
 
36
 import javax.swing.JButton;
36
 import javax.swing.JButton;
124
                 table.getSelectionModel().setSelectionInterval(-1, -1);
124
                 table.getSelectionModel().setSelectionInterval(-1, -1);
125
             }
125
             }
126
             date.setText(selectedError.map(DisplayableError::getDate)
126
             date.setText(selectedError.map(DisplayableError::getDate)
127
-                    .map(d -> new SimpleDateFormat("MMM dd hh:mm aa").format(d)).orElse(""));
127
+                    .map(d -> d.format(DateTimeFormatter.ofPattern("MMM dd hh:mm aa"))).orElse(""));
128
             severity.setText(selectedError.map(DisplayableError::getSeverity)
128
             severity.setText(selectedError.map(DisplayableError::getSeverity)
129
                     .map(ErrorLevel::name).orElse(""));
129
                     .map(ErrorLevel::name).orElse(""));
130
             reportStatus.setText(
130
             reportStatus.setText(

Загрузка…
Отмена
Сохранить