Skip to content

Conversation

Asej
Copy link
Contributor

@Asej Asej commented Jun 18, 2019

Added the preliminary steps to complete images Part 2
Issue:#34
PR:#80

Copy link
Contributor

@FluffySheep FluffySheep left a comment

Choose a reason for hiding this comment

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

Don't forget to run the java formatter!

for (BlobKey blobK : blobKeys) {
ServingUrlOptions options = ServingUrlOptions.Builder.withBlobKey(blobK);
try {
// getting the image URL to the uploaded file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Capitalize the first letter of your comments.

// Getting the image URL to the uploaded file

System.out.printf("[%s] seems to be an image, url is %s%n", blobK, imageUrl);
imageBlobUrls.add(imageUrl);
} catch (java.lang.IllegalArgumentException exception) {
// not image file -> do not add to list, remove from Blobstore
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto here

// not image file -> do not add to list, remove from Blobstore
System.out.printf("[%s] IllegalArgumentException: %s%n", blobK, exception.getMessage());
try {
System.out.printf("I am deleting this thing I don't believe is an image: [%s]%n", blobK);
Copy link
Contributor

Choose a reason for hiding this comment

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

Logs should use Logger and not System.out.printf. See https://cloud.google.com/appengine/docs/standard/java/logs/

imageBlobUrls.add(imageUrl);
} catch (java.lang.IllegalArgumentException exception) {
// not image file -> do not add to list, remove from Blobstore
System.out.printf("[%s] IllegalArgumentException: %s%n", blobK, exception.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

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

Logs should use Logger and not System.out.printf. See https://cloud.google.com/appengine/docs/standard/java/logs/

try {
// getting the image URL to the uploaded file
String imageUrl = imagesService.getServingUrl(options);
System.out.printf("[%s] seems to be an image, url is %s%n", blobK, imageUrl);
Copy link
Contributor

Choose a reason for hiding this comment

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

Logs should use Logger and not System.out.printf. See https://cloud.google.com/appengine/docs/standard/java/logs/

System.out.printf("[%s] seems to be an image, url is %s%n", blobK, imageUrl);
imageBlobUrls.add(imageUrl);
} catch (java.lang.IllegalArgumentException exception) {
// not image file -> do not add to list, remove from Blobstore
Copy link
Contributor

Choose a reason for hiding this comment

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

capitalize first letter of comment.

// User submitted form without selecting a file, so we can't get a URL.
// (devserver)
if (blobKeys == null || blobKeys.isEmpty()) {
System.out.printf(
Copy link
Contributor

Choose a reason for hiding this comment

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

Logs should use Logger and not System.out.printf. See https://cloud.google.com/appengine/docs/standard/java/logs/

// not image file -> do not add to list, remove from Blobstore
System.out.printf("[%s] IllegalArgumentException: %s%n", blobK, exception.getMessage());
try {
System.out.printf("I am deleting this thing I don't believe is an image: [%s]%n", blobK);
Copy link
Contributor

Choose a reason for hiding this comment

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

Logs should use Logger and not System.out.printf. See https://cloud.google.com/appengine/docs/standard/java/logs/

System.out.printf("I am deleting this thing I don't believe is an image: [%s]%n", blobK);
blobstoreService.delete(blobK);
} catch (Exception e) {
System.out.printf("exception when deleting: %s%n", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Logs should use Logger and not System.out.printf. See https://cloud.google.com/appengine/docs/standard/java/logs/

response.sendRedirect("/user-page.html?user=" + user);
}

/** should send a get request to display img in url. */
Copy link
Contributor

Choose a reason for hiding this comment

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

Change comment to:
/** Sends a get request to display image in URL. */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants