Changeset 3232 in josm for trunk/src/org


Ignore:
Timestamp:
2010-05-11T09:25:21+02:00 (15 years ago)
Author:
jttt
Message:

Fix #2297 JOSM Webstart fails at loading plugins, cleanup puwg projection

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

Legend:

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

    r3083 r3232  
    123123    public Collection<String> getPreferencesFromCode(String code)
    124124    {
    125         for (Projection p : Puwg.Zones)
     125        for (PuwgData p : Puwg.Zones)
    126126        {
    127127            if(code.equals(p.toCode()))
     
    151151}
    152152
    153 interface PuwgData extends Projection {
    154     public double getPuwgCentralMeridianDeg();
    155     public double getPuwgCentralMeridian();
    156     public double getPuwgFalseEasting();
    157     public double getPuwgFalseNorthing();
    158     public double getPuwgScaleFactor();
     153interface PuwgData {
     154    double getPuwgCentralMeridianDeg();
     155    double getPuwgCentralMeridian();
     156    double getPuwgFalseEasting();
     157    double getPuwgFalseNorthing();
     158    double getPuwgScaleFactor();
     159
     160    // Projection methods
     161    String toCode();
     162    String getCacheDirectoryName();
     163    Bounds getWorldBoundsLatLon();
    159164}
    160165
     
    165170    private static final double Epsg2180ScaleFactor = 0.9993;
    166171    private static final double Epsg2180CentralMeridian = 19.0;
    167     private static DecimalFormat decFormatter = new DecimalFormat("###0");
    168172
    169173    @Override public String toString() {
     
    185189                new LatLon(54.84, 24.15));
    186190    }
    187 
    188     /* These two MUST NOT be used. Use Puwg implementation instead. */
    189     public EastNorth latlon2eastNorth(LatLon p) { return null; }
    190     public LatLon eastNorth2latlon(EastNorth p) { return null; }
    191191
    192192    public double getPuwgCentralMeridianDeg() { return Epsg2180CentralMeridian; }
     
    195195    public double getPuwgFalseNorthing() { return Epsg2180FalseNorthing; }
    196196    public double getPuwgScaleFactor() { return Epsg2180ScaleFactor; }
    197 
    198     public double getDefaultZoomInPPD() {
    199         // This will set the scale bar to about 100 km
    200         return 0.009;
    201     }
    202 
    203     public String eastToString(EastNorth p) {
    204         return decFormatter.format(p.east());
    205     }
    206 
    207     public String northToString(EastNorth p) {
    208         return decFormatter.format(p.north());
    209     }
    210197}
    211198
     
    218205    final private String[] Puwg2000Code = { "EPSG:2176",  "EPSG:2177", "EPSG:2178", "EPSG:2179"};
    219206    final private String[] Puwg2000CDName = { "epsg2176",  "epsg2177", "epsg2178", "epsg2179"};
    220     private static DecimalFormat decFormatter = new DecimalFormat("###0.00");
    221207
    222208    @Override public String toString() {
     
    238224                new LatLon(54.84, (3 * getZone()) + 1.5));
    239225    }
    240 
    241     /* These two MUST NOT be used. Use Puwg implementation instead. */
    242     public EastNorth latlon2eastNorth(LatLon p) { return null; }
    243     public LatLon eastNorth2latlon(EastNorth p) { return null; }
    244226
    245227    public double getPuwgCentralMeridianDeg() { return getZone() * 3.0; }
     
    252234    public int getZoneIndex() { return getZone() - 5; }
    253235
    254     public double getDefaultZoomInPPD() {
    255         // This will set the scale bar to about 100 km
    256         return 0.009;
    257     }
    258 
    259     public String eastToString(EastNorth p) {
    260         return Integer.toString(getZone()) + decFormatter.format(p.east());
    261     }
    262 
    263     public String northToString(EastNorth p) {
    264         return decFormatter.format(p.north());
    265     }
    266 
    267 }
    268 
    269 class Epsg2176 extends Puwg2000 implements Projection {
     236}
     237
     238class Epsg2176 extends Puwg2000 {
    270239    private static final int PuwgZone = 5;
    271240
     
    274243}
    275244
    276 class Epsg2177 extends Puwg2000 implements Projection {
     245class Epsg2177 extends Puwg2000 {
    277246    private static final int PuwgZone = 6;
    278247
     
    281250}
    282251
    283 class Epsg2178 extends Puwg2000 implements Projection {
     252class Epsg2178 extends Puwg2000 {
    284253    private static final int PuwgZone = 7;
    285254
     
    288257}
    289258
    290 class Epsg2179 extends Puwg2000 implements Projection {
     259class Epsg2179 extends Puwg2000 {
    291260    private static final int PuwgZone = 8;
    292261
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r3098 r3232  
    1111import java.net.Authenticator;
    1212import java.net.ProxySelector;
     13import java.security.AllPermission;
     14import java.security.CodeSource;
     15import java.security.PermissionCollection;
     16import java.security.Permissions;
     17import java.security.Policy;
    1318import java.util.Collection;
    1419import java.util.HashMap;
     
    130135        I18n.init();
    131136
     137        Policy.setPolicy(new Policy() {
     138            // Permissions for plug-ins loaded when josm is started via webstart
     139            private PermissionCollection pc;
     140
     141            {
     142                pc = new Permissions();
     143                pc.add(new AllPermission());
     144            }
     145
     146            @Override
     147            public void refresh() { }
     148
     149            @Override
     150            public PermissionCollection getPermissions(CodeSource codesource) {
     151                return pc;
     152            }
     153        });
     154
    132155        Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler());
    133156        // http://stuffthathappens.com/blog/2007/10/15/one-more-note-on-uncaught-exception-handlers/
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r3131 r3232  
    6363 * PluginHandler is basically a collection of static utility functions used to bootstrap
    6464 * and manage the loaded plugins.
    65  * 
     65 *
    6666 */
    6767public class PluginHandler {
     
    8484     * Removes deprecated plugins from a collection of plugins. Modifies the
    8585     * collection <code>plugins</code>.
    86      * 
     86     *
    8787     * Also notifies the user about removed deprecated plugins
    88      * 
     88     *
    8989     * @param plugins the collection of plugins
    9090     */
     
    128128     * collection <code>plugins</code>. Also removes the plugin from the list
    129129     * of plugins in the preferences, if necessary.
    130      * 
     130     *
    131131     * Asks the user for every unmaintained plugin whether it should be removed.
    132      * 
     132     *
    133133     * @param plugins the collection of plugins
    134134     */
     
    153153     * JOSM was updated to a new version since the last plugin updates or
    154154     * if the plugins were last updated a long time ago.
    155      * 
     155     *
    156156     * @param parent the parent window relative to which the confirmation dialog
    157157     * is to be displayed
     
    261261    /**
    262262     * Alerts the user if a plugin required by another plugin is missing
    263      * 
     263     *
    264264     * @param plugin the the plugin
    265265     * @param missingRequiredPlugin the missing required plugin
     
    304304     * current JOSM version must be compatible with the plugin and no other plugins this plugin
    305305     * depends on should be missing.
    306      * 
     306     *
    307307     * @param plugins the collection of all loaded plugins
    308308     * @param plugin the plugin for which preconditions are checked
     
    342342    /**
    343343     * Creates a class loader for loading plugin code.
    344      * 
     344     *
    345345     * @param plugins the collection of plugins which are going to be loaded with this
    346346     * class loader
     
    371371     * Loads and instantiates the plugin described by <code>plugin</code> using
    372372     * the class loader <code>pluginClassLoader</code>.
    373      * 
     373     *
    374374     * @param plugin the plugin
    375375     * @param pluginClassLoader the plugin class loader
     
    383383            }
    384384        } catch(PluginException e) {
     385            e.printStackTrace();
    385386            if (e.getCause() instanceof ClassNotFoundException) {
    386                 e.printStackTrace();
    387387                String msg = tr("<html>Could not load plugin {0} because the plugin<br>main class ''{1}'' was not found.<br>"
    388388                        + "Delete from preferences?", plugin.name, plugin.className);
     
    403403     * Loads the plugin in <code>plugins</code> from locally available jar files into
    404404     * memory.
    405      * 
     405     *
    406406     * @param plugins the list of plugins
    407407     * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null.
     
    452452     * Loads plugins from <code>plugins</code> which have the flag {@see PluginInformation#early}
    453453     * set to true.
    454      * 
     454     *
    455455     * @param plugins the collection of plugins
    456456     * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null.
     
    469469     * Loads plugins from <code>plugins</code> which have the flag {@see PluginInformation#early}
    470470     * set to false.
    471      * 
     471     *
    472472     * @param plugins the collection of plugins
    473473     * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null.
     
    489489     * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null.
    490490     * @return the list of locally available plugin information
    491      * 
     491     *
    492492     */
    493493    private static Map<String, PluginInformation> loadLocallyAvailablePluginInformation(ProgressMonitor monitor) {
     
    614614    /**
    615615     * Updates the plugins in <code>plugins</code>.
    616      * 
     616     *
    617617     * @param parent the parent window for message boxes
    618618     * @param plugins the collection of plugins to update. Must not be null.
     
    696696    /**
    697697     * Ask the user for confirmation that a plugin shall be disabled.
    698      * 
     698     *
    699699     * @param reason the reason for disabling the plugin
    700700     * @param name the plugin name
     
    731731    /**
    732732     * Notified loaded plugins about a new map frame
    733      * 
     733     *
    734734     * @param old the old map frame
    735735     * @param map the new map frame
     
    763763     * Installs downloaded plugins. Moves files with the suffix ".jar.new" to the corresponding
    764764     * ".jar" files.
    765      * 
     765     *
    766766     * If {@code dowarn} is true, this methods emits warning messages on the console if a downloaded
    767767     * but not yet installed plugin .jar can't be be installed. If {@code dowarn} is false, the
    768768     * installation of the respective plugin is sillently skipped.
    769      * 
     769     *
    770770     * @param dowarn if true, warning messages are displayed; false otherwise
    771771     */
     
    843843    /**
    844844     * Replies the plugin which most likely threw the exception <code>ex</code>.
    845      * 
     845     *
    846846     * @param ex the exception
    847847     * @return the plugin; null, if the exception proably wasn't thrown from a plugin
     
    864864     * Checks whether the exception <code>e</code> was thrown by a plugin. If so,
    865865     * conditionally deactivates the plugin, but asks the user first.
    866      * 
     866     *
    867867     * @param e the exception
    868868     */
     
    914914            String version = pp.getPluginInformation().localversion;
    915915            text += version != null && !version.equals("") ? " (Version: " + version + ")\n"
    916                         : "\n";
     916                    : "\n";
    917917        }
    918918        return text;
Note: See TracChangeset for help on using the changeset viewer.