sahwar / microemu

Automatically exported from code.google.com/p/microemu
0 stars 0 forks source link

Cannot open jad from dynamic url #76

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Click File->Open MIDlet URL
2. Enter 
http://mini.opera.com/download-5/opera-mini-latest-advanced-en-us.jad?no_redir&i
smobile=false

What is the expected output? What do you see instead?
Expected the jad to be opened.
Get "Empty jar 
http://mini.opera.com/download-5/opera-mini-latest-advanced-en-us.jad?no_redir&i
smobile=false" error dialog box with an OK button.

What version of the product are you using? On what operating system?
Any. Win7.

Original issue reported on code.google.com by jdd...@gmail.com on 25 Oct 2010 at 11:21

GoogleCodeExporter commented 8 years ago
Here is some more information:

The reason is because in 
/trunk/microemulator/microemu-javase/src/main/java/org/microemu/app/Common.java

function: openMIDletUrl(String, MIDletClassLoader)
The following is tested:
 if (urlString.toLowerCase().endsWith(".jad")) {
                jad = loadJadProperties(urlString);
                loadJar(urlString, jad.getJarURL(), midletClassLoader);
            } else {
                jad.setCorrectedJarURL(urlString);
                loadJar(null, urlString, midletClassLoader);
            }

So we can see here that the jad is loaded as a jar.
But I think the Content-Type returned from the URL (perhaps with a http HEAD 
call if available) should be checked for the jad mimetype first 
("text/vnd.sun.j2me.app-descriptor"), and then fall back to the jar loading if 
that fails.

Lastly, when this error does occur the status bar at the bottom stays on 
"Loading...", and opening another jad or jar from filesystem does nothing.

Original comment by jdd...@gmail.com on 25 Oct 2010 at 11:27