Files
VisualSapfor/src/_VisualDVM/Passes/All/DownloadBugReport.java
2025-02-05 01:14:41 +03:00

26 lines
923 B
Java

package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Passes.Server.ComponentsServerPass;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.Server.ServerCode;
public class DownloadBugReport extends ComponentsServerPass<BugReport> {
@Override
protected boolean canStart(Object... args) {
target = (BugReport) args[0];
return !target.getArchiveFile().exists()&&SendRequest(ServerCode.ReceiveBugReport, target.id);
}
@Override
protected void performPreparation() throws Exception {
Utils_.CheckDirectory(Global.BugReportsDirectory);
}
@Override
protected void body() throws Exception {
Utils_.bytesToFile((byte[]) request.server_response.object, target.getArchiveFile());
}
@Override
protected boolean validate() {
return target.getArchiveFile().exists();
}
}