auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Grid load(String gridFileName){ InputStream s = loader.getResourceAsStream(GRID_PATH + gridFileName); Reader reader = new InputStreamReader(s); try{ return gson.fromJson(reader, Grid.class); } catch (JsonSyntaxException ex){ <START> return null; <END> } }</code><technical_language>returning null is a good idea. blow higher in call stack, debugging headaches on</technical_language>

Target:
public Grid load(String gridFileName) throws CreateGridException { InputStream s = loader.getResourceAsStream(GRID_PATH + gridFileName); Reader reader = null; try { reader = new InputStreamReader(s); } catch (NullPointerException ex){ throw new CreateGridException( "Error loading grid: " + gridFileName + " does not exist" ); } try{ return gson.fromJson(reader, Grid.class); } catch (JsonSyntaxException ex){ throw new CreateGridException("Error loading grid: Invalid content."); } }
Source:
<code>public void testGetUserWithHostname() { URI endpoint = URI.create("<LINK_0>"); UserApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/user_get_withhost.json")).build() ).getUserApiForInstanceInZone("instanceId-1234-5678","RegionOne"); User user = api.get("example.user", "192.168.64.64"); <START> assertEquals(user.getName(), "exampleuser"); <END> assertEquals(user.getHost(), "192.168.64.64"); assertEquals(user.getIdentifier(), "exampleuser@192.168.64.64"); assertEquals(user.getDatabases().size(), 2); assertEquals(user.getDatabases().iterator().next(), "databaseA"); }</code><technical_language>curious, user.getName() example.user? strange api.get(name, host) returning a name</technical_language>

Target:
public void testGetUserWithHostname() { URI endpoint = URI.create("<LINK_0>"); UserApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/user_get_withhost.json")).build() ).getUserApiForInstanceInZone("instanceId-1234-5678","RegionOne"); User user = api.get("example.user", "192.168.64.64"); assertEquals(user.getName(), "example.user"); assertEquals(user.getHost(), "192.168.64.64"); assertEquals(user.getIdentifier(), "example.user@192.168.64.64"); assertEquals(user.getDatabases().size(), 2); assertEquals(user.getDatabases().iterator().next(), "databaseA"); }
Source:
<code>public Guid getQuotaId() { <START> return quotaId != null ? quotaId.getValue() : Guid.Empty; <END> }</code><technical_language>if quota object is set</technical_language>

Target:
public Guid getQuotaId() { return getQuotaIdRef() != null ? getQuotaIdRef().getValue() : Guid.Empty; }
Source:
<code>public <T> T getValue(final OGlobalConfiguration iConfig) { if (config != null && config.containsKey(iConfig.getKey())) <START> return (T) config.get(iConfig.getKey()); <END> return iConfig.getValue(); }</code><technical_language>Unchecked cast warning</technical_language>

Target:
public Object getValue(final OGlobalConfiguration iConfig) { if (config != null && config.containsKey(iConfig.getKey())) return config.get(iConfig.getKey()); return iConfig.getValue(); }
Source:
<code>public void maybeFlush() { <START> if(binder == null) { <END> return; } setEnabledOnChangeValidations(false); try { flushNestedForms(); BindableProxy<T> proxy = (BindableProxy<T>) getModel(); T model = proxy.deepUnwrap(); T backupModel = proxy.deepUnwrap(); binder.setModel(model, StateSync.FROM_UI, true); if (!validate()) { binder.setModel(backupModel, StateSync.FROM_MODEL, true); validate(); } } finally { setEnabledOnChangeValidations(true); } }</code><technical_language>minor: kiegrooup formatting</technical_language>

Target:
public void maybeFlush() { if (binder == null) { return; } setEnabledOnChangeValidations(false); flushNestedForms(); BindableProxy<T> proxy = (BindableProxy<T>) getModel(); T model = proxy.deepUnwrap(); T backupModel = proxy.deepUnwrap(); binder.setModel(model, StateSync.FROM_UI, true); if (!validate()) { binder.setModel(backupModel, StateSync.FROM_MODEL, true); validate(); } setEnabledOnChangeValidations(true); }
Source:
<code>private Block[] buildOutputBlocks(int batchSize) { Block[] outputBlocks = new Block[outputChannelCount]; int channel = 0; for (int replicateIndex = 0; replicateIndex < replicateTypes.size(); replicateIndex++) { outputBlocks[channel++] = replicatedBlockBuilders.get(replicateIndex).buildOutputBlock(maxEntries, currentPosition, batchSize, currentBatchTotalEntries); } for (int unnestIndex = 0; unnestIndex < unnesters.size(); unnestIndex++) { Unnester unnester = unnesters.get(unnestIndex); Block[] block = unnester.buildOutputBlocks(maxEntries, currentPosition, batchSize, currentBatchTotalEntries, unnesters.size()); for (int j = 0; j < unnester.getChannelCount(); j++) { outputBlocks[channel++] = block[j]; } } if (withOrdinality) { <START> outputBlocks[channel] = buildOutputBlock(maxEntries, currentPosition, batchSize, currentBatchTotalEntries); <END> } currentPosition += batchSize; return outputBlocks; }</code><technical_language>nit: Do static import it, decreases readability</technical_language>

Target:
private Block[] buildOutputBlocks(int batchSize) { Block[] outputBlocks = new Block[outputChannelCount]; int channel = 0; for (int replicateIndex = 0; replicateIndex < replicateTypes.size(); replicateIndex++) { outputBlocks[channel++] = replicatedBlockBuilders.get(replicateIndex).buildOutputBlock(maxLengths, currentPosition, batchSize, currentBatchTotalLength); } for (int unnestIndex = 0; unnestIndex < unnesters.size(); unnestIndex++) { Unnester unnester = unnesters.get(unnestIndex); Block[] block = unnester.buildOutputBlocks(maxLengths, currentPosition, batchSize, currentBatchTotalLength); for (int j = 0; j < unnester.getChannelCount(); j++) { outputBlocks[channel++] = block[j]; } } if (withOrdinality) { outputBlocks[channel] = buildOrdinalityOutputBlock(maxLengths, currentPosition, batchSize, currentBatchTotalLength); } currentPosition += batchSize; return outputBlocks; }
Source:
<code>public void create(String name, int size) { ChronicleLogAppender cq = ChronicleLogAppender.create(new File(basePath.toFile(), name), size, retentionDuration); try { cq.close(); <START> } catch (Exception e) { <END> throw new RuntimeException("Cannot create and close " + name, e); } }</code><technical_language>catch Exception</technical_language>

Target:
public void create(String name, int size) { ChronicleLogAppender.create(basePath.resolve(name).toFile(), size, retentionDuration).close(); }
Source:
<code>private DoubleMatrix getMatrixByEntityTypeId(String entityId) { <START> DoubleMatrix matrix = null; <END> Entity entity = dataService.findOneById(MatrixMetadata.PACKAGE + "_" + MatrixMetadata.SIMPLE_NAME, entityId); if (entity != null) { return getMatrix(entityId, entity); } else { throw new MolgenisDataException("Unknown Matrix Metadata EntityID [" + entityId + "]"); } }</code><technical_language>Variable is</technical_language>

Target:
private DoubleMatrix getMatrixByEntityTypeId(String entityId) { Entity entity = dataService.findOneById(MatrixMetadata.PACKAGE + "_" + MatrixMetadata.SIMPLE_NAME, entityId); if (entity != null) { return getMatrix(entity); } else { throw new MolgenisDataException("Unknown Matrix Metadata EntityID [" + entityId + "]"); } }
Source:
<code>protected void provideModelInferrerConfiguration() { EMFPatternLanguageGeneratorConfig config = new EMFPatternLanguageGeneratorConfig(); if (useEclipseGeneratorPreferences && propertiesFileLocation != null) { File f = new File(propertiesFileLocation); if (f.canRead()) { Properties vqlCompilerSettings = new Properties(); try { vqlCompilerSettings.load(new FileInputStream(f)); String matcherGenerationProp = vqlCompilerSettings.getProperty("generateMatchers", MatcherGenerationStrategy.defaultValue().toString()); try { config.setMatcherGenerationStrategy(MatcherGenerationStrategy.valueOf(matcherGenerationProp)); } catch (IllegalArgumentException e) { getLog().warn("Invalid matcher generation strategy " + matcherGenerationProp + "; using default value instead"); } String generateProcessorProp = vqlCompilerSettings.getProperty("generateMatchProcessors", "true"); config.setGenerateMatchProcessors(Boolean.valueOf(generateProcessorProp)); } catch (IOException e) { getLog().warn(e); } } else { getLog().info( <START> "Can't find Xtend properties under " + propertiesFileLocation + ", maven defaults are used."); <END> config.setMatcherGenerationStrategy(matcherGeneration); config.setGenerateMatchProcessors(generateMatchProcessors); } } else { config.setMatcherGenerationStrategy(matcherGeneration); config.setGenerateMatchProcessors(generateMatchProcessors); } MavenGeneratorConfigProvider.setGeneratorConfig(config); }</code><technical_language>Message incorrect</technical_language>

Target:
protected void provideModelInferrerConfiguration() { EMFPatternLanguageGeneratorConfig config = new EMFPatternLanguageGeneratorConfig(); if (useEclipseGeneratorPreferences && propertiesFileLocation != null) { File f = new File(propertiesFileLocation); if (f.canRead()) { Properties vqlCompilerSettings = new Properties(); try { vqlCompilerSettings.load(new FileInputStream(f)); String matcherGenerationProp = vqlCompilerSettings.getProperty("generateMatchers", MatcherGenerationStrategy.defaultValue().toString()); try { config.setMatcherGenerationStrategy(MatcherGenerationStrategy.valueOf(matcherGenerationProp)); } catch (IllegalArgumentException e) { getLog().warn("Invalid matcher generation strategy " + matcherGenerationProp + "; using default value instead"); } String generateProcessorProp = vqlCompilerSettings.getProperty("generateMatchProcessors", "true"); config.setGenerateMatchProcessors(Boolean.valueOf(generateProcessorProp)); } catch (IOException e) { getLog().warn(e); } } else { getLog().info( "Can't find VIATRA Generator properties under " + propertiesFileLocation + ", maven defaults are used."); config.setMatcherGenerationStrategy(matcherGeneration); config.setGenerateMatchProcessors(generateMatchProcessors); } } else { config.setMatcherGenerationStrategy(matcherGeneration); config.setGenerateMatchProcessors(generateMatchProcessors); } MavenGeneratorConfigProvider.setGeneratorConfig(config); }
Source:
<code>private void ingestChildren(ContentContainerObject destObj, Resource parentResc) throws DepositException, IOException { NodeIterator iterator = getChildIterator(parentResc); if (iterator == null) { return; } try { ContentObject obj = null; while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); if (childResc.hasProperty(RDF.type, Cdr.Folder)) { obj = ingestFolder(destObj, parentResc, childResc); } else if (childResc.hasProperty(RDF.type, Cdr.Work)) { obj = ingestWork(destObj, parentResc, childResc); } else if (childResc.hasProperty(RDF.type, Cdr.FileObject)) { if (destObj instanceof WorkObject) { obj = ingestFileObject(destObj, parentResc, childResc); } else { obj= ingestFileObjectAsWork(destObj, parentResc, childResc); } } if (obj != null) { <START> addIngestionEventForChild(obj); <END> addPremisEvents(obj); } } } finally { iterator.close(); } }</code><technical_language>I appreciate centralized code of this approach, i is result in premis events added for objects addPremisEvents is called reads file. hard this approach a larger code change</technical_language>

