auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Logger getLogger() throws Exception { <START> System.setProperty("java.util.logging.config.file", CB.getConfugrationFilePath()); <END> Logger logger = Logger.getLogger(Candybean.class.getName()); return logger; }</code><technical_language>this work typo?! CB.getConfugrationFilePath() Good time mention it... merging dev, commit passes unit system tests locally. Do do that? 'mvn clean install' 'mvn clean install -Psystem' -- other parameters requred depending local maven settings.xml file. a settings.xml file in repo voodoo2 if want -- for anytime run tests</technical_language>

Target:
private Logger getLogger() throws Exception { System.setProperty("java.util.logging.config.file", AbstractTest.getConfigrationFilePath()); Logger logger = Logger.getLogger(Candybean.class.getName()); return logger; }
Source:
<code>private void scanGuiceModules(Set<Class<?>> classes) throws IOException { try { Class<?> sysModuleBaseClass = Module.class; Class<?> httpModuleBaseClass = Class.forName("com.google.inject.servlet.ServletModule"); Class<?> sshModuleBaseClass = Class.forName("com.google.gerrit.sshd.CommandModule"); sshModuleClass = null; httpModuleClass = null; sysModuleClass = null; for (Class<?> clazz : classes) { <START> if(clazz.isLocalClass()) <END> continue; if (sshModuleBaseClass.isAssignableFrom(clazz)) { sshModuleClass = getUniqueGuiceModule(sshModuleBaseClass, sshModuleClass, clazz); } else if (httpModuleBaseClass.isAssignableFrom(clazz)) { httpModuleClass = getUniqueGuiceModule(httpModuleBaseClass, httpModuleClass, clazz); } else if (sysModuleBaseClass.isAssignableFrom(clazz)) { sysModuleClass = getUniqueGuiceModule(sysModuleBaseClass, sysModuleClass, clazz); } } } catch (ClassNotFoundException e) { throw new IOException( "Cannot find base Gerrit classes for Guice Plugin Modules", e); } }</code><technical_language>style nit: add a space if</technical_language>

Target:
private void scanGuiceModules(Set<Class<?>> classes) throws IOException { try { Class<?> sysModuleBaseClass = Module.class; Class<?> httpModuleBaseClass = Class.forName("com.google.inject.servlet.ServletModule"); Class<?> sshModuleBaseClass = Class.forName("com.google.gerrit.sshd.CommandModule"); sshModuleClass = null; httpModuleClass = null; sysModuleClass = null; for (Class<?> clazz : classes) { if (clazz.isLocalClass()) { continue; } if (sshModuleBaseClass.isAssignableFrom(clazz)) { sshModuleClass = getUniqueGuiceModule(sshModuleBaseClass, sshModuleClass, clazz); } else if (httpModuleBaseClass.isAssignableFrom(clazz)) { httpModuleClass = getUniqueGuiceModule(httpModuleBaseClass, httpModuleClass, clazz); } else if (sysModuleBaseClass.isAssignableFrom(clazz)) { sysModuleClass = getUniqueGuiceModule(sysModuleBaseClass, sysModuleClass, clazz); } } } catch (ClassNotFoundException e) { throw new IOException( "Cannot find base Gerrit classes for Guice Plugin Modules", e); } }
Source:
<code><START> private static AsyncRequestResponseHandler buildInstance(RestServerMetrics restServerMetrics) { <END> lock.lock(); try { if (instance == null) { AsyncRequestResponseHandlerFactory.restServerMetrics = restServerMetrics; instance = new AsyncRequestResponseHandler(restServerMetrics); } if (AsyncRequestResponseHandlerFactory.restServerMetrics != restServerMetrics) { throw new IllegalStateException("RestServerMetrics instance provided during construction of " + "AsyncRequestResponseHandler differs from the one currently received"); } } finally { lock.unlock(); } return instance; }</code><technical_language>a "build" instead of "get", return null instead</technical_language>

Target:
private static void buildInstance(RestServerMetrics restServerMetrics) { lock.lock(); try { if (instance == null) { AsyncRequestResponseHandlerFactory.restServerMetrics = restServerMetrics; instance = new AsyncRequestResponseHandler(restServerMetrics); } if (AsyncRequestResponseHandlerFactory.restServerMetrics != restServerMetrics) { throw new IllegalStateException("RestServerMetrics instance provided during construction of " + "AsyncRequestResponseHandler differs from the one currently received"); } } finally { lock.unlock(); } }
Source:
<code>protected LogService createLogService( LogProvider userLogProvider ) { long internalLogRotationThreshold = config.get( GraphDatabaseSettings.store_internal_log_rotation_threshold ); long internalLogRotationDelay = config.get( GraphDatabaseSettings.store_internal_log_rotation_delay ).toMillis(); int internalLogMaxArchives = config.get( GraphDatabaseSettings.store_internal_log_max_archives ); final StoreLogService.Builder builder = StoreLogService.withRotation( internalLogRotationThreshold, internalLogRotationDelay, internalLogMaxArchives, jobScheduler ); if ( userLogProvider != null ) { builder.withUserLogProvider( userLogProvider ); } builder.withRotationListener( logProvider -> diagnosticsManager.dumpAll( logProvider.getLog( DiagnosticsManager.class ) ) ); for ( String debugContext : config.get( GraphDatabaseSettings.store_internal_debug_contexts ) ) { builder.withLevel( debugContext, Level.DEBUG ); } builder.withDefaultLevel( config.get( GraphDatabaseSettings.store_internal_log_level ) ); <START> builder.withTimeZone( config.get( GraphDatabaseSettings.log_timezone ).getZoneId() ); <END> File logFile = config.get( store_internal_log_path ); if ( !logFile.getParentFile().exists() ) { logFile.getParentFile().mkdirs(); } StoreLogService logService; try { logService = builder.withInternalLog( logFile ).build( fileSystem ); } catch ( IOException ex ) { throw new RuntimeException( ex ); } return life.add( logService ); }</code><technical_language>chained</technical_language>

