Skip to content

Instantly share code, notes, and snippets.

@yyamano
Created March 17, 2016 10:11
Show Gist options
  • Save yyamano/6419f409c0cbf11ee3b7 to your computer and use it in GitHub Desktop.
Save yyamano/6419f409c0cbf11ee3b7 to your computer and use it in GitHub Desktop.
diff --git a/src/main/java/org/raml/parser/loader/FileResourceLoader.java b/src/main/java/org/raml/parser/loader/FileResourceLoader.java
index 5ec1e11..883b5bd 100644
--- a/src/main/java/org/raml/parser/loader/FileResourceLoader.java
+++ b/src/main/java/org/raml/parser/loader/FileResourceLoader.java
@@ -42,12 +42,15 @@ public class FileResourceLoader implements ResourceLoader
@Override
public InputStream fetchResource(String resourceName)
{
- File includedFile = new File(parentPath, resourceName);
+ File includedFile = new File(resourceName);
+ if (!includedFile.isAbsolute()) {
+ includedFile = new File(parentPath, resourceName);
+ if (logger.isDebugEnabled())
+ {
+ logger.debug(String.format("Looking for resource: %s on directory: %s...", resourceName, parentPath));
+ }
+ }
FileInputStream inputStream = null;
- if (logger.isDebugEnabled())
- {
- logger.debug(String.format("Looking for resource: %s on directory: %s...", resourceName, parentPath));
- }
try
{
return new FileInputStream(includedFile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment