aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp
diff options
context:
space:
mode:
Diffstat (limited to 'netx/net/sourceforge/jnlp')
-rw-r--r--netx/net/sourceforge/jnlp/ExtensionDesc.java5
-rw-r--r--netx/net/sourceforge/jnlp/JNLPFile.java5
-rw-r--r--netx/net/sourceforge/jnlp/JREDesc.java8
-rw-r--r--netx/net/sourceforge/jnlp/Launcher.java6
-rw-r--r--netx/net/sourceforge/jnlp/Parser.java10
-rw-r--r--netx/net/sourceforge/jnlp/cache/CacheEntry.java4
-rw-r--r--netx/net/sourceforge/jnlp/cache/CacheUtil.java10
-rw-r--r--netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java6
-rw-r--r--netx/net/sourceforge/jnlp/runtime/Boot.java8
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java5
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java2
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java6
-rw-r--r--netx/net/sourceforge/jnlp/runtime/Translator.java31
-rw-r--r--netx/net/sourceforge/jnlp/security/AccessWarningPane.java2
-rw-r--r--netx/net/sourceforge/jnlp/security/CertWarningPane.java2
-rw-r--r--netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java11
-rw-r--r--netx/net/sourceforge/jnlp/security/MoreInfoPane.java2
-rw-r--r--netx/net/sourceforge/jnlp/security/SecurityDialogPanel.java15
-rw-r--r--netx/net/sourceforge/jnlp/services/ServiceUtil.java4
-rw-r--r--netx/net/sourceforge/jnlp/services/SingleInstanceLock.java10
-rw-r--r--netx/net/sourceforge/jnlp/tools/JarSigner.java7
21 files changed, 76 insertions, 83 deletions
diff --git a/netx/net/sourceforge/jnlp/ExtensionDesc.java b/netx/net/sourceforge/jnlp/ExtensionDesc.java
index f744715..09a2ddb 100644
--- a/netx/net/sourceforge/jnlp/ExtensionDesc.java
+++ b/netx/net/sourceforge/jnlp/ExtensionDesc.java
@@ -17,13 +17,14 @@
package net.sourceforge.jnlp;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.*;
import java.net.*;
import java.util.*;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
/**
* The extension element.
*
@@ -128,7 +129,7 @@ public class ExtensionDesc {
// check for it being an extension descriptor
if (!file.isComponent() && !file.isInstaller())
- throw new ParseException(JNLPRuntime.getMessage("JInvalidExtensionDescriptor", new Object[] {name, location} ));
+ throw new ParseException(R("JInvalidExtensionDescriptor", name, location));
}
}
diff --git a/netx/net/sourceforge/jnlp/JNLPFile.java b/netx/net/sourceforge/jnlp/JNLPFile.java
index 48fa9e2..b0b8065 100644
--- a/netx/net/sourceforge/jnlp/JNLPFile.java
+++ b/netx/net/sourceforge/jnlp/JNLPFile.java
@@ -17,6 +17,8 @@
package net.sourceforge.jnlp;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
@@ -32,6 +34,7 @@ import net.sourceforge.jnlp.cache.ResourceTracker;
import net.sourceforge.jnlp.cache.UpdatePolicy;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
/**
* Provides methods to access the information in a Java Network
* Launching Protocol (JNLP) file. The Java Network Launching
@@ -60,8 +63,6 @@ public class JNLPFile {
// todo: currently does not filter resources by jvm version.
//
- private static String R(String key) { return JNLPRuntime.getMessage(key); }
-
/** the location this JNLP file was created from */
protected URL sourceLocation = null;
diff --git a/netx/net/sourceforge/jnlp/JREDesc.java b/netx/net/sourceforge/jnlp/JREDesc.java
index 69a4c25..54538f4 100644
--- a/netx/net/sourceforge/jnlp/JREDesc.java
+++ b/netx/net/sourceforge/jnlp/JREDesc.java
@@ -17,12 +17,12 @@
package net.sourceforge.jnlp;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.*;
import java.net.*;
import java.util.*;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
/**
* The J2SE/Java element.
*
@@ -143,7 +143,7 @@ public class JREDesc {
if ((lastChar < '0' || lastChar > '9')) {
lastCharacterIsDigit = false;
if (lastChar != 'k' && lastChar!= 'm' ) {
- throw new ParseException(JNLPRuntime.getMessage("PBadHeapSize",new Object[] {heapSize}));
+ throw new ParseException(R("PBadHeapSize", heapSize));
}
}
@@ -157,7 +157,7 @@ public class JREDesc {
// check that the number is a number!
Integer.valueOf(size);
} catch (NumberFormatException numberFormat) {
- throw new ParseException(JNLPRuntime.getMessage("PBadHeapSize", new Object[] {heapSize}), numberFormat);
+ throw new ParseException(R("PBadHeapSize", heapSize), numberFormat);
}
}
diff --git a/netx/net/sourceforge/jnlp/Launcher.java b/netx/net/sourceforge/jnlp/Launcher.java
index 6493315..713e64c 100644
--- a/netx/net/sourceforge/jnlp/Launcher.java
+++ b/netx/net/sourceforge/jnlp/Launcher.java
@@ -17,6 +17,8 @@
package net.sourceforge.jnlp;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.applet.Applet;
import java.awt.Container;
import java.io.File;
@@ -51,6 +53,7 @@ import javax.swing.SwingUtilities;
import sun.awt.SunToolkit;
+
/**
* Launches JNLPFiles either in the foreground or background.<p>
*
@@ -67,9 +70,6 @@ public class Launcher {
// defines class Launcher.BgRunner, Launcher.TgThread
- /** shortcut for resources */
- private static String R(String key) { return JNLPRuntime.getMessage(key); }
-
/** shared thread group */
/*package*/ static final ThreadGroup mainGroup = new ThreadGroup(R("LAllThreadGroup"));
diff --git a/netx/net/sourceforge/jnlp/Parser.java b/netx/net/sourceforge/jnlp/Parser.java
index 758b00d..9feec25 100644
--- a/netx/net/sourceforge/jnlp/Parser.java
+++ b/netx/net/sourceforge/jnlp/Parser.java
@@ -18,6 +18,8 @@
package net.sourceforge.jnlp;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.*;
import java.net.*;
import java.util.*;
@@ -27,10 +29,8 @@ import java.util.*;
//import gd.xml.tiny.*;
import net.sourceforge.jnlp.UpdateDesc.Check;
import net.sourceforge.jnlp.UpdateDesc.Policy;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
import net.sourceforge.nanoxml.*;
-
/**
* Contains methods to parse an XML document into a JNLPFile.
* Implements JNLP specification version 1.0.
@@ -40,12 +40,6 @@ import net.sourceforge.nanoxml.*;
*/
class Parser {
- private static String R(String key) { return JNLPRuntime.getMessage(key); }
- private static String R(String key, Object p1) { return R(key, p1, null); }
- private static String R(String key, Object p1, Object p2) { return R(key, p1, p2, null); }
- private static String R(String key, Object p1, Object p2, Object p3) { return JNLPRuntime.getMessage(key, new Object[] { p1, p2, p3 }); }
-
-
// defines netx.jnlp.Node class if using Tiny XML or Nano XML
// Currently uses the Nano XML parse. Search for "SAX" or
diff --git a/netx/net/sourceforge/jnlp/cache/CacheEntry.java b/netx/net/sourceforge/jnlp/cache/CacheEntry.java
index 7906e0c..d442a90 100644
--- a/netx/net/sourceforge/jnlp/cache/CacheEntry.java
+++ b/netx/net/sourceforge/jnlp/cache/CacheEntry.java
@@ -17,6 +17,8 @@
package net.sourceforge.jnlp.cache;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.*;
import java.net.*;
import java.util.*;
@@ -60,7 +62,7 @@ public class CacheEntry {
File infoFile = CacheUtil.getCacheFile(location, version);
infoFile = new File(infoFile.getPath()+".info"); // replace with something that can't be clobbered
- properties = new PropertiesFile(infoFile, JNLPRuntime.getMessage("CAutoGen"));
+ properties = new PropertiesFile(infoFile, R("CAutoGen"));
}
/**
diff --git a/netx/net/sourceforge/jnlp/cache/CacheUtil.java b/netx/net/sourceforge/jnlp/cache/CacheUtil.java
index 451e04a..3edc31e 100644
--- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java
+++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java
@@ -17,6 +17,8 @@
package net.sourceforge.jnlp.cache;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.*;
import java.net.*;
import java.nio.channels.FileChannel;
@@ -38,14 +40,6 @@ import net.sourceforge.jnlp.util.FileUtils;
*/
public class CacheUtil {
- private static String R(String key) {
- return JNLPRuntime.getMessage(key);
- }
-
- private static String R(String key, Object param) {
- return JNLPRuntime.getMessage(key, new Object[] {param});
- }
-
/**
* Compares a URL using string compare of its protocol, host,
* port, path, query, and anchor. This method avoids the host
diff --git a/netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java b/netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java
index 407d6f4..f7c382e 100644
--- a/netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java
+++ b/netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java
@@ -17,6 +17,8 @@
package net.sourceforge.jnlp.cache;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.awt.*;
import java.awt.event.*;
import java.net.*;
@@ -49,8 +51,8 @@ public class DefaultDownloadIndicator implements DownloadIndicator {
// todo: this should be synchronized at some point but conflicts
// aren't very likely.
- private static String downloading = JNLPRuntime.getMessage("CDownloading");
- private static String complete = JNLPRuntime.getMessage("CComplete");
+ private static String downloading = R("CDownloading");
+ private static String complete = R("CComplete");
/** time to wait after completing but before window closes */
private static final int CLOSE_DELAY = 750;
diff --git a/netx/net/sourceforge/jnlp/runtime/Boot.java b/netx/net/sourceforge/jnlp/runtime/Boot.java
index ea76bcb..195c55b 100644
--- a/netx/net/sourceforge/jnlp/runtime/Boot.java
+++ b/netx/net/sourceforge/jnlp/runtime/Boot.java
@@ -17,6 +17,8 @@
package net.sourceforge.jnlp.runtime;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -63,9 +65,6 @@ public final class Boot implements PrivilegedAction<Void> {
// todo: decide whether a spawned netx (external launch)
// should inherit the same options as this instance (store argv?)
- private static String R(String key) { return JNLPRuntime.getMessage(key); }
- private static String R(String key, Object param) { return JNLPRuntime.getMessage(key, new Object[] {param}); }
-
private static final String version = "0.5";
/** the text to display before launching the about link */
@@ -225,8 +224,7 @@ public final class Boot implements PrivilegedAction<Void> {
if (JNLPRuntime.isDebug())
ex.printStackTrace();
- fatalError(JNLPRuntime.getMessage("RUnexpected",
- new Object[] {ex.toString(), ex.getStackTrace()[0]} ));
+ fatalError(R("RUnexpected", ex.toString(), ex.getStackTrace()[0]));
}
return null;
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
index ebb9558..0960c1a 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
@@ -17,6 +17,8 @@
package net.sourceforge.jnlp.runtime;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -78,9 +80,6 @@ public class JNLPClassLoader extends URLClassLoader {
// extension classes too so that main file classes can load
// resources in an extension.
- /** shortcut for resources */
- private static String R(String key) { return JNLPRuntime.getMessage(key); }
-
/** map from JNLPFile url to shared classloader */
private static Map<String,JNLPClassLoader> urlToLoader =
new HashMap<String,JNLPClassLoader>(); // never garbage collected!
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
index a6f6304..31e6b06 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
@@ -522,7 +522,7 @@ public class JNLPRuntime {
*
* @param args the formatting arguments to the resource string
*/
- public static String getMessage(String key, Object args[]) {
+ public static String getMessage(String key, Object... args) {
return MessageFormat.format(getMessage(key), args);
}
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
index 5c49741..32a54f8 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
@@ -17,6 +17,8 @@
package net.sourceforge.jnlp.runtime;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.awt.Frame;
import java.awt.Window;
import java.awt.event.WindowAdapter;
@@ -88,14 +90,12 @@ class JNLPSecurityManager extends AWTSecurityManager {
// another way for different apps to have different properties
// in java.lang.Sytem with the same names.
- private static String R(String key) { return JNLPRuntime.getMessage(key); }
-
/** only class that can exit the JVM, if set */
private Object exitClass = null;
/** this exception prevents exiting the JVM */
private SecurityException closeAppEx = // making here prevents huge stack traces
- new SecurityException(JNLPRuntime.getMessage("RShutdown"));
+ new SecurityException(R("RShutdown"));
/** weak list of windows created */
private WeakList<Window> weakWindows = new WeakList<Window>();
diff --git a/netx/net/sourceforge/jnlp/runtime/Translator.java b/netx/net/sourceforge/jnlp/runtime/Translator.java
new file mode 100644
index 0000000..6e362b1
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/runtime/Translator.java
@@ -0,0 +1,31 @@
+// Copyright (C) 2010 Red Hat, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+package net.sourceforge.jnlp.runtime;
+
+/**
+ * Utility class to provide simple methods to help localize messages
+ */
+public class Translator {
+
+ /**
+ * @return the localized string for the message
+ */
+ public static String R(String message, Object... params) {
+ return JNLPRuntime.getMessage(message, params);
+ }
+
+}
diff --git a/netx/net/sourceforge/jnlp/security/AccessWarningPane.java b/netx/net/sourceforge/jnlp/security/AccessWarningPane.java
index 64c7727..c822d12 100644
--- a/netx/net/sourceforge/jnlp/security/AccessWarningPane.java
+++ b/netx/net/sourceforge/jnlp/security/AccessWarningPane.java
@@ -37,6 +37,8 @@ exception statement from your version.
package net.sourceforge.jnlp.security;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
diff --git a/netx/net/sourceforge/jnlp/security/CertWarningPane.java b/netx/net/sourceforge/jnlp/security/CertWarningPane.java
index 163c20c..b1101c2 100644
--- a/netx/net/sourceforge/jnlp/security/CertWarningPane.java
+++ b/netx/net/sourceforge/jnlp/security/CertWarningPane.java
@@ -37,6 +37,8 @@ exception statement from your version.
package net.sourceforge.jnlp.security;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
diff --git a/netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java b/netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java
index ca2fc08..6cf7c9d 100644
--- a/netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java
+++ b/netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java
@@ -37,6 +37,8 @@ exception statement from your version.
package net.sourceforge.jnlp.security;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.IOException;
import java.security.cert.CertPath;
import java.security.cert.Certificate;
@@ -50,7 +52,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
import net.sourceforge.jnlp.tools.KeyTool;
import sun.security.util.DerValue;
import sun.security.util.HostnameChecker;
@@ -198,14 +199,6 @@ public class HttpsCertVerifier implements CertVerifier {
details.add(detail);
}
- private static String R(String key) {
- return JNLPRuntime.getMessage(key);
- }
-
- private static String R(String key, String arg1, String arg2) {
- return JNLPRuntime.getMessage(key, new Object[] { arg1, arg2 });
- }
-
public Certificate getPublisher() {
if (chain.length > 0)
return (Certificate)chain[0];
diff --git a/netx/net/sourceforge/jnlp/security/MoreInfoPane.java b/netx/net/sourceforge/jnlp/security/MoreInfoPane.java
index 729eb1c..f5fac6a 100644
--- a/netx/net/sourceforge/jnlp/security/MoreInfoPane.java
+++ b/netx/net/sourceforge/jnlp/security/MoreInfoPane.java
@@ -37,6 +37,8 @@ exception statement from your version.
package net.sourceforge.jnlp.security;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
diff --git a/netx/net/sourceforge/jnlp/security/SecurityDialogPanel.java b/netx/net/sourceforge/jnlp/security/SecurityDialogPanel.java
index f3b8ee8..ed7921a 100644
--- a/netx/net/sourceforge/jnlp/security/SecurityDialogPanel.java
+++ b/netx/net/sourceforge/jnlp/security/SecurityDialogPanel.java
@@ -44,9 +44,6 @@ import java.awt.event.ActionListener;
import javax.swing.JComponent;
import javax.swing.JPanel;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
/**
* Provides a JPanel for use in JNLP warning dialogs.
*/
@@ -69,18 +66,6 @@ public abstract class SecurityDialogPanel extends JPanel {
this.setLayout(new BorderLayout());
}
- /*
- * String translation functions
- */
-
- protected static String R(String key) {
- return JNLPRuntime.getMessage(key);
- }
-
- protected static String R(String key, Object param) {
- return JNLPRuntime.getMessage(key, new Object[] {param});
- }
-
/**
* Needed to get word wrap working in JLabels.
*/
diff --git a/netx/net/sourceforge/jnlp/services/ServiceUtil.java b/netx/net/sourceforge/jnlp/services/ServiceUtil.java
index bb41f1b..6116332 100644
--- a/netx/net/sourceforge/jnlp/services/ServiceUtil.java
+++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java
@@ -53,10 +53,6 @@ import net.sourceforge.jnlp.security.SecurityWarning.AccessType;
*/
public class ServiceUtil {
- private static String R(String key) {
- return JNLPRuntime.getMessage(key);
- }
-
/**
* Returns the BasicService reference, or null if the service is
* unavailable.
diff --git a/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java b/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java
index 5108642..811b80d 100644
--- a/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java
+++ b/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java
@@ -16,6 +16,8 @@
package net.sourceforge.jnlp.services;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -183,12 +185,4 @@ class SingleInstanceLock {
return (display == null) ? "" : display;
}
- private static String R(String key) {
- return JNLPRuntime.getMessage(key);
- }
-
- private static String R(String key, Object param) {
- return JNLPRuntime.getMessage(key, new Object[] { param });
- }
-
}
diff --git a/netx/net/sourceforge/jnlp/tools/JarSigner.java b/netx/net/sourceforge/jnlp/tools/JarSigner.java
index 88c6dc8..020fcab 100644
--- a/netx/net/sourceforge/jnlp/tools/JarSigner.java
+++ b/netx/net/sourceforge/jnlp/tools/JarSigner.java
@@ -25,6 +25,8 @@
package net.sourceforge.jnlp.tools;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.io.*;
import java.util.*;
import java.util.zip.*;
@@ -40,7 +42,6 @@ import sun.security.util.*;
import net.sourceforge.jnlp.*;
import net.sourceforge.jnlp.cache.*;
-import net.sourceforge.jnlp.runtime.*;
import net.sourceforge.jnlp.security.*;
/**
@@ -52,10 +53,6 @@ import net.sourceforge.jnlp.security.*;
public class JarSigner implements CertVerifier {
- private static String R(String key) {
- return JNLPRuntime.getMessage(key);
- }
-
private static final Collator collator = Collator.getInstance();
static {
// this is for case insensitive string comparisions