List of usage examples for java.lang Throwable Throwable
public Throwable()
From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java
private void addUpperLink(final String networkId, final Link link) { logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " Start"); Map<String, String> attributes = link.getAttributes(); String establishmentStatus = attributes.get(AttrElements.ESTABLISHMENT_STATUS); if (null == establishmentStatus) { logger.debug("** Link Attribute establishment_status non"); return;//from www .j a va 2 s . c o m } logger.info("** link_id:" + link.getId() + " status:" + establishmentStatus); logger.debug("** Link Attribute establishment_status:" + establishmentStatus); registerLinkAndSync(networkId, getUpperNetworkId(), link); }
From source file:eu.stratosphere.nephele.executiongraph.ExecutionGraph.java
private static InternalJobStatus determineNewJobStatus(final ExecutionGraph eg, final ExecutionState latestStateChange) { final InternalJobStatus currentJobStatus = eg.getJobStatus(); switch (currentJobStatus) { case CREATED: if (eg.jobHasScheduledStatus()) { return InternalJobStatus.SCHEDULED; } else if (latestStateChange == ExecutionState.CANCELED) { if (eg.jobHasFailedOrCanceledStatus()) { return InternalJobStatus.CANCELED; }/*from ww w.j ava 2 s . c om*/ } break; case SCHEDULED: if (latestStateChange == ExecutionState.RUNNING) { return InternalJobStatus.RUNNING; } else if (latestStateChange == ExecutionState.CANCELED) { if (eg.jobHasFailedOrCanceledStatus()) { return InternalJobStatus.CANCELED; } } break; case RUNNING: if (latestStateChange == ExecutionState.CANCELED) { return InternalJobStatus.CANCELING; } if (latestStateChange == ExecutionState.FAILED) { final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(eg, true); while (it.hasNext()) { final ExecutionVertex vertex = it.next(); if (vertex.getExecutionState() == ExecutionState.FAILED) { return InternalJobStatus.FAILING; } } } if (eg.jobHasFinishedStatus()) { return InternalJobStatus.FINISHED; } break; case FAILING: if (eg.jobHasFailedOrCanceledStatus()) { return InternalJobStatus.FAILED; } break; case FAILED: LOG.error("Received update of execute state in job status FAILED"); break; case CANCELING: if (eg.jobHasFailedOrCanceledStatus()) { return InternalJobStatus.CANCELED; } break; case CANCELED: LOG.error("Received update of execute state in job status CANCELED: " + eg.getJobID()); break; case FINISHED: LOG.error("Received update of execute state in job status FINISHED: " + eg.getJobID() + " " + StringUtils.stringifyException(new Throwable())); break; } return currentJobStatus; }
From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java
private void addLayerizedLink(final String networkId, final Link link) { logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " Start"); Map<String, String> attributes = link.getAttributes(); String establishmentStatus = attributes.get(AttrElements.ESTABLISHMENT_STATUS); if (null == establishmentStatus) { logger.debug("** Link Attribute establishment_status non"); return;/*from ww w . j a v a 2s. c o m*/ } logger.info("** link_id:" + link.getId() + " status:" + establishmentStatus); logger.debug("** Link Attribute establishment_status:" + establishmentStatus); registerLinkAndSync(networkId, getLayerizerNetworkId(), link); }
From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java
private void uppdateLowerFlowFromLayerizerLink(final Link link) { logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " Start"); String establishmentStatus = link.getAttribute(AttrElements.ESTABLISHMENT_STATUS); NetworkInterface lowerNetworkIf = networkInterfaces().get(getLowerNetworkId()); if (!LINK_STATUS_ESTABLISHED.equals(establishmentStatus)) { logger.debug("** Lower_nw Add Flow Start"); if (lowerflows.containsKey(link.getId())) { for (String lowerFlowId : lowerflows.get(link.getId())) { Flow lowerFlow = lowerNetworkIf.getFlow(lowerFlowId); if (null != lowerFlow) { lowerFlow.setStatus(establishmentStatus); lowerFlow.putAttribute(AttrElements.BANDWIDTH, StringUtils.defaultString(link.getAttribute(AttrElements.MAX_BANDWIDTH))); lowerFlow.putAttribute(AttrElements.REQ_BANDWIDTH, StringUtils.defaultString(link.getAttribute(AttrElements.REQ_BANDWIDTH))); lowerFlow.putAttribute(AttrElements.LATENCY, StringUtils.defaultString(link.getAttribute(AttrElements.LATENCY))); lowerFlow.putAttribute(AttrElements.REQ_LATENCY, StringUtils.defaultString(link.getAttribute(AttrElements.REQ_LATENCY))); lowerFlow.putAttribute(TableManager.TRANSACTION_ID, StringUtils.defaultString(link.getAttribute(TableManager.TRANSACTION_ID))); lowerNetworkIf.putFlow(lowerFlow); }/*from ww w .j ava2s .c om*/ } } else { BasicFlow flow = linkToFlow(lowerNetworkIf, link); logger.debug("** layerized_nw:" + getLayerizerNetworkId()); logger.debug("** lower_nw:" + getLowerNetworkId()); if (flow.validate()) { logger.debug("** flow True"); lowerNetworkIf.putFlow(flow); putLowerFlows(link.getId(), flow.getFlowId()); putLayerizedlinks(link.getId(), flow.getFlowId()); } } } logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " End"); }
From source file:com.flexive.shared.FxSharedUtils.java
/** * Get the localized message for a given language code and ISO * * @param resourceBundle the resource bundle to use * @param localeId used locale if args contain FxString instances * @param localeIso ISO code of the requested locale * @param key the key in the resource bundle * @param args arguments to replace in the message ({n}) * @return localized message// w ww . ja v a 2 s. c om */ public static String getLocalizedMessage(String resourceBundle, long localeId, String localeIso, String key, Object... args) { if (key == null) { //noinspection ThrowableInstanceNeverThrown LOG.error("No key given!", new Throwable()); return "??NO_KEY_GIVEN"; } String resource = lookupResource(resourceBundle, key, localeIso); if (resource == null) { //try to fallback to PluginMessages ... resource = lookupResource("PluginMessages", key, localeIso); if (resource == null) { // LOG.warn("Called with unlocalized Message [" + key + "]. See StackTrace for origin!", new Throwable()); return key; } } //lookup possible resource keys in values (they may not have placeholders like {n} though) String tmp; for (int i = 0; i < args.length; i++) { Object o = args[i]; if (o instanceof String && ((String) o).indexOf(' ') == -1 && ((String) o).indexOf('.') > 0) if ((tmp = lookupResource(resourceBundle, (String) o, localeIso)) != null) args[i] = tmp; } return FxFormatUtils.formatResource(resource, localeId, args); }
From source file:com.alipay.vbizplatform.web.controller.MyCarManageController.java
/** * ??//from ww w. j a v a2 s.co m * @param request * @param response * @return */ @RequestMapping("/newCarInfo") public String newCarInfo(HttpServletRequest request, HttpServletResponse response) { Map<String, String> pageParam = super.getParametersFromPage(request); // ??? Map<String, Object> vo = null; //?? String manufacturer = null; // ?? String carSeriesName = null; String uId = null; long startTime = System.currentTimeMillis(); try { // Object obj = request.getSession().getAttribute("newVehicleModel"); uId = super.getUserInfo(request).getUid(); String vehicleModelKey = uId + VEHICLE_MODEL_KEY_PREFIX; Object obj = spyMemcachedClient.get(vehicleModelKey); if (obj == null || (pageParam.get("newCarFlag") != null && pageParam.get("newCarFlag").equals("1"))) { vo = new HashMap<String, Object>(); // request.getSession().setAttribute("newVehicleModel", vo); this.spyMemcachedClient.set(vehicleModelKey, Constant.MEMCACHED_SAVETIME_24, vo); } else { vo = (HashMap<String, Object>) obj; } /*****???vo******/ if (StringUtils.isNotEmpty(pageParam.get("carSeriesName"))) { // ?? carSeriesName = URLDecoder.decode(pageParam.get("carSeriesName"), "UTF-8"); if (null != carSeriesName && !(ObjectUtil.toString(vo.get("viSeriesName")).equals(carSeriesName))) { vo.put("viSeriesName", carSeriesName); //? vo.put("viBrandName", URLDecoder.decode(pageParam.get("brandName"), "UTF-8")); //??? vo.put("viBrandLogo", URLDecoder.decode(pageParam.get("picUrl"), "UTF-8")); // vo.put("viLogoUrl", URLDecoder.decode(pageParam.get("modPicUrl"), "UTF-8")); //? vo.put("bgUrl", URLDecoder.decode(pageParam.get("bgUrl"), "UTF-8")); //?? manufacturer = URLDecoder.decode(pageParam.get("manufacturer"), "UTF-8"); vo.put("manufacturer", manufacturer); // vo.put("sweptVolume", ""); vo.put("viStyleName", ""); vo.put("viModelName", ""); vo.put("viModelId", ""); vo.put("engineType", ""); } } //??? List<String> carEngineList = request.getAttribute("carEngineList") == null ? new ArrayList<String>() : (List<String>) request.getAttribute("carEngineList"); String carEngineFlag = pageParam.get("carEngineFlag"); if (!carEngineList.isEmpty() || "false".equals(carEngineFlag)) { String engineType = ""; if (StringUtils.isNotEmpty(pageParam.get("engineType"))) { // ?? engineType = URLDecoder.decode(pageParam.get("engineType"), "UTF-8"); } else { engineType = carEngineList.get(0); } if (null != engineType && !(ObjectUtil.toString(vo.get("engineType")).equals(engineType))) { String sweptVolume = URLDecoder.decode(ObjectUtil.toString(pageParam.get("sweptVolume")), "UTF-8"); String productionYear = URLDecoder.decode(ObjectUtil.toString(pageParam.get("carYearName")), "UTF-8"); String carModelName = URLDecoder.decode(ObjectUtil.toString(pageParam.get("carModelName")), "UTF-8"); //? vo.put("sweptVolume", sweptVolume); // // vo.put("viStyleName", ); // vo.put("productionYear", productionYear); // vo.put("viModelName", carModelName); //?? vo.put("engineType", engineType); Map<String, Object> map = getVihcleInfo(ObjectUtil.toString(vo.get("manufacturer")), ObjectUtil.toString(vo.get("viSeriesName")), sweptVolume, productionYear, carModelName, engineType); // vo.put("viStyleName", ObjectUtil.toString(map.get("style"))); } } else { if (StringUtils.isNotEmpty(pageParam.get("carModelName"))) { // ?? String carModelName = URLDecoder.decode(pageParam.get("carModelName"), "UTF-8"); if (null != carModelName && !(ObjectUtil.toString(vo.get("viModelName")).equals(carModelName))) { String sweptVolume = URLDecoder.decode(ObjectUtil.toString(pageParam.get("sweptVolume")), "UTF-8"); String productionYear = URLDecoder.decode(ObjectUtil.toString(pageParam.get("carYearName")), "UTF-8"); //? vo.put("sweptVolume", sweptVolume); // // vo.put("productionYear", productionYear); // vo.put("viModelName", carModelName); Map<String, Object> map = getVihcleInfo(ObjectUtil.toString(vo.get("manufacturer")), ObjectUtil.toString(vo.get("viSeriesName")), sweptVolume, productionYear, carModelName, "?"); // vo.put("viStyleName", ObjectUtil.toString(map.get("style"))); } } } // cookie? if (StringUtils.isEmpty(ObjectUtils.toString(vo.get("vlCityName")))) { Map<String, String> cityInfo = getCityInfo(request); if (!cityInfo.isEmpty()) { vo.put("vlCityId", cityInfo.get("resident_city_code")); vo.put("vlCityName", cityInfo.get("resident_city_name")); } } // request.getSession().setAttribute("newVehicleModel", vo); this.spyMemcachedClient.set(vehicleModelKey, Constant.MEMCACHED_SAVETIME_24, vo); request.setAttribute("vehicleModel", vo); String viNumber = String.valueOf(vo.get("viNumber")); // if (StringUtils.isNotEmpty(viNumber) && viNumber.length() >= 1) { request.setAttribute("cityAB", viNumber.substring(0, 1)); // request.setAttribute("carNumber", viNumber.substring(1, viNumber.length())); // } else { if (!StringUtils.isEmpty(ObjectUtil.toString(vo.get("vlCityId"))) && (StringUtils.isEmpty(viNumber))) { CityMapModel cityCode = ownerMessage.queryCityMapInfo(vo.get("vlCityId").toString()); if (null != cityCode) request.setAttribute("cityAB", cityCode.getCarNoPrefix()); // } } if (vo.get("viStartTime") != null) { // request.setAttribute("viStartTime", DateUtil.parserDateToString((Date) vo.get("viStartTime"), DateUtil.DATEFORMAT5)); } String backUrl = "/car/myCarList"; Object backObj = request.getSession().getAttribute("backUrl"); if (backObj != null) { backUrl = backObj.toString(); } request.setAttribute("backUrl", backUrl); //ocs?? List<Map<String, Object>> vehicleList = spyMemcachedClient .get(super.getUserInfo(request).getUid() + "_myCarList"); request.setAttribute("carList", JSONObject.toJSON(vehicleList)); //collapse request.setAttribute("collapseFlag", pageParam.get("collapseFlag")); } catch (Exception e) { if (logger.isErrorEnabled()) { logger.error("???", e); } logUtil.log(new Throwable(), "CARINFO", uId, MethodCallResultEnum.EXCEPTION, null, "???", startTime); super.redirectErrorPage("BUSY-ERR", "??", null, null, response); return null; } logUtil.log(new Throwable(), "CARINFO", uId, MethodCallResultEnum.SUCCESS, null, "????", startTime); return "page/cars/completion"; }
From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java
private void registerLinkAndSync(final String networkId, final String targetNetworkId, final Link link) { logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " Start"); NetworkInterface networkIf = networkInterfaces().get(targetNetworkId); Link targetLink = link.clone();// w w w . ja va 2 s . com Response ret = networkIf.putLink(targetLink); logger.debug("** Response:" + ret.statusCode); logger.debug("** Response Body:" + ret.getBodyValue().toString()); // Update conversionTable conversionTable().addEntryLink(networkId, link.getId(), targetNetworkId, link.getId()); logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " End"); }
From source file:com.orange.cepheus.broker.controller.NgsiControllerTest.java
@Test public void postUpdateContextWithThrowExecutionException() throws Exception { //localRegistrations mock return always a providingApplication when(providingApplication.hasNext()).thenReturn(true); when(providingApplication.next()).thenReturn(new URI("http//iotagent:1234")); when(localRegistrations.findProvidingApplication(any(), any())).thenReturn(providingApplication); //subscriptions mock return always without matched subscriptions when(matchedSubscriptions.hasNext()).thenReturn(false); when(subscriptions.findSubscriptions(any(), any())).thenReturn(matchedSubscriptions); when(updateContextResponseListenableFuture.get()) .thenThrow(new ExecutionException("execution exception", new Throwable())); //ngsiclient mock return always createUpdateContextREsponseTemperature when call updateContext when(ngsiClient.updateContext(any(), any(), any())).thenReturn(updateContextResponseListenableFuture); //check ngsiClient.notify is not called verify(ngsiClient, never()).notifyContext(any(), any(), any()); mockMvc.perform(post("/v1/updateContext").content(json(mapper, createUpdateContextTempSensorAndPressure())) .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.errorCode.code").value("500")) .andExpect(//from w w w. java 2 s .com MockMvcResultMatchers.jsonPath("$.errorCode.reasonPhrase").value("Receiver internal error")) .andExpect(MockMvcResultMatchers.jsonPath("$.errorCode.details") .value("An unknown error at the receiver has occured")); }
From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java
private void delLowerFlows(final String linkId) { logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " Start"); logger.debug("** linkId={}, lowerflows=[{}]", linkId, lowerflows); if (!lowerflows.containsKey(linkId)) { return;/*w ww . j av a 2 s.c om*/ } for (String flowId : lowerflows.get(linkId)) { logger.debug("** Lower flow delete. flowId={}", flowId); networkInterfaces().get(getLowerNetworkId()).delFlow(flowId); layerizedlinks.remove(flowId); } lowerflows.remove(linkId); logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " End"); }
From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java
private void putLowerFlows(String layerLinkId, String lowFlowId) { logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " Start"); ArrayList<String> list = lowerflows.get(layerLinkId); if (null == list) { list = new ArrayList<String>(); }//from w w w.j av a 2 s . c om list.add(lowFlowId); lowerflows.put(layerLinkId, list); logger.info("** lowerflows [{}]", lowerflows); logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " End"); }