Skip to content

Commit

Permalink
Code Quality: Remove unnecessary throws declarations (frankframework#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jkosternl authored Nov 20, 2023
1 parent 39086b7 commit 6629c16
Show file tree
Hide file tree
Showing 236 changed files with 619 additions and 707 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected String getAuthDataHeaderValue() {
}

@Test
public void netStorageUtilsComputeSignHeader() throws URISyntaxException {
public void netStorageUtilsComputeSignHeader() {
//Validate hash compute method
byte[] data = "myDummyString".getBytes();
byte[] binaryData = NetStorageUtils.computeKeyedHash(data, "accessToken", KeyedHashAlgorithm.HMACSHA256);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;

import javax.imageio.ImageIO;
Expand All @@ -11,7 +10,7 @@ public class ImageUtil {

static Logger logger = Logger.getLogger(ImageUtil.class.getName());

static double compareAndHighlight(final BufferedImage img1, final BufferedImage img2, String fileName, boolean highlight, int colorCode, double deviation) throws IOException {
static double compareAndHighlight(final BufferedImage img1, final BufferedImage img2, String fileName, boolean highlight, int colorCode, double deviation) {
final int w = img1.getWidth();
final int h = img1.getHeight();
final int[] p1 = img1.getRGB(0, 0, w, h, null, 0, w);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,13 +572,13 @@ public void multiThreadedMailWithWordAttachment() throws Exception {
}

@Test
public void wrongPdfOutputLocation() throws Exception {
public void wrongPdfOutputLocation() {
pipe.setPdfOutputLocation("not a valid location");
assertThrows(ConfigurationException.class, pipe::configure);
}

@Test
public void nullAction() throws Exception {
public void nullAction() {
assertThrows(ConfigurationException.class, pipe::configure, "please specify an action for pdf pipe [PdfPipe under test]. possible values: [CONVERT, COMBINE]");
}

Expand All @@ -594,7 +594,7 @@ public void emptyLicense() throws Exception {
}

@Test
public void wrongLicense() throws Exception {
public void wrongLicense() {
pipe.setAction(DocumentAction.CONVERT); //without action the pipe will never reach the license block!
pipe.setLicense("test123");//can't find this 'license' file
assertThrows(ConfigurationException.class, pipe::configure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private static S3Object extractS3ObjectFromSummary(S3ObjectSummary summary) {
}

@Override
public boolean exists(S3Object f) throws FileSystemException {
public boolean exists(S3Object f) {
return s3Client.doesObjectExist(bucketName, f.getKey());
}

Expand Down Expand Up @@ -297,7 +297,7 @@ public OutputStream appendFile(S3Object f) throws FileSystemException, IOExcepti
* Further, failure to close this stream can cause the request pool to become blocked.
*/
@Override
public Message readFile(S3Object file, String charset) throws FileSystemException, IOException {
public Message readFile(S3Object file, String charset) throws FileSystemException {
try {
if(file.getObjectContent() == null) { // We have a reference but not an actual object representing the S3 bucket.
file = s3Client.getObject(bucketName, file.getKey()); // Fetch a new copy
Expand Down Expand Up @@ -426,24 +426,24 @@ public String getName(S3Object f) {
}

@Override
public String getParentFolder(S3Object f) throws FileSystemException {
public String getParentFolder(S3Object f) {
int lastSlashPos = f.getKey().lastIndexOf('/');
return lastSlashPos > 1 ? f.getKey().substring(0, lastSlashPos) : null;
}

@Override
public String getCanonicalName(S3Object f) throws FileSystemException {
public String getCanonicalName(S3Object f) {
return f.getBucketName() + BUCKET_OBJECT_SEPARATOR + f.getKey();
}

@Override
public long getFileSize(S3Object f) throws FileSystemException {
public long getFileSize(S3Object f) {
updateFileAttributes(f);
return f.getObjectMetadata().getContentLength();
}

@Override
public Date getModificationTime(S3Object f) throws FileSystemException {
public Date getModificationTime(S3Object f) {
updateFileAttributes(f);
return f.getObjectMetadata().getLastModified();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public AmazonS3FileSystem createFileSystem() {
}

@Test
public void testConfigureAccessKey() throws Exception {
public void testConfigureAccessKey() {
fileSystem.setAuthAlias(null);
fileSystem.setAccessKey("123");
fileSystem.setSecretKey(null);
Expand All @@ -55,7 +55,7 @@ public void testConfigureAccessKey() throws Exception {
}

@Test
public void testConfigureSecretKey() throws Exception {
public void testConfigureSecretKey() {
fileSystem.setAuthAlias(null);
fileSystem.setAccessKey(null);
fileSystem.setSecretKey("123");
Expand Down Expand Up @@ -86,15 +86,15 @@ public void testConfigureAuthAlias() throws Exception {
}

@Test
public void testInvalidRegion() throws Exception {
public void testInvalidRegion() {
fileSystem.setClientRegion("tralala");

ConfigurationException e = assertThrows(ConfigurationException.class, fileSystem::configure);
assertThat(e.getMessage(), startsWith("invalid region [tralala] please use"));
}

@Test
public void testInvalidBucketName() throws Exception {
public void testInvalidBucketName() {
fileSystem.setBucketName("tr/89/**-alala");

ConfigurationException e = assertThrows(ConfigurationException.class, fileSystem::configure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilterInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -143,7 +142,7 @@ public void close() throws IOException {
}

@Override
public InputStream _readFile(String folder, String filename) throws FileNotFoundException {
public InputStream _readFile(String folder, String filename) {
String path = StringUtil.concatStrings(folder, "/", filename);
final S3Object file = s3Client.getObject(bucketName, path);
InputStream is = file.getObjectContent();
Expand All @@ -159,7 +158,7 @@ public void close() throws IOException {
}

@Override
public void _createFolder(String folderName) throws IOException {
public void _createFolder(String folderName) {
String foldername = folderName.endsWith("/") ? folderName : folderName +"/";
s3Client.putObject(bucketName, foldername, "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void setup() {
}

@Test
public void testCreateConnectionFactory() throws JMSException {
public void testCreateConnectionFactory() {
// Arrange / Act
ConnectionFactory cf = sqsFactory.createConnectionFactory();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public HttpRequestBase getMethod(URI uri, Message message, ParameterValueList pv
}

@Override
public Message extractResult(HttpResponseHandler responseHandler, PipeLineSession session) throws SenderException, IOException {
public Message extractResult(HttpResponseHandler responseHandler, PipeLineSession session) throws IOException {
int responseCode = -1;
try {
StatusLine statusline = responseHandler.getStatusLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void setUp() throws Exception { //Make this test Junit5 compliant
}

@Test
public void testEventAttribute() throws Exception {
public void testEventAttribute() {
listener.setEventListener("getObject");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testOverrideEntryPointWSDLWithoutWebservice() throws Exception {
}

@Test
public void testCreateActionWithNoSession() throws ConfigurationException {
public void testCreateActionWithNoSession() {
String dummyString = "dummyString";
sender.setUrl(dummyString);
sender.setOverrideEntryPointWSDL(dummyString);
Expand All @@ -53,7 +53,7 @@ public void testCreateActionWithNoSession() throws ConfigurationException {
}

@Test
public void testGetActionWithNoSession() throws ConfigurationException {
public void testGetActionWithNoSession() {
String dummyString = "dummyString";
sender.setUrl(dummyString);
sender.setRepository(dummyString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public SendJmsMessage createJaxRsResource() {
}

@Test
public void testWrongEncoding() throws Exception {
public void testWrongEncoding() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("connectionFactory", "qcf/connectionFactory"));
attachments.add(new StringAttachment("destination", "some-queue"));
Expand All @@ -40,7 +40,7 @@ public void testWrongEncoding() throws Exception {
}

@Test
public void testFileWrongEncoding() throws Exception {
public void testFileWrongEncoding() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("connectionFactory", "qcf/connectionFactory"));
attachments.add(new StringAttachment("destination", "some-queue"));
Expand All @@ -54,7 +54,7 @@ public void testFileWrongEncoding() throws Exception {
}

@Test
public void testWithMessage() throws Exception {
public void testWithMessage() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("connectionFactory", "qcf/connectionFactory"));
attachments.add(new StringAttachment("destination", "some-queue"));
Expand All @@ -77,7 +77,7 @@ public void testWithMessage() throws Exception {
}

@Test
public void testWithFile() throws Exception {
public void testWithFile() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("connectionFactory", "qcf/connectionFactory"));
attachments.add(new StringAttachment("destination", "some-queue"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public JsonResponseMessage answer(InvocationOnMock invocation) {
}

@Test
public void testMessage() throws Exception {
public void testMessage() {
doAnswer(new DefaultSuccessAnswer()).when(jaxRsResource).sendSyncMessage(any(RequestMessageBuilder.class));

List<Attachment> attachments = new ArrayList<Attachment>();
Expand All @@ -54,7 +54,7 @@ public void testMessage() throws Exception {
}

@Test
public void testFileMessage() throws Exception {
public void testFileMessage() {
doAnswer(new DefaultSuccessAnswer()).when(jaxRsResource).sendSyncMessage(any(RequestMessageBuilder.class));

List<Attachment> attachments = new ArrayList<Attachment>();
Expand Down Expand Up @@ -86,7 +86,7 @@ public void testZipMessage() throws Exception {
}

@Test
public void testPipelineBinaryResponse() throws Exception {
public void testPipelineBinaryResponse() {
doAnswer((e)->{return new BinaryResponseMessage("dummy data".getBytes());}).when(jaxRsResource).sendSyncMessage(any(RequestMessageBuilder.class));

List<Attachment> attachments = new ArrayList<Attachment>();
Expand All @@ -100,7 +100,7 @@ public void testPipelineBinaryResponse() throws Exception {
}

@Test
public void testPipelineUnknownResponse() throws Exception {
public void testPipelineUnknownResponse() {
doAnswer((e)->{return new GenericMessage<>(123L);}).when(jaxRsResource).sendSyncMessage(any(RequestMessageBuilder.class));

List<Attachment> attachments = new ArrayList<Attachment>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public TestServiceListener createJaxRsResource() {
}

@Test
public void testWrongEncoding() throws Exception {
public void testWrongEncoding() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("service", "dummyService123"));
attachments.add(new StringAttachment("encoding", "fakeEncoding"));
Expand All @@ -37,7 +37,7 @@ public void testWrongEncoding() throws Exception {
}

@Test
public void testFileWrongEncoding() throws Exception {
public void testFileWrongEncoding() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("service", "dummyService123"));
attachments.add(new StringAttachment("encoding", "fakeEncoding"));
Expand All @@ -48,7 +48,7 @@ public void testFileWrongEncoding() throws Exception {
}

@Test
public void testMessageServiceListeners() throws Exception {
public void testMessageServiceListeners() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("service", "dummyService123"));
attachments.add(new StringAttachment("message", "inputMessage"));
Expand All @@ -68,7 +68,7 @@ public void testMessageServiceListeners() throws Exception {
}

@Test
public void testFileServiceListeners() throws Exception {
public void testFileServiceListeners() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("service", "dummyService123"));
attachments.add(new FileAttachment("file", new ByteArrayInputStream("inputMessage".getBytes()), "script.xml"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public ShowLiquibaseScript createJaxRsResource() {
}

@Test
public void downloadSingleScript() throws Exception {
public void downloadSingleScript() {
Mockito.doAnswer((i) -> {
RequestMessageBuilder inputMessage = i.getArgument(0);
inputMessage.addHeader(ResponseMessageBase.STATUS_KEY, 200);
Expand All @@ -45,7 +45,7 @@ public void downloadSingleScript() throws Exception {
}

@Test
public void downloadAllScripts() throws Exception {
public void downloadAllScripts() {
Mockito.doAnswer((i) -> {
RequestMessageBuilder inputMessage = i.getArgument(0);
inputMessage.addHeader(ResponseMessageBase.STATUS_KEY, 200);
Expand All @@ -62,7 +62,7 @@ public void downloadAllScripts() throws Exception {
}

@Test
public void downloadAllScriptsWithConfig() throws Exception {
public void downloadAllScriptsWithConfig() {
Mockito.doAnswer((i) -> {
RequestMessageBuilder inputMessage = i.getArgument(0);
inputMessage.addHeader(ResponseMessageBase.STATUS_KEY, 200);
Expand All @@ -79,7 +79,7 @@ public void downloadAllScriptsWithConfig() throws Exception {
}

@Test
public void uploadScript() throws Exception {
public void uploadScript() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("configuration", "TestConfiguration"));
attachments.add(new FileAttachment("file", new ByteArrayInputStream("dummy".getBytes()), "script.xml"));
Expand All @@ -101,7 +101,7 @@ public void uploadScript() throws Exception {
}

@Test
public void uploadZipWithScripts() throws Exception {
public void uploadZipWithScripts() {
List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(new StringAttachment("configuration", "TestConfiguration"));
attachments.add(new FileAttachment("file", new ByteArrayInputStream("dummy".getBytes()), "script.zip"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testConversions() throws Exception {
}

@Test
public void testGetValue() throws Exception {
public void testGetValue() {
// Arrange
Map<String, Object> input = new HashMap<>();
input.put("string", "value");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -63,7 +62,7 @@ public String getName() {
}

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.getWriter().write(keyGenerator.getPublicJwkSet());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public boolean isNil(XSElementDeclaration elementDeclaration, Node node) {
return nilAttribute!=null && "true".equals(nilAttribute.getTextContent());
}
@Override
public Map<String, String> getAttributes(XSElementDeclaration elementDeclaration, Node node) throws SAXException {
public Map<String, String> getAttributes(XSElementDeclaration elementDeclaration, Node node) {
Map<String, String> result=new HashMap<String, String>();
NamedNodeMap attributes=node.getAttributes();
if (attributes!=null) {
Expand Down
Loading

0 comments on commit 6629c16

Please sign in to comment.