Skip to content

Commit 03f93ab

Browse files
committed
Code Update
* Fix an issue with Calendar.java during Time class instantiation * Made exceptions to be more contextual * activate update functionality
1 parent 66d06f7 commit 03f93ab

File tree

9 files changed

+30
-8
lines changed

9 files changed

+30
-8
lines changed

Source/Cataphract/API/Astaroth/Calendar.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ public Calendar()
5050
*/
5151
public void printCalendar(int specificMonth, int specificYear)
5252
{
53+
Time time = new Time();
5354
// Set the month to current month if invalid input
54-
month = specificMonth == 0 || (specificMonth > 12 || specificMonth < 0) ? Integer.parseInt(new Time().getDateTimeUsingSpecifiedFormat("MM")) : specificMonth;
55+
month = specificMonth == 0 || (specificMonth > 12 || specificMonth < 0) ? Integer.parseInt(time.getDateTimeUsingSpecifiedFormat("MM")) : specificMonth;
5556
// Set the year to current year if not specified
56-
year = specificYear == 0 ? Integer.parseInt(new Time().getDateTimeUsingSpecifiedFormat("YYYY")) : specificYear;
57+
year = specificYear == 0 ? Integer.parseInt(time.getDateTimeUsingSpecifiedFormat("YYYY")) : specificYear;
5758
// Delegate to the private method for printing the calendar
5859
printCalendar();
5960
}
@@ -65,8 +66,9 @@ public void printCalendar(int specificMonth, int specificYear)
6566
*/
6667
private void printCalendar()
6768
{
69+
Time time = new Time();
6870
// Get the current date in the specified format
69-
String currentDate = new Time().getDateTimeUsingSpecifiedFormat("dd-MMMM-yyyy EEEE");
71+
String currentDate = time.getDateTimeUsingSpecifiedFormat("dd-MMMM-yyyy EEEE");
7072

7173
YearMonth yearMonth = YearMonth.of(year, month);
7274
LocalDate firstDayOfMonth = yearMonth.atDay(1);

Source/Cataphract/API/Wraith/Archive/FileUnzip.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616
package Cataphract.API.Wraith.Archive;
1717

1818
import java.io.FileInputStream;
19+
import java.io.FileNotFoundException;
1920
import java.io.FileOutputStream;
21+
2022
import java.nio.file.Files;
2123
import java.nio.file.Path;
2224
import java.nio.file.Paths;
25+
2326
import java.util.zip.ZipEntry;
2427
import java.util.zip.ZipInputStream;
2528

@@ -141,10 +144,15 @@ private void unzipLogic(String zipFilePath, String outputDirectory)
141144
}
142145
}
143146
}
147+
catch (FileNotFoundException fnfe)
148+
{
149+
IOStreams.printError("File Parse Failure: File Not Found.");
150+
}
144151
catch (Exception e)
145152
{
146153
// Handle exceptions (e.g., file not found, I/O errors)
147154
IOStreams.printError("Unable to proceed.");
155+
e.printStackTrace();
148156
}
149157

150158
System.gc();

Source/Cataphract/API/Wraith/Archive/FileZip.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
import java.io.File;
1919
import java.io.FileInputStream;
2020
import java.io.FileOutputStream;
21+
22+
import java.util.zip.ZipEntry;
2123
import java.util.zip.ZipOutputStream;
2224

2325
import Cataphract.API.IOStreams;
2426
import Cataphract.API.Dragon.Login;
2527
import Cataphract.API.Minotaur.PolicyCheck;
2628

27-
import java.util.zip.ZipEntry;
2829

2930
/**
3031
* Utility class for zipping files and directories.

Source/Cataphract/API/Wraith/FileDownload.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
package Cataphract.API.Wraith;
1717

18+
import java.io.FileNotFoundException;
1819
import java.io.FileOutputStream;
1920

2021
import java.nio.channels.Channels;
@@ -130,6 +131,10 @@ private boolean downloadUsingNIO(String urlStr, String fileName) throws Exceptio
130131
// Download successful.
131132
status = true;
132133
}
134+
catch(FileNotFoundException fnfe)
135+
{
136+
IOStreams.printError("File Not Found On Remote.\nValidate URL And Resource Availability At Specified Address.");
137+
}
133138
catch (Exception e)
134139
{
135140
// Print any exceptions that occur during the download.

Source/Cataphract/API/Wraith/FileManagement.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.Console;
44
import java.io.File;
5+
56
import java.nio.file.Files;
67
import java.nio.file.StandardCopyOption;
78

Source/Cataphract/API/Wraith/FileRead.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
package Cataphract.API.Wraith;
1717

18-
import java.io.BufferedReader;
19-
import java.io.FileReader;
2018
import java.io.File;
19+
import java.io.FileReader;
20+
import java.io.BufferedReader;
2121

2222
import Cataphract.API.IOStreams;
2323
import Cataphract.API.Build;

Source/Cataphract/API/Wraith/FileWrite.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
package Cataphract.API.Wraith;
1717

18-
import java.io.BufferedWriter;
19-
import java.io.Console;
2018
import java.io.File;
2119
import java.io.PrintWriter;
2220
import java.io.FileWriter;
21+
import java.io.BufferedWriter;
22+
import java.io.Console;
2323

2424
import Cataphract.API.IOStreams;
2525
import Cataphract.API.Astaroth.Time;

Source/Cataphract/Core/Loader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public static void main(String[] args)throws Exception
9292
new Cataphract.API.Astaroth.Calendar().printCalendar(0,0);
9393
new Cataphract.API.Astaroth.Calendar().printCalendar(8, 2077);
9494
System.exit(0);
95+
break;
9596

9697
case "iostreams":
9798
IOStreams.printError("This is an error message.");

Source/Cataphract/Core/SycoraxKernel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ private void commandProcessor(String input)throws Exception
113113
case "":
114114
break;
115115

116+
case "update":
117+
new Cataphract.API.Wyvern.NionUpdate(_username).updater();
118+
break;
119+
116120
case "usermgmt":
117121
switch(commandArray[1].toLowerCase())
118122
{

0 commit comments

Comments
 (0)