Skip to content

Commit

Permalink
Let enum action continue on registry errors
Browse files Browse the repository at this point in the history
  • Loading branch information
qtc-de committed May 16, 2024
1 parent ef233a7 commit 85d6d24
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Improve `scan` action reliability (#62)
* Refactor plugin system ([README](/plugins/README.md))
* IArgumentProvider now accepts an array of arguments instead of a string (a653e6367260ba46333e596d81da283a64fc80f1)
* Let `enum` action continue on RemoteObject retrieval errors


## v5.0.0 - Dec 23, 2023
Expand Down
7 changes: 5 additions & 2 deletions src/eu/tneitzel/rmg/io/Formatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,17 @@ public void listBoundNames(RemoteObjectWrapper[] remoteObjects)
for (RemoteObjectWrapper remoteObject : remoteObjects)
{
Logger.printlnMixedYellow("-", remoteObject.boundName);
Logger.increaseIndent();

if (remoteObject.remoteObject == null)
{
Logger.printlnMixedRed("--> Error:", "RemoteObject could not be obtained from registry.");
Logger.printlnMixedBlue(" Check", "/docs/rmg/transport-errors.md", "for more information.");

Logger.decreaseIndent();
continue;
}

Logger.increaseIndent();

if (remoteObject instanceof SpringRemotingWrapper)
{
Logger.printMixedBlue("-->", SpringRemotingWrapper.invocationHandlerClass, "");
Expand Down
38 changes: 23 additions & 15 deletions src/eu/tneitzel/rmg/operations/Dispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import eu.tneitzel.rmg.io.WordlistHandler;
import eu.tneitzel.rmg.networking.RMIEndpoint;
import eu.tneitzel.rmg.networking.RMIRegistryEndpoint;
import eu.tneitzel.rmg.utils.EmptyWrapper;
import eu.tneitzel.rmg.utils.IUnknown;
import eu.tneitzel.rmg.utils.RMGUtils;
import eu.tneitzel.rmg.utils.RemoteObjectWrapper;
Expand Down Expand Up @@ -113,36 +114,43 @@ private void obtainBoundObjects() throws NoSuchObjectException
{
ExceptionHandler.internalError("obtainBoundObjects", "reflection");
}

}

else
{
int retryCount = 0;

if (boundNames == null)
{
obtainBoundNames();
}

while (retryCount < 5)
remoteObjects = new RemoteObjectWrapper[boundNames.length];

outer: for (int ctr = 0; ctr < boundNames.length; ctr++)
{
try
{
remoteObjects = getRegistry().lookupWrappers(boundNames);
return;
}
int retryCount = 0;

catch (java.rmi.UnmarshalException e)
while (retryCount < 5)
{
retryCount += 1;
}
try
{
remoteObjects[ctr] = getRegistry().lookupWrapper(boundNames[ctr]);
continue outer;
}

catch (Exception e)
{
ExceptionHandler.unexpectedException(e, "lookup", "operation", true);
catch (java.rmi.UnmarshalException e)
{
retryCount += 1;
}

catch (Exception e)
{
ExceptionHandler.unexpectedException(e, "lookup", "operation", true);
}
}

remoteObjects[ctr] = new EmptyWrapper(boundNames[ctr]);
}

}
}

Expand Down

0 comments on commit 85d6d24

Please sign in to comment.