Target:
protected LogService createLogService( LogProvider userLogProvider ) { long internalLogRotationThreshold = config.get( GraphDatabaseSettings.store_internal_log_rotation_threshold ); long internalLogRotationDelay = config.get( GraphDatabaseSettings.store_internal_log_rotation_delay ).toMillis(); int internalLogMaxArchives = config.get( GraphDatabaseSettings.store_internal_log_max_archives ); final StoreLogService.Builder builder = StoreLogService.withRotation( internalLogRotationThreshold, internalLogRotationDelay, internalLogMaxArchives, jobScheduler ); if ( userLogProvider != null ) { builder.withUserLogProvider( userLogProvider ); } builder.withRotationListener( logProvider -> diagnosticsManager.dumpAll( logProvider.getLog( DiagnosticsManager.class ) ) ); for ( String debugContext : config.get( GraphDatabaseSettings.store_internal_debug_contexts ) ) { builder.withLevel( debugContext, Level.DEBUG ); } builder.withDefaultLevel( config.get( GraphDatabaseSettings.store_internal_log_level ) ) .withTimeZone( config.get( GraphDatabaseSettings.log_timezone ).getZoneId() ); File logFile = config.get( store_internal_log_path ); if ( !logFile.getParentFile().exists() ) { logFile.getParentFile().mkdirs(); } StoreLogService logService; try { logService = builder.withInternalLog( logFile ).build( fileSystem ); } catch ( IOException ex ) { throw new RuntimeException( ex ); } return life.add( logService ); }
Source:
<code>public List<Document> getDocuments() { <START> if (isCollectionEmpty(lookupPatient)) { <END> List<Patient> patients = HelperUtil.convertPatients(wsService.getAllPatients()); lookupPatient = mapPatientById(patients); } if (CollectionUtils.isEmpty(documentList)) { documentList = HelperUtil.convertDocuments(wsService.getAllDocuments()); for (Document doc : documentList) { if (doc.getPatientRecordId() != null) { doc.setPatientIdentifier(lookupPatient.get(doc.getPatientRecordId()).getPatientIdentifier()); } } } return documentList; }</code><technical_language>CollectionUtils.isEmpty here</technical_language>

Target:
public List<Document> getDocuments() { if (MapUtils.isEmpty(lookupPatient)) { List<Patient> patients = HelperUtil.convertPatients(wsService.getAllPatients()); lookupPatient = mapPatientById(patients); } if (CollectionUtils.isEmpty(documentList)) { documentList = HelperUtil.convertDocuments(wsService.getAllDocuments()); for (Document doc : documentList) { if (doc.getPatientRecordId() != null) { Patient idFound = lookupPatient.get(doc.getPatientRecordId()); doc.setPatientIdentifier(null != idFound ? idFound.getPatientIdentifier() : null); } } } return documentList; }
Source:
<code>public void smallestPalindromeFromSingleDigitFactors() { <START> final List<List<Integer>> expected = Collections.unmodifiableList( <END> Arrays.asList( Arrays.asList(1, 1) ) ); final long expectedValue = 1l; final SortedMap<Long, List<List<Integer>>> palindromes = palindromeCalculator.getPalindromeProductsWithFactors(1, 9); checkPalindromeWithFactorsMatchesExpected(expected, expectedValue, palindromes, palindromes.firstKey()); }</code><technical_language>present, try avoid of keyword final [POLICIES](<LINK_0></technical_language>

Target:
public void smallestPalindromeFromSingleDigitFactors() { List<List<Integer>> expected = Collections.unmodifiableList( Arrays.asList( Arrays.asList(1, 1) ) ); long expectedValue = 1l; SortedMap<Long, List<List<Integer>>> palindromes = palindromeCalculator.getPalindromeProductsWithFactors(1, 9); checkPalindromeWithFactorsMatchesExpected(expected, expectedValue, palindromes, palindromes.firstKey()); }
Source:
<code>private static MemoryRecordsBuilder buildRetainedRecordsInto(RecordBatch originalBatch, List<Record> retainedRecords, ByteBufferOutputStream bufferOutputStream, final long deleteHorizonMs) { byte magic = originalBatch.magic(); TimestampType timestampType = originalBatch.timestampType(); long logAppendTime = timestampType == TimestampType.LOG_APPEND_TIME ? originalBatch.maxTimestamp() : RecordBatch.NO_TIMESTAMP; long baseOffset = magic >= RecordBatch.MAGIC_VALUE_V2 ? originalBatch.baseOffset() : retainedRecords.get(0).offset(); MemoryRecordsBuilder builder = new MemoryRecordsBuilder(bufferOutputStream, magic, originalBatch.compressionType(), timestampType, baseOffset, logAppendTime, originalBatch.producerId(), originalBatch.producerEpoch(), originalBatch.baseSequence(), originalBatch.isTransactional(), originalBatch.isControlBatch(), originalBatch.partitionLeaderEpoch(), bufferOutputStream.limit()); <START> builder.setDeleteHorizonMs(deleteHorizonMs); <END> for (Record record : retainedRecords) builder.append(record); if (magic >= RecordBatch.MAGIC_VALUE_V2) builder.overrideLastOffset(originalBatch.lastOffset()); return builder; }</code><technical_language>Instead of adding a new setDeleteHorizonMs() method, add another constructor for MemoryRecordsBuilder includes DeleteHorizonMs? This way, more consistent DeleteHorizonMs is set in another classes</technical_language>

Target:
private static MemoryRecordsBuilder buildRetainedRecordsInto(RecordBatch originalBatch, List<Record> retainedRecords, ByteBufferOutputStream bufferOutputStream, final long deleteHorizonMs) { byte magic = originalBatch.magic(); TimestampType timestampType = originalBatch.timestampType(); long logAppendTime = timestampType == TimestampType.LOG_APPEND_TIME ? originalBatch.maxTimestamp() : RecordBatch.NO_TIMESTAMP; long baseOffset = magic >= RecordBatch.MAGIC_VALUE_V2 ? originalBatch.baseOffset() : retainedRecords.get(0).offset(); MemoryRecordsBuilder builder = new MemoryRecordsBuilder(bufferOutputStream, magic, originalBatch.compressionType(), timestampType, baseOffset, logAppendTime, originalBatch.producerId(), originalBatch.producerEpoch(), originalBatch.baseSequence(), originalBatch.isTransactional(), originalBatch.isControlBatch(), originalBatch.partitionLeaderEpoch(), bufferOutputStream.limit(), deleteHorizonMs); for (Record record : retainedRecords) builder.append(record); if (magic >= RecordBatch.MAGIC_VALUE_V2) builder.overrideLastOffset(originalBatch.lastOffset()); return builder; }
Source:
<code>public static List<IFile> getFilesFromWorkspace(final String prefix, final String suffix) { final List<IFile> matches = Lists.newArrayList(); try { <START> final IWorkspace workspace = ResourcesPlugin.getWorkspace(); <END> final IWorkspaceRoot root = workspace.getRoot(); root.accept(new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { if (resource.isAccessible() && resource instanceof IFile) { IFile file = (IFile) resource; boolean okForPrefix = StringUtil.isEmpty(prefix) || file.getName().startsWith(prefix); boolean okForSuffix = StringUtil.isEmpty(suffix) || file.getName().endsWith(suffix); if (okForPrefix && okForSuffix) { matches.add(file); } } return true; } }); } catch (final CoreException e1) { } catch (IllegalStateException e) { } return matches; }</code><technical_language>remark in ViewpointRegistryImpl</technical_language>

