Updated dependencies and cleanup.

This commit is contained in:
Erik C. Thauvin 2020-03-22 20:59:53 -07:00
parent aa8fadd37c
commit 4a701e1ee0
20 changed files with 321 additions and 117 deletions

View file

@ -1,7 +1,7 @@
/*
* Utils.java
*
* Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -100,7 +100,7 @@ public final class Utils {
* @throws IOException If an I/O error occurs.
*/
public static void outWrite(final Writer out, final String value, final String defaultValue, final boolean xml)
throws IOException {
throws IOException {
if (xml) {
if (value != null) {
out.write(escapeXml(value));

View file

@ -1,7 +1,7 @@
/*
* CauseTag.java
*
* Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -52,6 +52,7 @@ public class CauseTag extends XmlSupport {
@Override
public void doTag() throws IOException {
final PageContext pageContext = (PageContext) getJspContext();
@SuppressWarnings("PMD.CloseResource")
final JspWriter out = pageContext.getOut();
String cause;
@ -63,5 +64,7 @@ public class CauseTag extends XmlSupport {
}
Utils.outWrite(out, cause, defaultValue, escapeXml);
}
}

View file

@ -1,7 +1,7 @@
/*
* CodeTag.java
*
* Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -51,6 +51,7 @@ public class CodeTag extends SimpleTagSupport {
@Override
public void doTag() throws IOException {
final PageContext pageContext = (PageContext) getJspContext();
@SuppressWarnings("PMD.CloseResource")
final JspWriter out = pageContext.getOut();
out.write(String.valueOf(pageContext.getErrorData().getStatusCode()));

View file

@ -1,7 +1,7 @@
/*
* ReasonTag.java
*
* Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -56,6 +56,7 @@ public class ReasonTag extends XmlSupport {
@Override
public void doTag() {
final PageContext pageContext = (PageContext) getJspContext();
@SuppressWarnings("PMD.CloseResource")
final JspWriter out = pageContext.getOut();
try {

View file

@ -1,7 +1,7 @@
/*
* XmlSupport.java
*
* Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -2,7 +2,7 @@
<!--
~ httpstatus.tld
~
~ Copyright (c) 2015-2019, Erik C. Thauvin (erik@thauvin.net)
~ Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
~ All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/*
* TestMain.java
* ReasonsMainTest.java
*
* Copyright (c) 2015-2019, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -49,7 +49,7 @@ import static org.testng.Assert.assertTrue;
* @created 2019-05-06
* @since 1.0
*/
@SuppressFBWarnings({"DM_DEFAULT_ENCODING", "ITU_INAPPROPRIATE_TOSTRING_USE"})
@SuppressFBWarnings({ "DM_DEFAULT_ENCODING", "ITU_INAPPROPRIATE_TOSTRING_USE" })
public class ReasonsMainTest {
private final PrintStream originalOut = System.out;
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();

View file

@ -1,7 +1,7 @@
/*
* ReasonsTest.java
*
* Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -52,7 +52,7 @@ public class ReasonsTest {
for (final String key : bundle.keySet()) {
assertEquals(bundle.getString(key), Reasons.getReasonPhrase(key), "getReasonPhrase(" + key + ')');
assertEquals(bundle.getString(key), Reasons.getReasonPhrase(Integer.parseInt(key)),
"getReasonPhrase(int: " + key + ')');
"getReasonPhrase(int: " + key + ')');
}
}

View file

@ -1,7 +1,7 @@
/*
* UtilsTest.java
*
* Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -51,9 +51,10 @@ public class UtilsTest {
@Test
public void testEscapeXml() {
assertEquals(Utils.escapeXml(
"This is a test. We wan't to make sure that everything is <encoded> according the \"encoding\" parameter "
+ "& value."), "This is a test. We wan&#039;t to make sure that everything is &lt;encoded&gt; according "
+ "the &#034;encoding&#034; parameter &amp; value.");
"This is a test. We wan't to make sure that everything is <encoded> according the \"encoding\" "
+ "parameter & value."),
"This is a test. We wan&#039;t to make sure that everything is &lt;encoded&gt; according the "
+ "&#034;encoding&#034; parameter &amp; value.");
}
@SuppressWarnings("PMD.AvoidDuplicateLiterals")