Home | History | Annotate | Download | only in apicheck
      1 /*
      2  * Copyright (C) 2010 Google Inc.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.google.doclava.apicheck;
     18 
     19 public final class ApiParseException extends Exception {
     20   public String file;
     21   public int line;
     22 
     23   public ApiParseException() {
     24   }
     25 
     26   public ApiParseException(String message) {
     27     super(message);
     28   }
     29 
     30   public ApiParseException(String message, Exception cause) {
     31     super(message, cause);
     32     if (cause instanceof ApiParseException) {
     33         this.line = ((ApiParseException)cause).line;
     34     }
     35   }
     36 
     37   public ApiParseException(String message, int line) {
     38     super(message);
     39     this.line = line;
     40   }
     41 
     42   public String getMessage() {
     43     if (line > 0) {
     44       return super.getMessage() + " line " + line;
     45     } else {
     46       return super.getMessage();
     47     }
     48   }
     49 }
     50