1 /* 2 * Copyright (C) 2011 The Android Open Source Project 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 org.apache.harmony.xml.dom; 18 19 import org.w3c.dom.DOMError; 20 import org.w3c.dom.DOMLocator; 21 import org.w3c.dom.Node; 22 23 public final class DOMErrorImpl implements DOMError { 24 private static final DOMLocator NULL_DOM_LOCATOR = new DOMLocator() { 25 public int getLineNumber() { 26 return -1; 27 } 28 public int getColumnNumber() { 29 return -1; 30 } 31 public int getByteOffset() { 32 return -1; 33 } 34 public int getUtf16Offset() { 35 return -1; 36 } 37 public Node getRelatedNode() { 38 return null; 39 } 40 public String getUri() { 41 return null; 42 } 43 }; 44 45 private final short severity; 46 private final String type; 47 DOMErrorImpl(short severity, String type)48 public DOMErrorImpl(short severity, String type) { 49 this.severity = severity; 50 this.type = type; 51 } 52 getSeverity()53 public short getSeverity() { 54 return severity; 55 } 56 getMessage()57 public String getMessage() { 58 return type; 59 } 60 getType()61 public String getType() { 62 return type; 63 } 64 getRelatedException()65 public Object getRelatedException() { 66 return null; 67 } 68 getRelatedData()69 public Object getRelatedData() { 70 return null; 71 } 72 getLocation()73 public DOMLocator getLocation() { 74 return NULL_DOM_LOCATOR; 75 } 76 } 77