auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static AsyncRequestResponseHandler 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(); } return instance; }

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:
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 ) ); builder.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 ); }

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:
public List<Document> getDocuments() { if (isCollectionEmpty(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) { doc.setPatientIdentifier(lookupPatient.get(doc.getPatientRecordId()).getPatientIdentifier()); } } } return documentList; }

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:
public void smallestPalindromeFromSingleDigitFactors() { final List<List<Integer>> expected = Collections.unmodifiableList( 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()); }

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:
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()); builder.setDeleteHorizonMs(deleteHorizonMs); for (Record record : retainedRecords) builder.append(record); if (magic >= RecordBatch.MAGIC_VALUE_V2) builder.overrideLastOffset(originalBatch.lastOffset()); return builder; }

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:
public static List<IFile> getFilesFromWorkspace(final String prefix, final String suffix) { final List<IFile> matches = Lists.newArrayList(); try { final IWorkspace workspace = ResourcesPlugin.getWorkspace(); 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; }

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:
public void testPreserveStatus() throws IOException { TaskAttemptContext taskAttemptContext = getTaskAttemptContext(config); JobContext jobContext = new JobContextImpl(taskAttemptContext.getConfiguration(), taskAttemptContext.getTaskAttemptID().getJobID()); Configuration conf = jobContext.getConfiguration(); String sourceBase; String targetBase; FileSystem fs = null; try { OutputCommitter committer = new CopyCommitter(null, taskAttemptContext); fs = FileSystem.get(conf); FsPermission sourcePerm = new FsPermission((short) 511); FsPermission initialPerm = new FsPermission((short) 448); sourceBase = TestDistCpUtils.createTestSetup(fs, sourcePerm); targetBase = TestDistCpUtils.createTestSetup(fs, initialPerm); final DistCpOptions options = new DistCpOptions.Builder( Collections.singletonList(new Path(sourceBase)), new Path("/out")) .preserve(FileAttribute.PERMISSION).build(); options.appendToConf(conf); final DistCpContext context = new DistCpContext(options); context.setTargetPathExists(false); CopyListing listing = new GlobbedCopyListing(conf, CREDENTIALS); Path listingFile = new Path("/tmp1/" + rand.nextLong()); listing.buildListing(listingFile, context); conf.set(DistCpConstants.CONF_LABEL_TARGET_FINAL_PATH, targetBase); committer.commitJob(jobContext); checkDirectoryPermissions(fs, targetBase, sourcePerm); committer.commitJob(jobContext); checkDirectoryPermissions(fs, targetBase, sourcePerm); } finally { TestDistCpUtils.delete(fs, "/tmp1"); conf.unset(DistCpConstants.CONF_LABEL_PRESERVE_STATUS); } }

Target:
public void testPreserveStatus() throws IOException { TaskAttemptContext taskAttemptContext = getTaskAttemptContext(config); JobContext jobContext = new JobContextImpl(taskAttemptContext.getConfiguration(), taskAttemptContext.getTaskAttemptID().getJobID()); Configuration conf = jobContext.getConfiguration(); String sourceBase; String targetBase; FileSystem fs = null; try { OutputCommitter committer = new CopyCommitter(null, taskAttemptContext); fs = FileSystem.get(conf); FsPermission sourcePerm = new FsPermission((short) 511); FsPermission initialPerm = new FsPermission((short) 448); sourceBase = TestDistCpUtils.createTestSetup(fs, sourcePerm); targetBase = TestDistCpUtils.createTestSetup(fs, initialPerm); final DistCpOptions options = new DistCpOptions.Builder( Collections.singletonList(new Path(sourceBase)), new Path("/out")) .preserve(FileAttribute.PERMISSION).build(); options.appendToConf(conf); final DistCpContext context = new DistCpContext(options); context.setTargetPathExists(false); CopyListing listing = new GlobbedCopyListing(conf, CREDENTIALS); Path listingFile = new Path("/tmp1/" + rand.nextLong()); listing.buildListing(listingFile, context); conf.set(CONF_LABEL_TARGET_FINAL_PATH, targetBase); committer.commitJob(jobContext); checkDirectoryPermissions(fs, targetBase, sourcePerm); committer.commitJob(jobContext); checkDirectoryPermissions(fs, targetBase, sourcePerm); } finally { TestDistCpUtils.delete(fs, "/tmp1"); conf.unset(DistCpConstants.CONF_LABEL_PRESERVE_STATUS); } }
Source:
private static EnumActionResult rotateStairs(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched) { if (state.getBlock() instanceof BlockStairs) { if (sideWrenched.getAxis().isHorizontal()) { 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; }

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:
public Response<ResponseBody> makeRequest() throws IOException { switch (method) { case POST: currentCall = commCareNetworkService.makePostRequest(url, params, addPostHeaders(requestBody), 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(); }

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:
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) .body(ResponseStatusEnum.FAILED.value()); } } else { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("Repository " + storageId + ":" + repositoryId + " was not found."); } }

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:
private BigDecimal getBigDecimalUpperBoundFromFloatString(String floatStr) { 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; }

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:
public void shouldNotThrowExceptionWhenOnChangeNotCalled() { new StreamsMetadataState(TopologyWrapper.getInternalTopologyBuilder(builder.build()), hostOne).getAllMetadataForStore("store"); }

Target:
public void shouldNotThrowExceptionWhenOnChangeNotCalled() { final Collection<StreamsMetadata> metadata = new StreamsMetadataState( TopologyWrapper.getInternalTopologyBuilder(builder.build()), hostOne).getAllMetadataForStore("store"); assertEquals(0, metadata.size()); }
Source:
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() == StorageDomainType.Master) { returnValue = domain.getId(); break; } } return returnValue; }

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:
protected FileAnnotation getErrorNumber( final int number) throws IOException { Collection<FileAnnotation> warnings = new SdccParser().parse(openFile("sdcc_Output.txt")); Iterator<FileAnnotation> iterator = warnings.iterator(); FileAnnotation annotation = iterator.next(); for(int i = 1; i < number; i++) { annotation = iterator.next(); } return annotation; }