Target:
public static List<IFile> getFilesFromWorkspace(final String prefix, final String suffix) { final List<IFile> matches = Lists.newArrayList(); try { IWorkspaceRoot root = EcorePlugin.getWorkspaceRoot(); if (root != null) { root.accept(new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { if (resource.isAccessible() && resource instanceof IFile) { IFile file = (IFile) resource; boolean okForPrefix = StringUtil.isEmpty(prefix) || file.getName().startsWith(prefix); boolean okForSuffix = StringUtil.isEmpty(suffix) || file.getName().endsWith(suffix); if (okForPrefix && okForSuffix) { matches.add(file); } } return true; } }); } } catch (final CoreException e1) { } return matches; }
Source:
<code>private static EnumActionResult rotateStairs(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched) { if (state.getBlock() instanceof BlockStairs) { <START> if (sideWrenched.getAxis().isHorizontal()) { <END> BlockStairs.EnumHalf half = state.getValue(BlockStairs.HALF); if (half == BlockStairs.EnumHalf.TOP) { half = BlockStairs.EnumHalf.BOTTOM; } else { half = BlockStairs.EnumHalf.TOP; } world.setBlockState(pos, state.withProperty(BlockStairs.HALF, half)); return EnumActionResult.SUCCESS; } return rotateOnce(world, pos, state, BlockStairs.FACING, ROTATE_HORIZONTAL); } return EnumActionResult.PASS; }</code><technical_language>Please this - a confusing correct side time annoying. try this instead? (Same applies trapdoors, problem is worse of sides main face small). java private static EnumActionResult rotateStairs(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched) { if (state.getBlock() instanceof BlockStairs) { EnumFacing dir = state.getValue(BlockStairs.FACING); if (dir == ROTATE_HORIZONTAL.get(0)) { BlockStairs.EnumHalf = state.getValue(BlockStairs.HALF); if (half == BlockStairs.EnumHalf.TOP) { = BlockStairs.EnumHalf.BOTTOM; } else { = BlockStairs.EnumHalf.TOP; } state = state.withProperty(BlockStairs.HALF, half); } return rotateOnce(world, pos, state, BlockStairs.FACING, ROTATE_HORIZONTAL); } return EnumActionResult.PASS; }</technical_language>

Target:
private static EnumActionResult rotateStairs(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched) { if (state.getBlock() instanceof BlockStairs) { if (state.getValue(BlockStairs.FACING) == ROTATE_HORIZONTAL.get(0)) { BlockStairs.EnumHalf half = state.getValue(BlockStairs.HALF); if (half == BlockStairs.EnumHalf.TOP) { half = BlockStairs.EnumHalf.BOTTOM; } else { half = BlockStairs.EnumHalf.TOP; } state = state.withProperty(BlockStairs.HALF, half); } return rotateOnce(world, pos, state, BlockStairs.FACING, ROTATE_HORIZONTAL); } return EnumActionResult.PASS; }
Source:
<code>public Response<ResponseBody> makeRequest() throws IOException { switch (method) { case POST: <START> currentCall = commCareNetworkService.makePostRequest(url, params, addPostHeaders(requestBody), requestBody); <END> break; case MULTIPART_POST: currentCall = commCareNetworkService.makeMultipartPostRequest(url, params, headers, parts); break; case GET: currentCall = commCareNetworkService.makeGetRequest(url, params, headers); break; default: throw new IllegalArgumentException("Invalid HTTPMethod " + method.toString()); } return currentCall.execute(); }</code><technical_language>addPostHeaders() need get called for type POST for type MULTIPART_POST</technical_language>

Target:
public Response<ResponseBody> makeRequest() throws IOException { switch (method) { case POST: currentCall = commCareNetworkService.makePostRequest(url, params, headers, requestBody); break; case MULTIPART_POST: currentCall = commCareNetworkService.makeMultipartPostRequest(url, params, headers, parts); break; case GET: currentCall = commCareNetworkService.makeGetRequest(url, params, headers); break; default: throw new IllegalArgumentException("Invalid HTTPMethod " + method.toString()); } return currentCall.execute(); }
Source:
<code>public ResponseEntity removeRepository(@ApiParam(value = "The storageId", required = true) @PathVariable final String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable final String repositoryId, @ApiParam(value = "Whether to force delete the repository from the file system") @RequestParam(name = "force", defaultValue = "false") final boolean force) throws IOException { final Repository repository = configurationManagementService.getStorage(storageId) .getRepository(repositoryId); if (repository != null) { try { logger.debug(storageId); logger.debug(repositoryId); repositoryIndexManager.closeIndexer(storageId + ":" + repositoryId); final File repositoryBaseDir = new File(repository.getBasedir()); if (!repositoryBaseDir.exists() && force) { repositoryManagementService.removeRepository(storageId, repository.getId()); } Configuration configuration = configurationManagementService.getConfiguration(); Storage storage = configuration.getStorage(storageId); storage.removeRepository(repositoryId); configurationManagementService.saveStorage(storage); logger.debug("Removed repository " + storageId + ":" + repositoryId + "."); return ResponseEntity.ok(ResponseStatusEnum.OK.value()); } catch (IOException | JAXBException e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) <START> .body(ResponseStatusEnum.FAILED.value()); <END> } } else { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("Repository " + storageId + ":" + repositoryId + " was not found."); } }</code><technical_language>removed actual text response here</technical_language>

