Skip to content

Commit

Permalink
Remove system exception (#2162)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier authored May 14, 2024
1 parent 3352525 commit fd47c71
Show file tree
Hide file tree
Showing 36 changed files with 7 additions and 298 deletions.
3 changes: 1 addition & 2 deletions cpp/test/Ice/retry/msbuild/server/server.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\InstrumentationI.h"/>
<ClInclude Include="..\..\SystemFailure.h"/>
<ClInclude Include="..\..\TestI.h"/>
<ClInclude Include="Win32\Debug\Test.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
Expand Down Expand Up @@ -142,4 +141,4 @@
<Error Condition="!Exists('..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.9\build\zeroc.icebuilder.msbuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.9\build\zeroc.icebuilder.msbuild.props'))"/>
<Error Condition="!Exists('..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.9\build\zeroc.icebuilder.msbuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\msbuild\packages\zeroc.icebuilder.msbuild.5.0.9\build\zeroc.icebuilder.msbuild.targets'))"/>
</Target>
</Project>
</Project>
5 changes: 1 addition & 4 deletions cpp/test/Ice/retry/msbuild/server/server.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@
<ClInclude Include="..\..\InstrumentationI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SystemFailure.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="x64\Debug\Test.h">
<Filter>Header Files\x64\Debug</Filter>
</ClInclude>
Expand All @@ -102,4 +99,4 @@
<Filter>Slice Files</Filter>
</SliceCompile>
</ItemGroup>
</Project>
</Project>
5 changes: 0 additions & 5 deletions csharp/src/Ice/ConnectionI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -798,11 +798,6 @@ public void sendNoResponse()
}
}

public bool systemException(int requestId, SystemException ex, bool amd)
{
return false; // System exceptions aren't marshaled.
}

public void dispatchException(int requestId, LocalException ex, int requestCount, bool amd)
{
//
Expand Down
19 changes: 0 additions & 19 deletions csharp/src/Ice/Exception.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,6 @@ public LocalException() { }
public LocalException(System.Exception ex) : base(ex) { }
}

/// <summary>
/// Base class for Ice system exceptions.
/// Ice system exceptions are currently Ice internal, non-documented exceptions.
/// </summary>
public abstract class SystemException : Exception
{
/// <summary>
/// Creates a default-initialized system exception.
/// </summary>
public SystemException() { }

/// <summary>
/// Creates a default-initialized system exception and sets the InnerException
/// property to the passed exception.
/// </summary>
/// <param name="ex">The inner exception.</param>
public SystemException(System.Exception ex) : base(ex) { }
}

/// <summary>
/// Base class for Slice user exceptions.
/// </summary>
Expand Down
8 changes: 0 additions & 8 deletions csharp/src/Ice/Internal/CollocatedRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ public void
_adapter.decDirectCount();
}

public bool
systemException(int requestId, Ice.SystemException ex, bool amd)
{
handleException(requestId, ex, amd);
_adapter.decDirectCount();
return true;
}

