Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-26218] Android: Resolved Veracode string equality warnings. #10208

Merged
merged 3 commits into from Jul 27, 2018

Conversation

jquick-axway
Copy link
Contributor

JIRA:
https://jira.appcelerator.org/browse/TIMOB-26218

Summary:

  • Replaced string reference equality with value equality, as reported by Veracode.

Test:

  1. Build and run the below code on an Android device with a camera.
  2. Tap the "Take Picture" button.
  3. If a dialog requests permission, allow it.
  4. Take a picture with the camera.
  5. When returning from to the app from the camera, verify that app displays the camera shot.
  6. Verify that the log outputs: @@@ Camera image size: <width>x<height>
var window = Ti.UI.createWindow();
var imageView = Ti.UI.createImageView();
window.add(imageView);
var button = Ti.UI.createButton({
	title: "Take Picture",
	bottom: "10dp",
});
button.addEventListener("click", function(e) {
	if (!Ti.Media.hasCameraPermissions()) {
		Ti.Media.requestCameraPermissions(function(e) {
			if (e.success) {
				button.fireEvent("click", {});
			}
		});
	} else if (!Ti.Filesystem.hasStoragePermissions()) {
		Ti.Filesystem.requestStoragePermissions(function(e) {
			if (e.success) {
				button.fireEvent("click", {});
			}
		});
	} else {
		Ti.Media.showCamera({
			mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
			success: function(e) {
				Ti.API.info("@@@ Camera image size: " + e.media.width + "x" + e.media.height);
				imageView.image = e.media;
			},
			cancel: function(e) {
				Ti.API.info("@@@ Camera canceled");
			},
			error: function(e) {
				Ti.API.info("@@@ Camera error: " + e.error);
				imageView.image = null;
			}
		});
	}
});
window.add(button);
window.open();

- Replaced string reference equality with value equality.
Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: PASS

@build
Copy link
Contributor

build commented Jul 27, 2018

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

@hansemannn hansemannn merged commit da0e5c0 into tidev:master Jul 27, 2018
sgtcoolguy pushed a commit that referenced this pull request Jul 27, 2018
…10208)

- Replaced string reference equality with value equality.
@jquick-axway jquick-axway modified the milestones: 7.4.0, 7.5.0 Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants