Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle out of space #427

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
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 @@ -2,7 +2,7 @@
* org.openmicroscopy.shoola.env.data.ConnectionExceptionHandler
*
*------------------------------------------------------------------------------
* Copyright (C) 2006-2013 University of Dundee & Open Microscopy Environment.
* Copyright (C) 2006-2024 University of Dundee & Open Microscopy Environment.
* All rights reserved.
*
*
Expand Down Expand Up @@ -67,6 +67,9 @@ public class ConnectionExceptionHandler
/** Indicates that the network is down. */
public static final int NETWORK = 3;

/** Indicates that the server ran out of disk space **/
public static final int OUT_OF_SPACE = 4;

/** String identifying the connection refused exception.*/
private static final String REFUSED = "Ice::ConnectionRefusedException";

Expand Down Expand Up @@ -139,6 +142,9 @@ else if (cause instanceof UnknownException)
index = handleIceUnknownException(cause);
else if (e instanceof UnknownException)
index = handleIceUnknownException(e);
else if (e.toString().contains("No space")) {
index = OUT_OF_SPACE;
}
return index;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*------------------------------------------------------------------------------
* Copyright (C) 2006-2022 University of Dundee. All rights reserved.
* Copyright (C) 2006-2024 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -409,7 +409,14 @@ public void sessionExpiredExit(int index, Throwable exc)
connectionDialog = new NotificationDialog(f,
"Connection Refused", message, null);
addListenerAndShow();
}
case ConnectionExceptionHandler.OUT_OF_SPACE:
message = "The server ran out of disk space.\n" +
"Please contact your system administrator.\n" +
"The application will now exit.";
connectionDialog = new NotificationDialog(f,
"Out of disk space.", message, null);
addListenerAndShow();;
}
}

/**
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/org/openmicroscopy/shoola/env/data/OMEROGateway.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*------------------------------------------------------------------------------
* Copyright (C) 2006-2022 University of Dundee. All rights reserved.
* Copyright (C) 2006-2024 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -248,6 +248,7 @@
import omero.gateway.model.WellSampleData;



/**
* Unified access point to the various <i>OMERO</i> services.
*
Expand Down Expand Up @@ -767,8 +768,11 @@ private void handleException(Throwable t, String message)
} else if (cause instanceof AuthenticationException) {
String s = "Cannot initialize the session. \n";
throw new DSOutOfServiceException(s+message, cause);
} else if (cause instanceof ResourceError) {
}
else if (cause instanceof ResourceError) {
String s = "Fatal error. Please contact the administrator. \n";
if (t.toString().contains("No space"))
s = "Server ran out of disk space. Please contact the administrator. \n";
throw new DSOutOfServiceException(s+message, t);
}
throw new DSAccessException("Cannot access data. \n"+message, t);
Expand Down Expand Up @@ -5671,9 +5675,13 @@ Object importImageFile(SecurityContext ctx, ImportableObject object,
null, 0, srcFiles.length, null, null, null));

for (int i = 0; i < srcFiles.length; i++) {
checksums.add(library. uploadFile(proc, srcFiles, i,
checksumProviderFactory, estimator,
buf));
try {
checksums.add(library.uploadFile(proc, srcFiles, i,
checksumProviderFactory, estimator,
buf));
} catch (Throwable e ){
handleConnectionException(e);
}
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* org.openmicroscopy.shoola.env.ui.TaskBarImpl
*
*------------------------------------------------------------------------------
* Copyright (C) 2006-2013 University of Dundee. All rights reserved.
* Copyright (C) 2006-2024 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -608,7 +608,7 @@ public void removeFromMenu(int menuID, JMenuItem entry)
for (int j = 0; j < comps.length; j++) {
c = comps[j];
if (c instanceof JMenu) {
if (((JMenu) c).getText() == entry.getText()) {
if (((JMenu) c).getText().equals(entry.getText())) {
menu.remove(c);
}
}
Expand Down
Loading