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 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.
*
@ -104,13 +109,13 @@ public class Page<ITEM_T> {
* @throws IllegalArgumentException when {@code totalCount} is negative
*/
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);
checkArgument(itemsBefore >= 0, "Required non-negative value of items before");
checkArgument(itemsBefore >= 0, nonNegativeValueOfItems);
this.itemsBefore = itemsBefore;
checkArgument(pageSize > 0, "Required positive value of page size");
checkArgument(pageSize > 0, positiveValueOfPageSize);
this.pageSize = pageSize;
checkArgument(totalCount >= 0, "Required non-negative value of total items");
checkArgument(totalCount >= 0, nonNegativeValueOfTotalItems);
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.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. */
public class EndpointIdConfigurator {
private static final Logger LOGGER = getLogger(EndpointIdConfigurator.class);
@ -40,8 +44,8 @@ public class EndpointIdConfigurator {
}
public MethodNameConfigurator endpointId(String id) {
checkNotNull(id, "Endpoint ID must not be null");
checkArgument(!id.isEmpty(), "Endpoint ID must not be empty");
checkNotNull(id, endpointIdMustNotBeNull);
checkArgument(!id.isEmpty(), endpointIdMustNotBeEmpty);
LOGGER.debug("Configuring outgoing request endpoint ID: " + id);

View File

@ -41,6 +41,8 @@ public class SendConfiguratorFromOne<P> {
private final P pValue;
private final String endpointId;
private static final String resultClassMustNotBeNull= "Result class value must not be null";
SendConfiguratorFromOne(
JsonRpcMarshaller marshaller,
ResponseDispatcher dispatcher,
@ -79,7 +81,7 @@ public class SendConfiguratorFromOne<P> {
public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto(
final Class<R> rClass, int timeoutInMillis) {
checkNotNull(rClass, "Result class value must not be null");
checkNotNull(rClass, resultClassMustNotBeNull);
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.eclipse.che.dto.generator.DtoGenerator;
/** Mojo to run {@link org.eclipse.che.dto.generator.DtoGenerator}. */
@Mojo(name = "generate", requiresDependencyResolution = ResolutionScope.COMPILE)
public class DtoGeneratorMojo extends AbstractMojo {
@ -38,10 +40,12 @@ public class DtoGeneratorMojo extends AbstractMojo {
@Parameter(property = "che.dto.skip", defaultValue = "false")
private boolean skip;
private static String skippingTheExecution= "Skipping the execution";
@Override
public void execute() throws MojoExecutionException {
if (skip) {
getLog().info("Skipping the execution");
getLog().info(skippingTheExecution);
return;
}

View File

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