Remove Java 5+ language constructs: varargs, generics, for-each (Fixes

compiler errors)
fix-message-formatting
Danny van Heumen 11 years ago
parent 3fd55e9c3b
commit e0887ceb8e

@ -39,7 +39,8 @@ public static void main(String[] args) throws Exception
try try
{ {
Class c = Class.forName(chainMain); Class c = Class.forName(chainMain);
final Method m = c.getMethod("main", _chainArgs.getClass()); final Method m = c.getMethod("main",
new Class[] {_chainArgs.getClass()});
new Thread() new Thread()
{ {
public void run() public void run()
@ -79,20 +80,22 @@ public void run()
LogManager.getLogManager().getLogger("").addHandler(new FileHandler()); LogManager.getLogManager().getLogger("").addHandler(new FileHandler());
LogManager.getLogManager().getLogger("") LogManager.getLogManager().getLogger("")
.addHandler(new ConsoleHandler()); .addHandler(new ConsoleHandler());
for (Handler h : LogManager.getLogManager().getLogger("").getHandlers())
h.setFormatter(new ScLogFormatter()); Handler[] h = LogManager.getLogManager().getLogger("").getHandlers();
for (int i = 0; i < h.length; i++)
h[i].setFormatter(new ScLogFormatter());
// be evil :-) // be evil :-)
// find the path of the nativelibs under webstart (findLibrary is // find the path of the nativelibs under webstart (findLibrary is
// protected and therefore at least documented api) // protected and therefore at least documented api)
Method findLibrary = Method findLibrary =
SIPCommunicatorJWS.class.getClassLoader().getClass() SIPCommunicatorJWS.class.getClassLoader().getClass()
.getDeclaredMethod("findLibrary", String.class); .getDeclaredMethod("findLibrary", new Class[] {String.class});
findLibrary.setAccessible(true); findLibrary.setAccessible(true);
File path = File path =
new File((String) findLibrary.invoke( new File((String) findLibrary.invoke(
SIPCommunicatorJWS.class.getClassLoader(), "hid")) SIPCommunicatorJWS.class.getClassLoader(),
.getParentFile(); new Object[] {"hid"})).getParentFile();
System.setProperty( System.setProperty(
"java.library.path", "java.library.path",
System.getProperty("java.library.path") + File.pathSeparator System.getProperty("java.library.path") + File.pathSeparator
@ -114,19 +117,24 @@ public void run()
System.getProperty("net.java.sip.communicator.SC_JWS_BASEDIR"); System.getProperty("net.java.sip.communicator.SC_JWS_BASEDIR");
ClassLoader cl = SIPCommunicatorJWS.class.getClassLoader(); ClassLoader cl = SIPCommunicatorJWS.class.getClassLoader();
Method getJarFile = Method getJarFile =
cl.getClass().getDeclaredMethod("getJarFile", URL.class); cl.getClass().getDeclaredMethod("getJarFile",
new Class[] {URL.class});
getJarFile.setAccessible(true); getJarFile.setAccessible(true);
for (Map.Entry<Object, Object> e : pIn.entrySet())
Iterator propIt = pIn.entrySet().iterator();
while (propIt.hasNext())
{ {
Map.Entry e = (Map.Entry) propIt.next();
if (((String) e.getKey()).startsWith("felix.auto.start.")) if (((String) e.getKey()).startsWith("felix.auto.start."))
{ {
String[] refs = ((String) e.getValue()).split("\\s"); String[] refs = ((String) e.getValue()).split("\\s");
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (String ref : refs) for (int i = 0; i < refs.length; i++)
{ {
String ref = refs[i];
JarFile localFile = JarFile localFile =
(JarFile) getJarFile.invoke(cl, new URL(baseServerUrl (JarFile) getJarFile.invoke(cl, new Object[] {
+ ref.replace("@URL@", ""))); new URL(baseServerUrl + ref.replace("@URL@", ""))});
if (localFile != null) if (localFile != null)
{ {
String localFileName = String localFileName =
@ -164,8 +172,9 @@ public void run()
File desktop = File desktop =
new File(System.getProperty("user.home") + "/Desktop"); new File(System.getProperty("user.home") + "/Desktop");
File[] files = desktop.listFiles(); File[] files = desktop.listFiles();
for (File file : files) for (int i = 0; i < files.length; i++)
{ {
File file = files[i];
if (file.getName().contains("jws_app_shortcut_")) if (file.getName().contains("jws_app_shortcut_"))
{ {
file.setExecutable(true, false); file.setExecutable(true, false);
@ -178,7 +187,7 @@ public void run()
} }
// Handle the "-open" argument from the javaws command line // Handle the "-open" argument from the javaws command line
Vector<String> _args = new Vector<String>(); Vector _args = new Vector();
for(int i = 0; i < args.length ; i++) for(int i = 0; i < args.length ; i++)
{ {
String arg = args[i]; String arg = args[i];
@ -203,6 +212,6 @@ public void run()
} }
// launch the original app // launch the original app
SIPCommunicator.main(_args.toArray(new String[] {})); SIPCommunicator.main((String[])_args.toArray(new String[_args.size()]));
} }
} }

Loading…
Cancel
Save