Ignore:
Timestamp:
2016-05-30T01:17:28+02:00 (9 years ago)
Author:
Don-vip
Message:

sonar - Performance - Method passes constant String of length 1 to character overridden method + add unit tests/javadoc

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r10160 r10300  
    122122                final boolean hasReason = reasonForRequest != null && !reasonForRequest.isEmpty();
    123123                Main.info("{0} {1}{2} -> {3}{4}",
    124                         requestMethod, url, hasReason ? " (" + reasonForRequest + ")" : "",
     124                        requestMethod, url, hasReason ? (" (" + reasonForRequest + ')') : "",
    125125                        connection.getResponseCode(),
    126126                        connection.getContentLengthLong() > 0
    127                                 ? " (" + Utils.getSizeString(connection.getContentLengthLong(), Locale.getDefault()) + ")"
     127                                ? (" (" + Utils.getSizeString(connection.getContentLengthLong(), Locale.getDefault()) + ')')
    128128                                : ""
    129129                );
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r10212 r10300  
    928928            } else {
    929929                final String fnMD5 = Utils.md5Hex(fn);
    930                 url = b + fnMD5.substring(0, 1) + '/' + fnMD5.substring(0, 2) + "/" + fn;
     930                url = b + fnMD5.substring(0, 1) + '/' + fnMD5.substring(0, 2) + '/' + fn;
    931931            }
    932932            result = getIfAvailableHttp(url, type);
  • trunk/src/org/openstreetmap/josm/tools/Pair.java

    r9983 r10300  
    4242        Pair<?, ?> pair = (Pair<?, ?>) other;
    4343        return Objects.equals(a, pair.a) &&
    44                 Objects.equals(b, pair.b);
     44               Objects.equals(b, pair.b);
    4545    }
    4646
     
    6262    @Override
    6363    public String toString() {
    64         return "<"+a+','+b+'>';
     64        return '<'+a.toString()+','+b.toString()+'>';
    6565    }
    6666
  • trunk/src/org/openstreetmap/josm/tools/bugreport/BugReport.java

    r10285 r10300  
    7070            if (className.equals(element.getClassName()) && "getCallingMethod".equals(element.getMethodName())) {
    7171                StackTraceElement toReturn = stackTrace[i + offset];
    72                 return toReturn.getClassName().replaceFirst(".*\\.", "") + "#" + toReturn.getMethodName();
     72                return toReturn.getClassName().replaceFirst(".*\\.", "") + '#' + toReturn.getMethodName();
    7373            }
    7474        }
  • trunk/src/org/openstreetmap/josm/tools/bugreport/ReportedException.java

    r10285 r10300  
    124124
    125125    private static String niceThreadName(Thread thread) {
    126         String name = "Thread: " + thread.getName() + " (" + thread.getId() + ")";
     126        String name = "Thread: " + thread.getName() + " (" + thread.getId() + ')';
    127127        ThreadGroup threadGroup = thread.getThreadGroup();
    128128        if (threadGroup != null) {
     
    221221    @Override
    222222    public String toString() {
    223         StringBuilder builder = new StringBuilder();
    224         builder.append("CrashReportedException [on thread ");
    225         builder.append(caughtOnThread);
    226         builder.append("]");
    227         return builder.toString();
     223        return new StringBuilder(48)
     224            .append("CrashReportedException [on thread ")
     225            .append(caughtOnThread)
     226            .append(']')
     227            .toString();
    228228    }
    229229
     
    235235            this.key = key;
    236236            this.value = value;
    237 
    238237        }
    239238
     
    273272         */
    274273        public void printSection(PrintWriter out) {
    275             out.println(sectionName + ":");
     274            out.println(sectionName + ':');
    276275            if (entries.isEmpty()) {
    277276                out.println("No data collected.");
Note: See TracChangeset for help on using the changeset viewer.