List of usage examples for java.lang IllegalArgumentException printStackTrace
public void printStackTrace()
From source file:com.signalcollect.sna.visualization.SignalCollectSNATopComponent.java
/** * Runs a Signal/Collect SNA method when the "Run" button is clicked * * @param evt//from ww w . j a va2 s. c o m */ private void runMetricButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runMetricButtonActionPerformed try { mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (jTextArea1.getText() == null) { throw new IllegalArgumentException("No file was chosen!\nPlease choose a valid .gml file"); } if (!jTextArea1.getText().contains(".gml")) { throw new IllegalArgumentException( "The chosen file doesn't have the right format!\nPlease choose a valid .gml file"); } String actualMetric = metricDropDown.getSelectedItem().toString(); if (actualMetric.equals("Degree")) { scgc = new DegreeSignalCollectGephiConnectorImpl(fileName); scgc.executeGraph(); metricValuesTextPane.setText(setMetricText(scgc.getAverage(), scgc.getAll())); } else if (actualMetric.equals("PageRank")) { scgc = new PageRankSignalCollectGephiConnectorImpl(fileName); scgc.executeGraph(); metricValuesTextPane.setText(setMetricText(scgc.getAverage(), scgc.getAll())); } else if (actualMetric.equals("Betweenness")) { scgc = new BetweennessSignalCollectGephiConnectorImpl(fileName); scgc.executeGraph(); metricValuesTextPane.setText(setMetricText(scgc.getAverage(), scgc.getAll())); } else if (actualMetric.equals("Closeness")) { scgc = new ClosenessSignalCollectGephiConnectorImpl(fileName); scgc.executeGraph(); metricValuesTextPane.setText(setMetricText(scgc.getAverage(), scgc.getAll())); } else if (actualMetric.equals("Local Cluster Coefficient")) { scgc = new LocalClusterCoefficientSignalCollectGephiConnectorImpl(fileName); scgc.executeGraph(); metricValuesTextPane.setText(setMetricText(scgc.getAverage(), scgc.getAll())); } else if (actualMetric.equals("Triad Census")) { scgc = new TriadCensusSignalCollectGephiConnectorImpl(fileName); scgc.executeGraph(); metricValuesTextPane.setText(setTriadCensusText(scgc.getAll())); } else { throw new IllegalArgumentException("invalid Signal/Collect metric chosen!\nPlease try again"); } Dimension dim = new Dimension(750, 450); metricResultFrame.setMinimumSize(dim); metricResultFrame.pack(); metricValuesTextPane.setVisible(true); metricValuesScrollPane.setVisible(true); metricResultFrame.setVisible(true); } catch (IllegalArgumentException exception) { messageFrame = new JFrame(); JOptionPane.showMessageDialog(messageFrame, exception.getMessage(), "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } catch (Exception exception) { messageFrame = new JFrame(); exception.printStackTrace(); JOptionPane.showMessageDialog(messageFrame, "Technical exception happened (" + exception.getCause() + ")", "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } finally { mainPanel.setCursor(Cursor.getDefaultCursor()); } }
From source file:com.signalcollect.sna.visualization.SignalCollectSNATopComponent.java
/** * Executes the label propagation algorithm * * @param evt//from www .j a v a2 s . com */ private void labelPropagationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_labelPropagationButtonActionPerformed try { mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (jTextPane1.getText() == null) { throw new IllegalArgumentException("No input found!"); } if (Integer.parseInt(jTextPane1.getText()) < 1) { throw new IllegalArgumentException("The number has to be greater than 0"); } scgc = new LabelPropagationSignalCollectGephiConnectorImpl(fileName, scala.Option.apply(Integer.parseInt(jTextPane1.getText()))); scgc.getLabelPropagation(); } catch (IllegalArgumentException exception) { JOptionPane.showMessageDialog(messageFrame, "Error when parsing input " + jTextPane1.getText() + ": " + exception.getMessage(), "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } catch (Exception exception) { messageFrame = new JFrame(); exception.printStackTrace(); JOptionPane.showMessageDialog(messageFrame, "Technical exception happened (" + exception.getCause() + ")", "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } finally { scgc = null; mainPanel.setCursor(Cursor.getDefaultCursor()); } }
From source file:org.apache.ranger.service.XResourceService.java
public List<XXTrxLog> getTransactionLog(VXResource vObj, XXResource mObj, String action) { if (vObj == null || action == null || (action.equalsIgnoreCase("update") && mObj == null)) { return null; }//from ww w. j a va 2 s .c o m XXAsset xAsset = rangerDaoManager.getXXAsset().getById(vObj.getAssetId()); String parentObjectName = xAsset.getName(); List<XXTrxLog> trxLogList = new ArrayList<XXTrxLog>(); Field[] fields = vObj.getClass().getDeclaredFields(); Field nameField; try { nameField = vObj.getClass().getDeclaredField("name"); nameField.setAccessible(true); String objectName = "" + nameField.get(vObj); for (Field field : fields) { field.setAccessible(true); String fieldName = field.getName(); if (!trxLogAttrs.containsKey(fieldName)) { continue; } int policyType = vObj.getAssetType(); if (policyType == AppConstants.ASSET_HDFS) { String[] ignoredAttribs = { "tableType", "columnType", "isEncrypt", "databases", "tables", "columnFamilies", "columns", "udfs" }; if (ArrayUtils.contains(ignoredAttribs, fieldName)) { continue; } } else if (policyType == AppConstants.ASSET_HIVE) { String[] ignoredAttribs = { "name", "isRecursive", "isEncrypt", "columnFamilies" }; if (ArrayUtils.contains(ignoredAttribs, fieldName)) { continue; } } else if (policyType == AppConstants.ASSET_HBASE) { String[] ignoredAttribs = { "name", "tableType", "columnType", "isRecursive", "databases", "udfs" }; if (ArrayUtils.contains(ignoredAttribs, fieldName)) { continue; } } else if (policyType == AppConstants.ASSET_KNOX || policyType == AppConstants.ASSET_STORM) { String[] ignoredAttribs = { "name", "tableType", "columnType", "isEncrypt", "databases", "tables", "columnFamilies", "columns", "udfs" }; if (ArrayUtils.contains(ignoredAttribs, fieldName)) { continue; } } VTrxLogAttr vTrxLogAttr = trxLogAttrs.get(fieldName); XXTrxLog xTrxLog = new XXTrxLog(); xTrxLog.setAttributeName(vTrxLogAttr.getAttribUserFriendlyName()); String value = null; boolean isEnum = vTrxLogAttr.isEnum(); if (isEnum) { String enumName = XXResource.getEnumName(fieldName); if (enumName == null && fieldName.equals("assetType")) { enumName = "CommonEnums.AssetType"; } int enumValue = field.get(vObj) == null ? 0 : Integer.parseInt("" + field.get(vObj)); value = xaEnumUtil.getLabel(enumName, enumValue); } else { value = "" + field.get(vObj); if (value == null || value.equalsIgnoreCase("null")) { continue; } } if (action.equalsIgnoreCase("create")) { if (stringUtil.isEmpty(value)) { continue; } xTrxLog.setNewValue(value); } else if (action.equalsIgnoreCase("delete")) { xTrxLog.setPreviousValue(value); } else if (action.equalsIgnoreCase("update")) { String oldValue = null; Field[] mFields = mObj.getClass().getDeclaredFields(); for (Field mField : mFields) { mField.setAccessible(true); String mFieldName = mField.getName(); if (fieldName.equalsIgnoreCase(mFieldName)) { if (isEnum) { String enumName = XXResource.getEnumName(mFieldName); if (enumName == null && mFieldName.equals("assetType")) { enumName = "CommonEnums.AssetType"; } int enumValue = mField.get(mObj) == null ? 0 : Integer.parseInt("" + mField.get(mObj)); oldValue = xaEnumUtil.getLabel(enumName, enumValue); } else { oldValue = mField.get(mObj) + ""; } break; } } if (value.equalsIgnoreCase(oldValue) && !fieldName.equals("policyName")) { continue; } xTrxLog.setPreviousValue(oldValue); xTrxLog.setNewValue(value); } xTrxLog.setAction(action); xTrxLog.setObjectClassType(AppConstants.CLASS_TYPE_XA_RESOURCE); xTrxLog.setObjectId(vObj.getId()); xTrxLog.setParentObjectClassType(AppConstants.CLASS_TYPE_XA_ASSET); xTrxLog.setParentObjectId(vObj.getAssetId()); xTrxLog.setParentObjectName(parentObjectName); xTrxLog.setObjectName(objectName); trxLogList.add(xTrxLog); } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } if (trxLogList.size() == 0) { XXTrxLog xTrxLog = new XXTrxLog(); xTrxLog.setAction(action); xTrxLog.setObjectClassType(AppConstants.CLASS_TYPE_XA_RESOURCE); xTrxLog.setObjectId(vObj.getId()); xTrxLog.setObjectName(vObj.getName()); xTrxLog.setParentObjectClassType(AppConstants.CLASS_TYPE_XA_ASSET); xTrxLog.setParentObjectId(vObj.getAssetId()); xTrxLog.setParentObjectName(parentObjectName); trxLogList.add(xTrxLog); } return trxLogList; }
From source file:com.example.mydemos.view.RingtonePickerActivity.java
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) { Log.e("lys", "onItemClick position ==" + position + "id" + id); if (id == -1) { if (mHasSilentItem) { if ((mHasDefaultItem && (position == 1)) || !mHasDefaultItem) { Log.e("lys", "onItemClick silentItemChecked == true"); //toneCur.moveToPosition(position); mSelectedId = SILENT_ID; mSelectedUri = null;/*from ww w .jav a2 s . c o m*/ silentItemChecked = true; defaultItemChecked = false; stopMediaPlayer(); listView.invalidateViews(); return; } else if (mHasDefaultItem && (position == 0)) { Log.e("lys", "onItemClick defaultItemChecked == true"); //toneCur.moveToPosition(position); mSelectedId = DEFAULT_ID; mSelectedUri = mUriForDefaultItem; defaultItemChecked = true; silentItemChecked = false; } } else { if (mHasDefaultItem) { Log.e("lys", "onItemClick defaultItemChecked == true"); //toneCur.moveToPosition(position); mSelectedId = DEFAULT_ID; mSelectedUri = mUriForDefaultItem; defaultItemChecked = true; silentItemChecked = false; } } } else { if (mHasSilentItem) { silentItemChecked = false; position--; } if (mHasDefaultItem) { defaultItemChecked = false; position--; } } if (id != -1) { toneCur.moveToPosition(position); Log.e("lys", "onItemClick position == " + position + "id ==" + id); long newId = toneCur.getLong(toneCur.getColumnIndex(MediaStore.Audio.Media._ID)); mSelectedId = newId; Log.e("lys", " onItemClick mSelectedId==" + mSelectedId); //wuqingliang modify begin20130307 if (tabName == SYSTEM_TONE) { BaseUri = MediaStore.Audio.Media.INTERNAL_CONTENT_URI; Log.e("lys", "BaseUri = MediaStore.Audio.Media.INTERNAL_CONTENT_URI;111111"); } else { BaseUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Log.e("lys", "BaseUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;1111111"); } //wuqingliang modify end mSelectedUri = ContentUris.withAppendedId(BaseUri, newId); } listView.invalidateViews(); audioManager.requestAudioFocus(mAudioFocusListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); stopMediaPlayer(); mMediaPlayer = new MediaPlayer(); try { if (toneType == ALARM_TYPE) mMediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); else mMediaPlayer.setAudioStreamType(AudioManager.STREAM_RING); mMediaPlayer.setDataSource(RingtonePickerActivity.this, mSelectedUri); mMediaPlayer.prepare(); mMediaPlayer.start(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:com.www.avtovokzal.org.MainActivity.java
private void queryDialogDismiss() { try {/*from w w w. j a v a2 s .com*/ if (queryDialog != null && queryDialog.isShowing()) { queryDialog.dismiss(); } } catch (IllegalArgumentException e) { e.printStackTrace(); } finally { queryDialog = null; } }
From source file:com.corebase.android.framework.http.client.AsyncHttpClient.java
/** * Perform a HTTP GET request and track the Android Context which initiated * the request./*from www . ja va 2s . c o m*/ * * @param context * the Android Context which initiated the request. * @param url * the URL to send the request to. * @param params * additional GET parameters to send with the request. * @param responseHandler * the response handler instance that should handle the response. */ public void get(Context context, String url, RequestParams params, CacheParams cacheParams, AsyncHttpResponseHandler responseHandler) { HttpUriRequest request = null; if (null == url || "".equals(url)) return; try { request = new HttpGet(getUrlWithQueryString(url, params)); } catch (IllegalArgumentException e) { responseHandler.sendFailureMessage(context, e, "uri is invalid"); e.printStackTrace(); return; } setTimeout(socketTimeout); sendRequest(httpClient, httpContext, request, null, cacheParams, responseHandler, context); }
From source file:com.corebase.android.framework.http.client.AsyncHttpClient.java
/** * post/*from ww w . j av a 2 s . c o m*/ * * @param context * @param url * @param params * @param cacheParams * @param responseHandler */ public void post(Context context, String url, RequestParams params, CacheParams cacheParams, AsyncHttpResponseHandler responseHandler) { HttpPost request = null; if (null == url || "".equals(url)) return; try { request = new HttpPost(url); } catch (IllegalArgumentException e) { responseHandler.sendFailureMessage(context, e, "uri is invalid"); e.printStackTrace(); return; } setTimeout(socketTimeout); sendRequest(httpClient, httpContext, request, null, cacheParams, responseHandler, context); }
From source file:com.corebase.android.framework.http.client.AsyncHttpClient.java
/** * ???//from w ww. j a va 2s.c o m * * @param context * @param url * @param params * @param cacheParams * @param responseHandler * @param isGetDataBase */ public void getByDateBase(Context context, String url, RequestParams params, CacheParams cacheParams, AsyncHttpResponseHandler responseHandler, boolean isGetDataBase) { HttpUriRequest request = null; if (null == url || "".equals(url)) return; try { request = new HttpGet(getUrlWithQueryString(url, params)); } catch (IllegalArgumentException e) { responseHandler.sendFailureMessage(context, e, "uri is invalid"); e.printStackTrace(); return; } setTimeout(socketTimeout); sendRequestByDateBase(httpClient, httpContext, request, null, cacheParams, responseHandler, context, isGetDataBase); }
From source file:com.corebase.android.framework.http.client.AsyncHttpClient.java
/** * Perform a HTTP POST request and track the Android Context which initiated * the request./* www . j a v a2 s.c o m*/ * * @param context * the Android Context which initiated the request. * @param url * the URL to send the request to. * @param entity * a raw {@link HttpEntity} to send with the request, for * example, use this to send string/json/xml payloads to a server * by passing a {@link org.apache.http.entity.StringEntity}. * @param contentType * the content type of the payload you are sending, for example * application/json if sending a json payload. * @param responseHandler * the response handler instance that should handle the response. */ public void post(Context context, String url, HttpEntity entity, String contentType, AsyncHttpResponseHandler responseHandler) { HttpPost httpPost; if (null == url || "".equals(url)) return; try { httpPost = new HttpPost(url); } catch (IllegalArgumentException e) { responseHandler.sendFailureMessage(context, e, "uri is invalid"); e.printStackTrace(); return; } setTimeout(socketTimeout); sendRequest(httpClient, httpContext, addEntityToRequestBase(httpPost, entity), contentType, null, responseHandler, context); }
From source file:com.corebase.android.framework.http.client.AsyncHttpClient.java
/** * Perform a HTTP POST request and track the Android Context which initiated * the request. Set headers only for this request * /*from w ww .jav a2 s . com*/ * @param context * the Android Context which initiated the request. * @param url * the URL to send the request to. * @param headers * set headers only for this request * @param entity * a raw {@link HttpEntity} to send with the request, for * example, use this to send string/json/xml payloads to a server * by passing a {@link org.apache.http.entity.StringEntity}. * @param contentType * the content type of the payload you are sending, for example * application/json if sending a json payload. * @param responseHandler * the response handler instance that should handle the response. */ public void post(Context context, String url, Header[] headers, HttpEntity entity, String contentType, AsyncHttpResponseHandler responseHandler) { HttpEntityEnclosingRequestBase req; if (null == url || "".equals(url)) return; try { req = new HttpPost(url); } catch (IllegalArgumentException e) { responseHandler.sendFailureMessage(null, e, "uri is invalid"); e.printStackTrace(); return; } if (null == url || "".equals(url)) return; HttpEntityEnclosingRequestBase request = addEntityToRequestBase(req, entity); if (headers != null) request.setHeaders(headers); setTimeout(socketTimeout); sendRequest(httpClient, httpContext, request, contentType, null, responseHandler, context); }