Ignore:
Timestamp:
2014-04-28T16:41:29+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8465 - fix @SafeVarargs warning, see http://docs.oracle.com/javase/7/docs/api/java/lang/SafeVarargs.html

File:
1 edited

Legend:

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

    r7009 r7019  
    126126    /**
    127127     * Returns the first element from {@code items} which is non-null, or null if all elements are null.
    128      */
     128     * @param items the items to look for
     129     * @return first non-null item if there is one
     130     */
     131    @SafeVarargs
    129132    public static <T> T firstNonNull(T... items) {
    130133        for (T i : items) {
     
    972975        }
    973976    }
    974    
    975     /**
    976      * Fixes URL with illegal characters in the query (and fragment) part by 
     977
     978    /**
     979     * Fixes URL with illegal characters in the query (and fragment) part by
    977980     * percent encoding those characters.
    978      * 
     981     *
    979982     * special characters like &amp; and # are not encoded
    980      * 
     983     *
    981984     * @param url the URL that should be fixed
    982985     * @return the repaired URL
    983986     */
    984987    public static String fixURLQuery(String url) {
    985         if (url.indexOf('?') == -1) 
     988        if (url.indexOf('?') == -1)
    986989            return url;
    987        
     990
    988991        String query = url.substring(url.indexOf('?') + 1);
    989        
     992
    990993        StringBuilder sb = new StringBuilder(url.substring(0, url.indexOf('?') + 1));
    991        
     994
    992995        for (int i=0; i<query.length(); i++) {
    993996            String c = query.substring(i, i+1);
     
    10041007        return sb.toString();
    10051008    }
    1006    
     1009
    10071010}
Note: See TracChangeset for help on using the changeset viewer.