You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2019/07/06 16:40:40 UTC
[juneau] branch master updated: JUNEAU-124 Serializers and parsers
should throw specific exceptions.
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new d7be7f0 JUNEAU-124 Serializers and parsers should throw specific exceptions.
d7be7f0 is described below
commit d7be7f098f4a4b3cd62a86b4729a7a87796696ac
Author: JamesBognar <ja...@apache.org>
AuthorDate: Sat Jul 6 12:40:25 2019 -0400
JUNEAU-124 Serializers and parsers should throw specific exceptions.
---
.../{ => source-prefs}/org.eclipse.jdt.core.prefs | 51 ++++-----
.../{ => source-prefs}/org.eclipse.jdt.ui.prefs | 12 --
.../{ => test-prefs}/org.eclipse.jdt.core.prefs | 21 ++--
.../{ => test-prefs}/org.eclipse.jdt.ui.prefs | 0
.../juneau/json/JsonParserEdgeCasesTest.java | 22 ++--
.../org/apache/juneau/PropertyStoreBuilder.java | 1 -
.../org/apache/juneau/csv/CsvParserSession.java | 2 +-
.../org/apache/juneau/html/HtmlParserSession.java | 8 +-
.../apache/juneau/html/HtmlSerializerSession.java | 2 +-
.../org/apache/juneau/internal/DelegateMap.java | 1 -
.../org/apache/juneau/json/JsonParserSession.java | 2 +-
.../java/org/apache/juneau/marshall/Marshall.java | 88 +++++++++++++-
.../juneau/oapi/OpenApiSerializerSession.java | 2 +-
.../main/java/org/apache/juneau/parser/Parser.java | 60 +++++++++-
.../org/apache/juneau/parser/ParserSession.java | 126 +++++++++++++++++++--
.../org/apache/juneau/pojotools/PojoSearcher.java | 1 -
.../serializer/OutputStreamSerializerSession.java | 6 +-
.../org/apache/juneau/serializer/Serializer.java | 3 +-
.../juneau/serializer/SerializerSession.java | 5 +-
.../juneau/serializer/WriterSerializerSession.java | 6 +-
.../org/apache/juneau/svl/VarResolverBuilder.java | 1 -
.../java/org/apache/juneau/utils/ProcBuilder.java | 2 +-
juneau-doc/docs/ReleaseNotes/8.0.1.html | 3 +
.../examples/rest/petstore/PetStoreService.java | 3 +-
.../apache/juneau/rest/test/ConfigResource.java | 2 +-
.../java/org/apache/juneau/rest/test/Root.java | 1 -
.../org/apache/juneau/rest/test/_TestSuite.java | 1 -
.../rest/test/client/CallbackStringsTest.java | 1 -
.../juneau/rest/test/client/ClientFuturesTest.java | 1 -
.../juneau/rest/test/client/FormDataTest.java | 1 -
.../rest/test/client/RequestBeanProxyTest.java | 1 -
.../rest/test/client/RestClientResource.java | 1 -
.../rest/test/client/ThirdPartyProxyResource.java | 2 +-
.../server/config/repository/GetConfiguration.java | 2 +-
.../server/config/repository/GitControl.java | 2 +-
launches/juneau-apply-prefs.sh | 25 ++--
pom.xml | 1 +
37 files changed, 356 insertions(+), 113 deletions(-)
diff --git a/eclipse-preferences/org.eclipse.jdt.core.prefs b/eclipse-preferences/source-prefs/org.eclipse.jdt.core.prefs
similarity index 94%
copy from eclipse-preferences/org.eclipse.jdt.core.prefs
copy to eclipse-preferences/source-prefs/org.eclipse.jdt.core.prefs
index 880e185..c357749 100644
--- a/eclipse-preferences/org.eclipse.jdt.core.prefs
+++ b/eclipse-preferences/source-prefs/org.eclipse.jdt.core.prefs
@@ -1,15 +1,3 @@
-# ***************************************************************************************************************************
-# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-# * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-# * with the License. You may obtain a copy of the License at *
-# * *
-# * http://www.apache.org/licenses/LICENSE-2.0 *
-# * *
-# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-# * specific language governing permissions and limitations under the License. *
-# ***************************************************************************************************************************
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
@@ -20,12 +8,18 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -34,8 +28,9 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=info
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
@@ -45,7 +40,7 @@ org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
@@ -53,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=info
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=info
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
@@ -65,10 +60,10 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=info
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
@@ -81,13 +76,13 @@ org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=info
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
@@ -99,7 +94,7 @@ org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
@@ -107,11 +102,11 @@ org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
diff --git a/eclipse-preferences/org.eclipse.jdt.ui.prefs b/eclipse-preferences/source-prefs/org.eclipse.jdt.ui.prefs
similarity index 86%
copy from eclipse-preferences/org.eclipse.jdt.ui.prefs
copy to eclipse-preferences/source-prefs/org.eclipse.jdt.ui.prefs
index f09a9ac..cfe018f 100644
--- a/eclipse-preferences/org.eclipse.jdt.ui.prefs
+++ b/eclipse-preferences/source-prefs/org.eclipse.jdt.ui.prefs
@@ -1,15 +1,3 @@
-# ***************************************************************************************************************************
-# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-# * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-# * with the License. You may obtain a copy of the License at *
-# * *
-# * http://www.apache.org/licenses/LICENSE-2.0 *
-# * *
-# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-# * specific language governing permissions and limitations under the License. *
-# ***************************************************************************************************************************
cleanup.add_default_serial_version_id=true
cleanup.add_generated_serial_version_id=false
cleanup.add_missing_annotations=true
diff --git a/eclipse-preferences/org.eclipse.jdt.core.prefs b/eclipse-preferences/test-prefs/org.eclipse.jdt.core.prefs
similarity index 95%
rename from eclipse-preferences/org.eclipse.jdt.core.prefs
rename to eclipse-preferences/test-prefs/org.eclipse.jdt.core.prefs
index 880e185..09a3122 100644
--- a/eclipse-preferences/org.eclipse.jdt.core.prefs
+++ b/eclipse-preferences/test-prefs/org.eclipse.jdt.core.prefs
@@ -1,15 +1,3 @@
-# ***************************************************************************************************************************
-# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-# * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-# * with the License. You may obtain a copy of the License at *
-# * *
-# * http://www.apache.org/licenses/LICENSE-2.0 *
-# * *
-# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-# * specific language governing permissions and limitations under the License. *
-# ***************************************************************************************************************************
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
@@ -20,12 +8,18 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=disabled
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -34,6 +28,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
diff --git a/eclipse-preferences/org.eclipse.jdt.ui.prefs b/eclipse-preferences/test-prefs/org.eclipse.jdt.ui.prefs
similarity index 100%
rename from eclipse-preferences/org.eclipse.jdt.ui.prefs
rename to eclipse-preferences/test-prefs/org.eclipse.jdt.ui.prefs
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/json/JsonParserEdgeCasesTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/json/JsonParserEdgeCasesTest.java
index e224d5f..d611882 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/json/JsonParserEdgeCasesTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/json/JsonParserEdgeCasesTest.java
@@ -44,8 +44,8 @@ public class JsonParserEdgeCasesTest {
{ 8, "ix_string_invalid_surrogate", "5B 22 5C 75 64 38 30 30 61 62 63 22 5D"/*["bud800abc"]*/, null },
{ 9, "ix_string_inverted_surrogates_U+1D11E", "5B 22 5C 75 44 64 31 65 5C 75 44 38 33 34 22 5D"/*["buDd1ebuD834"]*/, null },
{ 10, "ix_string_lone_second_surrogate", "5B 22 5C 75 44 46 41 41 22 5D"/*["buDFAA"]*/, null },
- { 11, "ix_string_not_in_unicode_range", "5B 22 F4 BF BF BF 22 5D"/*["[fffd][fffd][fffd][fffd]"]*/, "I/O exception occurred. exception=MalformedInputException" },
- { 12, "ix_string_truncated-utf-8", "5B 22 E0 FF 22 5D"/*["[fffd][fffd]"]*/, "I/O exception occurred. exception=MalformedInputException" },
+ { 11, "ix_string_not_in_unicode_range", "5B 22 F4 BF BF BF 22 5D"/*["[fffd][fffd][fffd][fffd]"]*/, null},
+ { 12, "ix_string_truncated-utf-8", "5B 22 E0 FF 22 5D"/*["[fffd][fffd]"]*/, null },
{ 13, "ix_string_unicode_U+10FFFE_nonchar", "5B 22 5C 75 44 42 46 46 5C 75 44 46 46 45 22 5D"/*["buDBFFbuDFFE"]*/, null },
{ 14, "ix_string_unicode_U+1FFFE_nonchar", "5B 22 5C 75 44 38 33 46 5C 75 44 46 46 45 22 5D"/*["buD83FbuDFFE"]*/, null },
{ 15, "ix_string_unicode_U+FDD0_nonchar", "5B 22 5C 75 46 44 44 30 22 5D"/*["buFDD0"]*/, null },
@@ -222,15 +222,15 @@ public class JsonParserEdgeCasesTest {
{ 186, "nx_string_invalid-utf-8-in-escape", "5B 22 5C 75 E5 22 5D"/*["bu[fffd]"]*/, null },
{ 187, "nx_string_invalid_backslash_esc", "5B 22 5C 61 22 5D"/*["\a"]*/, "Invalid escape sequence" },
{ 188, "nx_string_invalid_unicode_escape", "5B 22 5C 75 71 71 71 71 22 5D"/*["buqqqq"]*/, "Invalid Unicode escape sequence in string" },
- { 189, "nx_string_invalid_utf-8", "5B 22 FF 22 5D"/*["[fffd]"]*/, "MalformedInputException" },
+ { 189, "nx_string_invalid_utf-8", "5B 22 FF 22 5D"/*["[fffd]"]*/, null },
{ 190, "nx_string_invalid_utf8_after_escape", "5B 22 5C E5225D"/*["\[fffd]"]*/, null },
- { 191, "nx_string_iso_latin_1", "5B 22 E9 22 5D"/*["[fffd]"]*/, "MalformedInputException" },
+ { 191, "nx_string_iso_latin_1", "5B 22 E9 22 5D"/*["[fffd]"]*/, null },
{ 192, "nx_string_leading_uescaped_thinspace", "5B 5C 75 30 30 32 30 22 61 73 64 22 5D"/*[bu0020"asd"]*/, "Unrecognized syntax" },
- { 193, "nx_string_lone_utf8_continuation_byte", "5B 22 81 22 5D"/*["[fffd]"]*/, "MalformedInputException" },
+ { 193, "nx_string_lone_utf8_continuation_byte", "5B 22 81 22 5D"/*["[fffd]"]*/, null },
{ 194, "nx_string_no_quotes_with_bad_escape", "5B 5C 6E 5D"/*[\n]*/, "Unrecognized syntax" },
- { 195, "nx_string_overlong_sequence_2_bytes", "5B 22 C0 AF 22 5D"/*["[fffd][fffd]"]*/, "MalformedInputException" },
- { 196, "nx_string_overlong_sequence_6_bytes", "5B 22 FC 83 BF BF BF BF 22 5D"/*["[fffd][fffd][fffd][fffd][fffd][fffd]"]*/, "MalformedInputException" },
- { 197, "nx_string_overlong_sequence_6_bytes_null", "5B 22 FC 80 80 80 80 80 22 5D"/*["[fffd][fffd][fffd][fffd][fffd][fffd]"]*/, "MalformedInputException" },
+ { 195, "nx_string_overlong_sequence_2_bytes", "5B 22 C0 AF 22 5D"/*["[fffd][fffd]"]*/, null },
+ { 196, "nx_string_overlong_sequence_6_bytes", "5B 22 FC 83 BF BF BF BF 22 5D"/*["[fffd][fffd][fffd][fffd][fffd][fffd]"]*/, null },
+ { 197, "nx_string_overlong_sequence_6_bytes_null", "5B 22 FC 80 80 80 80 80 22 5D"/*["[fffd][fffd][fffd][fffd][fffd][fffd]"]*/, null },
{ 198, "nx_string_start_escape_unclosed", "5B 22 5C"/*["\*/, null },
{ 199, "nx_string_unescaped_crtl_char", "5B 22 61 00 61 22 5D"/*["a[0]a"]*/, null },
{ 200, "nx_string_unescaped_newline", "5B 22 6E 65 77 0A 6C 69 6E 65 22 5D"/*["new[a]line"]*/, null },
@@ -387,6 +387,9 @@ public class JsonParserEdgeCasesTest {
} catch (ParseException e) {
if (errorText != null)
assertTrue("Got ParseException but didn't contain expected text '"+errorText+"'. Test="+name+", Input=" + jsonReadable + ", Message=" + e.getRootCause().getMessage(), e.getRootCause().getMessage().contains(errorText));
+ } catch (IOException e) {
+ if (errorText != null)
+ assertTrue("Got ParseException but didn't contain expected text '"+errorText+"'. Test="+name+", Input=" + jsonReadable + ", Message=" + e.getMessage(), e.getMessage().contains(errorText));
} catch (AssertionError e) {
throw e;
} catch (Throwable t) {
@@ -400,6 +403,9 @@ public class JsonParserEdgeCasesTest {
} catch (ParseException e) {
if (errorText != null)
assertTrue("Got ParseException but didn't contain expected text '"+errorText+"'. Test="+name+", Input=" + jsonReadable + ", Message=" + e.getRootCause().getMessage(), e.getRootCause().getMessage().contains(errorText));
+ } catch (IOException e) {
+ if (errorText != null)
+ assertTrue("Got ParseException but didn't contain expected text '"+errorText+"'. Test="+name+", Input=" + jsonReadable + ", Message=" + e.getMessage(), e.getMessage().contains(errorText));
} catch (Throwable t) {
fail("Expected ParseException. Test="+name+", Input=" + jsonReadable + ", Exception=" + t.getClass().getName() + "," +t.getLocalizedMessage());
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStoreBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStoreBuilder.java
index b8e8978..2aae8d3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStoreBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStoreBuilder.java
@@ -844,7 +844,6 @@ public class PropertyStoreBuilder {
add(e.getKey(), e.getValue());
}
- @SuppressWarnings("unchecked")
@Override /* MutableProperty */
synchronized void add(String arg, Object o) {
if (arg != null) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserSession.java
index 203ad2d..de56226 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserSession.java
@@ -49,7 +49,7 @@ public final class CsvParserSession extends ReaderParserSession {
}
@SuppressWarnings({})
- private <T> T parseAnything(ClassMeta<T> eType, ParserReader r, Object outer, BeanPropertyMeta pMeta) throws IOException, ParseException {
+ private <T> T parseAnything(ClassMeta<T> eType, ParserReader r, Object outer, BeanPropertyMeta pMeta) throws ParseException {
throw new ParseException("Not implemented.");
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java
index 45790db..79e19e9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java
@@ -285,7 +285,7 @@ public final class HtmlParserSession extends XmlParserSession {
/*
* For parsing output from HtmlDocSerializer, this skips over the head, title, and links.
*/
- private HtmlTag skipToData(XmlReader r) throws IOException, ParseException, XMLStreamException {
+ private HtmlTag skipToData(XmlReader r) throws ParseException, XMLStreamException {
while (true) {
int event = r.next();
if (event == START_ELEMENT && "div".equals(r.getLocalName()) && "data".equals(r.getAttributeValue(null, "id"))) {
@@ -524,7 +524,7 @@ public final class HtmlParserSession extends XmlParserSession {
* Precondition: Must be pointing before the event we want to parse.
* Postcondition: Pointing at the tag just parsed.
*/
- private HtmlTag nextTag(XmlReader r, HtmlTag...expected) throws IOException, ParseException, XMLStreamException {
+ private HtmlTag nextTag(XmlReader r, HtmlTag...expected) throws ParseException, XMLStreamException {
int et = r.next();
while (et != START_ELEMENT && et != END_ELEMENT && et != END_DOCUMENT)
@@ -552,7 +552,7 @@ public final class HtmlParserSession extends XmlParserSession {
* @param r The stream being read from.
* @throws XMLStreamException
*/
- private void skipTag(XmlReader r) throws IOException, ParseException, XMLStreamException {
+ private void skipTag(XmlReader r) throws ParseException, XMLStreamException {
int et = r.getEventType();
if (et != START_ELEMENT)
@@ -580,7 +580,7 @@ public final class HtmlParserSession extends XmlParserSession {
}
}
- private void skipTag(XmlReader r, HtmlTag...expected) throws IOException, ParseException, XMLStreamException {
+ private void skipTag(XmlReader r, HtmlTag...expected) throws ParseException, XMLStreamException {
HtmlTag tag = HtmlTag.forEvent(this, r);
if (tag.isOneOf(expected))
r.next();
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
index 0881c12..f17bf73 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
@@ -371,7 +371,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
return cr;
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({ "rawtypes" })
private void serializeMap(XmlWriter out, Map m, ClassMeta<?> sType,
ClassMeta<?> eKeyType, ClassMeta<?> eValueType, String typeName, BeanPropertyMeta ppMeta) throws IOException, SerializeException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/DelegateMap.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/DelegateMap.java
index 7341f6b..4a66687 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/DelegateMap.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/DelegateMap.java
@@ -33,7 +33,6 @@ public class DelegateMap<T extends Map> extends ObjectMap implements Delegate<T>
* @param m The metadata object that created this delegate object.
* @param session The current bean session.
*/
- @SuppressWarnings("unchecked")
public DelegateMap(T m, BeanSession session) {
this.classMeta = session.getClassMetaForObject(m);
for (Map.Entry e : (Set<Map.Entry>)m.entrySet())
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
index 0540718..586fdc4 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
@@ -237,7 +237,7 @@ public final class JsonParserSession extends ReaderParserSession {
return parseNumber(r, parseNumberString(r), type);
}
- private Number parseNumber(ParserReader r, String s, Class<? extends Number> type) throws IOException, ParseException {
+ private Number parseNumber(ParserReader r, String s, Class<? extends Number> type) throws ParseException {
// JSON has slightly different number rules from Java.
// Strict mode enforces these different rules, lax does not.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/marshall/Marshall.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/marshall/Marshall.java
index ed0dfb9..15ef4f9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/marshall/Marshall.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/marshall/Marshall.java
@@ -119,8 +119,9 @@ public abstract class Marshall {
* <li>{@link File}
* </ul>
* @throws SerializeException If a problem occurred trying to convert the output.
+ * @throws IOException Thrown by underlying stream.
*/
- public final void write(Object o, Object output) throws SerializeException {
+ public final void write(Object o, Object output) throws SerializeException, IOException {
s.createSession().serialize(o, output);
}
@@ -298,9 +299,51 @@ public abstract class Marshall {
* <br>Ignored if the main type is not a map or collection.
* @return The parsed object.
* @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
* @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections.
*/
- public final <T> T read(Object input, Type type, Type...args) throws ParseException {
+ public final <T> T read(Object input, Type type, Type...args) throws ParseException, IOException {
+ return p.createSession().parse(input, type, args);
+ }
+
+ /**
+ * Same as {@link #read(Object,Type,Type...)} but reads from a string and thus doesn't throw an <c>IOException</c>.
+ *
+ * @param <T> The class type of the object to create.
+ * @param input
+ * The input.
+ * <br>Character-based parsers can handle the following input class types:
+ * <ul>
+ * <li><jk>null</jk>
+ * <li>{@link Reader}
+ * <li>{@link CharSequence}
+ * <li>{@link InputStream} containing UTF-8 encoded text (or charset defined by
+ * {@link ReaderParser#RPARSER_streamCharset} property value).
+ * <li><code><jk>byte</jk>[]</code> containing UTF-8 encoded text (or charset defined by
+ * {@link ReaderParser#RPARSER_streamCharset} property value).
+ * <li>{@link File} containing system encoded text (or charset defined by
+ * {@link ReaderParser#RPARSER_fileCharset} property value).
+ * </ul>
+ * <br>Stream-based parsers can handle the following input class types:
+ * <ul>
+ * <li><jk>null</jk>
+ * <li>{@link InputStream}
+ * <li><code><jk>byte</jk>[]</code>
+ * <li>{@link File}
+ * <li>{@link CharSequence} containing encoded bytes according to the {@link InputStreamParser#ISPARSER_binaryFormat} setting.
+ * </ul>
+ * @param type
+ * The object type to create.
+ * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
+ * @param args
+ * The type arguments of the class if it's a collection or map.
+ * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
+ * <br>Ignored if the main type is not a map or collection.
+ * @return The parsed object.
+ * @throws ParseException Malformed input encountered.
+ * @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections.
+ */
+ public final <T> T read(String input, Type type, Type...args) throws ParseException {
return p.createSession().parse(input, type, args);
}
@@ -337,8 +380,47 @@ public abstract class Marshall {
* @param type The object type to create.
* @return The parsed object.
* @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
+ */
+ public final <T> T read(Object input, Class<T> type) throws ParseException, IOException {
+ return p.createSession().parse(input, type);
+ }
+
+ /**
+ * Same as {@link #read(Object,Class)} but reads from a string and thus doesn't throw an <c>IOException</c>.
+ *
+ * <p>
+ * This is the preferred parse method for simple types since you don't need to cast the results.
+ *
+ * <h5 class='section'>Examples:</h5>
+ * <p class='bcode w800'>
+ * Marshall m = Json.<jsf>DEFAULT</jsf>;
+ *
+ * <jc>// Parse into a string.</jc>
+ * String s = m.read(json, String.<jk>class</jk>);
+ *
+ * <jc>// Parse into a bean.</jc>
+ * MyBean b = m.read(json, MyBean.<jk>class</jk>);
+ *
+ * <jc>// Parse into a bean array.</jc>
+ * MyBean[] ba = m.read(json, MyBean[].<jk>class</jk>);
+ *
+ * <jc>// Parse into a linked-list of objects.</jc>
+ * List l = m.read(json, LinkedList.<jk>class</jk>);
+ *
+ * <jc>// Parse into a map of object keys/values.</jc>
+ * Map m = m.read(json, TreeMap.<jk>class</jk>);
+ * </p>
+ *
+ * @param <T> The class type of the object being created.
+ * @param input
+ * The input.
+ * See {@link #read(Object, Type, Type...)} for details.
+ * @param type The object type to create.
+ * @return The parsed object.
+ * @throws ParseException Malformed input encountered.
*/
- public final <T> T read(Object input, Class<T> type) throws ParseException {
+ public final <T> T read(String input, Class<T> type) throws ParseException {
return p.createSession().parse(input, type);
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializerSession.java
index ee88303..a72f691 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializerSession.java
@@ -219,7 +219,7 @@ public class OpenApiSerializerSession extends UonSerializerSession {
return out;
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({ "rawtypes" })
private Map toMap(HttpPartType partType, ClassMeta<?> type, Object o, HttpPartSchema s) throws SerializeException, SchemaValidationException {
if (s == null)
s = DEFAULT_SCHEMA;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
index e8f1fb7..50e365a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
@@ -627,9 +627,31 @@ public abstract class Parser extends BeanContext {
* <br>Ignored if the main type is not a map or collection.
* @return The parsed object.
* @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
* @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections.
*/
- public final <T> T parse(Object input, Type type, Type...args) throws ParseException {
+ public final <T> T parse(Object input, Type type, Type...args) throws ParseException, IOException {
+ return createSession().parse(input, type, args);
+ }
+
+ /**
+ * Same as {@link #parse(Object, Type, Type...)} but since it's a {@link String} input doesn't throw an {@link IOException}.
+ *
+ * @param <T> The class type of the object being created.
+ * @param input
+ * The input.
+ * See {@link #parse(Object, Type, Type...)} for details.
+ * @param type
+ * The object type to create.
+ * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
+ * @param args
+ * The type arguments of the class if it's a collection or map.
+ * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
+ * <br>Ignored if the main type is not a map or collection.
+ * @return The parsed object.
+ * @throws ParseException Malformed input encountered.
+ */
+ public final <T> T parse(String input, Type type, Type...args) throws ParseException {
return createSession().parse(input, type, args);
}
@@ -666,8 +688,24 @@ public abstract class Parser extends BeanContext {
* @param type The object type to create.
* @return The parsed object.
* @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by the underlying stream.
*/
- public final <T> T parse(Object input, Class<T> type) throws ParseException {
+ public final <T> T parse(Object input, Class<T> type) throws ParseException, IOException {
+ return createSession().parse(input, type);
+ }
+
+ /**
+ * Same as {@link #parse(Object, Class)} but since it's a {@link String} input doesn't throw an {@link IOException}.
+ *
+ * @param <T> The class type of the object being created.
+ * @param input
+ * The input.
+ * See {@link #parse(Object, Type, Type...)} for details.
+ * @param type The object type to create.
+ * @return The parsed object.
+ * @throws ParseException Malformed input encountered.
+ */
+ public final <T> T parse(String input, Class<T> type) throws ParseException {
return createSession().parse(input, type);
}
@@ -685,8 +723,24 @@ public abstract class Parser extends BeanContext {
* @param type The object type to create.
* @return The parsed object.
* @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by the underlying stream.
+ */
+ public final <T> T parse(Object input, ClassMeta<T> type) throws ParseException, IOException {
+ return createSession().parse(input, type);
+ }
+
+ /**
+ * Same as {@link #parse(Object, ClassMeta)} but since it's a {@link String} input doesn't throw an {@link IOException}.
+ *
+ * @param <T> The class type of the object being created.
+ * @param input
+ * The input.
+ * See {@link #parse(Object, Type, Type...)} for details.
+ * @param type The object type to create.
+ * @return The parsed object.
+ * @throws ParseException Malformed input encountered.
*/
- public final <T> T parse(Object input, ClassMeta<T> type) throws ParseException {
+ public final <T> T parse(String input, ClassMeta<T> type) throws ParseException {
return createSession().parse(input, type);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
index d7f198f..ff5e946 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
@@ -390,15 +390,61 @@ public abstract class ParserSession extends BeanSession {
* @return The parsed object.
* @throws ParseException Malformed input encountered.
* @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections.
+ * @throws IOException Thrown by the underlying stream.
*/
@SuppressWarnings("unchecked")
- public final <T> T parse(Object input, Type type, Type...args) throws ParseException {
+ public final <T> T parse(Object input, Type type, Type...args) throws ParseException, IOException {
try (ParserPipe pipe = createPipe(input)) {
return (T)parseInner(pipe, getClassMeta(type, args));
}
}
/**
+ * Same as {@link #parse(Object,Type,Type...)} but parses from a string and doesn't throw an {@link IOException}.
+ *
+ * @param <T> The class type of the object to create.
+ * @param input
+ * The input.
+ * <br>Character-based parsers can handle the following input class types:
+ * <ul>
+ * <li><jk>null</jk>
+ * <li>{@link Reader}
+ * <li>{@link CharSequence}
+ * <li>{@link InputStream} containing UTF-8 encoded text (or charset defined by
+ * {@link ReaderParser#RPARSER_streamCharset} property value).
+ * <li><code><jk>byte</jk>[]</code> containing UTF-8 encoded text (or charset defined by
+ * {@link ReaderParser#RPARSER_streamCharset} property value).
+ * <li>{@link File} containing system encoded text (or charset defined by
+ * {@link ReaderParser#RPARSER_fileCharset} property value).
+ * </ul>
+ * <br>Stream-based parsers can handle the following input class types:
+ * <ul>
+ * <li><jk>null</jk>
+ * <li>{@link InputStream}
+ * <li><code><jk>byte</jk>[]</code>
+ * <li>{@link File}
+ * </ul>
+ * @param type
+ * The object type to create.
+ * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
+ * @param args
+ * The type arguments of the class if it's a collection or map.
+ * <br>Can be any of the following: {@link ClassMeta}, {@link Class}, {@link ParameterizedType}, {@link GenericArrayType}
+ * <br>Ignored if the main type is not a map or collection.
+ * @return The parsed object.
+ * @throws ParseException Malformed input encountered.
+ * @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections.
+ */
+ @SuppressWarnings("unchecked")
+ public final <T> T parse(String input, Type type, Type...args) throws ParseException {
+ try (ParserPipe pipe = createPipe(input)) {
+ return (T)parseInner(pipe, getClassMeta(type, args));
+ } catch (IOException e) {
+ throw new ParseException(e); // Shouldn't happen.
+ }
+ }
+
+ /**
* Same as {@link #parse(Object, Type, Type...)} except optimized for a non-parameterized class.
*
* <p>
@@ -431,10 +477,53 @@ public abstract class ParserSession extends BeanSession {
* @param type The object type to create.
* @return The parsed object.
* @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by the underlying stream.
+ */
+ public final <T> T parse(Object input, Class<T> type) throws ParseException, IOException {
+ try (ParserPipe pipe = createPipe(input)) {
+ return parseInner(pipe, getClassMeta(type));
+ }
+ }
+
+ /**
+ * Same as {@link #parse(Object, Class)} but parses from a string and doesn't throw an {@link IOException}.
+ *
+ * <p>
+ * This is the preferred parse method for simple types since you don't need to cast the results.
+ *
+ * <h5 class='section'>Examples:</h5>
+ * <p class='bcode w800'>
+ * ReaderParser p = JsonParser.<jsf>DEFAULT</jsf>;
+ *
+ * <jc>// Parse into a string.</jc>
+ * String s = p.parse(json, String.<jk>class</jk>);
+ *
+ * <jc>// Parse into a bean.</jc>
+ * MyBean b = p.parse(json, MyBean.<jk>class</jk>);
+ *
+ * <jc>// Parse into a bean array.</jc>
+ * MyBean[] ba = p.parse(json, MyBean[].<jk>class</jk>);
+ *
+ * <jc>// Parse into a linked-list of objects.</jc>
+ * List l = p.parse(json, LinkedList.<jk>class</jk>);
+ *
+ * <jc>// Parse into a map of object keys/values.</jc>
+ * Map m = p.parse(json, TreeMap.<jk>class</jk>);
+ * </p>
+ *
+ * @param <T> The class type of the object being created.
+ * @param input
+ * The input.
+ * See {@link #parse(Object, Type, Type...)} for details.
+ * @param type The object type to create.
+ * @return The parsed object.
+ * @throws ParseException Malformed input encountered.
*/
- public final <T> T parse(Object input, Class<T> type) throws ParseException {
+ public final <T> T parse(String input, Class<T> type) throws ParseException {
try (ParserPipe pipe = createPipe(input)) {
return parseInner(pipe, getClassMeta(type));
+ } catch (IOException e) {
+ throw new ParseException(e); // Shouldn't happen.
}
}
@@ -452,10 +541,33 @@ public abstract class ParserSession extends BeanSession {
* @param type The object type to create.
* @return The parsed object.
* @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by the underlying stream.
+ */
+ public final <T> T parse(Object input, ClassMeta<T> type) throws ParseException, IOException {
+ try (ParserPipe pipe = createPipe(input)) {
+ return parseInner(pipe, type);
+ }
+ }
+
+ /**
+ * Same as {@link #parse(Object, ClassMeta)} except parses from a string and doesn't throw an {@link IOException}.
+ *
+ * <p>
+ * This is mostly an internal method used by the framework.
+ *
+ * @param <T> The class type of the object being created.
+ * @param input
+ * The input.
+ * See {@link #parse(Object, Type, Type...)} for details.
+ * @param type The object type to create.
+ * @return The parsed object.
+ * @throws ParseException Malformed input encountered.
*/
- public final <T> T parse(Object input, ClassMeta<T> type) throws ParseException {
+ public final <T> T parse(String input, ClassMeta<T> type) throws ParseException {
try (ParserPipe pipe = createPipe(input)) {
return parseInner(pipe, type);
+ } catch (IOException e) {
+ throw new ParseException(e); // Shouldn't happen.
}
}
@@ -471,19 +583,17 @@ public abstract class ParserSession extends BeanSession {
* @param <T> The class type of the object to create.
* @return The parsed object.
* @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by the underlying stream.
*/
- private <T> T parseInner(ParserPipe pipe, ClassMeta<T> type) throws ParseException {
+ private <T> T parseInner(ParserPipe pipe, ClassMeta<T> type) throws ParseException, IOException {
if (type.isVoid())
return null;
try {
return doParse(pipe, type);
- } catch (ParseException e) {
+ } catch (ParseException | IOException e) {
throw e;
} catch (StackOverflowError e) {
throw new ParseException(this, "Depth too deep. Stack overflow occurred.");
- } catch (IOException e) {
- throw new ParseException(this, e, "I/O exception occurred. exception={0}, message={1}.",
- e.getClass().getSimpleName(), e.getLocalizedMessage());
} catch (Exception e) {
throw new ParseException(this, e, "Exception occurred. exception={0}, message={1}.",
e.getClass().getSimpleName(), e.getLocalizedMessage());
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSearcher.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSearcher.java
index 286e5b8..a2e5a9d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSearcher.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSearcher.java
@@ -95,7 +95,6 @@ public final class PojoSearcher implements PojoTool<SearchArgs> {
Map<String,ColumnMatcher> entryMatchers = new HashMap<>();
BeanSession bs;
- @SuppressWarnings("unchecked")
RowMatcher(BeanSession bs, Map query) {
this.bs = bs;
for (Map.Entry e : (Set<Map.Entry>)query.entrySet())
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerSession.java
index cef7fc9..7a2e01c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerSession.java
@@ -79,7 +79,11 @@ public abstract class OutputStreamSerializerSession extends SerializerSession {
@Override /* SerializerSession */
public final byte[] serialize(Object o) throws SerializeException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- serialize(o, baos);
+ try {
+ serialize(o, baos);
+ } catch (IOException e) {
+ throw new SerializeException(e); // Should never happen.
+ }
return baos.toByteArray();
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
index 78daa12..7181ef9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
@@ -793,8 +793,9 @@ public abstract class Serializer extends BeanTraverseContext {
* <li>{@link File}
* </ul>
* @throws SerializeException If a problem occurred trying to convert the output.
+ * @throws IOException Thrown by the underlying stream.
*/
- public final void serialize(Object o, Object output) throws SerializeException {
+ public final void serialize(Object o, Object output) throws SerializeException, IOException {
createSession().serialize(o, output);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
index e1036b1..455a175 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
@@ -209,11 +209,12 @@ public abstract class SerializerSession extends BeanTraverseSession {
* @param out Where to send the output from the serializer.
* @param o The object to serialize.
* @throws SerializeException If a problem occurred trying to convert the output.
+ * @throws IOException Thrown by the underlying stream.
*/
- public final void serialize(Object o, Object out) throws SerializeException {
+ public final void serialize(Object o, Object out) throws SerializeException, IOException {
try (SerializerPipe pipe = createPipe(out)) {
doSerialize(pipe, o);
- } catch (SerializeException e) {
+ } catch (SerializeException | IOException e) {
throw e;
} catch (StackOverflowError e) {
throw new SerializeException(this,
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializerSession.java
index ed74a48..fd19a37 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializerSession.java
@@ -91,7 +91,11 @@ public abstract class WriterSerializerSession extends SerializerSession {
@Override /* SerializerSession */
public final String serialize(Object o) throws SerializeException {
StringWriter w = new StringWriter();
- serialize(o, w);
+ try {
+ serialize(o, w);
+ } catch (IOException e) {
+ throw new SerializeException(e); // Shouldn't happen.
+ }
return w.toString();
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverBuilder.java
index 81dac6d..f74785a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverBuilder.java
@@ -36,7 +36,6 @@ public class VarResolverBuilder {
*
* @return A new var resolver.
*/
- @SuppressWarnings("unchecked")
public VarResolver build() {
return new VarResolver(vars.toArray(new Class[vars.size()]), contextObjects);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ProcBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ProcBuilder.java
index 7d90b07..a238fd3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ProcBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ProcBuilder.java
@@ -247,7 +247,7 @@ public class ProcBuilder {
* @param env The new set of environment variables.
* @return This object (for method chaining).
*/
- @SuppressWarnings({"rawtypes", "unchecked"})
+ @SuppressWarnings({"rawtypes"})
public ProcBuilder env(Map env) {
if (env != null)
for (Map.Entry e : (Set<Map.Entry>)env.entrySet())
diff --git a/juneau-doc/docs/ReleaseNotes/8.0.1.html b/juneau-doc/docs/ReleaseNotes/8.0.1.html
index d7c389c..f6cb642 100644
--- a/juneau-doc/docs/ReleaseNotes/8.0.1.html
+++ b/juneau-doc/docs/ReleaseNotes/8.0.1.html
@@ -54,6 +54,9 @@
<li class='jm'>{@link oaj.marshall.Marshall#err(String,Object...)} - Prints <c>MessageFormat</c>-style messages to STDERR.
</ul>
</ul>
+ <li>
+ Serializer and parser APIs now throw <c>IOExceptions</c> in addition to <c>SerializeException</c> and <c>ParseException</c> to make it
+ easier to determine if problems are stream based or syntax based.
</ul>
<h5 class='topic w800'>juneau-config</h5>
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/PetStoreService.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/PetStoreService.java
index e24d1da..19f3e17 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/PetStoreService.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/PetStoreService.java
@@ -49,8 +49,9 @@ public class PetStoreService extends AbstractPersistenceService {
* @param w Console output.
* @return This object (for method chaining).
* @throws ParseException Malformed input encountered.
+ * @throws IOException File could not be read from file system.
*/
- public PetStoreService initDirect(PrintWriter w) throws ParseException {
+ public PetStoreService initDirect(PrintWriter w) throws ParseException, IOException {
EntityManager em = getEntityManager();
EntityTransaction et = em.getTransaction();
diff --git a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/ConfigResource.java b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/ConfigResource.java
index b35d0d8..e2bbefc 100644
--- a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/ConfigResource.java
+++ b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/ConfigResource.java
@@ -24,7 +24,7 @@ import org.apache.juneau.rest.annotation.*;
@RestResource(
path="/testConfig"
)
-@SuppressWarnings({"serial","javadoc"})
+@SuppressWarnings({"serial"})
public class ConfigResource extends BasicRestServlet {
@RestMethod(name=GET, path="/")
diff --git a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/Root.java b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/Root.java
index 1a88d23..5847a92 100644
--- a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/Root.java
+++ b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/Root.java
@@ -33,7 +33,6 @@ import org.apache.juneau.rest.test.client.*;
ShutdownResource.class,
}
)
-@SuppressWarnings("javadoc")
public class Root extends BasicRestServlet {
private static final long serialVersionUID = 1L;
diff --git a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/_TestSuite.java b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
index 2c434ec..e1da651 100644
--- a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
+++ b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
@@ -35,7 +35,6 @@ import org.junit.runners.Suite.*;
RestClientTest.class,
ThirdPartyProxyTest.class,
})
-@SuppressWarnings("javadoc")
public class _TestSuite {
@BeforeClass
diff --git a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/CallbackStringsTest.java b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/CallbackStringsTest.java
index 9885f52..45db140 100644
--- a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/CallbackStringsTest.java
+++ b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/CallbackStringsTest.java
@@ -25,7 +25,6 @@ import org.apache.juneau.rest.mock2.*;
import org.junit.*;
import org.junit.runners.*;
-@SuppressWarnings("javadoc")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class CallbackStringsTest {
diff --git a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ClientFuturesTest.java b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ClientFuturesTest.java
index 9c861a9..ec548e1 100644
--- a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ClientFuturesTest.java
+++ b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ClientFuturesTest.java
@@ -25,7 +25,6 @@ import org.apache.juneau.rest.mock2.*;
import org.junit.*;
import org.junit.runners.*;
-@SuppressWarnings("javadoc")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ClientFuturesTest {
diff --git a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/FormDataTest.java b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/FormDataTest.java
index 7c50b7b..89e2b38 100644
--- a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/FormDataTest.java
+++ b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/FormDataTest.java
@@ -30,7 +30,6 @@ import org.junit.*;
/**
* Tests client-side form posts.
*/
-@SuppressWarnings("javadoc")
public class FormDataTest extends RestTestcase {
//=================================================================================================================
diff --git a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/RequestBeanProxyTest.java b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/RequestBeanProxyTest.java
index b3fa415..fe65ba2 100644
--- a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/RequestBeanProxyTest.java
+++ b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/RequestBeanProxyTest.java
@@ -39,7 +39,6 @@ import org.junit.*;
import org.junit.runners.*;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-@SuppressWarnings("javadoc")
public class RequestBeanProxyTest {
//=================================================================================================================
diff --git a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/RestClientResource.java b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/RestClientResource.java
index 0ac63f1..fb98415 100644
--- a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/RestClientResource.java
+++ b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/RestClientResource.java
@@ -22,7 +22,6 @@ import org.apache.juneau.rest.annotation.*;
/**
* JUnit automated testcase resource.
*/
-@SuppressWarnings("javadoc")
@RestResource(
path="/testRestClient"
)
diff --git a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyResource.java b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyResource.java
index 17a7a66..3db48e1 100644
--- a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyResource.java
+++ b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyResource.java
@@ -41,7 +41,7 @@ import org.apache.juneau.utils.*;
path="/testThirdPartyProxy"
)
@SerializerConfig(addRootType="true",addBeanTypes="true")
-@SuppressWarnings({"serial","javadoc"})
+@SuppressWarnings({"serial"})
public class ThirdPartyProxyResource extends BasicRestServletJena {
public static FileWriter logFile;
diff --git a/juneau-sc/juneau-sc-server/src/main/java/org/apache/juneau/server/config/repository/GetConfiguration.java b/juneau-sc/juneau-sc-server/src/main/java/org/apache/juneau/server/config/repository/GetConfiguration.java
index df93eaf..e01be54 100644
--- a/juneau-sc/juneau-sc-server/src/main/java/org/apache/juneau/server/config/repository/GetConfiguration.java
+++ b/juneau-sc/juneau-sc-server/src/main/java/org/apache/juneau/server/config/repository/GetConfiguration.java
@@ -27,7 +27,7 @@ public class GetConfiguration implements Command, GetValue<Map<String, ConfigIte
private static final String EXT = ".cfg";
private static final String BAR = "/";
- private Map<String, ConfigItem> configs = new HashMap<String, ConfigItem>();
+ private Map<String, ConfigItem> configs = new HashMap<>();
private String project;
private String branch;
diff --git a/juneau-sc/juneau-sc-server/src/main/java/org/apache/juneau/server/config/repository/GitControl.java b/juneau-sc/juneau-sc-server/src/main/java/org/apache/juneau/server/config/repository/GitControl.java
index 8ad3240..7782681 100644
--- a/juneau-sc/juneau-sc-server/src/main/java/org/apache/juneau/server/config/repository/GitControl.java
+++ b/juneau-sc/juneau-sc-server/src/main/java/org/apache/juneau/server/config/repository/GitControl.java
@@ -40,7 +40,7 @@ import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.PushResult;
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
-@SuppressWarnings("javadoc")
+@SuppressWarnings({"javadoc","unused"})
public class GitControl {
private String localPath, remotePath;
diff --git a/launches/juneau-apply-prefs.sh b/launches/juneau-apply-prefs.sh
index 419e367..f0b2129 100755
--- a/launches/juneau-apply-prefs.sh
+++ b/launches/juneau-apply-prefs.sh
@@ -14,7 +14,6 @@
projects=(
"juneau-core/juneau-config"
-"juneau-core/juneau-core-utest"
"juneau-core/juneau-dto"
"juneau-core/juneau-marshall"
"juneau-core/juneau-marshall-rdf"
@@ -23,22 +22,17 @@ projects=(
"juneau-examples/juneau-examples-core"
"juneau-examples/juneau-examples-rest"
"juneau-examples/juneau-examples-rest-jetty"
-"juneau-examples/juneau-examples-rest-jetty-ftest"
"juneau-examples/juneau-examples-rest-springboot"
"juneau-microservice/juneau-microservice-core"
-"juneau-microservice/juneau-microservice-ftest"
"juneau-microservice/juneau-microservice-jetty"
"juneau-microservice/juneau-my-jetty-microservice"
"juneau-microservice/juneau-my-springboot-microservice"
"juneau-rest/juneau-rest-client"
-"juneau-rest/juneau-rest-client-utest"
"juneau-rest/juneau-rest-mock"
-"juneau-rest/juneau-rest-mock-utest"
"juneau-rest/juneau-rest-server"
"juneau-rest/juneau-rest-server-jaxrs"
"juneau-rest/juneau-rest-server-rdf"
"juneau-rest/juneau-rest-server-springboot"
-"juneau-rest/juneau-rest-server-utest"
"juneau-sc/juneau-sc-client"
"juneau-sc/juneau-sc-server"
)
@@ -46,8 +40,23 @@ projects=(
for i in "${projects[@]}"
do
echo Preferences applied to $i
- cp eclipse-preferences/org.eclipse.jdt.core.prefs $i/.settings
- cp eclipse-preferences/org.eclipse.jdt.ui.prefs $i/.settings
+ cp eclipse-preferences/source-prefs/org.eclipse.jdt.core.prefs $i/.settings
+ cp eclipse-preferences/source-prefs/org.eclipse.jdt.ui.prefs $i/.settings
done
+projects=(
+"juneau-core/juneau-core-utest"
+"juneau-examples/juneau-examples-rest-jetty-ftest"
+"juneau-microservice/juneau-microservice-ftest"
+"juneau-rest/juneau-rest-client-utest"
+"juneau-rest/juneau-rest-mock-utest"
+"juneau-rest/juneau-rest-server-utest"
+)
+
+for i in "${projects[@]}"
+do
+ echo Preferences applied to $i
+ cp eclipse-preferences/test-prefs/org.eclipse.jdt.core.prefs $i/.settings
+ cp eclipse-preferences/test-prefs/org.eclipse.jdt.ui.prefs $i/.settings
+done
diff --git a/pom.xml b/pom.xml
index b7ec35c..80d402d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -169,6 +169,7 @@
<exclude>**/.project</exclude>
<exclude>**/.classpath</exclude>
<exclude>**/*.launch</exclude>
+ <exclude>**/*.prefs</exclude>
<!-- Overlay files -->
<exclude>**/*.2</exclude>