Target:
public ResponseEntity removeRepository(@ApiParam(value = "The storageId", required = true) @PathVariable final String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable final String repositoryId, @ApiParam(value = "Whether to force delete the repository from the file system") @RequestParam(name = "force", defaultValue = "false") final boolean force) throws IOException { final Repository repository = configurationManagementService.getStorage(storageId) .getRepository(repositoryId); if (repository != null) { try { logger.debug(storageId); logger.debug(repositoryId); repositoryIndexManager.closeIndexer(storageId + ":" + repositoryId); final File repositoryBaseDir = new File(repository.getBasedir()); if (!repositoryBaseDir.exists() && force) { repositoryManagementService.removeRepository(storageId, repository.getId()); } Configuration configuration = configurationManagementService.getConfiguration(); Storage storage = configuration.getStorage(storageId); storage.removeRepository(repositoryId); configurationManagementService.saveStorage(storage); logger.debug("Removed repository " + storageId + ":" + repositoryId + "."); return ResponseEntity.ok().build(); } catch (IOException | JAXBException e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body("Failed to remove repository " + repositoryId + "!"); } } else { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("Repository " + storageId + ":" + repositoryId + " was not found."); } }
Source:
<code><START> private BigDecimal getBigDecimalUpperBoundFromFloatString(String floatStr) <END> { BigDecimal convertedBD; try { convertedBD = new BigDecimal(floatStr); } catch (NumberFormatException nfe) { return null; } if (upperStrict) { convertedBD = convertedBD.setScale(0, RoundingMode.CEILING); } else { convertedBD = convertedBD.setScale(0, RoundingMode.FLOOR); } return convertedBD; }</code><technical_language>@Nullable</technical_language>

Target:
private BigDecimal getBigDecimalUpperBoundFromFloatString(String floatStr) { BigDecimal convertedBD; try { convertedBD = new BigDecimal(floatStr); } catch (NumberFormatException nfe) { return null; } if (upperStrict) { return convertedBD.setScale(0, RoundingMode.CEILING); } else { return convertedBD.setScale(0, RoundingMode.FLOOR); } }
Source:
<code>public void shouldNotThrowExceptionWhenOnChangeNotCalled() { new StreamsMetadataState(TopologyWrapper.getInternalTopologyBuilder(builder.build()), hostOne).getAllMetadataForStore("store"); <START> } <END></code><technical_language>This is fine, some assertions returned in this case</technical_language>

Target:
public void shouldNotThrowExceptionWhenOnChangeNotCalled() { final Collection<StreamsMetadata> metadata = new StreamsMetadataState( TopologyWrapper.getInternalTopologyBuilder(builder.build()), hostOne).getAllMetadataForStore("store"); assertEquals(0, metadata.size()); }
Source:
<code>public Guid getStorageDomainIdForPoolByType(Guid pool, StorageDomainType type) { Guid returnValue = Guid.Empty; List<storage_domains> domains = getAllForStoragePool(pool); for (storage_domains domain : domains) { <START> if (domain.getstorage_domain_type() == StorageDomainType.Master) { <END> returnValue = domain.getId(); break; } } return returnValue; }</code><technical_language>requires fix: domain.getstorage_domain_type() == type</technical_language>

Target:
public Guid getStorageDomainIdForPoolByType(Guid pool, StorageDomainType type) { Guid returnValue = Guid.Empty; List<storage_domains> domains = getAllForStoragePool(pool); for (storage_domains domain : domains) { if (domain.getstorage_domain_type() == type) { returnValue = domain.getId(); break; } } return returnValue; }
Source:
<code>protected FileAnnotation getErrorNumber( final int number) throws IOException { Collection<FileAnnotation> warnings = new SdccParser().parse(openFile("sdcc_Output.txt")); <START> Iterator<FileAnnotation> iterator = warnings.iterator(); <END> FileAnnotation annotation = iterator.next(); for(int i = 1; i < number; i++) { annotation = iterator.next(); } return annotation; }</code><technical_language>a list access index</technical_language>

Target:
protected FileAnnotation getErrorNumber( final int number) throws IOException { List<FileAnnotation> warnings = new SdccParser().parse(openFile("sdcc_Output.txt")); return warnings.get(number); }
Source:
<code>public void testAvoidArea() { CustomModel vehicleModel = new CustomModel(); Map map = new HashMap(); map.put(MOTORWAY.toString(), 0.1); String areaId = "blup"; vehicleModel.getPriority().put(KEY, map); vehicleModel.getPriority().put("area_" + areaId, 0.5); Coordinate[] coordinates = {new Coordinate(13.722, 51.053), new Coordinate(13.722, 51.055), new Coordinate(13.731, 51.055), new Coordinate(13.731, 51.053), null}; coordinates[coordinates.length - 1] = coordinates[0]; Geometry poly = new GeometryFactory().createPolygon(coordinates); <START> JsonFeature area = new JsonFeature(areaId, "Polygon", new BBox(13.713684, 13.719864, 51.036213, 51.036591), <END> poly, Collections.<String, Object>emptyMap()); vehicleModel.getAreas().put(areaId, area); CustomWeighting weighting = new CustomWeighting(carFE, encodingManager, NO_TURN_COST_PROVIDER, vehicleModel); graphHopperStorage.getNodeAccess().setNode(0, 51.036213, 13.713684); graphHopperStorage.getNodeAccess().setNode(1, 51.036591, 13.719864); graphHopperStorage.getNodeAccess().setNode(2, 51.054506, 13.723432); graphHopperStorage.getNodeAccess().setNode(3, 51.053589, 13.730679); EdgeIteratorState edge1 = graphHopperStorage.edge(0, 1).setDistance(500).set(avSpeedEnc, 15).set(accessEnc, true); assertEquals(155, weighting.calcEdgeWeight(edge1, false), 0.01); EdgeIteratorState edge2 = graphHopperStorage.edge(2, 3).setDistance(500).set(avSpeedEnc, 15).set(accessEnc, true); assertTrue(poly.intersects(edge2.fetchWayGeometry(FetchMode.ALL).toLineString(false))); assertEquals(275, weighting.calcEdgeWeight(edge2, false), 0.01); }</code><technical_language>do pass extra bounding box here, polygon</technical_language>