Target:
private void ingestChildren(ContentContainerObject destObj, Resource parentResc) throws DepositException, IOException { NodeIterator iterator = getChildIterator(parentResc); if (iterator == null) { return; } try { while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); if (childResc.hasProperty(RDF.type, Cdr.Folder)) { ingestFolder(destObj, parentResc, childResc); } else if (childResc.hasProperty(RDF.type, Cdr.Work)) { ingestWork(destObj, parentResc, childResc); } else if (childResc.hasProperty(RDF.type, Cdr.FileObject)) { if (destObj instanceof WorkObject) { ingestFileObject(destObj, parentResc, childResc); } else { ingestFileObjectAsWork(destObj, parentResc, childResc); } } } } finally { iterator.close(); } }
Source:
<code><START> public static IValidator locateValidator(final Class<? extends Question> questionType) { <END> if (!Question.class.isAssignableFrom(questionType)) { return null; } if (questionType.isAnnotationPresent(ValidatesWith.class)) { log.debug("Validator for question validation found. Using : " + questionType.getAnnotation(ValidatesWith.class).value()); Injector injector = IsaacApplicationRegister.injector; return injector.getInstance(questionType.getAnnotation(ValidatesWith.class).value()); } else if (questionType.equals(Question.class)) { return null; } return locateValidator((Class<? extends Question>) questionType.getSuperclass()); }</code><technical_language>I @sacummins pronounce this, changes encapsulation of functionality</technical_language>

