List of usage examples for java.lang UnsupportedOperationException printStackTrace
public void printStackTrace()
From source file:com.cats.version.utils.Utils.java
@SuppressWarnings("unused") private static String getResponseMsg(HttpResponse response) { InputStream input = null;//w w w .j a v a 2 s. c om try { input = response.getEntity().getContent(); ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); int iReadLen = -1; do { byte[] data = new byte[1024]; iReadLen = input.read(data); if (iReadLen != -1) { arrayOutputStream.write(data, 0, iReadLen); } } while (iReadLen != -1); byte[] rspData = arrayOutputStream.toByteArray(); return new String(rspData, IVersionConstant.CHARSET_UTF8); } catch (UnsupportedOperationException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { Utils.closeRes(input); } return null; }
From source file:com.sourcesense.alfresco.opensso.OpenSSOClient.java
public SSOToken tokenFromString(String ticket) { SSOToken token = null;//from w w w. j a v a 2s . com try { token = tokenManager.createSSOToken(ticket); } catch (UnsupportedOperationException e) { e.printStackTrace(); } catch (SSOException e) { e.printStackTrace(); } return token; }
From source file:com.sourcesense.alfresco.opensso.OpenSSOClient.java
public SSOToken tokenFromRequest(HttpServletRequest request) { SSOToken token = null;//from w ww.ja v a2 s . c om try { token = tokenManager.createSSOToken(request); } catch (UnsupportedOperationException e) { e.printStackTrace(); } catch (SSOException e) { e.printStackTrace(); } return token; }
From source file:de.dfki.resc28.serendipity.services.Service.java
@POST @Path("recipes") public Response addRecipe(@QueryParam("uri") String recipeUri) { try {/* ww w. j av a 2 s . co m*/ // load the recipe Model recipeModel = ModelFactory.createDefaultModel(); RDFDataMgr.read(recipeModel, recipeUri, Lang.TURTLE); Server.fGraphStore.createNamedGraph(recipeUri, recipeModel); Model recipesModel = Server.fGraphStore.getDefaultGraph(); recipesModel.add(Server.serendipity, RDFS.member, ResourceFactory.createResource(recipeUri)); Server.fGraphStore.addToDefaultGraph(recipesModel); return Response.created(new URI(recipeUri)).build(); } catch (UnsupportedOperationException e) { e.printStackTrace(); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); return Response.status(Status.BAD_REQUEST).build(); } }
From source file:pl.openrnd.connection.rest.request.Request.java
/** * Cancels the request.//w ww . j a v a 2 s . com * * When request is canceled null response is returned in OnRequestResultListener. */ public void cancel() { mIsCanceled = true; new Thread(new Runnable() { @Override public void run() { try { mHttpUriRequest.abort(); } catch (UnsupportedOperationException exc) { exc.printStackTrace(); } } }).start(); }
From source file:com.cloverstudio.spika.CameraCropActivity.java
private void getImageIntents() { /*//from ww w. j ava 2 s .c o m * if (getIntent().hasExtra("trio")) { _trio = true; _groupId = * getIntent().getStringExtra("groupId"); _planner = * getIntent().getBooleanExtra("planner", false); } else { _trio = * false; _planner = false; _groupId = ""; } */ if (getIntent().getStringExtra("type").equals("gallery")) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); this.startActivityForResult(intent, GALLERY); mIsCamera = false; } else { try { startCamera(); mIsCamera = true; } catch (UnsupportedOperationException ex) { ex.printStackTrace(); Toast.makeText(getBaseContext(), "UnsupportedOperationException", Toast.LENGTH_SHORT).show(); } } if (getIntent().getBooleanExtra("profile", false) == true) { mForProfile = true; } else { mForProfile = false; } if (getIntent().getBooleanExtra("createGroup", false) == true) { mForGroup = true; } else { mForGroup = false; } if (getIntent().getBooleanExtra("groupUpdate", false) == true) { mForGroupUpdate = true; } else { mForGroupUpdate = false; } }
From source file:com.snappy.CameraCropActivity.java
private void getImageIntents() { /*/*from ww w. j a v a2 s . c o m*/ * if (getIntent().hasExtra("trio")) { _trio = true; _groupId = * getIntent().getStringExtra("groupId"); _planner = * getIntent().getBooleanExtra("planner", false); } else { _trio = * false; _planner = false; _groupId = ""; } */ if (getIntent().getStringExtra("type").equals("gallery")) { //this is used to solve the selected path for android 19, kitkat o superior if (Build.VERSION.SDK_INT < 19) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); this.startActivityForResult(intent, GALLERY); } else { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("image/*"); this.startActivityForResult(intent, GALLERY); } mIsCamera = false; } else { try { startCamera(); mIsCamera = true; } catch (UnsupportedOperationException ex) { ex.printStackTrace(); Toast.makeText(getBaseContext(), "UnsupportedOperationException", Toast.LENGTH_SHORT).show(); } } if (getIntent().getBooleanExtra("profile", false) == true) { mForProfile = true; } else { mForProfile = false; } if (getIntent().getBooleanExtra("createGroup", false) == true) { mForGroup = true; } else { mForGroup = false; } if (getIntent().getBooleanExtra("groupUpdate", false) == true) { mForGroupUpdate = true; } else { mForGroupUpdate = false; } }
From source file:org.pentaho.platform.plugin.action.xmla.XMLABaseComponent.java
@Override protected boolean executeAction() { try {/* w w w . j a v a2s.co m*/ scf = SOAPConnectionFactory.newInstance(); mf = MessageFactory.newInstance(); } catch (UnsupportedOperationException e) { e.printStackTrace(); } catch (SOAPException e) { e.printStackTrace(); } String uri = this.getInputStringValue(XMLABaseComponent.URI); String user = this.getInputStringValue(XMLABaseComponent.USER); String password = this.getInputStringValue(XMLABaseComponent.PASSWORD); String catalog = this.getInputStringValue(XMLABaseComponent.CATALOG); String query = this.getInputStringValue(XMLABaseComponent.QUERY); buildURl(uri, user, password); try { setProviderAndDataSource(discoverDS()); return executeQuery(query, catalog); } catch (XMLAException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; }
From source file:com.phonegap.CameraLauncher.java
/** * Called when the camera view exits. //from w w w .j a va2 s . c om * * @param requestCode The request code originally supplied to startActivityForResult(), * allowing you to identify who this result came from. * @param resultCode The integer result code returned by the child activity through its setResult(). * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). */ public void onActivityResult(int requestCode, int resultCode, Intent intent) { // Get src and dest types from request code int srcType = (requestCode / 16) - 1; int destType = (requestCode % 16) - 1; // If CAMERA if (srcType == CAMERA) { // If image available if (resultCode == Activity.RESULT_OK) { try { // Read in bitmap of captured image Bitmap bitmap = android.provider.MediaStore.Images.Media .getBitmap(this.ctx.getContentResolver(), imageUri); // If sending base64 image back if (destType == DATA_URL) { this.processPicture(bitmap); } // If sending filename back else if (destType == FILE_URI) { // Create entry in media store for image // (Don't use insertImage() because it uses default compression setting of 50 - no way to change it) ContentValues values = new ContentValues(); values.put(android.provider.MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); Uri uri = null; try { uri = this.ctx.getContentResolver() .insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); } catch (UnsupportedOperationException e) { System.out.println("Can't write to external media storage."); try { uri = this.ctx.getContentResolver().insert( android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values); } catch (UnsupportedOperationException ex) { System.out.println("Can't write to internal media storage."); this.failPicture("Error capturing image - no media storage found."); return; } } // Add compressed version of captured image to returned media store Uri OutputStream os = this.ctx.getContentResolver().openOutputStream(uri); bitmap.compress(Bitmap.CompressFormat.JPEG, this.mQuality, os); os.close(); // Send Uri back to JavaScript for viewing image this.success(new PluginResult(PluginResult.Status.OK, uri.toString()), this.callbackId); } bitmap.recycle(); bitmap = null; System.gc(); } catch (IOException e) { e.printStackTrace(); this.failPicture("Error capturing image."); } } // If cancelled else if (resultCode == Activity.RESULT_CANCELED) { this.failPicture("Camera cancelled."); } // If something else else { this.failPicture("Did not complete!"); } } // If retrieving photo from library else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) { if (resultCode == Activity.RESULT_OK) { Uri uri = intent.getData(); android.content.ContentResolver resolver = this.ctx.getContentResolver(); // If sending base64 image back if (destType == DATA_URL) { try { Bitmap bitmap = android.graphics.BitmapFactory.decodeStream(resolver.openInputStream(uri)); this.processPicture(bitmap); bitmap.recycle(); bitmap = null; System.gc(); } catch (FileNotFoundException e) { e.printStackTrace(); this.failPicture("Error retrieving image."); } } // If sending filename back else if (destType == FILE_URI) { this.success(new PluginResult(PluginResult.Status.OK, uri.toString()), this.callbackId); } } else if (resultCode == Activity.RESULT_CANCELED) { this.failPicture("Selection cancelled."); } else { this.failPicture("Selection did not complete!"); } } }
From source file:org.skt.runtime.original.Capture.java
/** * Called when the video view exits. /*from w ww . j a v a2 s. com*/ * * @param requestCode The request code originally supplied to startActivityForResult(), * allowing you to identify who this result came from. * @param resultCode The integer result code returned by the child activity through its setResult(). * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). * @throws JSONException */ public void onActivityResult(int requestCode, int resultCode, Intent intent) { // Result received okay if (resultCode == Activity.RESULT_OK) { // An audio clip was requested if (requestCode == CAPTURE_AUDIO) { // Get the uri of the audio clip Uri data = intent.getData(); // create a file object from the uri results.put(createMediaFile(data)); if (results.length() >= limit) { // Send Uri back to JavaScript for listening to audio this.success(new PluginResult(PluginResult.Status.OK, results), this.callbackId); } else { // still need to capture more audio clips captureAudio(); } } else if (requestCode == CAPTURE_IMAGE) { // For some reason if I try to do: // Uri data = intent.getData(); // It crashes in the emulator and on my phone with a null pointer exception // To work around it I had to grab the code from CameraLauncher.java try { // Create an ExifHelper to save the exif data that is lost during compression ExifHelper exif = new ExifHelper(); exif.createInFile(DirectoryManager.getTempDirectoryPath(ctx.getContext()) + "/Capture.jpg"); exif.readExifData(); // Read in bitmap of captured image Bitmap bitmap = android.provider.MediaStore.Images.Media .getBitmap(this.ctx.getContentResolver(), imageUri); // Create entry in media store for image // (Don't use insertImage() because it uses default compression setting of 50 - no way to change it) ContentValues values = new ContentValues(); values.put(android.provider.MediaStore.Images.Media.MIME_TYPE, IMAGE_JPEG); Uri uri = null; try { uri = this.ctx.getContentResolver() .insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); } catch (UnsupportedOperationException e) { LOG.d(LOG_TAG, "Can't write to external media storage."); try { uri = this.ctx.getContentResolver() .insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values); } catch (UnsupportedOperationException ex) { LOG.d(LOG_TAG, "Can't write to internal media storage."); this.fail(createErrorObject(CAPTURE_INTERNAL_ERR, "Error capturing image - no media storage found.")); return; } } // Add compressed version of captured image to returned media store Uri OutputStream os = this.ctx.getContentResolver().openOutputStream(uri); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, os); os.close(); bitmap.recycle(); bitmap = null; System.gc(); // Restore exif data to file exif.createOutFile(FileUtils.getRealPathFromURI(uri, this.ctx)); exif.writeExifData(); // Add image to results results.put(createMediaFile(uri)); if (results.length() >= limit) { // Send Uri back to JavaScript for viewing image this.success(new PluginResult(PluginResult.Status.OK, results), this.callbackId); } else { // still need to capture more images captureImage(); } } catch (IOException e) { e.printStackTrace(); this.fail(createErrorObject(CAPTURE_INTERNAL_ERR, "Error capturing image.")); } } else if (requestCode == CAPTURE_VIDEO) { // Get the uri of the video clip Uri data = intent.getData(); // create a file object from the uri results.put(createMediaFile(data)); if (results.length() >= limit) { // Send Uri back to JavaScript for viewing video this.success(new PluginResult(PluginResult.Status.OK, results), this.callbackId); } else { // still need to capture more video clips captureVideo(duration); } } } // If canceled else if (resultCode == Activity.RESULT_CANCELED) { // If we have partial results send them back to the user if (results.length() > 0) { this.success(new PluginResult(PluginResult.Status.OK, results), this.callbackId); } // user canceled the action else { this.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Canceled.")); } } // If something else else { // If we have partial results send them back to the user if (results.length() > 0) { this.success(new PluginResult(PluginResult.Status.OK, results), this.callbackId); } // something bad happened else { this.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Did not complete!")); } } }