public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Refactor EndOfFileException and TimeoutException into MatchException. Date: Mon, 17 Dec 2007 17:25:00 -0000 [thread overview] Message-ID: <20071217172529.20069.qmail@sourceware.org> (raw) The branch, master has been updated via b1956ae0e033bbecd1d58cdf732e806968e82e81 (commit) from d2a0a36ecfd0058513e5a8a6d0d86572abbfa5ba (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit b1956ae0e033bbecd1d58cdf732e806968e82e81 Author: Andrew Cagney <cagney@redhat.com> Date: Mon Dec 17 12:24:52 2007 -0500 Refactor EndOfFileException and TimeoutException into MatchException. 2007-12-17 cagney <cagney@redhat.com> * MatchException.java: New. * EndOfFileException.java: Extend MatchException. (message()): Delete. * TimeoutException.java: Ditto. ----------------------------------------------------------------------- Summary of changes: frysk-sys/frysk/expunit/ChangeLog | 7 +++++ frysk-sys/frysk/expunit/EndOfFileException.java | 20 +------------- frysk-sys/frysk/expunit/MatchException.java | 30 +++++++++++++++++++++++ frysk-sys/frysk/expunit/TimeoutException.java | 26 ++----------------- 4 files changed, 42 insertions(+), 41 deletions(-) create mode 100644 frysk-sys/frysk/expunit/MatchException.java First 500 lines of diff: diff --git a/frysk-sys/frysk/expunit/ChangeLog b/frysk-sys/frysk/expunit/ChangeLog index 1173518..25f737d 100644 --- a/frysk-sys/frysk/expunit/ChangeLog +++ b/frysk-sys/frysk/expunit/ChangeLog @@ -1,3 +1,10 @@ +2007-12-17 cagney <cagney@redhat.com> + + * MatchException.java: New. + * EndOfFileException.java: Extend MatchException. + (message()): Delete. + * TimeoutException.java: Ditto. + 2007-12-14 cagney <cagney@redhat.com> * EndOfFileException.java: Rename EofException.java. diff --git a/frysk-sys/frysk/expunit/EndOfFileException.java b/frysk-sys/frysk/expunit/EndOfFileException.java index e815132..48051c5 100644 --- a/frysk-sys/frysk/expunit/EndOfFileException.java +++ b/frysk-sys/frysk/expunit/EndOfFileException.java @@ -43,26 +43,10 @@ package frysk.expunit; * Thrown an an end-of-file is encountered and nothing else matches. */ -public class EndOfFileException extends RuntimeException { +public class EndOfFileException extends MatchException { static final long serialVersionUID = 1; - private static String message(Match[] matches, String output) { - StringBuffer msg = new StringBuffer(); - msg.append("End-of-file"); - if (matches != null) { - msg.append("; expecting: "); - for (int i = 0; i < matches.length; i++) { - msg.append(" <<"); - msg.append(matches.toString()); - msg.append(">>"); - } - } - msg.append("; buffer <<"); - msg.append(output); - msg.append(">>"); - return msg.toString(); - } EndOfFileException(Match[] matches, String output) { - super(message(matches, output)); + super("end-of-file", matches, output); } } diff --git a/frysk-sys/frysk/expunit/MatchException.java b/frysk-sys/frysk/expunit/MatchException.java new file mode 100644 index 0000000..e59bedf --- /dev/null +++ b/frysk-sys/frysk/expunit/MatchException.java @@ -0,0 +1,30 @@ +package frysk.expunit; + +class MatchException extends RuntimeException { + static final long serialVersionUID = 1; + private final String error; + private final Match[] matches; + private final String output; + MatchException(String error, Match[] matches, String output) { + super(error); + this.error = error; + this.matches = matches; + this.output = output; + } + public String getMessage() { + StringBuffer msg = new StringBuffer(); + msg.append(error); + if (matches != null) { + msg.append("; expecting: "); + for (int i = 0; i < matches.length; i++) { + msg.append(" <<"); + msg.append(matches.toString()); + msg.append(">>"); + } + } + msg.append("; buffer <<"); + msg.append(output); + msg.append(">>"); + return msg.toString(); + } +} \ No newline at end of file diff --git a/frysk-sys/frysk/expunit/TimeoutException.java b/frysk-sys/frysk/expunit/TimeoutException.java index 4f64398..d050720 100644 --- a/frysk-sys/frysk/expunit/TimeoutException.java +++ b/frysk-sys/frysk/expunit/TimeoutException.java @@ -44,30 +44,10 @@ package frysk.expunit; * pattern. */ -public class TimeoutException - extends RuntimeException -{ +public class TimeoutException extends MatchException { static final long serialVersionUID = 1; - private static String message(long millisecondTimeout, Match[] matches, String output) { - StringBuffer msg = new StringBuffer(); - msg.append("Timeout of " + millisecondTimeout + " expired"); - if (matches != null) { - msg.append("; expecting: "); - for (int i = 0; i < matches.length; i++) { - msg.append(" <<"); - msg.append(matches.toString()); - msg.append(">>"); - } - } - msg.append("; buffer <<"); - msg.append(output); - msg.append(">>"); - return msg.toString(); - } - TimeoutException (long millisecondTimeout, Match[] matches, String output) - { - super (message(millisecondTimeout, matches, output)); - + TimeoutException(long millisecondTimeout, Match[] matches, String output) { + super("timeout of " + millisecondTimeout + "expired", matches, output); } } hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2007-12-17 17:25 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20071217172529.20069.qmail@sourceware.org \ --to=cagney@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).