mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 10:35:25 +00:00
[Spring] Spotbugs static class and default encoding (#2609)
* add static modifier - mvn verify passes * specify charset, mvn verify works, compiles and clean on spotbugs in my project * update samples as per contribution guide; mvn integration-test passes * commit rest of samples * fix missing newline at EOF * lots of new newlines * needed to run mvn clean beforehand...
This commit is contained in:
parent
81f970e946
commit
b5ae21b090
@ -1,6 +1,7 @@
|
||||
package {{apiPackage}};
|
||||
|
||||
{{#reactive}}
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
@ -27,7 +28,7 @@ public class ApiUtil {
|
||||
{{/reactive}}
|
||||
{{#reactive}}
|
||||
public static Mono<Void> getExampleResponse(ServerWebExchange exchange, String example) {
|
||||
return exchange.getResponse().writeWith(Mono.just(new DefaultDataBufferFactory().wrap(example.getBytes())));
|
||||
return exchange.getResponse().writeWith(Mono.just(new DefaultDataBufferFactory().wrap(example.getBytes(StandardCharsets.UTF_8))));
|
||||
}
|
||||
{{/reactive}}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -1,11 +1,12 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
public class ApiUtil {
|
||||
public static Mono<Void> getExampleResponse(ServerWebExchange exchange, String example) {
|
||||
return exchange.getResponse().writeWith(Mono.just(new DefaultDataBufferFactory().wrap(example.getBytes())));
|
||||
return exchange.getResponse().writeWith(Mono.just(new DefaultDataBufferFactory().wrap(example.getBytes(StandardCharsets.UTF_8))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
@ -16,4 +16,4 @@ public class ApiUtil {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user