01: package com.tagtraum.framework.compiler;
02:
03: import com.tagtraum.framework.util.URLHelper;
04:
05: import java.io.File;
06: import java.net.MalformedURLException;
07:
08: /**
09: *
10: * Date: 04.04.2002
11: * Time: 12:07:48
12: * @author <a href="mailto:hs@tagtraum.com">Hendrik Schreiber</a>
13: * @version 1.1beta1 $Id: ErrorMessage.java,v 1.5 2005/03/15 21:46:44 hendriks73 Exp $
14: */
15: public class ErrorMessage {
16: private String file;
17: private String message;
18: private int line;
19: private int pos;
20:
21: public ErrorMessage(String file, String message, int line, int pos) {
22: try {
23: file = URLHelper.encodeSpaces(new File(file).toURL())
24: .toString();
25: } catch (MalformedURLException e) {
26: // best effort to make this a URL
27: // ignore
28: }
29: this .file = file;
30: this .message = message;
31: this .line = line;
32: this .pos = pos;
33: }
34:
35: public String getFile() {
36: return file;
37: }
38:
39: public String getMessage() {
40: return message;
41: }
42:
43: public int getLine() {
44: return line;
45: }
46:
47: public int getPos() {
48: return pos;
49: }
50:
51: public String toString() {
52: StringBuffer sb = new StringBuffer();
53: sb.append("Error in ");
54: sb.append(file);
55: sb.append(", line ");
56: sb.append(line);
57: sb.append(", column ");
58: sb.append(pos);
59: sb.append(": ");
60: sb.append(message);
61: return sb.toString();
62: }
63: }
|