Target:
public void testAvoidArea() { CustomModel vehicleModel = new CustomModel(); String areaId = "my_area"; vehicleModel.getPriority().put("area_" + areaId, 0.5); Coordinate[] coordinates = {new Coordinate(13.722, 51.053), new Coordinate(13.722, 51.055), new Coordinate(13.731, 51.055), new Coordinate(13.731, 51.053), null}; coordinates[coordinates.length - 1] = coordinates[0]; Geometry poly = new GeometryFactory().createPolygon(coordinates); JsonFeature area = new JsonFeature(areaId, "Polygon", null, poly, Collections.<String, Object>emptyMap()); vehicleModel.getAreas().put(areaId, area); vehicleModel.setDistanceInfluence(0); CustomWeighting weighting = createWeighting(vehicleModel); graphHopperStorage.getNodeAccess().setNode(0, 51.036213, 13.713684); graphHopperStorage.getNodeAccess().setNode(1, 51.036591, 13.719864); graphHopperStorage.getNodeAccess().setNode(2, 51.054506, 13.723432); graphHopperStorage.getNodeAccess().setNode(3, 51.053589, 13.730679); EdgeIteratorState edge1 = graphHopperStorage.edge(0, 1, 500, true).set(avSpeedEnc, 15); assertEquals(120, weighting.calcEdgeWeight(edge1, false), 0.01); EdgeIteratorState edge2 = graphHopperStorage.edge(2, 3, 500, true).set(avSpeedEnc, 15); assertTrue(poly.intersects(edge2.fetchWayGeometry(FetchMode.ALL).toLineString(false))); assertEquals(240, weighting.calcEdgeWeight(edge2, false), 0.01); }
Source:
<code>private Breakable getBreakable(@Nullable ExpressionTree argument, StatementTree jumpStmp) { try { if (argument != null) { if (!argument.is(Kind.NUMERIC_LITERAL)) { throw exception(jumpStmp); } <START> Iterator<Breakable> breakableIterator = breakables.iterator(); <END> Breakable breakable = breakableIterator.next(); int breakLevels = Integer.parseInt(((LiteralTree) argument).value()); if (breakLevels == 0) { breakLevels = 1; } while (breakLevels > 1) { breakable = breakableIterator.next(); breakLevels--; } return breakable; } else { return breakables.element(); } } catch (NumberFormatException | NoSuchElementException e) { throw exception(jumpStmp, e); } }</code><technical_language>lines 145 146 moved while (breakLevels > 1) {</technical_language>

Target:
private Breakable getBreakable(@Nullable ExpressionTree argument, StatementTree jumpStmp) { try { if (argument != null) { if (!argument.is(Kind.NUMERIC_LITERAL)) { throw exception(jumpStmp); } int breakLevels = getBreakLevels((LiteralTree) argument); Iterator<Breakable> breakableIterator = breakables.iterator(); Breakable breakable = breakableIterator.next(); while (breakLevels > 1) { breakable = breakableIterator.next(); breakLevels--; } return breakable; } else { return breakables.element(); } } catch (NumberFormatException | NoSuchElementException e) { throw exception(jumpStmp, e); } }
Source:
<code><START> public static IVdsServer createVdsServer(VdsProtocol vdsProtocol, Version version, String hostname, int port, int clientTimeOut, <END> int connectionTimeOut, int clientRetries, int heartbeat) { IVdsServer vdsServer = null; Pair<VdsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(hostname, port, clientTimeOut, connectionTimeOut, clientRetries, Config.<Integer> getValue(ConfigValues.VdsMaxConnectionsPerHost), Config.<Integer> getValue(ConfigValues.MaxTotalConnections), VdsServerConnector.class, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)); if (VdsProtocol.STOMP == vdsProtocol) { String eventQueue = null; if (FeatureSupported.events(version)) { eventQueue = Config.<String> getValue(ConfigValues.EventQueueName); } vdsServer = new JsonRpcVdsServer(JsonRpcUtils.createStompClient(hostname, port, connectionTimeOut, clientTimeOut, clientRetries, heartbeat, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication), Config.<String> getValue(ConfigValues.VdsmSSLProtocol), Config.<Integer> getValue(ConfigValues.EventProcessingPoolSize), Config.<String> getValue(ConfigValues.VdsRequestQueueName), Config.<String> getValue(ConfigValues.VdsResponseQueueName), eventQueue), returnValue.getSecond()); } else if (VdsProtocol.XML == vdsProtocol) { vdsServer = new VdsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); } return vdsServer; }</code><technical_language>please</technical_language>

Target:
public static IVdsServer createVdsServer(VdsProtocol vdsProtocol, Version version, String hostname, int port, int clientTimeOut, int connectionTimeOut, int clientRetries, int heartbeat) { IVdsServer vdsServer = null; Pair<VdsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(hostname, port, clientTimeOut, connectionTimeOut, clientRetries, Config.<Integer> getValue(ConfigValues.VdsMaxConnectionsPerHost), Config.<Integer> getValue(ConfigValues.MaxTotalConnections), VdsServerConnector.class, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication)); if (VdsProtocol.STOMP == vdsProtocol) { String eventQueue = getEventsQueue(version); vdsServer = new JsonRpcVdsServer(JsonRpcUtils.createStompClient(hostname, port, connectionTimeOut, clientTimeOut, clientRetries, heartbeat, Config.<Boolean> getValue(ConfigValues.EncryptHostCommunication), Config.<String> getValue(ConfigValues.VdsmSSLProtocol), Config.<Integer> getValue(ConfigValues.EventProcessingPoolSize), Config.<String> getValue(ConfigValues.VdsRequestQueueName), Config.<String> getValue(ConfigValues.VdsResponseQueueName), eventQueue), returnValue.getSecond()); } else if (VdsProtocol.XML == vdsProtocol) { vdsServer = new VdsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); } return vdsServer; }
Source:
<code>public void testDelete() { long startTime = new Date().getTime(); OnmsAlarm situation = new OnmsAlarm(); situation.setDistPoller(m_distPollerDao.whoami()); situation.setCounter(1); situation.setUei("cardDown"); situation.setRelatedAlarms(new HashSet<>(Arrays.asList(linkDownAlarmOnR1, linkDownAlarmOnR2))); situation.setReductionKey("situation/reduction/key"); m_alarmDao.saveOrUpdate(situation); OnmsAlarm retrieved = m_alarmDao.findByReductionKey("situation/reduction/key"); assertThat(retrieved.getRelatedAlarms().size(), is(2)); List<AlarmAssociation> associatedAlarms = alarmAssociationDao.findAll(); assertThat(associatedAlarms.size(), is(2)); <START> AlarmAssociation alarmAssociation = associatedAlarms.stream().findFirst().get(); <END> assertThat(alarmAssociation.getMappedTime().getTime(), is(greaterThanOrEqualTo(startTime))); m_alarmDao.delete(retrieved); OnmsAlarm retrieved2 = m_alarmDao.findByReductionKey("situation/reduction/key"); assertThat(retrieved2, is(nullValue())); associatedAlarms = alarmAssociationDao.findAll(); assertThat(associatedAlarms.size(), is(0)); }</code><technical_language>suggestion AlarmAssociation alarmAssociation = associatedAlarms.get(0);</technical_language>

