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

[T6A1][F12-B4]Huynh Van Tu An #519

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/seedu/addressbook/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void setAddressBook(AddressBook addressBook){
* @throws Storage.InvalidStorageFilePathException if the target file path is incorrect.
*/
private Storage initializeStorage() throws Storage.InvalidStorageFilePathException {
return storage.newStorage();
return Storage.newStorage();
}

public String getStorageFilePath() {
Expand Down
8 changes: 6 additions & 2 deletions src/seedu/addressbook/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ public StorageOperationException(String message) {
public String getPath();
public void save(AddressBook addressBook)throws StorageOperationException;
public AddressBook load() throws StorageOperationException ;
public Storage newStorage() throws InvalidStorageFilePathException;
public Storage newStorage(String path) throws InvalidStorageFilePathException;
public static Storage newStorage() throws InvalidStorageFilePathException {
return new StorageFile();
Copy link

Choose a reason for hiding this comment

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

ouch! this is incorrect. can you think why?

}
public static Storage newStorage(String path) throws InvalidStorageFilePathException {
return new StorageFile(path);
}


}
12 changes: 1 addition & 11 deletions src/seedu/addressbook/storage/StorageFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,6 @@ public String getPath() {
return path.toString();
}

@Override
public Storage newStorage() throws InvalidStorageFilePathException{
// TODO Auto-generated method stub
return new StorageFile();
}

@Override
public Storage newStorage(String path) throws InvalidStorageFilePathException {
// TODO Auto-generated method stub
return new StorageFile(path);
}


}
2 changes: 1 addition & 1 deletion test/java/seedu/addressbook/logic/LogicTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class LogicTest {

@Before
public void setup() throws Exception {
saveFile = saveFile.newStorage(saveFolder.newFile("testSaveFile.txt").getPath());
saveFile = Storage.newStorage(saveFolder.newFile("testSaveFile.txt").getPath());
addressBook = new AddressBook();
saveFile.save(addressBook);
logic = new Logic(saveFile, addressBook);
Expand Down