Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/imageio/metadata/IIOInvalidTreeException.java
41153 views
1
/*
2
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.imageio.metadata;
27
28
import java.io.Serial;
29
30
import javax.imageio.IIOException;
31
32
import org.w3c.dom.Node;
33
34
/**
35
* An {@code IIOInvalidTreeException} is thrown when an attempt
36
* by an {@code IIOMetadata} object to parse a tree of
37
* {@code IIOMetadataNode}s fails. The node that led to the
38
* parsing error may be stored. As with any parsing error, the actual
39
* error may occur at a different point that that where it is
40
* detected. The node returned by {@code getOffendingNode}
41
* should merely be considered as a clue to the actual nature of the
42
* problem.
43
*
44
* @see IIOMetadata#setFromTree
45
* @see IIOMetadata#mergeTree
46
* @see IIOMetadataNode
47
*
48
*/
49
public class IIOInvalidTreeException extends IIOException {
50
51
/**
52
* Use serialVersionUID from JDK 9 for interoperability.
53
*/
54
@Serial
55
private static final long serialVersionUID = -1314083172544132777L;
56
57
/**
58
* The {@code Node} that led to the parsing error, or
59
* {@code null}.
60
*/
61
@SuppressWarnings("serial") // Not statically typed as Serializable
62
protected Node offendingNode = null;
63
64
/**
65
* Constructs an {@code IIOInvalidTreeException} with a
66
* message string and a reference to the {@code Node} that
67
* caused the parsing error.
68
*
69
* @param message a {@code String} containing the reason for
70
* the parsing failure.
71
* @param offendingNode the DOM {@code Node} that caused the
72
* exception, or {@code null}.
73
*/
74
public IIOInvalidTreeException(String message, Node offendingNode) {
75
super(message);
76
this.offendingNode = offendingNode;
77
}
78
79
/**
80
* Constructs an {@code IIOInvalidTreeException} with a
81
* message string, a reference to an exception that caused this
82
* exception, and a reference to the {@code Node} that caused
83
* the parsing error.
84
*
85
* @param message a {@code String} containing the reason for
86
* the parsing failure.
87
* @param cause the {@code Throwable} ({@code Error} or
88
* {@code Exception}) that caused this exception to occur,
89
* or {@code null}.
90
* @param offendingNode the DOM {@code Node} that caused the
91
* exception, or {@code null}.
92
*/
93
public IIOInvalidTreeException(String message, Throwable cause,
94
Node offendingNode) {
95
super(message, cause);
96
this.offendingNode = offendingNode;
97
}
98
99
/**
100
* Returns the {@code Node} that caused the error in parsing.
101
*
102
* @return the offending {@code Node}.
103
*/
104
public Node getOffendingNode() {
105
return offendingNode;
106
}
107
}
108
109