Target:
public void testDelete() { long startTime = new Date().getTime(); OnmsAlarm situation = new OnmsAlarm(); situation.setDistPoller(m_distPollerDao.whoami()); situation.setCounter(1); situation.setUei("cardDown"); situation.setRelatedAlarms(new HashSet<>(Arrays.asList(linkDownAlarmOnR1, linkDownAlarmOnR2))); situation.setReductionKey("situation/reduction/key"); m_alarmDao.saveOrUpdate(situation); OnmsAlarm retrieved = m_alarmDao.findByReductionKey("situation/reduction/key"); assertThat(retrieved.getRelatedAlarms().size(), is(2)); List<AlarmAssociation> associatedAlarms = alarmAssociationDao.findAll(); assertThat(associatedAlarms.size(), is(2)); AlarmAssociation alarmAssociation = associatedAlarms.get(0); assertThat(alarmAssociation.getMappedTime().getTime(), is(greaterThanOrEqualTo(startTime))); m_alarmDao.delete(retrieved); OnmsAlarm retrieved2 = m_alarmDao.findByReductionKey("situation/reduction/key"); assertThat(retrieved2, is(nullValue())); associatedAlarms = alarmAssociationDao.findAll(); assertThat(associatedAlarms.size(), is(0)); }
Source:
<code>public void execute(ScriptEntry scriptEntry) { <START> EntityTag entity = (EntityTag) scriptEntry.getObject("entity"); <END> LocationTag location = (LocationTag) scriptEntry.getObject("location"); List<PlayerTag> players = (List<PlayerTag>) scriptEntry.getObject("players"); DurationTag duration = scriptEntry.getObjectTag("duration"); if (scriptEntry.dbCallShouldDebug()) { Debug.report(scriptEntry, getName(), entity.debug() + location.debug() + duration.debug() + ArgumentHelper.debugList("players", players)); } FakeEntity.showFakeEntityTo(players, entity, location, duration); }</code><technical_language>EntityTag entity = scriptEntry.getObjectTag("entity"); similar for LocationTag</technical_language>

Target:
public void execute(ScriptEntry scriptEntry) { EntityTag entity = scriptEntry.getObjectTag("entity"); LocationTag location = scriptEntry.getObjectTag("location"); List<PlayerTag> players = (List<PlayerTag>) scriptEntry.getObject("players"); DurationTag duration = scriptEntry.getObjectTag("duration"); if (scriptEntry.dbCallShouldDebug()) { Debug.report(scriptEntry, getName(), entity.debug() + location.debug() + duration.debug() + ArgumentHelper.debugList("players", players)); } FakeEntity.showFakeEntityTo(players, entity, location, duration); }
Source:
<code>private List<RemoteResult> executeTasks(List<Callable<RemoteResult>> tasks) { List<RemoteResult> results = new ArrayList<>(); try { List<Future<RemoteResult>> futures = executor.invokeAll(tasks); for (Future<RemoteResult> future : futures) { try { results.add(future.get(taskWaitTimeSeconds, TimeUnit.SECONDS)); } catch (ExecutionException e) { LOGGER.warn( "Error executing query on a remote registry. Verify network connection to remote host is available. If connection is good, verify this instance has permission to access the registry.", e); } catch (TimeoutException e) { LOGGER.warn( "Timeout occurred when querying a remote registry. Verify network connection to remote host is available."); } } } catch (InterruptedException e) { LOGGER.debug("Remote registry queries interrupted", e); <START> Thread.currentThread().interrupt(); <END> } return results; }</code><technical_language>logic is a bit aborting remainder futures soon interruption is detected</technical_language>

Target:
private List<RemoteResult> executeTasks(List<Callable<RemoteResult>> tasks) { List<RemoteResult> results = new ArrayList<>(); try { List<Future<RemoteResult>> futures = executor.invokeAll(tasks); for (Future<RemoteResult> future : futures) { try { results.add(future.get(taskWaitTimeSeconds, TimeUnit.SECONDS)); } catch (ExecutionException e) { LOGGER.warn( "Error executing query on a remote registry. Verify network connection to remote host is available. If connection is good, verify this instance has permission to access the registry.", e); } catch (TimeoutException e) { LOGGER.warn( "Timeout occurred when querying a remote registry. Verify network connection to remote host is available."); } } } catch (InterruptedException e) { LOGGER.debug("Remote registry queries interrupted", e); } return results; }
Source:
<code>public static void awaitOrFail(CountDownLatch latch) { <START> awaitOrFail(latch, 15); <END> }</code><technical_language>Bump numbers</technical_language>

