/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 4487532
* @summary When the system property "sun.rmi.server.suppressStackTraces" is
* set to boolean true, then the RMI runtime should take positive action to
* counteract the new feature in 1.4 of an exception's stack trace being part
* of its serialized form so that the server-side stack trace of an exception
* that occurs during the execution of a remote method invocation gets
* marshalled to the client. In most cases, this feature-- along with the
* final fix to 4010355 to make the server-side stack trace data available
* at the RMI client application level-- is highly desirable, but this system
* property provides an opportunity to suppress the server-side stack trace
* data of exceptions thrown by remote methods from being marshalled, perhaps
* for reasons of performance or confidentiality requirements.
* @author Peter Jones
*
* @build SuppressStackTraces Impl2_Stub Impl1_Stub Impl1_Skel
*/
}
throws IOException, ClassNotFoundException
{
/*
* Verify right at unmarshalling time that this exception instance
* contains no stack trace data from the server (regardless of whether
* or not it would be apparent at the RMI client application level).
*/
throw new RuntimeException(
"TEST FAILED: exception contained non-empty stack trace: " +
}
}
}
// stub class generated with "rmic -v1.2 ..."
}
// stub and skeleton classes generated with "rmic -v1.1 ..."
}
public class SuppressStackTraces {
throws PongException, RemoteException
{
}
try {
/*
* Verify behavior for both -v1.1 and -v1.2 stub protocols.
*/
"TEST PASSED (server-side stack trace data suppressed)");
} finally {
try {
} catch (Exception e) {
}
try {
} catch (Exception e) {
}
}
}
try {
throw new RuntimeException("TEST FAILED: no exception caught");
} catch (PongException e) {
"trace of exception thrown by remote call:");
e.printStackTrace();
remoteTrace = e.getStackTrace();
}
int fooIndex = -1;
StackTraceElement e = remoteTrace[i];
if (fooIndex != -1) {
throw new RuntimeException(
"TEST FAILED: trace contains more than one __FOO__");
}
fooIndex = i;
throw new RuntimeException(
"TEST FAILED: trace contains __BAR__");
}
}
if (fooIndex == -1) {
throw new RuntimeException(
"TEST FAILED: trace lacks client-side method __FOO__");
}
}
}