Ignore:
Timestamp:
2013-09-08T05:14:39+02:00 (11 years ago)
Author:
Don-vip
Message:

Make some more defensive copies of user-supplied arrays, javadoc

File:
1 edited

Legend:

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

    r6221 r6222  
    256256   
    257257    /**
     258     * Copies the given array. Unlike {@link Arrays#copyOf}, this method is null-safe.
     259     * @param array The array to copy
     260     * @return A copy of the original array, or {@code null} if {@code array} is null
     261     * @since 6222
     262     */
     263    public static char[] copyArray(char[] array) {
     264        if (array != null) {
     265            return Arrays.copyOf(array, array.length);
     266        }
     267        return null;
     268    }
     269   
     270    /**
    258271     * Simple file copy function that will overwrite the target file.<br/>
    259272     * Taken from <a href="http://www.rgagnon.com/javadetails/java-0064.html">this article</a> (CC-NC-BY-SA)
     
    715728        return all.toString();
    716729    }
    717 
    718730}
Note: See TracChangeset for help on using the changeset viewer.