Target:
public static void awaitOrFail(CountDownLatch latch) { awaitOrFail(latch, 10); }
Source:
<code>private Optional<Map<Integer, Integer>> fitNodes(int vmNumaNodeIndex, Map<Integer, Long> hostNodeFreeMem) { if (vmNumaNodeIndex >= vmNodes.size()) { return Optional.of(new HashMap<>(vmNodes.size())); } VmNumaNode vmNode = vmNodes.get(vmNumaNodeIndex); if (vmNode.getVdsNumaNodeList().isEmpty()) { return fitNodes(vmNumaNodeIndex + 1, hostNodeFreeMem); } for (Integer pinnedIndex: vmNode.getVdsNumaNodeList()) { long hostFreeMem = hostNodeFreeMem.get(pinnedIndex); if (hostFreeMem < vmNode.getMemTotal()) { failedOnMemory = true; <START> continue; <END> } List<Integer> hostNodeCpus = hostNodeCpuMap.get(pinnedIndex); if (!vmNodeFitsHostNodeCpuPinning(vmNode, hostNodeCpus)) { failedOnCpuPinning = true; continue; } hostNodeFreeMem.put(pinnedIndex, hostFreeMem - vmNode.getMemTotal()); Optional<Map<Integer, Integer>> othersFit = fitNodes(vmNumaNodeIndex + 1, hostNodeFreeMem); if (othersFit.isPresent()) { othersFit.get().put(vmNode.getIndex(), pinnedIndex); return othersFit; } hostNodeFreeMem.put(pinnedIndex, hostFreeMem); } return Optional.empty(); }</code><technical_language>this code if numa pinning failed memory check cpu pinning a message for failures FAILED_ON_MEMORY_AND_CPU_PINNING? is if vnuma is pinned more physical numa is avoided in ui anyway</technical_language>

Target:
private Optional<Map<Integer, Integer>> fitNodes(int vmNumaNodeIndex, Map<Integer, Long> hostNodeFreeMem) { if (vmNumaNodeIndex >= vmNodes.size()) { return Optional.of(new HashMap<>(vmNodes.size())); } VmNumaNode vmNode = vmNodes.get(vmNumaNodeIndex); if (vmNode.getVdsNumaNodeList().isEmpty()) { return fitNodes(vmNumaNodeIndex + 1, hostNodeFreeMem); } for (Integer pinnedIndex: vmNode.getVdsNumaNodeList()) { long hostFreeMem = hostNodeFreeMem.get(pinnedIndex); boolean memoryFits = hostFreeMem >= vmNode.getMemTotal(); List<Integer> hostNodeCpus = hostNodeCpuMap.get(pinnedIndex); boolean cpuPinningFits = vmNodeFitsHostNodeCpuPinning(vmNode, hostNodeCpus); if (!memoryFits || !cpuPinningFits) { failedOnMemory = failedOnMemory || !memoryFits; failedOnCpuPinning = failedOnCpuPinning || !cpuPinningFits; continue; } hostNodeFreeMem.put(pinnedIndex, hostFreeMem - vmNode.getMemTotal()); Optional<Map<Integer, Integer>> othersFit = fitNodes(vmNumaNodeIndex + 1, hostNodeFreeMem); if (othersFit.isPresent()) { othersFit.get().put(vmNode.getIndex(), pinnedIndex); return othersFit; } hostNodeFreeMem.put(pinnedIndex, hostFreeMem); } return Optional.empty(); }
Source:
<code>public Boolean call(ApiCaller ac, Deserializer parms) throws PerunException { String secret = BeansUtils.getCoreConfig().getRecaptchaPrivateKey(); String response = parms.readString("response"); RestTemplate restTemplate = new RestTemplate(); final String verificationUrl = "<LINK_0>"; HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); map.add("response", response); map.add("secret", secret); HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers); <START> JSONObject answer = new JSONObject(restTemplate.postForObject(verificationUrl, request , String.class)); <END> return answer.getBoolean("success"); }</code><technical_language>written return restTemplate.postForObject(verificationUrl, request , JsonNode.class).path("success").asBoolean()</technical_language>

Target:
public List<Attribute> call(ApiCaller ac, Deserializer parms) throws PerunException { if (parms.contains("group")) { return ac.getRegistrarManager().initialize(parms.readString("vo"), parms.readString("group")); } else { return ac.getRegistrarManager().initialize(parms.readString("vo"), null); } }
Source:
<code>public void executeSetter(Object bean, Object value) { <START> propertySetterAccessor.executeSetter(bean, value); <END> }</code><technical_language>I missed this in review. this affect performance? reason lamdba approach, is able replace executoSetter() a single setterFunction call, inlined. Inlining is mother of JVM performance tricks. note this is a very, frequently called method. step move - much, more. worth thinking this JMH'ing it. This extra PropertySetterAccessor **adds extra layer of indirection**</technical_language>

Target:
public void executeSetter(Object bean, Object value) { setterFunction.accept(bean, value); }
Source:
<code>public void testAccessControlsForCommentByInstructor() { prepareTestData(); <START> ______TS("Instructor as feedback participant"); <END> FeedbackResponseCommentAttributes comment = getCommentFromInstructor1(); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, comment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, comment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "", Const.ParamsNames.FEEDBACK_RESPONSE_ID, comment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, String.valueOf(comment.getId()) }; InstructorAttributes instructor1InCourse1 = dataBundle.instructors.get("instructor1InCourse1"); StudentAttributes student = dataBundle.students.get("student1InCourse1"); verifyUnaccessibleWithoutLogin(submissionParams, instructor1InCourse1, student); InstructorAttributes differentInstructorInSameCourse = dataBundle.instructors.get("instructor2InCourse1"); gaeSimulation.loginAsInstructor(differentInstructorInSameCourse.googleId); verifyCannotAccess(submissionParams); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams, instructor1InCourse1); ______TS("Moderator can delete comment"); InstructorAttributes moderator = dataBundle.instructors.get("instructor2InCourse1"); String[] submissionParamsForModeration = new String[] { Const.ParamsNames.COURSE_ID, comment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, comment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "", Const.ParamsNames.FEEDBACK_RESPONSE_ID, comment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, String.valueOf(comment.getId()), Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderator.email }; gaeSimulation.loginAsInstructor(moderator.googleId); verifyCanAccess(submissionParamsForModeration); }</code><technical_language>discussed, need verifyUnaccessibleWithoutLogin verifyAccessibleForAdminToMasqueradeAsInstructor</technical_language>

Target:
public void testAccessControlsForCommentByInstructor() { FeedbackResponseCommentAttributes comment = getCommentFromInstructor1AsFeedbackParticipant(); ______TS("Moderator can delete comment"); InstructorAttributes moderator = dataBundle.instructors.get("instructor2InCourse1"); String[] submissionParamsForModeration = new String[] { Const.ParamsNames.COURSE_ID, comment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, comment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, comment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, String.valueOf(comment.getId()), Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderator.email }; gaeSimulation.loginAsInstructor(moderator.googleId); verifyCanAccess(submissionParamsForModeration); }
Source:
<code>public void clickOnWorkspacesTab() { <START> redrawUiElementsTimeout.until(ExpectedConditions.visibilityOf(workspacesTab)).click(); <END> }</code><technical_language>user SeleniumWebDriverHelper#waitAndClick() method instead</technical_language>

