List of usage examples for java.lang SecurityException printStackTrace
public void printStackTrace()
From source file:org.broeuschmeul.android.gps.usb.provider.driver.USBGpsManager.java
/** * Notifies the reception of a NMEA sentence from the USB GPS to registered NMEA listeners. * * @param nmeaSentence the complete NMEA sentence received from the USB GPS (i.e. $....*XY where XY is the checksum) * @return true if the input string is a valid NMEA sentence, false otherwise. *///from ww w. j a va2s .co m private boolean notifyNmeaSentence(final String nmeaSentence) { boolean res = false; if (enabled) { log("parsing and notifying NMEA sentence: " + nmeaSentence); String sentence = null; try { if (shouldSetTime && !timeSetAlready) { parser.clearLastSentenceTime(); } sentence = parser.parseNmeaSentence(nmeaSentence); if (shouldSetTime && !timeSetAlready) { if (!parser.getLastSentenceTime().isEmpty()) { setSystemTime(parser.getLastSentenceTime()); timeSetAlready = true; } } } catch (SecurityException e) { if (BuildConfig.DEBUG || debug) Log.e(LOG_TAG, "error while parsing NMEA sentence: " + nmeaSentence, e); // a priori Mock Location is disabled sentence = null; disable(R.string.msg_mock_location_disabled); } catch (Exception e) { if (BuildConfig.DEBUG || debug) { Log.e(LOG_TAG, "Sentence not parsable"); Log.e(LOG_TAG, nmeaSentence); } e.printStackTrace(); } final String recognizedSentence = sentence; final long timestamp = System.currentTimeMillis(); if (recognizedSentence != null) { res = true; log("notifying NMEA sentence: " + recognizedSentence); ((USBGpsApplication) appContext).notifyNewSentence(recognizedSentence.replaceAll("(\\r|\\n)", "")); synchronized (nmeaListeners) { for (final NmeaListener listener : nmeaListeners) { notificationPool.execute(new Runnable() { @Override public void run() { listener.onNmeaReceived(timestamp, recognizedSentence); } }); } } } } return res; }
From source file:org.apache.myfaces.custom.skin.GenericSkinRenderer.java
public void encodeGenericWithRequiredComponent(FacesContext context, UIComponent component, SkinRenderingContext arc) throws IOException { log.debug("Component class " + component.getClass().getName()); // 2. the skin class for this component looks like this: // af|javax_faces_component_html_HtmlXXX::class String contentStyleClass = component.getClass().getName(); //Map<String, String> m = arc.getSkin().getStyleClassMap(arc); String baseStyleClass = SkinConstants.DEFAULT_NAMESPACE + StringUtils.replaceChars(contentStyleClass, '.', '_'); Method method;/* w w w. ja v a2 s. c o m*/ // Check it has a getStyleClass property contentStyleClass = null; try { method = component.getClass().getMethod("getStyleClass", (Class[]) null); contentStyleClass = baseStyleClass + SkinConstants.STYLE_CLASS_SUFFIX; } catch (SecurityException e) { // Nothing happends //e.printStackTrace(); } catch (NoSuchMethodException e) { // Nothing happends // e.printStackTrace(); } int otherStyles = 0; // Its necesary to add other style properties like // p_AFReadOnly and p_AFDisabled Map attributes = component.getAttributes(); String styleClass = (String) attributes.get("styleClass"); String disabledStyleClass = null; String readOnlyStyleClass = null; String requiredStyleClass = null; try { method = component.getClass().getMethod("isReadonly", (Class[]) null); if ((Boolean) method.invoke(component, (Object[]) null)) { readOnlyStyleClass = SkinSelectors.STATE_READ_ONLY; otherStyles += 1; } } catch (SecurityException e) { //e.printStackTrace(); } catch (NoSuchMethodException e) { // Nothing happends // e.printStackTrace(); } catch (InvocationTargetException e) { // Nothing happends //e.printStackTrace(); } catch (IllegalAccessException e) { // Nothing happends //e.printStackTrace(); } try { method = component.getClass().getMethod("isDisabled", (Class[]) null); if ((Boolean) method.invoke(component, (Object[]) null)) { disabledStyleClass = SkinSelectors.STATE_DISABLED; otherStyles += 1; } } catch (SecurityException e) { // Nothing happends //e.printStackTrace(); } catch (NoSuchMethodException e) { // Nothing happends // e.printStackTrace(); } catch (InvocationTargetException e) { // Nothing happends e.printStackTrace(); } catch (IllegalAccessException e) { // Nothing happends e.printStackTrace(); } try { method = component.getClass().getMethod("isRequired", (Class[]) null); if ((Boolean) method.invoke(component, (Object[]) null)) { requiredStyleClass = baseStyleClass + "::required"; otherStyles += 1; } } catch (SecurityException e) { //e.printStackTrace(); } catch (NoSuchMethodException e) { // Nothing happends // e.printStackTrace(); } catch (InvocationTargetException e) { // Nothing happends e.printStackTrace(); } catch (IllegalAccessException e) { // Nothing happends e.printStackTrace(); } List<String> parsedStyleClasses = OutputUtils.parseStyleClassList(styleClass); int userStyleClassCount; if (parsedStyleClasses == null) userStyleClassCount = (styleClass == null) ? 0 : 1; else userStyleClassCount = parsedStyleClasses.size(); String[] styleClasses = new String[userStyleClassCount + 4]; int i = 0; if (parsedStyleClasses != null) { while (i < userStyleClassCount) { styleClasses[i] = parsedStyleClasses.get(i); i++; } } else if (styleClass != null) { styleClasses[i++] = styleClass; } styleClasses[i++] = contentStyleClass; styleClasses[i++] = disabledStyleClass; styleClasses[i++] = readOnlyStyleClass; styleClasses[i++] = requiredStyleClass; // 3. set the property styleClass, setting it. if (otherStyles > 0) { _renderStyleClasses(component, context, arc, styleClasses); } else { _renderStyleClass(component, context, arc, contentStyleClass); } }
From source file:org.apache.myfaces.custom.skin.AdapterSkinRenderer.java
public void _addStyleDisabledReadOnlyRequired(FacesContext context, UIComponent component, SkinRenderingContext arc) throws IOException { String contentStyleClass = component.getClass().getName(); //Map<String, String> m = arc.getSkin().getStyleClassMap(arc); String baseStyleClass = this.getBaseStyleName(component); Method method;/*from ww w . j av a2 s .c o m*/ // Check it has a getStyleClass property contentStyleClass = null; try { method = component.getClass().getMethod("getStyleClass", (Class[]) null); contentStyleClass = baseStyleClass + SkinConstants.STYLE_CLASS_SUFFIX; } catch (SecurityException e) { // Nothing happends //e.printStackTrace(); } catch (NoSuchMethodException e) { // Nothing happends // e.printStackTrace(); } int otherStyles = 0; // Its necesary to add other style properties like // p_AFReadOnly and p_AFDisabled Map attributes = component.getAttributes(); String styleClass = (String) attributes.get("styleClass"); String disabledStyleClass = null; String readOnlyStyleClass = null; String requiredStyleClass = null; try { method = component.getClass().getMethod("isReadonly", (Class[]) null); if ((Boolean) method.invoke(component, (Object[]) null)) { readOnlyStyleClass = SkinSelectors.STATE_READ_ONLY; otherStyles += 1; } } catch (SecurityException e) { //e.printStackTrace(); } catch (NoSuchMethodException e) { // Nothing happends // e.printStackTrace(); } catch (InvocationTargetException e) { // Nothing happends //e.printStackTrace(); } catch (IllegalAccessException e) { // Nothing happends //e.printStackTrace(); } try { method = component.getClass().getMethod("isDisabled", (Class[]) null); if ((Boolean) method.invoke(component, (Object[]) null)) { disabledStyleClass = SkinSelectors.STATE_DISABLED; otherStyles += 1; } } catch (SecurityException e) { // Nothing happends //e.printStackTrace(); } catch (NoSuchMethodException e) { // Nothing happends // e.printStackTrace(); } catch (InvocationTargetException e) { // Nothing happends e.printStackTrace(); } catch (IllegalAccessException e) { // Nothing happends e.printStackTrace(); } try { method = component.getClass().getMethod("isRequired", (Class[]) null); if ((Boolean) method.invoke(component, (Object[]) null)) { requiredStyleClass = baseStyleClass + "::required"; otherStyles += 1; } } catch (SecurityException e) { //e.printStackTrace(); } catch (NoSuchMethodException e) { // Nothing happends // e.printStackTrace(); } catch (InvocationTargetException e) { // Nothing happends e.printStackTrace(); } catch (IllegalAccessException e) { // Nothing happends e.printStackTrace(); } List<String> parsedStyleClasses = OutputUtils.parseStyleClassList(styleClass); int userStyleClassCount; if (parsedStyleClasses == null) userStyleClassCount = (styleClass == null) ? 0 : 1; else userStyleClassCount = parsedStyleClasses.size(); String[] styleClasses = new String[userStyleClassCount + 4]; int i = 0; if (parsedStyleClasses != null) { while (i < userStyleClassCount) { styleClasses[i] = parsedStyleClasses.get(i); i++; } } else if (styleClass != null) { styleClasses[i++] = styleClass; } styleClasses[i++] = contentStyleClass; styleClasses[i++] = disabledStyleClass; styleClasses[i++] = readOnlyStyleClass; styleClasses[i++] = requiredStyleClass; // 3. set the property styleClass, setting it. if (otherStyles > 0) { _renderStyleClasses(component, context, arc, styleClasses); } else { _renderStyleClass(component, context, arc, contentStyleClass); } }
From source file:com.apdplat.platform.struts.APDPlatPackageBasedActionConfigBuilder.java
private UrlSet buildUrlSet() throws IOException { ClassLoaderInterface classLoaderInterface = getClassLoaderInterface(); UrlSet urlSet = new UrlSet(classLoaderInterface, this.fileProtocols); //excluding the urls found by the parent class loader is desired, but fails in JBoss (all urls are removed) if (excludeParentClassLoader) { //exclude parent of classloaders ClassLoaderInterface parent = classLoaderInterface.getParent(); //if reload is enabled, we need to step up one level, otherwise the UrlSet will be empty //this happens because the parent of the realoding class loader is the web app classloader if (parent != null && isReloadEnabled()) parent = parent.getParent(); if (parent != null) urlSet = urlSet.exclude(parent); try {//from www .ja va 2s . co m // This may fail in some sandboxes, ie GAE ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); urlSet = urlSet.exclude(new ClassLoaderInterfaceDelegate(systemClassLoader.getParent())); } catch (SecurityException e) { if (LOG.isWarnEnabled()) LOG.warn( "Could not get the system classloader due to security constraints, there may be improper urls left to scan"); } } //try to find classes dirs inside war files urlSet = urlSet.includeClassesUrl(classLoaderInterface); urlSet = urlSet.excludeJavaExtDirs(); urlSet = urlSet.excludeJavaEndorsedDirs(); try { urlSet = urlSet.excludeJavaHome(); } catch (NullPointerException e) { // This happens in GAE since the sandbox contains no java.home directory if (LOG.isWarnEnabled()) LOG.warn("Could not exclude JAVA_HOME, is this a sandbox jvm?"); } urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", "")); urlSet = urlSet.exclude(".*/JavaVM.framework/.*"); if (includeJars == null) { urlSet = urlSet.exclude(".*?\\.jar(!/|/)?"); } else { Set<URL> includeUrls = new HashSet<URL>(); boolean[] patternUsed = new boolean[includeJars.length]; for (int i = 0; i < includeJars.length; i++) { try { String includeJar = includeJars[i]; FileSystemResource resource = new FileSystemResource(FileUtils.getAbsolutePath(includeJar)); includeUrls.add(resource.getURL()); patternUsed[i] = true; } catch (Exception e) { e.printStackTrace(); } } if (LOG.isWarnEnabled()) { for (int i = 0; i < patternUsed.length; i++) { if (!patternUsed[i]) { LOG.warn("The includeJars pattern [#0] did not match any jars in the classpath", includeJars[i]); } } } return new UrlSet(includeUrls); } return urlSet; }
From source file:com.ifoer.expeditionphone.MainActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(Flags.FLAG8, Flags.FLAG8); contexts = this; this.loadSpecail = getIntent().getBooleanExtra("loadSpecail", false); FROMPATH = Constant.assestsPath;//from ww w . j av a 2 s . co m Locale locale = Locale.getDefault(); country = MainMenuActivity.country; if (country == null) { country = locale.getCountry(); } this.lanName = AndroidToLan.toLan(country); this.language = locale.getLanguage(); Constant.language = locale.toString(); if (this.loadSpecail) { setContentView(C0136R.layout.specia_function2); this.SpecialGridView = (GridView) findViewById(C0136R.id.main_WorkSpace); this.SpecialGridView.setHorizontalSpacing(15); this.SpecialGridView.setVerticalSpacing(15); this.SpecialGridView.setSelector(C0136R.color.transparent); this.SpecialGridView.setNumColumns(REQUEST_CIRCLE_ADD_IMAGE); this.mSpecilaBaseDiagAdapeter = createBaseDiagAdapter2(this.specialList); this.SpecialGridView.setAdapter(this.mSpecilaBaseDiagAdapeter); this.SpecialGridView.setOnItemClickListener(this); } else { setContentView(C0136R.layout.base_diagnose); LinearLayout lineLinear = (LinearLayout) findViewById(C0136R.id.diagnose_line2); this.mSlidePoinView = new SlidePointView(this); lineLinear.addView(this.mSlidePoinView); this.mSlidePoinView.postInvalidate(); this.mChinaCarGridView = new GridView(this); this.mAsiaCarGridView = new GridView(this); this.mEuroCarGridView = new GridView(this); this.mAmericaCarGridView = new GridView(this); this.mAmericaCarGridView.setHorizontalSpacing(15); this.mAmericaCarGridView.setVerticalSpacing(15); this.mAsiaCarGridView.setHorizontalSpacing(15); this.mAsiaCarGridView.setVerticalSpacing(15); this.mEuroCarGridView.setHorizontalSpacing(15); this.mEuroCarGridView.setVerticalSpacing(15); this.mAmericaCarGridView.setVerticalScrollBarEnabled(false); this.mAsiaCarGridView.setVerticalScrollBarEnabled(false); this.mEuroCarGridView.setVerticalScrollBarEnabled(false); this.mAsiaCarGridView.setSelector(C0136R.color.transparent); this.mEuroCarGridView.setSelector(C0136R.color.transparent); this.mAmericaCarGridView.setSelector(C0136R.color.transparent); LayoutParams linearParams = new LayoutParams(-2, -2); linearParams.width = C0136R.dimen.itemSize; linearParams.height = C0136R.dimen.itemSize; this.mChinaCarGridView.setLayoutParams(linearParams); this.mAsiaCarGridView.setLayoutParams(linearParams); this.mEuroCarGridView.setLayoutParams(linearParams); this.mAmericaCarGridView.setLayoutParams(linearParams); this.mChinaCarGridView.setNumColumns(REQUEST_CIRCLE_ADD_IMAGE); this.mAsiaCarGridView.setNumColumns(REQUEST_CIRCLE_ADD_IMAGE); this.mEuroCarGridView.setNumColumns(REQUEST_CIRCLE_ADD_IMAGE); this.mAmericaCarGridView.setNumColumns(REQUEST_CIRCLE_ADD_IMAGE); } MyApplication.getInstance().addActivity(this); createMainActivity(); MySharedPreferences.getSharedPref(this).edit().putString("CurrentPosition", Constant.language).commit(); MySharedPreferences.setString(contexts, MySharedPreferences.generateOperatingRecord, Contact.RELATION_ASK); if (MainMenuActivity.database != null) { database = MainMenuActivity.database; } else { database = DBDao.getInstance(this).getConnection(); } new Thread(new UpgradeRunnable(contexts)).start(); registerBoradcastReceiver(); try { dataDir = getPackageManager().getApplicationInfo(getPackageName(), 0).dataDir; } catch (NameNotFoundException e) { e.printStackTrace(); } try { serialPort = new SerialPortManager().getSerialPort(); } catch (InvalidParameterException e2) { e2.printStackTrace(); } catch (SecurityException e3) { e3.printStackTrace(); } catch (Exception e4) { e4.printStackTrace(); } if (MySharedPreferences.share == null) { MySharedPreferences.getSharedPref(this); } }
From source file:androidmapsdefinitivo.android.bajaintec.com.androidmapsdefinitivo.MapsActivity.java
@Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap;/*from w w w . ja v a 2s . c o m*/ try { locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location == null) { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, (LocationListener) this); location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location == null) { Log.d("Falla de gps: ", "valio"); location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } } CameraUpdate center = CameraUpdateFactory .newLatLng(new LatLng(location.getLatitude(), location.getLongitude())); /* CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(32.595085, -115.482046)); */ //CameraUpdate zoom = CameraUpdateFactory.zoomTo(20); mMap.moveCamera(center); //mMap.animateCamera(zoom); point = new LatLng(location.getAltitude(), location.getLongitude()); getLines(location.getAltitude(), location.getLongitude()); //getLines(); mMap.setMyLocationEnabled(true); mMap.getUiSettings().setZoomControlsEnabled(false); } catch (SecurityException e) { System.exit(0); } catch (NullPointerException e) { System.exit(0); } final Snackbar snackStart = Snackbar.make(findViewById(R.id.map), "Selecciona una ruta de una calle", Snackbar.LENGTH_LONG); snackStart.show(); final Snackbar snackErr = Snackbar.make(findViewById(R.id.map), "Selecciona una sola calle", Snackbar.LENGTH_LONG); final Snackbar snackbar = Snackbar.make(findViewById(R.id.map), R.string.guardar_ruta, Snackbar.LENGTH_LONG); mBtnGuardar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MapsActivity.this, SeguridadActivity.class); intent.putExtra("calle", calleDestino); intent.putExtra("origen_n", String.valueOf(markerPoints.get(0).latitude)); intent.putExtra("origen_w", String.valueOf(markerPoints.get(0).longitude)); intent.putExtra("destino_n", String.valueOf(markerPoints.get(1).latitude)); intent.putExtra("destino_w", String.valueOf(markerPoints.get(1).longitude)); intent.putExtra("idUsuario", getIntent().getIntExtra("idUsuario", 0)); startActivity(intent); } }); mMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition cameraPosition) { LatLng li = cameraPosition.target; LatLngBounds bounds = mMap.getProjection().getVisibleRegion().latLngBounds; if (!bounds.contains(point)) { try { point = null; point = new LatLng(li.latitude, li.longitude); System.out.println("Sali"); getLines(point.latitude, point.longitude); //getLines(); } catch (SecurityException e) { e.printStackTrace(); } } } }); mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() { @Override public void onMapClick(LatLng point) { if (markerPoints.size() > 1) { markerPoints.clear(); mMap.clear(); mBtnGuardar.setEnabled(false); //snackbar.dismiss(); getLines(); //getLines(point.latitude,point.longitude); } markerPoints.add(point); /* try { Geocoder gc = new Geocoder(getBaseContext(), Locale.getDefault()); List<Address> addresses = gc.getFromLocation(point.latitude, point.longitude, 1); //Obtener nombres de las calles. if (markerPoints.size() == 1) { calleOrigen = addresses.get(0).getAddressLine(0); } else if (markerPoints.size() == 2) { calleDestino = addresses.get(0).getAddressLine(0); } } catch (IOException e) { e.printStackTrace(); }*/ MarkerOptions options = new MarkerOptions(); options.position(point); if (markerPoints.size() == 1) { options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)); } else if (markerPoints.size() == 2) { options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)); if (!calleOrigen.equalsIgnoreCase(calleDestino)) { Log.d("Calles: ", calleOrigen + "//" + calleDestino); Boolean msj = !calleOrigen.equalsIgnoreCase(calleDestino); Log.d("Calles: ", msj.toString()); markerPoints.clear(); mMap.clear(); //getLines(point.latitude,point.longitude); getLines(); snackErr.show(); return; } } mMap.addMarker(options); if (markerPoints.size() >= 2) { LatLng origin = markerPoints.get(0); LatLng dest = markerPoints.get(1); String url = getDirectionsUrl(origin, dest); DownloadTask downloadTask = new DownloadTask(); downloadTask.execute(url); snackbar.show(); mBtnGuardar.setEnabled(true); } } }); //getLines(); getLines(point.latitude, point.longitude); }
From source file:com.nbplus.iotlib.IoTInterface.java
/** * Method used for binding with the service *///from w w w . j a va 2 s . c om private boolean bindService() { /* * Note that this is an implicit Intent that must be defined in the * Android Manifest. */ Intent i = null; if (IoTConstants.USE_ANOTHER_APP) { i = new Intent(); i.setClassName(REMOTE_IOT_SERVICE_PACKAGE, REMOTE_IOT_SERVICE_CLASS); i.setAction(REMOTE_IOT_SERVICE_ACTION); } else { i = new Intent(mCtx, IoTService.class); i.setAction(REMOTE_IOT_SERVICE_ACTION); } try { if (mCtx.getApplicationContext().bindService(i, mConnection, Context.BIND_AUTO_CREATE)) { return true; } } catch (SecurityException e) { e.printStackTrace(); Log.e(TAG, "Not allowed to bind to service Intent"); } mServiceStatus = IoTServiceStatus.NONE; return false; }
From source file:com.sos.JSHelper.Options.JSOptionsClass.java
private String getOptionValue(final Class c, final String pstrOptionName) { @SuppressWarnings("unused") final String conMethodName = conClassName + "::getOptionValue"; String strValue = null;//from w ww . j a va 2s. com Field objField = null; try { objField = c.getField(pstrOptionName); Object objO = objField.get(this); if (objO instanceof String) { strValue = (String) objField.get(this); } else { if (objO instanceof SOSOptionElement) { SOSOptionElement objDE = (SOSOptionElement) objO; strValue = objDE.Value(); } } } // try catch (final NoSuchFieldException objException) { Method objMethod; try { /** * Die Methode, die gesucht wird, hat keine Parameter, weil * diese ein "getter" ist. * Deshalb in "getMethod" als zweites Argument "null", andernfalls * erwischt die JVM eine andere Methode (zum Beispiel den "setter"). */ objMethod = c.getMethod(pstrOptionName, null); /** * ein "getter" hat keine Parameter, deshalb auch hier wieder * als zweites Argument "null" angeben. */ strValue = (String) objMethod.invoke(this, null); } catch (final SecurityException exception) { exception.printStackTrace(); } catch (final NoSuchMethodException exception) { // c = super.getClass(); // try { // objMethod = c.getMethod(strOptionName, null); // strValue = (String) objMethod.invoke(this, null); // } // try // catch (Exception objExc) { // objExc.printStackTrace(); // } // finally { // // // } // finally } catch (final IllegalArgumentException exception) { exception.printStackTrace(); } catch (final InvocationTargetException exception) { exception.printStackTrace(); } catch (final IllegalAccessException exception) { exception.printStackTrace(); } } catch (final IllegalAccessException exception) { exception.printStackTrace(); } return strValue; }
From source file:org.jbuilt.componentTree.jsf.AbstractJsfComponentTreeBuilder.java
@SuppressWarnings("unchecked") public UIInput inputSecret(Object... args) { UIInput inputSecret = new HtmlInputSecret(); System.out.print("inputSecret"); incrementIndent();//from ww w . j a v a 2 s . c o m System.out.println(" "); for (Object arg : args) { if (arg instanceof ComponentAttribute) { ((UIComponent) inputSecret).getAttributes().put(((ComponentAttribute<String, Object>) arg).getKey(), ((ComponentAttribute<String, Object>) arg).getValue()); } else if (arg instanceof UIComponent) { if (((UIInput) arg).getFacet((String) ((UIComponent) arg).getAttributes().get("name")) == null) { (inputSecret).getChildren().add((UIComponent) arg); } else { ((inputSecret).getFacets()).put((String) ((UIInput) arg).getAttributes().get("name"), (UIComponent) arg); } } else if (arg instanceof Converter) { try { if (inputSecret.getClass().getDeclaredMethod("setConverter", inputSecret.getClass()) != null) { inputSecret.getClass().getDeclaredMethod("setConverter", inputSecret.getClass()) .invoke(inputSecret, (Converter) arg); } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } else if (arg instanceof Validator) { try { if (inputSecret.getClass().getDeclaredMethod("addValidator", inputSecret.getClass()) != null) { inputSecret.getClass().getDeclaredMethod("addValidator", inputSecret.getClass()) .invoke(inputSecret, (Validator) arg); } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } decrementIndent(); System.out.print("end_inputSecret\n"); return inputSecret; }
From source file:org.jbuilt.componentTree.jsf.AbstractJsfComponentTreeBuilder.java
@SuppressWarnings("unchecked") public UIInput inputHidden(Object... args) { UIInput inputHidden = new HtmlInputHidden(); System.out.print("inputHidden"); incrementIndent();/*from w w w . jav a 2 s .c o m*/ System.out.println(" "); for (Object arg : args) { if (arg instanceof ComponentAttribute) { ((UIComponent) inputHidden).getAttributes().put(((ComponentAttribute<String, Object>) arg).getKey(), ((ComponentAttribute<String, Object>) arg).getValue()); } else if (arg instanceof UIComponent) { if (((UIInput) arg).getFacet((String) ((UIComponent) arg).getAttributes().get("name")) == null) { (inputHidden).getChildren().add((UIComponent) arg); } else { ((inputHidden).getFacets()).put((String) ((UIInput) arg).getAttributes().get("name"), (UIComponent) arg); } } else if (arg instanceof Converter) { try { if (inputHidden.getClass().getDeclaredMethod("setConverter", inputHidden.getClass()) != null) { inputHidden.getClass().getDeclaredMethod("setConverter", inputHidden.getClass()) .invoke(inputHidden, (Converter) arg); } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } else if (arg instanceof Validator) { try { if (inputHidden.getClass().getDeclaredMethod("addValidator", inputHidden.getClass()) != null) { inputHidden.getClass().getDeclaredMethod("addValidator", inputHidden.getClass()) .invoke(inputHidden, (Validator) arg); } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } decrementIndent(); System.out.print("end_inputHidden\n"); return inputHidden; }