-Heap error alert
This commit is contained in:
tonikelope 2018-08-20 12:30:54 +02:00
parent 304a8f750a
commit 8e44bbb66a
9 changed files with 21 additions and 18 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>5.26</version>
<version>5.27</version>
<packaging>jar</packaging>
<dependencies>
<dependency>

View File

@ -37,7 +37,7 @@ public final class Chunk {
private final int _size_multi;
private boolean _writable;
public Chunk(long id, long file_size, String file_url) throws ChunkInvalidException, IOException {
public Chunk(long id, long file_size, String file_url) throws ChunkInvalidException, IOException, OutOfMemoryError {
_writable = true;
@ -67,7 +67,7 @@ public final class Chunk {
_data_os = new ByteArrayOutInputStream((int) _size);
}
public Chunk(long id, long file_size, String file_url, int size_multi) throws ChunkInvalidException {
public Chunk(long id, long file_size, String file_url, int size_multi) throws ChunkInvalidException, OutOfMemoryError {
_writable = true;

View File

@ -347,9 +347,9 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
} catch (ChunkInvalidException e) {
} catch (Exception ex) {
_download.stopDownloader(ex.getMessage());
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
} catch (OutOfMemoryError | Exception error) {
_download.stopDownloader(error.getMessage());
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, error.getMessage());
}
_download.stopThisSlot(this);

View File

@ -212,10 +212,9 @@ public class ChunkDownloaderMono extends ChunkDownloader {
} catch (ChunkInvalidException e) {
} catch (Exception ex) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
getDownload().stopDownloader(ex.getMessage());
} catch (OutOfMemoryError | Exception error) {
getDownload().stopDownloader(error.getMessage());
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, error.getMessage());
}
getDownload().stopThisSlot(this);

View File

@ -13,7 +13,6 @@ import javax.crypto.NoSuchPaddingException;
import static com.tonikelope.megabasterd.MiscTools.*;
import static com.tonikelope.megabasterd.CryptTools.*;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
@ -360,11 +359,10 @@ public class ChunkUploader implements Runnable, SecureSingleThreadNotifiable {
}
} catch (FileNotFoundException ex) {
Logger.getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
} catch (ChunkInvalidException ex) {
} catch (OutOfMemoryError | Exception error) {
_upload.stopUploader(error.getMessage());
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, error.getMessage());
}
_upload.stopThisSlot(this);

View File

@ -1311,7 +1311,9 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
public void stopDownloader(String reason) {
_status_error_message = reason != null ? reason : "FATAL ERROR!";
_status_error = true;
_status_error_message = (reason != null ? LabelTranslatorSingleton.getInstance().translate("FATAL ERROR! ") + reason : LabelTranslatorSingleton.getInstance().translate("FATAL ERROR! "));
stopDownloader();
}

View File

@ -41,6 +41,8 @@ public final class LabelTranslatorSingleton {
private void Spanish() {
_addTranslation("FATAL ERROR! ", "¡ERROR FATAL! ");
_addTranslation("Mega link is not valid! ", "Enlace de MEGA incorrecto! ");
_addTranslation("Checking your MEGA accounts, please wait...", "Comprobando tus cuentas de MEGA, por favor espera...");
_addTranslation("Check version", "Comprobar versión");
_addTranslation("Checking, please wait...", "Comprobando, por favor espera...");

View File

@ -47,7 +47,7 @@ import java.io.File;
*/
public final class MainPanel {
public static final String VERSION = "5.26";
public static final String VERSION = "5.27";
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
public static final int STREAMER_PORT = 1337;

View File

@ -1153,7 +1153,9 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
public void stopUploader(String reason) {
_status_error_message = reason != null ? reason : "FATAL ERROR!";
_status_error = true;
_status_error_message = (reason != null ? LabelTranslatorSingleton.getInstance().translate("FATAL ERROR! ") + reason : LabelTranslatorSingleton.getInstance().translate("FATAL ERROR! "));
stopUploader();
}