Changeset 6987 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2014-04-16T02:29:53+02:00 (10 years ago)
Author:
Don-vip
Message:

sonar - fix some more issues

Location:
trunk/src/org/openstreetmap/josm
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DownloadAlongAction.java

    r6643 r6987  
    4545    }
    4646   
    47     protected static void addToDownload(Area a, Rectangle2D r, Collection<Rectangle2D> results, double max_area) {
     47    protected static void addToDownload(Area a, Rectangle2D r, Collection<Rectangle2D> results, double maxArea) {
    4848        Area tmp = new Area(r);
    4949        // intersect with sought-after area
     
    5353        }
    5454        Rectangle2D bounds = tmp.getBounds2D();
    55         if (bounds.getWidth() * bounds.getHeight() > max_area) {
     55        if (bounds.getWidth() * bounds.getHeight() > maxArea) {
    5656            // the rectangle gets too large; split it and make recursive call.
    5757            Rectangle2D r1;
     
    6868                        bounds.getHeight() / 2);
    6969            }
    70             addToDownload(a, r1, results, max_area);
    71             addToDownload(a, r2, results, max_area);
     70            addToDownload(a, r1, results, maxArea);
     71            addToDownload(a, r2, results, maxArea);
    7272        } else {
    7373            results.add(bounds);
     
    9292     * the areas if applicable.
    9393     */
    94     protected static void confirmAndDownloadAreas(Area a, double max_area, boolean osmDownload, boolean gpxDownload, String title, ProgressMonitor progressMonitor) {
     94    protected static void confirmAndDownloadAreas(Area a, double maxArea, boolean osmDownload, boolean gpxDownload, String title, ProgressMonitor progressMonitor) {
    9595        List<Rectangle2D> toDownload = new ArrayList<Rectangle2D>();
    96         addToDownload(a, a.getBounds(), toDownload, max_area);
     96        addToDownload(a, a.getBounds(), toDownload, maxArea);
    9797        if (toDownload.isEmpty()) {
    9898            return;
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r6977 r6987  
    112112        public boolean insideToTheRight;
    113113
    114         public WayInPolygon(Way _way, boolean _insideRight) {
    115             this.way = _way;
    116             this.insideToTheRight = _insideRight;
     114        public WayInPolygon(Way way, boolean insideRight) {
     115            this.way = way;
     116            this.insideToTheRight = insideRight;
    117117        }
    118118
     
    289289        public final AssembledMultipolygon pol;
    290290
    291         public PolygonLevel(AssembledMultipolygon _pol, int _level) {
    292             pol = _pol;
    293             level = _level;
     291        public PolygonLevel(AssembledMultipolygon pol, int level) {
     292            this.pol = pol;
     293            this.level = level;
    294294        }
    295295    }
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r6986 r6987  
    518518     * Class contains some auxiliary functions
    519519     */
    520     private static class EN {
     520    private static final class EN {
    521521        private EN() {
    522522            // Hide implicit public constructor for utility class
  • trunk/src/org/openstreetmap/josm/actions/upload/CyclicUploadDependencyException.java

    r6822 r6987  
    1111
    1212public class CyclicUploadDependencyException extends Exception {
    13     private Stack<Relation> cycle;
     13    private final Stack<Relation> cycle;
    1414
    1515    public CyclicUploadDependencyException(Stack<Relation> cycle) {
    16         super();
    1716        this.cycle = cycle;
    1817    }
  • trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java

    r6986 r6987  
    9292     * @since 5787
    9393     */
    94     public static class TagSwitcher {
     94    public static final class TagSwitcher {
    9595
    9696        private TagSwitcher() {
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r6986 r6987  
    739739     * Also contains functions that convert preferences object to JavaScript object and back
    740740     */
    741     public static class PreferencesUtils {
     741    public static final class PreferencesUtils {
    742742
    743743        private PreferencesUtils() {
  • trunk/src/org/openstreetmap/josm/data/osm/DataIntegrityProblemException.java

    r5170 r6987  
    44public class DataIntegrityProblemException extends RuntimeException {
    55
    6     private String htmlMessage;
     6    private final String htmlMessage;
    77
    88    public DataIntegrityProblemException(String message) {
    9         super(message);
     9        this(message, null);
    1010    }
    1111
  • trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java

    r6974 r6987  
    237237     * convert cartesian coordinates to ellipsoidal coordinates
    238238     *
    239      * @param XYZ the coordinates in meters (X, Y, Z)
     239     * @param xyz the coordinates in meters (X, Y, Z)
    240240     * @return The corresponding latitude and longitude in degrees
    241241     */
    242     public LatLon cart2LatLon(double[] XYZ) {
    243         return cart2LatLon(XYZ, 1e-11);
    244     }
    245     public LatLon cart2LatLon(double[] XYZ, double epsilon) {
    246         double norm = Math.sqrt(XYZ[0] * XYZ[0] + XYZ[1] * XYZ[1]);
    247         double lg = 2.0 * Math.atan(XYZ[1] / (XYZ[0] + norm));
    248         double lt = Math.atan(XYZ[2] / (norm * (1.0 - (a * e2 / Math.sqrt(XYZ[0] * XYZ[0] + XYZ[1] * XYZ[1] + XYZ[2] * XYZ[2])))));
     242    public LatLon cart2LatLon(double[] xyz) {
     243        return cart2LatLon(xyz, 1e-11);
     244    }
     245
     246    public LatLon cart2LatLon(double[] xyz, double epsilon) {
     247        double norm = Math.sqrt(xyz[0] * xyz[0] + xyz[1] * xyz[1]);
     248        double lg = 2.0 * Math.atan(xyz[1] / (xyz[0] + norm));
     249        double lt = Math.atan(xyz[2] / (norm * (1.0 - (a * e2 / Math.sqrt(xyz[0] * xyz[0] + xyz[1] * xyz[1] + xyz[2] * xyz[2])))));
    249250        double delta = 1.0;
    250251        while (delta > epsilon) {
    251252            double s2 = Math.sin(lt);
    252253            s2 *= s2;
    253             double l = Math.atan((XYZ[2] / norm)
     254            double l = Math.atan((xyz[2] / norm)
    254255                    / (1.0 - (a * e2 * Math.cos(lt) / (norm * Math.sqrt(1.0 - e2 * s2)))));
    255256            delta = Math.abs(l - lt);
     
    270271
    271272        double Rn = a / Math.sqrt(1 - e2 * Math.pow(Math.sin(phi), 2));
    272         double[] XYZ = new double[3];
    273         XYZ[0] = Rn * Math.cos(phi) * Math.cos(lambda);
    274         XYZ[1] = Rn * Math.cos(phi) * Math.sin(lambda);
    275         XYZ[2] = Rn * (1 - e2) * Math.sin(phi);
    276 
    277         return XYZ;
     273        double[] xyz = new double[3];
     274        xyz[0] = Rn * Math.cos(phi) * Math.cos(lambda);
     275        xyz[1] = Rn * Math.cos(phi) * Math.sin(lambda);
     276        xyz[2] = Rn * (1 - e2) * Math.sin(phi);
     277
     278        return xyz;
    278279    }
    279280}
  • trunk/src/org/openstreetmap/josm/gui/MenuScroller.java

    r6986 r6987  
    439439    protected void finalize() throws Throwable {
    440440        dispose();
     441        super.finalize();
    441442    }
    442443
     
    566567        UP(9, 1, 9),
    567568        DOWN(1, 9, 1);
    568         static final int[] xPoints = {1, 5, 9};
     569        static final int[] XPOINTS = {1, 5, 9};
    569570        final int[] yPoints;
    570571
     
    578579            Graphics g2 = g.create(size.width / 2 - 5, size.height / 2 - 5, 10, 10);
    579580            g2.setColor(Color.GRAY);
    580             g2.drawPolygon(xPoints, yPoints, 3);
     581            g2.drawPolygon(XPOINTS, yPoints, 3);
    581582            if (c.isEnabled()) {
    582583                g2.setColor(Color.BLACK);
    583                 g2.fillPolygon(xPoints, yPoints, 3);
     584                g2.fillPolygon(XPOINTS, yPoints, 3);
    584585            }
    585586            g2.dispose();
  • trunk/src/org/openstreetmap/josm/gui/help/HelpContentReader.java

    r6920 r6987  
    4343    public String fetchHelpTopicContent(String helpTopicUrl, boolean dotest) throws HelpContentReaderException {
    4444        if(helpTopicUrl == null)
    45             throw new MissingHelpContentException();
     45            throw new MissingHelpContentException(helpTopicUrl);
    4646        HttpURLConnection con = null;
    4747        BufferedReader in = null;
     
    9090        }
    9191        if(dotest && s.isEmpty())
    92             throw new MissingHelpContentException();
     92            throw new MissingHelpContentException(s);
    9393        return s;
    9494    }
  • trunk/src/org/openstreetmap/josm/gui/help/HelpContentReaderException.java

    r3408 r6987  
    44public class HelpContentReaderException extends Exception {
    55    private int responseCode;
    6 
    7     public HelpContentReaderException() {
    8         super();
    9     }
    106
    117    public HelpContentReaderException(String message, Throwable cause) {
     
    3935        this.responseCode = responseCode;
    4036    }
    41 
    4237}
  • trunk/src/org/openstreetmap/josm/gui/help/MissingHelpContentException.java

    r3408 r6987  
    33
    44public class MissingHelpContentException extends HelpContentReaderException {
    5 
    6     public MissingHelpContentException() {
    7         super();
    8     }
    95
    106    public MissingHelpContentException(String message, Throwable cause) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSException.java

    r6070 r6987  
    44public class MapCSSException extends RuntimeException {
    55
    6     protected String specialmessage;
     6    protected final String specialmessage;
    77    protected Integer line;
    88    protected Integer column;
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r6643 r6987  
    148148        } catch(OAuthCommunicationException e){
    149149            if (canceled)
    150                 throw new OsmTransferCanceledException();
     150                throw new OsmTransferCanceledException(e);
    151151            throw new OsmOAuthAuthorizationException(e);
    152152        } catch(OAuthException e){
    153153            if (canceled)
    154                 throw new OsmTransferCanceledException();
     154                throw new OsmTransferCanceledException(e);
    155155            throw new OsmOAuthAuthorizationException(e);
    156156        } finally {
     
    182182        } catch(OAuthCommunicationException e){
    183183            if (canceled)
    184                 throw new OsmTransferCanceledException();
     184                throw new OsmTransferCanceledException(e);
    185185            throw new OsmOAuthAuthorizationException(e);
    186186        } catch(OAuthException e){
    187187            if (canceled)
    188                 throw new OsmTransferCanceledException();
     188                throw new OsmTransferCanceledException(e);
    189189            throw new OsmOAuthAuthorizationException(e);
    190190        } finally {
     
    569569        } catch(OsmOAuthAuthorizationException e) {
    570570            if (canceled)
    571                 throw new OsmTransferCanceledException();
     571                throw new OsmTransferCanceledException(e);
    572572            throw e;
    573573        } finally {
  • trunk/src/org/openstreetmap/josm/io/OsmTransferCanceledException.java

    r5386 r6987  
    77public class OsmTransferCanceledException extends OsmTransferException {
    88
     9    /**
     10     * Constructs a new {@code OsmTransferCanceledException}, without root cause.
     11     */
     12    public OsmTransferCanceledException() {
     13       
     14    }
     15
     16    /**
     17     * Constructs a new {@code OsmTransferCanceledException}, with given root cause.
     18     * @param cause the cause (which is saved for later retrieval by the {@link #getCause} method).
     19     *              A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown.
     20     */
     21    public OsmTransferCanceledException(Throwable cause) {
     22        super(cause);
     23    }
    924}
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r6920 r6987  
    457457                    }
    458458
    459                     String full_name = subdir + name + ext;
    460                     String cache_name = full_name;
     459                    String fullName = subdir + name + ext;
     460                    String cacheName = fullName;
    461461                    /* cache separately */
    462462                    if (dirs != null && !dirs.isEmpty()) {
    463                         cache_name = "id:" + id + ":" + full_name;
     463                        cacheName = "id:" + id + ":" + fullName;
    464464                        if(archive != null) {
    465                             cache_name += ":" + archive.getName();
     465                            cacheName += ":" + archive.getName();
    466466                        }
    467467                    }
    468468
    469                     ImageResource ir = cache.get(cache_name);
     469                    ImageResource ir = cache.get(cacheName);
    470470                    if (ir != null) return ir;
    471471
     
    473473                    case ARCHIVE:
    474474                        if (archive != null) {
    475                             ir = getIfAvailableZip(full_name, archive, inArchiveDir, type);
     475                            ir = getIfAvailableZip(fullName, archive, inArchiveDir, type);
    476476                            if (ir != null) {
    477                                 cache.put(cache_name, ir);
     477                                cache.put(cacheName, ir);
    478478                                return ir;
    479479                            }
     
    486486                        // and don't bother to create a URL unless we're actually
    487487                        // creating the image.
    488                         URL path = getImageUrl(full_name, dirs, additionalClassLoaders);
     488                        URL path = getImageUrl(fullName, dirs, additionalClassLoaders);
    489489                        if (path == null) {
    490490                            continue;
     
    492492                        ir = getIfAvailableLocalURL(path, type);
    493493                        if (ir != null) {
    494                             cache.put(cache_name, ir);
     494                            cache.put(cacheName, ir);
    495495                            return ir;
    496496                        }
     
    602602    }
    603603
    604     private static ImageResource getIfAvailableZip(String full_name, File archive, String inArchiveDir, ImageType type) {
     604    private static ImageResource getIfAvailableZip(String fullName, File archive, String inArchiveDir, ImageType type) {
    605605        ZipFile zipFile = null;
    606         try
    607         {
     606        try {
    608607            zipFile = new ZipFile(archive);
    609608            if (inArchiveDir == null || inArchiveDir.equals(".")) {
     
    612611                inArchiveDir += "/";
    613612            }
    614             String entry_name = inArchiveDir + full_name;
    615             ZipEntry entry = zipFile.getEntry(entry_name);
     613            String entryName = inArchiveDir + fullName;
     614            ZipEntry entry = zipFile.getEntry(entryName);
    616615            if(entry != null)
    617616            {
     
    624623                    switch (type) {
    625624                    case SVG:
    626                         URI uri = getSvgUniverse().loadSVG(is, entry_name);
     625                        URI uri = getSvgUniverse().loadSVG(is, entryName);
    627626                        SVGDiagram svg = getSvgUniverse().getDiagram(uri);
    628627                        return svg == null ? null : new ImageResource(svg);
     
    755754        /** Quit parsing, when a certain condition is met */
    756755        class SAXReturnException extends SAXException {
    757             private String result;
     756            private final String result;
    758757
    759758            public SAXReturnException(String result) {
Note: See TracChangeset for help on using the changeset viewer.