Target:
private static IValidator locateValidator(final Class<? extends Question> questionType) { if (!Question.class.isAssignableFrom(questionType)) { return null; } if (questionType.isAnnotationPresent(ValidatesWith.class)) { log.debug("Validator for question validation found. Using : " + questionType.getAnnotation(ValidatesWith.class).value()); Injector injector = IsaacApplicationRegister.injector; return injector.getInstance(questionType.getAnnotation(ValidatesWith.class).value()); } else if (questionType.equals(Question.class)) { return null; } return locateValidator((Class<? extends Question>) questionType.getSuperclass()); }
Source:
<code>public void postCollectionSubmittersGroupCreateSubmittersGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); <START> <END> }</code><technical_language>double check group created</technical_language>

Target:
public void postCollectionSubmittersGroupCreateSubmittersGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isNoContent()); }
Source:
<code>public UsageReporter() { <START> s_instance = this; <END> }</code><technical_language>A public (instance) constructor writes a static variable. I constructor private assign static getInstance(). check for null assign if needed return existing object. public static UsageReporter getInstance(Map<String, String> configs) { if (s_instance == null) { s_instance = new UsageReporter(); //make is private called s_instance.init(configs); } return s_instance; }</technical_language>

Target:
private UsageReporter() { s_instance = this; }
Source:
<code>private static void googleDelete(final URL url) throws IOException { final HttpURLConnection connection = setupUrlConnection(DELETE, url, false, Collections.emptyMap()); final int responseCode = connection.getResponseCode(); if (responseCode < 200 || responseCode > 299) { final InputStream stream = connection.getErrorStream(); final String response = CharStreams.toString(new InputStreamReader(stream, URL_ENCODING)); stream.close(); logger.error("Received unexpected response from Google Cloud Storage. Response status code: {}. Response body: {}", responseCode, response); throw new IOException("Received unexpected response from Google Cloud Storage."); } else { final InputStream stream = connection.getInputStream(); <START> while (stream.read() != -1) <END> } }</code><technical_language>Guava a nice ByteStreams.exhaust(stream) for this. (Then need for PMD suppression.)</technical_language>

Target:
private static void googleDelete(final URL url) throws IOException { final HttpURLConnection connection = setupUrlConnection(DELETE, url, false, Collections.emptyMap()); throwIOExceptionOnErrorResponse(connection); final InputStream stream = connection.getInputStream(); ByteStreams.exhaust(stream); }
Source:
<code>public CompletableFuture<Void> mergeRegions(List<byte[]> nameOfRegionsToMerge, boolean forcible) { if (nameOfRegionsToMerge.size() < 2) { return failedFuture(new IllegalArgumentException( "Can not merge only " + nameOfRegionsToMerge.size() + " region")); } CompletableFuture<Void> future = new CompletableFuture<>(); byte[][] encodedNameOfRegionsToMerge = nameOfRegionsToMerge.stream().map(this::toEncodeRegionName).toArray(byte[][]::new); addListener(checkRegionsAndGetTableName(encodedNameOfRegionsToMerge), (tableName, err) -> { if (err != null) { future.completeExceptionally(err); return; } <START> MergeTableRegionsRequest request; <END> try { request = RequestConverter.buildMergeTableRegionsRequest(encodedNameOfRegionsToMerge, forcible, ng.getNonceGroup(), ng.newNonce()); } catch (DeserializationException e) { future.completeExceptionally(e); return; } addListener( this.<MergeTableRegionsRequest, MergeTableRegionsResponse> procedureCall(tableName, request, (s, c, req, done) -> s.mergeTableRegions(c, req, done), (resp) -> resp.getProcId(), new MergeTableRegionProcedureBiConsumer(tableName)), (ret, err2) -> { if (err2 != null) { future.completeExceptionally(err2); } else { future.complete(ret); } }); }); return future; }</code><technical_language>this final well</technical_language>

Target:
public CompletableFuture<Void> mergeRegions(List<byte[]> nameOfRegionsToMerge, boolean forcible) { if (nameOfRegionsToMerge.size() < 2) { return failedFuture(new IllegalArgumentException( "Can not merge only " + nameOfRegionsToMerge.size() + " region")); } CompletableFuture<Void> future = new CompletableFuture<>(); byte[][] encodedNameOfRegionsToMerge = nameOfRegionsToMerge.stream().map(this::toEncodeRegionName).toArray(byte[][]::new); addListener(checkRegionsAndGetTableName(encodedNameOfRegionsToMerge), (tableName, err) -> { if (err != null) { future.completeExceptionally(err); return; } final MergeTableRegionsRequest request; try { request = RequestConverter.buildMergeTableRegionsRequest(encodedNameOfRegionsToMerge, forcible, ng.getNonceGroup(), ng.newNonce()); } catch (DeserializationException e) { future.completeExceptionally(e); return; } addListener( this.procedureCall(tableName, request, MasterService.Interface::mergeTableRegions, MergeTableRegionsResponse::getProcId, new MergeTableRegionProcedureBiConsumer(tableName)), (ret, err2) -> { if (err2 != null) { future.completeExceptionally(err2); } else { future.complete(ret); } }); }); return future; }
Source:
<code>public static GCRule buildGarbageCollectionRule(HColumnDescriptor columnDescriptor) { int maxVersions = columnDescriptor.getMaxVersions(); int minVersions = columnDescriptor.getMinVersions(); int ttlSeconds = columnDescriptor.getTimeToLive(); Preconditions.checkState(minVersions < maxVersions, "HColumnDescriptor min versions must be less than max versions."); if (ttlSeconds == HColumnDescriptor.DEFAULT_TTL) { if (maxVersions == Integer.MAX_VALUE) { return null; } else { return GCRULES.maxVersions(maxVersions); } } <START> GCRule ageRule = GCRULES.maxAge(org.threeten.bp.Duration.ofSeconds(ttlSeconds)); <END> if (minVersions != HColumnDescriptor.DEFAULT_MIN_VERSIONS) { ageRule = GCRULES.intersection().rule(ageRule).rule(GCRULES.maxVersions(minVersions)); } if (maxVersions == Integer.MAX_VALUE) { return ageRule; } else { return GCRULES.union().rule(ageRule).rule(GCRULES.maxVersions(maxVersions)); } }</code><technical_language>remove unused methods, able remove conflicting Duration import import this instead</technical_language>

Target:
public static GCRule buildGarbageCollectionRule(HColumnDescriptor columnDescriptor) { int maxVersions = columnDescriptor.getMaxVersions(); int minVersions = columnDescriptor.getMinVersions(); int ttlSeconds = columnDescriptor.getTimeToLive(); Preconditions.checkState(minVersions < maxVersions, "HColumnDescriptor min versions must be less than max versions."); if (ttlSeconds == HColumnDescriptor.DEFAULT_TTL) { if (maxVersions == Integer.MAX_VALUE) { return null; } else { return GCRULES.maxVersions(maxVersions); } } GCRule ageRule = GCRULES.maxAge(Duration.ofSeconds(ttlSeconds)); if (minVersions != HColumnDescriptor.DEFAULT_MIN_VERSIONS) { ageRule = GCRULES.intersection().rule(ageRule).rule(GCRULES.maxVersions(minVersions)); } if (maxVersions == Integer.MAX_VALUE) { return ageRule; } else { return GCRULES.union().rule(ageRule).rule(GCRULES.maxVersions(maxVersions)); } }
Source:
<code>private Server createAndStartServer(int port, HandlerList handlers, Audience audience) throws Exception { Server server = null; int tryPort = -1; int retry = 0; try { tryPort = (port <= 0) ? ServerHelper.getAvailablePort() : port; LOGGER.info("Trying port {}", tryPort); server = new Server(tryPort); server.setHandler(handlers); server.setStopAtShutdown(true); server.start(); jettyConfig.setPort(audience, tryPort); LOGGER.info("Jetty started on port ({})", tryPort, audience); } catch (Exception ex) { ++retry; <START> LOGGER.info("Tried port but failed to start server", tryPort); <END> if (retry > 5) { throw ex; } } return server; }</code><technical_language>I missing loop here. retry mechanism is a quick & easy read solution for recurring issue of re-attempts. In this case however, solution if jetty port allocation, support that, sadly. a race condition ServerHelper.getAvailablePort() server.start()</technical_language>

Target:
private Server createAndStartServer(int port, HandlerList handlers, Audience audience) throws Exception { int retryIterations = 5; Server server = null; int tryPort = (port <= 0) ? 0 : port; int retry = 0; int listeningPort = 0; while (listeningPort == 0) { try { LOGGER.info("Attempting to start Jetty on port ({})", tryPort, audience); server = new Server(tryPort); server.setHandler(handlers); server.setStopAtShutdown(true); server.start(); listeningPort = server.getConnectors()[0].getLocalPort(); jettyConfig.setPort(audience, listeningPort); LOGGER.info("Jetty started on port ({})", listeningPort, audience); } catch (Exception ex) { if (tryPort == 0) { retry = retryIterations; } ++retry; LOGGER.info("Tried port ({}) but failed to start server", tryPort, audience); if (retry > retryIterations) { throw ex; } } } return server; }
Source:
<code>private void executeCommand(ChannelHandlerContext ctx, Command command) throws Exception { if (isAuthenticated) { if (command.isOfType(RedisCommandType.SHUTDOWN)) { this.server.shutdown(); return; } if (hasTransaction() && !command.isTransactional()) { executeWithTransaction(ctx, command); } else { executeWithoutTransaction(command); } if (logger.isDebugEnabled() && command.getResponse() != null) { <START> ByteBuf response = command.getResponse() <END> .copy(0, Math.min(command.getResponse().readableBytes(), 100)); logger.debug("Redis command returned: {}", getPrintableByteBuf(response)); response.release(); } if (hasTransaction() && command.isOfType(RedisCommandType.MULTI)) { writeToChannel( Coder.getSimpleStringResponse(this.byteBufAllocator, RedisConstants.COMMAND_QUEUED)); } else { if (command.getCommandType() != RedisCommandType.PUBLISH) { ByteBuf response = command.getResponse(); writeToChannel(response); } } } else if (command.isOfType(RedisCommandType.QUIT)) { command.execute(this); ByteBuf response = command.getResponse(); writeToChannel(response); channelInactive(ctx); } else if (command.isOfType(RedisCommandType.AUTH)) { command.execute(this); ByteBuf response = command.getResponse(); writeToChannel(response); } else { ByteBuf r = Coder.getNoAuthResponse(this.byteBufAllocator, RedisConstants.ERROR_NOT_AUTH); writeToChannel(r); } }</code><technical_language>this copy call release call lines moved getPrintableByteBuf? this block moved a method named "logResponse(command)". "release" call in a "finally" block in case exception is thrown</technical_language>

Target:
private void executeCommand(ChannelHandlerContext ctx, Command command) throws Exception { if (isAuthenticated) { if (command.isOfType(RedisCommandType.SHUTDOWN)) { this.server.shutdown(); return; } if (hasTransaction() && !command.isTransactional()) { executeWithTransaction(ctx, command); } else { executeWithoutTransaction(command); } logResponse(command); if (hasTransaction() && command.isOfType(RedisCommandType.MULTI)) { writeToChannel( Coder.getSimpleStringResponse(this.byteBufAllocator, RedisConstants.COMMAND_QUEUED)); } else { if (command.getCommandType() != RedisCommandType.PUBLISH) { ByteBuf response = command.getResponse(); writeToChannel(response); } } } else if (command.isOfType(RedisCommandType.QUIT)) { command.execute(this); ByteBuf response = command.getResponse(); writeToChannel(response); channelInactive(ctx); } else if (command.isOfType(RedisCommandType.AUTH)) { command.execute(this); ByteBuf response = command.getResponse(); writeToChannel(response); } else { ByteBuf r = Coder.getNoAuthResponse(this.byteBufAllocator, RedisConstants.ERROR_NOT_AUTH); writeToChannel(r); } }
Source:
<code>private boolean allowedConstructor(final Constructor<?> constructor, final List<String> classNames) { final Class<?>[] parameterTypes = constructor.getParameterTypes(); if (typeNames(parameterTypes).equals(classNames)) return true; if (parameterTypes.length != classNames.size()) return false; for (int i = 0; i < parameterTypes.length; i++) { final Class<?> parameterType = parameterTypes[i]; final String className = classNames.get(i); if (parameterType.isPrimitive() && !primitiveTypes.getWrapper(parameterType).getName().equals(className)) { return false; <START> } else if (!parameterType.isPrimitive() && !parameterType.isAssignableFrom(toClassForName(className))) { <END> return false; } } return true; }</code><technical_language>Good change! I of supported in primitiveTypes wrapper logic wrapper types</technical_language>

Target:
private boolean allowedConstructor(final Constructor<?> constructor, final List<String> classNames) { final Class<?>[] parameterTypes = constructor.getParameterTypes(); if (typeNames(parameterTypes).equals(classNames)) return true; if (parameterTypes.length != classNames.size()) return false; for (int i = 0; i < parameterTypes.length; i++) { final Class<?> parameterType = parameterTypes[i]; final Class<?> resultSetType = toClassForName(classNames.get(i)); boolean matches = parameterType.isPrimitive() ? primitiveTypes.matchesWithWrapperType(parameterType, resultSetType) : parameterType.isAssignableFrom(resultSetType); if (!matches) { return false; } } return true; }
Source:
<code>public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) { <START> Optional<Limiter.Listener> listener = limiter.acquire(exchange); <END> if (!listener.isPresent()) { exchange.getResponse().setStatusCode(HttpStatus.TOO_MANY_REQUESTS); return exchange.getResponse().setComplete(); } return chain.filter(exchange) .doOnSuccess(v -> listener.get().onSuccess()) .doOnError(throwable -> listener.get().onIgnore()); }</code><technical_language>want code functional style need call isPresent() multiple times. return limiter.acquire(exchange) .map(listener -> chain.filter(exchange) .doOnSuccess(v -> listener.onSuccess()) .doOnError(throwable -> listener.onIgnore())) .orElseGet(() -> { exchange.getResponse().setStatusCode(HttpStatus.TOO_MANY_REQUESTS); //TODO: set body return exchange.getResponse().setComplete(); });</technical_language>

Target:
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) { return limiter.acquire(exchange) .map(listener -> chain.filter(exchange) .doOnSuccess(v -> listener.onSuccess()) .doOnError(throwable -> listener.onIgnore())) .orElseGet(() -> { exchange.getResponse().setStatusCode(HttpStatus.TOO_MANY_REQUESTS); return exchange.getResponse().setComplete(); }); }
Source:
<code>BiConsumer<ObjectOutput, Object> findWriter(Object obj) { Class<?> clazz = obj.getClass(); AdvancedExternalizer internalExt = internalExts.get(clazz); if (internalExt != null) return (out, object) -> { writeInternalClean(object, internalExt, out); }; AdvancedExternalizer externalExt = externalExts.get(clazz); if (externalExt != null) return (out, object) -> { <START> writeExternalClean(object, externalExt, out); <END> }; return null; }</code><technical_language>reduced a single line lambda</technical_language>

Target:
BiConsumer<ObjectOutput, Object> findWriter(Object obj) { Class<?> clazz = obj.getClass(); AdvancedExternalizer internalExt = internalExts.get(clazz); if (internalExt != null) return (out, object) -> { writeInternalClean(object, internalExt, out); }; AdvancedExternalizer externalExt = externalExts.get(clazz); if (externalExt != null) return (out, object) -> writeExternalClean(object, externalExt, out); return null; }
Source:
<code>static boolean waitForTcp(final String host, final int port, final int connTimeoutMs, final long overallTimeoutMs) { final long timestamp = System.currentTimeMillis(); final SocketAddress sa = new java.net.InetSocketAddress(host, port); while (System.currentTimeMillis() - timestamp < overallTimeoutMs) { try (final Socket socket = new Socket()) { socket.connect(sa, connTimeoutMs); socket.shutdownInput(); socket.shutdownOutput(); return true; } catch (IOException e) { LOGGER.fine(String.format("waitForTcp: %s:%d", host, port)); } try { Thread.sleep(1000); } catch (InterruptedException e) { <START> LOGGER.fine(String.format("waitForTcp: %s", e.getMessage())); <END> } } return false; }</code><technical_language>if interrupted rethrown a good practice flag set thread Thread.currentThread().interrupt(); _I'm write this request other places included_</technical_language>

Target:
static boolean waitForTcp(final String host, final int port, final int connTimeoutMs, final long overallTimeoutMs) { final long timestamp = System.currentTimeMillis(); final SocketAddress sa = new java.net.InetSocketAddress(host, port); while (System.currentTimeMillis() - timestamp < overallTimeoutMs) { try (final Socket socket = new Socket()) { socket.connect(sa, connTimeoutMs); socket.shutdownInput(); socket.shutdownOutput(); return true; } catch (IOException e) { LOGGER.fine(String.format("waitForTcp: %s:%d", host, port)); } try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOGGER.log(Level.FINE, "waitForTcp interrupted.", e); } } return false; }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <START> EventBus.getDefault().register(this); <END> segIO.trackScreenView(courseData.getCourse().getName() + " - Handouts"); }</code><technical_language>event bus registered onViewCreated(), unregistered in onDestroyView() interact views in callback</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); segIO.trackScreenView(courseData.getCourse().getName() + " - Handouts"); }
Source:
<code>public void removeMember(PerunSession sess, Group group, Member member) throws InternalErrorException, MemberNotExistsException, NotGroupMemberException, PrivilegeException, GroupNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, group); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, group) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, group)) { throw new PrivilegeException(sess, "removeMember"); } Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME); <START> if (Objects.equals("true", (String) attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) { <END> throw new ExternallyManagedException("Removing of member is not allowed. Group is externally managed."); } getGroupsManagerBl().removeMember(sess, group, member); }</code><technical_language>suggestion if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) {</technical_language>

Target:
public void removeMember(PerunSession sess, Group group, Member member) throws InternalErrorException, MemberNotExistsException, NotGroupMemberException, PrivilegeException, GroupNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, group); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, group) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, group)) { throw new PrivilegeException(sess, "removeMember"); } Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME); if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) { throw new ExternallyManagedException("Removing of member is not allowed. Group is externally managed."); } getGroupsManagerBl().removeMember(sess, group, member); }
Source:
<code>private void showAlertDialog() { CustomAlertDialogBuilder stripAlertDialog = new CustomAlertDialogBuilder(getActivity()); <START> stripAlertDialog.setTitle(getResources().getString(R.string.title_alert_strip)). <END> setMessage(R.string.alert_strip).setCancelable(true); stripAlertDialog.setPositiveButton(R.string.strip, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { sendMessageToHandler(MESSAGE_STRIP, null); } }); stripAlertDialog.setNegativeButton(R.string.btn_do_not_save, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dismiss(); } }); stripAlertDialog.show(); }</code><technical_language>setTitle a version resource id directly, setMessage</technical_language>

