Example usage for java.lang Exception hashCode

List of usage examples for java.lang Exception hashCode

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public native int hashCode();

Source Link

Document

Returns a hash code value for the object.

Usage

From source file:io.coala.eve3.Eve3Test.java

public static void main(String[] args) {
    try {//from w ww  .  ja  v a2  s  . co  m
        final LocalConfig config = LocalConfig.builder().withId(agentName)
                .withProvider(Invoker.class, Eve3Invoker.class).build();
        final LocalBinder binder = Guice4LocalBinder.of(config);

        final List<URI> endpoints = binder.inject(Eve3Exposer.class).exposeAs(MyExposableService.class,
                new MyExposing());
        LOG.trace("Exposed {} at endpoints: {}", MyExposableService.class.getSimpleName(), endpoints);

        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
            System.err.println("SHUTTING DOWN EVE HTTP DAEMON");
        }));

        //         Runtime.getRuntime().exit( 0 );
    } catch (final Exception e) {
        e.printStackTrace();
        System.exit(e.hashCode());
    }
}

From source file:net.java.client.slee.resource.http.event.ResponseEvent.java

public ResponseEvent(Exception exception, Object requestApplicationData) {
    this.requestApplicationData = requestApplicationData;
    this.exception = exception;
    id = "null".hashCode() * 31 + exception.hashCode();
}

From source file:kotys.monika.MenuCreatorJSP.LoadData.java

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    String redirect = "/Administration/loadFoodCollectionFromCSV.jsp";
    PrintWriter out = response.getWriter();
    try {/*from   www. ja va 2s .c  om*/
        instance = MenuCreatorApp.getInstance();
        FoodComponentCollection_CSVLoader csvLoader = (FoodComponentCollection_CSVLoader) instance
                .getLoaderByName("FoodComponentCollection CSV Loader");
        File file = new File(((ArrayList<String>) request.getSession().getAttribute("uploadedFiles")).get(0));
        csvLoader.getDataSourceParameters().put("FilePath", file.getName());
        if (request.getParameter("submitted") == null) {
            request.getSession().setAttribute("ObjectName", "Food components");
            request.getSession().setAttribute("headersMapping", csvLoader.getHeadersMaping());
            request.getSession().setAttribute("dataSourceParameters", csvLoader.getDataSourceParameters());
            request.getSession().setAttribute("mapping", csvLoader.getMapping());
        } else {
            boolean issues = false;
            for (String key : csvLoader.getHeadersMaping().keySet()) {
                String atr = request.getParameter(key);
                if ("".equals(atr))
                    atr = "0";
                String val = csvLoader.validateHeadersMapping(key, atr);

                if (!val.isEmpty()) {
                    request.setAttribute(key + "_val", val);
                    issues = true;
                } else
                    csvLoader.getHeadersMaping().put(key, Integer.parseInt(atr));
            }
            for (String key : csvLoader.getDataSourceParameters().keySet()) {
                String atr = request.getParameter("ds_" + key);
                if ("".equals(atr))
                    atr = "0";
                String val = csvLoader.validateDataSourceParameters(key, atr);

                if (!val.isEmpty()) {
                    request.setAttribute(key + "_dsval", val);
                    issues = true;
                } else
                    csvLoader.getDataSourceParameters().put(key, atr);
            }
            for (String key : csvLoader.getMapping().keySet()) {
                String atr = request.getParameter("ma_" + key);
                if ("".equals(atr))
                    atr = "0";
                String val = csvLoader.validateMapping(key, atr);

                if (!val.isEmpty()) {
                    request.setAttribute(key + "_mval", val);
                    issues = true;
                } else
                    csvLoader.getMapping().put(key, Integer.parseInt(atr));
            }

            if (!issues) {
                csvLoader.getDataSourceParameters().put("FilePath", file.getPath());
                if (csvLoader.connect()) {
                    csvLoader.loadData();
                    Integer loaded = ((FoodComponentsCollection) csvLoader.getTargetObject()).getFoodList()
                            .size();
                    request.setAttribute("loaded", loaded);
                    redirect = "/done.jsp";
                }
            }
        }

        getServletContext().getRequestDispatcher(redirect).forward(request, response);
    } catch (Exception e) {
        response.sendError(e.hashCode(), e.getMessage());
    } finally {

        out.close();
    }
}