List of usage examples for java.lang Throwable Throwable
public Throwable()
From source file:org.o3project.ocnrm.odenos.driver.AbstractDriver.java
@Override protected BasicFlow getFlow(final NetworkInterface nwIf, final String flowId) { logger.debug(">> " + new Throwable().getStackTrace()[0].getMethodName()); if (nwIf == null) { logger.error(seqNo + "\t" + "networkIF is null."); return null; }//w w w .j a v a 2 s . c o m if (flowId == null) { logger.error(seqNo + "\t" + "flow ID is null."); return null; } Flow flow = nwIf.getFlow(flowId); if (flow == null) { logger.error(seqNo + "\t" + "flow is null."); return null; } if (!flow.getType().equals(BasicFlow.class.getSimpleName())) { logger.error(seqNo + "\t" + "flow type mismatch."); return null; } BasicFlow basicFlow = (BasicFlow) flow; if (basicFlow.getMatches() == null) { logger.error(seqNo + "\t" + "flow matches is null."); return null; } else if (basicFlow.getMatches().size() == 0) { logger.error(seqNo + "\t" + "flow matches is empty."); return null; } return basicFlow; }
From source file:net.lightbody.bmp.proxy.jetty.xml.XmlConfiguration.java
private Object itemValue(Object obj, Object item) throws NoSuchMethodException, ClassNotFoundException, InvocationTargetException, IllegalAccessException { // String value if (item instanceof String) return item; XmlParser.Node node = (XmlParser.Node) item; String tag = node.getTag();//w w w. j av a 2s . co m if ("Call".equals(tag)) return call(obj, node); if ("Get".equals(tag)) return get(obj, node); if ("New".equals(tag)) return newObj(obj, node); if ("Ref".equals(tag)) return refObj(obj, node); if ("Array".equals(tag)) return newArray(obj, node); if ("SystemProperty".equals(tag)) { String name = node.getAttribute("name"); String defaultValue = node.getAttribute("default"); return System.getProperty(name, defaultValue); } log.warn("Unknown value tag: " + node, new Throwable()); return null; }
From source file:org.apache.ranger.biz.KmsKeyMgr.java
private KeySearchFilter extractCommonCriteriasForFilter(HttpServletRequest request, KeySearchFilter ret, List<SortField> sortFields) { int startIndex = restErrorUtil.parseInt(request.getParameter(KeySearchFilter.START_INDEX), 0, "Invalid value for parameter startIndex", MessageEnums.INVALID_INPUT_DATA, null, KeySearchFilter.START_INDEX); ret.setStartIndex(startIndex);//w ww . j av a 2s . c o m int pageSize = restErrorUtil.parseInt(request.getParameter(KeySearchFilter.PAGE_SIZE), configUtil.getDefaultMaxRows(), "Invalid value for parameter pageSize", MessageEnums.INVALID_INPUT_DATA, null, KeySearchFilter.PAGE_SIZE); ret.setMaxRows(pageSize); ret.setGetCount(restErrorUtil.parseBoolean(request.getParameter("getCount"), true)); String sortBy = restErrorUtil.validateString(request.getParameter(KeySearchFilter.SORT_BY), StringUtil.VALIDATION_ALPHA, "Invalid value for parameter sortBy", MessageEnums.INVALID_INPUT_DATA, null, KeySearchFilter.SORT_BY); boolean sortSet = false; if (!StringUtils.isEmpty(sortBy)) { for (SortField sortField : sortFields) { if (sortField.getParamName().equalsIgnoreCase(sortBy)) { ret.setSortBy(sortField.getParamName()); String sortType = restErrorUtil.validateString(request.getParameter("sortType"), StringUtil.VALIDATION_ALPHA, "Invalid value for parameter sortType", MessageEnums.INVALID_INPUT_DATA, null, "sortType"); ret.setSortType(sortType); sortSet = true; break; } } } if (!sortSet && !StringUtils.isEmpty(sortBy)) { logger.info("Invalid or unsupported sortBy field passed. sortBy=" + sortBy, new Throwable()); } if (ret.getParams() == null) { ret.setParams(new HashMap<String, String>()); } return ret; }
From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java
private void updateFlowToLayerizer(String networkId, Flow prev, Flow curr) { logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " Start"); NetworkInterface targetNetworkIf = networkInterfaces().get(getLayerizerNetworkId()); BasicFlow flowWithPath = (BasicFlow) networkInterfaces().get(networkId).getFlow(curr.getFlowId()); Flow targetFlow = flowWithPath.clone(); targetFlow.setVersion(targetNetworkIf.getFlow(curr.getFlowId()).getVersion()); targetNetworkIf.putFlow(targetFlow); conversionTable().addEntryFlow(networkId, curr.getFlowId(), getLayerizerNetworkId(), targetFlow.getFlowId());//from ww w.j a v a 2 s . co m logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " End"); }
From source file:com.alipay.vbizplatform.web.controller.MyCarManageController.java
/** * ?// w ww .jav a 2 s .c o m * @param request * @param response * @return */ @RequestMapping("/queryCarModels") public String queryCarModels(HttpServletRequest request, HttpServletResponse response) { Map<String, String> pageParam = super.getParametersFromPage(request); // ?? String carYearName = null; Map<String, Object> vo = null; String uId = null; long startTime = System.currentTimeMillis(); // Map<String, Map> vehicleTypeListMap = null; 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) { vo = (HashMap<String, Object>) obj; if (StringUtils.isNotEmpty(pageParam.get("viNumber"))) { vo.put("viNumber", URLDecoder.decode(pageParam.get("viNumber"), "UTF-8").toUpperCase()); } if (StringUtils.isNotEmpty(pageParam.get("viStartTime"))) {// vo.put("viStartTime", DateUtil.parserDateFromString(pageParam.get("viStartTime"), DateUtil.DATEFORMAT5)); } if (StringUtils.isNotEmpty(pageParam.get("vlCityId"))) {// vo.put("vlCityId", pageParam.get("vlCityId")); } if (StringUtils.isNotEmpty(pageParam.get("vlCityName"))) {// ?? vo.put("vlCityName", URLDecoder.decode(pageParam.get("vlCityName"), "UTF-8")); } if (StringUtils.isNotEmpty(pageParam.get("viMileage"))) {// vo.put("viMileage", pageParam.get("viMileage")); } if (StringUtils.isNotEmpty(pageParam.get("viVin"))) {// ? vo.put("viVin", pageParam.get("viVin").toUpperCase()); } if (StringUtils.isNotEmpty(pageParam.get("engineType"))) { // ?? vo.put("engineType", pageParam.get("engineType").toUpperCase()); } // request.getSession().setAttribute("newVehicleModel", vo); this.spyMemcachedClient.set(vehicleModelKey, Constant.MEMCACHED_SAVETIME_24, vo); request.setAttribute("brandName", vo.get("viBrandName")); request.setAttribute("seriesName", vo.get("viSeriesName")); request.setAttribute("sweptVolume", pageParam.get("sweptVolume")); request.setAttribute("carYearName", URLDecoder.decode(pageParam.get("carYearName"), "UTF-8")); request.setAttribute("viId", vo.get("viId")); request.setAttribute("upst", pageParam.get("upst")); } else { // ? logUtil.log(new Throwable(), "CARMODELS", uId, MethodCallResultEnum.EXCEPTION, null, "??", startTime); return "redirect:/car/myCarList"; } // 1???? vehicleTypeListMap = myCarManageService.getVehiclesNow(String.valueOf(vo.get("manufacturer")), String.valueOf(vo.get("viSeriesName"))); List<String> carModelsList = new ArrayList<String>(); if (null != vehicleTypeListMap) { Map<String, Object> vehicleYearMap = vehicleTypeListMap .get(URLDecoder.decode(pageParam.get("sweptVolume"), "UTF-8")); carModelsList = new ArrayList<String>(); if (null != vehicleYearMap) { Map<String, Object> vehicleTypeMap = (Map<String, Object>) vehicleYearMap .get(String.valueOf(URLDecoder.decode(pageParam.get("carYearName"), "UTF-8"))); if (null != vehicleTypeMap) { for (Map.Entry<String, Object> entry : vehicleTypeMap.entrySet()) { carModelsList.add(entry.getKey()); } } } } request.setAttribute("carModelList", carModelsList); request.setAttribute("collapseFlag", pageParam.get("collapseFlag")); } catch (Exception e) { if (logger.isErrorEnabled()) { logger.error("???", e); } logUtil.log(new Throwable(), "CARMODELS", uId, MethodCallResultEnum.EXCEPTION, null, "??", startTime); super.redirectErrorPage("BUSY-ERR", "??", null, null, response); return null; } logUtil.log(new Throwable(), "CARMODELS", uId, MethodCallResultEnum.SUCCESS, null, "???", startTime); return "page/cars/selectCarType"; }
From source file:com.jk.framework.util.FakeRunnable.java
/** * Prints the stack trace.//w w w .ja va 2s . co m */ public static void printStackTrace() { final Throwable t = new Throwable(); final StackTraceElement trace[] = t.getStackTrace(); for (final StackTraceElement element : trace) { System.err.println(element.getClassName() + "." + element.getMethodName()); } }
From source file:mobisocial.musubi.service.AddressBookUpdateHandler.java
public static void importFullAddressBook(Context context) { Log.d(TAG, "doing full import"); SQLiteOpenHelper db = App.getDatabaseSource(context); DatabaseManager dbm = new DatabaseManager(context); IdentitiesManager idm = dbm.getIdentitiesManager(); FeedManager fm = dbm.getFeedManager(); MyAccountManager am = dbm.getMyAccountManager(); long startTime = System.currentTimeMillis(); String musubiAccountType = context.getString(R.string.account_type); long maxDataId = -1; long maxContactId = -1; assert (SYNC_EMAIL); String account_type_selection = getAccountSelectionString(); Cursor c = context.getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data.CONTACT_ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Data._ID, ContactsContract.Data.DATA_VERSION, ContactsContract.Data.DATA1, ContactsContract.Data.MIMETYPE, ContactsContract.RawContacts.ACCOUNT_NAME, ContactsContract.RawContacts.ACCOUNT_TYPE }, "(" + ContactsContract.RawContacts.ACCOUNT_TYPE + "<>'" + musubiAccountType + "'" + ") AND (" + NAME_OR_OTHER_SELECTION + account_type_selection + ")", // All known contacts. null, null);/* w ww . java 2 s . c o m*/ if (c == null) { Log.e(TAG, "no valid cursor", new Throwable()); return; } sAddressBookTotal = c.getCount(); sAddressBookPosition = 0; Log.d(TAG, "Scanning contacts..."); final Map<String, MMyAccount> myAccounts = new HashMap<String, MMyAccount>(); final Pattern emailPattern = getEmailPattern(); final Pattern numberPattern = getNumberPattern(); while (c.moveToNext()) { sAddressBookPosition++; String identityType = c.getString(5); String identityPrincipal = c.getString(4); long contactId = c.getLong(0); long dataId = c.getLong(2); String displayName = c.getString(1); byte[] thumbnail = null; String accountName = c.getString(6); String accountType = c.getString(7); if (accountName == null) { accountName = "null-account-name"; } if (accountType == null) { accountType = "null-account-type"; } String accountKey = accountName + "-" + accountType; MMyAccount myAccount = myAccounts.get(accountKey); if (myAccount == null) { myAccount = lookupOrCreateAccount(dbm, accountName, accountType); prepareAccountWhitelistFeed(am, fm, myAccount); myAccounts.put(accountKey, myAccount); } if (displayName == null || emailPattern.matcher(displayName).matches() || numberPattern.matcher(displayName).matches()) { continue; } IBIdentity ibid = ibIdentityForData(identityType, identityPrincipal); if (ibid == null) { //TODO: better selection //Log.d(TAG, "skipping " + displayName + " // " + identityPrincipal); continue; } Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId); InputStream is = ContactsContract.Contacts.openContactPhotoInputStream(context.getContentResolver(), uri); if (is != null) { //Log.d(TAG, "importing photo for " + displayName); try { thumbnail = IOUtils.toByteArray(is); } catch (IOException e) { thumbnail = null; //Log.e(TAG, "photo thumbnail failed to serialize", e); } finally { try { is.close(); } catch (IOException e) { } } } else { thumbnail = null; } MIdentity ident = addIdentity(context, idm, contactId, displayName, thumbnail, ibid); if (ident != null) { fm.ensureFeedMember(myAccount.feedId_, ident.id_); fm.acceptFeedsFromMember(context, ident.id_); } maxDataId = Math.max(maxDataId, dataId); maxContactId = Math.max(maxContactId, contactId); } c.close(); long timeTaken = System.currentTimeMillis() - startTime; ContactDataVersionManager cdvm = new ContactDataVersionManager(db); cdvm.setMaxDataIdSeen(maxDataId); cdvm.setMaxContactIdSeen(maxContactId); Log.d(TAG, "full import took " + timeTaken / 1000 + " secs"); context.getContentResolver().notifyChange(MusubiService.ADDRESS_BOOK_SCANNED, null); }
From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java
private void syncLinkLayerizer() { logger.info("** " + new Throwable().getStackTrace()[0].getMethodName() + " Start"); if (getUpperNetworkId().isEmpty() || getLowerNetworkId().isEmpty() || getLayerizerNetworkId().isEmpty()) { logger.debug("** Network components either does not exist."); return;/*w w w . j av a 2 s. c om*/ } NetworkInterface upNetworkIf = networkInterfaces().get(getUpperNetworkId()); NetworkInterface lowNetworkIf = networkInterfaces().get(getLowerNetworkId()); NetworkInterface layerizerNetworkIf = networkInterfaces().get(getLayerizerNetworkId()); // Upper.Node -> Layerizer.Node Upper.Port -> Layerizer.Port Map<String, Node> upNodes = upNetworkIf.getNodes(); if (null != upNodes && !upNodes.isEmpty()) { for (Entry<String, Node> nodes : upNodes.entrySet()) { Node node = nodes.getValue(); logger.debug("** put node target={}, nodeid={}", layerizerNetworkIf.getNetworkId(), node.getId()); layerizerNetworkIf.putNode(node); conversionTable().addEntryNode(getUpperNetworkId(), node.getId(), getLayerizerNetworkId(), node.getId()); for (Entry<String, Port> ports : node.getPortMap().entrySet()) { Port port = ports.getValue(); conversionTable().addEntryPort(getUpperNetworkId(), node.getId(), port.getId(), getLayerizerNetworkId(), node.getId(), port.getId()); } } } // Lower.Flow -> Layerizer.Link // Layerizer.Link -> Upper.Link FlowSet lowFlowSet = lowNetworkIf.getFlowSet(); if (null != lowFlowSet && null != lowFlowSet.getFlows() && !lowFlowSet.getFlows().isEmpty()) { for (Entry<String, Flow> entry : lowFlowSet.getFlows().entrySet()) { logger.debug("** put Link target={}, linkid={}", getLayerizerNetworkId(), entry.getValue().getFlowId()); addLinkOfLayerizerFromFlowOfLower(getLayerizerNetworkId(), entry.getValue()); } } }
From source file:cc.flydev.launcher.Workspace.java
/** * Adds the specified child in the specified screen. The position and dimension of * the child are defined by x, y, spanX and spanY. * * @param child The child to add in one of the workspace's screens. * @param screenId The screen in which to add the child. * @param x The X position of the child in the screen's grid. * @param y The Y position of the child in the screen's grid. * @param spanX The number of cells spanned horizontally by the child. * @param spanY The number of cells spanned vertically by the child. * @param insert When true, the child is inserted at the beginning of the children list. * @param computeXYFromRank When true, we use the rank (stored in screenId) to compute * the x and y position in which to place hotseat items. Otherwise * we use the x and y position to compute the rank. *///w w w . j a v a 2s . c o m void addInScreen(View child, long container, long screenId, int x, int y, int spanX, int spanY, boolean insert, boolean computeXYFromRank) { if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) { if (getScreenWithId(screenId) == null) { Log.e(TAG, "Skipping child, screenId " + screenId + " not found"); // DEBUGGING - Print out the stack trace to see where we are adding from new Throwable().printStackTrace(); return; } } if (screenId == EXTRA_EMPTY_SCREEN_ID) { // This should never happen throw new RuntimeException("Screen id should not be EXTRA_EMPTY_SCREEN_ID"); } final CellLayout layout; if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { layout = mLauncher.getHotseat().getLayout(); child.setOnKeyListener(null); // Hide folder title in the hotseat if (child instanceof FolderIcon) { ((FolderIcon) child).setTextVisible(false); } if (computeXYFromRank) { x = mLauncher.getHotseat().getCellXFromOrder((int) screenId); y = mLauncher.getHotseat().getCellYFromOrder((int) screenId); } else { screenId = mLauncher.getHotseat().getOrderInHotseat(x, y); } } else { // Show folder title if not in the hotseat if (child instanceof FolderIcon) { ((FolderIcon) child).setTextVisible(true); } layout = getScreenWithId(screenId); child.setOnKeyListener(new IconKeyEventListener()); } ViewGroup.LayoutParams genericLp = child.getLayoutParams(); CellLayout.LayoutParams lp; if (genericLp == null || !(genericLp instanceof CellLayout.LayoutParams)) { lp = new CellLayout.LayoutParams(x, y, spanX, spanY); } else { lp = (CellLayout.LayoutParams) genericLp; lp.cellX = x; lp.cellY = y; lp.cellHSpan = spanX; lp.cellVSpan = spanY; } if (spanX < 0 && spanY < 0) { lp.isLockedToGrid = false; } // Get the canonical child id to uniquely represent this view in this screen int childId = LauncherModel.getCellLayoutChildId(container, screenId, x, y, spanX, spanY); boolean markCellsAsOccupied = !(child instanceof Folder); if (!layout.addViewToCellLayout(child, insert ? 0 : -1, childId, lp, markCellsAsOccupied)) { // TODO: This branch occurs when the workspace is adding views // outside of the defined grid // maybe we should be deleting these items from the LauncherModel? Launcher.addDumpLog(TAG, "Failed to add to item at (" + lp.cellX + "," + lp.cellY + ") to CellLayout", true); } if (!(child instanceof Folder)) { child.setHapticFeedbackEnabled(false); child.setOnLongClickListener(mLongClickListener); } if (child instanceof DropTarget) { mDragController.addDropTarget((DropTarget) child); } }
From source file:com.example.launcher3.Workspace.java
/** * Adds the specified child in the specified screen. The position and * dimension of the child are defined by x, y, spanX and spanY. * * @param child/*from w w w . j a v a 2s. c o m*/ * The child to add in one of the workspace's screens. * @param screenId * The screen in which to add the child. * @param x * The X position of the child in the screen's grid. * @param y * The Y position of the child in the screen's grid. * @param spanX * The number of cells spanned horizontally by the child. * @param spanY * The number of cells spanned vertically by the child. * @param insert * When true, the child is inserted at the beginning of the * children list. * @param computeXYFromRank * When true, we use the rank (stored in screenId) to compute the * x and y position in which to place hotseat items. Otherwise we * use the x and y position to compute the rank. */ void addInScreen(View child, long container, long screenId, int x, int y, int spanX, int spanY, boolean insert, boolean computeXYFromRank) { if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) { if (getScreenWithId(screenId) == null) { Log.e(TAG, "Skipping child, screenId " + screenId + " not found"); // DEBUGGING - Print out the stack trace to see where we are // adding from new Throwable().printStackTrace(); return; } } if (screenId == EXTRA_EMPTY_SCREEN_ID) { // This should never happen throw new RuntimeException("Screen id should not be EXTRA_EMPTY_SCREEN_ID"); } final CellLayout layout; if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { layout = mLauncher.getHotseat().getLayout(); child.setOnKeyListener(null); // Hide folder title in the hotseat if (child instanceof FolderIcon) { ((FolderIcon) child).setTextVisible(false); } if (computeXYFromRank) { x = mLauncher.getHotseat().getCellXFromOrder((int) screenId); y = mLauncher.getHotseat().getCellYFromOrder((int) screenId); } else { screenId = mLauncher.getHotseat().getOrderInHotseat(x, y); } } else { // Show folder title if not in the hotseat if (child instanceof FolderIcon) { ((FolderIcon) child).setTextVisible(true); } layout = getScreenWithId(screenId); child.setOnKeyListener(new IconKeyEventListener()); } ViewGroup.LayoutParams genericLp = child.getLayoutParams(); CellLayout.LayoutParams lp; if (genericLp == null || !(genericLp instanceof CellLayout.LayoutParams)) { lp = new CellLayout.LayoutParams(x, y, spanX, spanY); } else { lp = (CellLayout.LayoutParams) genericLp; lp.cellX = x; lp.cellY = y; lp.cellHSpan = spanX; lp.cellVSpan = spanY; } if (spanX < 0 && spanY < 0) { lp.isLockedToGrid = false; } // Get the canonical child id to uniquely represent this view in this // screen int childId = LauncherModel.getCellLayoutChildId(container, screenId, x, y, spanX, spanY); boolean markCellsAsOccupied = !(child instanceof Folder); if (!layout.addViewToCellLayout(child, insert ? 0 : -1, childId, lp, markCellsAsOccupied)) { // TODO: This branch occurs when the workspace is adding views // outside of the defined grid // maybe we should be deleting these items from the LauncherModel? Launcher.addDumpLog(TAG, "Failed to add to item at (" + lp.cellX + "," + lp.cellY + ") to CellLayout", true); } if (!(child instanceof Folder)) { child.setHapticFeedbackEnabled(false); child.setOnLongClickListener(mLongClickListener); } if (child instanceof DropTarget) { mDragController.addDropTarget((DropTarget) child); } }