Skip to content

Commit

Permalink
Signed-off-by: Stepan Ermakov <[email protected]>
Browse files Browse the repository at this point in the history
##Fixes issue
This PR fixes the #900 issue.

##Changes introduced with this PR
Since the SecretValue structure is used in GWT, it should implement Serializable interface.
Also couple null checks were added to avoid NPE in the scenario explained in the #900 issue.

##Are you the owner of the code you are sending in, or do you have permission of the owner?
Yes
  • Loading branch information
sermakov-orion committed Aug 2, 2024
1 parent 7d868bf commit 0e9718f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package org.ovirt.engine.core.common.utils;

import java.io.Serializable;
import java.util.Objects;

public class SecretValue<T> {
public class SecretValue<T> implements Serializable {
private static final long serialVersionUID = -7894728002078425194L;

private T value;

public T getValue() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package org.ovirt.engine.ui.common.widget.uicommon.vm;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;

import org.gwtbootstrap3.client.ui.Label;
import org.ovirt.engine.core.common.businessentities.network.NetworkInterface;
import org.ovirt.engine.core.common.businessentities.network.NetworkStatistics;
import org.ovirt.engine.core.common.businessentities.network.VmInterfaceType;
import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface;
import org.ovirt.engine.core.common.businessentities.storage.Disk;
Expand Down Expand Up @@ -266,8 +270,10 @@ protected Double getSpeed(VmNetworkInterface object) {
AbstractTextColumn<VmNetworkInterface> dropsColumn = new AbstractSumUpColumn<VmNetworkInterface>() {
@Override
protected Double[] getRawValue(VmNetworkInterface object) {
Double receiveDrops = object != null ? object.getStatistics().getReceiveDrops().doubleValue() : null;
Double transmitDrops = object != null ? object.getStatistics().getTransmitDrops().doubleValue() : null;
Double receiveDrops = Optional.ofNullable(object).map(NetworkInterface::getStatistics)
.map(NetworkStatistics::getReceiveDrops).map(BigInteger::doubleValue).orElse(null);
Double transmitDrops = Optional.ofNullable(object).map(NetworkInterface::getStatistics)
.map(NetworkStatistics::getTransmitDrops).map(BigInteger::doubleValue).orElse(null);
return new Double[] { receiveDrops, transmitDrops };
}
};
Expand Down

0 comments on commit 0e9718f

Please sign in to comment.