-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing problems with remote URL when using Maven Plugin #1614
base: master
Are you sure you want to change the base?
Conversation
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.jsonschema2pojo.URLProtocol; | ||
|
||
public class URLUtil { | ||
|
||
private static final Set<URLProtocol> LOCAL_PROTOCOL = Arrays.stream(new URLProtocol[]{URLProtocol.NO_PROTOCOL, URLProtocol.FILE}).collect(Collectors.toSet()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this just be replaced by Set.of
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid it can't since Set::of
was introduced in Java 9 and current compiler configuration is:
Lines 213 to 223 in 34cc693
<plugin> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<configuration> | |
<encoding>UTF-8</encoding> | |
<source>1.8</source> | |
<target>1.8</target> | |
<compilerArgs> | |
<arg>-Xlint</arg> | |
</compilerArgs> | |
</configuration> | |
</plugin> |
That being said it could be changed to = EnumSet.of(URLProtocol.NO_PROTOCOL, URLProtocol.FILE)
with a small caveat - resulting set would be mutable (however that shouldn't be a problem since it's private and there are no methods returning it's reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the corresponding line. I am now using an EnumSet wrapped in an unmodifiable set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joelittlejohn: Can it be merged now?
When using remote URL's like an HTTP-Url as sourcePaths input. The URL's have been normalized to a file like notation. Afterwards the type generator was unable to resolve the remote file.