44import com .fasterxml .jackson .annotation .JsonInclude ;
55import com .fasterxml .jackson .annotation .JsonInclude .Include ;
66import com .fasterxml .jackson .annotation .JsonProperty ;
7- import com . fasterxml .jackson .core .type .TypeReference ;
8- import com . fasterxml .jackson .databind .JsonNode ;
9- import com . fasterxml .jackson .databind .ObjectMapper ;
10- import com . fasterxml .jackson .databind .node .ArrayNode ;
11- import com . fasterxml .jackson .databind .node .ObjectNode ;
7+ import tools .jackson .core .type .TypeReference ;
8+ import tools .jackson .databind .JsonNode ;
9+ import tools .jackson .databind .ObjectMapper ;
10+ import tools .jackson .databind .node .ArrayNode ;
11+ import tools .jackson .databind .node .ObjectNode ;
1212import io .frictionlessdata .datapackage .exceptions .DataPackageException ;
1313import io .frictionlessdata .datapackage .exceptions .DataPackageFileOrUrlNotFoundException ;
1414import io .frictionlessdata .datapackage .exceptions .DataPackageValidationException ;
1818import io .frictionlessdata .tableschema .exception .JsonParsingException ;
1919import io .frictionlessdata .tableschema .exception .ValidationException ;
2020import io .frictionlessdata .tableschema .util .JsonUtil ;
21- import org .apache .commons .collections .list .UnmodifiableList ;
22- import org .apache .commons .collections .set .UnmodifiableSet ;
21+ import org .apache .commons .collections4 .list .UnmodifiableList ;
22+ import org .apache .commons .collections4 .set .UnmodifiableSet ;
2323import org .apache .commons .lang3 .StringUtils ;
2424
2525import java .io .*;
@@ -273,7 +273,7 @@ public String getId() {
273273 public Set <String > getKeywords () {
274274 if (null == keywords )
275275 return null ;
276- return UnmodifiableSet .decorate (keywords );
276+ return UnmodifiableSet .unmodifiableSet (keywords );
277277 }
278278
279279 @ JsonProperty ("version" )
@@ -334,7 +334,7 @@ public ZonedDateTime getCreated() {
334334 public List <Contributor > getContributors () {
335335 if (null == contributors )
336336 return null ;
337- return UnmodifiableList .decorate (contributors );
337+ return UnmodifiableList .unmodifiableList (contributors );
338338 }
339339
340340 /**
@@ -348,7 +348,7 @@ public Object getProperty(String key) {
348348 JsonNode jNode = jsonObject .get (key );
349349 if (jNode .isArray ()) {
350350 return getProperty (key , new TypeReference <ArrayList <?>>() {});
351- } else if (jNode .isTextual ()) {
351+ } else if (jNode .isString ()) {
352352 return getProperty (key , new TypeReference <String >() {});
353353 } else if (jNode .isBoolean ()) {
354354 return getProperty (key , new TypeReference <Boolean >() {});
@@ -716,7 +716,7 @@ final URL getBaseUrl(){
716716 private ObjectNode getJsonNode (){
717717 ObjectNode objectNode = (ObjectNode ) JsonUtil .getInstance ().createNode (this );
718718 // update any manually set properties
719- this .jsonObject .fields ().forEachRemaining (f ->{
719+ this .jsonObject .properties (). iterator ().forEachRemaining (f ->{
720720 // but do not overwrite properties set via the API
721721 if (!wellKnownKeys .contains (f .getKey ())) {
722722 objectNode .set (f .getKey (), f .getValue ());
@@ -813,8 +813,8 @@ private void setJson(ObjectNode jsonNodeSource) throws Exception {
813813 this .setVersion (textValueOrNull (jsonNodeSource , Package .JSON_KEY_VERSION ));
814814
815815 if (jsonNodeSource .has (Package .JSON_KEY_HOMEPAGE ) &&
816- StringUtils .isNotEmpty (jsonNodeSource .get (Package .JSON_KEY_HOMEPAGE ).asText ())) {
817- this .setHomepage ( new URL (jsonNodeSource .get (Package .JSON_KEY_HOMEPAGE ).asText ()));
816+ StringUtils .isNotEmpty (jsonNodeSource .get (Package .JSON_KEY_HOMEPAGE ).asString ())) {
817+ this .setHomepage ( new URL (jsonNodeSource .get (Package .JSON_KEY_HOMEPAGE ).asString ()));
818818 }
819819
820820 this .setImagePath (textValueOrNull (jsonNodeSource , Package .JSON_KEY_IMAGE ));
@@ -826,13 +826,13 @@ private void setJson(ObjectNode jsonNodeSource) throws Exception {
826826 if (jsonNodeSource .has (Package .JSON_KEY_KEYWORDS )) {
827827 ArrayNode arr = (ArrayNode ) jsonObject .get (Package .JSON_KEY_KEYWORDS );
828828 for (int i = 0 ; i < arr .size (); i ++) {
829- this .addKeyword (arr .get (i ).asText ());
829+ this .addKeyword (arr .get (i ).asString ());
830830 }
831831 }
832832 List <String > wellKnownKeys = Arrays .asList (JSON_KEY_NAME , JSON_KEY_RESOURCES , JSON_KEY_ID , JSON_KEY_VERSION ,
833833 JSON_KEY_HOMEPAGE , JSON_KEY_IMAGE , JSON_KEY_CREATED , JSON_KEY_CONTRIBUTORS ,
834834 JSON_KEY_KEYWORDS );
835- jsonNodeSource .fieldNames ().forEachRemaining ((k ) -> {
835+ jsonNodeSource .propertyNames (). iterator ().forEachRemaining ((k ) -> {
836836 if (!wellKnownKeys .contains (k )) {
837837 JsonNode obj = jsonNodeSource .get (k );
838838 this .setProperty (k , obj );
@@ -1016,6 +1016,6 @@ private static boolean isArchive(File f) throws IOException {
10161016
10171017
10181018 private static String textValueOrNull (JsonNode source , String fieldName ) {
1019- return source .has (fieldName ) ? source .get (fieldName ).asText () : null ;
1019+ return source .has (fieldName ) ? source .get (fieldName ).asString () : null ;
10201020 }
10211021}
0 commit comments