Changeset 16629 in josm


Ignore:
Timestamp:
2020-06-14T17:17:02+02:00 (5 years ago)
Author:
simon04
Message:

see #19334 - https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r16628 r16629  
    302302            <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
    303303            <compilerarg value="-XDignore.symbol.file"/>
    304             <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:ShortCircuitBoolean:OFF -Xep:StringSplitter:OFF -Xep:JdkObsolete:OFF -Xep:UnnecessaryParentheses:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:JavaTimeDefaultTimeZone:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:MutablePublicArray:OFF"/>
     304            <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:ShortCircuitBoolean:OFF -Xep:StringSplitter:OFF -Xep:JdkObsolete:OFF -Xep:UnnecessaryParentheses:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:MutablePublicArray:OFF"/>
    305305            <compilerarg line="-Xmaxwarns 1000"/>
    306306            <classpath>
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r16509 r16629  
    9898        try {
    9999            if (info.getUrl() != null && info.getUrl().contains("{time}")) {
    100                 final String instant = Year.now().atDay(1).atStartOfDay(ZoneOffset.UTC).toInstant().toString();
     100                final String instant = Year.now(ZoneOffset.UTC).atDay(1).atStartOfDay(ZoneOffset.UTC).toInstant().toString();
    101101                final String example = String.join("/", instant, instant);
    102102                final String initialSelectionValue = info.getDate() != null ? info.getDate() : example;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/DateValidator.java

    r13849 r16629  
    55
    66import java.time.LocalDate;
     7import java.time.ZoneId;
    78import java.time.ZonedDateTime;
    89import java.time.format.DateTimeFormatter;
     
    5960     */
    6061    public String getStandardTooltipText() {
    61         final ZonedDateTime now = ZonedDateTime.now();
     62        final ZonedDateTime now = ZonedDateTime.now(ZoneId.systemDefault());
    6263        return tr(
    6364                "Please enter a date in the usual format for your locale.<br>"
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/TimeValidator.java

    r13849 r16629  
    55
    66import java.time.LocalTime;
     7import java.time.ZoneId;
    78import java.time.ZonedDateTime;
    89import java.time.format.DateTimeFormatter;
     
    6162     */
    6263    public String getStandardTooltipText() {
    63         final ZonedDateTime now = ZonedDateTime.now();
     64        final ZonedDateTime now = ZonedDateTime.now(ZoneId.systemDefault());
    6465        return tr(
    6566                "Please enter a valid time in the usual format for your locale.<br>"
  • trunk/src/org/openstreetmap/josm/gui/download/UserQueryList.java

    r16488 r16629  
    1515import java.awt.event.MouseEvent;
    1616import java.time.LocalDateTime;
     17import java.time.ZoneId;
    1718import java.time.format.DateTimeFormatter;
    1819import java.time.format.DateTimeParseException;
     
    136137        if (!historicExist) {
    137138            SelectorItem item = new SelectorItem(
    138                     TRANSLATED_HISTORY + " " + LocalDateTime.now().format(FORMAT), query);
     139                    TRANSLATED_HISTORY + " " + LocalDateTime.now(ZoneId.systemDefault()).format(FORMAT), query);
    139140
    140141            this.items.put(item.getKey(), item);
     
    540541                            this.query.getText(),
    541542                            !newKey.equals(itemKey) || !newQuery.equals(itemQuery)
    542                                 ? LocalDateTime.now()
     543                                ? LocalDateTime.now(ZoneId.systemDefault())
    543544                                : this.itemToEdit.getLastEdit()));
    544545
     
    571572         */
    572573        public SelectorItem(String key, String query) {
    573             this(key, query, LocalDateTime.now());
     574            this(key, query, LocalDateTime.now(ZoneId.systemDefault()));
    574575        }
    575576
  • trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java

    r15497 r16629  
    1313import java.text.MessageFormat;
    1414import java.time.Year;
     15import java.time.ZoneId;
    1516import java.util.Optional;
    1617
     
    291292            if (copyrightYear.getText().isEmpty()) {
    292293                copyrightYear.setText(Optional.ofNullable(data.getString(META_COPYRIGHT_YEAR)).orElseGet(
    293                         () -> Year.now().toString()));
     294                        () -> Year.now(ZoneId.systemDefault()).toString()));
    294295            }
    295296            if (copyright.getText().isEmpty()) {
  • trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java

    r15447 r16629  
    1010import java.time.LocalDateTime;
    1111import java.time.Period;
     12import java.time.ZoneId;
    1213import java.time.ZoneOffset;
    1314import java.util.Arrays;
     
    205206                switch (matcher.group(1)) {
    206207                    case "date":
    207                         matcher.appendReplacement(sb, date(matcher.group(2), LocalDateTime.now()));
     208                        matcher.appendReplacement(sb, date(matcher.group(2), LocalDateTime.now(ZoneId.systemDefault())));
    208209                        break;
    209210                    case "geocodeArea":
Note: See TracChangeset for help on using the changeset viewer.