/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.    
 */

package javax.script;

/**
 * See Javadoc of <a href="http://java.sun.com/javase/6/docs/api/javax/script/package-summary.html">Java Scripting API</a>
 */
public class ScriptException extends Exception {
    
	private static final long serialVersionUID = 1L;

	/** Stroes the file name of the script */
	protected String fileName = null;
    
    /** 
     * Stores the line number of the script in which the error has 
     * occured
     */ 
   	protected int lineNumber = -1;
    
    /** 
     * Stores the column number of the script in which the error has 
     * occured
     */
    protected int columnNumber = -1;
    
    /** Stores the message which describes the cause of error */
    protected String message;
     
    /**
     * Constructs a new exception with the specified cause.
     * 
     * @param exception the cause of exception
     */
	public ScriptException(Exception exception) {
      		super(exception);
	}
    
    /**
     * Constructs a new exception with the specified detailed 
     * message.
     *  
     * @param message the datailed message which caused the 
     *        exception 
     */
    public ScriptException(String message) {
        super(message);
        this.message = message;
    }

    /**
     * Constructs a new exception with the spcified detailed message 
     * of cause, the file name of the source of script and the line 
     * number of the script where the error has occured.
     * 
     * @param message    the detailed message of cause of exception
     * @param fileName   the file name which contains the script
     * @param lineNumber the line number of the script where the error has 
     *                   occured
     */
    public ScriptException(String message,String fileName,int lineNumber) {
		super(message);
        this.message = message;
		this.fileName = fileName;
		this.lineNumber = lineNumber;
	}
    
    /**
     * Constructs a new exception using the detailed message of 
     * cause, file name which contains the script, line number and
     * column number in which the error has occured.
     *  
     * @param message      the detailed message of the cause of 
     *                     exception
     * @param fileName     the name of the file which contains the
     *                     script
     * @param lineNumber   the line number of the script where the 
     *                     error has occured
     * @param columnNumber the column number of the script where the
     *                     error has occured
     */
	public ScriptException(String message,String fileName,int lineNumber,int columnNumber) {
		super(message);
        this.message = message;
		this.fileName = fileName;
		this.lineNumber = lineNumber;
		this.columnNumber = columnNumber;
	}
	
	/**
     * Retrieves the file name in which the script is contained.
     * 
     * @return Returns the file name in which the script is contained
     */
    public String getFileName() {
        return fileName;
    }
    
	/**
     * Retrieves the column number of the script where the error has 
     * occured. If the information is not available, returns -1.
     * 
	 * @return Returns the column number of the script where the 
     *         error has occured
	 */
	public int getColumnNumber() {        
		return columnNumber;
	}
    
	/**
     * Retrieves the line number of the script where the error has 
     * occured. If the information is not available, returns -1.
     * 
	 * @return Returns the line number of the script where the error 
     *         has occured
	 */
	public int getLineNumber() {
		return lineNumber;
	}
    
    /**
     * Retrieves a String describing the cause of error.
     * 
     * @return a String describing the cause of error
     */
    public String getMessage(){
        StringBuffer buffer = new StringBuffer();
        buffer.append(message);
        if (fileName != null) {
            buffer.append("in: " + fileName);
        }
        if (lineNumber != -1) {
            buffer.append("at line no: " + lineNumber);
        }
        if (columnNumber != -1) {
            buffer.append("at column number: " + columnNumber);
        }
        return buffer.toString();        
    }
}

@@ -962,16 +962,29 @@
 /a%3E%0A */%0A
+//@Immutable%0A
 public c
@@ -1087,18 +1087,18 @@
 %0A%09/** St
-r
 o
+r
 es the f
@@ -1126,23 +1126,27 @@
 t */%0A%09pr
-otected
+ivate final
  String 
@@ -1157,16 +1157,25 @@
 Name
- =
+; // default
  null
-;
 %0A   
@@ -1281,21 +1281,22 @@
 */ %0A
-   %09protected
+%09private final
  int
@@ -1302,24 +1302,36 @@
 t lineNumber
+; // default
  = -1;%0A    %0A
@@ -1432,29 +1432,30 @@
      */%0A
-    protected
+%09private final
  int col
@@ -1463,16 +1463,28 @@
 mnNumber
+; // default
  = -1;%0A 
@@ -1556,21 +1556,22 @@
  */%0A
-    protected
+%09private final
  Str
@@ -1578,24 +1578,40 @@
 ing message;
+ // default null
 %0A     %0A    /
@@ -1809,16 +1809,153 @@
 ption);%0A
+            this.message = null;%0A            this.fileName = null;%0A            this.lineNumber = -1;%0A            this.columnNumber = -1;%0A
 %09%7D%0A    %0A
@@ -2193,32 +2193,8 @@
 ) %7B%0A
-        super(message);%0A
     
@@ -2201,34 +2201,39 @@
     this
-.
+(
 message
- = message
+, null, -1, -1)
 ;%0A    %7D%0A
@@ -2771,34 +2771,16 @@
 mber) %7B%0A
-%09%09super(message);%0A
         
@@ -2787,86 +2787,43 @@
 this
-.
+(
 message
- = message;%0A%09%09this.fileName = fileName;%0A%09%09this.lineNumber = lineNumber
+, fileName, lineNumber, -1)
 ;%0A%09%7D
@@ -3499,32 +3499,33 @@
 (String message,
+ 
 String fileName,
@@ -3516,32 +3516,33 @@
 String fileName,
+ 
 int lineNumber,i
@@ -3540,16 +3540,17 @@
 eNumber,
+ 
 int colu

Make immutable (and so thread-safe)