File size: 21,902 Bytes
62cfde8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | diff --git a/src/main/java/dev/hypera/dragonfly/Dragonfly.java b/src/main/java/dev/hypera/dragonfly/Dragonfly.java
index 3b99701..ef59387 100644
--- a/src/main/java/dev/hypera/dragonfly/Dragonfly.java
+++ b/src/main/java/dev/hypera/dragonfly/Dragonfly.java
@@ -40,6 +40,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.jetbrains.annotations.ApiStatus.Internal;
+import org.jetbrains.annotations.NotNull;
/**
* Main Dragonfly class.
@@ -47,16 +48,16 @@ import org.jetbrains.annotations.ApiStatus.Internal;
*/
public class Dragonfly {
- private static final String VERSION = "0.3.0-SNAPSHOT";
+ private static final @NotNull String VERSION = "0.3.1-SNAPSHOT";
private final int timeout;
- private final Path directory;
- private final Set<String> repositories;
- private final Consumer<Status> statusHandler;
+ private final @NotNull Path directory;
+ private final @NotNull Set<String> repositories;
+ private final @NotNull Consumer<Status> statusHandler;
- private final DependencyDownloader dependencyDownloader = new DependencyDownloader(this);
- private final DependencyRelocator dependencyRelocator;
- private final DependencyLoader dependencyLoader;
+ private final @NotNull DependencyDownloader dependencyDownloader = new DependencyDownloader(this);
+ private final @NotNull DependencyRelocator dependencyRelocator;
+ private final @NotNull DependencyLoader dependencyLoader;
@Internal
@@ -74,7 +75,7 @@ public class Dragonfly {
}
}
- public static String getVersion() {
+ public static @NotNull String getVersion() {
return VERSION;
}
@@ -84,7 +85,7 @@ public class Dragonfly {
* @param dependencies Dependencies to be loaded.
* @return If the load was successful, in the form of a {@link CompletableFuture<Boolean>}.
*/
- public CompletableFuture<Boolean> load(Dependency... dependencies) {
+ public @NotNull CompletableFuture<Boolean> load(@NotNull Dependency... dependencies) {
return CompletableFuture.supplyAsync(() -> {
try {
statusHandler.accept(Status.STARTING);
@@ -137,11 +138,11 @@ public class Dragonfly {
return timeout;
}
- public Path getDirectory() {
+ public @NotNull Path getDirectory() {
return directory;
}
- public Set<String> getRepositories() {
+ public @NotNull Set<String> getRepositories() {
return repositories;
}
@@ -151,7 +152,7 @@ public class Dragonfly {
* @return Stored instance of {@link DependencyDownloader}.
*/
@Internal
- public DependencyDownloader getDependencyDownloader() {
+ public @NotNull DependencyDownloader getDependencyDownloader() {
return dependencyDownloader;
}
diff --git a/src/main/java/dev/hypera/dragonfly/DragonflyBuilder.java b/src/main/java/dev/hypera/dragonfly/DragonflyBuilder.java
index 6c4b8e8..3d35043 100644
--- a/src/main/java/dev/hypera/dragonfly/DragonflyBuilder.java
+++ b/src/main/java/dev/hypera/dragonfly/DragonflyBuilder.java
@@ -32,6 +32,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Consumer;
+import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
/**
@@ -115,6 +116,7 @@ public class DragonflyBuilder {
*
* @return New {@link Dragonfly} instance.
*/
+ @Contract(value = "-> new", pure = true)
public @NotNull Dragonfly build() {
try {
return new Dragonfly(timeout, classLoader, directory, repositories, deleteOnRelocate, statusHandler);
diff --git a/src/main/java/dev/hypera/dragonfly/downloaders/impl/MavenDownloader.java b/src/main/java/dev/hypera/dragonfly/downloaders/impl/MavenDownloader.java
index eca6c92..767165a 100644
--- a/src/main/java/dev/hypera/dragonfly/downloaders/impl/MavenDownloader.java
+++ b/src/main/java/dev/hypera/dragonfly/downloaders/impl/MavenDownloader.java
@@ -41,8 +41,8 @@ import org.jetbrains.annotations.NotNull;
@Downloader(MavenDependency.class)
public class MavenDownloader implements IDownloader<MavenDependency> {
- private final MavenResolver resolver = new MavenResolver();
- private final MavenSnapshotResolver snapshotResolver = new MavenSnapshotResolver();
+ private final @NotNull MavenResolver resolver = new MavenResolver();
+ private final @NotNull MavenSnapshotResolver snapshotResolver = new MavenSnapshotResolver();
@Override
public void download(@NotNull Dragonfly dragonfly, @NotNull MavenDependency dependency) throws DownloadFailureException {
diff --git a/src/main/java/dev/hypera/dragonfly/exceptions/DownloadFailureException.java b/src/main/java/dev/hypera/dragonfly/exceptions/DownloadFailureException.java
index 1880a5c..41e818f 100644
--- a/src/main/java/dev/hypera/dragonfly/exceptions/DownloadFailureException.java
+++ b/src/main/java/dev/hypera/dragonfly/exceptions/DownloadFailureException.java
@@ -23,25 +23,29 @@
package dev.hypera.dragonfly.exceptions;
+import org.jetbrains.annotations.NotNull;
+
public class DownloadFailureException extends DragonflyException {
+ private static final long serialVersionUID = 5648475409314204882L;
+
public DownloadFailureException() {
super();
}
- public DownloadFailureException(String message) {
+ public DownloadFailureException(@NotNull String message) {
super(message);
}
- public DownloadFailureException(String message, Throwable cause) {
+ public DownloadFailureException(@NotNull String message, @NotNull Throwable cause) {
super(message, cause);
}
- public DownloadFailureException(Throwable cause) {
+ public DownloadFailureException(@NotNull Throwable cause) {
super(cause);
}
- protected DownloadFailureException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ protected DownloadFailureException(@NotNull String message, @NotNull Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
diff --git a/src/main/java/dev/hypera/dragonfly/exceptions/DragonflyException.java b/src/main/java/dev/hypera/dragonfly/exceptions/DragonflyException.java
index 62ec283..79252da 100644
--- a/src/main/java/dev/hypera/dragonfly/exceptions/DragonflyException.java
+++ b/src/main/java/dev/hypera/dragonfly/exceptions/DragonflyException.java
@@ -23,29 +23,33 @@
package dev.hypera.dragonfly.exceptions;
+import org.jetbrains.annotations.NotNull;
+
/**
* Dragonfly Exception.
* @author Joshua Sing <joshua@hypera.dev>
*/
public class DragonflyException extends Exception {
+ private static final long serialVersionUID = 3565376065959848642L;
+
public DragonflyException() {
super();
}
- public DragonflyException(String message) {
+ public DragonflyException(@NotNull String message) {
super(message);
}
- public DragonflyException(String message, Throwable cause) {
+ public DragonflyException(@NotNull String message, @NotNull Throwable cause) {
super(message, cause);
}
- public DragonflyException(Throwable cause) {
+ public DragonflyException(@NotNull Throwable cause) {
super(cause);
}
- protected DragonflyException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ protected DragonflyException(@NotNull String message, @NotNull Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
diff --git a/src/main/java/dev/hypera/dragonfly/exceptions/LoadFailureException.java b/src/main/java/dev/hypera/dragonfly/exceptions/LoadFailureException.java
index 27fae4f..87850f6 100644
--- a/src/main/java/dev/hypera/dragonfly/exceptions/LoadFailureException.java
+++ b/src/main/java/dev/hypera/dragonfly/exceptions/LoadFailureException.java
@@ -23,25 +23,29 @@
package dev.hypera.dragonfly.exceptions;
+import org.jetbrains.annotations.NotNull;
+
public class LoadFailureException extends DragonflyException {
+ private static final long serialVersionUID = -8555618454694039541L;
+
public LoadFailureException() {
super();
}
- public LoadFailureException(String message) {
+ public LoadFailureException(@NotNull String message) {
super(message);
}
- public LoadFailureException(String message, Throwable cause) {
+ public LoadFailureException(@NotNull String message, @NotNull Throwable cause) {
super(message, cause);
}
- public LoadFailureException(Throwable cause) {
+ public LoadFailureException(@NotNull Throwable cause) {
super(cause);
}
- protected LoadFailureException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ protected LoadFailureException(@NotNull String message, @NotNull Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
diff --git a/src/main/java/dev/hypera/dragonfly/exceptions/RelocationFailureException.java b/src/main/java/dev/hypera/dragonfly/exceptions/RelocationFailureException.java
index cccf256..9a2ca58 100644
--- a/src/main/java/dev/hypera/dragonfly/exceptions/RelocationFailureException.java
+++ b/src/main/java/dev/hypera/dragonfly/exceptions/RelocationFailureException.java
@@ -23,25 +23,29 @@
package dev.hypera.dragonfly.exceptions;
+import org.jetbrains.annotations.NotNull;
+
public class RelocationFailureException extends DragonflyException {
+ private static final long serialVersionUID = -2817144091943660838L;
+
public RelocationFailureException() {
super();
}
- public RelocationFailureException(String message) {
+ public RelocationFailureException(@NotNull String message) {
super(message);
}
- public RelocationFailureException(String message, Throwable cause) {
+ public RelocationFailureException(@NotNull String message, @NotNull Throwable cause) {
super(message, cause);
}
- public RelocationFailureException(Throwable cause) {
+ public RelocationFailureException(@NotNull Throwable cause) {
super(cause);
}
- protected RelocationFailureException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ protected RelocationFailureException(@NotNull String message, @NotNull Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
diff --git a/src/main/java/dev/hypera/dragonfly/exceptions/ResolveFailureException.java b/src/main/java/dev/hypera/dragonfly/exceptions/ResolveFailureException.java
index 24f25b3..1f82577 100644
--- a/src/main/java/dev/hypera/dragonfly/exceptions/ResolveFailureException.java
+++ b/src/main/java/dev/hypera/dragonfly/exceptions/ResolveFailureException.java
@@ -23,25 +23,29 @@
package dev.hypera.dragonfly.exceptions;
+import org.jetbrains.annotations.NotNull;
+
public class ResolveFailureException extends DownloadFailureException {
+ private static final long serialVersionUID = -8393996338726021911L;
+
public ResolveFailureException() {
super();
}
- public ResolveFailureException(String message) {
+ public ResolveFailureException(@NotNull String message) {
super(message);
}
- public ResolveFailureException(String message, Throwable cause) {
+ public ResolveFailureException(@NotNull String message, @NotNull Throwable cause) {
super(message, cause);
}
- public ResolveFailureException(Throwable cause) {
+ public ResolveFailureException(@NotNull Throwable cause) {
super(cause);
}
- protected ResolveFailureException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ protected ResolveFailureException(@NotNull String message, @NotNull Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
diff --git a/src/main/java/dev/hypera/dragonfly/loading/DependencyLoader.java b/src/main/java/dev/hypera/dragonfly/loading/DependencyLoader.java
index 940dc5c..aa46e4c 100644
--- a/src/main/java/dev/hypera/dragonfly/loading/DependencyLoader.java
+++ b/src/main/java/dev/hypera/dragonfly/loading/DependencyLoader.java
@@ -29,6 +29,7 @@ import dev.hypera.dragonfly.exceptions.LoadFailureException;
import java.net.MalformedURLException;
import java.util.List;
import org.jetbrains.annotations.ApiStatus.Internal;
+import org.jetbrains.annotations.NotNull;
/**
* Dependency loader.
@@ -37,11 +38,11 @@ import org.jetbrains.annotations.ApiStatus.Internal;
*/
public class DependencyLoader {
- private final Dragonfly dragonfly;
- private final IClassLoader classLoader;
+ private final @NotNull Dragonfly dragonfly;
+ private final @NotNull IClassLoader classLoader;
@Internal
- public DependencyLoader(Dragonfly dragonfly, IClassLoader classLoader) {
+ public DependencyLoader(@NotNull Dragonfly dragonfly, @NotNull IClassLoader classLoader) {
this.dragonfly = dragonfly;
this.classLoader = classLoader;
}
@@ -52,7 +53,7 @@ public class DependencyLoader {
* @param dependencies Dependencies to be loaded.
* @throws LoadFailureException if something went wrong while loading the dependencies.
*/
- public void load(List<Dependency> dependencies) throws LoadFailureException {
+ public void load(@NotNull List<Dependency> dependencies) throws LoadFailureException {
for (Dependency dependency : dependencies) {
load(dependency);
}
@@ -64,7 +65,7 @@ public class DependencyLoader {
* @param dependency Dependency to be loaded.
* @throws LoadFailureException if something went wrong while loading the dependency.
*/
- private void load(Dependency dependency) throws LoadFailureException {
+ private void load(@NotNull Dependency dependency) throws LoadFailureException {
try {
classLoader.addURL(dragonfly.getDirectory().resolve(dependency.getFileName()).toUri().toURL());
} catch (MalformedURLException ex) {
diff --git a/src/main/java/dev/hypera/dragonfly/loading/DragonflyClassLoader.java b/src/main/java/dev/hypera/dragonfly/loading/DragonflyClassLoader.java
index 5cb38b6..889e039 100644
--- a/src/main/java/dev/hypera/dragonfly/loading/DragonflyClassLoader.java
+++ b/src/main/java/dev/hypera/dragonfly/loading/DragonflyClassLoader.java
@@ -26,6 +26,7 @@ package dev.hypera.dragonfly.loading;
import java.net.URL;
import java.net.URLClassLoader;
import org.jetbrains.annotations.ApiStatus.Internal;
+import org.jetbrains.annotations.NotNull;
/**
* Dragonfly class loader, a child-first {@link URLClassLoader} used for loading Dragonfly's internal dependencies.
@@ -35,17 +36,17 @@ import org.jetbrains.annotations.ApiStatus.Internal;
@Internal
public class DragonflyClassLoader extends URLClassLoader {
- public DragonflyClassLoader(ClassLoader classLoader) {
+ public DragonflyClassLoader(@NotNull ClassLoader classLoader) {
super(new URL[0], classLoader);
}
@Override
- public void addURL(URL url) {
+ public void addURL(@NotNull URL url) {
super.addURL(url);
}
@Override
- protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ protected @NotNull Class<?> loadClass(@NotNull String name, boolean resolve) throws ClassNotFoundException {
Class<?> loadedClass = findLoadedClass(name);
if (null == loadedClass) {
try {
diff --git a/src/main/java/dev/hypera/dragonfly/relocation/DependencyRelocator.java b/src/main/java/dev/hypera/dragonfly/relocation/DependencyRelocator.java
index 9132a76..bfb88db 100644
--- a/src/main/java/dev/hypera/dragonfly/relocation/DependencyRelocator.java
+++ b/src/main/java/dev/hypera/dragonfly/relocation/DependencyRelocator.java
@@ -41,6 +41,7 @@ import java.util.List;
import java.util.Map;
import org.jetbrains.annotations.ApiStatus.Internal;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* Dependency relocator.
@@ -49,21 +50,21 @@ import org.jetbrains.annotations.NotNull;
*/
public class DependencyRelocator {
- private static final String RELOCATED_FILENAME = "%s-relocated.jar";
+ private static final @NotNull String RELOCATED_FILENAME = "%s-relocated.jar";
- private final Dragonfly dragonfly;
+ private final @NotNull Dragonfly dragonfly;
private final boolean deleteOld;
- private final DragonflyClassLoader classLoader;
- private final DependencyLoader dependencyLoader;
+ private final @NotNull DragonflyClassLoader classLoader;
+ private final @NotNull DependencyLoader dependencyLoader;
private boolean dependenciesLoaded;
- private Constructor<?> constructor;
- private Method method;
+ private @Nullable Constructor<?> constructor;
+ private @Nullable Method method;
@Internal
- public DependencyRelocator(Dragonfly dragonfly, boolean deleteOld) {
+ public DependencyRelocator(@NotNull Dragonfly dragonfly, boolean deleteOld) {
this.dragonfly = dragonfly;
this.deleteOld = deleteOld;
this.classLoader = new DragonflyClassLoader(getClass().getClassLoader());
diff --git a/src/main/java/dev/hypera/dragonfly/relocation/Relocation.java b/src/main/java/dev/hypera/dragonfly/relocation/Relocation.java
index d88c529..8b80923 100644
--- a/src/main/java/dev/hypera/dragonfly/relocation/Relocation.java
+++ b/src/main/java/dev/hypera/dragonfly/relocation/Relocation.java
@@ -32,10 +32,10 @@ import org.jetbrains.annotations.NotNull;
*/
public class Relocation {
- private final String from;
- private final String to;
+ private final @NotNull String from;
+ private final @NotNull String to;
- private Relocation(String from, String to) {
+ private Relocation(@NotNull String from, @NotNull String to) {
this.from = from.replace("\\.", ".");
this.to = to;
}
@@ -44,11 +44,11 @@ public class Relocation {
return new Relocation(from, to);
}
- public String getFrom() {
+ public @NotNull String getFrom() {
return from;
}
- public String getTo() {
+ public @NotNull String getTo() {
return to;
}
diff --git a/src/main/java/dev/hypera/dragonfly/resolvers/impl/MavenResolver.java b/src/main/java/dev/hypera/dragonfly/resolvers/impl/MavenResolver.java
index 16c9d1f..4f01643 100644
--- a/src/main/java/dev/hypera/dragonfly/resolvers/impl/MavenResolver.java
+++ b/src/main/java/dev/hypera/dragonfly/resolvers/impl/MavenResolver.java
@@ -40,7 +40,7 @@ import org.jetbrains.annotations.Nullable;
*/
public class MavenResolver implements IResolver<MavenDependency> {
- private static final String FORMAT = "%s%s/%s/%s/%s-%s.jar";
+ private static final @NotNull String FORMAT = "%s%s/%s/%s/%s-%s.jar";
@Override
public @Nullable String resolve(@NotNull Dragonfly dragonfly, @NotNull MavenDependency dependency) throws ResolveFailureException {
diff --git a/src/main/java/dev/hypera/dragonfly/resolvers/impl/MavenSnapshotResolver.java b/src/main/java/dev/hypera/dragonfly/resolvers/impl/MavenSnapshotResolver.java
index 83043b8..c08df23 100644
--- a/src/main/java/dev/hypera/dragonfly/resolvers/impl/MavenSnapshotResolver.java
+++ b/src/main/java/dev/hypera/dragonfly/resolvers/impl/MavenSnapshotResolver.java
@@ -27,16 +27,19 @@ import dev.hypera.dragonfly.Dragonfly;
import dev.hypera.dragonfly.dependency.impl.MavenDependency;
import dev.hypera.dragonfly.exceptions.ResolveFailureException;
import dev.hypera.dragonfly.resolvers.IResolver;
+import java.io.IOException;
import java.io.StringReader;
import java.util.Set;
import java.util.stream.Collectors;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
+import sun.tools.jstat.ParserException;
/**
* Maven snapshot resolver.
@@ -45,8 +48,26 @@ import org.xml.sax.InputSource;
*/
public class MavenSnapshotResolver implements IResolver<MavenDependency> {
- private static final String FORMAT = "%s%s/%s/%s/maven-metadata.xml";
- private static final String OUTPUT_FORMAT = "%s/%s-%s-%s-%s.jar";
+ private static final @NotNull String FORMAT = "%s%s/%s/%s/maven-metadata.xml";
+ private static final @NotNull String OUTPUT_FORMAT = "%s/%s-%s-%s-%s.jar";
+ private final @NotNull DocumentBuilderFactory documentBuilderFactory;
+
+ public MavenSnapshotResolver() {
+ try {
+ /* The below is an attempt to create an XML parser while preventing XML External Entity attacks */
+ /* Read more: https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#java */
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ factory.setXIncludeAware(false);
+ factory.setExpandEntityReferences(false);
+ this.documentBuilderFactory = factory;
+ } catch (ParserConfigurationException ex) {
+ throw new RuntimeException("Failed to create DocumentBuilderFactory", ex);
+ }
+ }
@Override
public @Nullable String resolve(@NotNull Dragonfly dragonfly, @NotNull MavenDependency dependency) throws ResolveFailureException {
@@ -72,7 +93,7 @@ public class MavenSnapshotResolver implements IResolver<MavenDependency> {
}
try {
- DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(data)));
Element root = document.getDocumentElement();
Element snapshotData = (Element) root.getElementsByTagName("snapshot").item(0);
|