Example usage for java.lang Exception Exception

List of usage examples for java.lang Exception Exception

Introduction

In this page you can find the example usage for java.lang Exception Exception.

Prototype

public Exception() 

Source Link

Document

Constructs a new exception with null as its detail message.

Usage

From source file:cherry.foundation.log.trace.TraceTest0Impl.java

public void test5() throws Exception {
    throw new Exception();
}

From source file:com.Services.Impl.SportRecords.SoccerRecords_CrudImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public Soccer_records merge(Soccer_records entity) {

    System.out.println("FOUND A FUCKING NULL");
    if (entity == null) {

        try {//from www. ja va2s.  c  om

            throw new Exception();
        } catch (Exception ex) {
            Logger.getLogger(SoccerRecords_CrudImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return entity;
}

From source file:com.Services.Impl.Employees.EmployeesCrudService.java

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public Other_Employees merge(Other_Employees entity) {
    if (entity == null) {
        try {//from w  w w  . ja  va2 s .  c  om
            throw new Exception();
        } catch (Exception ex) {
            Logger.getLogger(EmployeesCrudService.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    return entity;
}

From source file:Configuration.AlarmConfig.java

private String getConfigParam(String param) throws Exception {
    try {/*  w w  w.  j a  va2s  . c o  m*/
        if (config != null) {
            return config.getString(param);

        } else {
            throw new Exception();
        }
    } catch (Exception e) {
        Logger.getLogger("HMB").log(Level.WARN, "HMB Config File not found for parameter: " + param);
        throw e;
    }
}

From source file:com.arellomobile.android.push.DeviceFeature2_5.java

static void sendAppOpen(Context context) {
    final Map<String, Object> data = new HashMap<String, Object>();

    data.putAll(RequestHelper.getSendAppOpenData(context, NetworkUtils.PUSH_VERSION));

    Log.w(TAG, "Try To sent AppOpen");

    NetworkUtils.NetworkResult res = new NetworkUtils.NetworkResult(-1, null);
    Exception exception = new Exception();
    for (int i = 0; i < NetworkUtils.MAX_TRIES; ++i) {
        try {//from   ww  w.j a  va 2s. com
            res = NetworkUtils.makeRequest(data, APP_OPEN);
            if (200 == res.getResultCode()) {
                Log.w(TAG, "Send AppOpen success");
                return;
            }
        } catch (Exception e) {
            exception = e;
        }
    }

    Log.e(TAG, "ERROR: Try To sent AppOpen " + exception.getMessage() + ". Response = " + res.getResultData(),
            exception);
}

From source file:com.jivesoftware.jive.deployer.jaxrs.util.ResponseHelperTest.java

@Test
public void testErrorResponse() throws Exception {
    ObjectNode jsonNode = objectMapper.createObjectNode();
    jsonNode.put("Foobar", true);
    String message = "This is a BAD request!";
    Exception e = new Exception();
    OutputStream outputStream = new ByteArrayOutputStream();
    PrintStream printStream = new PrintStream(outputStream);
    e.printStackTrace(printStream);//  ww  w .ja  v  a2  s .c o m
    Response response = ResponseHelper.INSTANCE.errorResponse(Response.Status.BAD_REQUEST, message, e,
            jsonNode);
    assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
    String bodyString = objectMapper.writeValueAsString(response.getEntity());
    System.out.println(bodyString);
    ObjectNode body = (ObjectNode) objectMapper.readTree(bodyString);
    assertEquals(body.get("message").textValue(), message);
    assertEquals(body.get("trace").textValue(), outputStream.toString());
    assertEquals(body.get("relatedData"), jsonNode);
}

From source file:com.scvngr.levelup.core.net.AbstractResponseTest.java

@SmallTest
public void testConstructor2() throws MalformedURLException, IOException {
    final Exception e = new Exception();
    final AbstractResponseUnderTest response = new AbstractResponseUnderTest(e);
    assertEquals(AbstractResponse.HTTP_STATUS_CODE_UNUSED, response.getHttpStatusCode());
    assertNotNull(response.getError());//from   www.  j  a  v a2 s  .c o m
    assertEquals(e, response.getError());
}

From source file:com.telefonica.euro_iaas.sdc.rest.aspects.TraceInterceptorTest.java

@Test
public void testWriteToLogLogStringThrowable() {
    Log log = LogFactory.getLog(TraceInterceptorTest.class);
    traceInterceptor.writeToLog(log, "message", new Exception());
}

From source file:com.trenako.web.controllers.ErrorControllerTests.java

@Test
public void shouldShowStackTraceForLocalhostClients() {
    MockHttpServletRequest request = mockRequest("127.0.0.1", new Exception());

    ModelAndView mav = controller.resolveException(request);

    assertViewName(mav, "error/debug");
    assertModelAttributeAvailable(mav, "error");
}

From source file:com.vmware.bdd.manager.job.ProvisionTasklet.java

private void randomlyFail(double p) throws Exception {
    if (RandomUtils.nextDouble() > 1 - p) {
        throw BddException.INTERNAL(new Exception(), "Undefined random failure.");
    }//  w w w . j a  va  2 s.  com
}