-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BZ941 Fix for rewrite on outputstream with large sizes/fragments
- Loading branch information
Showing
7 changed files
with
382 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module org | ||
{ | ||
module jacorb | ||
{ | ||
module test | ||
{ | ||
module bugs | ||
{ | ||
module bug941 | ||
{ | ||
struct Data | ||
{ | ||
sequence <octet> bits; | ||
}; | ||
|
||
interface MyServer | ||
{ | ||
void setData (in Data few_bits); | ||
|
||
void setBigData (in Data too_many_bits); | ||
|
||
typedef fixed <5,2> fixedT; | ||
|
||
readonly attribute short height; // height of the grid | ||
readonly attribute short width; // width of the grid | ||
|
||
// set the element [n,m] of the grid, to value: | ||
void set(in short n, in short m, in fixedT value); | ||
|
||
// return element [n,m] of the grid: | ||
fixedT get(in short n, in short m); | ||
|
||
exception MyException | ||
{ | ||
string why; | ||
}; | ||
|
||
short opWithException() raises( MyException ); | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; |
85 changes: 85 additions & 0 deletions
85
test/regression/src/org/jacorb/test/bugs/bug941/Bug941Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package org.jacorb.test.bugs.bug941; | ||
|
||
/* | ||
* JacORB - a free Java ORB | ||
* | ||
* Copyright (C) 1997-2013 Gerald Brose / The JacORB Team. | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public | ||
* License along with this library; if not, write to the Free | ||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
*/ | ||
|
||
import java.util.Arrays; | ||
import java.util.Properties; | ||
import junit.framework.Test; | ||
import junit.framework.TestSuite; | ||
import org.jacorb.test.common.ClientServerSetup; | ||
import org.jacorb.test.common.ClientServerTestCase; | ||
import org.jacorb.test.common.TestUtils; | ||
|
||
public class Bug941Test extends ClientServerTestCase | ||
{ | ||
private org.omg.CORBA.Object server; | ||
|
||
public Bug941Test(String name, ClientServerSetup setup) | ||
{ | ||
super(name, setup); | ||
} | ||
|
||
public static Test suite() | ||
{ | ||
Properties severProp = new Properties(); | ||
|
||
Properties clientProp = new Properties(); | ||
clientProp.setProperty("org.omg.PortableInterceptor.ORBInitializerClass.a", | ||
MyInitializer.class.getName()); | ||
|
||
TestSuite suite = new TestSuite(Bug941Test.class.getName()); | ||
|
||
ClientServerSetup setup = new ClientServerSetup(suite, | ||
"org.jacorb.test.bugs.bug941.TestObjectImpl", | ||
clientProp, severProp); | ||
TestUtils.addToSuite(suite, setup, Bug941Test.class); | ||
|
||
return setup; | ||
} | ||
|
||
protected void setUp() throws Exception | ||
{ | ||
server = setup.getServerObject(); | ||
} | ||
|
||
protected void tearDown() throws Exception | ||
{ | ||
server = null; | ||
} | ||
|
||
public void testBug941Test() | ||
{ | ||
MyServer grid; | ||
|
||
grid = MyServerHelper.narrow(server); | ||
|
||
System.out.println ("### In main" ); | ||
byte [] petite_bite = new byte [1]; | ||
petite_bite[0] = 1; | ||
Data tiny = new Data(petite_bite); | ||
grid.setData(tiny); | ||
|
||
byte [] grosse_bite = new byte [10000]; | ||
Arrays.fill(grosse_bite, (byte) 1); | ||
Data biger = new Data(grosse_bite); | ||
grid.setBigData(biger); | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
test/regression/src/org/jacorb/test/bugs/bug941/ClientInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package org.jacorb.test.bugs.bug941; | ||
|
||
/* | ||
* JacORB - a free Java ORB | ||
* | ||
* Copyright (C) 1997-2013 Gerald Brose / The JacORB Team. | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public | ||
* License along with this library; if not, write to the Free | ||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
*/ | ||
|
||
import org.jacorb.orb.giop.RequestOutputStream; | ||
import org.jacorb.orb.portableInterceptor.ClientRequestInfoImpl; | ||
import org.omg.PortableInterceptor.ClientRequestInfo; | ||
import org.omg.PortableInterceptor.ClientRequestInterceptor; | ||
import org.omg.PortableInterceptor.ForwardRequest; | ||
|
||
/** | ||
* @author Nick Cross | ||
*/ | ||
|
||
public class ClientInterceptor extends org.omg.CORBA.LocalObject implements ClientRequestInterceptor | ||
{ | ||
public ClientInterceptor() | ||
{ | ||
} | ||
|
||
public String name() | ||
{ | ||
return "ClientInterceptor941"; | ||
} | ||
|
||
public void destroy() | ||
{ | ||
} | ||
|
||
public void send_request( ClientRequestInfo ri ) | ||
throws ForwardRequest | ||
{ | ||
final RequestOutputStream output = ((ClientRequestInfoImpl) ri).getRequestStream (); | ||
|
||
if (output != null && output.getBodyBegin() > 0) | ||
{ | ||
int debut = output.getBodyBegin(); | ||
final int fin = output.size(); | ||
int resteALire = fin - debut; | ||
|
||
if (resteALire > 0) | ||
{ | ||
final byte[] buf = output.getBufferCopy(); | ||
final int pos = output.get_pos(); | ||
|
||
// skip header | ||
output.skip(debut - pos); | ||
// rewrite remaining | ||
output.write_octet_array(buf, debut, resteALire); | ||
} | ||
} | ||
} | ||
|
||
public void send_poll(ClientRequestInfo ri) | ||
{ | ||
} | ||
|
||
public void receive_reply(ClientRequestInfo ri) | ||
{ | ||
} | ||
|
||
public void receive_exception(ClientRequestInfo ri) | ||
throws ForwardRequest | ||
{ | ||
} | ||
|
||
public void receive_other(ClientRequestInfo ri) | ||
throws ForwardRequest | ||
{ | ||
} | ||
} |
Oops, something went wrong.