Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"Bash(python3 -m json.tool)",
"Bash(timeout 300 ./gradlew:*)",
"Bash(wc:*)",
"Bash(xargs cat:*)",
"Edit(./**)",
"Read(//home/mernst/research/types/checker-framework-fork*/**)",
"Read(//scratch/**)",
Expand All @@ -28,5 +29,5 @@
"deny": [],
"ask": []
},
"skipDangerousModePermissionPrompt": false
"skipDangerousModePermissionPrompt": true
}
2 changes: 2 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ jobs:
cache: 'gradle'
- name: java -version
run: java -version
- name: Warm up Gradle cache
run: ./gradlew spotlessCheck > /dev/null 2>&1 || (sleep 60 && true)
- name: ./gradlew build
run: ./gradlew build
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jdk:
- openjdk21
- openjdk25

# Add "verGJF" task when google-java-format handles type annotations better;
# see https://github.com/google/google-java-format/issues/5
script: ./gradlew build

git:
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.com.gradleup.shadow)

// Code formatting; defines targets "spotlessApply" and "spotlessCheck"
// which are run by "check" (which is itself run by "build").
alias(libs.plugins.com.diffplug.spotless)

// Error Prone linter
Expand Down
50 changes: 25 additions & 25 deletions src/main/java/org/plumelib/icalavailable/ICalAvailable.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static void processOptions(String[] args) {
start_date = new DateTime(parseDate(date));
}
} catch (Exception e) {
if (Pattern.matches(".*/.*", date) && !Pattern.matches(".*/.*/", date)) {
if (date.contains("/") && date.indexOf('/') == date.lastIndexOf('/')) {
System.err.println("Could not parse date (missing year?): " + date);
System.exit(1);
} else {
Expand Down Expand Up @@ -346,7 +346,7 @@ static DateTime parseTime(String time) {
String ampmString = m.group(4);

int hour = Integer.parseInt(hourString);
if ((ampmString != null) && ampmString.toLowerCase(Locale.getDefault()).equals("pm")) {
if ((ampmString != null) && ampmString.equalsIgnoreCase("pm")) {
hour += 12;
}
int minute = 0;
Expand Down Expand Up @@ -502,6 +502,28 @@ static List<Period> oneDayAvailable(DateTime day, List<Calendar> calendars) {
return result;
}

ComponentList<CalendarComponent> busyTimes = new ComponentList<>();
// Problem: any all-day events will be treated as UTC.
// Instead, they should be converted to local time (tz1).
// But VFreeBusy does not support this, so I may need to convert
// daily events into a different format before inserting them.
for (Calendar calendar : calendars) {
// getComponents() returns a raw ArrayList. Expose its element type.
ArrayList<@NonNull CalendarComponent> clist = calendar.getComponents();
for (CalendarComponent c : clist) {
/* TODO
if (c instanceof VEvent) {
VEvent v = (VEvent) c;
DtStart dts = v.getStartDate();
Parameter dtsValue = dts.getParameter("VALUE");
boolean allDay = (dtsValue != null) && dtsValue.getValue().equals("DATE");
// TODO: convert to the proper timezone.
// Tricky: must deal with the possibility of RRULE:FREQ=
}
*/
busyTimes.add(c);
}
}
for (Period bh : businessHours) {
DateTime start = mergeDateAndTime(day, bh.getStart());
DateTime end = mergeDateAndTime(day, bh.getEnd());
Expand All @@ -510,28 +532,6 @@ static List<Period> oneDayAvailable(DateTime day, List<Calendar> calendars) {
if (debug) {
System.out.println("Request = " + request);
}
ComponentList<CalendarComponent> busyTimes = new ComponentList<>();
// Problem: any all-day events will be treated as UTC.
// Instead, they should be converted to local time (tz1).
// But VFreeBusy does not support this, so I may need to convert
// daily events into a different format before inserting them.
for (Calendar calendar : calendars) {
// getComponents() returns a raw ArrayList. Expose its element type.
ArrayList<@NonNull CalendarComponent> clist = calendar.getComponents();
for (CalendarComponent c : clist) {
/* TODO
if (c instanceof VEvent) {
VEvent v = (VEvent) c;
DtStart dts = v.getStartDate();
Parameter dtsValue = dts.getParameter("VALUE");
boolean allDay = (dtsValue != null) && dtsValue.getValue().equals("DATE");
// TODO: convert to the proper timezone.
// Tricky: must deal with the possibility of RRULE:FREQ=
}
*/
busyTimes.add(c);
}
}
VFreeBusy response = new VFreeBusy(request, busyTimes);
if (debug) {
System.out.println("Response = " + response);
Expand Down Expand Up @@ -577,7 +577,7 @@ static List<Period> oneDayAvailable(DateTime day, List<Calendar> calendars) {
* @see dateFormats
*/
static java.util.Date parseDate(String strDate) throws ParseException {
if (Pattern.matches("^[0-9][0-9]?/[0-9][0-9]?$", date)) {
if (Pattern.matches("^[0-9][0-9]?/[0-9][0-9]?$", strDate)) {
@SuppressWarnings("deprecation") // for iCal4j
int year = new Date().getYear() + 1900;
strDate = strDate + "/" + year;
Expand Down