Skip to content

Commit 6cef302

Browse files
authored
Correct NullPointer in HebrewDateFormatter week format
Fixes #237 Thanks @MatanelAbayof
1 parent a321438 commit 6cef302

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/main/java/com/kosherjava/zmanim/hebrewcalendar/HebrewDateFormatter.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Zmanim Java API
3-
* Copyright (C) 2011 - 2023 Eliyahu Hershfeld
3+
* Copyright (C) 2011 - 2024 Eliyahu Hershfeld
44
*
55
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
66
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
@@ -20,7 +20,7 @@
2020

2121
/**
2222
* The HebrewDateFormatter class formats a {@link JewishDate}.
23-
* <p>
23+
*
2424
* The class formats Jewish dates, numbers, <em>Daf Yomi</em> (<em>Bavli</em> and <em>Yerushalmi</em>), the <em>Omer</em>,
2525
* <em>Parshas Hashavua</em> (including the special <em>parshiyos</em> of <em>Shekalim</em>, <em>Zachor</em>, <em>Parah</em>
2626
* and <em>Hachodesh</em>), Yomim Tovim and the Molad (experimental) in Hebrew or Latin chars, and has various settings.
@@ -37,7 +37,7 @@
3737
* @see JewishDate
3838
* @see JewishCalendar
3939
*
40-
* @author &copy; Eliyahu Hershfeld 2011 - 2023
40+
* @author &copy; Eliyahu Hershfeld 2011 - 2024
4141
*/
4242
public class HebrewDateFormatter {
4343

@@ -122,6 +122,7 @@ public class HebrewDateFormatter {
122122
* Default constructor sets the {@link EnumMap}s of Hebrew and default transliterated parshiyos.
123123
*/
124124
public HebrewDateFormatter() {
125+
weekFormat = new SimpleDateFormat("EEEE");
125126
transliteratedParshaMap = new EnumMap<>(JewishCalendar.Parsha.class);
126127
transliteratedParshaMap.put(JewishCalendar.Parsha.NONE, "");
127128
transliteratedParshaMap.put(JewishCalendar.Parsha.BERESHIS, "Bereshis");
@@ -373,7 +374,7 @@ public void setTransliteratedShabbosDayOfWeek(String transliteratedShabbos) {
373374
"Isru Chag"};
374375

375376
/**
376-
* Returns the list of holidays transliterated into Latin chars. This is used by the
377+
* Returns the array of holidays transliterated into Latin chars. This is used by the
377378
* {@link #formatYomTov(JewishCalendar)} when formatting the Yom Tov String. The default list of months uses
378379
* Ashkenazi pronunciation in typical American English spelling.
379380
*
@@ -394,7 +395,7 @@ public String[] getTransliteratedHolidayList() {
394395
}
395396

396397
/**
397-
* Sets the list of holidays transliterated into Latin chars. This is used by the
398+
* Sets the array of holidays transliterated into Latin chars. This is used by the
398399
* {@link #formatYomTov(JewishCalendar)} when formatting the Yom Tov String.
399400
*
400401
* @param transliteratedHolidays
@@ -575,7 +576,7 @@ public void setHebrewOmerPrefix(String hebrewOmerPrefix) {
575576
}
576577

577578
/**
578-
* Returns the list of months transliterated into Latin chars. The default list of months uses Ashkenazi
579+
* Returns the array of months transliterated into Latin chars. The default list of months uses Ashkenazi
579580
* pronunciation in typical American English spelling. This list has a length of 14 with 3 variations for Adar -
580581
* "Adar", "Adar II", "Adar I"
581582
*
@@ -688,7 +689,7 @@ public void setUseGershGershayim(boolean useGershGershayim) {
688689
/**
689690
* Returns whether the class is set to use the &#x05DE;&#x05E0;&#x05E6;&#x05E4;&#x05F4;&#x05DA; letters when
690691
* formatting years ending in 20, 40, 50, 80 and 90 to produce &#x05EA;&#x05E9;&#x05F4;&#x05E4; if false or
691-
* &#x05EA;&#x05E9;&#x05F4;&#x05E3; if true. Traditionally non-final form letters are used, so the year
692+
* &#x05EA;&#x05E9;&#x05F4;&#x05E3; if true. Traditionally non-final form letters are used, so the year
692693
* 5780 would be formatted as &#x05EA;&#x05E9;&#x05F4;&#x05E4; if the default false is used here. If this returns
693694
* true, the format &#x05EA;&#x05E9;&#x05F4;&#x05E3; would be used.
694695
*
@@ -867,7 +868,7 @@ public String getFormattedKviah(int jewishYear) {
867868
returnValue = returnValue.replaceAll(GERESH, "");// geresh is never used in the kviah format
868869
// boolean isLeapYear = JewishDate.isJewishLeapYear(jewishYear);
869870
// for efficiency we can avoid the expensive recalculation of the pesach day of week by adding 1 day to Rosh
870-
// Hashana for a 353-day year, 2 for a 354-day year, 3 for a 355 or 383 day year, 4 for a 384-day year and 5 for
871+
// Hashana for a 353-day year, 2 for a 354-day year, 3 for a 355 or 383-day year, 4 for a 384-day year and 5 for
871872
// a 385-day year
872873
return returnValue;
873874
}
@@ -1075,7 +1076,7 @@ public String formatParsha(JewishCalendar jewishCalendar) {
10751076
* chars. The default uses Ashkenazi pronunciation in typical American English spelling, for example
10761077
* Bereshis or Nitzavim Vayeilech or an empty string if there are none.
10771078
* @see #formatParsha(JewishCalendar)
1078-
*
1079+
* @see JewishCalendar#getUpcomingParshah()
10791080
*/
10801081
public String formatParsha(JewishCalendar.Parsha parsha) {
10811082
return hebrewFormat ? hebrewParshaMap.get(parsha) : transliteratedParshaMap.get(parsha);

0 commit comments

Comments
 (0)