pull/578/merge
DONGSIK2026KIM 2024-04-18 01:52:30 +02:00 committed by GitHub
commit a764af7696
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 9 deletions

View File

@ -91,6 +91,11 @@ public class Page<ITEM_T> {
private final long totalCount; private final long totalCount;
private final List<ITEM_T> items; private final List<ITEM_T> items;
final String nonNullItemsString = "Required non-null items";
final String nonNegativeValueOfItems = "Required non-negative value of items before";
final String positiveValueOfPageSize = "Required positive value of page size";
final String nonNegativeValueOfTotalItems = "Required non-negative value of total items";
/** /**
* Creates a new page. * Creates a new page.
* *
@ -104,13 +109,13 @@ public class Page<ITEM_T> {
* @throws IllegalArgumentException when {@code totalCount} is negative * @throws IllegalArgumentException when {@code totalCount} is negative
*/ */
public Page(Collection<? extends ITEM_T> items, long itemsBefore, int pageSize, long totalCount) { public Page(Collection<? extends ITEM_T> items, long itemsBefore, int pageSize, long totalCount) {
requireNonNull(items, "Required non-null items"); requireNonNull(items, nonNullItemsString);
this.items = new ArrayList<>(items); this.items = new ArrayList<>(items);
checkArgument(itemsBefore >= 0, "Required non-negative value of items before"); checkArgument(itemsBefore >= 0, nonNegativeValueOfItems);
this.itemsBefore = itemsBefore; this.itemsBefore = itemsBefore;
checkArgument(pageSize > 0, "Required positive value of page size"); checkArgument(pageSize > 0, positiveValueOfPageSize);
this.pageSize = pageSize; this.pageSize = pageSize;
checkArgument(totalCount >= 0, "Required non-negative value of total items"); checkArgument(totalCount >= 0, nonNegativeValueOfTotalItems);
this.totalCount = totalCount; this.totalCount = totalCount;
} }

View File

@ -21,6 +21,10 @@ import org.eclipse.che.api.core.jsonrpc.commons.ResponseDispatcher;
import org.eclipse.che.api.core.websocket.commons.WebSocketMessageTransmitter; import org.eclipse.che.api.core.websocket.commons.WebSocketMessageTransmitter;
import org.slf4j.Logger; import org.slf4j.Logger;
private static final String endpointIdMustNotBeNull = "Endpoint ID must not be null"
private static final String endpointIdMustNotBeEmpty = "Endpoint ID must not be empty"
/** Endpoint ID configurator to defined endpoint id that the request should be addressed to. */ /** Endpoint ID configurator to defined endpoint id that the request should be addressed to. */
public class EndpointIdConfigurator { public class EndpointIdConfigurator {
private static final Logger LOGGER = getLogger(EndpointIdConfigurator.class); private static final Logger LOGGER = getLogger(EndpointIdConfigurator.class);
@ -40,8 +44,8 @@ public class EndpointIdConfigurator {
} }
public MethodNameConfigurator endpointId(String id) { public MethodNameConfigurator endpointId(String id) {
checkNotNull(id, "Endpoint ID must not be null"); checkNotNull(id, endpointIdMustNotBeNull);
checkArgument(!id.isEmpty(), "Endpoint ID must not be empty"); checkArgument(!id.isEmpty(), endpointIdMustNotBeEmpty);
LOGGER.debug("Configuring outgoing request endpoint ID: " + id); LOGGER.debug("Configuring outgoing request endpoint ID: " + id);

View File

@ -41,6 +41,8 @@ public class SendConfiguratorFromOne<P> {
private final P pValue; private final P pValue;
private final String endpointId; private final String endpointId;
private static final String resultClassMustNotBeNull= "Result class value must not be null";
SendConfiguratorFromOne( SendConfiguratorFromOne(
JsonRpcMarshaller marshaller, JsonRpcMarshaller marshaller,
ResponseDispatcher dispatcher, ResponseDispatcher dispatcher,
@ -79,7 +81,7 @@ public class SendConfiguratorFromOne<P> {
public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto( public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto(
final Class<R> rClass, int timeoutInMillis) { final Class<R> rClass, int timeoutInMillis) {
checkNotNull(rClass, "Result class value must not be null"); checkNotNull(rClass, resultClassMustNotBeNull);
final String requestId = transmitRequest(); final String requestId = transmitRequest();

View File

@ -19,6 +19,8 @@ import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.plugins.annotations.ResolutionScope;
import org.eclipse.che.dto.generator.DtoGenerator; import org.eclipse.che.dto.generator.DtoGenerator;
/** Mojo to run {@link org.eclipse.che.dto.generator.DtoGenerator}. */ /** Mojo to run {@link org.eclipse.che.dto.generator.DtoGenerator}. */
@Mojo(name = "generate", requiresDependencyResolution = ResolutionScope.COMPILE) @Mojo(name = "generate", requiresDependencyResolution = ResolutionScope.COMPILE)
public class DtoGeneratorMojo extends AbstractMojo { public class DtoGeneratorMojo extends AbstractMojo {
@ -38,10 +40,12 @@ public class DtoGeneratorMojo extends AbstractMojo {
@Parameter(property = "che.dto.skip", defaultValue = "false") @Parameter(property = "che.dto.skip", defaultValue = "false")
private boolean skip; private boolean skip;
private static String skippingTheExecution= "Skipping the execution";
@Override @Override
public void execute() throws MojoExecutionException { public void execute() throws MojoExecutionException {
if (skip) { if (skip) {
getLog().info("Skipping the execution"); getLog().info(skippingTheExecution);
return; return;
} }

View File

@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
public class FileStoresMeterBinder implements MeterBinder { public class FileStoresMeterBinder implements MeterBinder {
private static final Logger LOG = LoggerFactory.getLogger(FileStoresMeterBinder.class); private static final Logger LOG = LoggerFactory.getLogger(FileStoresMeterBinder.class);
private static final String unallocatedSpaceForFileStorage = "Unallocated space for file storage"
@Override @Override
public void bindTo(MeterRegistry registry) { public void bindTo(MeterRegistry registry) {
@ -42,7 +43,7 @@ public class FileStoresMeterBinder implements MeterBinder {
Gauge.builder("disk.free", fileStore, exceptionToNonWrapper(FileStore::getUnallocatedSpace)) Gauge.builder("disk.free", fileStore, exceptionToNonWrapper(FileStore::getUnallocatedSpace))
.tags(tagsWithPath) .tags(tagsWithPath)
.description("Unallocated space for file storage") .description(unallocatedSpaceForFileStorage)
.baseUnit("bytes") .baseUnit("bytes")
.strongReference(true) .strongReference(true)
.register(registry); .register(registry);