File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
src/main/java/org/eclipse/yasson/internal/deserializer/types Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2021, 2026 Oracle and/or its affiliates. All rights reserved.
33 *
44 * This program and the accompanying materials are made available under the
55 * terms of the Eclipse Public License v. 2.0 which is available at
1414
1515import java .lang .reflect .Type ;
1616import java .net .URI ;
17+ import java .net .URISyntaxException ;
1718
1819import org .eclipse .yasson .internal .DeserializationContextImpl ;
1920
21+ import jakarta .json .bind .JsonbException ;
22+
2023/**
2124 * Deserializer of the {@link URI} type.
2225 */
@@ -28,6 +31,11 @@ class UriDeserializer extends TypeDeserializer {
2831
2932 @ Override
3033 Object deserializeStringValue (String value , DeserializationContextImpl context , Type rType ) {
31- return URI .create (value );
34+ try {
35+ return new URI (value );
36+ } catch (URISyntaxException e ) {
37+ // Exception will be caught and wrapped
38+ throw new JsonbException ("java.net.URI could not parse value " + value , e );
39+ }
3240 }
3341}
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2021, 2026 Oracle and/or its affiliates. All rights reserved.
33 *
44 * This program and the accompanying materials are made available under the
55 * terms of the Eclipse Public License v. 2.0 which is available at
1212
1313package org .eclipse .yasson .internal .deserializer .types ;
1414
15+ import jakarta .json .bind .JsonbException ;
16+
1517import java .lang .reflect .Type ;
1618import java .net .MalformedURLException ;
1719import java .net .URL ;
@@ -29,12 +31,10 @@ class UrlDeserializer extends TypeDeserializer {
2931
3032 @ Override
3133 Object deserializeStringValue (String value , DeserializationContextImpl context , Type rType ) {
32- URL url = null ;
3334 try {
34- url = new URL (value );
35+ return new URL (value );
3536 } catch (MalformedURLException e ) {
36- e . printStackTrace ( );
37+ throw new JsonbException ( "java.net.URL could not parse value " + value , e );
3738 }
38- return url ;
3939 }
4040}
You can’t perform that action at this time.
0 commit comments