@@ -52,13 +52,13 @@ public class DolphinPlaces implements QuickAccessService {
52
52
</bookmark>""" ;
53
53
54
54
55
- private static final Validator xmlValidator ;
55
+ private static final Validator XML_VALIDATOR ;
56
56
57
57
static {
58
58
SchemaFactory factory = SchemaFactory .newInstance (XMLConstants .W3C_XML_SCHEMA_NS_URI );
59
59
try (var schemaDefinition = DolphinPlaces .class .getResourceAsStream ("/xbel-1.0.xsd" )) {
60
60
Source schemaFile = new StreamSource (schemaDefinition );
61
- xmlValidator = factory .newSchema (schemaFile ).newValidator ();
61
+ XML_VALIDATOR = factory .newSchema (schemaFile ).newValidator ();
62
62
} catch (IOException | SAXException e ) {
63
63
throw new IllegalStateException ("Failed to load included XBEL schema definition file." , e );
64
64
}
@@ -75,7 +75,7 @@ public QuickAccessService.QuickAccessEntry add(Path target, String displayName)
75
75
}
76
76
var placesContent = Files .readString (PLACES_FILE );
77
77
//validate
78
- xmlValidator .validate (new StreamSource (new StringReader (placesContent )));
78
+ XML_VALIDATOR .validate (new StreamSource (new StringReader (placesContent )));
79
79
// modify
80
80
int insertIndex = placesContent .lastIndexOf ("</xbel" ); //cannot be -1 due to validation; we do not match the end tag, since betweent tag name and closing bracket can be whitespaces
81
81
try (var writer = Files .newBufferedWriter (TMP_FILE , StandardCharsets .UTF_8 , StandardOpenOption .WRITE , StandardOpenOption .CREATE , StandardOpenOption .TRUNCATE_EXISTING )) {
@@ -121,7 +121,7 @@ public void remove() throws QuickAccessServiceException {
121
121
return ; //we assume someone has removed our entry
122
122
}
123
123
//validate
124
- xmlValidator .validate (new StreamSource (new StringReader (placesContent )));
124
+ XML_VALIDATOR .validate (new StreamSource (new StringReader (placesContent )));
125
125
//modify
126
126
int openingTagIndex = indexOfEntryOpeningTag (placesContent , idIndex );
127
127
var contentToWrite1 = placesContent .substring (0 , openingTagIndex ).stripTrailing ();
0 commit comments