public void
dispatchException(int requestId, Ice.LocalException ex, int requestCount, bool amd)
{
Expand Down
8 changes: 0 additions & 8 deletions csharp/src/Ice/Internal/Incoming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -578,14 +578,6 @@ private void handleException(System.Exception exc, bool amd)
{
Debug.Assert(_responseHandler != null);

if (exc is Ice.SystemException)
{
if (_responseHandler.systemException(_current.requestId, (Ice.SystemException)exc, amd))
{
return;
}
}

if (_response)
{
//
Expand Down
1 change: 0 additions & 1 deletion csharp/src/Ice/Internal/ResponseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ public interface ResponseHandler
{
void sendResponse(int requestId, Ice.OutputStream os, byte status, bool amd);
void sendNoResponse();
bool systemException(int requestId, Ice.SystemException ex, bool amd);
void dispatchException(int requestId, Ice.LocalException ex, int requestCount, bool amd);
}
2 changes: 1 addition & 1 deletion csharp/src/Ice/Proxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,7 @@ public int iceHandleException(Exception ex, RequestHandler handler, OperationMod
iceUpdateRequestHandler(handler, null); // Clear the request handler

//
// We only retry local exception, system exceptions aren't retried.
// We only retry local exception.
//
// A CloseConnectionException indicates graceful server shutdown, and is therefore
// always repeatable without violating "at-most-once". That's because by sending a
Expand Down
30 changes: 0 additions & 30 deletions csharp/test/Ice/retry/AllTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,36 +155,6 @@ public class AllTests : global::Test.AllTests
Instrumentation.testRetryCount(0);
output.WriteLine("ok");

if (retry1.ice_getConnection() == null)
{
Instrumentation.testInvocationCount(1);

output.Write("testing system exception... ");
try
{
retry1.opSystemException();
test(false);
}
catch (SystemFailure)
{
}
Instrumentation.testInvocationCount(1);
Instrumentation.testFailureCount(1);
Instrumentation.testRetryCount(0);
try
{
await retry1.opSystemExceptionAsync();
test(false);
}
catch (SystemFailure)
{
}
Instrumentation.testInvocationCount(1);
Instrumentation.testFailureCount(1);
Instrumentation.testRetryCount(0);
output.WriteLine("ok");
}

{
output.Write("testing invocation timeout and retries... ");
output.Flush();
Expand Down
5 changes: 0 additions & 5 deletions csharp/test/Ice/retry/RetryI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public override void opNotIdempotent(Ice.Current current)
throw new Ice.ConnectionLostException();
}

public override void opSystemException(Ice.Current c)
{
throw new SystemFailure();
}

public override void sleep(int delay, Ice.Current c)
{
Thread.Sleep(delay);
Expand Down
16 changes: 0 additions & 16 deletions csharp/test/Ice/retry/SystemFailure.cs

This file was deleted.

1 change: 0 additions & 1 deletion csharp/test/Ice/retry/Test.ice
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ interface Retry

idempotent int opIdempotent(int c);
void opNotIdempotent();
void opSystemException();

idempotent void sleep(int delay);

Expand Down
1 change: 0 additions & 1 deletion csharp/test/Ice/retry/msbuild/client/client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<Compile Include="../../AllTests.cs" />
<Compile Include="../../Client.cs" />
<Compile Include="../../Instrumentation.cs" />
<Compile Include="../../SystemFailure.cs" />
<Compile Include="generated\Test.cs">
<SliceCompileSource>../../Test.ice</SliceCompileSource>
</Compile>
Expand Down
1 change: 0 additions & 1 deletion csharp/test/Ice/retry/msbuild/collocated/collocated.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<Compile Include="../../Collocated.cs" />
<Compile Include="../../Instrumentation.cs" />
<Compile Include="../../RetryI.cs" />
<Compile Include="../../SystemFailure.cs" />
<Compile Include="generated\Test.cs">
<SliceCompileSource>../../Test.ice</SliceCompileSource>
</Compile>
Expand Down
1 change: 0 additions & 1 deletion csharp/test/Ice/retry/msbuild/server/server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<Compile Include="../../../../TestCommon/TestHelper.cs" />
<Compile Include="../../RetryI.cs" />
<Compile Include="../../Server.cs" />
<Compile Include="../../SystemFailure.cs" />
<Compile Include="generated\Test.cs">
<SliceCompileSource>../../Test.ice</SliceCompileSource>
</Compile>
Expand Down
5 changes: 0 additions & 5 deletions java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java
Original file line number Diff line number Diff line change
Expand Up @@ -680,11 +680,6 @@ public void sendNoResponse() {
}
}

@Override
public boolean systemException(int requestId, SystemException ex, boolean amd) {
return false; // System exceptions aren't marshaled.
}

@Override
public synchronized void invokeException(
int requestId, LocalException ex, int invokeNum, boolean amd) {
Expand Down
6 changes: 3 additions & 3 deletions java/src/Ice/src/main/java/com/zeroc/Ice/Exception.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
package com.zeroc.Ice;

/**
* Base class for Ice local and system exceptions. Those exceptions are not checked so we inherit
* from java.lang.RuntimeException. User exceptions are checked exceptions and therefore inherit
* directly from java.lang.Exception.
* Base class for Ice local exceptions. Those exceptions are not checked so we inherit from
* java.lang.RuntimeException. User exceptions are checked exceptions and therefore inherit directly
* from java.lang.Exception.
*/
public abstract class Exception extends RuntimeException implements Cloneable {
public Exception() {}
Expand Down
19 changes: 0 additions & 19 deletions java/src/Ice/src/main/java/com/zeroc/Ice/SystemException.java

This file was deleted.

2 changes: 1 addition & 1 deletion java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public int _handleException(
_updateRequestHandler(handler, null); // Clear the request handler

//
// We only retry local exception, system exceptions aren't retried.
// We only retry local exception.
//
// A CloseConnectionException indicates graceful server shutdown, and is therefore
// always repeatable without violating "at-most-once". That's because by sending a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,6 @@ public void sendNoResponse() {
_adapter.decDirectCount();
}

@Override
public boolean systemException(int requestId, com.zeroc.Ice.SystemException ex, boolean amd) {
handleException(requestId, ex, amd);
_adapter.decDirectCount();
return true;
}

@Override
public void invokeException(
int requestId, com.zeroc.Ice.LocalException ex, int batchRequestNum, boolean amd) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,13 +695,6 @@ private void handleException(Throwable exc, boolean amd) {
_responseHandler.sendNoResponse();
}
} catch (com.zeroc.Ice.Exception ex) {
if (ex instanceof com.zeroc.Ice.SystemException) {
if (_responseHandler.systemException(
_current.requestId, (com.zeroc.Ice.SystemException) ex, amd)) {
return;
}
}

if (_instance
.initializationData()
.properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ public interface ResponseHandler {

void sendNoResponse();

boolean systemException(int requestId, com.zeroc.Ice.SystemException ex, boolean amd);

void invokeException(int requestId, com.zeroc.Ice.LocalException ex, int invokeNum, boolean amd);
}
36 changes: 0 additions & 36 deletions java/test/src/main/java/test/Ice/interceptor/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,6 @@ private void runTest(MyObjectPrx prx, InterceptorI interceptor) {
test(interceptor.getLastOperation().equals("notExistAdd"));
test(!interceptor.getLastStatus());
out.println("ok");
out.print("testing system exception... ");
out.flush();
interceptor.clear();
try {
prx.badSystemAdd(33, 12);
test(false);
} catch (com.zeroc.Ice.UnknownException e) {
test(!prx.ice_isCollocationOptimized());
} catch (MySystemException e) {
test(prx.ice_isCollocationOptimized());
} catch (Throwable ex) {
test(false);
}
test(interceptor.getLastOperation().equals("badSystemAdd"));
test(!interceptor.getLastStatus());
out.println("ok");

out.print("testing exceptions raised by the interceptor... ");
out.flush();
Expand Down Expand Up @@ -127,22 +111,6 @@ private void runAmdTest(MyObjectPrx prx, InterceptorI interceptor, PrintWriter o
test(interceptor.getLastOperation().equals("amdNotExistAdd"));
test(interceptor.getLastStatus());
out.println("ok");
out.print("testing system exception... ");
out.flush();
interceptor.clear();
try {
prx.amdBadSystemAdd(33, 12);
test(false);
} catch (com.zeroc.Ice.UnknownException e) {
test(!prx.ice_isCollocationOptimized());
} catch (MySystemException e) {
test(prx.ice_isCollocationOptimized());
} catch (Throwable ex) {
test(false);
}
test(interceptor.getLastOperation().equals("amdBadSystemAdd"));
test(interceptor.getLastStatus());
out.println("ok");

out.print("testing exceptions raised by the interceptor... ");
out.flush();
Expand Down Expand Up @@ -201,10 +169,8 @@ private void testInterceptorExceptions(MyObjectPrx prx) {
java.util.List<ExceptionPoint> exceptions = new java.util.ArrayList<>();
exceptions.add(new ExceptionPoint("raiseBeforeDispatch", "user"));
exceptions.add(new ExceptionPoint("raiseBeforeDispatch", "notExist"));
exceptions.add(new ExceptionPoint("raiseBeforeDispatch", "system"));
exceptions.add(new ExceptionPoint("raiseAfterDispatch", "user"));
exceptions.add(new ExceptionPoint("raiseAfterDispatch", "notExist"));
exceptions.add(new ExceptionPoint("raiseAfterDispatch", "system"));
for (ExceptionPoint e : exceptions) {
java.util.Map<String, String> ctx = new java.util.HashMap<>();
ctx.put(e.point, e.exception);
Expand All @@ -217,8 +183,6 @@ private void testInterceptorExceptions(MyObjectPrx prx) {
test(e.exception.equals("notExist"));
} catch (com.zeroc.Ice.UnknownException ex) {
test(e.exception.equals("system")); // non-collocated
} catch (MySystemException ex) {
test(e.exception.equals("system")); // collocated
}
{
com.zeroc.Ice.ObjectPrx batch = prx.ice_batchOneway();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public CompletionStage<OutputStream> dispatch(com.zeroc.Ice.Request request)
throw new InvalidInputException();
} else if (context.equals("notExist")) {
throw new com.zeroc.Ice.ObjectNotExistException();
} else if (context.equals("system")) {
throw new MySystemException();
}
}

Expand Down Expand Up @@ -68,8 +66,6 @@ public CompletionStage<OutputStream> dispatch(com.zeroc.Ice.Request request)
throw new InvalidInputException();
} else if (context.equals("notExist")) {
throw new com.zeroc.Ice.ObjectNotExistException();
} else if (context.equals("system")) {
throw new MySystemException();
}
}
return f;
Expand Down
Loading

0 comments on commit fd47c71

Please sign in to comment.