Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,29 @@ public class NodeAgentConfigUpgrade implements ConfigurationUpgrade, PostConstru

public void postConstruct() {

// first, check if the nodes element already exists.
final Nodes nodes = domain.getNodes();
if (nodes != null) {
if (!nodes.getNode().isEmpty()) {
// if nodes element exists, and it's not empty, there's no need to do the upgrade.
return;
}
// otherwise, remove the empty nodes element, then move on.
try {
ConfigSupport.apply(new SingleConfigCode<Domain>() {
@Override
public Object run(Domain d) throws PropertyVetoException, TransactionFailure {
d.setNodes(null);
return null;
}
}, domain);
} catch (Exception e) {
Logger.getAnonymousLogger().log(Level.SEVERE,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be better to move the log to the message of the runtime exception?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to follow the same style of the other try-catch of ConfigSupport.apply(..) in this soruce code.

"Failure while removing empty nodes config", e);
throw new RuntimeException(e);
}
}

final NodeAgents nodeAgents = domain.getNodeAgents();
if (nodeAgents == null) {
createDefaultNodeList();
Expand Down
Loading