Ignore:
Timestamp:
2016-05-18T17:44:31+02:00 (8 years ago)
Author:
Don-vip
Message:

findbugs - UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java

    r10242 r10250  
    103103    public void loadGridShiftFile(InputStream in, boolean loadAccuracy) throws IOException {
    104104        byte[] b8 = new byte[8];
    105         boolean bigEndian = true;
    106105        fromEllipsoid = "";
    107106        toEllipsoid = "";
     
    111110        if (!"NUM_OREC".equals(overviewHeaderCountId))
    112111            throw new IllegalArgumentException("Input file is not an NTv2 grid shift file");
     112        boolean bigEndian;
    113113        readBytes(in, b8);
    114114        overviewHeaderCount = NTV2Util.getIntBE(b8, 0);
     
    204204     */
    205205    public boolean gridShiftForward(NTV2GridShift gs) {
    206         // Try the last sub grid first, big chance the coord is still within it
    207         NTV2SubGrid subGrid = lastSubGrid.getSubGridForCoord(gs.getLonPositiveWestSeconds(), gs.getLatSeconds());
     206        NTV2SubGrid subGrid = null;
     207        if (lastSubGrid != null) {
     208            // Try the last sub grid first, big chance the coord is still within it
     209            subGrid = lastSubGrid.getSubGridForCoord(gs.getLonPositiveWestSeconds(), gs.getLatSeconds());
     210        }
    208211        if (subGrid == null) {
    209             subGrid = getSubGrid(gs.getLonPositiveWestSeconds(), gs.getLatSeconds());
    210         }
    211         if (subGrid == null)
     212            subGrid = getSubGrid(topLevelSubGrid, gs.getLonPositiveWestSeconds(), gs.getLatSeconds());
     213        }
     214        if (subGrid == null) {
    212215            return false;
    213         else {
     216        } else {
    214217            subGrid.interpolateGridShift(gs);
    215218            gs.setSubGridName(subGrid.getSubGridName());
     
    251254
    252255    /**
    253      * Find the finest SubGrid containing the coordinate, specified
    254      * in Positive West Seconds
    255      *
     256     * Find the finest SubGrid containing the coordinate, specified in Positive West Seconds
     257     * @param topLevelSubGrid top level subgrid
    256258     * @param lon Longitude in Positive West Seconds
    257259     * @param lat Latitude in Seconds
    258260     * @return The SubGrid found or null
    259261     */
    260     private NTV2SubGrid getSubGrid(double lon, double lat) {
     262    private static NTV2SubGrid getSubGrid(NTV2SubGrid[] topLevelSubGrid, double lon, double lat) {
    261263        NTV2SubGrid sub = null;
    262264        for (int i = 0; i < topLevelSubGrid.length; i++) {
Note: See TracChangeset for help on using the changeset viewer.