Target:
protected FileAnnotation getErrorNumber( final int number) throws IOException { List<FileAnnotation> warnings = new SdccParser().parse(openFile("sdcc_Output.txt")); return warnings.get(number); }
Source:
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); JsonFeature area = new JsonFeature(areaId, "Polygon", new BBox(13.713684, 13.719864, 51.036213, 51.036591), 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); }

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:
private Breakable getBreakable(@Nullable ExpressionTree argument, StatementTree jumpStmp) { try { if (argument != null) { if (!argument.is(Kind.NUMERIC_LITERAL)) { throw exception(jumpStmp); } Iterator<Breakable> breakableIterator = breakables.iterator(); 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); } }

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:
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 = 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; }

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:
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.stream().findFirst().get(); 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)); }

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:
public void execute(ScriptEntry scriptEntry) { EntityTag entity = (EntityTag) scriptEntry.getObject("entity"); 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); }

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:
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); Thread.currentThread().interrupt(); } return results; }

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:
public static void awaitOrFail(CountDownLatch latch) { awaitOrFail(latch, 15); }

Target:
public static void awaitOrFail(CountDownLatch latch) { awaitOrFail(latch, 10); }
Source:
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; continue; } 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(); }

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:
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); JSONObject answer = new JSONObject(restTemplate.postForObject(verificationUrl, request , String.class)); return answer.getBoolean("success"); }

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:
public void executeSetter(Object bean, Object value) { propertySetterAccessor.executeSetter(bean, value); }

Target:
public void executeSetter(Object bean, Object value) { setterFunction.accept(bean, value); }
Source:
public void testAccessControlsForCommentByInstructor() { prepareTestData(); ______TS("Instructor as feedback participant"); 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); }

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:
public void clickOnWorkspacesTab() { redrawUiElementsTimeout.until(ExpectedConditions.visibilityOf(workspacesTab)).click(); }

Target:
public void clickOnWorkspacesTab() { seleniumWebDriverHelper.waitAndClick(workspacesTab); }
Source:
public String getModeName() { String header = getHeader(); return header.substring(0, header.indexOf(' ')); }

