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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ICalAvailable

Given one or more calendars in
[iCalendar format](http://en.wikipedia.org/wiki/ICalendar),
[iCalendar format](https://en.wikipedia.org/wiki/ICalendar),
produces a textual summary of available times.
This is useful for sending someone a list of acceptable times for a meeting,
if you need to negotiate a meeting time via text rather than sharing a calendar.
Expand Down
1 change: 0 additions & 1 deletion src/main/elisp/ical-available.el
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ With just C-u prefix argument, prompt for starting date and days."
(append (list "-cp"
(substitute-in-file-name "$HOME/java/plume-lib/icalavailable/build/libs/icalavailable-all.jar")
"-Dical4j.parsing.relaxed=true"
"-Dical4j.parsing.relaxed=true"
"org.plumelib.icalavailable.ICalAvailable")
ical-args)))
(if (or (= (char-before) 0) (= (char-before) 1) (= (char-before) 255))
Expand Down
27 changes: 13 additions & 14 deletions src/main/java/org/plumelib/icalavailable/ICalAvailable.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ private ICalAvailable() {
@EnsuresNonNull("tz1")
static void processOptions(String[] args) {
Options options = new Options("ICalAvailable [options]", ICalAvailable.class);
String[] remaining_args = options.parse(true, args);
if (remaining_args.length != 0) {
System.err.println("Unrecognized arguments: " + Arrays.toString(remaining_args));
String[] remainingArgs = options.parse(true, args);
if (remainingArgs.length != 0) {
System.err.println("Unrecognized arguments: " + Arrays.toString(remainingArgs));
System.exit(1);
}
if (iCal_URL.isEmpty()) {
Expand Down Expand Up @@ -220,9 +220,9 @@ static void processOptions(String[] args) {
start_date.setTimeZone(tz1);
start_date.setMinutes((start_date.getMinutes() / 15) * 15);

for (String URL : iCal_URL) {
for (String iCalUrl : iCal_URL) {
try {
URL url = new URL(URL);
URL url = new URL(iCalUrl);
CalendarBuilder builder = new CalendarBuilder();
Calendar c;
try (InputStream urlStream = url.openStream()) {
Expand All @@ -233,15 +233,14 @@ static void processOptions(String[] args) {
System.out.println();
System.out.println("It is possible that the calendar has moved.");
// Debugging: write the URL contents to standard output
URL url2 = new URL(URL);
try (InputStream url_is = url2.openStream()) {
System.out.printf("URL: %s%n", url2);
try (InputStream contentStream = url.openStream()) {
System.out.printf("URL: %s%n", url);
System.out.println("Contents:");
byte[] buffer = new byte[1024];
int len = url_is.read(buffer);
int len = contentStream.read(buffer);
while (len != -1) {
System.out.write(buffer, 0, len);
len = url_is.read(buffer);
len = contentStream.read(buffer);
}
System.out.println();
}
Expand All @@ -252,7 +251,7 @@ static void processOptions(String[] args) {
calendars.add(c);
} catch (Exception e) {
e.printStackTrace(System.err);
System.err.println("Could not read calendar from " + URL);
System.err.println("Could not read calendar from " + iCalUrl);
System.exit(1);
}
}
Expand Down Expand Up @@ -584,10 +583,10 @@ static java.util.Date parseDate(String strDate) throws ParseException {
int year = new Date().getYear() + 1900;
strDate = strDate + "/" + year;
}
for (DateFormat this_df : dateFormats) {
this_df.setLenient(false);
for (DateFormat dateFormat : dateFormats) {
dateFormat.setLenient(false);
try {
java.util.Date result = this_df.parse(strDate);
java.util.Date result = dateFormat.parse(strDate);
return result;
} catch (ParseException e) {
// Try the next format in the list.
Expand Down