Target:
private void showAlertDialog() { CustomAlertDialogBuilder stripAlertDialog = new CustomAlertDialogBuilder(getActivity()); stripAlertDialog.setTitle(R.string.title_alert_strip). setMessage(R.string.alert_strip).setCancelable(true); stripAlertDialog.setPositiveButton(R.string.strip, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { sendMessageToHandler(MESSAGE_STRIP, null); } }); stripAlertDialog.setNegativeButton(R.string.btn_do_not_save, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dismiss(); } }); stripAlertDialog.show(); }
Source:
<code>protected boolean isDiverseBusiness(PaymentWorksVendor pmwVendor) { if (paymentWorksFormModeService.shouldUseLegacyFormProcessingMode()) { return pmwVendor.isDiverseBusiness(); } else if (paymentWorksFormModeService.shouldUseForeignFormProcessingMode()) { return pmwVendor.isDiverseBusiness() || <START> StringUtils.isNotBlank(pmwVendor.getFederalDivsersityClassifications()) || StringUtils.isNotBlank(pmwVendor.getStateDivsersityClassifications()); <END> } else { throw new IllegalStateException("invalid form mode service"); } }</code><technical_language>PaymentWorksVendor class some pre-existing typos in diversity classification property names (as in supplier diversity service). If fixing names is scope of this PR, please create a separate user story get fixed</technical_language>

