Namespaces
Variants
Actions

Archived:Using copy, cut, and paste in ConstrainedText may crash eSWT MIDlet on some S60 5th Edition devices (Known Issue)

Jump to: navigation, search
Archived.png
Archived: 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}}.

ESWT supported in Symbian Java only. Issue relates to older platform version.
Article Metadata

Tested with
Devices(s): Nokia 5800 XpressMusic, Nokia N97, S60 5th Edition SDK emulator, Nokia N97 SDK emulator

Compatibility
Platform(s): S60 5th Edition

Article
Keywords: ConstrainedText.copy(), ConstrainedText.cut(), ConstrainedText.paste()
Created: User:Kbwiki (28 Dec 2009)
Last edited: hamishwillee (24 Apr 2013)


Description

ConstrainedText is a single-line text control which constrains the user input with styles. It uses styles to limit the characters that users can enter to make data entry more efficient.

On certain S60 5th Edition devices, the heavy use of ConstrainedText's clipboard functions (copy, cut, and paste) may crash the MIDlet.

How to reproduce

Implement a test MIDlet with the following source code:

 import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import org.eclipse.ercp.swt.mobile.Command;
import org.eclipse.ercp.swt.mobile.ConstrainedText;
import org.eclipse.swt.events.*;
import org.eclipse.swt.widgets.*;
 
public class ConstrainedText_CopyCutPaste extends MIDlet
implements Runnable, SelectionListener
{
 
private Thread UIThread;
private boolean exiting;
private Command exitCmd;
private Command cutCmd;
private Command copyCmd;
private Command pasteCmd;
private Shell shell;
private ConstrainedText cText;
 
 
public ConstrainedText_CopyCutPaste()
{
exiting = false;
}
 
protected void startApp()
throws MIDletStateChangeException
{
if(UIThread == null)
{
UIThread = new Thread(this);
UIThread.start();
}
}
 
public void destroyApp(boolean unconditional)
{
exitEventLoop();
try
{
UIThread.join();
}
catch(InterruptedException interruptedexception) { }
}
 
protected void pauseApp()
{
}
 
public void run()
{
Display display = new Display();
shell = new Shell(display, 2048);
 
exitCmd = new Command(shell, 7, 0);
exitCmd.setText("Exit");
exitCmd.addSelectionListener(this);
 
cutCmd = new Command(shell, 7, 0);
cutCmd.setText("Cut");
cutCmd.addSelectionListener(this);
 
copyCmd = new Command(shell, 7, 0);
copyCmd.setText("Copy");
copyCmd.addSelectionListener(this);
 
pasteCmd = new Command(shell, 7, 0);
pasteCmd.setText("Paste");
pasteCmd.addSelectionListener(this);
 
cText = new ConstrainedText(shell, 0, 1);
shell.open();
 
// String for copy, cut and paste actions.
String text = "123456";
 
// Sets the String to the ConstrainedText object.
cText.setText(text);
 
while(!exiting)
if(!display.readAndDispatch())
display.sleep();
shell.dispose();
display.dispose();
exitCmd.dispose();
cutCmd.dispose();
copyCmd.dispose();
pasteCmd.dispose();
notifyDestroyed();
}
 
void exitEventLoop()
{
exiting = true;
Display.getDefault().wake();
}
 
public void widgetDefaultSelected(SelectionEvent selectionevent)
{
}
 
public void widgetSelected(SelectionEvent e)
{
if(((TypedEvent) (e)).widget == exitCmd)
exitEventLoop();
 
if(((TypedEvent) (e)).widget == cutCmd){
 
// Selects all text in the ConstrainedText object.
cText.selectAll();
 
// Cuts the selected text to clipboard and
// removes the text from the ConstrainedText object.
cText.cut();
 
}
 
if(((TypedEvent) (e)).widget == copyCmd){
 
// Selects all text in the ConstrainedText object.
cText.selectAll();
 
// Copies the selected text to clipboard.
cText.copy();
 
}
if(((TypedEvent) (e)).widget == pasteCmd){
 
// Pastes the text from clipboard to the ConstrainedText object;
// deletes the existing text from the object before pasting.
cText.paste();
}
}
 
}

After installing and launching the MIDlet, perform the following test steps:

  1. From Options, select Copy or Cut.
  2. From Options, select Paste.
  3. Perform steps 1 and 2 several (at least 5-15) times in a row.

Solution

No solution exists for S60 5th Edition and Nokia N97 SDK emulators.

For the affected devices, this issue is expected to be fixed for Java Runtime 2.0 release via Independent Application Delivery.

This page was last modified on 24 April 2013, at 02:45.
222 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved