×
Namespaces

Variants
Actions

Archived:MMAPI player crashes with file names longer than 93 chars in S60 3rd Edition FP1 (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): Nokia N81 8GB, Nokia N82, Nokia N95, Nokia N95 8GB
Compatibility
Platform(s):
S60 3rd Edition FP1
Article
Created: User:Technical writer 1 (26 Nov 2008)
Last edited: hamishwillee (16 Aug 2013)

Description

The MMAPI player (JSR-135) crashes without exceptions when fetching a file with a file name longer than 93 characters.

How to reproduce

Implement a test MIDlet using the following source code:

 import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.midlet.MIDlet;
 
public final class TestMIDlet extends MIDlet implements CommandListener {
// Works for LENGTH <= 93.
// For LENGTH >= 94 the crash without exceptions happen
private static final int LENGTH = 94;
 
protected void destroyApp(final boolean unconditional) {}
protected void pauseApp() {}
 
protected void startApp() {
final Form form = new Form("Nokia S60 Java 3.1 Crash");
form.setCommandListener(this);
form.addCommand(new Command("Exit", Command.EXIT, 0));
Display.getDisplay(this).setCurrent(form);
 
try {
// Create a filename with the correct length
final StringBuffer sb = new StringBuffer();
sb.append("file:///C:/Data/Sounds/");
for (int i = 0; i < LENGTH - 27; ++i) {
sb.append('a');
}
sb.append(".mp3");
final String name = sb.toString();
form.append("Length: " + name.length());
 
// Create file (if it does not exist)
FileConnection c = (FileConnection) Connector.open(name);
if (!c.exists()) {
c.create();
}
form.append("\nCreated.");
 
// Try to play it
Player player = Manager.createPlayer(name);
try {
player.prefetch();
} catch (MediaException me) {
// Ignore exceptions
}
player.close();
 
// Remove it
c.delete();
c.close();
form.append("\nDone.");
} catch (Exception e) {
form.append(e.toString());
}
}
public void commandAction(Command command, Displayable disp) {
notifyDestroyed();
}
}

Solution

Avoid using file names longer than 93 characters in the affected S60 3rd Edition FP1 devices.

This page was last modified on 16 August 2013, at 09:18.
35 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×