use of flash.tools.debugger.VersionException in project vscode-nextgenas by BowlerHatLLC.
the class SWFDebugSession method launch.
public void launch(Response response, LaunchRequest.LaunchRequestArguments args) {
LaunchRequestArguments swfArgs = (LaunchRequestArguments) args;
ThreadSafeSessionManager manager = ThreadSafeBootstrap.sessionManager();
swfSession = null;
try {
manager.startListening();
if (manager.supportsLaunch()) {
String program = swfArgs.program;
Path programPath = Paths.get(program);
if (!programPath.isAbsolute()) {
//if it's not an absolute path, we'll treat it as a
//relative path within the workspace
String workspacePath = System.getProperty(WORKSPACE_PROPERTY);
if (workspacePath != null) {
program = Paths.get(workspacePath).resolve(programPath).toAbsolutePath().toString();
}
}
Player player = null;
CustomRuntimeLauncher launcher = null;
if (swfArgs.runtimeExecutable != null) {
//if runtimeExecutable is specified, we'll launch that
launcher = new CustomRuntimeLauncher(swfArgs.runtimeExecutable, swfArgs.runtimeArgs);
} else {
//otherwise, let the SWF debugger automatically figure out
//which runtime is required based on the program path
String playerPath = program;
try {
URI uri = Paths.get(playerPath).toUri();
playerPath = uri.toString();
} catch (Exception e) {
//safe to ignore
}
player = manager.playerForUri(playerPath, null);
if (player == null && !playerPath.startsWith("http:") && !playerPath.startsWith("https:") && playerPath.endsWith(".swf")) {
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
launcher = findWindowsStandalonePlayer();
} else if (//linux
!System.getProperty("os.name").toLowerCase().startsWith("mac os")) {
launcher = findLinuxStandalonePlayer();
}
}
}
if (player == null && launcher == null) {
sendErrorResponse(response, 10001, "Error launching SWF debug session. Runtime not found for program: " + program);
return;
} else {
AIRLaunchInfo launchInfo = null;
//check if the debugger automatically detected AIR
boolean isAIR = player != null && player.getType() == Player.AIR;
if (!isAIR && player == null && program.endsWith(FILE_EXTENSION_XML)) {
//otherwise, check if the program to launch is an AIR
//application descriptor
isAIR = true;
}
if (isAIR && adlPath != null) {
launchInfo = new AIRLaunchInfo();
launchInfo.profile = swfArgs.profile;
launchInfo.screenSize = swfArgs.screensize;
launchInfo.dpi = swfArgs.screenDPI;
launchInfo.versionPlatform = swfArgs.versionPlatform;
launchInfo.airDebugLauncher = adlPath.toFile();
launchInfo.extDir = swfArgs.extdir;
if (launcher != null) {
launcher.isAIR = true;
}
}
if (launcher != null) {
swfSession = (ThreadSafeSession) manager.launch(program, launchInfo, true, null, null, launcher);
} else {
swfSession = (ThreadSafeSession) manager.launch(program, launchInfo, true, null, null);
}
}
}
} catch (CommandLineException e) {
OutputEvent.OutputBody body = new OutputEvent.OutputBody();
body.output = e.getMessage() + "\n" + e.getCommandOutput();
body.category = OutputEvent.CATEGORY_STDERR;
sendEvent(new OutputEvent(body));
e.printStackTrace(System.err);
sendErrorResponse(response, 10001, "Error launching SWF debug session. Process exited with code: " + e.getExitValue());
return;
} catch (IOException e) {
e.printStackTrace(System.err);
sendErrorResponse(response, 10001, "Error launching SWF debug session.");
return;
}
try {
swfSession.bind();
} catch (VersionException e) {
e.printStackTrace(System.err);
}
try {
manager.stopListening();
} catch (IOException e) {
e.printStackTrace(System.err);
}
sendResponse(response);
cancelRunner = false;
sessionThread = new java.lang.Thread(new SessionRunner());
sessionThread.start();
}
use of flash.tools.debugger.VersionException in project intellij-plugins by JetBrains.
the class DebugCLI method process.
/**
* Process this reader until its done
*/
void process() throws IOException {
boolean done = false;
while (!done) {
try {
/**
* Now if we are in a session and that session is suspended then we go
* into a state where we wait for some user interaction to get us out
*/
runningLoop();
/* if we are in the stdin then put out a prompt */
if (!haveStreams())
displayPrompt();
/* now read in the next line */
readLine();
if (m_currentLine == null)
break;
done = processLine();
} catch (NoResponseException nre) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("noResponseException"));
} catch (NotSuspendedException nse) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("notSuspendedException"));
} catch (AmbiguousException ae) {
// we already put up a warning for the user
} catch (IllegalStateException ise) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("illegalStateException"));
} catch (IllegalMonitorStateException ime) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("illegalMonitorStateException"));
} catch (NoSuchElementException nse) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("noSuchElementException"));
} catch (NumberFormatException nfe) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("numberFormatException"));
} catch (SocketException se) {
Map socketArgs = new HashMap();
//$NON-NLS-1$
socketArgs.put("message", se.getMessage());
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("socketException", socketArgs));
} catch (VersionException ve) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("versionException"));
} catch (NotConnectedException nce) {
// handled by isConnectionLost()
} catch (Exception e) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("unexpectedError"));
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("stackTraceFollows"));
e.printStackTrace();
}
// check for a lost connection and if it is clean-up!
if (isConnectionLost()) {
try {
dumpHaltState(false);
} catch (PlayerDebugException pde) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("sessionEndedAbruptly"));
}
}
}
}
Aggregations