error message changed when the opened file is not swf

This commit is contained in:
honfika@gmail.com
2015-05-19 14:54:30 +02:00
parent 2fa2a2e022
commit 0670f0e36f
3 changed files with 2838 additions and 2793 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash;
import java.io.IOException;
/**
*
* @author JPEXS
*/
public class SwfOpenException extends IOException {
public SwfOpenException(String message) {
super(message);
}
}

View File

@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFBundle;
import com.jpexs.decompiler.flash.SWFSourceInfo;
import com.jpexs.decompiler.flash.SearchMode;
import com.jpexs.decompiler.flash.SwfOpenException;
import com.jpexs.decompiler.flash.Version;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.configuration.Configuration;
@@ -80,6 +81,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map.Entry;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
@@ -456,11 +458,24 @@ public class Main {
SWFList swfs = null;
try {
Main.startWork(AppStrings.translate("work.reading.swf") + "...");
swfs = parseSWF(sourceInfo);
try {
swfs = parseSWF(sourceInfo);
} catch (ExecutionException ex) {
Throwable cause = ex.getCause();
if (cause instanceof SwfOpenException) {
throw (SwfOpenException) cause;
}
throw ex;
}
} catch (OutOfMemoryError ex) {
logger.log(Level.SEVERE, null, ex);
View.showMessageDialog(null, "Cannot load SWF file. Out of memory.");
continue;
} catch (SwfOpenException ex) {
logger.log(Level.SEVERE, null, ex);
View.showMessageDialog(null, ex.getMessage());
continue;
} catch (Exception ex) {
logger.log(Level.SEVERE, null, ex);
View.showMessageDialog(null, "Cannot load SWF file.");