Skip to content

Commit

Permalink
Removed useless throwables that were thrown.
Browse files Browse the repository at this point in the history
  • Loading branch information
Displee committed May 2, 2018
1 parent aea2226 commit c8fe0b1
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions src/org/displee/cache/index/IndexInformation.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public Archive[] getArchives() {
* Get the archives.
* @return {@code archives}
*/
public Archive[] copyArchives() throws Throwable {
public Archive[] copyArchives() {
final Archive[] archives = new Archive[archiveIds.length];
for(int i = 0; i < archives.length; i++) {
final Archive original = getArchive(archiveIds[i]);
Expand All @@ -313,7 +313,7 @@ public Archive[] copyArchives() throws Throwable {
* @param addFiles If we need to add the files in the archives to the new archive.
* @param resetFiles If we need to reset all the files in the archives.
*/
public void addArchives(Archive[] archives, boolean addFiles, boolean resetFiles) throws Throwable {
public void addArchives(Archive[] archives, boolean addFiles, boolean resetFiles) {
for (Archive archive : archives) {
addArchive(archive, addFiles, resetFiles);
}
Expand All @@ -325,7 +325,7 @@ public void addArchives(Archive[] archives, boolean addFiles, boolean resetFiles
* @param resetFiles If we need to reset all files in the new archive.
* @return The new archive instance.
*/
public Archive addArchive(Archive archive, boolean resetFiles) throws Throwable {
public Archive addArchive(Archive archive, boolean resetFiles) {
return addArchive(archive, true, resetFiles, getLastArchive().getId() + 1);
}

Expand All @@ -336,7 +336,7 @@ public Archive addArchive(Archive archive, boolean resetFiles) throws Throwable
* @param resetFiles If we need to reset all the files in the new archive.
* @return The new archive instance.
*/
public Archive addArchive(Archive archive, boolean addFiles, boolean resetFiles) throws Throwable {
public Archive addArchive(Archive archive, boolean addFiles, boolean resetFiles) {
return addArchive(archive, addFiles, resetFiles, archive.getId());
}

Expand All @@ -348,7 +348,7 @@ public Archive addArchive(Archive archive, boolean addFiles, boolean resetFiles)
* @param id The id to give to the new archive.
* @return The new archive instance.
*/
public Archive addArchive(Archive archive, boolean addFiles, boolean resetFiles, int id) throws Throwable {
public Archive addArchive(Archive archive, boolean addFiles, boolean resetFiles, int id) {
final File[] files = archive.copy().getFiles();
final Archive newArchive = addArchive(id, archive.getName(), resetFiles);
if (addFiles) {
Expand All @@ -362,7 +362,7 @@ public Archive addArchive(Archive archive, boolean addFiles, boolean resetFiles,
* Add an archive to this index.
* @return The new added archive.
*/
public Archive addArchive() throws Throwable {
public Archive addArchive() {
return addArchive(getLastArchive().getId() + 1);
}

Expand All @@ -371,7 +371,7 @@ public Archive addArchive() throws Throwable {
* @param name The name.
* @return The archive instance.
*/
public Archive addArchive(String name) throws Throwable {
public Archive addArchive(String name) {
return addArchive(name, false);
}

Expand All @@ -381,7 +381,7 @@ public Archive addArchive(String name) throws Throwable {
* @param resetFiles If we need to reset all the files in this archive.
* @return The archive instance.
*/
public Archive addArchive(String name, boolean resetFiles) throws Throwable {
public Archive addArchive(String name, boolean resetFiles) {
final int archiveId = getArchiveId(name);
return addArchive(archiveId == -1 ? (getLastArchive().getId() + 1) : archiveId, name == null ? -1 : name.toLowerCase().hashCode(), resetFiles);
}
Expand All @@ -391,7 +391,7 @@ public Archive addArchive(String name, boolean resetFiles) throws Throwable {
* @param id The id of the new archive.
* @return The archive instance.
*/
public Archive addArchive(int id) throws Throwable {
public Archive addArchive(int id) {
return addArchive(id, false);
}

Expand All @@ -401,7 +401,7 @@ public Archive addArchive(int id) throws Throwable {
* @param resetFiles If we need to reset all the files in this archive.
* @return The archive instance.
*/
public Archive addArchive(int id, boolean resetFiles) throws Throwable {
public Archive addArchive(int id, boolean resetFiles) {
return addArchive(id, -1, resetFiles);
}

Expand All @@ -412,7 +412,7 @@ public Archive addArchive(int id, boolean resetFiles) throws Throwable {
* @param resetFiles If we need to reset all the files in this archive.
* @return The archive instance.
*/
public Archive addArchive(int id, int name, boolean resetFiles) throws Throwable {
public Archive addArchive(int id, int name, boolean resetFiles) {
Archive current = getArchive(id, true);
if (current != null && !current.isRead() && !current.isNew() && !current.isUpdateRequired()) {
current = getArchive(id);
Expand Down Expand Up @@ -503,20 +503,15 @@ public void flag() {
*/
public void sort() {
Arrays.sort(archiveIds);
Arrays.sort(archives, new Comparator<Archive>() {
@Override
public int compare(Archive archive1, Archive archive2) {
return archive1.getId() > archive2.getId() ? 0 : -1;
}
});
Arrays.sort(archives, (archive1, archive2) -> archive1.getId() > archive2.getId() ? 0 : -1);
}

/**
* Get an archive instance by its name.
* @param name The name of the archive to get.
* @return The archive instance.
*/
public Archive getArchive(String name) throws Throwable {
public Archive getArchive(String name) {
return getArchive(name, null);
}

Expand All @@ -526,7 +521,7 @@ public Archive getArchive(String name) throws Throwable {
* @param xteas The xteas
* @return The archive instance.
*/
public Archive getArchive(String name, int[] xteas) throws Throwable {
public Archive getArchive(String name, int[] xteas) {
return getArchive(getArchiveId(name), xteas, false);
}

Expand All @@ -536,7 +531,7 @@ public Archive getArchive(String name, int[] xteas) throws Throwable {
* @param direct If we must get the archive instance without reading it.
* @return The archive instance.
*/
public Archive getArchive(String name, boolean direct) throws Throwable {
public Archive getArchive(String name, boolean direct) {
return getArchive(getArchiveId(name), null, direct);
}

Expand All @@ -545,7 +540,7 @@ public Archive getArchive(String name, boolean direct) throws Throwable {
* @param id The id of the archive to get.
* @return The archive instance.
*/
public Archive getArchive(int id) throws Throwable {
public Archive getArchive(int id) {
return getArchive(id, false);
}

Expand All @@ -555,7 +550,7 @@ public Archive getArchive(int id) throws Throwable {
* @param xteas The xteas.
* @return The archive instance.
*/
public Archive getArchive(int id, int[] xteas) throws Throwable {
public Archive getArchive(int id, int[] xteas) {
return getArchive(id, xteas, false);
}

Expand All @@ -565,7 +560,7 @@ public Archive getArchive(int id, int[] xteas) throws Throwable {
* @param direct If we want to get the instance without reading it.
* @return The archive instance.
*/
public Archive getArchive(int id, boolean direct) throws Throwable {
public Archive getArchive(int id, boolean direct) {
return getArchive(id, null, direct);
}

Expand All @@ -576,7 +571,7 @@ public Archive getArchive(int id, boolean direct) throws Throwable {
* @param direct If we want to get the archive without reading it.
* @return The archive instance.
*/
public Archive getArchive(int id, int[] xtea, boolean direct) throws Throwable {
public Archive getArchive(int id, int[] xtea, boolean direct) {
if (origin.isClosed()) {
return null;
}
Expand Down Expand Up @@ -626,7 +621,7 @@ public boolean containsName(String name) {
* Get the last archive.
* @return The last archive instance of this index.
*/
public Archive getLastArchive() throws Throwable {
public Archive getLastArchive() {
Archive archive = archives[archives.length - 1];
if (!archive.isRead()) {
archive = getArchive(archive.getId());
Expand Down

0 comments on commit c8fe0b1

Please sign in to comment.