Target:
private String getModeName() { String header = getHeader(); return header.substring(0, header.indexOf(' ')); }
Source:
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-pool")); DynamicCredentialsFileLoader credentialsFileLoader = new DynamicCredentialsFileLoader(basicCredentials, credentialsFile); credentialsFileLoader.updateCredentialsFromProperties(); ses.scheduleAtFixedRate(credentialsFileLoader, 0, credentialsRefreshInterval, TimeUnit.SECONDS); return ses; }

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:
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( () -> { FTPSClient client; 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; } }); } }

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:
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", "delete_cookie", false, "Delete its cookie on zookeeper"); }

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:
public static UiStateSummary from(UiInfo infos) { AtomicReference<State> res = new AtomicReference<>(State.GREEN); 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()); }

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); }
Source:
public static String loadPrivateKeys(JSch jsch, String current_pkeys){ Preferences preferences=JSchCorePlugin.getPlugin().getPluginPreferences(); String ssh_home=preferences.getString(IConstants.KEY_SSH2HOME); String pkeys=preferences.getString(IConstants.KEY_PRIVATEKEY); if(ssh_home.length()==0) ssh_home=PreferenceInitializer.SSH_HOME_DEFAULT; java.io.File file; String[] pkey=pkeys.split(","); String[] _pkey=current_pkeys.split(","); String result=""; for (String p : pkey) { file = new java.io.File(p); if (!file.isAbsolute()) { file = new java.io.File(ssh_home, p); } if (file.exists()) { boolean notyet=true; for (String _pkey1 : _pkey) { if (p.equals(_pkey1)) { notyet=false; break;} } try { if(notyet) jsch.addIdentity(file.getPath()); if (result.length()==0) { result = p; } else { result += ("," + p); } }catch(JSchException e){ JSchCorePlugin.log(IStatus.ERROR, "An error occurred loading the SSH2 private keys", e); } } } return result; }

Target:
public static String loadPrivateKeys(JSch jsch, String current_pkeys){ Preferences preferences=JSchCorePlugin.getPlugin().getPluginPreferences(); String ssh_home=preferences.getString(IConstants.KEY_SSH2HOME); String pkeys=preferences.getString(IConstants.KEY_PRIVATEKEY); if(ssh_home.length()==0) ssh_home=PreferenceInitializer.SSH_HOME_DEFAULT; java.io.File file; String[] pkey=pkeys.split(","); String[] _pkey=current_pkeys.split(","); String result=""; for(String p : pkey){ file=new java.io.File(p); if(!file.isAbsolute()){ file=new java.io.File(ssh_home, p); } if(file.exists()){ boolean notyet=true; for(String _p : _pkey){ if(p.equals(_p)){ notyet=false; break; } } try{ if(notyet) jsch.addIdentity(file.getPath()); if(result.length()==0){ result=p; } else{ result+=(","+p); } } catch(JSchException e){ JSchCorePlugin.log(IStatus.ERROR, "An error occurred loading the SSH2 private keys", e); } } } return result; }
Source:
private ObjectId createNoteContent(String reason, ObjectInserter inserter) throws UnsupportedEncodingException, IOException { String noteContent = reason != null ? reason : ""; if (!noteContent.endsWith("\n")) { noteContent = noteContent + "\n"; } return inserter.insert(Constants.OBJ_BLOB, noteContent.getBytes("UTF-8")); }

Target:
private ObjectId createNoteContent(String reason, ObjectInserter inserter) throws UnsupportedEncodingException, IOException { String noteContent = reason != null ? reason : ""; if (noteContent.length() > 0 && !noteContent.endsWith("\n")) { noteContent = noteContent + "\n"; } return inserter.insert(Constants.OBJ_BLOB, noteContent.getBytes("UTF-8")); }
Source:
public Object getData(String name) { Object result = this.data.get(name); if (result == null && name != null && name.equalsIgnoreCase("caseid")) { result = getCaseId(); } return result; }

Target:
public Object getData(String name) { Object result = this.data.get(name); if (result == null && "caseid".equalsIgnoreCase(name)) { result = getCaseId(); } return result; }
Source:
private static int getDefaultDataChannelCount() { int availableProcessors = Runtime.getRuntime().availableProcessors(); return Math.min(250, Math.max(1, availableProcessors * 2)); }

Target:
private static int getDefaultDataChannelCount() { int availableProcessors = Runtime.getRuntime().availableProcessors(); return Math.min(250, Math.max(1, availableProcessors * 4)); }
Source:
public void listDirectoriesAndFilesAsyncMaxOverload() { DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); directoryAsyncClient.listFilesAndDirectories("subdir", 10, Duration.ofSeconds(1)).subscribe( fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", fileRef.isDirectory(), fileRef.name()), error -> System.err.println(error.toString()), () -> System.out.println("Completed listing the directories and files.") ); END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer-duration }

Target:
public void listDirectoriesAndFilesAsyncMaxOverload() { DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); directoryAsyncClient.listFilesAndDirectories("subdir", 10).subscribe( fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", fileRef.isDirectory(), fileRef.name()), error -> System.err.println(error.toString()), () -> System.out.println("Completed listing the directories and files.") ); END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer }