Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 155735 Details for
Bug 298447
[DND] NullPointerException using LocalTransfer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
fix
byteArrayTransfer.txt (text/plain), 4.56 KB, created by
Tim Buschtoens
on 2010-01-11 07:46:04 EST
(
hide
)
Description:
fix
Filename:
MIME Type:
Creator:
Tim Buschtoens
Created:
2010-01-11 07:46:04 EST
Size:
4.56 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/swt/dnd/ByteArrayTransfer.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/swt/dnd/ByteArrayTransfer.java,v >retrieving revision 1.1 >diff -u -r1.1 ByteArrayTransfer.java >--- src/org/eclipse/swt/dnd/ByteArrayTransfer.java 27 Nov 2009 17:20:23 -0000 1.1 >+++ src/org/eclipse/swt/dnd/ByteArrayTransfer.java 11 Jan 2010 12:48:32 -0000 >@@ -150,12 +150,14 @@ > * @see Transfer#nativeToJava > */ > public void javaToNative (Object object, TransferData transferData) { >- if (!checkByteArray(object) || !isSupportedType(transferData)) { >- DND.error(DND.ERROR_INVALID_DATA); >- } >- byte[] data = (byte[])object; >- System.arraycopy( data, 0, transferData.data, 0, data.length ); >- transferData.result = 1; >+ if( !checkByteArray( object ) || !isSupportedType( transferData ) ) { >+ DND.error( DND.ERROR_INVALID_DATA ); >+ } >+ byte[] data = ( byte[] )object; >+ //fix for Bug 298447 >+ transferData.data = new byte[ data.length ]; >+ System.arraycopy( data, 0, transferData.data, 0, data.length ); >+ transferData.result = 1; > } > > /** >#P org.eclipse.rap.rwt.q07.test >Index: src/org/eclipse/swt/internal/widgets/displaykit/DNDSupport_Test.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.q07.test/src/org/eclipse/swt/internal/widgets/displaykit/DNDSupport_Test.java,v >retrieving revision 1.6 >diff -u -r1.6 DNDSupport_Test.java >--- src/org/eclipse/swt/internal/widgets/displaykit/DNDSupport_Test.java 15 Dec 2009 11:18:11 -0000 1.6 >+++ src/org/eclipse/swt/internal/widgets/displaykit/DNDSupport_Test.java 11 Jan 2010 12:48:34 -0000 >@@ -241,6 +241,67 @@ > assertEquals( "Hello World!", dropEvent.data ); > } > >+ // see Bug 298447 >+ public void testByteArrayTransfer() { >+ ByteArrayTransfer myTransfer = new ByteArrayTransfer(){ >+ protected int[] getTypeIds() { >+ return new int[]{ 99 }; >+ } >+ protected String[] getTypeNames() { >+ return new String[] { "byteTransfer" }; >+ } >+ }; >+ final java.util.List log = new ArrayList(); >+ Display display = new Display(); >+ Shell shell = new Shell( display ); >+ Control dragSourceControl = new Label( shell, SWT.NONE ); >+ DragSource dragSource = new DragSource( dragSourceControl, DND.DROP_MOVE ); >+ dragSource.setTransfer( new Transfer[] { myTransfer } ); >+ Control dropTargetControl = new Label( shell, SWT.NONE ); >+ DropTarget dropTarget = new DropTarget( dropTargetControl, DND.DROP_MOVE ); >+ dropTarget.setTransfer( new Transfer[] { myTransfer } ); >+ dropTarget.addDropListener( new DropTargetAdapter() { >+ public void dropAccept( final DropTargetEvent event ) { >+ log.add( event ); >+ } >+ public void drop( final DropTargetEvent event ) { >+ log.add( event ); >+ } >+ } ); >+ dragSource.addDragListener( new DragSourceAdapter(){ >+ public void dragSetData( final DragSourceEvent event ) { >+ log.add( event ); >+ event.data = new byte[]{ 34, 94 }; >+ } >+ } ); >+ shell.open(); >+ String displayId = DisplayUtil.getId( display ); >+ // Simulate request that sends a drop event >+ Fixture.fakeResponseWriter(); >+ Fixture.fakeRequestParam( RequestParams.UIROOT, displayId ); >+ int typeId = myTransfer.getSupportedTypes()[ 0 ].type; >+ createDropTargetEvent( dropTargetControl, >+ dragSourceControl, >+ "dropAccept", >+ 1, >+ 2, >+ "move", >+ typeId, >+ 1 ); >+ // run life cycle >+ Fixture.executeLifeCycleFromServerThread(); >+ assertEquals( 3, log.size() ); >+ DragSourceEvent dragSetDataEvent = ( DragSourceEvent )log.get( 1 ); >+ assertEquals( DragSourceEvent.DRAG_SET_DATA, dragSetDataEvent.getID() ); >+ TransferData dataType = dragSetDataEvent.dataType; >+ assertTrue( myTransfer.isSupportedType( dataType ) ); >+ DropTargetEvent dropEvent = ( DropTargetEvent )log.get( 2 ); >+ assertEquals( DropTargetEvent.DROP, dropEvent.getID() ); >+ byte[] data = ( byte[] )dropEvent.data; >+ assertEquals( 34, data[ 0 ] ); >+ assertEquals( 94, data[ 1 ] ); >+ } >+ > public void testInvalidDataOnDragSetData() { > final java.util.List log = new ArrayList(); > Display display = new Display();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 298447
: 155735