Browse Source

Merge branch 'release/11.0' of https://code.fineres.com/scm/~henry.wang/design into release/11.0

newui
Henry.Wang 2 years ago
parent
commit
fa02bd8385
  1. 6
      designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java
  2. 13
      designer-base/src/main/java/com/fr/env/detect/base/DetectorBridge.java
  3. 5
      designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java

6
designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java vendored

@ -151,7 +151,7 @@ public class EnvDetectorCenter {
if (!validAction.get()) {
return;
}
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect();
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect().stream();
// 展示效果
NotificationDialogProperties properties = new NotificationDialogProperties(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Detect_Notification_Title"));
@ -196,7 +196,7 @@ public class EnvDetectorCenter {
*/
public List<DetectorResult> terminate(Throwable throwable) {
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect(throwable);
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect(throwable).stream();
return resultStream
.filter((e) -> e.getStatus() == DetectorStatus.EXCEPTION)
.collect(Collectors.toList());
@ -209,7 +209,7 @@ public class EnvDetectorCenter {
*/
public List<DetectorResult> terminateUnexpectedly() {
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect();
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect().stream();
return resultStream
.filter((e) -> e.getStatus() == DetectorStatus.EXCEPTION)
.collect(Collectors.toList());

13
designer-base/src/main/java/com/fr/env/detect/base/DetectorBridge.java vendored

@ -16,7 +16,9 @@ import com.fr.log.FineLoggerFactory;
import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
@ -128,9 +130,11 @@ public class DetectorBridge {
*
* @return 能够检测出的异常情况
*/
public Stream<DetectorResult> detect() {
@NotNull
public Collection<DetectorResult> detect() {
return detectorManager.getValue().detect();
Stream<DetectorResult> results = detectorManager.getValue().detect();
return results.collect(Collectors.toList());
}
/**
@ -141,10 +145,11 @@ public class DetectorBridge {
* @param throwable 异常
* @return 检测结果
*/
public Stream<DetectorResult> detect(Throwable throwable) {
@NotNull
public Collection<DetectorResult> detect(Throwable throwable) {
ThrowableStore.getInstance().add(throwable);
Stream<DetectorResult> result = detect();
Collection<DetectorResult> result = detect();
ThrowableStore.getInstance().reset();
return result;

5
designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java

@ -28,12 +28,12 @@ import com.fr.stable.lifecycle.FineLifecycleFatalError;
import com.fr.stable.project.ProjectConstants;
import javax.swing.JOptionPane;
import java.util.Collection;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author hades
@ -88,8 +88,9 @@ public class LifecycleFatalErrorHandler {
@Override
public void handle(FineLifecycleFatalError fatal) {
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect(fatal);
Collection<DetectorResult> resultStream = DetectorBridge.getInstance().detect(fatal);
List<DetectorResult> results = resultStream
.stream()
.filter((e) -> e.getStatus() == DetectorStatus.EXCEPTION)
.collect(Collectors.toList());

Loading…
Cancel
Save