Target:
protected boolean isDiverseBusiness(PaymentWorksVendor pmwVendor) { if (paymentWorksFormModeService.shouldUseLegacyFormProcessingMode()) { return pmwVendor.isDiverseBusiness(); } else if (paymentWorksFormModeService.shouldUseForeignFormProcessingMode()) { return pmwVendor.isDiverseBusiness() || StringUtils.isNotBlank(pmwVendor.getFederalDiversityClassifications()) || StringUtils.isNotBlank(pmwVendor.getStateDiversityClassifications()); } else { throw new IllegalStateException("invalid form mode service"); } }
Source:
<code>public void sendGetMembersRequest(String cluster_name, Promise promise, boolean returnViewsOnly) throws Exception { clusterName = cluster_name; DiscoveryKey key = new DiscoveryKey(testName, clusterName); Map<Address, Discovery> discoveries = all.get(key); if (discoveries == null) { discoveries = new HashMap<Address, Discovery>(); Map ret = all.putIfAbsent(key, discoveries); if (ret != null) discoveries = ret; } if (log.isTraceEnabled()) <START> log.trace(String.format("Discoveries for %s are : ", key, discoveries)); <END> if (!discoveries.containsKey(local_addr)) { discoveries.put(local_addr, this); if (log.isTraceEnabled()) log.trace(String.format( "Add discovery for %s to cache. The cache now contains: %s", local_addr, discoveries)); } if (discard == null || !discard.isDiscardAll()) { Message msg = createGetMbrsReqMsg(clusterName, returnViewsOnly); if (!discoveries.isEmpty()) { for (Discovery discovery : discoveries.values()) { if (discovery != this) { discovery.up(new Event(Event.MSG, msg)); } } } else { log.debug("No other nodes yet, so skip sending get-members request"); } } else if (discard != null && discard.isDiscardAll()) { log.debug("Not sending discovery because DISCARD is on"); } }</code><technical_language>"discoveries" parameter is appended log message, a "%s" is missing</technical_language>

