Improved issue detection in presentation generated SWF files.
This commit is contained in:
parent
9d6f04ed16
commit
57eda6e54b
@ -63,8 +63,6 @@ public abstract class AbstractPageConverterHandler extends
|
||||
CharBuffer charBuffer = StandardCharsets.UTF_8.decode(buffer);
|
||||
stderrBuilder.append(charBuffer);
|
||||
}
|
||||
log.debug("Conversion stdout\n" + stdoutBuilder.toString());
|
||||
log.debug("Conversion error stderr\n" + stderrBuilder.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -84,7 +82,7 @@ public abstract class AbstractPageConverterHandler extends
|
||||
return stdoutBuilder.indexOf(value) > -1;
|
||||
}
|
||||
|
||||
protected Boolean sterrContains(String value) {
|
||||
protected Boolean stderrContains(String value) {
|
||||
return stderrBuilder.indexOf(value) > -1;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.bigbluebutton.presentation.handlers;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -30,7 +32,14 @@ public class SwfPageAnalyserHandler extends AbstractPageConverterHandler {
|
||||
private static String FONT_NULL_GLYPH = "glyph codepoint='0(?)'";
|
||||
private static String SYMBOL_REDEFINED = "redefined by identical tag";
|
||||
private static String DEFINE_SHAPE3 = "DefineShape3";
|
||||
private static String DEFINE_BUTTON = "decodeDefineButton";
|
||||
private static String MALFORMED_URL = "java.net.MalformedURLException";
|
||||
private int maxSwfShapes;
|
||||
private File analysedFile;
|
||||
|
||||
public SwfPageAnalyserHandler(File file) {
|
||||
analysedFile = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isConversionSuccessfull() {
|
||||
@ -47,15 +56,19 @@ public class SwfPageAnalyserHandler extends AbstractPageConverterHandler {
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
String reason = "The SWF is not compliant due to an unknown error";
|
||||
if (stdoutContains(FONT_NULL_GLYPH)) {
|
||||
log.error("SWF contains invalid font glyph dfintion");
|
||||
reason = "SWF contains invalid font glyph dfintion";
|
||||
} else if (stdoutContains(SYMBOL_REDEFINED)) {
|
||||
log.error("A SWF symbol was defined twice");
|
||||
} else {
|
||||
log.error("The SWF is not compliant due to an unknown error");
|
||||
log.error(stdoutBuilder.toString());
|
||||
reason = "A SWF symbol was defined twice";
|
||||
} else if (stderrContains(MALFORMED_URL)) {
|
||||
reason = "The SWF contains a malformed URL, the parsed file does probably not exist";
|
||||
} else if (stderrContains(DEFINE_BUTTON)) {
|
||||
reason = "A SWF DefineButton tag could not be parsed";
|
||||
}
|
||||
log.error(stderrBuilder.toString());
|
||||
log.error("swfdump exited with an error on file ["
|
||||
+ analysedFile.getAbsolutePath() + "]\nReason => " + reason
|
||||
+ "\nstderr:\n" + stderrBuilder.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ public class Pdf2SwfPageConverter implements PageConverter {
|
||||
String.valueOf(page), source, "-o", dest));
|
||||
Pdf2SwfPageConverterHandler pHandler = new Pdf2SwfPageConverterHandler();
|
||||
pb.setProcessListener(pHandler);
|
||||
log.debug("## Executing command: " + pb.command().toString());
|
||||
NuProcess process = pb.start();
|
||||
try {
|
||||
process.waitFor(60, TimeUnit.SECONDS);
|
||||
@ -69,7 +68,6 @@ public class Pdf2SwfPageConverter implements PageConverter {
|
||||
fontsDir, "-p", String.valueOf(page), source, "-o", dest));
|
||||
Pdf2SwfPageConverterHandler pBmpHandler = new Pdf2SwfPageConverterHandler();
|
||||
pbBmp.setProcessListener(pBmpHandler);
|
||||
log.debug("## Executing command: " + pbBmp.command().toString());
|
||||
NuProcess processBmp = pbBmp.start();
|
||||
try {
|
||||
processBmp.waitFor(60, TimeUnit.SECONDS);
|
||||
|
@ -42,11 +42,10 @@ public class SwfAnalyser implements PageAnalyser {
|
||||
|
||||
@Override
|
||||
public boolean analyse(File output) {
|
||||
NuProcessBuilder pb = new NuProcessBuilder(Arrays.asList(SWFTOOLS_DIR,
|
||||
"swfdump", output.getAbsolutePath()));
|
||||
SwfPageAnalyserHandler handler = new SwfPageAnalyserHandler();
|
||||
NuProcessBuilder pb = new NuProcessBuilder(Arrays.asList(SWFTOOLS_DIR
|
||||
+ File.separator + "swfdump", output.getAbsolutePath()));
|
||||
SwfPageAnalyserHandler handler = new SwfPageAnalyserHandler(output);
|
||||
handler.setMaxSwfShapes(maxSwfShapes);
|
||||
log.debug("$$ Executing command: " + pb.command().toString());
|
||||
pb.setProcessListener(handler);
|
||||
NuProcess process = pb.start();
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user