Skip to content

Commit

Permalink
Merge branch 'master' into new
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqing-nic authored Oct 16, 2018
2 parents ab25e74 + 6415360 commit 6c954eb
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/java/seedu/address/model/person/Photo.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public Photo(String filePath, String newPhoto) throws IllegalValueException {
/**
* Make a photo
*/

private void makePhoto(String filePath, String newPhoto) {

makePhotoFolder();
Expand All @@ -66,11 +66,10 @@ private void makePhoto(String filePath, String newPhoto) {

//create file object
File pictureFinal = new File(FOLDER + "//" + newPhoto);

//if cannot get file object create an empty object
//if cannot get file object create an empty object

if (!pictureFinal.exists()) {

try {
pictureFinal.createNewFile();
} catch (IOException e) {
Expand All @@ -85,7 +84,6 @@ private void makePhoto(String filePath, String newPhoto) {
this.photoPath = pictureFinal.toPath().toString();
} catch (IOException e) {
e.printStackTrace();

}

}
Expand Down Expand Up @@ -147,6 +145,7 @@ public static boolean checkPath(String path) {

if (path.matches(PHOTO_INTITAL_REGEX_)) {
return checkPicture(path);

}

return false;
Expand All @@ -173,7 +172,7 @@ public static boolean checkPicture(String path) {
if (pictureNew.length() > tenMB) {
return false;
}

return true;

}
Expand All @@ -184,5 +183,4 @@ public boolean equals(Object other) {
|| (other instanceof Photo // instanceof handles nulls
&& this.photoPath.equals(((Photo) other).photoPath));
}

}

0 comments on commit 6c954eb

Please sign in to comment.