Target:
public void sendGetMembersRequest(String cluster_name, Promise promise, boolean returnViewsOnly) throws Exception { clusterName = cluster_name; DiscoveryKey key = new DiscoveryKey(testName, clusterName); Map<Address, Discovery> discoveries = all.get(key); if (discoveries == null) { discoveries = new HashMap<Address, Discovery>(); Map ret = all.putIfAbsent(key, discoveries); if (ret != null) discoveries = ret; } if (log.isTraceEnabled()) log.trace(String.format("Discoveries for %s are : %s", key, discoveries)); if (!discoveries.containsKey(local_addr)) { discoveries.put(local_addr, this); if (log.isTraceEnabled()) log.trace(String.format( "Add discovery for %s to cache. The cache now contains: %s", local_addr, discoveries)); } if (discard == null || !discard.isDiscardAll()) { Message msg = createGetMbrsReqMsg(clusterName, returnViewsOnly); if (!discoveries.isEmpty()) { for (Discovery discovery : discoveries.values()) { if (discovery != this) { discovery.up(new Event(Event.MSG, msg)); } } } else { log.debug("No other nodes yet, so skip sending get-members request"); } } else if (discard != null && discard.isDiscardAll()) { log.debug("Not sending discovery because DISCARD is on"); } }
Source:
<code>private void startDimmerThread(GroupAddress destination, String item, Command type) { <START> logger.trace("Starting new dimmer thread for item " + item + "."); <END> DimmerThread dimmerThread = new DimmerThread(destination, item, type); itemDimmerThreads.put(item, dimmerThread); dimmerThread.start(); }</code><technical_language>parameterized logging here</technical_language>

