Skip to content

Commit

Permalink
1.1.2, simplify exceptions on getMessage()
Browse files Browse the repository at this point in the history
  • Loading branch information
cafe24-jspark03 committed Dec 5, 2019
1 parent 01baa80 commit 84af2bd
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Graylog SDK Spring Boot Starter is available at the Central Maven Repository.
<dependency>
<groupId>com.joonsang.graylog</groupId>
<artifactId>graylog-sdk-spring-boot-starter</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
</dependency>
```

**Gradle**
```
implementation group: 'com.joonsang.graylog', name: 'graylog-sdk-spring-boot-starter', version: '1.1.1'
implementation group: 'com.joonsang.graylog', name: 'graylog-sdk-spring-boot-starter', version: '1.1.2'
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repositories {

subprojects {
group = 'com.joonsang.graylog'
version = '1.1.1'
version = '1.1.2'
sourceCompatibility = '11'

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

Expand All @@ -33,7 +32,7 @@ public GraylogSearchController(GraylogSearchService graylogSearchService) {
@GetMapping({"/messages/{requestId}"})
public ResponseEntity<?> getMessageByRequestId(
@PathVariable("requestId") String requestId
) throws IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
) throws IOException, ReflectiveOperationException {

LocalDateTime fromDateTime = LocalDateTime.now().minusMonths(3);
LocalDateTime toDateTime = LocalDateTime.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
Expand All @@ -40,7 +39,7 @@ public GraylogMessage getMessage(
LocalDateTime fromDateTime,
LocalDateTime toDateTime,
GraylogQuery query
) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, IOException {
) throws IOException, ReflectiveOperationException {

@SuppressWarnings("unchecked")
List<GraylogMessage> messages = (List<GraylogMessage>) graylogSearch.getMessages(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.apache.commons.lang3.StringUtils;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
Expand Down Expand Up @@ -47,10 +46,7 @@ public GraylogSearch(
* @param messageObject message object
* @return List of message
* @throws IOException Graylog server failure
* @throws NoSuchMethodException if given message object does not have constructor
* @throws IllegalAccessException if given message object fails initialization
* @throws InvocationTargetException if given message object fails initialization
* @throws InstantiationException if given message object fails initialization
* @throws ReflectiveOperationException if given message object does not have constructor
* @since 1.0.0
*/
public List<?> getMessages(
Expand All @@ -59,7 +55,7 @@ public List<?> getMessages(
LocalDateTime toDateTime,
String query,
Class<?> messageObject
) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
) throws IOException, ReflectiveOperationException {

String filter = "streams:" + streamId;
String from = fromDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.springframework.boot.test.context.SpringBootTest;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
Expand All @@ -37,7 +36,7 @@ class GraylogSearchTests {
GraylogSearch graylogSearch;

@Test
void messages() throws IOException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
void messages() throws IOException, ReflectiveOperationException {
LocalDateTime from = LocalDateTime.parse("2019-11-04 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
LocalDateTime to = LocalDateTime.parse("2019-11-05 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

Expand Down

0 comments on commit 84af2bd

Please sign in to comment.