Example usage for java.util EmptyStackException EmptyStackException

List of usage examples for java.util EmptyStackException EmptyStackException

Introduction

In this page you can find the example usage for java.util EmptyStackException EmptyStackException.

Prototype

public EmptyStackException() 

Source Link

Document

Constructs a new EmptyStackException with null as its error message string.

Usage

From source file:wsattacker.plugin.dos.dosExtension.attackThreads.SendRequestThread.java

@Override
public void run() {

    // do actual sending depending on requestType
    RequestSender requestSender;//  w  ww  .  j a  va2 s .c o  m
    if (!useNewMeasure) {
        requestSender = new RequestSenderImpl(model);
    } else {
        requestSender = new Http4RequestSenderImpl(model);
    }

    // Start time
    timeStart = System.currentTimeMillis();

    // TODO [CHAL 2013-12-31] we have to use enumeration here
    // TODO [CHAL 2013-12-31] where is the networkTest???
    if (this.requestType.equals("tampered")) {
        responseString = requestSender.sendTamperedRequest();
    } else if (this.requestType.equals("untampered")) {
        responseString = requestSender.sendUntamperedRequest();
    } else if (this.requestType.equals("testProbe")) {
        responseString = requestSender.sendTestProbeRequest();
    } else {
        throw new EmptyStackException();
    }

    // Stop time
    timeEnd = System.currentTimeMillis();

    // calculate the duration, the RequestSender knows its timing
    duration = requestSender.getReceiveTime() - requestSender.getSendTime();

    // Check for empty Response or SOAP-Fault
    // - SOAP-Fault check by finding end of closing Tag "Fault>"
    if (StringUtils.isEmpty(responseString)) {
        errorFlag = true;
    } else if (responseString.contains("Fault>")) {
        faultFlag = true;
    }

    // Log time -> done in context of EDT
    LogRequestRunnable log = new LogRequestRunnable(this.model, this.requestType, timeStart, timeEnd, duration,
            this.threadNumber, faultFlag, errorFlag, responseString);
    EventQueue.invokeLater(log);

    // Update GUI + Counter
    // - since called via runnable, Method will be executed in EDT -> no
    // Problems with Syncronization!
    if (this.requestType.equals("tampered") || this.requestType.equals("untampered")) {
        UpdateNumberRequestsRunnable update = new UpdateNumberRequestsRunnable(model, requestType);
        EventQueue.invokeLater(update);
    } else if (this.requestType.equals("testProbe")) {
        UpdateNumberProbesRunnable update = new UpdateNumberProbesRunnable(model);
        EventQueue.invokeLater(update);
    } else if (this.requestType.equals("networkTest")) {
        UpdateNumberNetworktestProbesRunnable update = new UpdateNumberNetworktestProbesRunnable(model);
        EventQueue.invokeLater(update);
    }

    // Log completion
    Result.getGlobalResult().add(new ResultEntry(ResultLevel.Trace, getName(),
            "Done Sending " + this.requestType + "-Request in " + duration + " ns"));
}