Target:
private void startDimmerThread(GroupAddress destination, String item, Command type) { logger.trace("Starting new dimmer thread for item {}.", item); DimmerThread dimmerThread = new DimmerThread(destination, item, type); itemDimmerThreads.put(item, dimmerThread); dimmerThread.start(); }
Source:
<code>private Integer calculateKafkaPartitionCount(final EventTypeStatistics stat) { if (null == stat) { return settings.getDefaultTopicPartitionCount(); } final int maxPartitionsDueParallelism = Math.max(stat.getReadParallelism(), stat.getWriteParallelism()); if (maxPartitionsDueParallelism >= settings.getMaxTopicPartitionCount()) { return settings.getMaxTopicPartitionCount(); } <START> return Math.min(8, Math.max( <END> maxPartitionsDueParallelism, calculatePartitionsAccordingLoad(stat.getExpectedWriteRate(), stat.getMessageSize()))); }</code><technical_language>lines 365-368 redundant? java private Integer calculateKafkaPartitionCount(final EventTypeStatistics stat) { if (null == stat) { return settings.getDefaultTopicPartitionCount(); } final int maxPartitionsDueParallelism = Math.max(stat.getReadParallelism(), stat.getWriteParallelism()); return Math.min(settings.getMaxTopicPartitionCount(), Math.max( maxPartitionsDueParallelism, calculatePartitionsAccordingLoad(stat.getExpectedWriteRate(), stat.getMessageSize())));</technical_language>

Target:
private Integer calculateKafkaPartitionCount(final EventTypeStatistics stat) { if (null == stat) { return settings.getDefaultTopicPartitionCount(); } final int maxPartitionsDueParallelism = Math.max(stat.getReadParallelism(), stat.getWriteParallelism()); if (maxPartitionsDueParallelism >= settings.getMaxTopicPartitionCount()) { return settings.getMaxTopicPartitionCount(); } return Math.min(settings.getMaxTopicPartitionCount(), Math.max( maxPartitionsDueParallelism, calculatePartitionsAccordingLoad(stat.getMessagesPerMinute(), stat.getMessageSize()))); }
Source:
<code>public int read() throws IOException { if (!open) { throw new ClosedChannelException(); } final MantaObjectInputStream stream = connectOrGetResponse(); final int read = stream.read(); if (read > -1) { <START> position++; <END> } return read; }</code><technical_language>This class is intended threadsafe, right? This need a CAS atomic long then</technical_language>

Target:
public int read() throws IOException { if (!open) { throw new ClosedChannelException(); } final MantaObjectInputStream stream = connectOrGetResponse(); final int read = stream.read(); if (read > -1) { position.incrementAndGet(); } return read; }
Source:
<code>protected Map<String, List<String>> getRequestParameters(String state) { Map<String, List<String>> params = new HashMap<>(); if (!(state == null || state.isEmpty())) { String decodedState; try { decodedState = URLDecoder.decode(state, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage(), e); } for (String pair : decodedState.split("&")) { if (!pair.isEmpty()) { String name; String value; int eq = pair.indexOf('='); if (eq < 0) { name = pair; value = ""; } else { name = pair.substring(0, eq); value = pair.substring(eq + 1); } <START> List<String> l = params.get(name); <END> if (l == null) { l = new ArrayList<>(); params.put(name, l); } l.add(value); } } } return params; }</code><technical_language>change name of this list 'l'</technical_language>

Target:
protected Map<String, List<String>> getRequestParameters(String state) { Map<String, List<String>> params = new HashMap<>(); if (!(state == null || state.isEmpty())) { String decodedState; try { decodedState = URLDecoder.decode(state, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage(), e); } for (String pair : decodedState.split("&")) { if (!pair.isEmpty()) { String name; String value; int eq = pair.indexOf('='); if (eq < 0) { name = pair; value = ""; } else { name = pair.substring(0, eq); value = pair.substring(eq + 1); } List<String> paramValues = params.get(name); if (paramValues == null) { paramValues = new ArrayList<>(); params.put(name, paramValues); } paramValues.add(value); } } } return params; }
Source:
<code>public void testTemporalCompactionNoCompactionAcrossDays() throws Exception { <START> DateTimeZone localTimeZone = DateTimeZone.forTimeZone(TimeZone.getTimeZone("PST")); <END> long today = Duration.ofNanos(System.nanoTime()).toDays(); long startOfDay1 = localTimeZone.convertLocalToUTC(Duration.ofDays(today).toMillis(), false); long startOfDay2 = localTimeZone.convertLocalToUTC(Duration.ofDays(today + 1).toMillis(), false); long startOfDay3 = localTimeZone.convertLocalToUTC(Duration.ofDays(today + 2).toMillis(), false); List<ShardIndexInfo> inputShards = ImmutableList.of( shardWithTemporalRange(TIMESTAMP, startOfDay1, startOfDay2 - 100), shardWithTemporalRange(TIMESTAMP, startOfDay1, startOfDay1), shardWithTemporalRange(TIMESTAMP, startOfDay2, startOfDay3 - 100), shardWithTemporalRange(TIMESTAMP, startOfDay2, startOfDay2 + 100), shardWithTemporalRange(TIMESTAMP, startOfDay2, startOfDay2), shardWithTemporalRange(TIMESTAMP, startOfDay3, startOfDay3)); Set<OrganizationSet> actual = compactionSetCreator.createCompactionSets(temporalTableInfo, inputShards); assertEquals(actual.size(), 2); Set<OrganizationSet> expected = ImmutableSet.of( new OrganizationSet(temporalTableInfo.getTableId(), extractIndexes(inputShards, 0, 1), OptionalInt.empty()), new OrganizationSet(temporalTableInfo.getTableId(), extractIndexes(inputShards, 2, 3, 4), OptionalInt.empty())); assertEquals(actual, expected); }</code><technical_language>this need match time zone create CompactionSetCreator? If so, a constant</technical_language>

Target:
public void testTemporalCompactionNoCompactionAcrossDays() throws Exception { long day1 = Duration.ofDays(Duration.ofNanos(System.nanoTime()).toDays()).toMillis(); long day2 = Duration.ofDays(Duration.ofMillis(day1).toDays() + 1).toMillis(); long day3 = Duration.ofDays(Duration.ofMillis(day1).toDays() + 2).toMillis(); List<ShardIndexInfo> inputShards = ImmutableList.of( shardWithTemporalRange(TIMESTAMP, day1, day1), shardWithTemporalRange(TIMESTAMP, day2, day2), shardWithTemporalRange(TIMESTAMP, day2, day2), shardWithTemporalRange(TIMESTAMP, day1, day1), shardWithTemporalRange(TIMESTAMP, day3, day3)); Set<OrganizationSet> actual = compactionSetCreator.createCompactionSets(temporalTableInfo, inputShards); assertEquals(actual.size(), 2); Set<OrganizationSet> expected = ImmutableSet.of( new OrganizationSet(temporalTableInfo.getTableId(), extractIndexes(inputShards, 0, 3), OptionalInt.empty()), new OrganizationSet(temporalTableInfo.getTableId(), extractIndexes(inputShards, 1, 2), OptionalInt.empty())); assertEquals(actual, expected); }
Source:
<code>public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException { SQLXML sqlxml = ps.getConnection().createSQLXML(); sqlxml.setString(parameter); ps.setSQLXML(i, sqlxml); <START> sqlxml.free(); <END> }</code><technical_language>If need call free(), call in try-finally</technical_language>

Target:
public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException { SQLXML sqlxml = ps.getConnection().createSQLXML(); try { sqlxml.setString(parameter); ps.setSQLXML(i, sqlxml); } finally { sqlxml.free(); } }
Source:
<code>private void createEmptyFolderIgnored() throws Exception { File path = new File(db.getWorkTree(), IGNORED_FOLDER); assertTrue(path.mkdir()); <START> assertTrue(path.isDirectory()); <END> writeTrashFile(GITIGNORE, GITIGNORE + "\n" + IGNORED_FOLDER + "/"); }</code><technical_language>Replace asserts FileUtils.mkDirs</technical_language>

Target:
private void createEmptyFolderIgnored() throws Exception { File path = new File(db.getWorkTree(), IGNORED_FOLDER); FileUtils.mkdir(path); writeTrashFile(GITIGNORE, GITIGNORE + "\n" + IGNORED_FOLDER + "/"); }
Source:
<code>public static String extractFilesNameFromUrl(String url) { <START> return url.substring(url.lastIndexOf('/') + 1, url.length()); <END> }</code><technical_language>I follow another approach, get a ZIP file, interested in content, schemas data directory providers I responsible provide location store them, a ZIP a file, clear current schemas directory content drop ZIP output file in it. handling ZIP file, user ZIP schemas root a directory, shoudl vouch for cases: 1. a directory a ZIP, directory content 2. files root directory, is</technical_language>

Target:
public static String extractFilesNameFromUrl(String url) throws MalformedURLException { URL urlObject = new URL(url); return urlObject.getPath().replaceAll("/", ""); }