1919
2020import java .io .IOException ;
2121import java .io .InputStream ;
22- import java .io .UncheckedIOException ;
2322import java .net .URI ;
2423import java .nio .file .Files ;
24+ import java .nio .file .Path ;
2525import java .nio .file .Paths ;
2626import java .util .Properties ;
2727
@@ -36,12 +36,23 @@ public String getEcosystem() {
3636
3737 @ Override
3838 public RecipeBundleReader resolve (RecipeBundle bundle ) {
39- try (InputStream is = Files .exists (Paths .get (bundle .getPackageName ())) ?
40- Files .newInputStream (Paths .get (bundle .getPackageName ())) :
41- URI .create (bundle .getPackageName ()).toURL ().openStream ()) {
42- return new YamlRecipeBundleReader (bundle , is , URI .create (bundle .getPackageName ()), properties );
43- } catch (IOException e ) {
44- throw new UncheckedIOException (e );
39+ try {
40+ Path path = Paths .get (bundle .getPackageName ());
41+ if (Files .exists (path )) {
42+ try (InputStream is = Files .newInputStream (path )) {
43+ return new YamlRecipeBundleReader (bundle , is , path .toUri (), properties );
44+ }
45+ }
46+ } catch (Exception ignored ) {
47+ }
48+
49+ try {
50+ URI resource = URI .create (bundle .getPackageName ());
51+ try (InputStream is = resource .toURL ().openStream ()) {
52+ return new YamlRecipeBundleReader (bundle , is , resource , properties );
53+ }
54+ } catch (Exception e ) {
55+ throw new RuntimeException (e );
4556 }
4657 }
4758}
0 commit comments