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/05 18:53:12 UTC
[juneau] branch master updated: Javadoc and thrown-exception
cleanup.
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 3746a79 Javadoc and thrown-exception cleanup.
3746a79 is described below
commit 3746a7917cd6c303dd3c9374bba0995d7bed5932
Author: JamesBognar <ja...@apache.org>
AuthorDate: Fri Jul 5 14:52:55 2019 -0400
Javadoc and thrown-exception cleanup.
---
.../main/java/org/apache/juneau/config/Config.java | 45 +--
.../apache/juneau/config/internal/ConfigMap.java | 32 +-
.../juneau/config/store/ConfigFileStore.java | 2 +-
.../apache/juneau/config/store/ConfigStore.java | 6 +-
.../test/java/org/apache/juneau/ComboInput.java | 2 +-
.../java/org/apache/juneau/XmlValidatorParser.java | 8 +-
.../apache/juneau/reflection/ClassInfoTest.java | 10 +-
.../org/apache/juneau/jena/RdfParserSession.java | 17 +-
.../apache/juneau/jena/RdfSerializerSession.java | 19 +-
.../java/org/apache/juneau/BeanContextBuilder.java | 2 +-
.../src/main/java/org/apache/juneau/BeanMap.java | 4 +-
.../src/main/java/org/apache/juneau/BeanMeta.java | 7 +-
.../src/main/java/org/apache/juneau/ClassMeta.java | 77 +---
.../java/org/apache/juneau/ContextBuilder.java | 2 +-
.../{Setter.java => ExecutableException.java} | 57 ++-
.../main/java/org/apache/juneau/ObjectList.java | 8 +-
.../src/main/java/org/apache/juneau/ObjectMap.java | 10 +-
.../src/main/java/org/apache/juneau/Setter.java | 20 +-
.../main/java/org/apache/juneau/Streamable.java | 2 +-
.../main/java/org/apache/juneau/ValueListener.java | 3 +-
.../src/main/java/org/apache/juneau/Writable.java | 2 +-
.../annotation/InvalidAnnotationException.java | 2 +-
.../org/apache/juneau/csv/CsvParserSession.java | 8 +-
.../apache/juneau/csv/CsvSerializerSession.java | 2 +-
.../org/apache/juneau/encoders/Finishable.java | 2 +-
.../juneau/html/HtmlDocSerializerSession.java | 11 +-
.../org/apache/juneau/html/HtmlParserSession.java | 42 ++-
.../html/HtmlSchemaDocSerializerSession.java | 11 +-
.../juneau/html/HtmlSchemaSerializerSession.java | 10 +-
.../apache/juneau/html/HtmlSerializerSession.java | 39 +-
.../html/HtmlStrippedDocSerializerSession.java | 3 +-
.../main/java/org/apache/juneau/html/HtmlTag.java | 4 +-
.../java/org/apache/juneau/html/HtmlWidget.java | 6 +-
.../src/main/java/org/apache/juneau/http/Age.java | 2 +-
.../main/java/org/apache/juneau/http/Allow.java | 2 +-
.../org/apache/juneau/http/ContentLanguage.java | 2 +-
.../java/org/apache/juneau/http/ContentLength.java | 2 +-
.../java/org/apache/juneau/http/MaxForwards.java | 2 +-
.../org/apache/juneau/http/ReaderResource.java | 6 +-
.../org/apache/juneau/http/StreamResource.java | 6 +-
.../main/java/org/apache/juneau/http/Upgrade.java | 2 +-
.../src/main/java/org/apache/juneau/http/Via.java | 2 +-
.../java/org/apache/juneau/httppart/HttpPart.java | 10 +-
.../org/apache/juneau/httppart/HttpPartParser.java | 8 +-
.../juneau/httppart/HttpPartParserSession.java | 12 +-
.../apache/juneau/httppart/HttpPartSerializer.java | 4 +-
.../org/apache/juneau/internal/DelegateMap.java | 2 +-
.../java/org/apache/juneau/internal/FileUtils.java | 2 +-
.../java/org/apache/juneau/internal/IOUtils.java | 26 +-
.../org/apache/juneau/internal/ObjectUtils.java | 2 +-
.../org/apache/juneau/internal/StringUtils.java | 18 +-
.../org/apache/juneau/internal/ThrowableUtils.java | 10 +-
.../org/apache/juneau/jso/JsoParserSession.java | 8 +-
.../apache/juneau/jso/JsoSerializerSession.java | 2 +-
.../org/apache/juneau/json/JsonParserSession.java | 34 +-
.../juneau/json/JsonSchemaSerializerSession.java | 10 +-
.../apache/juneau/json/JsonSerializerSession.java | 25 +-
.../java/org/apache/juneau/json/JsonWriter.java | 8 +-
.../jsonschema/JsonSchemaGeneratorSession.java | 29 +-
.../org/apache/juneau/jsonschema/SchemaUtils.java | 2 +-
.../java/org/apache/juneau/marshall/Marshall.java | 6 +-
.../apache/juneau/msgpack/MsgPackInputStream.java | 4 +-
.../juneau/msgpack/MsgPackParserSession.java | 7 +-
.../juneau/msgpack/MsgPackSerializerSession.java | 19 +-
.../juneau/oapi/OpenApiSerializerSession.java | 9 +-
.../main/java/org/apache/juneau/parser/Parser.java | 19 +-
.../apache/juneau/parser/ParserInputStream.java | 4 +-
.../java/org/apache/juneau/parser/ParserPipe.java | 10 +-
.../org/apache/juneau/parser/ParserReader.java | 8 +-
.../org/apache/juneau/parser/ParserSession.java | 60 +--
.../juneau/plaintext/PlainTextParserSession.java | 4 +-
.../plaintext/PlainTextSerializerSession.java | 4 +-
.../org/apache/juneau/pojotools/PojoSearcher.java | 7 +-
.../org/apache/juneau/reflect/AnnotationInfo.java | 24 +-
.../java/org/apache/juneau/reflect/ClassInfo.java | 13 +-
.../org/apache/juneau/reflect/ConstructorInfo.java | 13 +-
.../java/org/apache/juneau/reflect/MethodInfo.java | 23 +-
.../java/org/apache/juneau/reflect/ParamInfo.java | 1 +
.../juneau/serializer/SerializerSession.java | 41 ++-
.../apache/juneau/serializer/SerializerWriter.java | 2 +-
.../juneau/soap/SoapXmlSerializerSession.java | 3 +-
.../java/org/apache/juneau/svl/VarResolver.java | 2 +-
.../org/apache/juneau/svl/VarResolverSession.java | 2 +-
.../org/apache/juneau/transform/BuilderSwap.java | 20 +-
.../org/apache/juneau/uon/UonParserSession.java | 62 ++--
.../main/java/org/apache/juneau/uon/UonReader.java | 4 +-
.../apache/juneau/uon/UonSerializerSession.java | 23 +-
.../main/java/org/apache/juneau/uon/UonWriter.java | 6 +-
.../urlencoding/UrlEncodingParserSession.java | 11 +-
.../urlencoding/UrlEncodingSerializerSession.java | 15 +-
.../org/apache/juneau/utils/CalendarUtils.java | 14 +-
.../juneau/utils/ClasspathResourceFinder.java | 2 +-
.../juneau/utils/ClasspathResourceFinderBasic.java | 2 +-
.../utils/ClasspathResourceFinderSimple.java | 2 +-
.../juneau/utils/ClasspathResourceManager.java | 14 +-
.../main/java/org/apache/juneau/utils/IOPipe.java | 2 +-
.../org/apache/juneau/utils/PojoIntrospector.java | 8 +-
.../java/org/apache/juneau/utils/PojoMerge.java | 14 +-
.../java/org/apache/juneau/utils/PojoRest.java | 34 +-
.../java/org/apache/juneau/utils/ProcBuilder.java | 12 +-
.../juneau/utils/StringExpressionMatcher.java | 4 +-
.../java/org/apache/juneau/utils/ZipFileList.java | 4 +-
.../apache/juneau/xml/XmlDocSerializerSession.java | 2 +-
.../org/apache/juneau/xml/XmlParserSession.java | 53 ++-
.../main/java/org/apache/juneau/xml/XmlReader.java | 9 +-
.../apache/juneau/xml/XmlSerializerSession.java | 24 +-
.../main/java/org/apache/juneau/xml/XmlWriter.java | 8 +-
.../xmlschema/XmlSchemaDocSerializerSession.java | 4 +-
.../xmlschema/XmlSchemaSerializerSession.java | 2 +-
.../juneau/examples/core/dto/DtoExample.java | 333 ++++++++---------
.../juneau/examples/core/dto/atom/AtomFeed.java | 78 ++--
.../examples/core/dto/atom/AtomHtmlExample.java | 404 +++++++++++----------
.../examples/core/dto/atom/AtomJsonExample.java | 176 ++++-----
.../examples/core/dto/atom/AtomXmlExample.java | 150 ++++----
.../examples/core/html/HtmlComplexExample.java | 88 ++---
.../examples/core/html/HtmlSimpleExample.java | 64 ++--
.../examples/core/json/JsonComplexExample.java | 80 ++--
.../core/json/JsonConfigurationExample.java | 17 +-
.../examples/core/json/JsonSimpleExample.java | 8 +-
.../juneau/examples/core/oapi/OapiExample.java | 81 +++--
.../org/apache/juneau/examples/core/pojo/Pojo.java | 10 +
.../juneau/examples/core/pojo/PojoComplex.java | 14 +-
.../examples/core/rdf/RdfComplexExample.java | 144 ++++----
.../juneau/examples/core/rdf/RdfExample.java | 5 +-
.../juneau/examples/core/svl/SvlExample.java | 4 +-
.../examples/core/uon/UONComplexExample.java | 60 +--
.../juneau/examples/core/uon/UONExample.java | 51 ++-
.../examples/core/xml/XmlComplexExample.java | 11 +-
.../examples/core/xml/XmlConfigurationExample.java | 91 ++---
.../juneau/examples/core/xml/XmlSimpleExample.java | 67 ++--
.../org/apache/juneau/examples/rest/jetty/App.java | 2 +-
.../juneau/examples/rest/springboot/App.java | 9 +-
.../juneau/examples/rest/HelloWorldResource.java | 6 +-
.../juneau/examples/rest/RequestEchoResource.java | 7 +-
.../juneau/examples/rest/dto/AtomFeedResource.java | 15 +-
.../examples/rest/dto/JsonSchemaResource.java | 15 +-
.../rest/dto/PredefinedLabelsResource.java | 21 +-
.../rest/petstore/AbstractPersistenceService.java | 13 +
.../examples/rest/petstore/ExpiresAfter.java | 11 +
.../examples/rest/petstore/PetStoreService.java | 130 ++++++-
.../examples/rest/petstore/dto/CreateOrder.java | 19 +
.../examples/rest/petstore/dto/CreatePet.java | 48 ++-
.../juneau/examples/rest/petstore/dto/Order.java | 53 ++-
.../examples/rest/petstore/dto/OrderStatus.java | 4 +
.../juneau/examples/rest/petstore/dto/Pet.java | 114 +++++-
.../examples/rest/petstore/dto/PetStatus.java | 4 +
.../juneau/examples/rest/petstore/dto/PetTag.java | 29 +-
.../juneau/examples/rest/petstore/dto/Species.java | 4 +
.../examples/rest/petstore/dto/UpdatePet.java | 22 ++
.../juneau/examples/rest/petstore/dto/User.java | 83 ++++-
.../examples/rest/petstore/dto/UserStatus.java | 4 +
.../examples/rest/petstore/rest/PetStore.java | 174 ++++++++-
.../rest/petstore/rest/PetStoreResource.java | 41 ++-
.../rest/petstore/rest/PhotosResource.java | 50 ++-
.../rest/petstore/rest/SqlQueryResource.java | 21 +-
.../apache/juneau/microservice/Microservice.java | 30 +-
.../juneau/microservice/MicroserviceBuilder.java | 23 +-
.../juneau/microservice/resources/LogParser.java | 4 +-
.../microservice/resources/ShutdownResource.java | 3 +-
.../microservice/jetty/JettyMicroservice.java | 58 +--
.../jetty/JettyMicroserviceBuilder.java | 27 +-
.../juneau/microservice/jetty/template/App.java | 2 +-
.../microservice/springboot/template/App.java | 3 +
.../org/apache/juneau/rest/client/RestCall.java | 108 +++---
.../juneau/rest/client/RestCallException.java | 6 +-
.../juneau/rest/client/RestCallInterceptor.java | 2 +-
.../org/apache/juneau/rest/client/RestClient.java | 16 +-
.../juneau/rest/client/RestClientBuilder.java | 96 +++--
.../juneau/rest/client/SimpleX509TrustManager.java | 4 +-
.../org/apache/juneau/rest/mock2/MockRest.java | 42 +--
.../juneau/rest/mock2/MockServletRequest.java | 5 +-
.../test/java/org/apache/juneau/rest/NlsTest.java | 4 +-
.../annotation/RestResourcePropertiesTest.java | 4 +-
.../annotation/RestResourceSerializersTest.java | 10 +-
.../juneau/rest/annotation2/RestHookTest.java | 5 +-
.../rest/annotation2/RestMethodInheritTest.java | 5 +-
.../rest/annotation2/RestResourceParsersTest.java | 10 +-
.../juneau/rest/headers/AcceptCharsetTest.java | 4 +-
.../org/apache/juneau/rest/headers/AcceptTest.java | 4 +-
.../juneau/rest/headers/ContentTypeTest.java | 4 +-
.../apache/juneau/rest/BasicRestCallHandler.java | 8 +-
.../org/apache/juneau/rest/BasicRestGroup.java | 3 +-
.../apache/juneau/rest/BasicRestInfoProvider.java | 12 +-
.../apache/juneau/rest/BasicRestServletGroup.java | 3 +-
.../org/apache/juneau/rest/HtmlDocBuilder.java | 4 +-
.../java/org/apache/juneau/rest/RequestBody.java | 4 +-
.../org/apache/juneau/rest/RestCallHandler.java | 15 +-
.../java/org/apache/juneau/rest/RestContext.java | 22 +-
.../java/org/apache/juneau/rest/RestConverter.java | 2 +-
.../org/apache/juneau/rest/RestMethodParam.java | 2 +-
.../java/org/apache/juneau/rest/RestRequest.java | 26 +-
.../java/org/apache/juneau/rest/RestResponse.java | 13 +-
.../java/org/apache/juneau/rest/RestServlet.java | 4 +-
.../org/apache/juneau/rest/SwaggerGenerator.java | 4 +-
.../juneau/rest/guards/RoleBasedRestGuard.java | 2 +-
.../rest/helper/ChildResourceDescriptions.java | 20 +-
.../rest/helper/ResolvingReaderResource.java | 6 +-
.../java/org/apache/juneau/rest/mock/MockRest.java | 14 +-
.../juneau/rest/mock/MockServletRequest.java | 2 +-
.../juneau/rest/util/FinishablePrintWriter.java | 2 +-
.../org/apache/juneau/rest/util/RestUtils.java | 135 +++----
.../apache/juneau/rest/widget/MenuItemWidget.java | 8 +-
.../java/org/apache/juneau/rest/widget/Widget.java | 22 +-
.../java/org/apache/juneau/server/config/App.java | 9 +
204 files changed, 2976 insertions(+), 2033 deletions(-)
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java
index d7da807..89f2f7b 100644
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java
@@ -422,7 +422,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
*
* @param ps
* The property store containing all the settings for this object.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public Config(PropertyStore ps) throws IOException {
super(ps, true);
@@ -1132,8 +1132,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
* @param key The key.
* @param type The object type to create.
* @return The parsed object.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
* @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections.
*/
public <T> T getObject(String key, Class<T> type) throws ParseException {
@@ -1150,8 +1149,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
* If <jk>null</jk>, then uses the predefined parser on the config file.
* @param type The object type to create.
* @return The parsed object.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
* @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections.
*/
public <T> T getObject(String key, Parser parser, Class<T> type) throws ParseException {
@@ -1246,7 +1244,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
*
* @param key The key.
* @return The value, or <jk>null</jk> if the section or key does not exist.
- * @throws ParseException
+ * @throws ParseException Malformed input encountered.
*/
public ObjectMap getObjectMap(String key) throws ParseException {
return getObject(key, ObjectMap.class);
@@ -1258,7 +1256,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
* @param key The key.
* @param def The default value.
* @return The value, or the default value if the section or key does not exist.
- * @throws ParseException
+ * @throws ParseException Malformed input encountered.
*/
public ObjectMap getObjectMap(String key, ObjectMap def) throws ParseException {
return getObjectWithDefault(key, def, ObjectMap.class);
@@ -1269,7 +1267,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
*
* @param key The key.
* @return The value, or <jk>null</jk> if the section or key does not exist.
- * @throws ParseException
+ * @throws ParseException Malformed input encountered.
*/
public ObjectList getObjectList(String key) throws ParseException {
return getObject(key, ObjectList.class);
@@ -1281,7 +1279,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
* @param key The key.
* @param def The default value.
* @return The value, or the default value if the section or key does not exist.
- * @throws ParseException
+ * @throws ParseException Malformed input encountered.
*/
public ObjectList getObjectList(String key, ObjectList def) throws ParseException {
return getObjectWithDefault(key, def, ObjectList.class);
@@ -1314,12 +1312,9 @@ public final class Config extends Context implements ConfigEventListener, Writab
* correspond to a setter method.
* @return An object map of the changes made to the bean.
* @throws ParseException If parser was not set on this config file or invalid properties were found in the section.
- * @throws IllegalArgumentException
- * @throws IllegalAccessException
- * @throws InvocationTargetException
* @throws UnsupportedOperationException If configuration is read only.
*/
- public Config writeProperties(String section, Object bean, boolean ignoreUnknownProperties) throws ParseException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
+ public Config writeProperties(String section, Object bean, boolean ignoreUnknownProperties) throws ParseException {
checkWrite();
assertFieldNotNull(bean, "bean");
section = section(section);
@@ -1351,9 +1346,9 @@ public final class Config extends Context implements ConfigEventListener, Writab
* <br>Must not be <jk>null</jk>.
* @param c The bean class to create.
* @return A new bean instance.
- * @throws ParseException
+ * @throws ParseException Malformed input encountered.
*/
- public <T> T getSectionAsBean(String section, Class<T>c) throws ParseException {
+ public <T> T getSectionAsBean(String section, Class<T> c) throws ParseException {
return getSectionAsBean(section, c, false);
}
@@ -1397,7 +1392,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
* If <jk>false</jk>, throws a {@link ParseException} if the section contains an entry that isn't a bean property
* name.
* @return A new bean instance, or <jk>null</jk> if the section doesn't exist.
- * @throws ParseException
+ * @throws ParseException Unknown property was encountered in section.
*/
public <T> T getSectionAsBean(String section, Class<T> c, boolean ignoreUnknownProperties) throws ParseException {
assertFieldNotNull(c, "c");
@@ -1430,7 +1425,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
* <br>If empty, refers to the default section.
* <br>Must not be <jk>null</jk>.
* @return A new {@link ObjectMap}, or <jk>null</jk> if the section doesn't exist.
- * @throws ParseException
+ * @throws ParseException Malformed input encountered.
*/
public ObjectMap getSectionAsMap(String section) throws ParseException {
section = section(section);
@@ -1594,7 +1589,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
* Values to set in the new section.
* <br>Can be <jk>null</jk>.
* @return The appended or existing section.
- * @throws SerializeException
+ * @throws SerializeException Contents could not be serialized.
* @throws UnsupportedOperationException If configuration is read only.
*/
public Config setSection(String name, List<String> preLines, Map<String,Object> contents) throws SerializeException {
@@ -1667,7 +1662,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
*
* @param m The maps to load.
* @return This object (for method chaining).
- * @throws SerializeException
+ * @throws SerializeException Value could not be serialized.
*/
public Config load(Map<String,Map<String,Object>> m) throws SerializeException {
if (m != null)
@@ -1681,7 +1676,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
* Commit the changes in this config to the store.
*
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
* @throws UnsupportedOperationException If configuration is read only.
*/
public Config commit() throws IOException {
@@ -1733,7 +1728,7 @@ public final class Config extends Context implements ConfigEventListener, Writab
/**
* Closes this configuration object by unregistering it from the underlying config map.
*
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public void close() throws IOException {
configMap.unregister(this);
@@ -1745,8 +1740,8 @@ public final class Config extends Context implements ConfigEventListener, Writab
* @param contents The new contents of the config file.
* @param synchronous Wait until the change has been persisted before returning this map.
* @return This object (for method chaining).
- * @throws IOException
- * @throws InterruptedException
+ * @throws IOException Thrown by underlying stream.
+ * @throws InterruptedException Thread was interrupted.
* @throws UnsupportedOperationException If configuration is read only.
*/
public Config load(Reader contents, boolean synchronous) throws IOException, InterruptedException {
@@ -1761,8 +1756,8 @@ public final class Config extends Context implements ConfigEventListener, Writab
* @param contents The new contents of the config file.
* @param synchronous Wait until the change has been persisted before returning this map.
* @return This object (for method chaining).
- * @throws IOException
- * @throws InterruptedException
+ * @throws IOException Thrown by underlying stream.
+ * @throws InterruptedException Thread was interrupted.
* @throws UnsupportedOperationException If configuration is read only.
*/
public Config load(String contents, boolean synchronous) throws IOException, InterruptedException {
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/internal/ConfigMap.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/internal/ConfigMap.java
index b682e40..cd25896 100644
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/internal/ConfigMap.java
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/internal/ConfigMap.java
@@ -59,7 +59,7 @@ public class ConfigMap implements ConfigStoreListener {
*
* @param store The config store.
* @param name The config name.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public ConfigMap(ConfigStore store, String name) throws IOException {
this.store = store;
@@ -380,16 +380,22 @@ public class ConfigMap implements ConfigStoreListener {
/**
- * TODO
+ * Not implemented.
*
* @param section
+ * The section name where to place the import statement.
+ * <br>Must not be <jk>null</jk>.
+ * <br>Use blank for the default section.
* @param importName
+ * The import name.
+ * <br>Must not be <jk>null</jk>.
* @param preLines
+ * Optional comment and blank lines to add immediately before the import statement.
+ * <br>If <jk>null</jk>, previous pre-lines will not be replaced.
* @return This object (for method chaining).
*/
public ConfigMap setImport(String section, String importName, List<String> preLines) {
- // TODO Auto-generated method stub
- return this;
+ throw new UnsupportedOperationException();
}
/**
@@ -428,15 +434,19 @@ public class ConfigMap implements ConfigStoreListener {
}
/**
- * TODO
+ * Not implemented.
*
* @param section
+ * The section name where to place the import statement.
+ * <br>Must not be <jk>null</jk>.
+ * <br>Use blank for the default section.
* @param importName
+ * The import name.
+ * <br>Must not be <jk>null</jk>.
* @return This object (for method chaining).
*/
public ConfigMap removeImport(String section, String importName) {
- // TODO Auto-generated method stub
- return this;
+ throw new UnsupportedOperationException();
}
private ConfigMap applyChange(boolean addToChangeList, ConfigEvent ce) {
@@ -489,8 +499,8 @@ public class ConfigMap implements ConfigStoreListener {
* @param contents The new contents of the config file.
* @param synchronous Wait until the change has been persisted before returning this map.
* @return This object (for method chaining).
- * @throws IOException
- * @throws InterruptedException
+ * @throws IOException Thrown by underlying stream.
+ * @throws InterruptedException Thread was interrupted.
*/
public ConfigMap load(String contents, boolean synchronous) throws IOException, InterruptedException {
@@ -531,7 +541,7 @@ public class ConfigMap implements ConfigStoreListener {
* <br>If the file keeps changing on the file system, we throw an exception.
*
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public ConfigMap commit() throws IOException {
writeLock();
@@ -664,7 +674,7 @@ public class ConfigMap implements ConfigStoreListener {
*
* @param w The writer to serialize to.
* @return The same writer passed in.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public Writer writeTo(Writer w) throws IOException {
readLock();
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigFileStore.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigFileStore.java
index b22a631..a99826f 100644
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigFileStore.java
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigFileStore.java
@@ -468,7 +468,7 @@ public class ConfigFileStore extends ConfigStore {
* Gets called when the watcher service on this store is triggered with a file system change.
*
* @param e The file system event.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
protected synchronized void onFileEvent(WatchEvent<Path> e) throws IOException {
String fn = e.context().getFileName().toString();
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigStore.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigStore.java
index 8ef6ce4..3069187 100644
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigStore.java
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigStore.java
@@ -63,7 +63,7 @@ public abstract class ConfigStore extends Context implements Closeable {
* The contents of the configuration file.
* <br>A blank string if the config does not exist.
* <br>Never <jk>null</jk>.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public abstract String read(String name) throws IOException;
@@ -76,7 +76,7 @@ public abstract class ConfigStore extends Context implements Closeable {
* @return
* If <jk>null</jk>, then we successfully stored the contents of the file.
* <br>Otherwise the contents of the file have changed and we return the new contents of the file.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public abstract String write(String name, String expectedContents, String newContents) throws IOException;
@@ -128,7 +128,7 @@ public abstract class ConfigStore extends Context implements Closeable {
* @return
* The parsed configuration.
* <br>Never <jk>null</jk>.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public synchronized ConfigMap getMap(String name) throws IOException {
name = resolveName(name);
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/ComboInput.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/ComboInput.java
index 7f5be00..f72c2f1 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/ComboInput.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/ComboInput.java
@@ -81,7 +81,7 @@ public class ComboInput<T> {
/**
* Returns the input object.
* Override this method if you want it dynamically created each time.
- * @throws Exception
+ * @throws Exception Subclasses can throw any exception.
*/
public T getInput() throws Exception {
return in;
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/XmlValidatorParser.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/XmlValidatorParser.java
index 73a0d52..40a1c30 100755
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/XmlValidatorParser.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/XmlValidatorParser.java
@@ -38,8 +38,12 @@ public class XmlValidatorParser extends XmlParser {
return new XmlParserSession(null, args) {
@Override
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
- return (T)validate(pipe.getReader());
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
+ try {
+ return (T)validate(pipe.getReader());
+ } catch (Exception e) {
+ throw new ParseException(e);
+ }
}
@Override /* ReaderParser */
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
index 29e568d..cb909e1 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
@@ -2107,33 +2107,33 @@ public class ClassInfoTest {
aTypeInfo.newInstance();
fail();
}
- catch (InstantiationException e) { /* OK */ }
+ catch (ExecutableException e) { /* OK */ }
catch (Exception e) { fail(e.getMessage()); }
try {
pTypeInfo.newInstance();
fail();
}
- catch (InstantiationException e) { /* OK */ }
+ catch (ExecutableException e) { /* OK */ }
catch (Exception e) { fail(e.getMessage()); }
try {
pTypeDimensionalInfo.newInstance();
fail();
}
- catch (InstantiationException e) { /* OK */ }
+ catch (ExecutableException e) { /* OK */ }
catch (Exception e) { fail(e.getMessage()); }
try {
pTypeGenericInfo.newInstance();
fail();
}
- catch (InstantiationException e) { /* OK */ }
+ catch (ExecutableException e) { /* OK */ }
catch (Exception e) { /* OK */ }
try {
pTypeGenericArgInfo.newInstance();
fail();
}
- catch (InstantiationException e) { /* OK */ }
+ catch (ExecutableException e) { /* OK */ }
catch (Exception e) { fail(e.getMessage()); }
}
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
index 4e173f6..5c181c1 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
@@ -15,6 +15,7 @@ package org.apache.juneau.jena;
import static org.apache.juneau.internal.StringUtils.*;
import static org.apache.juneau.jena.Constants.*;
+import java.io.IOException;
import java.util.*;
import org.apache.jena.rdf.model.*;
@@ -69,7 +70,7 @@ public class RdfParserSession extends ReaderParserSession {
}
@Override /* ReaderParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
RDFReader r = rdfReader;
r.read(model, pipe.getBufferedReader(), null);
@@ -164,7 +165,7 @@ public class RdfParserSession extends ReaderParserSession {
return l;
}
- private <T> BeanMap<T> parseIntoBeanMap(Resource r2, BeanMap<T> m) throws Exception {
+ private <T> BeanMap<T> parseIntoBeanMap(Resource r2, BeanMap<T> m) throws IOException, ParseException, ExecutableException {
BeanMeta<T> bm = m.getMeta();
RdfBeanMeta rbm = bm.getExtendedMeta(RdfBeanMeta.class);
if (rbm.hasBeanUri() && r2.getURI() != null)
@@ -205,7 +206,7 @@ public class RdfParserSession extends ReaderParserSession {
return getCollectionFormat() == RdfCollectionFormat.MULTI_VALUED;
}
- private <T> T parseAnything(ClassMeta<?> eType, RDFNode n, Object outer, BeanPropertyMeta pMeta) throws Exception {
+ private <T> T parseAnything(ClassMeta<?> eType, RDFNode n, Object outer, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
if (eType == null)
eType = object();
@@ -336,7 +337,7 @@ public class RdfParserSession extends ReaderParserSession {
}
if (swap != null && o != null)
- o = swap.unswap(this, o, eType);
+ o = unswap(swap, o, eType);
if (outer != null)
setParent(eType, o, outer);
@@ -362,7 +363,7 @@ public class RdfParserSession extends ReaderParserSession {
return false;
}
- private Object getValue(RDFNode n, Object outer) throws Exception {
+ private Object getValue(RDFNode n, Object outer) throws IOException, ParseException, ExecutableException {
if (n.isLiteral())
return n.asLiteral().getValue();
if (n.isResource()) {
@@ -378,7 +379,7 @@ public class RdfParserSession extends ReaderParserSession {
}
private <K,V> Map<K,V> parseIntoMap(Resource r, Map<K,V> m, ClassMeta<K> keyType,
- ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
// Add URI as "uri" to generic maps.
if (r.getURI() != null) {
K uri = convertAttrToType(m, "uri", keyType);
@@ -403,7 +404,7 @@ public class RdfParserSession extends ReaderParserSession {
}
private <E> Collection<E> parseIntoCollection(Container c, Collection<E> l,
- ClassMeta<?> type, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<?> type, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
int argIndex = 0;
for (NodeIterator ni = c.iterator(); ni.hasNext();) {
E e = (E)parseAnything(type.isArgs() ? type.getArg(argIndex++) : type.getElementType(), ni.next(), l, pMeta);
@@ -413,7 +414,7 @@ public class RdfParserSession extends ReaderParserSession {
}
private <E> Collection<E> parseIntoCollection(RDFList list, Collection<E> l,
- ClassMeta<?> type, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<?> type, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
int argIndex = 0;
for (ExtendedIterator<RDFNode> ni = list.iterator(); ni.hasNext();) {
E e = (E)parseAnything(type.isArgs() ? type.getArg(argIndex++) : type.getElementType(), ni.next(), l, pMeta);
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerSession.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerSession.java
index a22f4f4..c9fd337 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerSession.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerSession.java
@@ -15,6 +15,7 @@ package org.apache.juneau.jena;
import static org.apache.juneau.jena.Constants.*;
import static org.apache.juneau.jena.RdfSerializer.*;
+import java.io.IOException;
import java.util.*;
import org.apache.jena.rdf.model.*;
@@ -113,7 +114,7 @@ public final class RdfSerializerSession extends WriterSerializerSession {
}
@Override /* Serializer */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
Resource r = null;
@@ -139,14 +140,14 @@ public final class RdfSerializerSession extends WriterSerializerSession {
}
private RDFNode serializeAnything(Object o, boolean isURI, ClassMeta<?> eType,
- String attrName, BeanPropertyMeta bpm, Resource parentResource) throws Exception {
+ String attrName, BeanPropertyMeta bpm, Resource parentResource) throws IOException, SerializeException {
Model m = model;
ClassMeta<?> aType = null; // The actual type
ClassMeta<?> wType = null; // The wrapped type
ClassMeta<?> sType = object(); // The serialized type
- aType = push(attrName, o, eType);
+ aType = push2(attrName, o, eType);
if (eType == null)
eType = object();
@@ -169,7 +170,7 @@ public final class RdfSerializerSession extends WriterSerializerSession {
// Swap if necessary
PojoSwap swap = aType.getPojoSwap(this);
if (swap != null) {
- o = swap.swap(this, o);
+ o = swap(swap, o);
sType = swap.getSwapClassMeta(this);
// If the getSwapClass() method returns Object, we need to figure out
@@ -279,7 +280,7 @@ public final class RdfSerializerSession extends WriterSerializerSession {
return getUriResolver().resolve(s);
}
- private void serializeMap(Map m, Resource r, ClassMeta<?> type) throws Exception {
+ private void serializeMap(Map m, Resource r, ClassMeta<?> type) throws IOException, SerializeException {
m = sort(m);
@@ -300,7 +301,7 @@ public final class RdfSerializerSession extends WriterSerializerSession {
}
}
- private void serializeBeanMap(BeanMap<?> m, Resource r, String typeName) throws Exception {
+ private void serializeBeanMap(BeanMap<?> m, Resource r, String typeName) throws IOException, SerializeException {
List<BeanPropertyValue> l = m.getValues(isTrimNullProperties(), typeName != null ? createBeanTypeNameProperty(m, typeName) : null);
Collections.reverse(l);
for (BeanPropertyValue bpv : l) {
@@ -338,7 +339,7 @@ public final class RdfSerializerSession extends WriterSerializerSession {
}
- private Container serializeToContainer(Collection c, ClassMeta<?> type, Container list) throws Exception {
+ private Container serializeToContainer(Collection c, ClassMeta<?> type, Container list) throws IOException, SerializeException {
ClassMeta<?> elementType = type.getElementType();
for (Object e : c) {
@@ -348,7 +349,7 @@ public final class RdfSerializerSession extends WriterSerializerSession {
return list;
}
- private RDFList serializeToList(Collection c, ClassMeta<?> type) throws Exception {
+ private RDFList serializeToList(Collection c, ClassMeta<?> type) throws IOException, SerializeException {
ClassMeta<?> elementType = type.getElementType();
List<RDFNode> l = new ArrayList<>(c.size());
for (Object e : c) {
@@ -358,7 +359,7 @@ public final class RdfSerializerSession extends WriterSerializerSession {
}
private void serializeToMultiProperties(Collection c, ClassMeta<?> sType,
- BeanPropertyMeta bpm, String attrName, Resource parentResource) throws Exception {
+ BeanPropertyMeta bpm, String attrName, Resource parentResource) throws IOException, SerializeException {
ClassMeta<?> elementType = sType.getElementType();
RdfBeanPropertyMeta bpRdf = bpRdf(bpm);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContextBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContextBuilder.java
index a8a81fe..5e4c2df 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContextBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContextBuilder.java
@@ -708,7 +708,7 @@ public class BeanContextBuilder extends ContextBuilder {
* <li class='jf'>{@link BeanContext#BEAN_examples}
* </ul>
*
- * @param <T>
+ * @param <T> The POJO class type.
* @param pojoClass The POJO class.
* @param json The simple JSON representation of the example.
* @return This object (for method chaining).
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMap.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMap.java
index 90ec491..9e069e3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMap.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMap.java
@@ -339,7 +339,7 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
*
* @param input The text that will get parsed into a map and then added to this map.
* @return This object (for method chaining).
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
*/
public BeanMap<T> load(String input) throws ParseException {
putAll(new ObjectMap(input));
@@ -352,7 +352,7 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
* @param r The text that will get parsed into a map and then added to this map.
* @param p The parser to use to parse the text.
* @return This object (for method chaining).
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
* @throws IOException Thrown by <c>Reader</c>.
*/
public BeanMap<T> load(Reader r, ReaderParser p) throws ParseException, IOException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
index 9dcaeef..341328c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
@@ -826,13 +826,10 @@ public class BeanMeta<T> {
*
* @param outer The outer object if bean class is a non-static inner member class.
* @return A new instance of this bean if possible, or <jk>null</jk> if not.
- * @throws IllegalArgumentException Thrown by constructor.
- * @throws InstantiationException Thrown by constructor.
- * @throws IllegalAccessException Thrown by constructor.
- * @throws InvocationTargetException Thrown by constructor.
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
@SuppressWarnings("unchecked")
- protected T newBean(Object outer) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
+ protected T newBean(Object outer) throws ExecutableException {
if (classMeta.isMemberClass()) {
if (constructor != null)
return constructor.<T>invoke(outer);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
index c76a779..3dca1f6 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
@@ -1792,24 +1792,22 @@ public final class ClassMeta<T> implements Type {
* The outer class object for non-static member classes. Can be <jk>null</jk> for non-member or static classes.
* @param arg The input argument value.
* @return A new instance of the object, or <jk>null</jk> if there is no string constructor on the object.
- * @throws IllegalAccessException
- * If the <c>Constructor</c> object enforces Java language access control and the underlying constructor is
- * inaccessible.
- * @throws IllegalArgumentException If the parameter type on the method was invalid.
- * @throws InstantiationException
- * If the class that declares the underlying constructor represents an abstract class, or does not have one of
- * the methods described above.
- * @throws InvocationTargetException If the underlying constructor throws an exception.
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
- public T newInstanceFromString(Object outer, String arg) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, InstantiationException {
+ public T newInstanceFromString(Object outer, String arg) throws ExecutableException {
if (isEnum() && beanContext.isUseEnumNames())
return (T)Enum.valueOf((Class<? extends Enum>)this.innerClass, arg);
Method m = fromStringMethod;
- if (m != null)
- return (T)m.invoke(null, arg);
+ if (m != null) {
+ try {
+ return (T)m.invoke(null, arg);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new ExecutableException(e);
+ }
+ }
ConstructorInfo c = stringConstructor;
if (c != null) {
if (isMemberClass)
@@ -1834,16 +1832,9 @@ public final class ClassMeta<T> implements Type {
* Can be <jk>null</jk> for non-member or static classes.
* @param arg The input argument value.
* @return A new instance of the object, or <jk>null</jk> if there is no numeric constructor on the object.
- * @throws IllegalAccessException
- * If the <c>Constructor</c> object enforces Java language access control and the underlying constructor is
- * inaccessible.
- * @throws IllegalArgumentException If the parameter type on the method was invalid.
- * @throws InstantiationException
- * If the class that declares the underlying constructor represents an abstract class, or does not have one of
- * the methods described above.
- * @throws InvocationTargetException If the underlying constructor throws an exception.
- */
- public T newInstanceFromNumber(BeanSession session, Object outer, Number arg) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, InstantiationException {
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
+ */
+ public T newInstanceFromNumber(BeanSession session, Object outer, Number arg) throws ExecutableException {
ConstructorInfo c = numberConstructor;
if (c != null) {
Object arg2 = session.convertToType(arg, numberConstructor.getRawParamType(0));
@@ -1858,27 +1849,10 @@ public final class ClassMeta<T> implements Type {
* Create a new instance of the main class of this declared type.
*
* @return A new instance of the object, or <jk>null</jk> if there is no no-arg constructor on the object.
- * @throws IllegalAccessException
- * If the <c>Constructor</c> object enforces Java language access control and the underlying constructor is
- * inaccessible.
- * @throws IllegalArgumentException
- * If one of the following occurs:
- * <ul class='spaced-list'>
- * <li>
- * The number of actual and formal parameters differ.
- * <li>
- * An unwrapping conversion for primitive arguments fails.
- * <li>
- * A parameter value cannot be converted to the corresponding formal parameter type by a method invocation
- * conversion.
- * <li>
- * The constructor pertains to an enum type.
- * </ul>
- * @throws InstantiationException If the class that declares the underlying constructor represents an abstract class.
- * @throws InvocationTargetException If the underlying constructor throws an exception.
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
@SuppressWarnings("unchecked")
- public T newInstance() throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
+ public T newInstance() throws ExecutableException {
if (isArray())
return (T)Array.newInstance(getInnerClass().getComponentType(), 0);
ConstructorInfo c = getConstructor();
@@ -1899,26 +1873,9 @@ public final class ClassMeta<T> implements Type {
* The instance of the owning object of the member class instance.
* Can be <jk>null</jk> if instantiating a non-member or static class.
* @return A new instance of the object, or <jk>null</jk> if there is no no-arg constructor on the object.
- * @throws IllegalAccessException
- * If the <c>Constructor</c> object enforces Java language access control and the underlying constructor is
- * inaccessible.
- * @throws IllegalArgumentException
- * If one of the following occurs:
- * <ul class='spaced-list'>
- * <li>
- * The number of actual and formal parameters differ.
- * <li>
- * An unwrapping conversion for primitive arguments fails.
- * <li>
- * A parameter value cannot be converted to the corresponding formal parameter type by a method invocation
- * conversion.
- * <li>
- * The constructor pertains to an enum type.
- * </ul>
- * @throws InstantiationException If the class that declares the underlying constructor represents an abstract class.
- * @throws InvocationTargetException If the underlying constructor throws an exception.
- */
- public T newInstance(Object outer) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
+ */
+ public T newInstance(Object outer) throws ExecutableException {
if (isMemberClass)
return noArgConstructor.<T>invoke(outer);
return newInstance();
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextBuilder.java
index 9bcbae4..3ecb1df 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextBuilder.java
@@ -254,7 +254,7 @@ public abstract class ContextBuilder {
* @param c The type to convert to.
* @param key The property name.
* @return This object (for method chaining).
- * @param <T>
+ * @param <T> The type to convert to.
*/
public <T> T peek(Class<T> c, String key) {
return psb.peek(c, key);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Setter.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ExecutableException.java
similarity index 63%
copy from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Setter.java
copy to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ExecutableException.java
index d81da79..d06b085 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Setter.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ExecutableException.java
@@ -12,53 +12,42 @@
// ***************************************************************************************************************************
package org.apache.juneau;
-import java.lang.reflect.*;
+import java.text.MessageFormat;
/**
- * Encapsulate a bean setter method that may be a method or field.
+ * General exception that occurs when trying to execute a constructor, method, or field using reflection.
*/
-public interface Setter {
+public class ExecutableException extends FormattedException {
+
+ private static final long serialVersionUID = 1L;
/**
- * Call the setter on the specified object.
+ * Constructor.
*
- * @param object The object to call the setter on
- * @param value The value to set.
- * @throws Exception
+ * @param causedBy The cause of this exception.
+ * @param message The {@link MessageFormat}-style message.
+ * @param args Optional {@link MessageFormat}-style arguments.
*/
- void set(Object object, Object value) throws Exception;
+ public ExecutableException(Throwable causedBy, String message, Object...args) {
+ super(causedBy, message, args);
+ }
/**
- * Field setter
+ * Constructor.
+ *
+ * @param causedBy The cause of this exception.
*/
- static class FieldSetter implements Setter {
-
- private final Field f;
-
- public FieldSetter(Field f) {
- this.f = f;
- }
-
- @Override /* Setter */
- public void set(Object object, Object value) throws Exception {
- f.set(object, value);
- }
+ public ExecutableException(Throwable causedBy) {
+ super(causedBy);
}
/**
- * Method setter
+ * Constructor.
+ *
+ * @param message The {@link MessageFormat}-style message.
+ * @param args Optional {@link MessageFormat}-style arguments.
*/
- static class MethodSetter implements Setter {
-
- private final Method m;
-
- public MethodSetter(Method m) {
- this.m = m;
- }
-
- @Override /* Setter */
- public void set(Object object, Object value) throws Exception {
- m.invoke(object, value);
- }
+ public ExecutableException(String message, Object...args) {
+ super(message, args);
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ObjectList.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ObjectList.java
index f6710bb..a66f831 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ObjectList.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ObjectList.java
@@ -139,7 +139,7 @@ public class ObjectList extends LinkedList<Object> {
*
* @param s The string being parsed.
* @param p The parser to use to parse the input.
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
*/
public ObjectList(CharSequence s, Parser p) throws ParseException {
this(p == null ? null : p.createBeanSession());
@@ -153,7 +153,7 @@ public class ObjectList extends LinkedList<Object> {
* Shortcut for <code><jk>new</jk> ObjectList(String,JsonParser.<jsf>DEFAULT</jsf>);</code>
*
* @param s The string being parsed.
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
*/
public ObjectList(CharSequence s) throws ParseException {
this(s, null);
@@ -166,7 +166,7 @@ public class ObjectList extends LinkedList<Object> {
* The reader to read from.
* Will automatically be wrapped in a {@link BufferedReader} if it isn't already a BufferedReader.
* @param p The parser to use to parse the input.
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
* @throws IOException If a problem occurred trying to read from the reader.
*/
public ObjectList(Reader r, Parser p) throws ParseException, IOException {
@@ -180,7 +180,7 @@ public class ObjectList extends LinkedList<Object> {
* @param r
* The reader to read from.
* The reader will be wrapped in a {@link BufferedReader} if it isn't already.
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
* @throws IOException If a problem occurred trying to read from the reader.
*/
public ObjectList(Reader r) throws ParseException, IOException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ObjectMap.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ObjectMap.java
index c459b7e..9fc8075 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ObjectMap.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ObjectMap.java
@@ -145,7 +145,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
*
* @param s The string being parsed.
* @param p The parser to use to parse the input.
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
*/
public ObjectMap(CharSequence s, Parser p) throws ParseException {
this(p == null ? null : p.createBeanSession());
@@ -159,7 +159,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* Shortcut for <code><jk>new</jk> ObjectMap(string,JsonParser.<jsf>DEFAULT</jsf>);</code>
*
* @param s The JSON text to parse.
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
*/
public ObjectMap(CharSequence s) throws ParseException {
this(s, null);
@@ -182,7 +182,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* Shortcut for <code><jk>new</jk> ObjectMap(reader, JsonParser.<jsf>DEFAULT</jsf>)</code>.
*
* @param r The reader to read from. The reader will be wrapped in a {@link BufferedReader} if it isn't already.
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
* @throws IOException If a problem occurred trying to read from the reader.
*/
public ObjectMap(Reader r) throws ParseException, IOException {
@@ -572,7 +572,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* @param pojoSwap The swap class used to convert the raw type to a transformed type.
* @param <T> The transformed class type.
* @return The value, or <jk>null</jk> if the entry doesn't exist.
- * @throws ParseException Thrown by the POJO swap if a problem occurred trying to parse the value.
+ * @throws ParseException Malformed input encountered.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public <T> T getSwapped(String key, PojoSwap<T,?> pojoSwap) throws ParseException {
@@ -767,7 +767,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
*
* @param key The key.
* @param json The JSON text that will be parsed into an Object and then inserted into this map.
- * @throws ParseException If the input contains a syntax error or is malformed.
+ * @throws ParseException Malformed input encountered.
*/
public void putJson(String key, String json) throws ParseException {
this.put(key, JsonParser.DEFAULT.parse(json, Object.class));
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Setter.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Setter.java
index d81da79..cab652d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Setter.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Setter.java
@@ -24,9 +24,9 @@ public interface Setter {
*
* @param object The object to call the setter on
* @param value The value to set.
- * @throws Exception
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- void set(Object object, Object value) throws Exception;
+ void set(Object object, Object value) throws ExecutableException;
/**
* Field setter
@@ -40,8 +40,12 @@ public interface Setter {
}
@Override /* Setter */
- public void set(Object object, Object value) throws Exception {
- f.set(object, value);
+ public void set(Object object, Object value) throws ExecutableException {
+ try {
+ f.set(object, value);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ throw new ExecutableException(e);
+ }
}
}
@@ -57,8 +61,12 @@ public interface Setter {
}
@Override /* Setter */
- public void set(Object object, Object value) throws Exception {
- m.invoke(object, value);
+ public void set(Object object, Object value) throws ExecutableException {
+ try {
+ m.invoke(object, value);
+ } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
+ throw new ExecutableException(e);
+ }
}
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Streamable.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Streamable.java
index 3d98b92..331a3fb 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Streamable.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Streamable.java
@@ -28,7 +28,7 @@ public interface Streamable {
* Serialize this object to the specified output stream.
*
* @param os The output stream to stream to.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
void streamTo(OutputStream os) throws IOException;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ValueListener.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ValueListener.java
index 5d392c9..c941859 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ValueListener.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ValueListener.java
@@ -14,7 +14,8 @@ package org.apache.juneau;
/**
* Simple listener for the {@link Value} class.
- * @param <T>
+ *
+ * @param <T> Value type.
*/
public interface ValueListener<T> {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Writable.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Writable.java
index 17acdd5..7485891 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Writable.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Writable.java
@@ -29,7 +29,7 @@ public interface Writable {
*
* @param w The writer to write to.
* @return The same writer passed in.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
Writer writeTo(Writer w) throws IOException;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/InvalidAnnotationException.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/InvalidAnnotationException.java
index 9c97ae2..b067148 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/InvalidAnnotationException.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/InvalidAnnotationException.java
@@ -40,7 +40,7 @@ public class InvalidAnnotationException extends FormattedRuntimeException {
*
* @param m The method to check.
* @param a The annotations to check for.
- * @throws InvalidAnnotationException
+ * @throws InvalidAnnotationException Annotation was used in an invalid location.
*/
@SafeVarargs
public static void assertNoInvalidAnnotations(MethodInfo m, Class<? extends Annotation>...a) throws InvalidAnnotationException {
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 d745375..203ad2d 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
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.csv;
+import java.io.IOException;
+
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
@@ -38,7 +40,7 @@ public final class CsvParserSession extends ReaderParserSession {
}
@Override /* ParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException {
try (ParserReader r = pipe.getParserReader()) {
if (r == null)
return null;
@@ -47,8 +49,8 @@ public final class CsvParserSession extends ReaderParserSession {
}
@SuppressWarnings({})
- private <T> T parseAnything(ClassMeta<T> eType, ParserReader r, Object outer, BeanPropertyMeta pMeta) throws Exception {
- throw new NoSuchMethodException("Not implemented.");
+ private <T> T parseAnything(ClassMeta<T> eType, ParserReader r, Object outer, BeanPropertyMeta pMeta) throws IOException, ParseException {
+ throw new ParseException("Not implemented.");
}
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerSession.java
index fb82eff..edf3aeb 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerSession.java
@@ -44,7 +44,7 @@ public final class CsvSerializerSession extends WriterSerializerSession {
}
@Override /* SerializerSession */
- protected final void doSerialize(SerializerPipe pipe, Object o) throws Exception {
+ protected final void doSerialize(SerializerPipe pipe, Object o) throws IOException, SerializeException {
try (Writer w = pipe.getWriter()) {
ClassMeta<?> cm = getClassMetaForObject(o);
Collection<?> l = null;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/encoders/Finishable.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/encoders/Finishable.java
index 4ee2819..705beae 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/encoders/Finishable.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/encoders/Finishable.java
@@ -25,7 +25,7 @@ public interface Finishable {
* <p>
* Use this method when applying multiple filters in succession to the same output stream.
*
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
void finish() throws IOException;
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerSession.java
index 61cd251..1ec3eab 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerSession.java
@@ -14,6 +14,7 @@ package org.apache.juneau.html;
import static org.apache.juneau.html.HtmlDocSerializer.*;
+import java.io.IOException;
import java.util.*;
import org.apache.juneau.*;
@@ -86,10 +87,14 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
@Override /* Serializer */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
try (HtmlWriter w = getHtmlWriter(out)) {
- getTemplate().writeTo(this, w, o);
+ try {
+ getTemplate().writeTo(this, w, o);
+ } catch (Exception e) {
+ throw new SerializeException(e);
+ }
}
}
@@ -99,7 +104,7 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
* @param out
* Where to send the output from the serializer.
* @param o The object being serialized.
- * @throws Exception
+ * @throws Exception Error occurred during serialization.
*/
public void parentSerialize(Object out, Object o) throws Exception {
try (SerializerPipe pipe = createPipe(out)) {
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 b5fe5ed..45790db 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
@@ -16,6 +16,7 @@ import static javax.xml.stream.XMLStreamConstants.*;
import static org.apache.juneau.html.HtmlTag.*;
import static org.apache.juneau.internal.StringUtils.*;
+import java.io.IOException;
import java.lang.reflect.*;
import java.util.*;
@@ -57,8 +58,12 @@ public final class HtmlParserSession extends XmlParserSession {
}
@Override /* ParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
- return parseAnything(type, getXmlReader(pipe), getOuter(), true, null);
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
+ try {
+ return parseAnything(type, getXmlReader(pipe), getOuter(), true, null);
+ } catch (XMLStreamException e) {
+ throw new ParseException(e);
+ }
}
@Override /* ReaderParserSession */
@@ -80,7 +85,7 @@ public final class HtmlParserSession extends XmlParserSession {
* Precondition: Must be pointing at outer START_ELEMENT.
* Postcondition: Pointing at outer END_ELEMENT.
*/
- private <T> T parseAnything(ClassMeta<T> eType, XmlReader r, Object outer, boolean isRoot, BeanPropertyMeta pMeta) throws Exception {
+ private <T> T parseAnything(ClassMeta<T> eType, XmlReader r, Object outer, boolean isRoot, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException, XMLStreamException {
if (eType == null)
eType = (ClassMeta<T>)object();
@@ -268,7 +273,7 @@ public final class HtmlParserSession extends XmlParserSession {
throw new ParseException(this, "Unexpected tag ''{0}'' for type ''{1}''", tag, eType);
if (swap != null && o != null)
- o = swap.unswap(this, o, eType);
+ o = unswap(swap, o, eType);
if (outer != null)
setParent(eType, o, outer);
@@ -280,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 Exception {
+ private HtmlTag skipToData(XmlReader r) throws IOException, ParseException, XMLStreamException {
while (true) {
int event = r.next();
if (event == START_ELEMENT && "div".equals(r.getLocalName()) && "data".equals(r.getAttributeValue(null, "id"))) {
@@ -308,7 +313,7 @@ public final class HtmlParserSession extends XmlParserSession {
* Reads an anchor tag and converts it into a bean.
*/
private <T> T parseAnchor(XmlReader r, ClassMeta<T> beanType)
- throws Exception {
+ throws IOException, ParseException, XMLStreamException {
String href = r.getAttributeValue(null, "href");
String name = getElementText(r);
Class<T> beanClass = beanType.getInnerClass();
@@ -335,7 +340,7 @@ public final class HtmlParserSession extends XmlParserSession {
* Postcondition: Pointing at next START_ELEMENT or END_DOCUMENT event.
*/
private <K,V> Map<K,V> parseIntoMap(XmlReader r, Map<K,V> m, ClassMeta<K> keyType,
- ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException, XMLStreamException {
while (true) {
HtmlTag tag = nextTag(r, TR, xTABLE);
if (tag == xTABLE)
@@ -365,7 +370,7 @@ public final class HtmlParserSession extends XmlParserSession {
* Postcondition: Pointing at next START_ELEMENT or END_DOCUMENT event.
*/
private <E> Collection<E> parseIntoCollection(XmlReader r, Collection<E> l,
- ClassMeta<?> type, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<?> type, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException, XMLStreamException {
int argIndex = 0;
while (true) {
HtmlTag tag = nextTag(r, LI, xUL);
@@ -383,7 +388,7 @@ public final class HtmlParserSession extends XmlParserSession {
* Postcondition: Pointing at next START_ELEMENT or END_DOCUMENT event.
*/
private <E> Collection<E> parseTableIntoCollection(XmlReader r, Collection<E> l,
- ClassMeta<E> type, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<E> type, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException, XMLStreamException {
HtmlTag tag = nextTag(r, TR);
List<String> keys = new ArrayList<>();
@@ -483,7 +488,7 @@ public final class HtmlParserSession extends XmlParserSession {
* Precondition: Must be pointing at event following <table> event.
* Postcondition: Pointing at next START_ELEMENT or END_DOCUMENT event.
*/
- private <T> BeanMap<T> parseIntoBean(XmlReader r, BeanMap<T> m) throws Exception {
+ private <T> BeanMap<T> parseIntoBean(XmlReader r, BeanMap<T> m) throws IOException, ParseException, ExecutableException, XMLStreamException {
while (true) {
HtmlTag tag = nextTag(r, TR, xTABLE);
if (tag == xTABLE)
@@ -519,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 Exception {
+ private HtmlTag nextTag(XmlReader r, HtmlTag...expected) throws IOException, ParseException, XMLStreamException {
int et = r.next();
while (et != START_ELEMENT && et != END_ELEMENT && et != END_DOCUMENT)
@@ -547,7 +552,7 @@ public final class HtmlParserSession extends XmlParserSession {
* @param r The stream being read from.
* @throws XMLStreamException
*/
- private void skipTag(XmlReader r) throws Exception {
+ private void skipTag(XmlReader r) throws IOException, ParseException, XMLStreamException {
int et = r.getEventType();
if (et != START_ELEMENT)
@@ -575,7 +580,7 @@ public final class HtmlParserSession extends XmlParserSession {
}
}
- private void skipTag(XmlReader r, HtmlTag...expected) throws Exception {
+ private void skipTag(XmlReader r, HtmlTag...expected) throws IOException, ParseException, XMLStreamException {
HtmlTag tag = HtmlTag.forEvent(this, r);
if (tag.isOneOf(expected))
r.next();
@@ -601,10 +606,10 @@ public final class HtmlParserSession extends XmlParserSession {
*
* @param r The stream being read from.
* @return The parsed string.
- * @throws XMLStreamException
+ * @throws XMLStreamException Thrown by underlying XML stream.
*/
@Override /* XmlParserSession */
- protected final String parseText(XmlReader r) throws Exception {
+ protected final String parseText(XmlReader r) throws IOException, ParseException, XMLStreamException {
StringBuilder sb = getStringBuilder();
@@ -692,10 +697,11 @@ public final class HtmlParserSession extends XmlParserSession {
*
* @param r The stream being read from.
* @return The parsed string.
- * @throws XMLStreamException
+ * @throws XMLStreamException Thrown by underlying XML stream.
+ * @throws ParseException Malformed input encountered.
*/
@Override /* XmlParserSession */
- protected final String getElementText(XmlReader r) throws Exception {
+ protected final String getElementText(XmlReader r) throws IOException, XMLStreamException, ParseException {
r.next();
return parseText(r);
}
@@ -707,7 +713,7 @@ public final class HtmlParserSession extends XmlParserSession {
}
@Override /* XmlParserSession */
- protected final String parseWhitespaceElement(XmlReader r) throws Exception {
+ protected final String parseWhitespaceElement(XmlReader r) throws IOException, ParseException, XMLStreamException {
HtmlTag tag = HtmlTag.forEvent(this, r);
int et = r.next();
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializerSession.java
index b566092..91fa49a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializerSession.java
@@ -12,6 +12,9 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
+import java.io.IOException;
+
+import org.apache.juneau.BeanRecursionException;
import org.apache.juneau.jsonschema.*;
import org.apache.juneau.serializer.*;
@@ -40,7 +43,11 @@ public class HtmlSchemaDocSerializerSession extends HtmlDocSerializerSession {
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
- super.doSerialize(out, genSession.getSchema(o));
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
+ try {
+ super.doSerialize(out, genSession.getSchema(o));
+ } catch (BeanRecursionException e) {
+ throw new SerializeException(e);
+ }
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaSerializerSession.java
index f77fe0a..dc340fd 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaSerializerSession.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
+import java.io.IOException;
+
import org.apache.juneau.*;
import org.apache.juneau.jsonschema.*;
import org.apache.juneau.serializer.*;
@@ -41,8 +43,12 @@ public class HtmlSchemaSerializerSession extends HtmlSerializerSession {
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
- super.doSerialize(out, genSession.getSchema(o));
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
+ try {
+ super.doSerialize(out, genSession.getSchema(o));
+ } catch (BeanRecursionException e) {
+ throw new SerializeException(e);
+ }
}
//-----------------------------------------------------------------------------------------------------------------
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 e920d2e..0881c12 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
@@ -65,9 +65,9 @@ public class HtmlSerializerSession extends XmlSerializerSession {
*
* @param out The output target object.
* @return The output target object wrapped in an {@link HtmlWriter}.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- protected final HtmlWriter getHtmlWriter(SerializerPipe out) throws Exception {
+ protected final HtmlWriter getHtmlWriter(SerializerPipe out) throws IOException {
Object output = out.getRawOutput();
if (output instanceof HtmlWriter)
return (HtmlWriter)output;
@@ -150,7 +150,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
}
@Override /* Serializer */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
doSerialize(o, getHtmlWriter(out));
}
@@ -163,12 +163,12 @@ public class HtmlSerializerSession extends XmlSerializerSession {
* @return The same writer passed in.
* @throws IOException If a problem occurred trying to send output to the writer.
*/
- private XmlWriter doSerialize(Object o, XmlWriter w) throws Exception {
+ private XmlWriter doSerialize(Object o, XmlWriter w) throws IOException, SerializeException {
serializeAnything(w, o, getExpectedRootType(o), null, null, getInitialDepth()-1, true);
return w;
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({ "rawtypes" })
@Override /* XmlSerializerSession */
protected ContentResult serializeAnything(
XmlWriter out,
@@ -180,10 +180,10 @@ public class HtmlSerializerSession extends XmlSerializerSession {
XmlFormat format,
boolean isMixed,
boolean preserveWhitespace,
- BeanPropertyMeta pMeta) throws Exception {
+ BeanPropertyMeta pMeta) throws IOException, SerializeException {
// If this is a bean, then we want to serialize it as HTML unless it's @Html(format=XML).
- ClassMeta<?> type = push(elementName, o, eType);
+ ClassMeta<?> type = push2(elementName, o, eType);
pop();
if (type == null)
@@ -192,7 +192,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
type = ((Delegate)o).getClassMeta();
PojoSwap swap = type.getPojoSwap(this);
if (swap != null) {
- o = swap.swap(this, o);
+ o = swap(swap, o);
type = swap.getSwapClassMeta(this);
if (type.isObject())
type = getClassMetaForObject(o);
@@ -218,11 +218,12 @@ public class HtmlSerializerSession extends XmlSerializerSession {
* @param xIndent The current indentation value.
* @param isRoot <jk>true</jk> if this is the root element of the document.
* @return The type of content encountered. Either simple (no whitespace) or normal (elements with whitespace).
- * @throws Exception If a problem occurred trying to convert the output.
+ * @throws IOException Thrown by underlying stream.
+ * @throws SerializeException Generic serialization error occurred.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected ContentResult serializeAnything(XmlWriter out, Object o,
- ClassMeta<?> eType, String name, BeanPropertyMeta pMeta, int xIndent, boolean isRoot) throws Exception {
+ ClassMeta<?> eType, String name, BeanPropertyMeta pMeta, int xIndent, boolean isRoot) throws IOException, SerializeException {
ClassMeta<?> aType = null; // The actual type
ClassMeta<?> wType = null; // The wrapped type (delegate)
@@ -231,7 +232,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
if (eType == null)
eType = object();
- aType = push(name, o, eType);
+ aType = push2(name, o, eType);
// Handle recursion
if (aType == null) {
@@ -264,7 +265,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
// Swap if necessary
PojoSwap swap = aType.getPojoSwap(this);
if (swap != null) {
- o = swap.swap(this, o);
+ o = swap(swap, o);
sType = swap.getSwapClassMeta(this);
// If the getSwapClass() method returns Object, we need to figure out
@@ -372,7 +373,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
@SuppressWarnings({ "rawtypes", "unchecked" })
private void serializeMap(XmlWriter out, Map m, ClassMeta<?> sType,
- ClassMeta<?> eKeyType, ClassMeta<?> eValueType, String typeName, BeanPropertyMeta ppMeta) throws Exception {
+ ClassMeta<?> eKeyType, ClassMeta<?> eValueType, String typeName, BeanPropertyMeta ppMeta) throws IOException, SerializeException {
ClassMeta<?> keyType = eKeyType == null ? string() : eKeyType;
ClassMeta<?> valueType = eValueType == null ? object() : eValueType;
@@ -432,7 +433,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
out.ie(i).eTag("table").nl(i);
}
- private void serializeBeanMap(XmlWriter out, BeanMap<?> m, ClassMeta<?> eType, BeanPropertyMeta ppMeta) throws Exception {
+ private void serializeBeanMap(XmlWriter out, BeanMap<?> m, ClassMeta<?> eType, BeanPropertyMeta ppMeta) throws IOException, SerializeException {
HtmlClassMeta cHtml = cHtml(m.getClassMeta());
HtmlBeanPropertyMeta bpHtml = bpHtml(ppMeta);
@@ -506,7 +507,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
}
@SuppressWarnings({ "rawtypes", "unchecked" })
- private void serializeCollection(XmlWriter out, Object in, ClassMeta<?> sType, ClassMeta<?> eType, String name, BeanPropertyMeta ppMeta) throws Exception {
+ private void serializeCollection(XmlWriter out, Object in, ClassMeta<?> sType, ClassMeta<?> eType, String name, BeanPropertyMeta ppMeta) throws IOException, SerializeException {
HtmlClassMeta cHtml = cHtml(sType);
HtmlBeanPropertyMeta bpHtml = bpHtml(ppMeta);
@@ -555,7 +556,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
if (cm != null && cm.getPojoSwap(this) != null) {
PojoSwap swap = cm.getPojoSwap(this);
- o = swap.swap(this, o);
+ o = swap(swap, o);
cm = swap.getSwapClassMeta(this);
}
@@ -695,7 +696,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
* 2-dimensional tables are used for collections of objects that all have the same set of property names.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
- private Object[] getTableHeaders(Collection c, HtmlBeanPropertyMeta bpHtml) throws Exception {
+ private Object[] getTableHeaders(Collection c, HtmlBeanPropertyMeta bpHtml) throws SerializeException {
if (c.size() == 0)
return null;
c = sort(c);
@@ -713,7 +714,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
PojoSwap swap = cm.getPojoSwap(this);
if (swap != null) {
- o1 = swap.swap(this, o1);
+ o1 = swap(swap, o1);
cm = swap.getSwapClassMeta(this);
}
@@ -779,7 +780,7 @@ public class HtmlSerializerSession extends XmlSerializerSession {
PojoSwap ps = cm == null ? null : cm.getPojoSwap(this);
if (ps != null) {
- o = ps.swap(this, o);
+ o = swap(ps, o);
cm = ps.getSwapClassMeta(this);
}
if (prevC.contains(cm))
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlStrippedDocSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlStrippedDocSerializerSession.java
index b7f37f6..458fdf8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlStrippedDocSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlStrippedDocSerializerSession.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
+import java.io.IOException;
import java.lang.reflect.*;
import java.util.*;
@@ -40,7 +41,7 @@ public class HtmlStrippedDocSerializerSession extends HtmlSerializerSession {
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
try (HtmlWriter w = getHtmlWriter(out)) {
if (o == null
|| (o instanceof Collection && ((Collection<?>)o).size() == 0)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlTag.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlTag.java
index 13fe45d..2916b5f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlTag.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlTag.java
@@ -72,7 +72,7 @@ enum HtmlTag {
cache.put(id, this);
}
- static HtmlTag forEvent(ParserSession session, XMLStreamReader r) throws Exception {
+ static HtmlTag forEvent(ParserSession session, XMLStreamReader r) throws ParseException {
int et = r.getEventType();
if (et == START_ELEMENT)
return forString(r.getLocalName(), false);
@@ -81,7 +81,7 @@ enum HtmlTag {
throw new ParseException(session, "Invalid call to HtmlTag.forEvent on event of type ''{0}''", XmlUtils.toReadableEvent(r));
}
- static HtmlTag forString(String tag, boolean end) throws Exception {
+ static HtmlTag forString(String tag, boolean end) {
char c = tag.charAt(0);
HtmlTag t = null;
if (c == 'u')
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlWidget.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlWidget.java
index da854f6..fd31b47 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlWidget.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlWidget.java
@@ -48,7 +48,7 @@ public interface HtmlWidget {
*
* @param session The current serializer session.
* @return The HTML content of this widget.
- * @throws Exception
+ * @throws Exception Error occurred.
*/
public String getHtml(VarResolverSession session) throws Exception;
@@ -60,7 +60,7 @@ public interface HtmlWidget {
*
* @param session The current serializer session.
* @return The Javascript needed by this widget.
- * @throws Exception
+ * @throws Exception Error occurred.
*/
public String getScript(VarResolverSession session) throws Exception;
@@ -72,7 +72,7 @@ public interface HtmlWidget {
*
* @param session The current serializer session.
* @return The CSS styles needed by this widget.
- * @throws Exception
+ * @throws Exception Error occurred.
*/
public String getStyle(VarResolverSession session) throws Exception;
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Age.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Age.java
index 0a4c504..551f2fd 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Age.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Age.java
@@ -62,7 +62,7 @@ public final class Age extends HeaderInteger {
/**
* Constructor.
*
- * @param value
+ * @param value The value for this header.
*/
public Age(Integer value) {
super(value);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
index cb10b95..a4db9fb 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Allow.java
@@ -72,7 +72,7 @@ public final class Allow extends HeaderStringArray {
/**
* Constructor.
*
- * @param value
+ * @param value The value for this header.
*/
public Allow(String[] value) {
super(value);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLanguage.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLanguage.java
index 6bfd6cf..8330dd5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLanguage.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLanguage.java
@@ -77,7 +77,7 @@ public final class ContentLanguage extends HeaderStringArray {
/**
* Constructor.
*
- * @param value
+ * @param value The value for this header.
*/
public ContentLanguage(String[] value) {
super(value);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLength.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLength.java
index 0caebc4..80a44f9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLength.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ContentLength.java
@@ -65,7 +65,7 @@ public final class ContentLength extends HeaderLong {
/**
* Constructor.
*
- * @param value
+ * @param value The value for this header.
*/
public ContentLength(Long value) {
super(value);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/MaxForwards.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/MaxForwards.java
index 68781ec..9a9ea62 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/MaxForwards.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/MaxForwards.java
@@ -63,7 +63,7 @@ public final class MaxForwards extends HeaderInteger {
/**
* Constructor.
*
- * @param value
+ * @param value The value for this header.
*/
public MaxForwards(Integer value) {
super(value);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ReaderResource.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ReaderResource.java
index 219e6f2..6244b2f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ReaderResource.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/ReaderResource.java
@@ -53,7 +53,7 @@ public class ReaderResource implements Writable {
* Constructor.
*
* @param b Builder containing values to initialize this object with.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
protected ReaderResource(Builder b) throws IOException {
this(b.mediaType, b.headers, b.cached, b.contents.toArray());
@@ -77,7 +77,7 @@ public class ReaderResource implements Writable {
* <li><c>File</c>
* <li><c>CharSequence</c> - Converted to UTF-8 bytes.
* </ul>
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public ReaderResource(MediaType mediaType, Map<String,Object> headers, boolean cached, Object...contents) throws IOException {
this.mediaType = mediaType;
@@ -203,7 +203,7 @@ public class ReaderResource implements Writable {
* Create a new {@link ReaderResource} using values in this builder.
*
* @return A new immutable {@link ReaderResource} object.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public ReaderResource build() throws IOException {
return new ReaderResource(this);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/StreamResource.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/StreamResource.java
index 84f111a..e945ac5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/StreamResource.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/StreamResource.java
@@ -70,7 +70,7 @@ public class StreamResource implements Streamable {
* <li><c>File</c>
* <li><c>CharSequence</c> - Converted to UTF-8 bytes.
* </ul>
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public StreamResource(MediaType mediaType, Map<String,Object> headers, boolean cached, Object...contents) throws IOException {
this.mediaType = mediaType;
@@ -195,7 +195,7 @@ public class StreamResource implements Streamable {
* Create a new {@link StreamResource} using values in this builder.
*
* @return A new immutable {@link StreamResource} object.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public StreamResource build() throws IOException {
return new StreamResource(this);
@@ -233,7 +233,7 @@ public class StreamResource implements Streamable {
* Returns the contents of this stream resource.
*
* @return The contents of this stream resource.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public InputStream getContents() throws IOException {
if (contents.length == 1) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Upgrade.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Upgrade.java
index f693524..d9d1247 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Upgrade.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Upgrade.java
@@ -86,7 +86,7 @@ public final class Upgrade extends HeaderStringArray {
/**
* Constructor.
*
- * @param value
+ * @param value The value for this header.
*/
public Upgrade(String[] value) {
super(value);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Via.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Via.java
index f1ad6ee..571d9a3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Via.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/Via.java
@@ -122,7 +122,7 @@ public final class Via extends HeaderStringArray {
/**
* Constructor.
*
- * @param value
+ * @param value The value for this header.
*/
public Via(String[] value) {
super(value);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPart.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPart.java
index d6d845d..d95509d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPart.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPart.java
@@ -95,8 +95,8 @@ public class HttpPart {
* Returns the value of the part converted to a string.
*
* @return The value of the part converted to a string.
- * @throws SchemaValidationException
- * @throws SerializeException
+ * @throws SchemaValidationException HTTP part failed schema validation.
+ * @throws SerializeException HTTP part could not be serialized.
*/
public String asString() throws SchemaValidationException, SerializeException {
if (spart != null)
@@ -107,10 +107,10 @@ public class HttpPart {
/**
* Returns the value of the part converted to a string.
*
- * @param c
+ * @param c The type to convert to.
* @return The value of the part converted to a string.
- * @throws SchemaValidationException
- * @throws ParseException
+ * @throws SchemaValidationException HTTP part failed schema validation.
+ * @throws ParseException Malformed input encountered.
*/
public <T> T asType(Class<T> c) throws SchemaValidationException, ParseException {
return parser.createPartSession(pargs).parse(partType, schema, spart, c);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParser.java
index b3ecd97..b8ac7d7 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParser.java
@@ -68,7 +68,7 @@ public interface HttpPartParser {
* @param in The value being parsed.
* @param toType The POJO type to transform the input into.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input fails schema validation.
*/
public <T> T parse(HttpPartType partType, HttpPartSchema schema, String in, Class<T> toType) throws ParseException, SchemaValidationException;
@@ -85,7 +85,7 @@ public interface HttpPartParser {
* @param toType The POJO type to transform the input into.
* @param toTypeArgs The POJO type arguments for Collections and Maps.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input fails schema validation.
*/
public <T> T parse(HttpPartType partType, HttpPartSchema schema, String in, Type toType, Type...toTypeArgs) throws ParseException, SchemaValidationException;
@@ -100,7 +100,7 @@ public interface HttpPartParser {
* @param in The value being parsed.
* @param toType The POJO type to transform the input into.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input fails schema validation.
*/
public <T> T parse(HttpPartSchema schema, String in, Class<T> toType) throws ParseException, SchemaValidationException;
@@ -116,7 +116,7 @@ public interface HttpPartParser {
* @param toType The POJO type to transform the input into.
* @param toTypeArgs The POJO type arguments for Collections and Maps.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input fails schema validation.
*/
public <T> T parse(HttpPartSchema schema, String in, Type toType, Type...toTypeArgs) throws ParseException, SchemaValidationException;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParserSession.java
index 28b2927..6c3eaed 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParserSession.java
@@ -37,7 +37,7 @@ public interface HttpPartParserSession {
* @param in The input being parsed.
* @param toType The POJO type to transform the input into.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input or resulting HTTP part object fails schema validation.
*/
public <T> T parse(HttpPartType partType, HttpPartSchema schema, String in, ClassMeta<T> toType) throws ParseException, SchemaValidationException;
@@ -53,7 +53,7 @@ public interface HttpPartParserSession {
* @param in The input being parsed.
* @param toType The POJO type to transform the input into.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input or resulting HTTP part object fails schema validation.
*/
public <T> T parse(HttpPartType partType, HttpPartSchema schema, String in, Class<T> toType) throws ParseException, SchemaValidationException;
@@ -70,7 +70,7 @@ public interface HttpPartParserSession {
* @param toType The POJO type to transform the input into.
* @param toTypeArgs The POJO type arguments for Collection and Map types.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input or resulting HTTP part object fails schema validation.
*/
public <T> T parse(HttpPartType partType, HttpPartSchema schema, String in, Type toType, Type...toTypeArgs) throws ParseException, SchemaValidationException;
@@ -85,7 +85,7 @@ public interface HttpPartParserSession {
* @param in The input being parsed.
* @param toType The POJO type to transform the input into.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input or resulting HTTP part object fails schema validation.
*/
public <T> T parse(HttpPartSchema schema, String in, ClassMeta<T> toType) throws ParseException, SchemaValidationException;
@@ -100,7 +100,7 @@ public interface HttpPartParserSession {
* @param in The input being parsed.
* @param toType The POJO type to transform the input into.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input or resulting HTTP part object fails schema validation.
*/
public <T> T parse(HttpPartSchema schema, String in, Class<T> toType) throws ParseException, SchemaValidationException;
@@ -116,7 +116,7 @@ public interface HttpPartParserSession {
* @param toType The POJO type to transform the input into.
* @param toTypeArgs The POJO type arguments for Collection and Map types.
* @return The parsed value.
- * @throws ParseException If a problem occurred while trying to parse the input.
+ * @throws ParseException Malformed input encountered.
* @throws SchemaValidationException If the input or resulting HTTP part object fails schema validation.
*/
public <T> T parse(HttpPartSchema schema, String in, Type toType, Type...toTypeArgs) throws ParseException, SchemaValidationException;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSerializer.java
index a412546..5775485 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSerializer.java
@@ -82,7 +82,7 @@ public interface HttpPartSerializer {
* @throws SerializeException If a problem occurred while trying to parse the input.
* @throws SchemaValidationException If the output fails schema validation.
*/
- public String serialize(HttpPartType partType, HttpPartSchema schema, Object value) throws SchemaValidationException, SerializeException ;
+ public String serialize(HttpPartType partType, HttpPartSchema schema, Object value) throws SchemaValidationException, SerializeException;
/**
* Convenience method for creating a no-arg session and serializing a part with no specified part type.
@@ -96,5 +96,5 @@ public interface HttpPartSerializer {
* @throws SerializeException If a problem occurred while trying to parse the input.
* @throws SchemaValidationException If the output fails schema validation.
*/
- public String serialize(HttpPartSchema schema, Object value) throws SchemaValidationException, SerializeException ;
+ public String serialize(HttpPartSchema schema, Object value) throws SchemaValidationException, 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 48f807c..7341f6b 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
@@ -31,7 +31,7 @@ public class DelegateMap<T extends Map> extends ObjectMap implements Delegate<T>
* Constructor.
*
* @param m The metadata object that created this delegate object.
- * @param session
+ * @param session The current bean session.
*/
@SuppressWarnings("unchecked")
public DelegateMap(T m, BeanSession session) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FileUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FileUtils.java
index 1e7bb54..4c0612a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FileUtils.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/FileUtils.java
@@ -132,7 +132,7 @@ public class FileUtils {
*
* @param name The file name
* @return A newly-created temporary file.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static File createTempFile(String name) throws IOException {
String[] parts = name.split("\\.");
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/IOUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/IOUtils.java
index c654aba..14475cc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/IOUtils.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/IOUtils.java
@@ -55,7 +55,7 @@ public final class IOUtils {
*
* @param in The object to read.
* @return The object serialized to a string, or <jk>null</jk> if it wasn't a supported type.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static String read(Object in) throws IOException {
if (in == null)
@@ -78,7 +78,7 @@ public final class IOUtils {
*
* @param in The objects to read.
* @return The objects serialized to a string, never <jk>null</jk>.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static String readAll(Object...in) throws IOException {
if (in.length == 1)
@@ -303,7 +303,7 @@ public final class IOUtils {
*
* @param in The objects to read.
* @return The objects serialized to a byte array, never <jk>null</jk>.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static byte[] readBytes(Object...in) throws IOException {
if (in.length == 1)
@@ -325,7 +325,7 @@ public final class IOUtils {
* @param out The file to write the output to.
* @param in The reader to pipe from.
* @return The number of characters written to the file.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static int write(File out, Reader in) throws IOException {
assertFieldNotNull(out, "out");
@@ -341,7 +341,7 @@ public final class IOUtils {
* @param out The file to write the output to.
* @param in The input stream to pipe from.
* @return The number of characters written to the file.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static int write(File out, InputStream in) throws IOException {
assertFieldNotNull(out, "out");
@@ -362,7 +362,7 @@ public final class IOUtils {
* Can be any of the types defined by {@link #toReader(Object)}.
* @param out
* The writer to pipe to.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static void pipe(Object in, Writer out) throws IOException {
IOPipe.create(in, out).run();
@@ -379,7 +379,7 @@ public final class IOUtils {
* Can be any of the types defined by {@link #toInputStream(Object)}.
* @param out
* The writer to pipe to.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static void pipe(Object in, OutputStream out) throws IOException {
IOPipe.create(in, out).run();
@@ -404,7 +404,7 @@ public final class IOUtils {
*
* @param is The input stream to read from.
* @return The number of bytes read.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static long count(InputStream is) throws IOException {
assertFieldNotNull(is, "is");
@@ -424,7 +424,7 @@ public final class IOUtils {
*
* @param r The reader to read from.
* @return The number of characters read.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static long count(Reader r) throws IOException {
assertFieldNotNull(r, "r");
@@ -548,7 +548,7 @@ public final class IOUtils {
* @param o
* The objects to flush.
* <jk>null</jk> entries are ignored.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static void flush(Object...o) throws IOException {
IOException ex = null;
@@ -572,7 +572,7 @@ public final class IOUtils {
* @param o
* The list of all objects to close.
* <jk>null</jk> entries are ignored.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static void close(Object...o) throws IOException {
IOException ex = null;
@@ -667,7 +667,7 @@ public final class IOUtils {
*
* @param path The file path.
* @param contents The new file contents.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static void write(String path, String contents) throws IOException {
write(new File(path), new StringReader(contents));
@@ -679,7 +679,7 @@ public final class IOUtils {
* @param name The file name.
* @param paths The paths to search.
* @return The file contents, or <jk>null</jk> if not found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public static String loadSystemResourceAsString(String name, String...paths) throws IOException {
for (String path : paths) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ObjectUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ObjectUtils.java
index 5e0f391..02b9c05 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ObjectUtils.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ObjectUtils.java
@@ -249,7 +249,7 @@ public final class ObjectUtils {
/**
* Returns the first non-null value in the specified array
*
- * @param t
+ * @param t The values to check.
* @return The first non-null value, or <jk>null</jk> if the array is null or empty or contains only <jk>null</jk> values.
*/
@SafeVarargs
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
index edc522a..cb82e36 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
@@ -82,11 +82,11 @@ public final class StringUtils {
* <li> BigDecimal
* </ul>
* If <jk>null</jk>, uses the best guess.
- * @throws IOException If a problem occurred trying to read from the reader.
* @return The parsed number.
- * @throws Exception
+ * @throws IOException If a problem occurred trying to read from the reader.
+ * @throws ParseException Malformed input encountered.
*/
- public static Number parseNumber(ParserReader r, Class<? extends Number> type) throws Exception {
+ public static Number parseNumber(ParserReader r, Class<? extends Number> type) throws ParseException, IOException {
return parseNumber(parseNumberString(r), type);
}
@@ -95,9 +95,9 @@ public final class StringUtils {
*
* @param r The reader to read form.
* @return The parsed number string.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- public static String parseNumberString(ParserReader r) throws Exception {
+ public static String parseNumberString(ParserReader r) throws IOException {
r.mark();
int c = 0;
while (true) {
@@ -131,7 +131,7 @@ public final class StringUtils {
* </ul>
* If <jk>null</jk> or <c>Number</c>, uses the best guess.
* @return The parsed number, or <jk>null</jk> if the string was null.
- * @throws ParseException
+ * @throws ParseException Malformed input encountered.
*/
public static Number parseNumber(String s, Class<? extends Number> type) throws ParseException {
if (s == null)
@@ -1329,7 +1329,7 @@ public final class StringUtils {
*
* @param date The date string.
* @return The parsed date.
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException Value was not a valid date.
*/
public static Date parseIsoDate(String date) throws IllegalArgumentException {
if (isEmpty(date))
@@ -1346,7 +1346,7 @@ public final class StringUtils {
*
* @param date The date string.
* @return The parsed calendar.
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException Value was not a valid date.
*/
public static Calendar parseIsoCalendar(String date) throws IllegalArgumentException {
if (isEmpty(date))
@@ -2373,7 +2373,7 @@ public final class StringUtils {
*
* @param s The string to parse.
* @return The parsed string.
- * @throws ParseException
+ * @throws ParseException Malformed input encountered.
*/
public static ObjectList parseListOrCdl(String s) throws ParseException {
if (isEmpty(s))
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ThrowableUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ThrowableUtils.java
index 7065846..7c2b01e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ThrowableUtils.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ThrowableUtils.java
@@ -27,7 +27,7 @@ public class ThrowableUtils {
* @param o The object to check.
* @param msg The message of the IllegalArgumentException.
* @param args Optional {@link MessageFormat}-style arguments.
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException Constructed exception.
*/
public static void assertNotNull(Object o, String msg, Object...args) throws IllegalArgumentException {
if (o == null)
@@ -39,7 +39,7 @@ public class ThrowableUtils {
*
* @param fieldValue The object to check.
* @param fieldName The name of the field.
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException Constructed exception.
*/
public static void assertFieldNotNull(Object fieldValue, String fieldName) throws IllegalArgumentException {
if (fieldValue == null)
@@ -51,7 +51,7 @@ public class ThrowableUtils {
*
* @param fieldValue The object to check.
* @param fieldName The name of the field.
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException Constructed exception.
*/
public static void assertFieldPositive(int fieldValue, String fieldName) throws IllegalArgumentException {
if (fieldValue <= 0)
@@ -63,7 +63,7 @@ public class ThrowableUtils {
*
* @param msg The message of the IllegalArgumentException.
* @param args Optional {@link MessageFormat}-style arguments.
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException Constructed exception.
*/
public static void illegalArg(String msg, Object...args) throws IllegalArgumentException {
throw new FormattedIllegalArgumentException(msg, args);
@@ -75,7 +75,7 @@ public class ThrowableUtils {
* @param threadId The ID of the thread to compare against.
* @param msg The message of the IllegalStateException.
* @param args Optional {@link MessageFormat}-style arguments.
- * @throws IllegalStateException
+ * @throws IllegalStateException Constructed exception.
*/
public static void assertSameThread(long threadId, String msg, Object...args) throws IllegalStateException {
if (Thread.currentThread().getId() != threadId)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParserSession.java
index 5a0eca8..650b09d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParserSession.java
@@ -38,9 +38,13 @@ public class JsoParserSession extends InputStreamParserSession {
}
@Override /* ParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException {
ObjectInputStream ois = new ObjectInputStream(pipe.getInputStream());
- return (T)ois.readObject();
+ try {
+ return (T)ois.readObject();
+ } catch (ClassNotFoundException e) {
+ throw new ParseException(e);
+ }
}
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializerSession.java
index 68d82f6..2461f31 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializerSession.java
@@ -43,7 +43,7 @@ public class JsoSerializerSession extends OutputStreamSerializerSession {
}
@Override /* OutputStreamSerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
try (ObjectOutputStream oos = new ObjectOutputStream(out.getOutputStream())) {
oos.writeObject(o);
}
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 ed24c11..0540718 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
@@ -83,7 +83,7 @@ public final class JsonParserSession extends ReaderParserSession {
}
@Override /* ParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
try (ParserReader r = pipe.getParserReader()) {
if (r == null)
return null;
@@ -94,7 +94,7 @@ public final class JsonParserSession extends ReaderParserSession {
}
@Override /* ReaderParserSession */
- protected <K,V> Map<K,V> doParseIntoMap(ParserPipe pipe, Map<K,V> m, Type keyType, Type valueType) throws Exception {
+ protected <K,V> Map<K,V> doParseIntoMap(ParserPipe pipe, Map<K,V> m, Type keyType, Type valueType) throws IOException, ParseException, ExecutableException {
try (ParserReader r = pipe.getParserReader()) {
m = parseIntoMap2(r, m, (ClassMeta<K>)getClassMeta(keyType), (ClassMeta<V>)getClassMeta(valueType), null);
validateEnd(r);
@@ -103,7 +103,7 @@ public final class JsonParserSession extends ReaderParserSession {
}
@Override /* ReaderParserSession */
- protected <E> Collection<E> doParseIntoCollection(ParserPipe pipe, Collection<E> c, Type elementType) throws Exception {
+ protected <E> Collection<E> doParseIntoCollection(ParserPipe pipe, Collection<E> c, Type elementType) throws IOException, ParseException, ExecutableException {
try (ParserReader r = pipe.getParserReader()) {
c = parseIntoCollection2(r, c, getClassMeta(elementType), null);
validateEnd(r);
@@ -111,7 +111,7 @@ public final class JsonParserSession extends ReaderParserSession {
}
}
- private <T> T parseAnything(ClassMeta<?> eType, ParserReader r, Object outer, BeanPropertyMeta pMeta) throws Exception {
+ private <T> T parseAnything(ClassMeta<?> eType, ParserReader r, Object outer, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
if (eType == null)
eType = object();
@@ -222,7 +222,7 @@ public final class JsonParserSession extends ReaderParserSession {
skipWrapperAttrEnd(r);
if (swap != null && o != null)
- o = swap.unswap(this, o, eType);
+ o = unswap(swap, o, eType);
if (outer != null)
setParent(eType, o, outer);
@@ -230,14 +230,14 @@ public final class JsonParserSession extends ReaderParserSession {
return (T)o;
}
- private Number parseNumber(ParserReader r, Class<? extends Number> type) throws Exception {
+ private Number parseNumber(ParserReader r, Class<? extends Number> type) throws IOException, ParseException {
int c = r.peek();
if (c == '\'' || c == '"')
return parseNumber(r, parseString(r), type);
return parseNumber(r, parseNumberString(r), type);
}
- private Number parseNumber(ParserReader r, String s, Class<? extends Number> type) throws Exception {
+ private Number parseNumber(ParserReader r, String s, Class<? extends Number> type) throws IOException, ParseException {
// JSON has slightly different number rules from Java.
// Strict mode enforces these different rules, lax does not.
@@ -277,7 +277,7 @@ public final class JsonParserSession extends ReaderParserSession {
return StringUtils.parseNumber(s, type);
}
- private Boolean parseBoolean(ParserReader r) throws Exception {
+ private Boolean parseBoolean(ParserReader r) throws IOException, ParseException {
int c = r.peek();
if (c == '\'' || c == '"')
return Boolean.valueOf(parseString(r));
@@ -293,7 +293,7 @@ public final class JsonParserSession extends ReaderParserSession {
}
private <K,V> Map<K,V> parseIntoMap2(ParserReader r, Map<K,V> m, ClassMeta<K> keyType,
- ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
if (keyType == null)
keyType = (ClassMeta<K>)string();
@@ -379,7 +379,7 @@ public final class JsonParserSession extends ReaderParserSession {
* Parse a JSON attribute from the character array at the specified position, then
* set the position marker to the last character in the field name.
*/
- private String parseFieldName(ParserReader r) throws Exception {
+ private String parseFieldName(ParserReader r) throws IOException, ParseException {
int c = r.peek();
if (c == '\'' || c == '"')
return parseString(r);
@@ -403,7 +403,7 @@ public final class JsonParserSession extends ReaderParserSession {
private static final AsciiSet VALID_BARE_CHARS = AsciiSet.create().range('A','Z').range('a','z').range('0','9').chars("$_-.").build();
private <E> Collection<E> parseIntoCollection2(ParserReader r, Collection<E> l,
- ClassMeta<?> type, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<?> type, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
int S0=0; // Looking for outermost [
int S1=1; // Looking for starting [ or { or " or ' or LITERAL or ]
@@ -465,7 +465,7 @@ public final class JsonParserSession extends ReaderParserSession {
return null; // Unreachable.
}
- private <T> BeanMap<T> parseIntoBeanMap2(ParserReader r, BeanMap<T> m) throws Exception {
+ private <T> BeanMap<T> parseIntoBeanMap2(ParserReader r, BeanMap<T> m) throws IOException, ParseException, ExecutableException {
int S0=0; // Looking for outer {
int S1=1; // Looking for attrName start.
@@ -557,7 +557,7 @@ public final class JsonParserSession extends ReaderParserSession {
* If the string consists of a concatenation of strings (e.g. 'AAA' + "BBB"), this method
* will automatically concatenate the strings and return the result.
*/
- private String parseString(ParserReader r) throws Exception {
+ private String parseString(ParserReader r) throws IOException, ParseException {
r.mark();
int qc = r.read(); // The quote character being used (" or ')
if (qc != '"' && isStrict()) {
@@ -641,7 +641,7 @@ public final class JsonParserSession extends ReaderParserSession {
* Looks for the keywords true, false, or null.
* Throws an exception if any of these keywords are not found at the specified position.
*/
- private void parseKeyword(String keyword, ParserReader r) throws Exception {
+ private void parseKeyword(String keyword, ParserReader r) throws IOException, ParseException {
try {
String s = r.read(keyword.length());
if (s.equals(keyword))
@@ -658,7 +658,7 @@ public final class JsonParserSession extends ReaderParserSession {
* the comments and whitespace. Otherwise, the cursor will be set to the last position of
* the comments and whitespace.
*/
- private void skipCommentsAndSpace(ParserReader r) throws Exception {
+ private void skipCommentsAndSpace(ParserReader r) throws IOException, ParseException {
int c = 0;
while ((c = r.read()) != -1) {
if (! isWhitespace(c)) {
@@ -678,7 +678,7 @@ public final class JsonParserSession extends ReaderParserSession {
* Doesn't actually parse anything, but moves the position beyond the construct "{wrapperAttr:" when
* the @Json(wrapperAttr) annotation is used on a class.
*/
- private void skipWrapperAttrStart(ParserReader r, String wrapperAttr) throws Exception {
+ private void skipWrapperAttrStart(ParserReader r, String wrapperAttr) throws IOException, ParseException {
int S0=0; // Looking for outer {
int S1=1; // Looking for attrName start.
@@ -773,7 +773,7 @@ public final class JsonParserSession extends ReaderParserSession {
* Call this method after you've finished a parsing a string to make sure that if there's any
* remainder in the input, that it consists only of whitespace and comments.
*/
- private void validateEnd(ParserReader r) throws Exception {
+ private void validateEnd(ParserReader r) throws IOException, ParseException {
if (! isValidateEnd())
return;
skipCommentsAndSpace(r);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializerSession.java
index 4ac53d1..ff17767 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializerSession.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.json;
+import java.io.IOException;
+
import org.apache.juneau.*;
import org.apache.juneau.jsonschema.*;
import org.apache.juneau.serializer.*;
@@ -45,8 +47,12 @@ public class JsonSchemaSerializerSession extends JsonSerializerSession {
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
- super.doSerialize(out, genSession.getSchema(o));
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
+ try {
+ super.doSerialize(out, genSession.getSchema(o));
+ } catch (BeanRecursionException e) {
+ throw new SerializeException(e);
+ }
}
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerSession.java
index 4debee8..915fb84 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerSession.java
@@ -49,7 +49,7 @@ public class JsonSerializerSession extends WriterSerializerSession {
}
@Override /* SerializerSesssion */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
serializeAnything(getJsonWriter(out), o, getExpectedRootType(o), "root", null);
}
@@ -61,7 +61,7 @@ public class JsonSerializerSession extends WriterSerializerSession {
*
* @param o The object to serialize.
* @return The serialized object.
- * @throws Exception
+ * @throws Exception Error occurred.
*/
protected String serializeJson(Object o) throws Exception {
StringWriter sw = new StringWriter();
@@ -79,10 +79,11 @@ public class JsonSerializerSession extends WriterSerializerSession {
* @param attrName The attribute name.
* @param pMeta The bean property currently being parsed.
* @return The same writer passed in.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
+ * @throws SerializeException General serialization error occurred.
*/
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected JsonWriter serializeAnything(JsonWriter out, Object o, ClassMeta<?> eType, String attrName, BeanPropertyMeta pMeta) throws Exception {
+ @SuppressWarnings({ "rawtypes" })
+ protected JsonWriter serializeAnything(JsonWriter out, Object o, ClassMeta<?> eType, String attrName, BeanPropertyMeta pMeta) throws IOException, SerializeException {
if (o == null) {
out.append("null");
@@ -95,7 +96,7 @@ public class JsonSerializerSession extends WriterSerializerSession {
ClassMeta<?> aType; // The actual type
ClassMeta<?> sType; // The serialized type
- aType = push(attrName, o, eType);
+ aType = push2(attrName, o, eType);
boolean isRecursion = aType == null;
// Handle recursion
@@ -110,7 +111,7 @@ public class JsonSerializerSession extends WriterSerializerSession {
// Swap if necessary
PojoSwap swap = aType.getPojoSwap(this);
if (swap != null) {
- o = swap.swap(this, o);
+ o = swap(swap, o);
sType = swap.getSwapClassMeta(this);
// If the getSwapClass() method returns Object, we need to figure out
@@ -160,7 +161,7 @@ public class JsonSerializerSession extends WriterSerializerSession {
}
@SuppressWarnings({ "rawtypes", "unchecked" })
- private SerializerWriter serializeMap(JsonWriter out, Map m, ClassMeta<?> type) throws Exception {
+ private SerializerWriter serializeMap(JsonWriter out, Map m, ClassMeta<?> type) throws IOException, SerializeException {
ClassMeta<?> keyType = type.getKeyType(), valueType = type.getValueType();
@@ -190,7 +191,7 @@ public class JsonSerializerSession extends WriterSerializerSession {
return out;
}
- private SerializerWriter serializeBeanMap(JsonWriter out, BeanMap<?> m, String typeName) throws Exception {
+ private SerializerWriter serializeBeanMap(JsonWriter out, BeanMap<?> m, String typeName) throws IOException, SerializeException {
int i = indent;
out.append('{');
@@ -223,7 +224,7 @@ public class JsonSerializerSession extends WriterSerializerSession {
}
@SuppressWarnings({"rawtypes", "unchecked"})
- private SerializerWriter serializeCollection(JsonWriter out, Collection c, ClassMeta<?> type) throws Exception {
+ private SerializerWriter serializeCollection(JsonWriter out, Collection c, ClassMeta<?> type) throws IOException, SerializeException {
ClassMeta<?> elementType = type.getElementType();
@@ -247,9 +248,9 @@ public class JsonSerializerSession extends WriterSerializerSession {
*
* @param out The output target object.
* @return The output target object wrapped in an {@link JsonWriter}.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- protected final JsonWriter getJsonWriter(SerializerPipe out) throws Exception {
+ protected final JsonWriter getJsonWriter(SerializerPipe out) throws IOException {
Object output = out.getRawOutput();
if (output instanceof JsonWriter)
return (JsonWriter)output;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonWriter.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonWriter.java
index 972eebf..b19cf05 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonWriter.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonWriter.java
@@ -174,7 +174,7 @@ public final class JsonWriter extends SerializerWriter {
*
* @param uri The URI to append to the output.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public SerializerWriter uriValue(Object uri) throws IOException {
return stringValue(uriResolver.resolve(uri));
@@ -201,7 +201,7 @@ public final class JsonWriter extends SerializerWriter {
*
* @param depth The current indentation depth.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public JsonWriter smi(int depth) throws IOException {
if (depth > maxIndent)
@@ -242,9 +242,9 @@ public final class JsonWriter extends SerializerWriter {
/**
* Adds a space only if the current indentation level is below maxIndent.
*
- * @param indent
+ * @param indent The number of spaces to indent.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public JsonWriter s(int indent) throws IOException {
if (indent <= maxIndent)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorSession.java
index 566ada1..b4ea353 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorSession.java
@@ -22,6 +22,7 @@ import java.util.regex.*;
import org.apache.juneau.*;
import org.apache.juneau.json.*;
import org.apache.juneau.jsonschema.annotation.*;
+import org.apache.juneau.parser.ParseException;
import org.apache.juneau.serializer.*;
import org.apache.juneau.transform.*;
@@ -66,9 +67,10 @@ public class JsonSchemaGeneratorSession extends BeanTraverseSession {
* The object.
* <br>Can either be a POJO or a <c>Class</c>/<c>Type</c>.
* @return The schema for the type.
- * @throws Exception
+ * @throws BeanRecursionException Bean recursion occurred.
+ * @throws SerializeException Error occurred.
*/
- public ObjectMap getSchema(Object o) throws Exception {
+ public ObjectMap getSchema(Object o) throws BeanRecursionException, SerializeException {
return getSchema(toClassMeta(o), "root", null, false, false, null);
}
@@ -77,9 +79,10 @@ public class JsonSchemaGeneratorSession extends BeanTraverseSession {
*
* @param type The object type.
* @return The schema for the type.
- * @throws Exception
+ * @throws BeanRecursionException Bean recursion occurred.
+ * @throws SerializeException Error occurred.
*/
- public ObjectMap getSchema(Type type) throws Exception {
+ public ObjectMap getSchema(Type type) throws BeanRecursionException, SerializeException {
return getSchema(getClassMeta(type), "root", null, false, false, null);
}
@@ -88,14 +91,15 @@ public class JsonSchemaGeneratorSession extends BeanTraverseSession {
*
* @param cm The object type.
* @return The schema for the type.
- * @throws Exception
+ * @throws BeanRecursionException Bean recursion occurred.
+ * @throws SerializeException Error occurred.
*/
- public ObjectMap getSchema(ClassMeta<?> cm) throws Exception {
+ public ObjectMap getSchema(ClassMeta<?> cm) throws BeanRecursionException, SerializeException {
return getSchema(cm, "root", null, false, false, null);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
- private ObjectMap getSchema(ClassMeta<?> eType, String attrName, String[] pNames, boolean exampleAdded, boolean descriptionAdded, JsonSchemaBeanPropertyMeta jsbpm) throws Exception {
+ private ObjectMap getSchema(ClassMeta<?> eType, String attrName, String[] pNames, boolean exampleAdded, boolean descriptionAdded, JsonSchemaBeanPropertyMeta jsbpm) throws BeanRecursionException, SerializeException {
if (ctx.isIgnoredType(eType))
return null;
@@ -268,12 +272,17 @@ public class JsonSchemaGeneratorSession extends BeanTraverseSession {
return l;
}
- private Object getExample(ClassMeta<?> sType, TypeCategory t, boolean exampleAdded) throws Exception {
+ private Object getExample(ClassMeta<?> sType, TypeCategory t, boolean exampleAdded) throws SerializeException {
boolean canAdd = isAllowNestedExamples() || ! exampleAdded;
if (canAdd && (getAddExamplesTo().contains(t) || getAddExamplesTo().contains(ANY))) {
Object example = sType.getExample(this);
- if (example != null)
- return JsonParser.DEFAULT.parse(toJson(example), Object.class);
+ if (example != null) {
+ try {
+ return JsonParser.DEFAULT.parse(toJson(example), Object.class);
+ } catch (ParseException e) {
+ throw new SerializeException(e);
+ }
+ }
}
return null;
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/SchemaUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/SchemaUtils.java
index fa20969..a53634f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/SchemaUtils.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/SchemaUtils.java
@@ -33,7 +33,7 @@ public class SchemaUtils {
*
* @param a The annotation instance. Can be <jk>null</jk>.
* @return The schema converted to a map, or and empty map if the annotation was null.
- * @throws ParseException
+ * @throws ParseException Malformed input encountered.
*/
public static ObjectMap asMap(Schema a) throws ParseException {
if (a == null)
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 893f3b9..ed0dfb9 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
@@ -297,8 +297,7 @@ public abstract class Marshall {
* <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
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
* @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 {
@@ -337,8 +336,7 @@ public abstract class Marshall {
* See {@link #read(Object, Type, Type...)} for details.
* @param type The object type to create.
* @return The parsed object.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
*/
public final <T> T read(Object 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/msgpack/MsgPackInputStream.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackInputStream.java
index e7455b2..0ae717d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackInputStream.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackInputStream.java
@@ -60,9 +60,9 @@ public final class MsgPackInputStream extends ParserInputStream {
* Constructor.
*
* @param pipe The parser input.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- protected MsgPackInputStream(ParserPipe pipe) throws Exception {
+ protected MsgPackInputStream(ParserPipe pipe) throws IOException {
super(pipe);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserSession.java
index 83dca6b..5421e5b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserSession.java
@@ -14,6 +14,7 @@ package org.apache.juneau.msgpack;
import static org.apache.juneau.msgpack.DataType.*;
+import java.io.IOException;
import java.util.*;
import org.apache.juneau.*;
@@ -44,7 +45,7 @@ public final class MsgPackParserSession extends InputStreamParserSession {
}
@Override /* ParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
try (MsgPackInputStream is = new MsgPackInputStream(pipe)) {
return parseAnything(type, is, getOuter(), null);
}
@@ -53,7 +54,7 @@ public final class MsgPackParserSession extends InputStreamParserSession {
/*
* Workhorse method.
*/
- private <T> T parseAnything(ClassMeta<?> eType, MsgPackInputStream is, Object outer, BeanPropertyMeta pMeta) throws Exception {
+ private <T> T parseAnything(ClassMeta<?> eType, MsgPackInputStream is, Object outer, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
if (eType == null)
eType = object();
@@ -194,7 +195,7 @@ public final class MsgPackParserSession extends InputStreamParserSession {
}
if (swap != null && o != null)
- o = swap.unswap(this, o, eType);
+ o = unswap(swap, o, eType);
if (outer != null)
setParent(eType, o, outer);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
index f347edb..d8b3ddc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.msgpack;
+import java.io.IOException;
import java.util.*;
import org.apache.juneau.*;
@@ -48,14 +49,14 @@ public final class MsgPackSerializerSession extends OutputStreamSerializerSessio
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
serializeAnything(getMsgPackOutputStream(out), o, getExpectedRootType(o), "root", null);
}
/*
* Converts the specified output target object to an {@link MsgPackOutputStream}.
*/
- private static final MsgPackOutputStream getMsgPackOutputStream(SerializerPipe out) throws Exception {
+ private static final MsgPackOutputStream getMsgPackOutputStream(SerializerPipe out) throws IOException {
Object output = out.getRawOutput();
if (output instanceof MsgPackOutputStream)
return (MsgPackOutputStream)output;
@@ -68,8 +69,8 @@ public final class MsgPackSerializerSession extends OutputStreamSerializerSessio
* Workhorse method.
* Determines the type of object, and then calls the appropriate type-specific serialization method.
*/
- @SuppressWarnings({ "rawtypes", "unchecked" })
- private MsgPackOutputStream serializeAnything(MsgPackOutputStream out, Object o, ClassMeta<?> eType, String attrName, BeanPropertyMeta pMeta) throws Exception {
+ @SuppressWarnings({ "rawtypes" })
+ private MsgPackOutputStream serializeAnything(MsgPackOutputStream out, Object o, ClassMeta<?> eType, String attrName, BeanPropertyMeta pMeta) throws IOException, SerializeException {
if (o == null)
return out.appendNull();
@@ -80,7 +81,7 @@ public final class MsgPackSerializerSession extends OutputStreamSerializerSessio
ClassMeta<?> aType; // The actual type
ClassMeta<?> sType; // The serialized type
- aType = push(attrName, o, eType);
+ aType = push2(attrName, o, eType);
boolean isRecursion = aType == null;
// Handle recursion
@@ -95,7 +96,7 @@ public final class MsgPackSerializerSession extends OutputStreamSerializerSessio
// Swap if necessary
PojoSwap swap = aType.getPojoSwap(this);
if (swap != null) {
- o = swap.swap(this, o);
+ o = swap(swap, o);
sType = swap.getSwapClassMeta(this);
// If the getSwapClass() method returns Object, we need to figure out
@@ -139,7 +140,7 @@ public final class MsgPackSerializerSession extends OutputStreamSerializerSessio
}
@SuppressWarnings({ "rawtypes", "unchecked" })
- private void serializeMap(MsgPackOutputStream out, Map m, ClassMeta<?> type) throws Exception {
+ private void serializeMap(MsgPackOutputStream out, Map m, ClassMeta<?> type) throws IOException, SerializeException {
ClassMeta<?> keyType = type.getKeyType(), valueType = type.getValueType();
@@ -162,7 +163,7 @@ public final class MsgPackSerializerSession extends OutputStreamSerializerSessio
}
}
- private void serializeBeanMap(MsgPackOutputStream out, final BeanMap<?> m, String typeName) throws Exception {
+ private void serializeBeanMap(MsgPackOutputStream out, final BeanMap<?> m, String typeName) throws IOException, SerializeException {
List<BeanPropertyValue> values = m.getValues(isTrimNullProperties(), typeName != null ? createBeanTypeNameProperty(m, typeName) : null);
@@ -200,7 +201,7 @@ public final class MsgPackSerializerSession extends OutputStreamSerializerSessio
}
@SuppressWarnings({"rawtypes", "unchecked"})
- private void serializeCollection(MsgPackOutputStream out, Collection c, ClassMeta<?> type) throws Exception {
+ private void serializeCollection(MsgPackOutputStream out, Collection c, ClassMeta<?> type) throws IOException, SerializeException {
ClassMeta<?> elementType = type.getElementType();
List<Object> l = new ArrayList<>(c.size());
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 e619e4b..ee88303 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
@@ -17,6 +17,7 @@ import static org.apache.juneau.httppart.HttpPartSchema.Format.*;
import static org.apache.juneau.httppart.HttpPartSchema.Type.*;
import static org.apache.juneau.internal.StringUtils.*;
+import java.io.IOException;
import java.lang.reflect.*;
import java.util.*;
@@ -77,8 +78,12 @@ public class OpenApiSerializerSession extends UonSerializerSession {
//-----------------------------------------------------------------------------------------------------------------
@Override /* Serializer */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
- out.getWriter().write(serialize(HttpPartType.BODY, getSchema(), o));
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
+ try {
+ out.getWriter().write(serialize(HttpPartType.BODY, getSchema(), o));
+ } catch (SchemaValidationException e) {
+ throw new SerializeException(e);
+ }
}
@Override /* PartSerializer */
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 d746ed3..e8f1fb7 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
@@ -626,8 +626,7 @@ public abstract class Parser extends BeanContext {
* <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
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
* @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 {
@@ -666,8 +665,7 @@ public abstract class Parser extends BeanContext {
* See {@link #parse(Object, Type, Type...)} for details.
* @param type The object type to create.
* @return The parsed object.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
*/
public final <T> T parse(Object input, Class<T> type) throws ParseException {
return createSession().parse(input, type);
@@ -686,8 +684,7 @@ public abstract class Parser extends BeanContext {
* See {@link #parse(Object, Type, Type...)} for details.
* @param type The object type to create.
* @return The parsed object.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
*/
public final <T> T parse(Object input, ClassMeta<T> type) throws ParseException {
return createSession().parse(input, type);
@@ -728,7 +725,7 @@ public abstract class Parser extends BeanContext {
* @param keyType The class type of the keys, or <jk>null</jk> to default to <code>String.<jk>class</jk></code>.
* @param valueType The class type of the values, or <jk>null</jk> to default to whatever is being parsed.
* @return The same map that was passed in to allow this method to be chained.
- * @throws ParseException If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
* @throws UnsupportedOperationException If not implemented.
*/
public final <K,V> Map<K,V> parseIntoMap(Object input, Map<K,V> m, Type keyType, Type valueType) throws ParseException {
@@ -751,8 +748,7 @@ public abstract class Parser extends BeanContext {
* @param c The collection being loaded.
* @param elementType The class type of the elements, or <jk>null</jk> to default to whatever is being parsed.
* @return The same collection that was passed in to allow this method to be chained.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
* @throws UnsupportedOperationException If not implemented.
*/
public final <E> Collection<E> parseIntoCollection(Object input, Collection<E> c, Type elementType) throws ParseException {
@@ -777,8 +773,7 @@ public abstract class Parser extends BeanContext {
* @param input The input. Subclasses can support different input types.
* @param argTypes Specifies the type of objects to create for each entry in the array.
* @return An array of parsed objects.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
*/
public final Object[] parseArgs(Object input, Type[] argTypes) throws ParseException {
if (argTypes == null || argTypes.length == 0)
@@ -898,7 +893,7 @@ public abstract class Parser extends BeanContext {
//-----------------------------------------------------------------------------------------------------------------
// Other methods
//-----------------------------------------------------------------------------------------------------------------
-
+
@Override /* Context */
public ObjectMap toMap() {
return super.toMap()
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserInputStream.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserInputStream.java
index e58ae4f..fd6f5a2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserInputStream.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserInputStream.java
@@ -32,9 +32,9 @@ public class ParserInputStream extends InputStream implements Positionable {
* Constructor.
*
* @param pipe The parser input.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- protected ParserInputStream(ParserPipe pipe) throws Exception {
+ protected ParserInputStream(ParserPipe pipe) throws IOException {
this.is = pipe.getInputStream();
pipe.setPositionable(this);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserPipe.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserPipe.java
index 53a0393..086ab12 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserPipe.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserPipe.java
@@ -95,7 +95,7 @@ public final class ParserPipe implements Closeable {
this.unbuffered = unbuffered;
Charset cs = isFile ? fileCharset : streamCharset;
if (cs == null)
- cs = (isFile ? Charset.defaultCharset() : UTF8);
+ cs = (isFile ? Charset.defaultCharset() : UTF8);
this.charset = cs;
if (input instanceof CharSequence)
this.inputString = input.toString();
@@ -272,9 +272,9 @@ public final class ParserPipe implements Closeable {
* If the reader passed into this pipe is already a buffered reader, that reader will be returned.
*
* @return The contents of this pipe as a buffered reader.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- public Reader getBufferedReader() throws Exception {
+ public Reader getBufferedReader() throws IOException {
return IOUtils.getBufferedReader(getReader());
}
@@ -294,9 +294,9 @@ public final class ParserPipe implements Closeable {
* Converts this pipe into a {@link ParserReader}.
*
* @return The converted pipe.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- public ParserReader getParserReader() throws Exception {
+ public ParserReader getParserReader() throws IOException {
if (input == null)
return null;
if (input instanceof ParserReader)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
index db8c23e..7aa0ab7 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
@@ -47,7 +47,7 @@ public class ParserReader extends Reader implements Positionable {
* Constructor.
*
* @param pipe The parser input.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public ParserReader(ParserPipe pipe) throws IOException {
this.unbuffered = pipe.unbuffered;
@@ -95,7 +95,7 @@ public class ParserReader extends Reader implements Positionable {
* Same as {@link #read()} but skips over any whitespace characters.
*
* @return The first non-whitespace character, or -1 if the end of stream reached.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public final int readSkipWs() throws IOException {
while (true) {
@@ -358,7 +358,7 @@ public class ParserReader extends Reader implements Positionable {
* @param c The new character.
* @param offset The offset.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public final ParserReader replace(int c, int offset) throws IOException {
if (c < 0x10000) {
@@ -385,7 +385,7 @@ public class ParserReader extends Reader implements Positionable {
*
* @param c The new character.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public final ParserReader replace(char c) throws IOException {
return replace(c, 1);
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 f21478a..d7f198f 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
@@ -92,9 +92,11 @@ public abstract class ParserSession extends BeanSession {
* <c>ObjectMap</c>, etc...
* @param <T> The class type of the object to create.
* @return The parsed object.
- * @throws Exception If thrown from underlying stream, or if the input contains a syntax error or is malformed.
+ * @throws IOException Thrown by underlying stream.
+ * @throws ParseException Malformed input encountered.
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- protected abstract <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception;
+ protected abstract <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException;
/**
* Returns <jk>true</jk> if this parser subclasses from {@link ReaderParser}.
@@ -386,8 +388,7 @@ public abstract class ParserSession extends BeanSession {
* <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
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
* @see BeanSession#getClassMeta(Type,Type...) for argument syntax for maps and collections.
*/
@SuppressWarnings("unchecked")
@@ -429,8 +430,7 @@ public abstract class ParserSession extends BeanSession {
* See {@link #parse(Object, Type, Type...)} for details.
* @param type The object type to create.
* @return The parsed object.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
*/
public final <T> T parse(Object input, Class<T> type) throws ParseException {
try (ParserPipe pipe = createPipe(input)) {
@@ -451,8 +451,7 @@ public abstract class ParserSession extends BeanSession {
* See {@link #parse(Object, Type, Type...)} for details.
* @param type The object type to create.
* @return The parsed object.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
*/
public final <T> T parse(Object input, ClassMeta<T> type) throws ParseException {
try (ParserPipe pipe = createPipe(input)) {
@@ -471,8 +470,7 @@ public abstract class ParserSession extends BeanSession {
* @param type The class type of the object to create.
* @param <T> The class type of the object to create.
* @return The parsed object.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
*/
private <T> T parseInner(ParserPipe pipe, ClassMeta<T> type) throws ParseException {
if (type.isVoid())
@@ -515,7 +513,7 @@ public abstract class ParserSession extends BeanSession {
* @param keyType The class type of the keys, or <jk>null</jk> to default to <code>String.<jk>class</jk></code>.
* @param valueType The class type of the values, or <jk>null</jk> to default to whatever is being parsed.
* @return The same map that was passed in to allow this method to be chained.
- * @throws ParseException If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
* @throws UnsupportedOperationException If not implemented.
*/
public final <K,V> Map<K,V> parseIntoMap(Object input, Map<K,V> m, Type keyType, Type valueType) throws ParseException {
@@ -563,8 +561,7 @@ public abstract class ParserSession extends BeanSession {
* @param c The collection being loaded.
* @param elementType The class type of the elements, or <jk>null</jk> to default to whatever is being parsed.
* @return The same collection that was passed in to allow this method to be chained.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
* @throws UnsupportedOperationException If not implemented.
*/
public final <E> Collection<E> parseIntoCollection(Object input, Collection<E> c, Type elementType) throws ParseException {
@@ -619,8 +616,7 @@ public abstract class ParserSession extends BeanSession {
* @param input The input. Subclasses can support different input types.
* @param argTypes Specifies the type of objects to create for each entry in the array.
* @return An array of parsed objects.
- * @throws ParseException
- * If the input contains a syntax error or is malformed, or is not valid for the specified type.
+ * @throws ParseException Malformed input encountered.
*/
public final Object[] parseArgs(Object input, Type[] argTypes) throws ParseException {
try (ParserPipe pipe = createPipe(input)) {
@@ -649,11 +645,13 @@ public abstract class ParserSession extends BeanSession {
* @param s The string to convert.
* @param type The class type to convert the string to.
* @return The string converted as an object of the specified type.
- * @throws Exception If the input contains a syntax error or is malformed, or is not valid for the specified type.
* @param <T> The class type to convert the string to.
+ * @throws IOException Thrown by underlying stream.
+ * @throws ParseException Malformed input encountered.
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
- protected final <T> T convertAttrToType(Object outer, String s, ClassMeta<T> type) throws Exception {
+ protected final <T> T convertAttrToType(Object outer, String s, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
if (s == null)
return null;
@@ -680,7 +678,7 @@ public abstract class ParserSession extends BeanSession {
}
if (swap != null)
- o = swap.unswap(this, o, type);
+ o = unswap(swap, o, type);
return (T)o;
}
@@ -692,9 +690,9 @@ public abstract class ParserSession extends BeanSession {
* @param cm The class type of the object.
* @param o The object.
* @param parent The parent to set.
- * @throws Exception
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- protected static final void setParent(ClassMeta<?> cm, Object o, Object parent) throws Exception {
+ protected static final void setParent(ClassMeta<?> cm, Object o, Object parent) throws ExecutableException {
Setter m = cm.getParentProperty();
if (m != null)
m.set(o, parent);
@@ -706,9 +704,9 @@ public abstract class ParserSession extends BeanSession {
* @param cm The class type of the object.
* @param o The object.
* @param name The name to set.
- * @throws Exception
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- protected static final void setName(ClassMeta<?> cm, Object o, Object name) throws Exception {
+ protected static final void setName(ClassMeta<?> cm, Object o, Object name) throws ExecutableException {
if (cm != null) {
Setter m = cm.getNameProperty();
if (m != null)
@@ -788,6 +786,24 @@ public abstract class ParserSession extends BeanSession {
return pipe == null ? null : pipe.getInputAsString();
}
+ /**
+ * Invokes the specified swap on the specified object.
+ *
+ * @param swap The swap to invoke.
+ * @param o The input object.
+ * @param eType The expected type.
+ * @return The swapped object.
+ * @throws ParseException If swap method threw an exception.
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ protected Object unswap(PojoSwap swap, Object o, ClassMeta<?> eType) throws ParseException {
+ try {
+ return swap.unswap(this, o, eType);
+ } catch (Exception e) {
+ throw new ParseException(e);
+ }
+ }
+
//-----------------------------------------------------------------------------------------------------------------
// Properties
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParserSession.java
index 5d0dfd6..faa273c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParserSession.java
@@ -14,6 +14,8 @@ package org.apache.juneau.plaintext;
import static org.apache.juneau.internal.IOUtils.*;
+import java.io.IOException;
+
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
@@ -40,7 +42,7 @@ public class PlainTextParserSession extends ReaderParserSession {
}
@Override /* ParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
return convertToType(read(pipe.getReader()), type);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerSession.java
index 4c8affd..1d92a42 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerSession.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.plaintext;
+import java.io.IOException;
+
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
@@ -41,7 +43,7 @@ public class PlainTextSerializerSession extends WriterSerializerSession {
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
out.getWriter().write(o == null ? "null" : convertToType(o, String.class));
}
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 4816d72..286e5b8 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
@@ -36,17 +36,16 @@ public final class PojoSearcher implements PojoTool<SearchArgs> {
final MatcherFactory[] factories;
/**
- * TODO
+ * Constructor.
*
- * @param factories
+ * @param factories The matcher factories to use.
*/
public PojoSearcher(MatcherFactory...factories) {
this.factories = factories;
}
/**
- * TODO
- *
+ * Constructor.
*/
public PojoSearcher() {
this(NumberMatcherFactory.DEFAULT, TimeMatcherFactory.DEFAULT, StringMatcherFactory.DEFAULT);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationInfo.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationInfo.java
index be87ddf..eab269f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationInfo.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationInfo.java
@@ -156,19 +156,23 @@ public class AnnotationInfo<T extends Annotation> {
*
* @param vrs Variable resolver passed to the {@link ConfigApply} object.
* @return A new {@link ConfigApply} object. Never <jk>null</jk>.
- * @throws Exception
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
@SuppressWarnings("unchecked")
- public ConfigApply<Annotation> getConfigApply(VarResolverSession vrs) throws Exception {
- if (configApplyConstructor == null) {
- PropertyStoreApply psa = a.annotationType().getAnnotation(PropertyStoreApply.class);
- if (psa != null)
- configApplyConstructor = (Constructor<? extends ConfigApply<?>>)psa.value().getConstructor(Class.class, VarResolverSession.class);
- if (configApplyConstructor == null)
- throw new NoSuchFieldError("Could not find ConfigApply constructor for annotation:\n" + toString());
+ public ConfigApply<Annotation> getConfigApply(VarResolverSession vrs) throws ExecutableException {
+ try {
+ if (configApplyConstructor == null) {
+ PropertyStoreApply psa = a.annotationType().getAnnotation(PropertyStoreApply.class);
+ if (psa != null)
+ configApplyConstructor = (Constructor<? extends ConfigApply<?>>)psa.value().getConstructor(Class.class, VarResolverSession.class);
+ if (configApplyConstructor == null)
+ throw new NoSuchFieldError("Could not find ConfigApply constructor for annotation:\n" + toString());
+ }
+ ClassInfo ci = getClassInfo();
+ return (ConfigApply<Annotation>) configApplyConstructor.newInstance(ci == null ? null : ci.inner(), vrs);
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
+ throw new ExecutableException(e);
}
- ClassInfo ci = getClassInfo();
- return (ConfigApply<Annotation>) configApplyConstructor.newInstance(ci == null ? null : ci.inner(), vrs);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
index adbcbce..a282b6f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
@@ -1860,13 +1860,16 @@ public final class ClassInfo {
* Shortcut for calling {@link Class#newInstance()} on the underlying class.
*
* @return A new instance of the underlying class
- * @throws IllegalAccessException
- * @throws InstantiationException
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- public Object newInstance() throws InstantiationException, IllegalAccessException {
+ public Object newInstance() throws ExecutableException {
if (c == null)
- throw new InstantiationException("Type '"+ getFullName() + "' cannot be instantiated");
- return c.newInstance();
+ throw new ExecutableException("Type ''{0}'' cannot be instantiated", getFullName());
+ try {
+ return c.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new ExecutableException(e);
+ }
}
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ConstructorInfo.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ConstructorInfo.java
index fc3eea7..cb66dd5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ConstructorInfo.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ConstructorInfo.java
@@ -84,14 +84,15 @@ public final class ConstructorInfo extends ExecutableInfo implements Comparable<
*
* @param args the arguments used for the method call
* @return The object returned from the constructor.
- * @throws InvocationTargetException
- * @throws IllegalArgumentException
- * @throws IllegalAccessException
- * @throws InstantiationException
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
@SuppressWarnings("unchecked")
- public <T> T invoke(Object...args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {
- return (T)c.newInstance(args);
+ public <T> T invoke(Object...args) throws ExecutableException {
+ try {
+ return (T)c.newInstance(args);
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
+ throw new ExecutableException(e);
+ }
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
index 4704eaa..c0fb331 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
@@ -20,6 +20,7 @@ import java.lang.reflect.*;
import java.util.*;
import java.util.function.*;
+import org.apache.juneau.ExecutableException;
import org.apache.juneau.annotation.*;
import org.apache.juneau.internal.*;
@@ -398,12 +399,14 @@ public final class MethodInfo extends ExecutableInfo implements Comparable<Metho
* @param obj the object the underlying method is invoked from.
* @param args the arguments used for the method call
* @return The object returned from the method.
- * @throws InvocationTargetException
- * @throws IllegalArgumentException
- * @throws IllegalAccessException
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- public Object invoke(Object obj, Object...args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- return m.invoke(obj, args);
+ public Object invoke(Object obj, Object...args) throws ExecutableException {
+ try {
+ return m.invoke(obj, args);
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ throw new ExecutableException(e);
+ }
}
/**
@@ -426,10 +429,14 @@ public final class MethodInfo extends ExecutableInfo implements Comparable<Metho
* The arguments to pass to the method.
* @return
* The results of the method invocation.
- * @throws Exception
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- public Object invokeFuzzy(Object pojo, Object...args) throws Exception {
- return m.invoke(pojo, ClassUtils.getMatchingArgs(m.getParameterTypes(), args));
+ public Object invokeFuzzy(Object pojo, Object...args) throws ExecutableException {
+ try {
+ return m.invoke(pojo, ClassUtils.getMatchingArgs(m.getParameterTypes(), args));
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ throw new ExecutableException(e);
+ }
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ParamInfo.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ParamInfo.java
index f80885a..9de79af 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ParamInfo.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ParamInfo.java
@@ -102,6 +102,7 @@ public final class ParamInfo {
* @param a
* The annotation to search for.
* @param <T>
+ * The annotation type.
* @return The specified parameter annotation declared on this parameter, or <jk>null</jk> if not found.
*/
@SuppressWarnings("unchecked")
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 bf64ccb..e1036b1 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
@@ -139,9 +139,10 @@ public abstract class SerializerSession extends BeanTraverseSession {
*
* @param pipe Where to send the output from the serializer.
* @param o The object to serialize.
- * @throws Exception If thrown from underlying stream, or if the input contains a syntax error or is malformed.
+ * @throws IOException Thrown by underlying stream.
+ * @throws SerializeException Problem occurred trying to serialize object.
*/
- protected abstract void doSerialize(SerializerPipe pipe, Object o) throws Exception;
+ protected abstract void doSerialize(SerializerPipe pipe, Object o) throws IOException, SerializeException;
/**
* Shortcut method for serializing objects directly to either a <c>String</c> or <code><jk>byte</jk>[]</code>
@@ -626,6 +627,42 @@ public abstract class SerializerSession extends BeanTraverseSession {
return getVarResolver().resolve(string);
}
+ /**
+ * Same as {@link #push(String, Object, ClassMeta)} but wraps {@link BeanRecursionException} inside {@link SerializeException}.
+ *
+ * @param attrName The attribute name.
+ * @param o The current object being traversed.
+ * @param eType The expected class type.
+ * @return
+ * The {@link ClassMeta} of the object so that <c>instanceof</c> operations only need to be performed
+ * once (since they can be expensive).
+ * @throws SerializeException If recursion occurred.
+ */
+ protected final ClassMeta<?> push2(String attrName, Object o, ClassMeta<?> eType) throws SerializeException {
+ try {
+ return super.push(attrName, o, eType);
+ } catch (BeanRecursionException e) {
+ throw new SerializeException(e);
+ }
+ }
+
+ /**
+ * Invokes the specified swap on the specified object.
+ *
+ * @param swap The swap to invoke.
+ * @param o The input object.
+ * @return The swapped object.
+ * @throws SerializeException If swap method threw an exception.
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ protected Object swap(PojoSwap swap, Object o) throws SerializeException {
+ try {
+ return swap.swap(this, o);
+ } catch (Exception e) {
+ throw new SerializeException(e);
+ }
+ }
+
//-----------------------------------------------------------------------------------------------------------------
// Properties
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerWriter.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
index 4c280f1..b8995fa 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
@@ -204,7 +204,7 @@ public class SerializerWriter extends Writer {
*
* @param characters The characters to append to this writer.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public SerializerWriter append(char[] characters) throws IOException {
for (char c : characters)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerSession.java
index b5404b0..a38dfd9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerSession.java
@@ -14,6 +14,7 @@ package org.apache.juneau.soap;
import static org.apache.juneau.soap.SoapXmlSerializer.*;
+import java.io.IOException;
import java.util.*;
import org.apache.juneau.*;
@@ -55,7 +56,7 @@ public class SoapXmlSerializerSession extends XmlSerializerSession {
//-----------------------------------------------------------------------------------------------------------------
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
try (XmlWriter w = getXmlWriter(out)) {
w.append("<?xml")
.attr("version", "1.0")
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolver.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolver.java
index 1fb93ff..941d7fd 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolver.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolver.java
@@ -174,7 +174,7 @@ public class VarResolver {
*
* @param s The input string.
* @param w The writer to send the result to.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public void resolveTo(String s, Writer w) throws IOException {
createSession(null).resolveTo(s, w);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
index 34e92bf..33870ec 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
@@ -263,7 +263,7 @@ public class VarResolverSession {
* @param s The string to resolve variables in.
* @param out The writer to write to.
* @return The same writer.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public Writer resolveTo(String s, Writer out) throws IOException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BuilderSwap.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BuilderSwap.java
index 275b765..11f1167 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BuilderSwap.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BuilderSwap.java
@@ -102,12 +102,16 @@ public class BuilderSwap<T,B> {
* @param session The current bean session.
* @param hint A hint about the class type.
* @return A new POJO.
- * @throws Exception
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- public B create(BeanSession session, ClassMeta<?> hint) throws Exception {
+ public B create(BeanSession session, ClassMeta<?> hint) throws ExecutableException {
if (createBuilderMethod != null)
return (B)createBuilderMethod.invoke(null);
- return builderConstructor.newInstance();
+ try {
+ return builderConstructor.newInstance();
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
+ throw new ExecutableException(e);
+ }
}
/**
@@ -117,12 +121,16 @@ public class BuilderSwap<T,B> {
* @param builder The POJO builder.
* @param hint A hint about the class type.
* @return A new POJO.
- * @throws Exception
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- public T build(BeanSession session, B builder, ClassMeta<?> hint) throws Exception {
+ public T build(BeanSession session, B builder, ClassMeta<?> hint) throws ExecutableException {
if (createPojoMethod != null)
return (T)createPojoMethod.invoke(builder);
- return pojoConstructor.newInstance(builder);
+ try {
+ return pojoConstructor.newInstance(builder);
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
+ throw new ExecutableException(e);
+ }
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
index 1c12bc8..ef41530 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
@@ -80,7 +80,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
}
@Override /* ParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
try (UonReader r = getUonReader(pipe, decoding)) {
T o = parseAnything(type, r, getOuter(), true, null);
validateEnd(r);
@@ -159,6 +159,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
/**
* Workhorse method.
*
+ * @param <T> The class type being parsed, or <jk>null</jk> if unknown.
* @param eType The class type being parsed, or <jk>null</jk> if unknown.
* @param r The reader being parsed.
* @param outer The outer object (for constructing nested inner classes).
@@ -167,9 +168,11 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
* default case.
* @param pMeta The current bean property being parsed.
* @return The parsed object.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
+ * @throws ParseException Malformed input encountered.
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- public <T> T parseAnything(ClassMeta<?> eType, UonReader r, Object outer, boolean isUrlParamValue, BeanPropertyMeta pMeta) throws Exception {
+ public <T> T parseAnything(ClassMeta<?> eType, UonReader r, Object outer, boolean isUrlParamValue, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
if (eType == null)
eType = object();
@@ -311,7 +314,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
if (o == null && sType.isPrimitive())
o = sType.getPrimitiveDefault();
if (swap != null && o != null)
- o = swap.unswap(this, o, eType);
+ o = unswap(swap, o, eType);
if (outer != null)
setParent(eType, o, outer);
@@ -320,7 +323,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
}
private <K,V> Map<K,V> parseIntoMap(UonReader r, Map<K,V> m, ClassMeta<K> keyType, ClassMeta<V> valueType,
- BeanPropertyMeta pMeta) throws Exception {
+ BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
if (keyType == null)
keyType = (ClassMeta<K>)string();
@@ -406,7 +409,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
return null; // Unreachable.
}
- private <E> Collection<E> parseIntoCollection(UonReader r, Collection<E> l, ClassMeta<E> type, boolean isUrlParamValue, BeanPropertyMeta pMeta) throws Exception {
+ private <E> Collection<E> parseIntoCollection(UonReader r, Collection<E> l, ClassMeta<E> type, boolean isUrlParamValue, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException {
int c = r.readSkipWs();
if (c == -1 || c == AMP)
@@ -495,7 +498,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
return null; // Unreachable.
}
- private <T> BeanMap<T> parseIntoBeanMap(UonReader r, BeanMap<T> m) throws Exception {
+ private <T> BeanMap<T> parseIntoBeanMap(UonReader r, BeanMap<T> m) throws IOException, ParseException, ExecutableException {
int c = r.readSkipWs();
if (c == -1 || c == AMP)
@@ -603,7 +606,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
return null; // Unreachable.
}
- private Object parseNull(UonReader r) throws Exception {
+ private Object parseNull(UonReader r) throws IOException, ParseException {
String s = parseString(r, false);
if ("ull".equals(s))
return null;
@@ -613,12 +616,13 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
/**
* Convenience method for parsing an attribute from the specified parser.
*
- * @param r
- * @param encoded
+ * @param r The reader.
+ * @param encoded Whether the attribute is encoded.
* @return The parsed object
- * @throws Exception
+ * @throws IOException Exception thrown by underlying stream.
+ * @throws ParseException Attribute was malformed.
*/
- protected final Object parseAttr(UonReader r, boolean encoded) throws Exception {
+ protected final Object parseAttr(UonReader r, boolean encoded) throws IOException, ParseException {
Object attr;
attr = parseAttrName(r, encoded);
return attr;
@@ -627,12 +631,13 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
/**
* Parses an attribute name from the specified reader.
*
- * @param r
- * @param encoded
+ * @param r The reader.
+ * @param encoded Whether the attribute is encoded.
* @return The parsed attribute name.
- * @throws Exception
+ * @throws IOException Exception thrown by underlying stream.
+ * @throws ParseException Attribute name was malformed.
*/
- protected final String parseAttrName(UonReader r, boolean encoded) throws Exception {
+ protected final String parseAttrName(UonReader r, boolean encoded) throws IOException, ParseException {
// If string is of form 'xxx', we're looking for ' at the end.
// Otherwise, we're looking for '&' or '=' or WS or -1 denoting the end of this string.
@@ -683,7 +688,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
/*
* Returns true if the next character in the stream is preceded by an escape '~' character.
*/
- private static final boolean isInEscape(int c, ParserReader r, boolean prevIsInEscape) throws Exception {
+ private static final boolean isInEscape(int c, ParserReader r, boolean prevIsInEscape) throws IOException {
if (c == '~' && ! prevIsInEscape) {
c = r.peek();
if (escapedChars.contains(c)) {
@@ -697,12 +702,13 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
/**
* Parses a string value from the specified reader.
*
- * @param r
- * @param isUrlParamValue
+ * @param r The input reader.
+ * @param isUrlParamValue Whether this is a URL parameter.
* @return The parsed string.
- * @throws Exception
+ * @throws IOException Exception thrown by underlying stream.
+ * @throws ParseException Malformed input found.
*/
- protected final String parseString(UonReader r, boolean isUrlParamValue) throws Exception {
+ protected final String parseString(UonReader r, boolean isUrlParamValue) throws IOException, ParseException {
// If string is of form 'xxx', we're looking for ' at the end.
// Otherwise, we're looking for ',' or ')' or -1 denoting the end of this string.
@@ -750,7 +756,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
* Parses a string of the form "'foo'"
* All whitespace within parenthesis are preserved.
*/
- private String parsePString(UonReader r) throws Exception {
+ private String parsePString(UonReader r) throws IOException, ParseException {
r.read(); // Skip first quote.
r.mark();
@@ -770,7 +776,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
throw new ParseException(this, "Unmatched parenthesis");
}
- private Boolean parseBoolean(UonReader r) throws Exception {
+ private Boolean parseBoolean(UonReader r) throws IOException, ParseException {
String s = parseString(r, false);
if (s == null || s.equals("null"))
return null;
@@ -781,7 +787,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
throw new ParseException(this, "Unrecognized syntax for boolean. ''{0}''.", s);
}
- private Number parseNumber(UonReader r, Class<? extends Number> c) throws Exception {
+ private Number parseNumber(UonReader r, Class<? extends Number> c) throws IOException, ParseException {
String s = parseString(r, false);
if (s == null)
return null;
@@ -792,7 +798,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
* Call this method after you've finished a parsing a string to make sure that if there's any
* remainder in the input, that it consists only of whitespace and comments.
*/
- private void validateEnd(UonReader r) throws Exception {
+ private void validateEnd(UonReader r) throws IOException, ParseException {
if (! isValidateEnd())
return;
while (true) {
@@ -804,7 +810,7 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
}
}
- private static void skipSpace(ParserReader r) throws Exception {
+ private static void skipSpace(ParserReader r) throws IOException {
int c = 0;
while ((c = r.read()) != -1) {
if (c <= 2 || ! Character.isWhitespace(c)) {
@@ -820,9 +826,9 @@ public class UonParserSession extends ReaderParserSession implements HttpPartPar
* @param pipe The parser input.
* @param decodeChars Whether the reader should automatically decode URL-encoded characters.
* @return A new {@link UonReader} object.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- public final UonReader getUonReader(ParserPipe pipe, boolean decodeChars) throws Exception {
+ public final UonReader getUonReader(ParserPipe pipe, boolean decodeChars) throws IOException {
Reader r = pipe.getReader();
if (r instanceof UonReader)
return (UonReader)r;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonReader.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonReader.java
index 7b8359e..cf080fc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonReader.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonReader.java
@@ -43,9 +43,9 @@ public final class UonReader extends ParserReader {
*
* @param pipe The parser input.
* @param decodeChars Whether the input is URL-encoded.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- public UonReader(ParserPipe pipe, boolean decodeChars) throws Exception {
+ public UonReader(ParserPipe pipe, boolean decodeChars) throws IOException {
super(pipe);
this.decodeChars = decodeChars;
if (pipe.isString()) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
index fee378e..3cfbdd3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
@@ -55,9 +55,9 @@ public class UonSerializerSession extends WriterSerializerSession implements Htt
*
* @param out The output target object.
* @return The output target object wrapped in an {@link UonWriter}.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- protected final UonWriter getUonWriter(SerializerPipe out) throws Exception {
+ protected final UonWriter getUonWriter(SerializerPipe out) throws IOException {
Object output = out.getRawOutput();
if (output instanceof UonWriter)
return (UonWriter)output;
@@ -71,7 +71,7 @@ public class UonSerializerSession extends WriterSerializerSession implements Htt
}
@Override /* Serializer */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
serializeAnything(getUonWriter(out), o, getExpectedRootType(o), "root", null);
}
@@ -89,10 +89,11 @@ public class UonSerializerSession extends WriterSerializerSession implements Htt
* <jk>null</jk> if this isn't a bean property being serialized.
* @param pMeta The bean property metadata.
* @return The same writer passed in.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
+ * @throws SerializeException Generic serialization error occurred.
*/
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected SerializerWriter serializeAnything(UonWriter out, Object o, ClassMeta<?> eType, String attrName, BeanPropertyMeta pMeta) throws Exception {
+ @SuppressWarnings({ "rawtypes" })
+ protected SerializerWriter serializeAnything(UonWriter out, Object o, ClassMeta<?> eType, String attrName, BeanPropertyMeta pMeta) throws IOException, SerializeException {
if (o == null) {
out.appendObject(null, false);
@@ -105,7 +106,7 @@ public class UonSerializerSession extends WriterSerializerSession implements Htt
ClassMeta<?> aType; // The actual type
ClassMeta<?> sType; // The serialized type
- aType = push(attrName, o, eType);
+ aType = push2(attrName, o, eType);
boolean isRecursion = aType == null;
// Handle recursion
@@ -120,7 +121,7 @@ public class UonSerializerSession extends WriterSerializerSession implements Htt
// Swap if necessary
PojoSwap swap = aType.getPojoSwap(this);
if (swap != null) {
- o = swap.swap(this, o);
+ o = swap(swap, o);
sType = swap.getSwapClassMeta(this);
// If the getSwapClass() method returns Object, we need to figure out
@@ -165,7 +166,7 @@ public class UonSerializerSession extends WriterSerializerSession implements Htt
}
@SuppressWarnings({ "rawtypes", "unchecked" })
- private SerializerWriter serializeMap(UonWriter out, Map m, ClassMeta<?> type) throws Exception {
+ private SerializerWriter serializeMap(UonWriter out, Map m, ClassMeta<?> type) throws IOException, SerializeException {
m = sort(m);
@@ -195,7 +196,7 @@ public class UonSerializerSession extends WriterSerializerSession implements Htt
return out;
}
- private SerializerWriter serializeBeanMap(UonWriter out, BeanMap<?> m, String typeName) throws Exception {
+ private SerializerWriter serializeBeanMap(UonWriter out, BeanMap<?> m, String typeName) throws IOException, SerializeException {
if (! plainTextParams)
out.append('(');
@@ -236,7 +237,7 @@ public class UonSerializerSession extends WriterSerializerSession implements Htt
}
@SuppressWarnings({ "rawtypes", "unchecked" })
- private SerializerWriter serializeCollection(UonWriter out, Collection c, ClassMeta<?> type) throws Exception {
+ private SerializerWriter serializeCollection(UonWriter out, Collection c, ClassMeta<?> type) throws IOException, SerializeException {
ClassMeta<?> elementType = type.getElementType();
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonWriter.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonWriter.java
index e85527e..4f1ade7 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonWriter.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonWriter.java
@@ -130,7 +130,7 @@ public final class UonWriter extends SerializerWriter {
*
* @param o The boolean value to append to the output.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
protected UonWriter appendBoolean(Object o) throws IOException {
append(o.toString());
@@ -142,7 +142,7 @@ public final class UonWriter extends SerializerWriter {
*
* @param o The numeric value to append to the output.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
protected UonWriter appendNumber(Object o) throws IOException {
append(o.toString());
@@ -164,7 +164,7 @@ public final class UonWriter extends SerializerWriter {
*
* @param uri The URI to append to the output.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
@Override
public SerializerWriter appendUri(Object uri) throws IOException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
index 148ea36..3fde0ca 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.urlencoding;
+import java.io.IOException;
import java.lang.reflect.*;
import java.util.*;
@@ -65,7 +66,7 @@ public class UrlEncodingParserSession extends UonParserSession {
}
@Override /* ParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
try (UonReader r = getUonReader(pipe, true)) {
return parseAnything(type, r, getOuter());
}
@@ -81,7 +82,7 @@ public class UrlEncodingParserSession extends UonParserSession {
}
}
- private <T> T parseAnything(ClassMeta<T> eType, UonReader r, Object outer) throws Exception {
+ private <T> T parseAnything(ClassMeta<T> eType, UonReader r, Object outer) throws IOException, ParseException, ExecutableException {
if (eType == null)
eType = (ClassMeta<T>)object();
@@ -147,7 +148,7 @@ public class UrlEncodingParserSession extends UonParserSession {
}
if (swap != null && o != null)
- o = swap.unswap(this, o, eType);
+ o = unswap(swap, o, eType);
if (outer != null)
setParent(eType, o, outer);
@@ -155,7 +156,7 @@ public class UrlEncodingParserSession extends UonParserSession {
return (T)o;
}
- private <K,V> Map<K,V> parseIntoMap2(UonReader r, Map<K,V> m, ClassMeta<?> type, Object outer) throws Exception {
+ private <K,V> Map<K,V> parseIntoMap2(UonReader r, Map<K,V> m, ClassMeta<?> type, Object outer) throws IOException, ParseException, ExecutableException {
ClassMeta<K> keyType = (ClassMeta<K>)(type.isArgs() || type.isCollectionOrArray() ? getClassMeta(Integer.class) : type.getKeyType());
@@ -241,7 +242,7 @@ public class UrlEncodingParserSession extends UonParserSession {
return null; // Unreachable.
}
- private <T> BeanMap<T> parseIntoBeanMap(UonReader r, BeanMap<T> m) throws Exception {
+ private <T> BeanMap<T> parseIntoBeanMap(UonReader r, BeanMap<T> m) throws IOException, ParseException, ExecutableException {
int c = r.peekSkipWs();
if (c == -1)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
index 0b2bccf..10dd525 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
@@ -14,6 +14,7 @@ package org.apache.juneau.urlencoding;
import static org.apache.juneau.internal.ArrayUtils.*;
+import java.io.IOException;
import java.lang.reflect.*;
import java.util.*;
@@ -82,20 +83,20 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
serializeAnything(getUonWriter(out), o);
}
/*
* Workhorse method. Determines the type of object, and then calls the appropriate type-specific serialization method.
*/
- private SerializerWriter serializeAnything(UonWriter out, Object o) throws Exception {
+ private SerializerWriter serializeAnything(UonWriter out, Object o) throws IOException, SerializeException {
ClassMeta<?> aType; // The actual type
ClassMeta<?> sType; // The serialized type
ClassMeta<?> eType = getExpectedRootType(o);
- aType = push("root", o, eType);
+ aType = push2("root", o, eType);
indent--;
if (aType == null)
aType = object();
@@ -106,7 +107,7 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
// Swap if necessary
PojoSwap swap = aType.getPojoSwap(this);
if (swap != null) {
- o = swap.swap(this, o);
+ o = swap(swap, o);
sType = swap.getSwapClassMeta(this);
// If the getSwapClass() method returns Object, we need to figure out
@@ -160,7 +161,7 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
return m;
}
- private SerializerWriter serializeMap(UonWriter out, Map m, ClassMeta<?> type) throws Exception {
+ private SerializerWriter serializeMap(UonWriter out, Map m, ClassMeta<?> type) throws IOException, SerializeException {
m = sort(m);
@@ -193,7 +194,7 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
return out;
}
- private SerializerWriter serializeCollectionMap(UonWriter out, Map m, ClassMeta<?> type) throws Exception {
+ private SerializerWriter serializeCollectionMap(UonWriter out, Map m, ClassMeta<?> type) throws IOException, SerializeException {
ClassMeta<?> valueType = type.getValueType();
@@ -210,7 +211,7 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
return out;
}
- private SerializerWriter serializeBeanMap(UonWriter out, BeanMap<?> m, String typeName) throws Exception {
+ private SerializerWriter serializeBeanMap(UonWriter out, BeanMap<?> m, String typeName) throws IOException, SerializeException {
boolean addAmp = false;
for (BeanPropertyValue p : m.getValues(isTrimNullProperties(), typeName != null ? createBeanTypeNameProperty(m, typeName) : null)) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java
index 47ad570..aa94513 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java
@@ -421,9 +421,8 @@ public class CalendarUtils {
* @param locale The locale to use. If <jk>null</jk>, uses {@link Locale#getDefault()}.
* @param timeZone The time zone to use. If <jk>null</jk>, uses {@link TimeZone#getDefault()}.
* @return The serialized date, or <jk>null</jk> if the calendar was <jk>null</jk>.
- * @throws Exception
*/
- public static final String serialize(Calendar c, CalendarUtils.Format format, Locale locale, TimeZone timeZone) throws Exception {
+ public static final String serialize(Calendar c, CalendarUtils.Format format, Locale locale, TimeZone timeZone) {
if (c == null)
return null;
if (timeZone == null)
@@ -486,9 +485,8 @@ public class CalendarUtils {
* @param locale The locale to use. If <jk>null</jk>, uses {@link Locale#getDefault()}.
* @param timeZone The time zone to use. If <jk>null</jk>, uses {@link TimeZone#getDefault()}.
* @return The serialized date, or <jk>null</jk> if the calendar was <jk>null</jk>.
- * @throws Exception
*/
- public static final String serialize(Date d, CalendarUtils.Format format, Locale locale, TimeZone timeZone) throws Exception {
+ public static final String serialize(Date d, CalendarUtils.Format format, Locale locale, TimeZone timeZone) {
if (d == null)
return null;
if (timeZone == null)
@@ -556,9 +554,9 @@ public class CalendarUtils {
* The timezone to assume if input string doesn't contain timezone info.
* If <jk>null</jk>, uses {@link TimeZone#getDefault()}.
* @return The date as a {@link Calendar}, or <jk>null</jk> if the input was <jk>null</jk> or empty.
- * @throws Exception
+ * @throws java.text.ParseException Malformed input encountered.
*/
- public static final Calendar parseCalendar(String in, CalendarUtils.Format format, Locale locale, TimeZone timeZone) throws Exception {
+ public static final Calendar parseCalendar(String in, CalendarUtils.Format format, Locale locale, TimeZone timeZone) throws java.text.ParseException {
if (isEmpty(in))
return null;
if (timeZone == null)
@@ -628,9 +626,9 @@ public class CalendarUtils {
* The timezone to assume if input string doesn't contain timezone info.
* If <jk>null</jk>, uses {@link TimeZone#getDefault()}.
* @return The date as a {@link Date}, or <jk>null</jk> if the input was <jk>null</jk> or empty.
- * @throws Exception
+ * @throws java.text.ParseException Malformed input encountered.
*/
- public static final Date parseDate(String in, CalendarUtils.Format format, Locale locale, TimeZone timeZone) throws Exception {
+ public static final Date parseDate(String in, CalendarUtils.Format format, Locale locale, TimeZone timeZone) throws java.text.ParseException {
if (isEmpty(in))
return null;
if (timeZone == null)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinder.java
index 8cd2ce8..db6bd9b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinder.java
@@ -56,7 +56,7 @@ public interface ClasspathResourceFinder {
* The locale of the resource to retrieve.
* <br>If <jk>null</jk>, won't look for localized file names.
* @return The resolved resource contents, or <jk>null</jk> if the resource was not found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
InputStream findResource(Class<?> baseClass, String name, Locale locale) throws IOException;
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderBasic.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderBasic.java
index 94b733c..a9b6119 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderBasic.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderBasic.java
@@ -49,7 +49,7 @@ public class ClasspathResourceFinderBasic extends ClasspathResourceFinderSimple
* The resource locale.
* <br>Can be <jk>null</jk>.
* @return The resource stream, or <jk>null</jk> if it couldn't be found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
protected InputStream findFileSystemResource(String name, Locale locale) throws IOException {
if (name.indexOf("..") == -1) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderSimple.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderSimple.java
index eed8e39..7eea5f3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderSimple.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderSimple.java
@@ -62,7 +62,7 @@ public class ClasspathResourceFinderSimple implements ClasspathResourceFinder {
* The resource locale.
* <br>If <jk>null</jk>, won't look for localized file names.
* @return The resource stream, or <jk>null</jk> if it couldn't be found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
protected InputStream findClasspathResource(Class<?> baseClass, String name, Locale locale) throws IOException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceManager.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceManager.java
index ff8fee8..960d4c9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceManager.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceManager.java
@@ -68,7 +68,7 @@ public final class ClasspathResourceManager {
*
* @param name Name of the desired resource.
* @return An input stream to the object, or <jk>null</jk> if the resource could not be found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public InputStream getStream(String name) throws IOException {
return getStream(name, null);
@@ -80,7 +80,7 @@ public final class ClasspathResourceManager {
* @param name Name of the desired resource.
* @param locale The locale. Can be <jk>null</jk>.
* @return An input stream to the object, or <jk>null</jk> if the resource could not be found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public InputStream getStream(String name, Locale locale) throws IOException {
return getStream(baseClass, name, locale);
@@ -95,7 +95,7 @@ public final class ClasspathResourceManager {
* @param name Name of the desired resource.
* @param locale The locale. Can be <jk>null</jk>.
* @return An input stream to the object, or <jk>null</jk> if the resource could not be found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public InputStream getStream(Class<?> baseClass, String name, Locale locale) throws IOException {
@@ -124,7 +124,7 @@ public final class ClasspathResourceManager {
*
* @param name Name of the desired resource.
* @return The resource converted to a string, or <jk>null</jk> if the resource could not be found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public String getString(String name) throws IOException {
return getString(baseClass, name, null);
@@ -138,7 +138,7 @@ public final class ClasspathResourceManager {
* <br>If <jk>null<jk>, uses the base class passed in through the constructor of this class.
* @param name Name of the desired resource.
* @return The resource converted to a string, or <jk>null</jk> if the resource could not be found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public String getString(Class<?> baseClass, String name) throws IOException {
return getString(baseClass, name, null);
@@ -150,7 +150,7 @@ public final class ClasspathResourceManager {
* @param name Name of the desired resource.
* @param locale The locale. Can be <jk>null</jk>.
* @return The resource converted to a string, or <jk>null</jk> if the resource could not be found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public String getString(String name, Locale locale) throws IOException {
return getString(baseClass, name, locale);
@@ -165,7 +165,7 @@ public final class ClasspathResourceManager {
* @param name Name of the desired resource.
* @param locale The locale. Can be <jk>null</jk>.
* @return The resource converted to a string, or <jk>null</jk> if the resource could not be found.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public String getString(Class<?> baseClass, String name, Locale locale) throws IOException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IOPipe.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IOPipe.java
index 35745dc..15b57c0 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IOPipe.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/IOPipe.java
@@ -156,7 +156,7 @@ public class IOPipe {
* Performs the piping of the input to the output.
*
* @return The number of bytes (if streams) or characters (if readers/writers) piped.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public int run() throws IOException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoIntrospector.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoIntrospector.java
index 0706a18..785a92f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoIntrospector.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoIntrospector.java
@@ -86,8 +86,8 @@ public final class PojoIntrospector {
* The constructor pertains to an enum type.
* </ul>
* @throws InvocationTargetException If the underlying constructor throws an exception.
- * @throws ParseException If the input contains a syntax error or is malformed.
- * @throws IOException
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
*/
public Object invokeMethod(Method method, Reader args) throws InvocationTargetException, IllegalArgumentException,
IllegalAccessException, ParseException, IOException {
@@ -124,8 +124,8 @@ public final class PojoIntrospector {
* The constructor pertains to an enum type.
* </ul>
* @throws InvocationTargetException If the underlying constructor throws an exception.
- * @throws ParseException If the input contains a syntax error or is malformed.
- * @throws IOException
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
*/
public Object invokeMethod(String method, String args) throws NoSuchMethodException, IllegalArgumentException,
InvocationTargetException, IllegalAccessException, ParseException, IOException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoMerge.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoMerge.java
index a307b1c..03a2f55 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoMerge.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoMerge.java
@@ -14,6 +14,8 @@ package org.apache.juneau.utils;
import java.lang.reflect.*;
+import org.apache.juneau.ExecutableException;
+
/**
* Utility class for merging POJOs behind a single interface.
*
@@ -120,17 +122,19 @@ public class PojoMerge {
/**
* Implemented to handle the method called.
- * @throws InvocationTargetException
- * @throws IllegalAccessException
- * @throws IllegalArgumentException
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
@Override /* InvocationHandler */
- public Object invoke(Object proxy, Method method, Object[] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
+ public Object invoke(Object proxy, Method method, Object[] args) throws ExecutableException {
Object r = null;
boolean isGetter = args == null && method.getReturnType() != Void.class;
for (Object pojo : pojos) {
if (pojo != null) {
- r = method.invoke(pojo, args);
+ try {
+ r = method.invoke(pojo, args);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new ExecutableException(e);
+ }
if (isGetter) {
if (r != null)
return r;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRest.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRest.java
index 6228427..370a7ff 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRest.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRest.java
@@ -600,30 +600,16 @@ public final class PojoRest {
* These will automatically be converted to the appropriate object type if possible.
* This must be an array, like a JSON array.
* @return The returned object from the method call.
- * @throws IllegalAccessException
- * If the <c>Constructor</c> object enforces Java language access control and the underlying constructor is
- * inaccessible.
- * @throws IllegalArgumentException
- * If one of the following occurs:
- * <ul class='spaced-list'>
- * <li>
- * The number of actual and formal parameters differ.
- * <li>
- * An unwrapping conversion for primitive arguments fails.
- * <li>
- * A parameter value cannot be converted to the corresponding formal parameter type by a method invocation
- * conversion.
- * <li>
- * The constructor pertains to an enum type.
- * </ul>
- * @throws InvocationTargetException If the underlying constructor throws an exception.
- * @throws ParseException If the input contains a syntax error or is malformed.
- * @throws NoSuchMethodException
- * @throws IOException
- */
- public Object invokeMethod(String url, String method, String args) throws InvocationTargetException,
- IllegalArgumentException, IllegalAccessException, ParseException, NoSuchMethodException, IOException {
- return new PojoIntrospector(get(url), parser).invokeMethod(method, args);
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
+ */
+ public Object invokeMethod(String url, String method, String args) throws ExecutableException, ParseException, IOException {
+ try {
+ return new PojoIntrospector(get(url), parser).invokeMethod(method, args);
+ } catch (NoSuchMethodException | IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
+ throw new ExecutableException(e);
+ }
}
/**
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 f724fa5..7d90b07 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
@@ -297,8 +297,8 @@ public class ProcBuilder {
* Run this command and pipes the output to the specified writer or output stream.
*
* @return The exit code from the process.
- * @throws IOException
- * @throws InterruptedException
+ * @throws IOException Thrown by underlying stream.
+ * @throws InterruptedException Thread was interrupted.
*/
public int run() throws IOException, InterruptedException {
if (pb.command().size() == 0)
@@ -322,8 +322,8 @@ public class ProcBuilder {
* Run this command and returns the output as a simple string.
*
* @return The output from the command.
- * @throws IOException
- * @throws InterruptedException
+ * @throws IOException Thrown by underlying stream.
+ * @throws InterruptedException Thread was interrupted.
*/
public String getOutput() throws IOException, InterruptedException {
StringWriter sw = new StringWriter();
@@ -335,8 +335,8 @@ public class ProcBuilder {
* Returns the output from this process as a {@link Scanner}.
*
* @return The output from the process as a Scanner object.
- * @throws IOException
- * @throws InterruptedException
+ * @throws IOException Thrown by underlying stream.
+ * @throws InterruptedException Thread was interrupted.
*/
public Scanner getScanner() throws IOException, InterruptedException {
StringWriter sw = new StringWriter();
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringExpressionMatcher.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringExpressionMatcher.java
index 8f8a267..4d46afd 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringExpressionMatcher.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/StringExpressionMatcher.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.utils;
-import java.text.*;
+import java.text.ParseException;
import java.util.*;
import java.util.regex.*;
@@ -55,7 +55,7 @@ public class StringExpressionMatcher {
* Constructor.
*
* @param expression The string expression.
- * @throws ParseException If the expression is malformed.
+ * @throws ParseException Malformed input encountered.
*/
public StringExpressionMatcher(String expression) throws ParseException {
this.exp = parse(expression);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ZipFileList.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ZipFileList.java
index b088057..9818545 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ZipFileList.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ZipFileList.java
@@ -92,7 +92,7 @@ public class ZipFileList extends LinkedList<ZipFileList.ZipFileEntry> implements
* Write this entry to the specified output stream.
*
* @param zos The output stream to write to.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
void write(ZipOutputStream zos) throws IOException;
}
@@ -149,7 +149,7 @@ public class ZipFileList extends LinkedList<ZipFileList.ZipFileEntry> implements
*
* @param zos The output stream.
* @param f The file to add.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
protected void addFile(ZipOutputStream zos, File f) throws IOException {
if (doAdd(f)) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlDocSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlDocSerializerSession.java
index aef59cd..425eec4 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlDocSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlDocSerializerSession.java
@@ -41,7 +41,7 @@ public class XmlDocSerializerSession extends XmlSerializerSession {
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws java.io.IOException, SerializeException {
try (XmlWriter w = getXmlWriter(out)) {
w.append("<?xml")
.attr("version", "1.0")
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
index 9d1a935..52a7f00 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
@@ -16,6 +16,7 @@ import static javax.xml.stream.XMLStreamConstants.*;
import static org.apache.juneau.internal.StringUtils.*;
import static org.apache.juneau.xml.annotation.XmlFormat.*;
+import java.io.IOException;
import java.lang.reflect.*;
import java.util.*;
@@ -61,9 +62,10 @@ public class XmlParserSession extends ReaderParserSession {
*
* @param pipe The parser input.
* @return The new STAX reader.
- * @throws Exception If problem occurred trying to create reader.
+ * @throws IOException Thrown by underlying stream.
+ * @throws XMLStreamException Unexpected XML processing error.
*/
- protected final XmlReader getXmlReader(ParserPipe pipe) throws Exception {
+ protected final XmlReader getXmlReader(ParserPipe pipe) throws IOException, XMLStreamException {
return new XmlReader(pipe, isValidating(), getReporter(), getResolver(), getEventAllocator());
}
@@ -121,9 +123,11 @@ public class XmlParserSession extends ReaderParserSession {
*
* @param r The reader to read the element text from.
* @return The decoded text. <jk>null</jk> if the text consists of the sequence <js>'_x0000_'</js>.
- * @throws Exception
+ * @throws XMLStreamException Thrown by underlying reader.
+ * @throws IOException Thrown by underlying stream.
+ * @throws ParseException Malformed input encountered.
*/
- protected String getElementText(XmlReader r) throws Exception {
+ protected String getElementText(XmlReader r) throws XMLStreamException, IOException, ParseException {
return decodeString(r.getElementText().trim());
}
@@ -168,11 +172,13 @@ public class XmlParserSession extends ReaderParserSession {
/**
* Parses the current element as text.
*
- * @param r
+ * @param r The input reader.
* @return The parsed text.
- * @throws Exception
+ * @throws XMLStreamException Thrown by underlying reader.
+ * @throws IOException Thrown by underlying stream.
+ * @throws ParseException Malformed input encountered.
*/
- protected String parseText(XmlReader r) throws Exception {
+ protected String parseText(XmlReader r) throws IOException, XMLStreamException, ParseException {
// Note that this is different than {@link #getText(XmlReader)} since it assumes that we're pointing to a
// whitespace element.
@@ -222,16 +228,21 @@ public class XmlParserSession extends ReaderParserSession {
*
* @param r The XML stream reader to read the current event from.
* @return The whitespace character or characters.
- * @throws XMLStreamException
- * @throws Exception
+ * @throws XMLStreamException Thrown by underlying reader.
+ * @throws IOException Thrown by underlying stream.
+ * @throws ParseException Malformed input encountered.
*/
- protected String parseWhitespaceElement(XmlReader r) throws Exception {
+ protected String parseWhitespaceElement(XmlReader r) throws IOException, XMLStreamException, ParseException {
return null;
}
@Override /* ParserSession */
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
- return parseAnything(type, null, getXmlReader(pipe), getOuter(), true, null);
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
+ try {
+ return parseAnything(type, null, getXmlReader(pipe), getOuter(), true, null);
+ } catch (XMLStreamException e) {
+ throw new ParseException(e);
+ }
}
@Override /* ReaderParserSession */
@@ -249,6 +260,7 @@ public class XmlParserSession extends ReaderParserSession {
/**
* Workhorse method.
*
+ * @param <T> The expected type of object.
* @param eType The expected type of object.
* @param currAttr The current bean property name.
* @param r The reader.
@@ -256,10 +268,13 @@ public class XmlParserSession extends ReaderParserSession {
* @param isRoot If <jk>true</jk>, then we're serializing a root element in the document.
* @param pMeta The bean property metadata.
* @return The parsed object.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
+ * @throws ParseException Malformed input encountered.
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
+ * @throws XMLStreamException Malformed XML encountered.
*/
protected <T> T parseAnything(ClassMeta<T> eType, String currAttr, XmlReader r,
- Object outer, boolean isRoot, BeanPropertyMeta pMeta) throws Exception {
+ Object outer, boolean isRoot, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException, XMLStreamException {
if (eType == null)
eType = (ClassMeta<T>)object();
@@ -365,7 +380,7 @@ public class XmlParserSession extends ReaderParserSession {
}
if (swap != null && o != null)
- o = swap.unswap(this, o, eType);
+ o = unswap(swap, o, eType);
if (outer != null)
setParent(eType, o, outer);
@@ -374,7 +389,7 @@ public class XmlParserSession extends ReaderParserSession {
}
private <K,V> Map<K,V> parseIntoMap(XmlReader r, Map<K,V> m, ClassMeta<K> keyType,
- ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException, XMLStreamException {
int depth = 0;
for (int i = 0; i < r.getAttributeCount(); i++) {
String a = r.getAttributeLocalName(i);
@@ -413,7 +428,7 @@ public class XmlParserSession extends ReaderParserSession {
}
private <E> Collection<E> parseIntoCollection(XmlReader r, Collection<E> l,
- ClassMeta<?> type, BeanPropertyMeta pMeta) throws Exception {
+ ClassMeta<?> type, BeanPropertyMeta pMeta) throws IOException, ParseException, ExecutableException, XMLStreamException {
int depth = 0;
int argIndex = 0;
do {
@@ -452,7 +467,7 @@ public class XmlParserSession extends ReaderParserSession {
return UNKNOWN;
}
- private <T> BeanMap<T> parseIntoBean(XmlReader r, BeanMap<T> m) throws Exception {
+ private <T> BeanMap<T> parseIntoBean(XmlReader r, BeanMap<T> m) throws IOException, ParseException, ExecutableException, XMLStreamException {
BeanMeta<?> bMeta = m.getMeta();
XmlBeanMeta xmlMeta = bMeta.getExtendedMeta(XmlBeanMeta.class);
@@ -603,7 +618,7 @@ public class XmlParserSession extends ReaderParserSession {
} while (depth > 0);
}
- private Object getUnknown(XmlReader r) throws Exception {
+ private Object getUnknown(XmlReader r) throws IOException, ParseException, ExecutableException, XMLStreamException {
if (r.getEventType() != START_ELEMENT) {
throw new ParseException(this, "Parser must be on START_ELEMENT to read next text.");
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlReader.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlReader.java
index 7cc9759..0d28572 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlReader.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlReader.java
@@ -40,9 +40,10 @@ public final class XmlReader implements XMLStreamReader, Positionable {
* @param reporter The value for the {@link XMLInputFactory#REPORTER} setting.
* @param resolver The value for the {@link XMLInputFactory#RESOLVER} setting.
* @param eventAllocator The value for the {@link XMLInputFactory#ALLOCATOR} setting.
- * @throws Exception
+ * @throws IOException Thrown by underling
+ * @throws XMLStreamException Thrown by underlying XML stream.
*/
- protected XmlReader(ParserPipe pipe, boolean validating, XMLReporter reporter, XMLResolver resolver, XMLEventAllocator eventAllocator) throws Exception {
+ protected XmlReader(ParserPipe pipe, boolean validating, XMLReporter reporter, XMLResolver resolver, XMLEventAllocator eventAllocator) throws IOException, XMLStreamException {
this.pipe = pipe;
try {
@SuppressWarnings("resource")
@@ -62,9 +63,7 @@ public final class XmlReader implements XMLStreamReader, Positionable {
sr.nextTag();
pipe.setPositionable(this);
} catch (Error e) {
- throw new ParseException(e.getLocalizedMessage());
- } catch (XMLStreamException e) {
- throw new ParseException(e);
+ throw new IOException(e.getLocalizedMessage());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
index cbbab8f..f69c2bb 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
@@ -18,6 +18,7 @@ import static org.apache.juneau.xml.XmlSerializerSession.ContentResult.*;
import static org.apache.juneau.xml.XmlSerializerSession.JsonType.*;
import static org.apache.juneau.xml.annotation.XmlFormat.*;
+import java.io.IOException;
import java.lang.reflect.*;
import java.util.*;
@@ -116,9 +117,9 @@ public class XmlSerializerSession extends WriterSerializerSession {
*
* @param out The output target object.
* @return The output target object wrapped in an {@link XmlWriter}.
- * @throws Exception
+ * @throws IOException Thrown by underlying stream.
*/
- public final XmlWriter getXmlWriter(SerializerPipe out) throws Exception {
+ public final XmlWriter getXmlWriter(SerializerPipe out) throws IOException {
Object output = out.getRawOutput();
if (output instanceof XmlWriter)
return (XmlWriter)output;
@@ -128,7 +129,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
}
@Override /* Serializer */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
if (isEnableNamespaces() && isAutoDetectNamespaces())
findNsfMappings(o);
serializeAnything(getXmlWriter(out), o, getExpectedRootType(o), null, null, isEnableNamespaces() && isAddNamespaceUrisToRoot(), XmlFormat.DEFAULT, false, false, null);
@@ -138,7 +139,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
* Recursively searches for the XML namespaces on the specified POJO and adds them to the serializer context object.
*
* @param o The POJO to check.
- * @throws SerializeException
+ * @throws SerializeException Thrown if bean recursion occurred.
*/
protected final void findNsfMappings(Object o) throws SerializeException {
ClassMeta<?> aType = null; // The actual type
@@ -238,7 +239,8 @@ public class XmlSerializerSession extends WriterSerializerSession {
* <jk>true</jk> if we're serializing {@link XmlFormat#MIXED_PWS} or {@link XmlFormat#TEXT_PWS}.
* @param pMeta The bean property metadata if this is a bean property being serialized.
* @return The same writer passed in so that calls to the writer can be chained.
- * @throws Exception If a problem occurred trying to convert the output.
+ * @throws IOException Thrown by underlying stream.
+ * @throws SerializeException General serialization error occurred.
*/
protected ContentResult serializeAnything(
XmlWriter out,
@@ -250,7 +252,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
XmlFormat format,
boolean isMixed,
boolean preserveWhitespace,
- BeanPropertyMeta pMeta) throws Exception {
+ BeanPropertyMeta pMeta) throws IOException, SerializeException {
JsonType type = null; // The type string (e.g. <type> or <x x='type'>
int i = isMixed ? 0 : indent; // Current indentation
@@ -258,7 +260,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
ClassMeta<?> wType = null; // The wrapped type (delegate)
ClassMeta<?> sType = object(); // The serialized type
- aType = push(elementName, o, eType);
+ aType = push2(elementName, o, eType);
if (eType == null)
eType = object();
@@ -281,7 +283,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
// Swap if necessary
PojoSwap swap = aType.getPojoSwap(this);
if (swap != null) {
- o = swap.swap(this, o);
+ o = swap(swap, o);
sType = swap.getSwapClassMeta(this);
// If the getSwapClass() method returns Object, we need to figure out
@@ -486,7 +488,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
}
private ContentResult serializeMap(XmlWriter out, Map m, ClassMeta<?> sType,
- ClassMeta<?> eKeyType, ClassMeta<?> eValueType, boolean isMixed) throws Exception {
+ ClassMeta<?> eKeyType, ClassMeta<?> eValueType, boolean isMixed) throws IOException, SerializeException {
m = sort(m);
@@ -518,7 +520,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
}
private ContentResult serializeBeanMap(XmlWriter out, BeanMap<?> m,
- Namespace elementNs, boolean isCollapsed, boolean isMixed) throws Exception {
+ Namespace elementNs, boolean isCollapsed, boolean isMixed) throws IOException, SerializeException {
boolean hasChildren = false;
BeanMeta<?> bm = m.getMeta();
@@ -662,7 +664,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
}
private XmlWriter serializeCollection(XmlWriter out, Object in, ClassMeta<?> sType,
- ClassMeta<?> eType, BeanPropertyMeta ppMeta, boolean isMixed) throws Exception {
+ ClassMeta<?> eType, BeanPropertyMeta ppMeta, boolean isMixed) throws IOException, SerializeException {
ClassMeta<?> eeType = eType.getElementType();
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlWriter.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlWriter.java
index f765a94..29fdebd 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlWriter.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlWriter.java
@@ -141,7 +141,7 @@ public class XmlWriter extends SerializerWriter {
* Shortcut for <code>append(<js>'>'</js>);</code>
*
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public XmlWriter cTag() throws IOException {
append('>');
@@ -155,7 +155,7 @@ public class XmlWriter extends SerializerWriter {
* Shortcut for <code>append(<js>'/'</js>).append(<js>'>'</js>);</code>
*
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public XmlWriter ceTag() throws IOException {
append('/').append('>');
@@ -554,7 +554,7 @@ public class XmlWriter extends SerializerWriter {
* @param preserveWhitespace
* If <jk>true</jk>, then we're serializing {@link XmlFormat#MIXED_PWS} or {@link XmlFormat#TEXT_PWS} content.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public XmlWriter text(Object o, boolean preserveWhitespace) throws IOException {
XmlUtils.encodeText(this, o, trimStrings, preserveWhitespace);
@@ -566,7 +566,7 @@ public class XmlWriter extends SerializerWriter {
*
* @param o The object being serialized.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public XmlWriter textUri(Object o) throws IOException {
text(uriResolver.resolve(o), false);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializerSession.java
index e11d85a..09b3619 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializerSession.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.xmlschema;
+import java.io.IOException;
+
import org.apache.juneau.serializer.*;
import org.apache.juneau.xml.*;
@@ -41,7 +43,7 @@ public class XmlSchemaDocSerializerSession extends XmlSchemaSerializerSession {
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
try (XmlWriter w = getXmlWriter(out)) {
w.append("<?xml")
.attr("version", "1.0")
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerSession.java
index ef9439a..e4be1cc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerSession.java
@@ -56,7 +56,7 @@ public class XmlSchemaSerializerSession extends XmlSerializerSession {
}
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
if (isEnableNamespaces() && isAutoDetectNamespaces())
findNsfMappings(o);
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/DtoExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/DtoExample.java
index 8ad5225..4480e4b 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/DtoExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/DtoExample.java
@@ -34,181 +34,182 @@ import static org.apache.juneau.dto.swagger.SwaggerBuilder.*;
*/
public class DtoExample {
- /**
- * DTO Samples
- * @param args
- * @throws Exception
- */
+ /**
+ * DTO Samples
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
- //Produces
- /**
- * <table>
- * <tr>
- * <th>c1</th>
- * <th>c2</th>
- * </tr>
- * <tr>
- * <td>v1</td>
- * <td>v2</td>
- * </tr>
- * </table>
- */
- Object mytable =
- table(
- tr(
- th("c1"),
- th("c2")
- ),
- tr(
- td("v1"),
- td("v2")
- )
- );
+ //Produces
+ /**
+ * <table>
+ * <tr>
+ * <th>c1</th>
+ * <th>c2</th>
+ * </tr>
+ * <tr>
+ * <td>v1</td>
+ * <td>v2</td>
+ * </tr>
+ * </table>
+ */
+ Object mytable =
+ table(
+ tr(
+ th("c1"),
+ th("c2")
+ ),
+ tr(
+ td("v1"),
+ td("v2")
+ )
+ );
- String html = HtmlSerializer.DEFAULT.serialize(mytable);
+ String html = HtmlSerializer.DEFAULT.serialize(mytable);
- Object mainJsp =
- form().action("main.jsp").method("GET")
- .children(
- input("text").name("first_name").value("apache"), br(),
- input("text").name("last_name").value("juneau"), br(),
- button("submit", "Submit"),
- button("reset", "Reset")
- );
+ Object mainJsp =
+ form().action("main.jsp").method("GET")
+ .children(
+ input("text").name("first_name").value("apache"), br(),
+ input("text").name("last_name").value("juneau"), br(),
+ button("submit", "Submit"),
+ button("reset", "Reset")
+ );
- /**
- * <form action='main.jsp' method='POST'>
- * Position (1-10000): <input name='pos' type='number'
- * value='1'/><br/>
- * Limit (1-10000): <input name='pos' type='number'
- * value='100'/><br/>
- * <button type='submit'>Submit</button>
- * <button type='reset'>Reset</button>
- * </form>
- */
- html = HtmlSerializer.DEFAULT.serialize(mainJsp);
+ /**
+ * <form action='main.jsp' method='POST'>
+ * Position (1-10000): <input name='pos' type='number'
+ * value='1'/><br/>
+ * Limit (1-10000): <input name='pos' type='number'
+ * value='100'/><br/>
+ * <button type='submit'>Submit</button>
+ * <button type='reset'>Reset</button>
+ * </form>
+ */
+ html = HtmlSerializer.DEFAULT.serialize(mainJsp);
- /**
- * Produces
- * {
- * a:{action:'main.jsp',method:'GET'},
- * c:[
- * {a:{type:'text',name:'first_name',value:'apache'}},{},
- * {a:{type:'text',name:'last_name',value:'juneau'}},{},
- * {a:{type:'submit'},c:['Submit']},
- * {a:{type:'reset'},c:['Reset']}
- * ]
- * }
- */
- html = JsonSerializer.create().simple().sq().build().serialize(mainJsp);
+ /**
+ * Produces
+ * {
+ * a:{action:'main.jsp',method:'GET'},
+ * c:[
+ * {a:{type:'text',name:'first_name',value:'apache'}},{},
+ * {a:{type:'text',name:'last_name',value:'juneau'}},{},
+ * {a:{type:'submit'},c:['Submit']},
+ * {a:{type:'reset'},c:['Reset']}
+ * ]
+ * }
+ */
+ html = JsonSerializer.create().simple().sq().build().serialize(mainJsp);
- Feed feed =
- feed("tag:juneau.apache.org", "Juneau ATOM specification", "2018-12-15T08:52:05Z")
- .title("Example apache Juneau feed")
- .subtitle(text("html").text("Describes <em>stuff</em> about Juneau"))
- .links(
- link("alternate", "text/html", "http://juneau.apache.org/").hreflang("en"),
- link("self", "application/atom+xml", "http://juneau.apache.org/feed.atom")
- )
- .rights("Copyright (c) 2016, Apache Foundation")
- .authors(new Person("Juneau_Commiter"))
- .updated("2018-12-15T08:52:05Z")
- .entries(
- entry("tag:juneau.sample.com,2013:1.2345", "Juneau ATOM specification snapshot", "2016-01-02T03:04:05Z")
- .published("2016-01-02T03:04:05Z")
- .content(
- content("xhtml")
- .lang("en")
- .base("http://www.apache.org/")
- .text("<div><p><i>[Update: Juneau supports ATOM.]</i></p></div>")
- )
- );
+ Feed feed =
+ feed("tag:juneau.apache.org", "Juneau ATOM specification", "2018-12-15T08:52:05Z")
+ .title("Example apache Juneau feed")
+ .subtitle(text("html").text("Describes <em>stuff</em> about Juneau"))
+ .links(
+ link("alternate", "text/html", "http://juneau.apache.org/").hreflang("en"),
+ link("self", "application/atom+xml", "http://juneau.apache.org/feed.atom")
+ )
+ .rights("Copyright (c) 2016, Apache Foundation")
+ .authors(new Person("Juneau_Commiter"))
+ .updated("2018-12-15T08:52:05Z")
+ .entries(
+ entry("tag:juneau.sample.com,2013:1.2345", "Juneau ATOM specification snapshot", "2016-01-02T03:04:05Z")
+ .published("2016-01-02T03:04:05Z")
+ .content(
+ content("xhtml")
+ .lang("en")
+ .base("http://www.apache.org/")
+ .text("<div><p><i>[Update: Juneau supports ATOM.]</i></p></div>")
+ )
+ );
- Swagger swagger = swagger()
- .swagger("2.0")
- .info(
- info("Swagger Petstore", "1.0.0")
- .description("This is a sample server Petstore server.")
- .termsOfService("http://swagger.io/terms/")
- .contact(
- contact().email("apiteam@swagger.io")
- )
- .license(
- license("Apache 2.0").url("http://www.apache.org/licenses/LICENSE-2.0.html")
- )
- )
- .path("/pet", "post",
- operation()
- .tags("pet")
- .summary("Add a new pet to the store")
- .description("")
- .operationId("addPet")
- .consumes(MediaType.JSON, MediaType.XML)
- .produces(MediaType.JSON, MediaType.XML)
- .parameters(
- parameterInfo("body", "body")
- .description("Pet object that needs to be added to the store")
- .required(true)
- )
- .response("405", responseInfo("Invalid input"))
- );
+ Swagger swagger = swagger()
+ .swagger("2.0")
+ .info(
+ info("Swagger Petstore", "1.0.0")
+ .description("This is a sample server Petstore server.")
+ .termsOfService("http://swagger.io/terms/")
+ .contact(
+ contact().email("apiteam@swagger.io")
+ )
+ .license(
+ license("Apache 2.0").url("http://www.apache.org/licenses/LICENSE-2.0.html")
+ )
+ )
+ .path("/pet", "post",
+ operation()
+ .tags("pet")
+ .summary("Add a new pet to the store")
+ .description("")
+ .operationId("addPet")
+ .consumes(MediaType.JSON, MediaType.XML)
+ .produces(MediaType.JSON, MediaType.XML)
+ .parameters(
+ parameterInfo("body", "body")
+ .description("Pet object that needs to be added to the store")
+ .required(true)
+ )
+ .response("405", responseInfo("Invalid input"))
+ );
- // Serialize to Swagger/JSON
- /**
- * Produces
- * {
- * "swagger": "2.0",
- * "info": {
- * "title": "Swagger Petstore",
- * "description": "This is a sample server Petstore server.",
- * "version": "1.0.0",
- * "termsOfService": "http://swagger.io/terms/",
- * "contact": {
- * "email": "apiteam@swagger.io"
- * },
- * "license": {
- * "name": "Apache 2.0",
- * "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
- * }
- * },
- * "paths": {
- * "/pet": {
- * "post": {
- * "tags": [
- * "pet"
- * ],
- * "summary": "Add a new pet to the store",
- * "description": "",
- * "operationId": "addPet",
- * "consumes": [
- * "application/json",
- * "text/xml"
- * ],
- * "produces": [
- * "application/json",
- * "text/xml"
- * ],
- * "parameters": [
- * {
- * "in": "body",
- * "name": "body",
- * "description": "Pet object that needs to be added to the store",
- * "required": true
- * }
- * ],
- * "responses": {
- * "405": {
- * "description": "Invalid input"
- * }
- * }
- * }
- * }
- * },
- * }
- */
- String swaggerJson = JsonSerializer.DEFAULT_READABLE.serialize(swagger);
+ // Serialize to Swagger/JSON
+ /**
+ * Produces
+ * {
+ * "swagger": "2.0",
+ * "info": {
+ * "title": "Swagger Petstore",
+ * "description": "This is a sample server Petstore server.",
+ * "version": "1.0.0",
+ * "termsOfService": "http://swagger.io/terms/",
+ * "contact": {
+ * "email": "apiteam@swagger.io"
+ * },
+ * "license": {
+ * "name": "Apache 2.0",
+ * "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+ * }
+ * },
+ * "paths": {
+ * "/pet": {
+ * "post": {
+ * "tags": [
+ * "pet"
+ * ],
+ * "summary": "Add a new pet to the store",
+ * "description": "",
+ * "operationId": "addPet",
+ * "consumes": [
+ * "application/json",
+ * "text/xml"
+ * ],
+ * "produces": [
+ * "application/json",
+ * "text/xml"
+ * ],
+ * "parameters": [
+ * {
+ * "in": "body",
+ * "name": "body",
+ * "description": "Pet object that needs to be added to the store",
+ * "required": true
+ * }
+ * ],
+ * "responses": {
+ * "405": {
+ * "description": "Invalid input"
+ * }
+ * }
+ * }
+ * }
+ * },
+ * }
+ */
+ String swaggerJson = JsonSerializer.DEFAULT_READABLE.serialize(swagger);
- }
+ }
}
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomFeed.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomFeed.java
index 4b2098d..d871b1d 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomFeed.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomFeed.java
@@ -28,46 +28,46 @@ import static org.apache.juneau.dto.atom.AtomBuilder.person;
*/
public class AtomFeed {
- public static Feed GetAtomFeed(){
+ /**
+ * @return A sample Atom feed.
+ */
+ public static Feed getAtomFeed(){
- Feed feed =
- feed("tag:juneau.apache.org", "Juneau ATOM specification", "2016-01-02T03:04:05Z")
- .subtitle(text("html").text("Describes <em>stuff</em> about Juneau"))
- .links(
- link("alternate", "text/html", "http://juneau.apache.org").hreflang("en"),
- link("self", "application/atom+xml", "http://juneau.apache.org/feed.atom")
- )
- .generator(
- generator("Juneau").uri("http://juneau.apache.org").version("1.0")
- )
- .entries(
- entry("tag:juneau.sample.com,2013:1.2345", "Juneau ATOM specification snapshot",
- "2016-01-02T03:04:05Z")
- .links(
- link("alternate", "text/html",
- "http://juneau.apache.org/juneau.atom"),
- link("enclosure", "audio/mpeg",
- "http://juneau.apache.org/audio/juneau_podcast.mp3").
- length(1337)
- )
- .published("2016-01-02T03:04:05Z")
- .authors(
- person("Jane Smith").
- uri("http://juneau.apache.org").
- email("janesmith@apache.org")
- )
- .contributors(
- person("John Smith")
- )
- .content(
- content("xhtml")
- .lang("en")
- .base("http://www.apache.org/")
- .text("<div><p><i>[Update: Juneau supports ATOM.]</i></p></div>")
- )
- );
+ Feed feed =
+ feed("tag:juneau.apache.org", "Juneau ATOM specification", "2016-01-02T03:04:05Z")
+ .subtitle(text("html").text("Describes <em>stuff</em> about Juneau"))
+ .links(
+ link("alternate", "text/html", "http://juneau.apache.org").hreflang("en"),
+ link("self", "application/atom+xml", "http://juneau.apache.org/feed.atom")
+ )
+ .generator(
+ generator("Juneau").uri("http://juneau.apache.org").version("1.0")
+ )
+ .entries(
+ entry("tag:juneau.sample.com,2013:1.2345", "Juneau ATOM specification snapshot", "2016-01-02T03:04:05Z")
+ .links(
+ link("alternate", "text/html", "http://juneau.apache.org/juneau.atom"),
+ link("enclosure", "audio/mpeg", "http://juneau.apache.org/audio/juneau_podcast.mp3").
+ length(1337)
+ )
+ .published("2016-01-02T03:04:05Z")
+ .authors(
+ person("Jane Smith").
+ uri("http://juneau.apache.org").
+ email("janesmith@apache.org")
+ )
+ .contributors(
+ person("John Smith")
+ )
+ .content(
+ content("xhtml")
+ .lang("en")
+ .base("http://www.apache.org/")
+ .text("<div><p><i>[Update: Juneau supports ATOM.]</i></p></div>")
+ )
+ );
- return feed;
+ return feed;
- }
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomHtmlExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomHtmlExample.java
index 08b8988..ad9604c 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomHtmlExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomHtmlExample.java
@@ -25,207 +25,213 @@ import org.apache.juneau.html.HtmlSerializer;
*/
public class AtomHtmlExample {
- public static void main(String[] args) throws Exception {
+ /**
+ * HTML Atom feed example.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ public static void main(String[] args) throws Exception {
- Feed feed = AtomFeed.GetAtomFeed();
+ Feed feed = AtomFeed.getAtomFeed();
- // Example with no namespaces
- // Create a serializer with readable output, no namespaces yet.
- HtmlSerializer s = HtmlSerializer.create().sq().ws().build();
+ // Example with no namespaces
+ // Create a serializer with readable output, no namespaces yet.
+ HtmlSerializer s = HtmlSerializer.create().sq().ws().build();
- //Produces
- /**
- * <table>
- * <tr>
- * <td>title</td>
- * <td>
- * <table>
- * <tr>
- * <td>text</td>
- * <td>Juneau ATOM specification</td>
- * </tr>
- * </table>
- * </td>
- * </tr>
- * <tr>
- * <td>updated</td>
- * <td>2016-01-02T03:04:05Z</td>
- * </tr>
- * <tr>
- * <td>links</td>
- * <td>
- * <table _type='array'>
- * <tr>
- * <th>rel</th>
- * <th>href</th>
- * <th>hreflang</th>
- * <th>type</th>
- * </tr>
- * <tr>
- * <td>alternate</td>
- * <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td>
- * <td>en</td>
- * <td>text/html</td>
- * </tr>
- * <tr>
- * <td>self</td>
- * <td><a href='http://juneau.apache.org/feed.atom'>http://juneau.apache.org/feed.atom</a></td>
- * <td><null/></td>
- * <td>application/atom+xml</td>
- * </tr>
- * </table>
- * </td>
- * </tr>
- * <tr>
- * <td>id</td>
- * <td>
- * <table>
- * <tr>
- * <td>text</td>
- * <td>tag:juneau.apache.org</td>
- * </tr>
- * </table>
- * </td>
- * </tr>
- * <tr>
- * <td>subtitle</td>
- * <td>
- * <table>
- * <tr>
- * <td>text</td>
- * <td>Describes <em>stuff</em> about Juneau</td>
- * </tr>
- * <tr>
- * <td>type</td>
- * <td>html</td>
- * </tr>
- * </table>
- * </td>
- * </tr>
- * <tr>
- * <td>generator</td>
- * <td>
- * <table>
- * <tr>
- * <td>version</td>
- * <td>1.0</td>
- * </tr>
- * <tr>
- * <td>text</td>
- * <td>Juneau</td>
- * </tr>
- * <tr>
- * <td>uri</td>
- * <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td>
- * </tr>
- * </table>
- * </td>
- * </tr>
- * <tr>
- * <td>entries</td>
- * <td>
- * <table _type='array'>
- * <tr>
- * <th>title</th>
- * <th>updated</th>
- * <th>links</th>
- * <th>contributors</th>
- * <th>authors</th>
- * <th>id</th>
- * <th>content</th>
- * </tr>
- * <tr>
- * <td>
- * <table>
- * <tr>
- * <td>text</td>
- * <td>Juneau ATOM specification snapshot</td>
- * </tr>
- * </table>
- * </td>
- * <td>2016-01-02T03:04:05Z</td>
- * <td>
- * <table _type='array'>
- * <tr>
- * <th>rel</th>
- * <th>href</th>
- * <th>type</th>
- * <th>length</th>
- * </tr>
- * <tr>
- * <td>alternate</td>
- * <td><a href='http://juneau.apache.org/juneau.atom'>http://juneau.apache.org/juneau.atom</a></td>
- * <td>text/html</td>
- * <td><null/></td>
- * </tr>
- * <tr>
- * <td>enclosure</td>
- * <td><a href='http://juneau.apache.org/audio/juneau_podcast.mp3'>http://juneau.apache.org/audio/juneau_podcast.mp3</a></td>
- * <td>audio/mpeg</td>
- * <td>1337</td>
- * </tr>
- * </table>
- * </td>
- * <td>
- * <table _type='array'>
- * <tr>
- * <th>uri</th>
- * <th>email</th>
- * <th>name</th>
- * </tr>
- * <tr>
- * <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td>
- * <td>janesmith@apache.org</td>
- * <td>Jane Smith</td>
- * </tr>
- * </table>
- * </td>
- * <td>
- * <table _type='array'>
- * <tr>
- * <th>name</th>
- * </tr>
- * <tr>
- * <td>John Smith</td>
- * </tr>
- * </table>
- * </td>
- * <td>
- * <table>
- * <tr>
- * <td>text</td>
- * <td>tag:juneau.sample.com,2013:1.2345</td>
- * </tr>
- * </table>
- * </td>
- * <td>2016-01-02T03:04:05Z</td>
- * <td>
- * <table>
- * <tr>
- * <td>lang</td>
- * <td>en</td>
- * </tr>
- * <tr>
- * <td>base</td>
- * <td><a href='http://www.apache.org/'>http://www.apache.org/</a></td>
- * </tr>
- * <tr>
- * <td>text</td>
- * <td><div><p><i>[Update: Juneau supports ATOM.]</i></p></div></td>
- * </tr>
- * <tr>
- * <td>type</td>
- * <td>xhtml</td>
- * </tr>
- * </table>
- * </td>
- * </tr>
- * </table>
- * </td>
- * </tr>
- * </table>
- */
- System.out.print(s.serialize(feed));
- }
+ //Produces
+ /**
+ * <table>
+ * <tr>
+ * <td>title</td>
+ * <td>
+ * <table>
+ * <tr>
+ * <td>text</td>
+ * <td>Juneau ATOM specification</td>
+ * </tr>
+ * </table>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>updated</td>
+ * <td>2016-01-02T03:04:05Z</td>
+ * </tr>
+ * <tr>
+ * <td>links</td>
+ * <td>
+ * <table _type='array'>
+ * <tr>
+ * <th>rel</th>
+ * <th>href</th>
+ * <th>hreflang</th>
+ * <th>type</th>
+ * </tr>
+ * <tr>
+ * <td>alternate</td>
+ * <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td>
+ * <td>en</td>
+ * <td>text/html</td>
+ * </tr>
+ * <tr>
+ * <td>self</td>
+ * <td><a href='http://juneau.apache.org/feed.atom'>http://juneau.apache.org/feed.atom</a></td>
+ * <td><null/></td>
+ * <td>application/atom+xml</td>
+ * </tr>
+ * </table>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>id</td>
+ * <td>
+ * <table>
+ * <tr>
+ * <td>text</td>
+ * <td>tag:juneau.apache.org</td>
+ * </tr>
+ * </table>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>subtitle</td>
+ * <td>
+ * <table>
+ * <tr>
+ * <td>text</td>
+ * <td>Describes <em>stuff</em> about Juneau</td>
+ * </tr>
+ * <tr>
+ * <td>type</td>
+ * <td>html</td>
+ * </tr>
+ * </table>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>generator</td>
+ * <td>
+ * <table>
+ * <tr>
+ * <td>version</td>
+ * <td>1.0</td>
+ * </tr>
+ * <tr>
+ * <td>text</td>
+ * <td>Juneau</td>
+ * </tr>
+ * <tr>
+ * <td>uri</td>
+ * <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td>
+ * </tr>
+ * </table>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>entries</td>
+ * <td>
+ * <table _type='array'>
+ * <tr>
+ * <th>title</th>
+ * <th>updated</th>
+ * <th>links</th>
+ * <th>contributors</th>
+ * <th>authors</th>
+ * <th>id</th>
+ * <th>content</th>
+ * </tr>
+ * <tr>
+ * <td>
+ * <table>
+ * <tr>
+ * <td>text</td>
+ * <td>Juneau ATOM specification snapshot</td>
+ * </tr>
+ * </table>
+ * </td>
+ * <td>2016-01-02T03:04:05Z</td>
+ * <td>
+ * <table _type='array'>
+ * <tr>
+ * <th>rel</th>
+ * <th>href</th>
+ * <th>type</th>
+ * <th>length</th>
+ * </tr>
+ * <tr>
+ * <td>alternate</td>
+ * <td><a href='http://juneau.apache.org/juneau.atom'>http://juneau.apache.org/juneau.atom</a></td>
+ * <td>text/html</td>
+ * <td><null/></td>
+ * </tr>
+ * <tr>
+ * <td>enclosure</td>
+ * <td><a href='http://juneau.apache.org/audio/juneau_podcast.mp3'>http://juneau.apache.org/audio/juneau_podcast.mp3</a></td>
+ * <td>audio/mpeg</td>
+ * <td>1337</td>
+ * </tr>
+ * </table>
+ * </td>
+ * <td>
+ * <table _type='array'>
+ * <tr>
+ * <th>uri</th>
+ * <th>email</th>
+ * <th>name</th>
+ * </tr>
+ * <tr>
+ * <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td>
+ * <td>janesmith@apache.org</td>
+ * <td>Jane Smith</td>
+ * </tr>
+ * </table>
+ * </td>
+ * <td>
+ * <table _type='array'>
+ * <tr>
+ * <th>name</th>
+ * </tr>
+ * <tr>
+ * <td>John Smith</td>
+ * </tr>
+ * </table>
+ * </td>
+ * <td>
+ * <table>
+ * <tr>
+ * <td>text</td>
+ * <td>tag:juneau.sample.com,2013:1.2345</td>
+ * </tr>
+ * </table>
+ * </td>
+ * <td>2016-01-02T03:04:05Z</td>
+ * <td>
+ * <table>
+ * <tr>
+ * <td>lang</td>
+ * <td>en</td>
+ * </tr>
+ * <tr>
+ * <td>base</td>
+ * <td><a href='http://www.apache.org/'>http://www.apache.org/</a></td>
+ * </tr>
+ * <tr>
+ * <td>text</td>
+ * <td><div><p><i>[Update: Juneau supports ATOM.]</i></p></div></td>
+ * </tr>
+ * <tr>
+ * <td>type</td>
+ * <td>xhtml</td>
+ * </tr>
+ * </table>
+ * </td>
+ * </tr>
+ * </table>
+ * </td>
+ * </tr>
+ * </table>
+ */
+ System.out.print(s.serialize(feed));
+ }
}
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomJsonExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomJsonExample.java
index b2cd5f5..9be5e00 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomJsonExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomJsonExample.java
@@ -26,93 +26,99 @@ import org.apache.juneau.json.SimpleJsonSerializer;
*/
public class AtomJsonExample {
- @SuppressWarnings("unused")
+ /**
+ * JSON Atom feed example.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ @SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
- Feed feed = AtomFeed.GetAtomFeed();
+ Feed feed = AtomFeed.getAtomFeed();
- // Get JSON serializer with readable output.
- JsonSerializer s = SimpleJsonSerializer.DEFAULT_READABLE;
+ // Get JSON serializer with readable output.
+ JsonSerializer s = SimpleJsonSerializer.DEFAULT_READABLE;
- // Serialize to ATOM/JSON
- //Produces
- /**
- * {
- * id: {
- * text: 'tag:juneau.apache.org'
- * },
- * links: [
- * {
- * href: 'http://juneau.apache.org/',
- * rel: 'alternate',
- * type: 'text/html',
- * hreflang: 'en'
- * },
- * {
- * href: 'http://juneau.apache.org/juneau.atom',
- * rel: 'self',
- * type: 'application/atom+xml'
- * }
- * ],
- * title: {
- * type: 'text',
- * text: 'Juneau ATOM specification'
- * },
- * updated: '2016-01-02T03:04:05Z',
- * generator: {
- * uri: 'http://juneau.apache.org/',
- * version: '1.0',
- * text: 'Juneau'
- * },
- * subtitle: {
- * type: 'html',
- * text: 'Describes <em>stuff</em> about Juneau'
- * },
- * entries: [
- * {
- * authors: [
- * {
- * name: 'James Bognar',
- * uri: 'http://juneau.apache.org/',
- * email: 'jamesbognar@apache.org'
- * }
- * ],
- * contributors: [
- * {
- * name: 'Barry M. Caceres'
- * }
- * ],
- * id: {
- * text: 'tag:juneau.apache.org'
- * },
- * links: [
- * {
- * href: 'http://juneau.apache.org/juneau.atom',
- * rel: 'alternate',
- * type: 'text/html'
- * },
- * {
- * href: 'http://juneau.apache.org/audio/juneau_podcast.mp3',
- * rel: 'enclosure',
- * type: 'audio/mpeg',
- * length: 12345
- * }
- * ],
- * title: {
- * text: 'Juneau ATOM specification snapshot'
- * },
- * updated: '2016-01-02T03:04:05Z',
- * content: {
- * base: 'http://www.apache.org/',
- * lang: 'en',
- * type: 'xhtml',
- * text: '<div xmlns="http://www.w3.org/1999/xhtml"><p><i>[Update: Juneau supports ATOM.]</i></p></div>'
- * },
- * published: '2016-01-02T03:04:05Z'
- * }
- * ]
- * }
- */
- String atomJson = s.serialize(feed);
- }
+ // Serialize to ATOM/JSON
+ //Produces
+ /**
+ * {
+ * id: {
+ * text: 'tag:juneau.apache.org'
+ * },
+ * links: [
+ * {
+ * href: 'http://juneau.apache.org/',
+ * rel: 'alternate',
+ * type: 'text/html',
+ * hreflang: 'en'
+ * },
+ * {
+ * href: 'http://juneau.apache.org/juneau.atom',
+ * rel: 'self',
+ * type: 'application/atom+xml'
+ * }
+ * ],
+ * title: {
+ * type: 'text',
+ * text: 'Juneau ATOM specification'
+ * },
+ * updated: '2016-01-02T03:04:05Z',
+ * generator: {
+ * uri: 'http://juneau.apache.org/',
+ * version: '1.0',
+ * text: 'Juneau'
+ * },
+ * subtitle: {
+ * type: 'html',
+ * text: 'Describes <em>stuff</em> about Juneau'
+ * },
+ * entries: [
+ * {
+ * authors: [
+ * {
+ * name: 'James Bognar',
+ * uri: 'http://juneau.apache.org/',
+ * email: 'jamesbognar@apache.org'
+ * }
+ * ],
+ * contributors: [
+ * {
+ * name: 'Barry M. Caceres'
+ * }
+ * ],
+ * id: {
+ * text: 'tag:juneau.apache.org'
+ * },
+ * links: [
+ * {
+ * href: 'http://juneau.apache.org/juneau.atom',
+ * rel: 'alternate',
+ * type: 'text/html'
+ * },
+ * {
+ * href: 'http://juneau.apache.org/audio/juneau_podcast.mp3',
+ * rel: 'enclosure',
+ * type: 'audio/mpeg',
+ * length: 12345
+ * }
+ * ],
+ * title: {
+ * text: 'Juneau ATOM specification snapshot'
+ * },
+ * updated: '2016-01-02T03:04:05Z',
+ * content: {
+ * base: 'http://www.apache.org/',
+ * lang: 'en',
+ * type: 'xhtml',
+ * text: '<div xmlns="http://www.w3.org/1999/xhtml"><p><i>[Update: Juneau supports ATOM.]</i></p></div>'
+ * },
+ * published: '2016-01-02T03:04:05Z'
+ * }
+ * ]
+ * }
+ */
+ String atomJson = s.serialize(feed);
+ }
}
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomXmlExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomXmlExample.java
index 11bfcac..148c57f 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomXmlExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/dto/atom/AtomXmlExample.java
@@ -25,83 +25,89 @@ import org.apache.juneau.xml.XmlSerializer;
*/
public class AtomXmlExample {
- @SuppressWarnings("unused")
+ /**
+ * XML Atom feed example.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ @SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
- Feed feed = AtomFeed.GetAtomFeed();
+ Feed feed = AtomFeed.getAtomFeed();
- // Example with no namespaces
- // Create a serializer with readable output, no namespaces yet.
- XmlSerializer s = XmlSerializer.create().sq().ws().build();
+ // Example with no namespaces
+ // Create a serializer with readable output, no namespaces yet.
+ XmlSerializer s = XmlSerializer.create().sq().ws().build();
- //Produces
- /**
- *<feed>
- *<id> tag:juneau.apache.org</id>
- *<link href='http://juneau.apache.org/' rel='alternate' type='text/html' hreflang='en'/>
- *<link href='http://juneau.apache.org/feed.atom' rel='self' type='application/atom+xml'/>
- *<title type='text'>Juneau ATOM specification</title>
- *<updated>2016-01-02T03:04:05Z</updated>
- *<generator uri='http://juneau.apache.org/' version='1.0'>Juneau</generator>
- *<subtitle type='html'>Describes <em>stuff</em> about Juneau</subtitle>
- *<entry>
- * <author>
- * <name>Jane Smith</name>
- * <uri>http://juneau.apache.org/</uri>
- * <email>janesmith@apache.org</email>
- * </author>
- * <contributor>
- * <name>John Smith</name>
- * </contributor>
- * <id>tag:juneau.apache.org</id>
- * <link href='http://juneau.apache.org/juneau.atom' rel='alternate' type='text/html'/>
- * <link href='http://juneau.apache.org/audio/juneau_podcast.mp3' rel='enclosure' type='audio/mpeg' length='12345'/>
- * <title>Juneau ATOM specification snapshot</title>
- * <updated>2016-01-02T03:04:05Z</updated>
- * <content base='http://www.apache.org/' lang='en' type='xhtml'>
- * <div xmlns="http://www.w3.org/1999/xhtml"><p><i>[Update: Juneau supports ATOM.]</i></p></div>
- * </content>
- * <published>2016-01-02T03:04:05Z</published>
- *</entry>
- *</feed>
- */
- //Serialize to ATOM/XML
- String atomXml = s.serialize(feed);
+ //Produces
+ /**
+ *<feed>
+ *<id> tag:juneau.apache.org</id>
+ *<link href='http://juneau.apache.org/' rel='alternate' type='text/html' hreflang='en'/>
+ *<link href='http://juneau.apache.org/feed.atom' rel='self' type='application/atom+xml'/>
+ *<title type='text'>Juneau ATOM specification</title>
+ *<updated>2016-01-02T03:04:05Z</updated>
+ *<generator uri='http://juneau.apache.org/' version='1.0'>Juneau</generator>
+ *<subtitle type='html'>Describes <em>stuff</em> about Juneau</subtitle>
+ *<entry>
+ * <author>
+ * <name>Jane Smith</name>
+ * <uri>http://juneau.apache.org/</uri>
+ * <email>janesmith@apache.org</email>
+ * </author>
+ * <contributor>
+ * <name>John Smith</name>
+ * </contributor>
+ * <id>tag:juneau.apache.org</id>
+ * <link href='http://juneau.apache.org/juneau.atom' rel='alternate' type='text/html'/>
+ * <link href='http://juneau.apache.org/audio/juneau_podcast.mp3' rel='enclosure' type='audio/mpeg' length='12345'/>
+ * <title>Juneau ATOM specification snapshot</title>
+ * <updated>2016-01-02T03:04:05Z</updated>
+ * <content base='http://www.apache.org/' lang='en' type='xhtml'>
+ * <div xmlns="http://www.w3.org/1999/xhtml"><p><i>[Update: Juneau supports ATOM.]</i></p></div>
+ * </content>
+ * <published>2016-01-02T03:04:05Z</published>
+ *</entry>
+ *</feed>
+ */
+ //Serialize to ATOM/XML
+ String atomXml = s.serialize(feed);
- /**
- * Produces
- * <feed>
- * <link hreflang='en' rel='alternate' href='http://juneau.apache.org' type='text/html'/>
- * <link rel='self' href='http://juneau.apache.org/feed.atom' type='application/atom+xml'/>
- * <title>Juneau ATOM specification</title>
- * <updated>2016-01-02T03:04:05Z</updated>
- * <id>tag:juneau.apache.org</id>
- * <subtitle type='html'>Describes <em>stuff</em> about Juneau</subtitle>
- * <generator version='1.0' uri='http://juneau.apache.org'>Juneau</generator>
- * <entry>
- * <link rel='alternate' href='http://juneau.apache.org/juneau.atom' type='text/html'/>
- * <link rel='enclosure' href='http://juneau.apache.org/audio/juneau_podcast.mp3' type='audio/mpeg' length='1337'/>
- * <author>
- * <uri>http://juneau.apache.org</uri>
- * <email>janesmith@apache.org</email>
- * <name>Jane Smith</name>
- * </author>
- * <contributor>
- * <name>John Smith</name>
- * </contributor>
- * <title>Juneau ATOM specification snapshot</title>
- * <updated>2016-01-02T03:04:05Z</updated>
- * <id>tag:juneau.sample.com,2013:1.2345</id>
- * <published>2016-01-02T03:04:05Z</published>
- * <content lang='en' base='http://www.apache.org/' type='xhtml'><div><p><i>[Update: Juneau supports ATOM.]</i></p></div></content>
- * </entry>
- * </feed>
- */
- // Create a serializer with readable output, no namespaces yet.
- XmlSerializer ns = XmlSerializer.create().sq().ws().build();
+ /**
+ * Produces
+ * <feed>
+ * <link hreflang='en' rel='alternate' href='http://juneau.apache.org' type='text/html'/>
+ * <link rel='self' href='http://juneau.apache.org/feed.atom' type='application/atom+xml'/>
+ * <title>Juneau ATOM specification</title>
+ * <updated>2016-01-02T03:04:05Z</updated>
+ * <id>tag:juneau.apache.org</id>
+ * <subtitle type='html'>Describes <em>stuff</em> about Juneau</subtitle>
+ * <generator version='1.0' uri='http://juneau.apache.org'>Juneau</generator>
+ * <entry>
+ * <link rel='alternate' href='http://juneau.apache.org/juneau.atom' type='text/html'/>
+ * <link rel='enclosure' href='http://juneau.apache.org/audio/juneau_podcast.mp3' type='audio/mpeg' length='1337'/>
+ * <author>
+ * <uri>http://juneau.apache.org</uri>
+ * <email>janesmith@apache.org</email>
+ * <name>Jane Smith</name>
+ * </author>
+ * <contributor>
+ * <name>John Smith</name>
+ * </contributor>
+ * <title>Juneau ATOM specification snapshot</title>
+ * <updated>2016-01-02T03:04:05Z</updated>
+ * <id>tag:juneau.sample.com,2013:1.2345</id>
+ * <published>2016-01-02T03:04:05Z</published>
+ * <content lang='en' base='http://www.apache.org/' type='xhtml'><div><p><i>[Update: Juneau supports ATOM.]</i></p></div></content>
+ * </entry>
+ * </feed>
+ */
+ // Create a serializer with readable output, no namespaces yet.
+ XmlSerializer ns = XmlSerializer.create().sq().ws().build();
- // Serialize to ATOM/XML
- atomXml = ns.serialize(feed);
- }
+ // Serialize to ATOM/XML
+ atomXml = ns.serialize(feed);
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/html/HtmlComplexExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/html/HtmlComplexExample.java
index c9cd8e0..4575304 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/html/HtmlComplexExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/html/HtmlComplexExample.java
@@ -31,54 +31,54 @@ import java.util.List;
*/
public class HtmlComplexExample {
- /**
- * Serializing PojoComplex bean into Html type
- * and Deserialize back to PojoComplex instance type.
- *
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
- // Juneau provides static constants with the most commonly used configurations
- // Get a reference to a serializer - converting POJO to flat format
- /**
- * Produces
- * <table><tr><td>innerPojo</td><td><table><tr><td>name</td><td>name0</td></tr>
- * <tr><td>id</td><td>1.0</td></tr></table></td></tr><tr><td>values</td><td><table>
- * <tr><td>setOne</td><td><table _type="array"><tr><th>name</th><th>id</th></tr>
- * <tr><td>name1</td><td>1.1</td></tr><tr><td>name2</td><td>1.1</td></tr>
- * </table></td></tr><tr><td>setTwo</td><td><table _type="array"><tr><th>name
- * </th><th>id</th></tr><tr><td>name1</td><td>1.2</td></tr><tr><td>name2</td><td>1.2
- * </td></tr></table></td></tr></table></td></tr><tr><td>id</td><td>pojo</td></tr></table>
- */
- HtmlSerializer htmlSerializer = HtmlSerializer.DEFAULT;
- // Get a reference to a parser - converts that flat format back into the POJO
- HtmlParser htmlParser = HtmlParser.DEFAULT;
+ /**
+ * Serializing PojoComplex bean into Html type
+ * and Deserialize back to PojoComplex instance type.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ public static void main(String[] args) throws Exception {
+ // Juneau provides static constants with the most commonly used configurations
+ // Get a reference to a serializer - converting POJO to flat format
+ /**
+ * Produces
+ * <table><tr><td>innerPojo</td><td><table><tr><td>name</td><td>name0</td></tr>
+ * <tr><td>id</td><td>1.0</td></tr></table></td></tr><tr><td>values</td><td><table>
+ * <tr><td>setOne</td><td><table _type="array"><tr><th>name</th><th>id</th></tr>
+ * <tr><td>name1</td><td>1.1</td></tr><tr><td>name2</td><td>1.1</td></tr>
+ * </table></td></tr><tr><td>setTwo</td><td><table _type="array"><tr><th>name
+ * </th><th>id</th></tr><tr><td>name1</td><td>1.2</td></tr><tr><td>name2</td><td>1.2
+ * </td></tr></table></td></tr></table></td></tr><tr><td>id</td><td>pojo</td></tr></table>
+ */
+ HtmlSerializer htmlSerializer = HtmlSerializer.DEFAULT;
+ // Get a reference to a parser - converts that flat format back into the POJO
+ HtmlParser htmlParser = HtmlParser.DEFAULT;
- // Fill some data to a PojoComplex bean
- HashMap<String, List<Pojo>> values = new HashMap<>();
- ArrayList<Pojo> setOne = new ArrayList<>();
- setOne.add(new Pojo("1.1", "name1"));
- setOne.add(new Pojo("1.1", "name2"));
- ArrayList<Pojo> setTwo = new ArrayList<>();
- setTwo.add(new Pojo("1.2", "name1"));
- setTwo.add(new Pojo("1.2", "name2"));
- values.put("setOne", setOne);
- values.put("setTwo", setTwo);
- PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
+ // Fill some data to a PojoComplex bean
+ HashMap<String, List<Pojo>> values = new HashMap<>();
+ ArrayList<Pojo> setOne = new ArrayList<>();
+ setOne.add(new Pojo("1.1", "name1"));
+ setOne.add(new Pojo("1.1", "name2"));
+ ArrayList<Pojo> setTwo = new ArrayList<>();
+ setTwo.add(new Pojo("1.2", "name1"));
+ setTwo.add(new Pojo("1.2", "name2"));
+ values.put("setOne", setOne);
+ values.put("setTwo", setTwo);
+ PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
- String flat = htmlSerializer.serialize(pojoc);
+ String flat = htmlSerializer.serialize(pojoc);
- // Print out the created POJO in JSON format.
- System.out.println(flat);
+ // Print out the created POJO in JSON format.
+ System.out.println(flat);
- PojoComplex parse = htmlParser.parse(flat, PojoComplex.class);
+ PojoComplex parse = htmlParser.parse(flat, PojoComplex.class);
- assert parse.getId().equals(pojoc.getId());
- assert parse.getInnerPojo().getName().equals(pojoc.getInnerPojo().getName());
- assert parse.getInnerPojo().getId().equals(pojoc.getInnerPojo().getId());
+ assert parse.getId().equals(pojoc.getId());
+ assert parse.getInnerPojo().getName().equals(pojoc.getInnerPojo().getName());
+ assert parse.getInnerPojo().getId().equals(pojoc.getInnerPojo().getId());
- // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo
- // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
- }
+ // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo
+ // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/html/HtmlSimpleExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/html/HtmlSimpleExample.java
index 6abfbad..b7d65ac 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/html/HtmlSimpleExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/html/HtmlSimpleExample.java
@@ -26,43 +26,43 @@ import org.apache.juneau.html.HtmlSerializer;
* </ul>
*/
public class HtmlSimpleExample {
- /**
- * Serializing Pojo bean into Html format
- * and Deserialize back to Pojo instance type.
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception{
- // Juneau provides static constants with the most commonly used configurations
- // Get a reference to a serializer - converting POJO to flat format
- // Produces
- // <table><tr><td>name</td><td>name</td></tr><tr><td>id</td><td>id</td></tr></table>
- HtmlSerializer htmlSerializer = HtmlSerializer.DEFAULT;
- // Get a reference to a parser - converts that flat format back into the POJO
- HtmlParser htmlParser = HtmlParser.DEFAULT;
+ /**
+ * Serializing Pojo bean into Html format and Deserialize back to Pojo instance type.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ public static void main(String[] args) throws Exception{
+ // Juneau provides static constants with the most commonly used configurations
+ // Get a reference to a serializer - converting POJO to flat format
+ // Produces
+ // <table><tr><td>name</td><td>name</td></tr><tr><td>id</td><td>id</td></tr></table>
+ HtmlSerializer htmlSerializer = HtmlSerializer.DEFAULT;
+ // Get a reference to a parser - converts that flat format back into the POJO
+ HtmlParser htmlParser = HtmlParser.DEFAULT;
- Pojo pojo = new Pojo("id","name");
+ Pojo pojo = new Pojo("id","name");
- String flat = htmlSerializer.serialize(pojo);
+ String flat = htmlSerializer.serialize(pojo);
- // Print out the created POJO in JSON format.
- System.out.println(flat);
+ // Print out the created POJO in JSON format.
+ System.out.println(flat);
- Pojo parse = htmlParser.parse(flat, Pojo.class);
+ Pojo parse = htmlParser.parse(flat, Pojo.class);
- assert parse.getId().equals(pojo.getId());
- assert parse.getName().equals(pojo.getName());
+ assert parse.getId().equals(pojo.getId());
+ assert parse.getName().equals(pojo.getName());
- /**
- * Produces
- * <html><head><style></style><script></script></head><body><section><article><div class="outerdata">
- * <div class="data" id="data"><table><tr><td>name</td><td>name</td></tr><tr><td>id</td><td>id</td></tr>
- * </table></div></div></article></section></body></html>
- */
- String docSerialized = HtmlDocSerializer.DEFAULT.serialize(pojo);
- System.out.println(docSerialized);
+ /**
+ * Produces
+ * <html><head><style></style><script></script></head><body><section><article><div class="outerdata">
+ * <div class="data" id="data"><table><tr><td>name</td><td>name</td></tr><tr><td>id</td><td>id</td></tr>
+ * </table></div></div></article></section></body></html>
+ */
+ String docSerialized = HtmlDocSerializer.DEFAULT.serialize(pojo);
+ System.out.println(docSerialized);
- // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo
- // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
- }
+ // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo
+ // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonComplexExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonComplexExample.java
index 5ea80f1..10ea515 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonComplexExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonComplexExample.java
@@ -29,49 +29,51 @@ import java.util.List;
* </ul>
*/
public class JsonComplexExample {
- /**
- * Serializing PojoComplex bean into Json type
- * and Deserialize back to PojoComplex instance type.
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception{
- // Juneau provides static constants with the most commonly used configurations
- // Get a reference to a serializer - converting POJO to flat format
- /**
- * Produces
- * {"innerPojo":{"name":"name0","id":"1.0"},
- * "values":{"setOne":[{"name":"name1","id":"1.1"},{"name":"name2","id":"1.1"}],
- * "setTwo":[{"name":"name1","id":"1.2"},{"name":"name2","id":"1.2"}]},"id":"pojo"}
- */
- JsonSerializer jsonSerializer = JsonSerializer.DEFAULT;
- // Get a reference to a parser - converts that flat format back into the POJO
- JsonParser jsonParser = JsonParser.DEFAULT;
- // Fill some data to a PojoComplex bean
- HashMap<String, List<Pojo>> values = new HashMap<>();
- ArrayList<Pojo> setOne = new ArrayList<>();
- setOne.add(new Pojo("1.1", "name1"));
- setOne.add(new Pojo("1.1", "name2"));
- ArrayList<Pojo> setTwo = new ArrayList<>();
- setTwo.add(new Pojo("1.2", "name1"));
- setTwo.add(new Pojo("1.2", "name2"));
- values.put("setOne", setOne);
- values.put("setTwo", setTwo);
- PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
+ /**
+ * Serializing PojoComplex bean into Json type
+ * and Deserialize back to PojoComplex instance type.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ public static void main(String[] args) throws Exception{
+ // Juneau provides static constants with the most commonly used configurations
+ // Get a reference to a serializer - converting POJO to flat format
+ /**
+ * Produces
+ * {"innerPojo":{"name":"name0","id":"1.0"},
+ * "values":{"setOne":[{"name":"name1","id":"1.1"},{"name":"name2","id":"1.1"}],
+ * "setTwo":[{"name":"name1","id":"1.2"},{"name":"name2","id":"1.2"}]},"id":"pojo"}
+ */
+ JsonSerializer jsonSerializer = JsonSerializer.DEFAULT;
+ // Get a reference to a parser - converts that flat format back into the POJO
+ JsonParser jsonParser = JsonParser.DEFAULT;
- String flat = jsonSerializer.serialize(pojoc);
+ // Fill some data to a PojoComplex bean
+ HashMap<String, List<Pojo>> values = new HashMap<>();
+ ArrayList<Pojo> setOne = new ArrayList<>();
+ setOne.add(new Pojo("1.1", "name1"));
+ setOne.add(new Pojo("1.1", "name2"));
+ ArrayList<Pojo> setTwo = new ArrayList<>();
+ setTwo.add(new Pojo("1.2", "name1"));
+ setTwo.add(new Pojo("1.2", "name2"));
+ values.put("setOne", setOne);
+ values.put("setTwo", setTwo);
+ PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
- // Print out the created POJO in JSON format.
- System.out.println(flat);
+ String flat = jsonSerializer.serialize(pojoc);
- PojoComplex parse = jsonParser.parse(flat, PojoComplex.class);
+ // Print out the created POJO in JSON format.
+ System.out.println(flat);
- assert parse.getId().equals(pojoc.getId());
- assert parse.getInnerPojo().getName().equals(pojoc.getInnerPojo().getName());
- assert parse.getInnerPojo().getId().equals(pojoc.getInnerPojo().getId());
+ PojoComplex parse = jsonParser.parse(flat, PojoComplex.class);
- // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo
- // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
- }
+ assert parse.getId().equals(pojoc.getId());
+ assert parse.getInnerPojo().getName().equals(pojoc.getInnerPojo().getName());
+ assert parse.getInnerPojo().getId().equals(pojoc.getInnerPojo().getId());
+
+ // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo
+ // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonConfigurationExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonConfigurationExample.java
index d753446..37da7a3 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonConfigurationExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonConfigurationExample.java
@@ -35,8 +35,9 @@ public class JsonConfigurationExample {
/**
* Examples on Json Serializers configured using properties
* defined in JsonSerializer class
- * @param args
- * @throws Exception
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
*/
public static void main(String[] args) throws Exception {
Pojo aPojo = new Pojo("a","</pojo>");
@@ -68,12 +69,12 @@ public class JsonConfigurationExample {
* }
*/
String configurableJson =JsonSerializer
- .create() // Create a JsonSerializerBuilder
- .simple() // Simple mode
- .ws() // Use whitespace
- .sq() // Use single quotes
- .build()
- .serialize(aPojo); // Create a JsonSerializer
+ .create() // Create a JsonSerializerBuilder
+ .simple() // Simple mode
+ .ws() // Use whitespace
+ .sq() // Use single quotes
+ .build()
+ .serialize(aPojo); // Create a JsonSerializer
System.out.println(configurableJson);
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonSimpleExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonSimpleExample.java
index 7dd07cb..e66e13e 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonSimpleExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/json/JsonSimpleExample.java
@@ -37,10 +37,10 @@ import java.util.Map;
public class JsonSimpleExample {
/**
- * Serializing Pojo bean into Json format
- * and Deserialize back to Pojo instance type.
- * @param args
- * @throws Exception
+ * Serializing Pojo bean into Json format and Deserialize back to Pojo instance type.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
*/
@SuppressWarnings({ "unused", "rawtypes" })
public static void main(String[] args) throws Exception{
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/oapi/OapiExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/oapi/OapiExample.java
index 841cccf..5e42965 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/oapi/OapiExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/oapi/OapiExample.java
@@ -31,55 +31,56 @@ import org.apache.juneau.oapi.OpenApiSerializer;
public class OapiExample {
- /**
- * Get a reference to a parser and usage of oapiserializer.
- * @param args
- * @throws Exception
- */
- @SuppressWarnings("unused")
+ /**
+ * Get a reference to a parser and usage of oapiserializer.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ @SuppressWarnings("unused")
public static void main(String[] args) throws Exception{
- OpenApiSerializer oapiSerializer = OpenApiSerializer.DEFAULT;
+ OpenApiSerializer oapiSerializer = OpenApiSerializer.DEFAULT;
- OpenApiParser oapiParser = OpenApiParser.DEFAULT;
+ OpenApiParser oapiParser = OpenApiParser.DEFAULT;
- Pojo pojo = new Pojo("id","name");
+ Pojo pojo = new Pojo("id","name");
- String flat = oapiSerializer.serialize(pojo);
- // Print out the created POJO in OpenAPI format.
+ String flat = oapiSerializer.serialize(pojo);
+ // Print out the created POJO in OpenAPI format.
- Pojo parse = oapiParser.parse(flat, Pojo.class);
+ Pojo parse = oapiParser.parse(flat, Pojo.class);
- assert parse.getId().equals(pojo.getId());
- assert parse.getName().equals(pojo.getName());
+ assert parse.getId().equals(pojo.getId());
+ assert parse.getName().equals(pojo.getName());
- //Http part schmea
- HttpPartSchema schema = HttpPartSchema
- .create("array")
- .collectionFormat("pipes")
- .items(
- HttpPartSchema
- .create("array")
- .collectionFormat("csv")
- .items(
- HttpPartSchema.create("integer","int64")
- )
- )
- .build();
- Object value = new long[][]{{1,2,3},{4,5,6},{7,8,9}};
- String output = OpenApiSerializer.DEFAULT.serialize(HttpPartType.HEADER, schema, value);
+ //Http part schmea
+ HttpPartSchema schema = HttpPartSchema
+ .create("array")
+ .collectionFormat("pipes")
+ .items(
+ HttpPartSchema
+ .create("array")
+ .collectionFormat("csv")
+ .items(
+ HttpPartSchema.create("integer","int64")
+ )
+ )
+ .build();
+ Object value = new long[][]{{1,2,3},{4,5,6},{7,8,9}};
+ String output = OpenApiSerializer.DEFAULT.serialize(HttpPartType.HEADER, schema, value);
- HttpPartSchema schemab = HttpPartSchema.create().type("string").build();
- // Convert POJO to BASE64-encoded string.
- HttpPartSerializer s = OpenApiSerializer.DEFAULT;
- String httpPart = s.serialize(schemab, pojo);
- System.out.println(httpPart);
+ HttpPartSchema schemab = HttpPartSchema.create().type("string").build();
+ // Convert POJO to BASE64-encoded string.
+ HttpPartSerializer s = OpenApiSerializer.DEFAULT;
+ String httpPart = s.serialize(schemab, pojo);
+ System.out.println(httpPart);
- // Convert BASE64-encoded string back into a POJO.
- HttpPartParser p = OpenApiParser.DEFAULT;
- pojo = p.parse(schemab, httpPart, Pojo.class);
+ // Convert BASE64-encoded string back into a POJO.
+ HttpPartParser p = OpenApiParser.DEFAULT;
+ pojo = p.parse(schemab, httpPart, Pojo.class);
- // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo
- // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
- }
+ // The object above can be parsed thanks to the @BeanConstructor(properties = id,name) annotation on Pojo
+ // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/Pojo.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/Pojo.java
index d30621c..e516c6c 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/Pojo.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/Pojo.java
@@ -33,16 +33,26 @@ public class Pojo {
private final String id;
private final String name;
+ /**
+ * @param id The <bc>id</bc> property value.
+ * @param name The <bc>name</bc> property value.
+ */
@BeanConstructor
public Pojo(@Name("id") String id, @Name("name") String name) {
this.id = id;
this.name = name;
}
+ /**
+ * @return The <bc>id</bc> property value.
+ */
public String getId() {
return id;
}
+ /**
+ * @return The <bc>name</bc> property value.
+ */
public String getName() {
return name;
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/PojoComplex.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/PojoComplex.java
index 869afd5..21e10d8 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/PojoComplex.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/pojo/PojoComplex.java
@@ -30,13 +30,12 @@ public class PojoComplex {
private final Pojo innerPojo;
private final HashMap<String, List<Pojo>> values;
-
/**
- * TODO
+ * Constructor.
*
- * @param id
- * @param innerPojo
- * @param values
+ * @param id The <bc>id</bc> property value.
+ * @param innerPojo The <bc>innerPojo</bc> property value.
+ * @param values The <bc>values</bc> property value.
*/
@BeanConstructor
public PojoComplex(@Name("id") String id, @Name("innerPojo") Pojo innerPojo, @Name("values") HashMap<String, List<Pojo>> values) {
@@ -45,7 +44,6 @@ public class PojoComplex {
this.values = values;
}
-
/**
* Bean property getter: <property>id</property>.
*
@@ -55,7 +53,6 @@ public class PojoComplex {
return id;
}
-
/**
* Bean property getter: <property>innerPojo</property>.
*
@@ -65,7 +62,6 @@ public class PojoComplex {
return innerPojo;
}
-
/**
* Bean property getter: <property>values</property>.
*
@@ -74,6 +70,4 @@ public class PojoComplex {
public HashMap<String,List<Pojo>> getValues() {
return values;
}
-
-
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfComplexExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfComplexExample.java
index 4444dd7..98abd03 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfComplexExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfComplexExample.java
@@ -31,79 +31,79 @@ import java.util.List;
*/
public class RdfComplexExample {
- /**
- * Serializing PojoComplex bean into RDF XML format.
- *
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
+ /**
+ * Serializing PojoComplex bean into RDF XML format.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ public static void main(String[] args) throws Exception {
- // Fill some data to a PojoComplex bean
- HashMap<String, List<Pojo>> values = new HashMap<>();
- ArrayList<Pojo> setOne = new ArrayList<>();
- setOne.add(new Pojo("1.1", "name1"));
- setOne.add(new Pojo("1.1", "name2"));
- ArrayList<Pojo> setTwo = new ArrayList<>();
- setTwo.add(new Pojo("1.2", "name1"));
- setTwo.add(new Pojo("1.2", "name2"));
- values.put("setOne", setOne);
- values.put("setTwo", setTwo);
- PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
+ // Fill some data to a PojoComplex bean
+ HashMap<String, List<Pojo>> values = new HashMap<>();
+ ArrayList<Pojo> setOne = new ArrayList<>();
+ setOne.add(new Pojo("1.1", "name1"));
+ setOne.add(new Pojo("1.1", "name2"));
+ ArrayList<Pojo> setTwo = new ArrayList<>();
+ setTwo.add(new Pojo("1.2", "name1"));
+ setTwo.add(new Pojo("1.2", "name2"));
+ values.put("setOne", setOne);
+ values.put("setTwo", setTwo);
+ PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
- // this creates an RDF serializer with the default XML structure
- /**Produces
- * <rdf:RDF
- * xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- * xmlns:j="http://www.apache.org/juneau/"
- * xmlns:jp="http://www.apache.org/juneaubp/" >
- * <rdf:Description rdf:nodeID="A0">
- * <jp:name>name1</jp:name>
- * <jp:id>1.1</jp:id>
- * </rdf:Description>
- * <rdf:Description rdf:nodeID="A1">
- * <jp:innerPojo rdf:nodeID="A2"/>
- * <jp:values rdf:nodeID="A3"/>
- * <jp:id>pojo</jp:id>
- * </rdf:Description>
- * <rdf:Description rdf:nodeID="A3">
- * <jp:setOne rdf:nodeID="A4"/>
- * <jp:setTwo rdf:nodeID="A5"/>
- * </rdf:Description>
- * <rdf:Description rdf:nodeID="A6">
- * <jp:name>name2</jp:name>
- * <jp:id>1.1</jp:id>
- * </rdf:Description>
- * <rdf:Description rdf:nodeID="A2">
- * <jp:name>name0</jp:name>
- * <jp:id>1.0</jp:id>
- * </rdf:Description>
- * <rdf:Description rdf:nodeID="A7">
- * <jp:name>name2</jp:name>
- * <jp:id>1.2</jp:id>
- * </rdf:Description>
- * <rdf:Description rdf:nodeID="A4">
- * <rdf:_2 rdf:nodeID="A6"/>
- * <rdf:_1 rdf:nodeID="A0"/>
- * <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"/>
- * </rdf:Description>
- * <rdf:Description rdf:nodeID="A5">
- * <rdf:_2 rdf:nodeID="A7"/>
- * <rdf:_1 rdf:nodeID="A8"/>
- * <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"/>
- * </rdf:Description>
- * <rdf:Description rdf:nodeID="A8">
- * <jp:name>name1</jp:name>
- * <jp:id>1.2</jp:id>
- * </rdf:Description>
- * </rdf:RDF>
- */
- RdfSerializer rdfSerializer = RdfXmlSerializer.DEFAULT;
- // This will show the final output from the bean
- System.out.println(rdfSerializer.serialize(pojoc));
+ // this creates an RDF serializer with the default XML structure
+ /**Produces
+ * <rdf:RDF
+ * xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ * xmlns:j="http://www.apache.org/juneau/"
+ * xmlns:jp="http://www.apache.org/juneaubp/" >
+ * <rdf:Description rdf:nodeID="A0">
+ * <jp:name>name1</jp:name>
+ * <jp:id>1.1</jp:id>
+ * </rdf:Description>
+ * <rdf:Description rdf:nodeID="A1">
+ * <jp:innerPojo rdf:nodeID="A2"/>
+ * <jp:values rdf:nodeID="A3"/>
+ * <jp:id>pojo</jp:id>
+ * </rdf:Description>
+ * <rdf:Description rdf:nodeID="A3">
+ * <jp:setOne rdf:nodeID="A4"/>
+ * <jp:setTwo rdf:nodeID="A5"/>
+ * </rdf:Description>
+ * <rdf:Description rdf:nodeID="A6">
+ * <jp:name>name2</jp:name>
+ * <jp:id>1.1</jp:id>
+ * </rdf:Description>
+ * <rdf:Description rdf:nodeID="A2">
+ * <jp:name>name0</jp:name>
+ * <jp:id>1.0</jp:id>
+ * </rdf:Description>
+ * <rdf:Description rdf:nodeID="A7">
+ * <jp:name>name2</jp:name>
+ * <jp:id>1.2</jp:id>
+ * </rdf:Description>
+ * <rdf:Description rdf:nodeID="A4">
+ * <rdf:_2 rdf:nodeID="A6"/>
+ * <rdf:_1 rdf:nodeID="A0"/>
+ * <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"/>
+ * </rdf:Description>
+ * <rdf:Description rdf:nodeID="A5">
+ * <rdf:_2 rdf:nodeID="A7"/>
+ * <rdf:_1 rdf:nodeID="A8"/>
+ * <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"/>
+ * </rdf:Description>
+ * <rdf:Description rdf:nodeID="A8">
+ * <jp:name>name1</jp:name>
+ * <jp:id>1.2</jp:id>
+ * </rdf:Description>
+ * </rdf:RDF>
+ */
+ RdfSerializer rdfSerializer = RdfXmlSerializer.DEFAULT;
+ // This will show the final output from the bean
+ System.out.println(rdfSerializer.serialize(pojoc));
- //Usage of RdfXmlAbbrevSerializer.
- String rdfXml = RdfXmlAbbrevSerializer.DEFAULT.serialize(pojoc);
- System.out.println(rdfXml);
- }
+ //Usage of RdfXmlAbbrevSerializer.
+ String rdfXml = RdfXmlAbbrevSerializer.DEFAULT.serialize(pojoc);
+ System.out.println(rdfXml);
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfExample.java
index a923653..7369dc7 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/rdf/RdfExample.java
@@ -33,8 +33,9 @@ public class RdfExample {
/**
* Serializing Pojo bean into RDF XML format.
- * @param args
- * @throws Exception
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
*/
public static void main(String[] args) throws Exception {
Pojo pojo = new Pojo("rdf","This is RDF format.");
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/svl/SvlExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/svl/SvlExample.java
index 2775a18..676dd95 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/svl/SvlExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/svl/SvlExample.java
@@ -25,9 +25,9 @@ import org.apache.juneau.svl.*;
public class SvlExample {
/**
- * TODO
+ * Main method.
*
- * @param args
+ * @param args Unused.
*/
public static void main(String[] args) {
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/uon/UONComplexExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/uon/UONComplexExample.java
index f51fb2a..b95be88 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/uon/UONComplexExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/uon/UONComplexExample.java
@@ -36,39 +36,39 @@ import java.util.List;
* </ul>
*/
public class UONComplexExample {
- /**
- * Serializing PojoComplex bean into UON format.
- *
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
+ /**
+ * Serializing PojoComplex bean into UON format.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ public static void main(String[] args) throws Exception {
- // Fill some data to a PojoComplex bean
- HashMap<String, List<Pojo>> values = new HashMap<>();
- ArrayList<Pojo> setOne = new ArrayList<>();
- setOne.add(new Pojo("1.1", "name1"));
- setOne.add(new Pojo("1.1", "name2"));
- ArrayList<Pojo> setTwo = new ArrayList<>();
- setTwo.add(new Pojo("1.2", "name1"));
- setTwo.add(new Pojo("1.2", "name2"));
- values.put("setOne", setOne);
- values.put("setTwo", setTwo);
- PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
+ // Fill some data to a PojoComplex bean
+ HashMap<String, List<Pojo>> values = new HashMap<>();
+ ArrayList<Pojo> setOne = new ArrayList<>();
+ setOne.add(new Pojo("1.1", "name1"));
+ setOne.add(new Pojo("1.1", "name2"));
+ ArrayList<Pojo> setTwo = new ArrayList<>();
+ setTwo.add(new Pojo("1.2", "name1"));
+ setTwo.add(new Pojo("1.2", "name2"));
+ values.put("setOne", setOne);
+ values.put("setTwo", setTwo);
+ PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
- // this creates an RDF serializer with the default XML structure
- /**Produces
- * (innerPojo=(name=name0,id='1.0'),
- * values=(setOne=@((name=name1,id='1.1'),(name=name2,id='1.1')),
- * setTwo=@((name=name1,id='1.2'),(name=name2,id='1.2'))),id=pojo)
- */
- UonSerializer uonSerializer = UonSerializer.DEFAULT;
- // This will show the final output from the bean
- System.out.println(uonSerializer.serialize(pojoc));
+ // this creates an RDF serializer with the default XML structure
+ /**Produces
+ * (innerPojo=(name=name0,id='1.0'),
+ * values=(setOne=@((name=name1,id='1.1'),(name=name2,id='1.1')),
+ * setTwo=@((name=name1,id='1.2'),(name=name2,id='1.2'))),id=pojo)
+ */
+ UonSerializer uonSerializer = UonSerializer.DEFAULT;
+ // This will show the final output from the bean
+ System.out.println(uonSerializer.serialize(pojoc));
- PojoComplex obj = UonParser.DEFAULT.parse(uonSerializer.serialize(pojoc), PojoComplex.class);
+ PojoComplex obj = UonParser.DEFAULT.parse(uonSerializer.serialize(pojoc), PojoComplex.class);
- assert obj.getId().equals(pojoc.getId());
+ assert obj.getId().equals(pojoc.getId());
- }
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/uon/UONExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/uon/UONExample.java
index 1d3e84e..404e3c4 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/uon/UONExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/uon/UONExample.java
@@ -19,8 +19,6 @@
package org.apache.juneau.examples.core.uon;
import org.apache.juneau.examples.core.pojo.Pojo;
-import org.apache.juneau.parser.ParseException;
-import org.apache.juneau.serializer.SerializeException;
import org.apache.juneau.uon.UonParser;
import org.apache.juneau.uon.UonSerializer;
@@ -31,35 +29,36 @@ import org.apache.juneau.uon.UonSerializer;
* <ul class='doctree'>
* <li class='extlink'>{@source}
* </ul>
-*/
+ */
public class UONExample {
- /**
- * Serializing SimplePojo bean into UON type
- * and Deserialize back to Pojo instance type.
- * @param args
- * @throws SerializeException
- * @throws ParseException
- */
- public static void main(String[] args) throws SerializeException, ParseException {
- // Fill some data to a Pojo bean
- Pojo pojo = new Pojo("id","name");
+ /**
+ * Serializing SimplePojo bean into UON type
+ * and Deserialize back to Pojo instance type.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ public static void main(String[] args) throws Exception {
+
+ // Fill some data to a Pojo bean
+ Pojo pojo = new Pojo("id","name");
- /**
- * Produces
- * (name=name,id=id)
- */
- String serial = UonSerializer.DEFAULT.serialize(pojo);
- System.out.println(serial);
+ /**
+ * Produces
+ * (name=name,id=id)
+ */
+ String serial = UonSerializer.DEFAULT.serialize(pojo);
+ System.out.println(serial);
- // Deserialize back to Pojo instance
- Pojo obj = UonParser.DEFAULT.parse(serial, Pojo.class);
+ // Deserialize back to Pojo instance
+ Pojo obj = UonParser.DEFAULT.parse(serial, Pojo.class);
- assert obj.getId().equals(pojo.getId());
- assert obj.getName().equals(pojo.getName());
+ assert obj.getId().equals(pojo.getId());
+ assert obj.getName().equals(pojo.getName());
- // The object above can be parsed thanks to the @BeanConstructor annotation on PojoComplex
- // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
+ // The object above can be parsed thanks to the @BeanConstructor annotation on PojoComplex
+ // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
- }
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlComplexExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlComplexExample.java
index 9570435..f45cdf2 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlComplexExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlComplexExample.java
@@ -15,8 +15,6 @@ package org.apache.juneau.examples.core.xml;
import java.util.*;
import org.apache.juneau.examples.core.pojo.*;
-import org.apache.juneau.parser.*;
-import org.apache.juneau.serializer.*;
import org.apache.juneau.xml.*;
/**
@@ -28,14 +26,15 @@ import org.apache.juneau.xml.*;
* </ul>
*/
public class XmlComplexExample {
+
/**
* Serializing PojoComplex bean into human readable XML
* and Deserialize back to PojoComplex instance type.
- * @param args
- * @throws SerializeException
- * @throws ParseException
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
*/
- public static void main(String[] args) throws SerializeException, ParseException {
+ public static void main(String[] args) throws Exception {
// Fill some data to a PojoComplex bean
HashMap<String, List<Pojo>> values = new HashMap<>();
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlConfigurationExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlConfigurationExample.java
index 8fbca0a..d54a152 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlConfigurationExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlConfigurationExample.java
@@ -29,59 +29,60 @@ import java.util.List;
*/
public class XmlConfigurationExample {
- /**
- * Examples on XML Serializers configured using properties
- * defined in XmlSerializer class.
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
+ /**
+ * Examples on XML Serializers configured using properties
+ * defined in XmlSerializer class.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ public static void main(String[] args) throws Exception {
- Pojo aPojo = new Pojo("a","<pojo>");
+ Pojo aPojo = new Pojo("a","<pojo>");
- /**
- * Xml Serializers can be configured using properties defined in XmlSerializer.
- * Produces
- * <object>
- * <name><pojo></name>
- * <id>a</id>
- * </object>
- */
- String withWhitespace = XmlSerializer.create().ws().build().serialize(aPojo);
- // the output will be padded with spaces after format characters.
- System.out.println(withWhitespace);
+ /**
+ * Xml Serializers can be configured using properties defined in XmlSerializer.
+ * Produces
+ * <object>
+ * <name><pojo></name>
+ * <id>a</id>
+ * </object>
+ */
+ String withWhitespace = XmlSerializer.create().ws().build().serialize(aPojo);
+ // the output will be padded with spaces after format characters.
+ System.out.println(withWhitespace);
- HashMap<String, List<Pojo>> values = new HashMap<>();
- PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
+ HashMap<String, List<Pojo>> values = new HashMap<>();
+ PojoComplex pojoc = new PojoComplex("pojo", new Pojo("1.0", "name0"), values);
- //Produces
- //<object><innerPojo><name>name0</name><id>1.0</id></innerPojo><id>pojo</id></object>
- String mapescaped = XmlSerializer.create().trimEmptyMaps(true).build().serialize(pojoc);
- // the output will have trimmed Empty maps.
- System.out.println(mapescaped);
+ //Produces
+ //<object><innerPojo><name>name0</name><id>1.0</id></innerPojo><id>pojo</id></object>
+ String mapescaped = XmlSerializer.create().trimEmptyMaps(true).build().serialize(pojoc);
+ // the output will have trimmed Empty maps.
+ System.out.println(mapescaped);
- //Produces
- //<object xmlns="http://www.apache.org/2013/Juneau"><name><pojo></name><id>a</id></object>
- String nspaceToRoot = XmlSerializer.create().ns().addNamespaceUrisToRoot(true).build().serialize(aPojo);
- // the output will add default name space to the xml document root.
- System.out.println(nspaceToRoot);
+ //Produces
+ //<object xmlns="http://www.apache.org/2013/Juneau"><name><pojo></name><id>a</id></object>
+ String nspaceToRoot = XmlSerializer.create().ns().addNamespaceUrisToRoot(true).build().serialize(aPojo);
+ // the output will add default name space to the xml document root.
+ System.out.println(nspaceToRoot);
- Pojo nPojo = new Pojo("a",null);
+ Pojo nPojo = new Pojo("a",null);
- //Produces
- //<object><id>a</id></object>
- String nullescaped = XmlSerializer.create().trimNullProperties(true).build().serialize(nPojo);
- // the output will have trimmed null properties.
- System.out.println(nullescaped);
+ //Produces
+ //<object><id>a</id></object>
+ String nullescaped = XmlSerializer.create().trimNullProperties(true).build().serialize(nPojo);
+ // the output will have trimmed null properties.
+ System.out.println(nullescaped);
- //Produces
- //<object xmlns="http://www.pierobon.org/iis/review1.htm.html#one"><name><pojo></name><id>a</id></object>
- String dNamsSpace = XmlSerializer.create().enableNamespaces(true).defaultNamespace("http://www.pierobon.org" +
- "/iis/review1.htm.html#one").autoDetectNamespaces(true).addNamespaceUrisToRoot(true).build()
- .serialize(aPojo);
- // the output will have new default namespace added.
- System.out.println(dNamsSpace);
+ //Produces
+ //<object xmlns="http://www.pierobon.org/iis/review1.htm.html#one"><name><pojo></name><id>a</id></object>
+ String dNamsSpace = XmlSerializer.create().enableNamespaces(true).defaultNamespace("http://www.pierobon.org" +
+ "/iis/review1.htm.html#one").autoDetectNamespaces(true).addNamespaceUrisToRoot(true).build()
+ .serialize(aPojo);
+ // the output will have new default namespace added.
+ System.out.println(dNamsSpace);
- }
+ }
}
diff --git a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlSimpleExample.java b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlSimpleExample.java
index 63d91e0..e240a43 100644
--- a/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlSimpleExample.java
+++ b/juneau-examples/juneau-examples-core/src/main/java/org/apache/juneau/examples/core/xml/XmlSimpleExample.java
@@ -13,8 +13,6 @@
package org.apache.juneau.examples.core.xml;
import org.apache.juneau.examples.core.pojo.Pojo;
-import org.apache.juneau.parser.ParseException;
-import org.apache.juneau.serializer.SerializeException;
import org.apache.juneau.xml.XmlParser;
import org.apache.juneau.xml.XmlSerializer;
@@ -27,36 +25,37 @@ import org.apache.juneau.xml.XmlSerializer;
* </ul>
*/
public class XmlSimpleExample {
- /**
- * Serializing SimplePojo bean into human readable XML
- * and Deserialize back to Pojo instance type.
- * @param args
- * @throws SerializeException
- * @throws ParseException
- */
- public static void main(String[] args) throws SerializeException, ParseException {
-
- // Fill some data to a Pojo bean
- Pojo pojo = new Pojo("id","name");
-
- // Serialize to human readable XML and print
- /**
- * <object>
- * <name>name</name>
- * <id>id</id>
- * </object>
- */
- String serial = XmlSerializer.DEFAULT_SQ_READABLE.serialize(pojo);
- System.out.println(serial);
-
- // Deserialize back to Pojo instance
- Pojo obj = XmlParser.DEFAULT.parse(serial, Pojo.class);
-
- assert obj.getId().equals(pojo.getId());
- assert obj.getName().equals(pojo.getName());
-
- // The object above can be parsed thanks to the @BeanConstructor annotation on PojoComplex
- // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
-
- }
+
+ /**
+ * Serializing SimplePojo bean into human readable XML
+ * and Deserialize back to Pojo instance type.
+ *
+ * @param args Unused.
+ * @throws Exception Unused.
+ */
+ public static void main(String[] args) throws Exception {
+
+ // Fill some data to a Pojo bean
+ Pojo pojo = new Pojo("id","name");
+
+ // Serialize to human readable XML and print
+ /**
+ * <object>
+ * <name>name</name>
+ * <id>id</id>
+ * </object>
+ */
+ String serial = XmlSerializer.DEFAULT_SQ_READABLE.serialize(pojo);
+ System.out.println(serial);
+
+ // Deserialize back to Pojo instance
+ Pojo obj = XmlParser.DEFAULT.parse(serial, Pojo.class);
+
+ assert obj.getId().equals(pojo.getId());
+ assert obj.getName().equals(pojo.getName());
+
+ // The object above can be parsed thanks to the @BeanConstructor annotation on PojoComplex
+ // Using this approach, you can keep your POJOs immutable, and still serialize and deserialize them.
+
+ }
}
diff --git a/juneau-examples/juneau-examples-rest-jetty/src/main/java/org/apache/juneau/examples/rest/jetty/App.java b/juneau-examples/juneau-examples-rest-jetty/src/main/java/org/apache/juneau/examples/rest/jetty/App.java
index 3d8fd9f..02c45bf 100644
--- a/juneau-examples/juneau-examples-rest-jetty/src/main/java/org/apache/juneau/examples/rest/jetty/App.java
+++ b/juneau-examples/juneau-examples-rest-jetty/src/main/java/org/apache/juneau/examples/rest/jetty/App.java
@@ -37,7 +37,7 @@ public class App {
* Entry point method.
*
* @param args Command line arguments.
- * @throws Exception
+ * @throws Exception General exception occurred.
*/
public static void main(String[] args) throws Exception {
JettyMicroservice
diff --git a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
index 8d303df..a371f42 100644
--- a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
+++ b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
@@ -34,6 +34,10 @@ import org.springframework.web.filter.*;
@Controller
public class App {
+ /**
+ * Entry point method.
+ * @param args Command-line arguments.
+ */
public static void main(String[] args) {
new SpringApplicationBuilder(App.class)
.initializers(new JuneauRestInitializer(App.class))
@@ -43,7 +47,7 @@ public class App {
}
/**
- * Our root resource.
+ * @return Our root resource.
*/
@Bean @JuneauRestRoot
public RootResources getRootResources() {
@@ -53,6 +57,9 @@ public class App {
/**
* We want to be able to consume url-encoded-form-post bodies, but HiddenHttpMethodFilter triggers the HTTP
* body to be consumed. So disable it.
+ *
+ * @param filter The filter.
+ * @return Filter registration bean.
*/
@Bean
public FilterRegistrationBean<HiddenHttpMethodFilter> registration(HiddenHttpMethodFilter filter) {
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HelloWorldResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HelloWorldResource.java
index ba1a71c..3aa75b5 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HelloWorldResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HelloWorldResource.java
@@ -42,7 +42,11 @@ import org.apache.juneau.rest.annotation.*;
)
public class HelloWorldResource implements BasicRestConfig {
- /** GET request handler */
+ /**
+ * GET request handler.
+ *
+ * @return A simple Hello-World message.
+ */
@RestMethod(name=GET, path="/*", summary="Responds with \"Hello world!\"")
public String sayHello() {
return "Hello world!";
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
index 1d06ac2..e222e1c 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
@@ -80,7 +80,12 @@ import org.apache.juneau.transforms.*;
)
public class RequestEchoResource extends BasicRest {
- /** GET request handler */
+ /**
+ * GET request handler.
+ *
+ * @param req The HTTP servlet request.
+ * @return The same request to serialize as the response.
+ */
@RestMethod(name="*", path="/*", converters={Traversable.class,Queryable.class}, summary="Serializes the incoming HttpServletRequest object.")
public HttpServletRequest doGet(RestRequest req) {
// Just echo the request back as the response.
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/AtomFeedResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/AtomFeedResource.java
index fbc129f..72a7c9e 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/AtomFeedResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/AtomFeedResource.java
@@ -116,18 +116,29 @@ public class AtomFeedResource extends BasicRestServletJena {
}
}
+ /**
+ * Get the sample ATOM feed
+ *
+ * @return The sample ATOM feed.
+ */
@RestMethod(
summary="Get the sample ATOM feed"
)
- public Feed get() throws Exception {
+ public Feed get() {
return feed;
}
+ /**
+ * Overwrite the sample ATOM feed
+ *
+ * @param feed The new ATOM feed.
+ * @return The updated ATOM feed.
+ */
@RestMethod(
summary="Overwrite the sample ATOM feed",
description="Replaces the feed with the specified content, and then mirrors it as the response."
)
- public Feed put(@Body Feed feed) throws Exception {
+ public Feed put(@Body Feed feed) {
this.feed = feed;
return feed;
}
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/JsonSchemaResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/JsonSchemaResource.java
index 6d41be2..46ccf6e 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/JsonSchemaResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/JsonSchemaResource.java
@@ -91,18 +91,29 @@ public class JsonSchemaResource extends BasicRestServletJena {
}
}
+ /**
+ * Get the JSON-Schema document.
+ *
+ * @return The JSON-Schema document.
+ */
@RestMethod(
summary="Get the JSON-Schema document"
)
- public JsonSchema get() throws Exception {
+ public JsonSchema get() {
return schema;
}
+ /**
+ * Overwrite the JSON-Schema document
+ *
+ * @param schema The new schema document.
+ * @return The updated schema document.
+ */
@RestMethod(
summary="Overwrite the JSON-Schema document",
description="Replaces the schema document with the specified content, and then mirrors it as the response."
)
- public JsonSchema put(@Body JsonSchema schema) throws Exception {
+ public JsonSchema put(@Body JsonSchema schema) {
this.schema = schema;
return schema;
}
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/PredefinedLabelsResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/PredefinedLabelsResource.java
index 44988ee..1c207ec 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/PredefinedLabelsResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/PredefinedLabelsResource.java
@@ -58,21 +58,36 @@ import org.apache.juneau.rest.widget.*;
public class PredefinedLabelsResource extends BasicRestServlet {
private static final long serialVersionUID = 1L;
+ /**
+ * Returns the list of child resource descriptions.
+ *
+ * @return The list of child resource descriptions.
+ */
@RestMethod
- public ResourceDescriptions get() throws Exception {
+ public ResourceDescriptions get() {
return new ResourceDescriptions()
.append("beanDescription", "BeanDescription")
.append("htmlLinks", "HtmlLink")
;
}
+ /**
+ * Returns the bean description of the {@link Pet} class.
+ *
+ * @return The bean description of the {@link Pet} class.
+ */
@RestMethod
- public BeanDescription getBeanDescription() throws Exception {
+ public BeanDescription getBeanDescription() {
return new BeanDescription(Pet.class);
}
+ /**
+ * Returns a list of hyperlinked strings.
+ *
+ * @return A list of hyperlinked strings.
+ */
@RestMethod
- public LinkString[] getHtmlLinks() throws Exception {
+ public LinkString[] getHtmlLinks() {
return new LinkString[] {
new LinkString("apache", "http://apache.org"),
new LinkString("juneau", "http://juneau.apache.org")
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/AbstractPersistenceService.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/AbstractPersistenceService.java
index 5a7c6c4..eb2e558 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/AbstractPersistenceService.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/AbstractPersistenceService.java
@@ -30,12 +30,17 @@ public class AbstractPersistenceService {
private final EntityManagerFactory entityManagerFactory;
+ /**
+ * Constructor.
+ */
public AbstractPersistenceService() {
entityManagerFactory = Persistence.createEntityManagerFactory("test");
}
/**
* Retrieves an entity manager session.
+ *
+ * @return The entity manager session.
*/
protected EntityManager getEntityManager() {
return entityManagerFactory.createEntityManager();
@@ -161,9 +166,12 @@ public class AbstractPersistenceService {
/**
* Runs a JPA query and returns the results.
*
+ * @param <T> The bean type.
* @param em The entity manager to use to retrieve the beans.
* @param query The JPA query.
* @param t The bean type.
+ * @param searchArgs Optional search arguments.
+ * @return The results.
*/
protected <T> List<T> query(EntityManager em, String query, Class<T> t, SearchArgs searchArgs) {
TypedQuery<T> q = em.createQuery(query, t);
@@ -177,8 +185,11 @@ public class AbstractPersistenceService {
/**
* Same as {@link #query(EntityManager,String,Class,SearchArgs)} but uses a new entity manager.
*
+ * @param <T> The bean type.
* @param query The JPA query.
* @param t The bean type.
+ * @param searchArgs Optional search arguments.
+ * @return The results.
*/
protected <T> List<T> query(String query, Class<T> t, SearchArgs searchArgs) {
return query(getEntityManager(), query, t, searchArgs);
@@ -191,6 +202,7 @@ public class AbstractPersistenceService {
* @param query The JPA query.
* @param t The bean type.
* @param params The query parameter values.
+ * @return The results.
*/
protected <T> List<T> query(EntityManager em, String query, Class<T> t, Map<String,Object> params) {
TypedQuery<T> tq = em.createQuery(query, t);
@@ -206,6 +218,7 @@ public class AbstractPersistenceService {
* @param query The JPA query.
* @param t The bean type.
* @param params The query parameter values.
+ * @return The results.
*/
protected <T> List<T> query(String query, Class<T> t, Map<String,Object> params) {
return query(getEntityManager(), query, t, params);
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/ExpiresAfter.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/ExpiresAfter.java
index 9ebbae4..0485080 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/ExpiresAfter.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/ExpiresAfter.java
@@ -33,10 +33,21 @@ import org.apache.juneau.http.annotation.*;
)
public class ExpiresAfter {
private final Calendar c;
+
+ /**
+ * Constructor.
+ *
+ * @param d The header value.
+ */
public ExpiresAfter(Date d) {
this.c = new GregorianCalendar();
c.setTime(d);
}
+
+ /**
+ * The header value.
+ * @return The header value.
+ */
public Calendar toCalendar() {
return c;
}
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 8ed7f3c..e24d1da 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
@@ -22,6 +22,7 @@ import javax.persistence.*;
import org.apache.juneau.examples.rest.petstore.dto.*;
import org.apache.juneau.examples.rest.petstore.rest.*;
import org.apache.juneau.json.*;
+import org.apache.juneau.parser.ParseException;
import org.apache.juneau.rest.client.*;
import org.apache.juneau.utils.*;
@@ -47,9 +48,9 @@ public class PetStoreService extends AbstractPersistenceService {
*
* @param w Console output.
* @return This object (for method chaining).
- * @throws Exception
+ * @throws ParseException Malformed input encountered.
*/
- public PetStoreService initDirect(PrintWriter w) throws Exception {
+ public PetStoreService initDirect(PrintWriter w) throws ParseException {
EntityManager em = getEntityManager();
EntityTransaction et = em.getTransaction();
@@ -96,9 +97,10 @@ public class PetStoreService extends AbstractPersistenceService {
*
* @param w Console output.
* @return This object (for method chaining).
- * @throws Exception
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by client stream.
*/
- public PetStoreService initViaRest(PrintWriter w) throws Exception {
+ public PetStoreService initViaRest(PrintWriter w) throws ParseException, IOException {
JsonParser parser = JsonParser.create().ignoreUnknownBeanProperties().build();
String port = System.getProperty("juneau.serverPort", "8000");
@@ -139,74 +141,175 @@ public class PetStoreService extends AbstractPersistenceService {
// Service methods.
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * Returns the pet with the specified ID.
+ *
+ * @param id The pet ID.
+ * @return The pet with the specified ID. Never <jk>null</jk>.
+ * @throws IdNotFound If pet was not found.
+ */
public Pet getPet(long id) throws IdNotFound {
return find(Pet.class, id);
}
+ /**
+ * Returns the order with the specified ID.
+ *
+ * @param id The order ID.
+ * @return The order with the specified ID. Never <jk>null</jk>.
+ * @throws IdNotFound If order was not found.
+ */
public Order getOrder(long id) throws IdNotFound {
return find(Order.class, id);
}
+ /**
+ * Returns the user with the specified username.
+ *
+ * @param username The username.
+ * @return The user with the specified username. Never <jk>null</jk>.
+ * @throws InvalidUsername Username was not valid.
+ * @throws IdNotFound If order was not found.
+ */
public User getUser(String username) throws InvalidUsername, IdNotFound {
assertValidUsername(username);
return find(User.class, username);
}
+ /**
+ * Returns all pets in the database.
+ *
+ * @return All pets in the database.
+ */
public List<Pet> getPets() {
return query("select X from PetstorePet X", Pet.class, (SearchArgs)null);
}
+ /**
+ * Returns all orders in the database.
+ *
+ * @return All orders in the database.
+ */
public List<Order> getOrders() {
return query("select X from PetstoreOrder X", Order.class, (SearchArgs)null);
}
+ /**
+ * Returns all users in the database.
+ *
+ * @return All users in the database.
+ */
public List<User> getUsers() {
return query("select X from PetstoreUser X", User.class, (SearchArgs)null);
}
+ /**
+ * Creates a new pet in the database.
+ *
+ * @param c The pet input data.
+ * @return a new {@link Pet} object.
+ */
public Pet create(CreatePet c) {
return merge(new Pet().status(PetStatus.AVAILABLE).apply(c));
}
+ /**
+ * Creates a new order in the database.
+ *
+ * @param c The order input data.
+ * @return a new {@link Order} object.
+ */
public Order create(CreateOrder c) {
return merge(new Order().status(OrderStatus.PLACED).apply(c));
}
+ /**
+ * Creates a new user in the database.
+ *
+ * @param c The user input data.
+ * @return a new {@link User} object.
+ */
public User create(User c) {
return merge(new User().apply(c));
}
+ /**
+ * Updates a pet in the database.
+ *
+ * @param u The update information.
+ * @return The updated {@link Pet} object.
+ * @throws IdNotFound Pet was not found.
+ */
public Pet update(UpdatePet u) throws IdNotFound {
EntityManager em = getEntityManager();
return merge(em, find(em, Pet.class, u.getId()).apply(u));
}
+ /**
+ * Updates an order in the database.
+ *
+ * @param o The update information.
+ * @return The updated {@link Order} object.
+ * @throws IdNotFound Order was not found.
+ */
public Order update(Order o) throws IdNotFound {
EntityManager em = getEntityManager();
return merge(em, find(em, Order.class, o.getId()).apply(o));
}
+ /**
+ * Updates a user in the database.
+ *
+ * @param u The update information.
+ * @return The updated {@link User} object.
+ * @throws IdNotFound User was not found.
+ * @throws InvalidUsername The username was not valid.
+ */
public User update(User u) throws IdNotFound, InvalidUsername {
assertValidUsername(u.getUsername());
EntityManager em = getEntityManager();
return merge(em, find(em, User.class, u.getUsername()).apply(u));
}
+ /**
+ * Removes a pet from the database.
+ *
+ * @param id The pet ID.
+ * @throws IdNotFound Pet was not found.
+ */
public void removePet(long id) throws IdNotFound {
EntityManager em = getEntityManager();
remove(em, find(em, Pet.class, id));
}
+ /**
+ * Removes an order from the database.
+ *
+ * @param id The order ID.
+ * @throws IdNotFound Order was not found.
+ */
public void removeOrder(long id) throws IdNotFound {
EntityManager em = getEntityManager();
remove(em, find(em, Order.class, id));
}
+ /**
+ * Removes a user from the database.
+ *
+ * @param username The username.
+ * @throws IdNotFound User was not found.
+ */
public void removeUser(String username) throws IdNotFound {
EntityManager em = getEntityManager();
remove(em, find(em, User.class, username));
}
+ /**
+ * Returns all pets with the specified statuses.
+ *
+ * @param status Pet statuses.
+ * @return Pets with the specified statuses.
+ */
public Collection<Pet> getPetsByStatus(PetStatus[] status) {
return getEntityManager()
.createQuery("select X from PetstorePet X where X.status in :status", Pet.class)
@@ -214,6 +317,13 @@ public class PetStoreService extends AbstractPersistenceService {
.getResultList();
}
+ /**
+ * Returns all pets with the specified tags.
+ *
+ * @param tags Pet tags.
+ * @return Pets with the specified tags.
+ * @throws InvalidTag Tag name was invalid.
+ */
public Collection<Pet> getPetsByTags(String[] tags) throws InvalidTag {
return getEntityManager()
.createQuery("select X from PetstorePet X where X.tags in :tags", Pet.class)
@@ -221,6 +331,11 @@ public class PetStoreService extends AbstractPersistenceService {
.getResultList();
}
+ /**
+ * Returns a summary of pet statuses and counts.
+ *
+ * @return A summary of pet statuses and counts.
+ */
public Map<PetStatus,Integer> getInventory() {
Map<PetStatus,Integer> m = new LinkedHashMap<>();
for (Pet p : getPets()) {
@@ -233,6 +348,13 @@ public class PetStoreService extends AbstractPersistenceService {
return m;
}
+ /**
+ * Returns <jk>true</jk> if the specified username and password is valid.
+ *
+ * @param username The username.
+ * @param password The password.
+ * @return <jk>true</jk> if the specified username and password is valid.
+ */
public boolean isValid(String username, String password) {
return getUser(username).getPassword().equals(password);
}
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/CreateOrder.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/CreateOrder.java
index 01589e9..56144e3 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/CreateOrder.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/CreateOrder.java
@@ -30,6 +30,9 @@ public class CreateOrder {
/**
* Optional constructor.
+ *
+ * @param petId The <bc>petId</bc> property value.
+ * @param username The <bc>username</bc> property value.
*/
@BeanConstructor(properties="petId,username")
public CreateOrder(long petId, String username) {
@@ -46,19 +49,33 @@ public class CreateOrder {
// Bean properties
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * @return The <bc>petId</bc> property value.
+ */
public long getPetId() {
return petId;
}
+ /**
+ * @param value The <bc>petId</bc> property value.
+ * @return This object (for method chaining).
+ */
public CreateOrder petId(long value) {
this.petId = value;
return this;
}
+ /**
+ * @return The <bc>username</bc> property value.
+ */
public String getUsername() {
return username;
}
+ /**
+ * @param value The <bc>username</bc> property value.
+ * @return This object (for method chaining).
+ */
public CreateOrder username(String value) {
this.username = value;
return this;
@@ -71,6 +88,8 @@ public class CreateOrder {
/**
* Used to populate Swagger examples.
* Example is inferred from the method name.
+ *
+ * @return An example POJO.
*/
public static CreateOrder example() {
return new CreateOrder(123, "sampleuser");
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/CreatePet.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/CreatePet.java
index 84e43d4..b0d950f 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/CreatePet.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/CreatePet.java
@@ -44,6 +44,12 @@ public class CreatePet {
/**
* Constructor.
+ *
+ * @param name The <bc>name</bc> property value.
+ * @param price The <bc>price</bc> property value.
+ * @param species The <bc>species</bc> property value.
+ * @param tags The <bc>tags</bc> property value.
+ * @param photo The <bc>photo</bc> property value.
*/
public CreatePet(String name, float price, Species species, String[] tags, String photo) {
this.name = name;
@@ -62,48 +68,83 @@ public class CreatePet {
// Bean properties
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * @return The <bc>name</bc> property value.
+ */
public String getName() {
return name;
}
+ /**
+ * @param value The <bc>name</bc> property value.
+ * @return This object (for method chaining).
+ */
public CreatePet name(String value) {
this.name = value;
return this;
}
+ /**
+ * @return The <bc>price</bc> property value.
+ */
public float getPrice() {
return price;
}
+ /**
+ * @param value The <bc>price</bc> property value.
+ * @return This object (for method chaining).
+ */
public CreatePet price(float value) {
this.price = value;
return this;
}
+ /**
+ * @return The <bc>species</bc> property value.
+ */
public Species getSpecies() {
return species;
}
+ /**
+ * @param value The <bc>species</bc> property value.
+ * @return This object (for method chaining).
+ */
public CreatePet species(Species value) {
this.species = value;
return this;
}
+ /**
+ * @return The <bc>tags</bc> property value.
+ */
public String[] getTags() {
return tags;
}
+ /**
+ * @param value The <bc>tags</bc> property value.
+ * @return This object (for method chaining).
+ */
public CreatePet tags(String...value) {
this.tags = value;
return this;
}
+ /**
+ * @return The <bc>photo</bc> property value.
+ */
public String getPhoto() {
return photo;
}
- public CreatePet photo(String photo) {
- this.photo = photo;
+ /**
+ * @param value The <bc>photo</bc> property value.
+ * @return This object (for method chaining).
+ */
+ public CreatePet photo(String value) {
+ this.photo = value;
return this;
}
@@ -111,6 +152,9 @@ public class CreatePet {
// Other
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * @return An example POJO.
+ */
public static CreatePet example() {
return new CreatePet("Doggie", 9.99f, Species.DOG, new String[]{"smart","friendly"}, null);
}
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Order.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Order.java
index 5dea230..f4b4047 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Order.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Order.java
@@ -62,12 +62,24 @@ public class Order {
@Swap(DateSwap.ISO8601D.class)
private Date shipDate;
+ /**
+ * Applies the specified create data to this order.
+ *
+ * @param o The create data to apply.
+ * @return This object.
+ */
public Order apply(CreateOrder o) {
this.petId = o.getPetId();
this.username = o.getUsername();
return this;
}
+ /**
+ * Applies the specified order this order.
+ *
+ * @param o The order to apply.
+ * @return This object.
+ */
public Order apply(Order o) {
this.id = o.getId();
this.petId = o.getPetId();
@@ -81,46 +93,81 @@ public class Order {
// Bean properties
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * @return The <bc>id</bc> property value.
+ */
public long getId() {
return id;
}
- public Order id(long id) {
- this.id = id;
+ /**
+ * @param value The <bc>id</bc> property value.
+ * @return This object (for method chaining).
+ */
+ public Order id(long value) {
+ this.id = value;
return this;
}
+ /**
+ * @return The <bc>shipDate</bc> property value.
+ */
public Date getShipDate() {
return shipDate;
}
+ /**
+ * @param value The <bc>shipDate</bc> property value.
+ * @return This object (for method chaining).
+ */
public Order shipDate(Date value) {
this.shipDate = value;
return this;
}
+ /**
+ * @return The <bc>status</bc> property value.
+ */
public OrderStatus getStatus() {
return status;
}
+ /**
+ * @param value The <bc>status</bc> property value.
+ * @return This object (for method chaining).
+ */
public Order status(OrderStatus value) {
this.status = value;
return this;
}
+ /**
+ * @return The <bc>petId</bc> property value.
+ */
public long getPetId() {
return petId;
}
+ /**
+ * @param value The <bc>petId</bc> property value.
+ * @return This object (for method chaining).
+ */
public Order petId(long value) {
this.petId = value;;
return this;
}
+ /**
+ * @return The <bc>username</bc> property value.
+ */
public String getUsername() {
return username;
}
+ /**
+ * @param value The <bc>username</bc> property value.
+ * @return This object (for method chaining).
+ */
public Order username(String value) {
this.username = value;
return this;
@@ -132,6 +179,8 @@ public class Order {
/**
* This shows an example generated from a static method.
+ *
+ * @return The example POJO.
*/
@Example
public static Order example() {
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/OrderStatus.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/OrderStatus.java
index e861a78..f195a87 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/OrderStatus.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/OrderStatus.java
@@ -25,9 +25,13 @@ import org.apache.juneau.serializer.*;
* </ul>
*/
@Html(render=OrderStatus.OrderStatusRender.class)
+@SuppressWarnings("javadoc")
public enum OrderStatus {
PLACED, APPROVED, DELIVERED;
+ /**
+ * Used to control how this enum is rendered in HTML view.
+ */
public static class OrderStatusRender extends HtmlRender<OrderStatus> {
@Override /* HtmlRender */
public String getStyle(SerializerSession session, OrderStatus value) {
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Pet.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Pet.java
index 711324a..2966a4f 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Pet.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Pet.java
@@ -67,6 +67,12 @@ public class Pet {
@URI
private String photo;
+ /**
+ * Applies the specified data to this object.
+ *
+ * @param x The data to apply.
+ * @return This object.
+ */
public Pet apply(CreatePet x) {
this.name = x.getName();
this.price = x.getPrice();
@@ -76,6 +82,12 @@ public class Pet {
return this;
}
+ /**
+ * Applies the specified data to this object.
+ *
+ * @param x The data to apply.
+ * @return This object.
+ */
public Pet apply(UpdatePet x) {
this.id = x.getId();
this.name = x.getName();
@@ -91,74 +103,131 @@ public class Pet {
// Bean properties
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * @return The <bc>id</jc> property value.
+ */
public long getId() {
return id;
}
- public Pet id(long id) {
- this.id = id;
+ /**
+ * @param value The <bc>id</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public Pet id(long value) {
+ this.id = value;
return this;
}
+ /**
+ * @return The <bc>name</jc> property value.
+ */
public String getName() {
return name;
}
- public Pet name(String name) {
- this.name = name;
+ /**
+ * @param value The <bc>name</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public Pet name(String value) {
+ this.name = value;
return this;
}
+ /**
+ * @return The <bc>price</jc> property value.
+ */
public float getPrice() {
return price;
}
- public Pet price(float price) {
- this.price = price;
+ /**
+ * @param value The <bc>price</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public Pet price(float value) {
+ this.price = value;
return this;
}
+ /**
+ * @return The <bc>species</jc> property value.
+ */
public Species getSpecies() {
return species;
}
- public Pet species(Species species) {
- this.species = species;
+ /**
+ * @param value The <bc>species</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public Pet species(Species value) {
+ this.species = value;
return this;
}
+ /**
+ * @return The <bc>tags</jc> property value.
+ */
public List<String> getTags() {
return tags;
}
- public Pet tags(List<String> tags) {
- this.tags = tags;
+ /**
+ * @param value The <bc>tags</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public Pet tags(List<String> value) {
+ this.tags = value;
return this;
}
- public Pet tags(String...tags) {
- this.tags = Arrays.asList(tags);
+ /**
+ * @param value The <bc>tags</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public Pet tags(String...value) {
+ this.tags = Arrays.asList(value);
return this;
}
+ /**
+ * @return The <bc>status</jc> property value.
+ */
public PetStatus getStatus() {
return status;
}
- public Pet status(PetStatus status) {
- this.status = status;
+ /**
+ * @param value The <bc>status</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public Pet status(PetStatus value) {
+ this.status = value;
return this;
}
+ /**
+ * @return The <bc>photo</jc> property value.
+ */
public String getPhoto() {
return photo;
}
- public Pet photo(String photo) {
- this.photo = photo;
+ /**
+ * @param value The <bc>photo</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public Pet photo(String value) {
+ this.photo = value;
return this;
}
+ /**
+ * @param statuses The statuses to match against.
+ * @return <jk>true</jk> if this pet matches at least one of the specified statuses.
+ */
public boolean hasStatus(PetStatus...statuses) {
for (PetStatus status : statuses)
if (this.status == status)
@@ -166,6 +235,10 @@ public class Pet {
return false;
}
+ /**
+ * @param tags The tags to match against.
+ * @return <jk>true</jk> if this pet matches at least one of the specified tags.
+ */
public boolean hasTag(String...tags) {
for (String tag : tags)
for (String t : this.tags)
@@ -174,6 +247,9 @@ public class Pet {
return false;
}
+ /**
+ * @return Edit page link.
+ */
public java.net.URI getEdit() {
return java.net.URI.create("servlet:/pet/edit/{id}");
}
@@ -184,6 +260,8 @@ public class Pet {
/**
* This shows an example generated from a static method.
+ *
+ * @return POJO example.
*/
@Example
public static Pet example() {
@@ -195,7 +273,9 @@ public class Pet {
.status(PetStatus.AVAILABLE);
}
-
+ /**
+ * Used to control format of prices in HTML view.
+ */
public static final class PriceRender extends HtmlRender<Float> {
@Override
public Object getContent(SerializerSession session, Float value) {
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/PetStatus.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/PetStatus.java
index ed36087..64afa00 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/PetStatus.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/PetStatus.java
@@ -25,9 +25,13 @@ import org.apache.juneau.serializer.*;
* </ul>
*/
@Html(render=PetStatus.PetStatusRender.class)
+@SuppressWarnings("javadoc")
public enum PetStatus {
AVAILABLE, PENDING, SOLD, UNKNOWN;
+ /**
+ * Used to control how this enum is rendered in HTML view.
+ */
public static class PetStatusRender extends HtmlRender<PetStatus> {
@Override /* HtmlRender */
public String getStyle(SerializerSession session, PetStatus value) {
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/PetTag.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/PetTag.java
index 653dda6..0822015 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/PetTag.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/PetTag.java
@@ -31,24 +31,41 @@ public class PetTag {
private long id;
private String name;
+ /**
+ * @return The <bc>id</jc> property value.
+ */
public long getId() {
return id;
}
- public PetTag id(long id) {
- this.id = id;
+ /**
+ * @param value The <bc>id</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public PetTag id(long value) {
+ this.id = value;
return this;
}
+ /**
+ * @return The <bc>name</jc> property value.
+ */
public String getName() {
return name;
}
- public PetTag name(String name) {
- this.name = name;
+ /**
+ * @param value The <bc>name</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public PetTag name(String value) {
+ this.name = value;
return this;
}
+ /**
+ * @return POJO example.
+ */
@Example
public static PetTag example() {
return new PetTag()
@@ -56,6 +73,10 @@ public class PetTag {
.name("MyTag");
}
+ /**
+ * @param tags Tags to convert to a simple string.
+ * @return The specified tags as a simple comma-delimited list.
+ */
public static String asString(List<PetTag> tags) {
if (tags == null)
return "";
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Species.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Species.java
index b0c92b0..6783184 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Species.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/Species.java
@@ -26,10 +26,14 @@ import org.apache.juneau.serializer.*;
* </ul>
*/
@Html(render=Species.SpeciesRender.class)
+@SuppressWarnings("javadoc")
public enum Species {
BIRD, CAT, DOG, FISH, MOUSE, RABBIT, SNAKE;
+ /**
+ * Used to control how this enum is rendered in HTML view.
+ */
public static class SpeciesRender extends HtmlRender<Species> {
@Override
public Object getContent(SerializerSession session, Species value) {
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/UpdatePet.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/UpdatePet.java
index ed2fb91..6959363 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/UpdatePet.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/UpdatePet.java
@@ -34,6 +34,14 @@ public class UpdatePet extends CreatePet {
/**
* Constructor.
+ *
+ * @param id The <bc>id</bc> property value.
+ * @param name The <bc>name</bc> property value.
+ * @param price The <bc>price</bc> property value.
+ * @param species The <bc>species</bc> property value.
+ * @param tags The <bc>tags</bc> property value.
+ * @param status The <bc>status</bc> property value.
+ * @param photo The <bc>photo</bc> property value.
*/
public UpdatePet(long id, String name, float price, Species species, String[] tags, PetStatus status, String photo) {
super(name, price, species, tags, photo);
@@ -50,19 +58,33 @@ public class UpdatePet extends CreatePet {
// Bean properties
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * @return The <bc>id</jc> property value.
+ */
public long getId() {
return id;
}
+ /**
+ * @param value The <bc>id</jc> property value.
+ * @return This object (for method chaining).
+ */
public UpdatePet id(long value) {
this.id = value;
return this;
}
+ /**
+ * @return The <bc>status</jc> property value.
+ */
public PetStatus getStatus() {
return status;
}
+ /**
+ * @param value The <bc>status</jc> property value.
+ * @return This object (for method chaining).
+ */
public UpdatePet status(PetStatus value) {
this.status = value;
return this;
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/User.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/User.java
index c2faff7..2080d21 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/User.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/User.java
@@ -62,6 +62,12 @@ public class User {
@Enumerated(STRING)
private UserStatus userStatus;
+ /**
+ * Applies the specified data to this object.
+ *
+ * @param c The data to apply.
+ * @return This object.
+ */
public User apply(User c) {
this.username = c.getUsername();
this.firstName = c.getFirstName();
@@ -77,66 +83,115 @@ public class User {
// Bean properties
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * @return The <bc>username</jc> property value.
+ */
public String getUsername() {
return username;
}
- public User username(String username) {
- this.username = username;
+ /**
+ * @param value The <bc>username</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public User username(String value) {
+ this.username = value;
return this;
}
+ /**
+ * @return The <bc>firstName</jc> property value.
+ */
public String getFirstName() {
return firstName;
}
- public User firstName(String firstName) {
- this.firstName = firstName;
+ /**
+ * @param value The <bc>firstName</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public User firstName(String value) {
+ this.firstName = value;
return this;
}
+ /**
+ * @return The <bc>lastName</jc> property value.
+ */
public String getLastName() {
return lastName;
}
- public User lastName(String lastName) {
- this.lastName = lastName;
+ /**
+ * @param value The <bc>lastName</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public User lastName(String value) {
+ this.lastName = value;
return this;
}
+ /**
+ * @return The <bc>email</jc> property value.
+ */
public String getEmail() {
return email;
}
- public User email(String email) {
- this.email = email;
+ /**
+ * @param value The <bc>email</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public User email(String value) {
+ this.email = value;
return this;
}
+ /**
+ * @return The <bc>password</jc> property value.
+ */
public String getPassword() {
return password;
}
- public User password(String password) {
- this.password = password;
+ /**
+ * @param value The <bc>password</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public User password(String value) {
+ this.password = value;
return this;
}
+ /**
+ * @return The <bc>phone</jc> property value.
+ */
public String getPhone() {
return phone;
}
- public User phone(String phone) {
- this.phone = phone;
+ /**
+ * @param value The <bc>phone</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public User phone(String value) {
+ this.phone = value;
return this;
}
+ /**
+ * @return The <bc>userStatus</jc> property value.
+ */
public UserStatus getUserStatus() {
return userStatus;
}
- public User userStatus(UserStatus userStatus) {
- this.userStatus = userStatus;
+ /**
+ * @param value The <bc>userStatus</jc> property value.
+ * @return This object (for method chaining).
+ */
+ public User userStatus(UserStatus value) {
+ this.userStatus = value;
return this;
}
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/UserStatus.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/UserStatus.java
index 335b53b..2467239 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/UserStatus.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/dto/UserStatus.java
@@ -25,9 +25,13 @@ import org.apache.juneau.serializer.*;
* </ul>
*/
@Html(render=UserStatus.UserStatusRender.class)
+@SuppressWarnings("javadoc")
public enum UserStatus {
ACTIVE, INACTIVE;
+ /**
+ * Used to control how this enum is rendered in HTML view.
+ */
public static class UserStatusRender extends HtmlRender<UserStatus> {
@Override /* HtmlRender */
public String getStyle(SerializerSession session, UserStatus value) {
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PetStore.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PetStore.java
index 26e7745..5117ceb 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PetStore.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PetStore.java
@@ -41,9 +41,23 @@ public interface PetStore {
// Pets
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Returns all pets in the database.
+ *
+ * @return All pets in the database.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/pet")
public Collection<Pet> getPets() throws NotAcceptable;
+ /**
+ * Returns a pet from the database.
+ *
+ * @param petId The ID of the pet to retrieve.
+ * @return The pet.
+ * @throws IdNotFound Pet was not found.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(path="/pet/{petId}") /* method inferred from method name */
public Pet getPet(
@Path(
@@ -54,6 +68,15 @@ public interface PetStore {
long petId
) throws IdNotFound, NotAcceptable;
+ /**
+ * Adds a pet to the database.
+ *
+ * @param pet The pet data to add to the database.
+ * @return {@link Ok} if successful.
+ * @throws IdConflict ID already in use.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
+ */
@RemoteMethod /* method and path inferred from method name */
public long postPet(
@Body(
@@ -61,6 +84,15 @@ public interface PetStore {
) CreatePet pet
) throws IdConflict, NotAcceptable, UnsupportedMediaType;
+ /**
+ * Updates a pet in the database.
+ *
+ * @param pet The pet data to add to the database.
+ * @return {@link Ok} if successful.
+ * @throws IdNotFound ID not found.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
+ */
@RemoteMethod(method=PUT, path="/pet/{petId}")
public Ok updatePet(
@Body(
@@ -68,6 +100,13 @@ public interface PetStore {
) UpdatePet pet
) throws IdNotFound, NotAcceptable, UnsupportedMediaType;
+ /**
+ * Find all pets with the matching statuses.
+ *
+ * @param status The statuses to match against.
+ * @return The pets that match the specified statuses.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/pet/findByStatus")
public Collection<Pet> findPetsByStatus(
@Query(
@@ -86,6 +125,14 @@ public interface PetStore {
PetStatus[] status
) throws NotAcceptable;
+ /**
+ * Find all pets with the specified tags.
+ *
+ * @param tags The tags to match against.
+ * @return The pets that match the specified tags.
+ * @throws InvalidTag Invalid tag was specified.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/pet/findByTags")
@Deprecated
public Collection<Pet> findPetsByTags(
@@ -98,6 +145,15 @@ public interface PetStore {
String[] tags
) throws InvalidTag, NotAcceptable;
+ /**
+ * Deletes the specified pet.
+ *
+ * @param apiKey Security key.
+ * @param petId ID of pet to delete.
+ * @return {@link Ok} if successful.
+ * @throws IdNotFound Pet not found.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=DELETE, path="/pet/{petId}")
public Ok deletePet(
@Header(
@@ -119,9 +175,24 @@ public interface PetStore {
// Orders
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Returns all orders in the database.
+ *
+ * @return All orders in the database.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/store/order")
public Collection<Order> getOrders() throws NotAcceptable;
+ /**
+ * Returns an order from the database.
+ *
+ * @param orderId The ID of the order to retreieve.
+ * @return The retrieved order.
+ * @throws InvalidId ID was invalid.
+ * @throws IdNotFound Order was not found.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/store/order/{orderId}")
public Order getOrder(
@Path(
@@ -134,6 +205,16 @@ public interface PetStore {
long orderId
) throws InvalidId, IdNotFound, NotAcceptable;
+ /**
+ * Adds an order to the database.
+ *
+ * @param petId Id of pet to order.
+ * @param username The username of the user placing the order.
+ * @return The ID of the order.
+ * @throws IdConflict ID was already in use.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
+ */
@RemoteMethod(method=POST, path="/store/order")
public long placeOrder(
@FormData(
@@ -148,6 +229,15 @@ public interface PetStore {
String username
) throws IdConflict, NotAcceptable, UnsupportedMediaType;
+ /**
+ * Deletes an order from the database.
+ *
+ * @param orderId The order ID.
+ * @return {@link Ok} if successful.
+ * @throws InvalidId ID not valid.
+ * @throws IdNotFound Order not found.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=DELETE, path="/store/order/{orderId}")
public Ok deleteOrder(
@Path(
@@ -159,6 +249,12 @@ public interface PetStore {
long orderId
) throws InvalidId, IdNotFound, NotAcceptable;
+ /**
+ * Returns an inventory of pet statuses and counts.
+ *
+ * @return An inventory of pet statuses and counts.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/store/inventory")
public Map<PetStatus,Integer> getStoreInventory() throws NotAcceptable;
@@ -166,9 +262,24 @@ public interface PetStore {
// Users
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Returns all users in the database.
+ *
+ * @return All users in the database.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/user")
public Collection<User> getUsers() throws NotAcceptable;
+ /**
+ * Returns a user from the database.
+ *
+ * @param username The username.
+ * @return The user.
+ * @throws InvalidUsername Invalid username.
+ * @throws IdNotFound username not found.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/user/{username}")
public User getUser(
@Path(
@@ -178,6 +289,16 @@ public interface PetStore {
String username
) throws InvalidUsername, IdNotFound, NotAcceptable;
+ /**
+ * Adds a new user to the database.
+ *
+ * @param user The user to add to the database.
+ * @return {@link Ok} if successful.
+ * @throws InvalidUsername Username was invalid.
+ * @throws IdConflict Username already in use.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
+ */
@RemoteMethod
public Ok postUser(
@Body(
@@ -186,6 +307,16 @@ public interface PetStore {
User user
) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType;
+ /**
+ * Bulk creates users.
+ *
+ * @param users The users to add to the database.
+ * @return {@link Ok} if successful.
+ * @throws InvalidUsername Username was invalid.
+ * @throws IdConflict Username already in use.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
+ */
@RemoteMethod(method=POST, path="/user/createWithArray")
public Ok createUsers(
@Body(
@@ -194,6 +325,17 @@ public interface PetStore {
User[] users
) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType;
+ /**
+ * Updates a user in the database.
+ *
+ * @param username The username.
+ * @param user The updated information.
+ * @return {@link Ok} if successful.
+ * @throws InvalidUsername Username was invalid.
+ * @throws IdNotFound User was not found.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header specified.
+ */
@RemoteMethod(method=PUT, path="/user/{username}")
public Ok updateUser(
@Path(
@@ -207,6 +349,15 @@ public interface PetStore {
User user
) throws InvalidUsername, IdNotFound, NotAcceptable, UnsupportedMediaType;
+ /**
+ * Deletes a user from the database.
+ *
+ * @param username The username.
+ * @return {@link Ok} if successful.
+ * @throws InvalidUsername Username was not valid.
+ * @throws IdNotFound User was not found.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=DELETE, path="/user/{username}")
public Ok deleteUser(
@Path(
@@ -216,18 +367,31 @@ public interface PetStore {
String username
) throws InvalidUsername, IdNotFound, NotAcceptable;
+ /**
+ * User login.
+ *
+ * @param username The username for login.
+ * @param password The password for login in clear text.
+ * @param rateLimit Calls per hour allowed by the user.
+ * @param expiresAfter The <bc>Expires-After</bc> response header.
+ * @param req The servlet request.
+ * @param res The servlet response.
+ * @return {@link Ok} if successful.
+ * @throws InvalidLogin Login was unsuccessful.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/user/login")
public Ok login(
@Query(
name="username",
- description="The username for login",
+ description="The username for login.",
required=true,
example="myuser"
)
String username,
@Query(
name="password",
- description="The password for login in clear text",
+ description="The password for login in clear text.",
required=true,
example="abc123"
)
@@ -245,6 +409,12 @@ public interface PetStore {
RestResponse res
) throws InvalidLogin, NotAcceptable;
+ /**
+ * User logout.
+ *
+ * @return {@link Ok} if successful.
+ * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
+ */
@RemoteMethod(method=GET, path="/user/logout")
public Ok logout() throws NotAcceptable;
}
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PetStoreResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PetStoreResource.java
index fb52b48..f4a0cb8 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PetStoreResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PetStoreResource.java
@@ -142,11 +142,21 @@ public class PetStoreResource extends BasicRestJena implements PetStore {
private PetStoreService store;
+ /**
+ * Initializes our pet store service during servlet initialization.
+ *
+ * @param builder Optional access to rest context builder.
+ */
@RestHook(INIT)
- public void startup(RestContextBuilder builder) throws Exception {
+ public void startup(RestContextBuilder builder) {
store = new PetStoreService();
}
+ /**
+ * Navigation page
+ *
+ * @return Navigation page contents.
+ */
@RestMethod(
name=GET,
path="/",
@@ -177,6 +187,11 @@ public class PetStoreResource extends BasicRestJena implements PetStore {
// Initialization
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Initialize database form entry page.
+ *
+ * @return Initialize database form entry page contents.
+ */
@RestMethod(
summary="Initialize database form entry page"
)
@@ -201,6 +216,13 @@ public class PetStoreResource extends BasicRestJena implements PetStore {
);
}
+ /**
+ * Initialize database.
+ *
+ * @param initMethod The method used to initialize the database.
+ * @param res HTTP request.
+ * @throws Exception Error occurred.
+ */
@RestMethod(
summary="Initialize database"
)
@@ -354,6 +376,14 @@ public class PetStoreResource extends BasicRestJena implements PetStore {
// Pets - extra methods
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Displays the pet edit page.
+ *
+ * @param petId ID of pet to edit
+ * @return Edit page contents.
+ * @throws NotAcceptable Unsupported <bc>Accept</bc> header value specified.
+ * @throws UnsupportedMediaType Unsupported <bc>Content-Type</bc> header value specified.
+ */
@RestMethod(
name=GET,
path="/pet/{petId}/edit",
@@ -368,11 +398,11 @@ public class PetStoreResource extends BasicRestJena implements PetStore {
public Div editPetPage(
@Path(
name="petId",
- description="ID of pet to return",
+ description="ID of pet to edit",
example="123"
)
long petId
- ) throws IdConflict, NotAcceptable, UnsupportedMediaType {
+ ) throws NotAcceptable, UnsupportedMediaType {
Pet pet = getPet(petId);
@@ -433,6 +463,11 @@ public class PetStoreResource extends BasicRestJena implements PetStore {
// Orders
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Store navigation page.
+ *
+ * @return Store navigation page contents.
+ */
@RestMethod(
summary="Store navigation page",
swagger=@MethodSwagger(
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PhotosResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PhotosResource.java
index e6ab755..a54dded 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PhotosResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/PhotosResource.java
@@ -111,6 +111,10 @@ public class PhotosResource extends BasicRestServlet {
this.image = image;
}
+ /**
+ * @return The URI of this photo.
+ * @throws URISyntaxException ID could not be converted to a URI.
+ */
public URI getURI() throws URISyntaxException {
return new URI("servlet:/" + id);
}
@@ -120,6 +124,12 @@ public class PhotosResource extends BasicRestServlet {
// REST methods
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * Show the list of all currently loaded photos
+ *
+ * @return The list of all currently loaded photos.
+ * @throws Exception Error occurred.
+ */
@RestMethod(
name=GET,
path="/",
@@ -129,6 +139,13 @@ public class PhotosResource extends BasicRestServlet {
return photos.values();
}
+ /**
+ * Shows how to use a custom serializer to serialize a BufferedImage object to a stream.
+ *
+ * @param id The photo ID.
+ * @return The image.
+ * @throws NotFound Image was not found.
+ */
@RestMethod(
name=GET,
path="/{id}",
@@ -146,6 +163,14 @@ public class PhotosResource extends BasicRestServlet {
return p.image;
}
+ /**
+ * Shows how to use a custom parser to parse a stream into a BufferedImage object.
+ *
+ * @param id The photo ID.
+ * @param image Binary contents of image.
+ * @return <js>"OK"</jk> if successful.
+ * @throws Exception Error occurred.
+ */
@RestMethod(
name=PUT,
path="/{id}",
@@ -165,6 +190,13 @@ public class PhotosResource extends BasicRestServlet {
return "OK";
}
+ /**
+ * Shows how to use a custom parser to parse a stream into a BufferedImage object.
+ *
+ * @param image Binary contents of image.
+ * @return The Photo bean.
+ * @throws Exception Error occurred.
+ */
@RestMethod(
name=POST,
path="/",
@@ -184,6 +216,13 @@ public class PhotosResource extends BasicRestServlet {
return p;
}
+ /**
+ * Upload a photo from a multipart form post.
+ *
+ * @param req HTTP request.
+ * @return Redirect to servlet root.
+ * @throws Exception Error occurred.
+ */
@RestMethod(
name=POST,
path="/upload",
@@ -215,6 +254,13 @@ public class PhotosResource extends BasicRestServlet {
return new SeeOtherRoot(); // Redirect to the servlet root.
}
+ /**
+ * Removes a photo from the database.
+ *
+ * @param id ID of photo to remove.
+ * @return <js>"OK"</jk> if successful.
+ * @throws NotFound Photo was not found.
+ */
@RestMethod(
name=DELETE,
path="/{id}",
@@ -247,7 +293,7 @@ public class PhotosResource extends BasicRestServlet {
return new OutputStreamSerializerSession(args) {
@Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
+ protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException {
RenderedImage image = (RenderedImage)o;
String mediaType = getProperty("mediaType", String.class, (String)null);
ImageIO.write(image, mediaType.substring(mediaType.indexOf('/')+1), out.getOutputStream());
@@ -273,7 +319,7 @@ public class PhotosResource extends BasicRestServlet {
@Override /* ParserSession */
@SuppressWarnings("unchecked")
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
+ protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException, ExecutableException {
return (T)ImageIO.read(pipe.getInputStream());
}
};
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/SqlQueryResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/SqlQueryResource.java
index ca993c2..9a5ff26 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/SqlQueryResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/petstore/rest/SqlQueryResource.java
@@ -89,10 +89,9 @@ public class SqlQueryResource extends BasicRestServlet {
* Initializes the registry URL and rest client.
*
* @param builder The resource config.
- * @throws Exception
*/
@RestHook(INIT)
- public void initConnection(RestContextBuilder builder) throws Exception {
+ public void initConnection(RestContextBuilder builder) {
Config cf = builder.getConfig();
driver = cf.getString("SqlQueryResource/driver");
@@ -109,6 +108,12 @@ public class SqlQueryResource extends BasicRestServlet {
}
}
+ /**
+ * Displays the query entry page.
+ *
+ * @param sql Text to prepopulate the SQL query field with.
+ * @return The HTML div tag to serialize.
+ */
@RestMethod(
summary="Display the query entry page"
)
@@ -161,6 +166,17 @@ public class SqlQueryResource extends BasicRestServlet {
);
}
+ /**
+ * Execute one or more queries.
+ *
+ * @param in
+ * Query input
+ * @return
+ * Query results.
+ * <br>Each entry in the array is a result of one query.
+ * <b>Each result can be a result set (for queries) or update count (for updates).
+ * @throws BadRequest Invalid SQL detected.
+ */
@RestMethod(
summary="Execute one or more queries"
)
@@ -226,6 +242,7 @@ public class SqlQueryResource extends BasicRestServlet {
}
/** The parsed form post */
+ @SuppressWarnings("javadoc")
public static class PostInput {
public String sql = "";
public int pos = 1, limit = 100;
diff --git a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
index 7d3fec4..acf8bad 100755
--- a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
+++ b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
@@ -35,6 +35,7 @@ import org.apache.juneau.config.vars.*;
import org.apache.juneau.internal.*;
import org.apache.juneau.microservice.console.*;
import org.apache.juneau.microservice.resources.*;
+import org.apache.juneau.parser.ParseException;
import org.apache.juneau.svl.*;
import org.apache.juneau.svl.vars.ManifestFileVar;
import org.apache.juneau.utils.*;
@@ -125,7 +126,7 @@ public class Microservice implements ConfigEventListener {
private final Scanner consoleReader;
private final PrintWriter consoleWriter;
private final Thread consoleThread;
- protected final File workingDir;
+ final File workingDir;
private final String configName;
//-----------------------------------------------------------------------------------------------------------------
@@ -146,10 +147,11 @@ public class Microservice implements ConfigEventListener {
* Constructor.
*
* @param builder The builder containing the settings for this microservice.
- * @throws Exception
+ * @throws IOException Problem occurred reading file.
+ * @throws ParseException Malformed input encountered.
*/
@SuppressWarnings("resource")
- protected Microservice(MicroserviceBuilder builder) throws Exception {
+ protected Microservice(MicroserviceBuilder builder) throws IOException, ParseException {
setInstance(this);
this.builder = builder.copy();
this.workingDir = builder.workingDir;
@@ -302,6 +304,9 @@ public class Microservice implements ConfigEventListener {
*
* <p>
* If the working directory has been explicitly specified, relative paths are resolved relative to that.
+ *
+ * @param path The path to resolve.
+ * @return The resolved path.
*/
protected File resolveFile(String path) {
if (Paths.get(path).isAbsolute())
@@ -325,9 +330,10 @@ public class Microservice implements ConfigEventListener {
* It will initialize (or reinitialize) the console commands, system properties, and logger.
*
* @return This object (for method chaining).
- * @throws Exception
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Couldn't read a file.
*/
- public synchronized Microservice init() throws Exception {
+ public synchronized Microservice init() throws IOException, ParseException {
// --------------------------------------------------------------------------------
// Set system properties.
@@ -395,7 +401,7 @@ public class Microservice implements ConfigEventListener {
* Overridden methods MUST call this method FIRST so that the {@link MicroserviceListener#onStart(Microservice)} method is called.
*
* @return This object (for method chaining).
- * @throws Exception
+ * @throws Exception Error occurred.
*/
public synchronized Microservice start() throws Exception {
@@ -427,7 +433,7 @@ public class Microservice implements ConfigEventListener {
* Starts the console thread for this microservice.
*
* @return This object (for method chaining).
- * @throws Exception
+ * @throws Exception Error occurred
*/
public synchronized Microservice startConsole() throws Exception {
if (consoleThread != null && ! consoleThread.isAlive())
@@ -439,7 +445,7 @@ public class Microservice implements ConfigEventListener {
* Stops the console thread for this microservice.
*
* @return This object (for method chaining).
- * @throws Exception
+ * @throws Exception Error occurred
*/
public synchronized Microservice stopConsole() throws Exception {
if (consoleThread != null && consoleThread.isAlive())
@@ -667,7 +673,7 @@ public class Microservice implements ConfigEventListener {
* Default implementation is a no-op.
*
* @return This object (for method chaining).
- * @throws Exception
+ * @throws Exception Error occurred
*/
public Microservice join() throws Exception {
return this;
@@ -680,7 +686,7 @@ public class Microservice implements ConfigEventListener {
* Overridden methods MUST call this method LAST so that the {@link MicroserviceListener#onStop(Microservice)} method is called.
*
* @return This object (for method chaining).
- * @throws Exception
+ * @throws Exception Error occurred
*/
public Microservice stop() throws Exception {
listener.onStop(this);
@@ -690,7 +696,7 @@ public class Microservice implements ConfigEventListener {
/**
* Stops the console (if it's started) and calls {@link System#exit(int)}.
*
- * @throws Exception
+ * @throws Exception Error occurred
*/
public void exit() throws Exception {
try {
@@ -784,7 +790,7 @@ public class Microservice implements ConfigEventListener {
/**
* Logs a message to the log file.
*
- * @param level
+ * @param level The log level.
* @param message The message text.
* @param args Optional {@link MessageFormat}-style arguments.
*/
diff --git a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/MicroserviceBuilder.java b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/MicroserviceBuilder.java
index e0389e1..cc87578 100644
--- a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/MicroserviceBuilder.java
+++ b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/MicroserviceBuilder.java
@@ -18,6 +18,7 @@ import java.util.*;
import java.util.jar.*;
import java.util.logging.*;
+import org.apache.juneau.ExecutableException;
import org.apache.juneau.config.*;
import org.apache.juneau.config.store.*;
import org.apache.juneau.config.vars.*;
@@ -86,7 +87,7 @@ public class MicroserviceBuilder {
* Instantiate a new microservice using the settings defined on this builder.
*
* @return A new microservice.
- * @throws Exception
+ * @throws Exception Error occurred.
*/
public Microservice build() throws Exception {
return new Microservice(this);
@@ -153,7 +154,7 @@ public class MicroserviceBuilder {
* <li>{@link Class} - Finds and loads the manifest file of the jar file that the specified class is contained within.
* </ul>
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public MicroserviceBuilder manifest(Object value) throws IOException {
if (value == null)
@@ -300,13 +301,16 @@ public class MicroserviceBuilder {
*
* @param consoleCommands The list of console commands to append to the list of available commands.
* @return This object (for method chaining).
- * @throws IllegalAccessException
- * @throws InstantiationException
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
@SuppressWarnings("unchecked")
- public MicroserviceBuilder consoleCommands(Class<? extends ConsoleCommand>...consoleCommands) throws InstantiationException, IllegalAccessException {
- for (Class<? extends ConsoleCommand> cc : consoleCommands)
- this.consoleCommands.add(cc.newInstance());
+ public MicroserviceBuilder consoleCommands(Class<? extends ConsoleCommand>...consoleCommands) throws ExecutableException {
+ try {
+ for (Class<? extends ConsoleCommand> cc : consoleCommands)
+ this.consoleCommands.add(cc.newInstance());
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new ExecutableException(e);
+ }
return this;
}
@@ -414,9 +418,12 @@ public class MicroserviceBuilder {
/**
* Resolves the specified path.
- *
+ *
* <p>
* If the working directory has been explicitly specified, relative paths are resolved relative to that.
+ *
+ * @param path The path to resolve.
+ * @return The resolved file.
*/
protected File resolveFile(String path) {
if (Paths.get(path).isAbsolute())
diff --git a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/LogParser.java b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
index 3f9443c..7d10731 100644
--- a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
+++ b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
@@ -43,7 +43,7 @@ public final class LogParser implements Iterable<LogParser.Entry>, Iterator<LogP
* @param thread Only return log entries with this thread name.
* @param loggers Only return log entries produced by these loggers (simple class names).
* @param severity Only return log entries with the specified severity.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public LogParser(LogEntryFormatter formatter, File f, Date start, Date end, String thread, String[] loggers, String[] severity) throws IOException {
br = new BufferedReader(new InputStreamReader(new FileInputStream(f), Charset.defaultCharset()));
@@ -113,7 +113,7 @@ public final class LogParser implements Iterable<LogParser.Entry>, Iterator<LogP
* Serializes the contents of the parsed log file to the specified writer and then closes the underlying reader.
*
* @param w The writer to write the log file to.
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public void writeTo(Writer w) throws IOException {
try {
diff --git a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java
index 154b50e..5b98885 100755
--- a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java
+++ b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java
@@ -32,10 +32,9 @@ public class ShutdownResource extends BasicRestServlet {
* [GET /] - Shutdown this resource.
*
* @return The string <js>"OK"</js>.
- * @throws Exception
*/
@RestMethod(name=GET, path="/", description="Show contents of config file.")
- public String shutdown() throws Exception {
+ public String shutdown() {
new Thread(
new Runnable() {
@Override /* Runnable */
diff --git a/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroservice.java b/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroservice.java
index 24070dd..6909cbe 100644
--- a/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroservice.java
+++ b/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroservice.java
@@ -27,6 +27,7 @@ import org.apache.juneau.*;
import org.apache.juneau.config.*;
import org.apache.juneau.internal.*;
import org.apache.juneau.microservice.*;
+import org.apache.juneau.parser.ParseException;
import org.apache.juneau.reflect.ClassInfo;
import org.apache.juneau.rest.*;
import org.apache.juneau.svl.*;
@@ -76,7 +77,7 @@ public class JettyMicroservice extends Microservice {
* Entry-point method.
*
* @param args Command line arguments.
- * @throws Exception
+ * @throws Exception Error occurred.
*/
public static void main(String[] args) throws Exception {
JettyMicroservice
@@ -115,9 +116,10 @@ public class JettyMicroservice extends Microservice {
* Constructor.
*
* @param builder The constructor arguments.
- * @throws Exception
+ * @throws IOException Problem occurred reading file.
+ * @throws ParseException Malformed content found in config file.
*/
- protected JettyMicroservice(JettyMicroserviceBuilder builder) throws Exception {
+ protected JettyMicroservice(JettyMicroserviceBuilder builder) throws ParseException, IOException {
super(builder);
setInstance(this);
this.builder = builder.copy();
@@ -130,7 +132,7 @@ public class JettyMicroservice extends Microservice {
//-----------------------------------------------------------------------------------------------------------------
@Override /* Microservice */
- public JettyMicroservice init() throws Exception {
+ public JettyMicroservice init() throws ParseException, IOException {
super.init();
return this;
}
@@ -308,9 +310,11 @@ public class JettyMicroservice extends Microservice {
* </p>
*
* @return The newly-created server.
- * @throws Exception
+ * @throws ParseException Configuration file contains malformed input.
+ * @throws IOException File could not be read.
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- public Server createServer() throws Exception {
+ public Server createServer() throws ParseException, IOException, ExecutableException {
listener.onCreateServer(this);
Config cf = getConfig();
@@ -335,25 +339,37 @@ public class JettyMicroservice extends Microservice {
getLogger().info(jettyXml);
- server = factory.create(jettyXml);
+ try {
+ server = factory.create(jettyXml);
+ } catch (Exception e2) {
+ throw new ExecutableException(e2);
+ }
for (String s : cf.getStringArray("Jetty/servlets", new String[0])) {
- ClassInfo c = getClassInfo(Class.forName(s));
- if (c.isChildOf(RestServlet.class)) {
- RestServlet rs = (RestServlet)c.newInstance();
- addServlet(rs, rs.getPath());
- } else {
- throw new FormattedRuntimeException("Invalid servlet specified in Jetty/servlets. Must be a subclass of RestServlet.", s);
+ try {
+ ClassInfo c = getClassInfo(Class.forName(s));
+ if (c.isChildOf(RestServlet.class)) {
+ RestServlet rs = (RestServlet)c.newInstance();
+ addServlet(rs, rs.getPath());
+ } else {
+ throw new FormattedRuntimeException("Invalid servlet specified in Jetty/servlets. Must be a subclass of RestServlet.", s);
+ }
+ } catch (ClassNotFoundException e1) {
+ throw new ExecutableException(e1);
}
}
for (Map.Entry<String,Object> e : cf.getObjectMap("Jetty/servletMap", ObjectMap.EMPTY_MAP).entrySet()) {
- ClassInfo c = getClassInfo(Class.forName(e.getValue().toString()));
- if (c.isChildOf(Servlet.class)) {
- Servlet rs = (Servlet)c.newInstance();
- addServlet(rs, e.getKey());
- } else {
- throw new FormattedRuntimeException("Invalid servlet specified in Jetty/servletMap. Must be a subclass of Servlet.", e.getValue());
+ try {
+ ClassInfo c = getClassInfo(Class.forName(e.getValue().toString()));
+ if (c.isChildOf(Servlet.class)) {
+ Servlet rs = (Servlet)c.newInstance();
+ addServlet(rs, e.getKey());
+ } else {
+ throw new FormattedRuntimeException("Invalid servlet specified in Jetty/servletMap. Must be a subclass of Servlet.", e.getValue());
+ }
+ } catch (ClassNotFoundException e1) {
+ throw new ExecutableException(e1);
}
}
@@ -374,7 +390,7 @@ public class JettyMicroservice extends Microservice {
/**
* Calls {@link Server#destroy()} on the underlying Jetty server if it exists.
*
- * @throws Exception
+ * @throws Exception Error occurred.
*/
public void destroyServer() throws Exception {
if (server != null)
@@ -444,7 +460,7 @@ public class JettyMicroservice extends Microservice {
* Subclasses can override this method to customize server startup.
*
* @return The port that this server started on.
- * @throws Exception
+ * @throws Exception Error occurred.
*/
protected int startServer() throws Exception {
listener.onStartServer(this);
diff --git a/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroserviceBuilder.java b/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroserviceBuilder.java
index e8ad2bb..b4e40e5 100644
--- a/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroserviceBuilder.java
+++ b/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroserviceBuilder.java
@@ -104,7 +104,7 @@ public class JettyMicroserviceBuilder extends MicroserviceBuilder {
* @param resolveVars
* If <jk>true</jk>, SVL variables in the file will automatically be resolved.
* @return This object (for method chaining).
- * @throws IOException
+ * @throws IOException Thrown by underlying stream.
*/
public JettyMicroserviceBuilder jettyXml(Object jettyXml, boolean resolveVars) throws IOException {
if (jettyXml instanceof String)
@@ -158,11 +158,15 @@ public class JettyMicroserviceBuilder extends MicroserviceBuilder {
*
* @param c The servlet to add to the servlet container.
* @return This object (for method chaining).
- * @throws InstantiationException
- * @throws IllegalAccessException
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- public JettyMicroserviceBuilder servlet(Class<? extends RestServlet> c) throws InstantiationException, IllegalAccessException {
- RestServlet rs = c.newInstance();
+ public JettyMicroserviceBuilder servlet(Class<? extends RestServlet> c) throws ExecutableException {
+ RestServlet rs;
+ try {
+ rs = c.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new ExecutableException(e);
+ }
return servlet(rs, '/' + rs.getPath());
}
@@ -175,11 +179,14 @@ public class JettyMicroserviceBuilder extends MicroserviceBuilder {
* @param c The servlet to add to the servlet container.
* @param path The servlet path spec.
* @return This object (for method chaining).
- * @throws InstantiationException
- * @throws IllegalAccessException
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
- public JettyMicroserviceBuilder servlet(Class<? extends Servlet> c, String path) throws InstantiationException, IllegalAccessException {
- return servlet(c.newInstance(), path);
+ public JettyMicroserviceBuilder servlet(Class<? extends Servlet> c, String path) throws ExecutableException {
+ try {
+ return servlet(c.newInstance(), path);
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new ExecutableException(e);
+ }
}
/**
@@ -238,7 +245,7 @@ public class JettyMicroserviceBuilder extends MicroserviceBuilder {
* <p>
* If not specified, uses {@link BasicJettyServerFactory}.
*
- * @param value
+ * @param value The new value for this property.
* @return This object (for method chaining).
*/
public JettyMicroserviceBuilder jettyServerFactory(JettyServerFactory value) {
diff --git a/juneau-microservice/juneau-my-jetty-microservice/src/main/java/org/apache/juneau/microservice/jetty/template/App.java b/juneau-microservice/juneau-my-jetty-microservice/src/main/java/org/apache/juneau/microservice/jetty/template/App.java
index 616f5e4..1419e33 100644
--- a/juneau-microservice/juneau-my-jetty-microservice/src/main/java/org/apache/juneau/microservice/jetty/template/App.java
+++ b/juneau-microservice/juneau-my-jetty-microservice/src/main/java/org/apache/juneau/microservice/jetty/template/App.java
@@ -27,7 +27,7 @@ public class App {
* Entry point method.
*
* @param args Command line arguments.
- * @throws Exception
+ * @throws Exception Error occurred.
*/
public static void main(String[] args) throws Exception {
JettyMicroservice
diff --git a/juneau-microservice/juneau-my-springboot-microservice/src/main/java/org/apache/juneau/microservice/springboot/template/App.java b/juneau-microservice/juneau-my-springboot-microservice/src/main/java/org/apache/juneau/microservice/springboot/template/App.java
index a6ade24..060c3c9 100644
--- a/juneau-microservice/juneau-my-springboot-microservice/src/main/java/org/apache/juneau/microservice/springboot/template/App.java
+++ b/juneau-microservice/juneau-my-springboot-microservice/src/main/java/org/apache/juneau/microservice/springboot/template/App.java
@@ -51,6 +51,9 @@ public class App {
/**
* If you want to parse URL-encoded form posts directly into beans, this call will disable the HiddenHttpMethodFilter
* which triggers form posts to be consumed.
+ *
+ * @param filter The filter to alter.
+ * @return The registration bean.
*/
@Bean
public FilterRegistrationBean<HiddenHttpMethodFilter> registration(HiddenHttpMethodFilter filter) {
diff --git a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
index 63b08ab..b01fe49 100644
--- a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
+++ b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCall.java
@@ -154,7 +154,7 @@ public final class RestCall extends BeanSession implements Closeable {
* The URI to use for this call.
* This overrides the URI passed in from the client.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid URI syntax detected.
*/
public RestCall uri(Object uri) throws RestCallException {
try {
@@ -219,7 +219,7 @@ public final class RestCall extends BeanSession implements Closeable {
* <br>If that's also <jk>null</jk>, defaults to {@link HttpPartSchema#DEFAULT}.
* <br>Only used if serializer is schema-aware (e.g. {@link OpenApiSerializer}).
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Error occurred.
*/
public RestCall query(String name, Object value, boolean skipIfEmpty, HttpPartSerializer serializer, HttpPartSchema schema) throws RestCallException {
if (serializer == null)
@@ -276,7 +276,7 @@ public final class RestCall extends BeanSession implements Closeable {
* @param name The parameter name.
* @param value The parameter value converted to a string using UON notation.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall query(String name, Object value) throws RestCallException {
return query(name, value, false, null, null);
@@ -287,7 +287,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param params The parameters. Values are converted to a string using UON notation.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall query(Map<String,Object> params) throws RestCallException {
return query(null, params);
@@ -302,7 +302,7 @@ public final class RestCall extends BeanSession implements Closeable {
* @param name The parameter name.
* @param value The parameter value converted to a string using UON notation.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall queryIfNE(String name, Object value) throws RestCallException {
return query(name, value, true, null, null);
@@ -316,7 +316,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param params The parameters. Values are converted to a string using UON notation.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall queryIfNE(Map<String,Object> params) throws RestCallException {
return query(null, params, true, null, null);
@@ -352,7 +352,7 @@ public final class RestCall extends BeanSession implements Closeable {
* <br>If that's also <jk>null</jk>, defaults to {@link HttpPartSchema#DEFAULT}.
* <br>Only used if serializer is schema-aware (e.g. {@link OpenApiSerializer}).
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall formData(String name, Object value, boolean skipIfEmpty, HttpPartSerializer serializer, HttpPartSchema schema) throws RestCallException {
if (formData == null)
@@ -418,7 +418,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param nameValuePairs The name-value pairs of the request.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall formData(NameValuePairs nameValuePairs) throws RestCallException {
return formData(null, nameValuePairs);
@@ -444,7 +444,7 @@ public final class RestCall extends BeanSession implements Closeable {
* @param name The parameter name.
* @param value The parameter value converted to a string using UON notation.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall formDataIfNE(String name, Object value) throws RestCallException {
return formData(name, value, true, null, null);
@@ -458,7 +458,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param params The parameters. Values are converted to a string using UON notation.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall formDataIfNE(Map<String,Object> params) throws RestCallException {
return formData(null, params, true, null, null);
@@ -670,7 +670,7 @@ public final class RestCall extends BeanSession implements Closeable {
* <br>If that's also <jk>null</jk>, defaults to {@link HttpPartSchema#DEFAULT}.
* <br>Only used if serializer is schema-aware (e.g. {@link OpenApiSerializer}).
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall header(String name, Object value, boolean skipIfEmpty, HttpPartSerializer serializer, HttpPartSchema schema) throws RestCallException {
if (serializer == null)
@@ -720,7 +720,7 @@ public final class RestCall extends BeanSession implements Closeable {
* The name can be null/empty if the value is a {@link Map}.
* @param value The header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall header(String name, Object value) throws RestCallException {
return header(name, value, false, null, null);
@@ -731,7 +731,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param values The header values.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall headers(Map<String,Object> values) throws RestCallException {
return header(null, values, false, null, null);
@@ -748,7 +748,7 @@ public final class RestCall extends BeanSession implements Closeable {
* The name can be null/empty if the value is a {@link Map}.
* @param value The header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall headerIfNE(String name, Object value) throws RestCallException {
return header(name, value, true, null, null);
@@ -762,7 +762,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param values The header values.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall headersIfNE(Map<String,Object> values) throws RestCallException {
return header(null, values, true, null, null);
@@ -777,7 +777,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall accept(Object value) throws RestCallException {
return header("Accept", value);
@@ -791,7 +791,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall acceptCharset(Object value) throws RestCallException {
return header("Accept-Charset", value);
@@ -805,7 +805,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall acceptEncoding(Object value) throws RestCallException {
return header("Accept-Encoding", value);
@@ -819,7 +819,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall acceptLanguage(Object value) throws RestCallException {
return header("Accept-Language", value);
@@ -833,7 +833,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall authorization(Object value) throws RestCallException {
return header("Authorization", value);
@@ -847,7 +847,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall cacheControl(Object value) throws RestCallException {
return header("Cache-Control", value);
@@ -861,7 +861,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall connection(Object value) throws RestCallException {
return header("Connection", value);
@@ -875,7 +875,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall contentLength(Object value) throws RestCallException {
return header("Content-Length", value);
@@ -890,7 +890,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall contentType(Object value) throws RestCallException {
return header("Content-Type", value);
@@ -904,7 +904,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall date(Object value) throws RestCallException {
return header("Date", value);
@@ -918,7 +918,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall expect(Object value) throws RestCallException {
return header("Expect", value);
@@ -932,7 +932,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall forwarded(Object value) throws RestCallException {
return header("Forwarded", value);
@@ -946,7 +946,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall from(Object value) throws RestCallException {
return header("From", value);
@@ -960,7 +960,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall host(Object value) throws RestCallException {
return header("Host", value);
@@ -974,7 +974,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall ifMatch(Object value) throws RestCallException {
return header("If-Match", value);
@@ -988,7 +988,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall ifModifiedSince(Object value) throws RestCallException {
return header("If-Modified-Since", value);
@@ -1002,7 +1002,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall ifNoneMatch(Object value) throws RestCallException {
return header("If-None-Match", value);
@@ -1016,7 +1016,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall ifRange(Object value) throws RestCallException {
return header("If-Range", value);
@@ -1030,7 +1030,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall ifUnmodifiedSince(Object value) throws RestCallException {
return header("If-Unmodified-Since", value);
@@ -1044,7 +1044,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall maxForwards(Object value) throws RestCallException {
return header("Max-Forwards", value);
@@ -1058,7 +1058,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall origin(Object value) throws RestCallException {
return header("Origin", value);
@@ -1072,7 +1072,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall pragma(Object value) throws RestCallException {
return header("Pragma", value);
@@ -1086,7 +1086,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall proxyAuthorization(Object value) throws RestCallException {
return header("Proxy-Authorization", value);
@@ -1100,7 +1100,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall range(Object value) throws RestCallException {
return header("Range", value);
@@ -1114,7 +1114,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall referer(Object value) throws RestCallException {
return header("Referer", value);
@@ -1128,7 +1128,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall te(Object value) throws RestCallException {
return header("TE", value);
@@ -1142,7 +1142,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall userAgent(Object value) throws RestCallException {
return header("User-Agent", value);
@@ -1156,7 +1156,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall upgrade(Object value) throws RestCallException {
return header("Upgrade", value);
@@ -1170,7 +1170,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall via(Object value) throws RestCallException {
return header("Via", value);
@@ -1184,7 +1184,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
* @param value The new header value.
* @return This object (for method chaining).
- * @throws RestCallException
+ * @throws RestCallException Invalid input.
*/
public RestCall warning(Object value) throws RestCallException {
return header("Warning", value);
@@ -1195,7 +1195,7 @@ public final class RestCall extends BeanSession implements Closeable {
*
... 2102 lines suppressed ...