Target:
public void clickOnWorkspacesTab() { seleniumWebDriverHelper.waitAndClick(workspacesTab); }
Source:
<code>public String getModeName() { String header = getHeader(); <START> return header.substring(0, header.indexOf(' ')); <END> }</code><technical_language>is other of article name</technical_language>

Target:
private String getModeName() { String header = getHeader(); return header.substring(0, header.indexOf(' ')); }
Source:
<code>ScheduledExecutorService dynamicCredentialsScheduledExecutorService( @Value("${" + CREDENTIALS_FILE + "}") String credentialsFile, @Value("${" + CREDENTIALS_REFRESH_INTERVAL + "}") Integer credentialsRefreshInterval, @Qualifier(QUALIFIER) BasicCredentials basicCredentials) throws IOException { ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor( <START> new NamedThreadFactory("zipkin-load-es-credentials-pool")); <END> DynamicCredentialsFileLoader credentialsFileLoader = new DynamicCredentialsFileLoader(basicCredentials, credentialsFile); credentialsFileLoader.updateCredentialsFromProperties(); ses.scheduleAtFixedRate(credentialsFileLoader, 0, credentialsRefreshInterval, TimeUnit.SECONDS); return ses; }</code><technical_language>Minor nit: drop pool suffix perhaps</technical_language>

Target:
ScheduledExecutorService dynamicCredentialsScheduledExecutorService( @Value("${" + CREDENTIALS_FILE + "}") String credentialsFile, @Value("${" + CREDENTIALS_REFRESH_INTERVAL + "}") Integer credentialsRefreshInterval, @Qualifier(QUALIFIER) BasicCredentials basicCredentials) throws IOException { ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor( new NamedThreadFactory("zipkin-load-es-credentials")); DynamicCredentialsFileLoader credentialsFileLoader = new DynamicCredentialsFileLoader(basicCredentials, credentialsFile); credentialsFileLoader.updateCredentialsFromProperties(); ses.scheduleAtFixedRate(credentialsFileLoader, 0, credentialsRefreshInterval, TimeUnit.SECONDS); return ses; }
Source:
<code>private void setClientAuthConfiguration(String clientAuth) throws Exception { Configuration config = getAdminConfig().getConfiguration("ddf.catalog.ftp.FtpServerManager"); config.setBundleLocation("mvn:ddf.catalog/ftp/" + System.getProperty("ddf.version")); Dictionary properties = new Hashtable<>(); properties.put(CLIENT_AUTH_PROPERTY_KEY, clientAuth); config.update(properties); switch (clientAuth) { case WANT: await( "SSL handshake to succeed with FTPS client without certificate because clientAuth = \"want\"") .atMost(SET_CLIENT_AUTH_TIMEOUT_SEC, TimeUnit.SECONDS) .until( () -> { <START> FTPSClient client; <END> try { client = createSecureClient(false); disconnectClient(client); return true; } catch (SSLException | SocketException | FTPConnectionClosedException e) { return false; } }); break; case NEED: await( "SSL handshake to fail with FTPS client without certificate because clientAuth = \"need\"") .atMost(SET_CLIENT_AUTH_TIMEOUT_SEC, TimeUnit.SECONDS) .until( () -> { FTPSClient client; try { client = createSecureClient(false); disconnectClient(client); return false; } catch (SSLException e) { return true; } catch (SocketException | FTPConnectionClosedException e) { return false; } }); } }</code><technical_language>move lambda a private method</technical_language>

Target:
private void setClientAuthConfiguration(String clientAuth) throws Exception { Configuration config = getAdminConfig().getConfiguration("ddf.catalog.ftp.FtpServerManager"); config.setBundleLocation("mvn:ddf.catalog/ftp/" + System.getProperty("ddf.version")); Dictionary properties = new Hashtable<>(); properties.put(CLIENT_AUTH_PROPERTY_KEY, clientAuth); config.update(properties); switch (clientAuth) { case WANT: await( "SSL handshake to succeed with FTPS client without certificate because clientAuth = \"want\"") .atMost(SET_CLIENT_AUTH_TIMEOUT_SEC, TimeUnit.SECONDS) .until(this::clientWithWant); break; case NEED: await( "SSL handshake to fail with FTPS client without certificate because clientAuth = \"need\"") .atMost(SET_CLIENT_AUTH_TIMEOUT_SEC, TimeUnit.SECONDS) .until(this::clientWithNeed); } }
Source:
<code>public BookieFormatCmd() { super(CMD_BOOKIEFORMAT); opts.addOption("n", "nonInteractive", false, "Whether to confirm if old data exists..?"); opts.addOption("f", "force", false, "If [nonInteractive] is specified, then whether" + " to force delete the old data without prompt..?"); <START> opts.addOption("d", "delete_cookie", false, "Delete its cookie on zookeeper"); <END> }</code><technical_language>BC break here. add a hidden option for deleteCookie, behaves delete_cookie show in help</technical_language>

Target:
public BookieFormatCmd() { super(CMD_BOOKIEFORMAT); opts.addOption("n", "nonInteractive", false, "Whether to confirm if old data exists..?"); opts.addOption("f", "force", false, "If [nonInteractive] is specified, then whether" + " to force delete the old data without prompt..?"); opts.addOption("d", "deleteCookie", false, "Delete its cookie on zookeeper"); }
Source:
<code>public static UiStateSummary from(UiInfo infos) { <START> AtomicReference<State> res = new AtomicReference<>(State.GREEN); <END> infos.getGroups().forEach( uiGroup -> { final State stateToCompare = uiGroup.getState() == State.GREY ? State.YELLOW : uiGroup.getState(); if(stateToCompare.compareTo(res.get()) > 0){ res.set(stateToCompare); } }); return new UiStateSummary(res.get()); }</code><technical_language>do need AtomicReference? I dont multithreading issues in this code</technical_language>

Target:
public static UiStateSummary from(UiInfo infos) { final State res = infos.getGroups().stream() .map(UIGroup::getState).distinct() .map(state -> state == State.GREY ? State.YELLOW : state) .reduce(State.GREEN, BinaryOperator.maxBy(Enum::compareTo)); return new UiStateSummary(res); }