forked from mvnpm/mvnpm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mvnpm#1296 from phillip-kruger/pinkie
Small fixes
- Loading branch information
Showing
10 changed files
with
175 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,4 @@ nbactions.xml | |
# Local environment | ||
.env | ||
/dev.sh | ||
/local.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.mvnpm.npm.model; | ||
|
||
import java.net.URL; | ||
|
||
public record License(String type, URL url) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package io.mvnpm.npm.model; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
import com.fasterxml.jackson.core.JacksonException; | ||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.databind.DeserializationContext; | ||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer; | ||
|
||
/** | ||
* To handle some License values that comes in with a String only | ||
* | ||
* @author Phillip Kruger ([email protected]) | ||
*/ | ||
public class LicenseDeserializer extends StdDeserializer<License> { | ||
|
||
public LicenseDeserializer() { | ||
this(null); | ||
} | ||
|
||
public LicenseDeserializer(Class<?> vc) { | ||
super(vc); | ||
} | ||
|
||
@Override | ||
public License deserialize(JsonParser jp, DeserializationContext dc) throws IOException, JacksonException { | ||
try { | ||
return jp.readValueAs(License.class); | ||
} catch (Throwable t) { | ||
// Let try with String | ||
try { | ||
URL url = jp.readValueAs(URL.class); | ||
return new License(null, url); | ||
} catch (Throwable tt) { | ||
try { | ||
String type = jp.readValueAs(String.class); | ||
return new License(type, null); | ||
} catch (Throwable ttt) { | ||
try { | ||
String type = jp.getText(); | ||
return new License(type, null); | ||
} catch (Throwable tttt) { | ||
ttt.printStackTrace(); | ||
return null; | ||
} | ||
|
||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/io/mvnpm/npm/model/RepositoryDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.mvnpm.npm.model; | ||
|
||
import java.io.IOException; | ||
|
||
import com.fasterxml.jackson.core.JacksonException; | ||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.databind.DeserializationContext; | ||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer; | ||
|
||
/** | ||
* To handle some Repository values that comes in with a String only | ||
* | ||
* @author Phillip Kruger ([email protected]) | ||
*/ | ||
public class RepositoryDeserializer extends StdDeserializer<Repository> { | ||
|
||
public RepositoryDeserializer() { | ||
this(null); | ||
} | ||
|
||
public RepositoryDeserializer(Class<?> vc) { | ||
super(vc); | ||
} | ||
|
||
@Override | ||
public Repository deserialize(JsonParser jp, DeserializationContext dc) throws IOException, JacksonException { | ||
try { | ||
return jp.readValueAs(Repository.class); | ||
} catch (Throwable t) { | ||
// Let try with String | ||
try { | ||
String url = jp.readValueAs(String.class); | ||
return new Repository(null, url, null); | ||
} catch (Throwable tt) { | ||
tt.printStackTrace(); | ||
return null; | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters