auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCreateSuccess() { AccountService accountService = Mockito.mock(AccountService.class); Account account = Mockito.mock(Account.class); Mockito.when(accountService.getAccount(anyLong())).thenReturn(account); VolumeApiService volumeApiService = Mockito.mock(VolumeApiService.class); Snapshot snapshot = Mockito.mock(Snapshot.class); try { Mockito.when(volumeApiService.takeSnapshot(anyLong(), anyLong(), anyLong(), any(Account.class), anyBoolean(), isNull(Snapshot.LocationType.class))).thenReturn(snapshot); } catch (Exception e) { Assert.fail("Received exception when success expected " + e.getMessage()); } responseGenerator = Mockito.mock(ResponseGenerator.class); SnapshotResponse snapshotResponse = Mockito.mock(SnapshotResponse.class); Mockito.when(responseGenerator.createSnapshotResponse(snapshot)).thenReturn(snapshotResponse); Mockito.doNothing().when(snapshotResponse).setAccountName(anyString()); createSnapshotCmd._accountService = accountService; createSnapshotCmd._responseGenerator = responseGenerator; createSnapshotCmd._volumeService = volumeApiService; createSnapshotCmd.execute(); }

Target:
public void testCreateSuccess() { AccountService accountService = Mockito.mock(AccountService.class); Account account = Mockito.mock(Account.class); Mockito.when(accountService.getAccount(anyLong())).thenReturn(account); VolumeApiService volumeApiService = Mockito.mock(VolumeApiService.class); Snapshot snapshot = Mockito.mock(Snapshot.class); try { Mockito.when(volumeApiService.takeSnapshot(anyLong(), anyLong(), anyLong(), any(Account.class), anyBoolean(), isNull(Snapshot.LocationType.class))).thenReturn(snapshot); } catch (Exception e) { Assert.fail("Received exception when success expected " + e.getMessage()); } responseGenerator = Mockito.mock(ResponseGenerator.class); SnapshotResponse snapshotResponse = Mockito.mock(SnapshotResponse.class); Mockito.when(responseGenerator.createSnapshotResponse(snapshot)).thenReturn(snapshotResponse); Mockito.doNothing().when(snapshotResponse).setAccountName(anyString()); createSnapshotCmd._accountService = accountService; createSnapshotCmd._responseGenerator = responseGenerator; createSnapshotCmd._volumeService = volumeApiService; try { createSnapshotCmd.execute(); } catch (Exception e) { Assert.fail("Received exception when success expected " + e.getMessage()); } }
Source:
public IDEWorkflow(@Named(CTX_SERVERS) List<IServerDescriptor> endpoints, ILogEventsQueue queue, ISystemSettings settings, IEventBroker broker, MylynNotificationsSupport notificationSupport, UploadReportsScheduler uploadService, IEclipseContext context, @Named(IDEWorkflow.CTX_REPORT_PROCESSORS) List<IProcessorDescriptor> descriptors) { this.servers = endpoints; this.queue = queue; this.system = settings; this.broker = broker; this.notificationSupport = notificationSupport; this.uploadService = uploadService; this.context = context; this.descriptors = descriptors; }

Target:
public IDEWorkflow(@Named(CTX_SERVERS) List<IServerDescriptor> endpoints, ILogEventsQueue queue, ISystemSettings settings, IEventBroker broker, MylynNotificationsSupport notificationSupport, UploadReportsScheduler uploadService, IEclipseContext context, @Named(IDEWorkflow.CTX_REPORT_PROCESSORS) List<IProcessorDescriptor> descriptors) { this.servers = endpoints; this.queue = queue; this.settings = settings; this.broker = broker; this.notificationSupport = notificationSupport; this.uploadService = uploadService; this.context = context; this.descriptors = descriptors; }
Source:
private void copyFiles(File src, File dest) throws IOException { FileOutputStream fos; try (FileInputStream fis = new FileInputStream(src)) { fos = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; while ((length = fis.read(buffer)) > 0) { fos.write(buffer, 0, length); } } fos.close(); }

Target:
private void copyFiles(File src, File dest) throws IOException { try (FileOutputStream fos = new FileOutputStream(dest); FileInputStream fis = new FileInputStream(src)) { byte[] buffer = new byte[1024]; int length; while ((length = fis.read(buffer)) > 0) { fos.write(buffer, 0, length); } } }
Source:
private static void writePolyline(Geometry geometry, SliceOutput output, boolean inGeometryCollection) { requireNonNull(geometry, "polyline is null"); requireNonNull(output, "output is null"); int numParts; int numPoints = geometry.getNumPoints(); switch (geometry.getGeometryType()) { case JTS_MULTI_LINESTRING: numParts = geometry.getNumGeometries(); break; case JTS_LINESTRING: numParts = numPoints > 0 ? 1 : 0; break; default: throw new IllegalArgumentException("Expected Polygon or MultiPolygon, but got " + geometry.getGeometryType()); } if (inGeometryCollection) { output.writeInt(SIZE_OF_INT + SIZE_OF_DOUBLE * 4 + SIZE_OF_INT * 2 + SIZE_OF_INT * numParts + SIZE_OF_DOUBLE * 2 * numPoints); } else { switch (geometry.getGeometryType()) { case JTS_LINESTRING: output.writeByte(GeometryUtils.GeometryTypeName.LINE_STRING.code()); break; case JTS_MULTI_LINESTRING: output.writeByte(GeometryUtils.GeometryTypeName.MULTI_LINE_STRING.code()); break; } } output.writeInt(EsriShapeType.POLYLINE.code); writeEnvelope(geometry.getEnvelopeInternal(), output); output.writeInt(numParts); output.writeInt(numPoints); if (numParts > 0) { output.writeInt(0); for (int i = 0; i < numParts - 1; i++) { output.writeInt(geometry.getGeometryN(i).getNumPoints()); } } writeCoordinates(geometry.getCoordinates(), output); }

Target:
private static void writePolyline(Geometry geometry, SliceOutput output, boolean inGeometryCollection) { requireNonNull(geometry, "polyline is null"); requireNonNull(output, "output is null"); int numParts; int numPoints = geometry.getNumPoints(); switch (geometry.getGeometryType()) { case JTS_MULTI_LINESTRING: numParts = geometry.getNumGeometries(); break; case JTS_LINESTRING: numParts = numPoints > 0 ? 1 : 0; break; default: throw new IllegalArgumentException("Expected LineString or MultiLineString, but got " + geometry.getGeometryType()); } if (inGeometryCollection) { output.writeInt(SIZE_OF_INT + SIZE_OF_DOUBLE * 4 + SIZE_OF_INT * 2 + SIZE_OF_INT * numParts + SIZE_OF_DOUBLE * 2 * numPoints); } else { switch (geometry.getGeometryType()) { case JTS_LINESTRING: output.writeByte(GeometryUtils.GeometryTypeName.LINE_STRING.code()); break; case JTS_MULTI_LINESTRING: output.writeByte(GeometryUtils.GeometryTypeName.MULTI_LINE_STRING.code()); break; } } output.writeInt(EsriShapeType.POLYLINE.code); writeEnvelope(geometry.getEnvelopeInternal(), output); output.writeInt(numParts); output.writeInt(numPoints); if (numParts > 0) { output.writeInt(0); for (int i = 0; i < numParts - 1; i++) { output.writeInt(geometry.getGeometryN(i).getNumPoints()); } } writeCoordinates(geometry.getCoordinates(), output); }
Source:
private void buildActivationCondition(final PropertyNode node, final PropertyNode origin, final int level) { if (node == null) { return; } node.getProperty().getCondition() .forEach(c -> { final String targetPath = pathResolver.resolvePath(node.getProperty().getPath(), c.getTarget()); if (targetPath != null && !targetPath.isEmpty()) { c.setTargetPath(targetPath); activations.computeIfAbsent(origin.getProperty().getPath(), (key) -> new HashMap<>()); activations.get(origin.getProperty().getPath()).computeIfAbsent(level, (k) -> new ArrayList<>()); activations.get(origin.getProperty().getPath()).get(level).add(c); } }); final int l = level + 1; buildActivationCondition(node.getParent(), origin, l); }

Target:
private void buildActivationCondition(final PropertyNode node, final PropertyNode origin, final int level) { if (node == null) { return; } node.getProperty().getCondition() .forEach(c -> { final Optional<String> targetPath = pathResolver.resolvePath(node.getProperty().getPath(), c.getTarget()); if (targetPath.isPresent()) { c.setTargetPath(targetPath.get()); activations.computeIfAbsent(origin.getProperty().getPath(), (key) -> new HashMap<>()); activations.get(origin.getProperty().getPath()).computeIfAbsent(level, (k) -> new ArrayList<>()); activations.get(origin.getProperty().getPath()).get(level).add(c); } else { LOGGER.warn("can't find target property '" + c.getTarget() + "' used on property '" + c.getSourcePath() + "'"); } }); final int l = level + 1; buildActivationCondition(node.getParent(), origin, l); }
Source:
private boolean newValueAlreadyExpired(K key, V oldValue, V newValue) { if (newValue == null) { return false; } final Duration duration; if (oldValue == null) { try { Expiry<? super K, ? super V> expiry = runtimeConfiguration.getExpiry(); duration = expiry.getExpiryForCreation(key, newValue); } catch (RuntimeException re) { logger.error("Expiry computation caused an exception - Expiry duration will be 0 ", re); return true; } } else { try { ValueSupplier<V> oldSupplier = supplierOf(oldValue); duration = runtimeConfiguration.getExpiry().getExpiryForUpdate(key, oldSupplier, newValue); } catch (RuntimeException re) { logger.error("Expiry computation caused an exception - Expiry duration will be 0 ", re); return true; } } return Duration.ZERO.equals(duration); }

Target:
private boolean newValueAlreadyExpired(K key, V oldValue, V newValue) { if (newValue == null) { return false; } final Duration duration; if (oldValue == null) { try { duration = runtimeConfiguration.getExpiry().getExpiryForCreation(key, newValue); } catch (RuntimeException re) { logger.error("Expiry computation caused an exception - Expiry duration will be 0 ", re); return true; } } else { try { duration = runtimeConfiguration.getExpiry().getExpiryForUpdate(key, supplierOf(oldValue), newValue); } catch (RuntimeException re) { logger.error("Expiry computation caused an exception - Expiry duration will be 0 ", re); return true; } } return Duration.ZERO.equals(duration); }
Source:
public void createGame(boolean isHosting, String ipAddress, int port, int players) { logger.info("Creating game"); this.isHost = isHosting; closeNewGameDialog(); if(isHost){ router = Router.getHostRouter(port, players); dialog = new HostGameDialog(view,this); }else{ router = Router.getClientRouter(ipAddress, port); dialog = new JoinGameDialog(view,this); } router.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent changeEvent) { if (changeEvent.getSource().getClass().equals(SevenWondersGame.class)) { handleGameChange(); } else if (changeEvent.getSource().getClass().equals(HumanPlayer.class)){ handlePlayerChange(); } else { handleRouterChange(); } } }); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { dialog.setVisible(true); } }); }

Target:
public void createGame(boolean isHosting, String ipAddress, int port, int players) { logger.info("Creating game"); this.isHost = isHosting; closeNewGameDialog(); if(isHost){ router = Router.getHostRouter(port, players); dialog = new HostGameDialog(view,this); }else{ router = Router.getClientRouter(ipAddress, port); dialog = new JoinGameDialog(view,this); } router.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent changeEvent) { if (changeEvent.getSource() instanceof SevenWondersGame) { handleGameChange(); } else if (changeEvent.getSource() instanceof Player){ handlePlayerChange(); } else if (changeEvent.getSource() instanceof Router){ handleRouterChange(); } else { logger.error("Unknown change source!"); } } }); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { dialog.setVisible(true); } }); }
Source:
public static IValue getValueOfInitializer(IASTInitializer init, IType type) { IASTInitializerClause clause= null; if (init instanceof IASTEqualsInitializer) { clause= ((IASTEqualsInitializer) init).getInitializerClause(); } else if (init instanceof ICPPASTConstructorInitializer) { IASTInitializerClause[] args= ((ICPPASTConstructorInitializer) init).getArguments(); if (args.length == 1 && args[0] instanceof IASTExpression) { IType typeUpToPointers= SemanticUtil.getUltimateTypeUptoPointers(type); if (typeUpToPointers instanceof IPointerType || typeUpToPointers instanceof IBasicType) { clause= args[0]; } } } else if (init instanceof ICPPASTInitializerList) { ICPPASTInitializerList list= (ICPPASTInitializerList) init; switch (list.getSize()) { case 0: return IntegralValue.create(0); case 1: clause= list.getClauses()[0]; break; default: return ((ICPPEvaluationOwner) init).getEvaluation().getValue(clause); } } if (clause instanceof IASTExpression) { return ValueFactory.create((IASTExpression) clause); } if (clause instanceof ICPPASTInitializerList) { return ((ICPPEvaluationOwner) clause).getEvaluation().getValue(clause); } return IntegralValue.UNKNOWN; }

Target:
public static IValue getValueOfInitializer(IASTInitializer init, IType type) { IASTInitializerClause clause= null; if (init instanceof IASTEqualsInitializer) { clause= ((IASTEqualsInitializer) init).getInitializerClause(); } else if (init instanceof ICPPASTConstructorInitializer) { IASTInitializerClause[] args= ((ICPPASTConstructorInitializer) init).getArguments(); if (args.length == 1 && args[0] instanceof IASTExpression) { IType typeUpToPointers= SemanticUtil.getUltimateTypeUptoPointers(type); if (typeUpToPointers instanceof IPointerType || typeUpToPointers instanceof IBasicType) { clause= args[0]; } } } else if (init instanceof ICPPASTInitializerList) { ICPPASTInitializerList list= (ICPPASTInitializerList) init; switch (list.getSize()) { case 0: return IntegralValue.create(0); case 1: clause= list.getClauses()[0]; break; default: return ((ICPPEvaluationOwner) init).getEvaluation().getValue(init); } } if (clause instanceof IASTExpression) { return ValueFactory.create((IASTExpression) clause); } if (clause instanceof ICPPASTInitializerList) { return ((ICPPEvaluationOwner) clause).getEvaluation().getValue(clause); } return IntegralValue.UNKNOWN; }
Source:
Page() throws IOException { Document hostDoc = HtmlDomUtil.clone(template); css = injectCssFile(hostDoc, "gerrit_sitecss", site.site_css); header = injectXmlFile(hostDoc, "gerrit_header", site.site_header); footer = injectXmlFile(hostDoc, "gerrit_footer", site.site_footer); final HostPageData pageData = new HostPageData(); final List<String> webUiPluginUrls = new ArrayList<String>(); for (RegisteredWebUiPlugin plugin : webUiPlugins.get()) { webUiPluginUrls.add(plugin.getFullPath()); } pageData.plugnis = webUiPluginUrls.toArray(new String[webUiPluginUrls.size()]); pageData.config = config; final StringWriter w = new StringWriter(); w.write("var " + HPD_ID + "="); json(pageData, w); w.write(";"); final Element data = HtmlDomUtil.find(hostDoc, HPD_ID); asScript(data); data.appendChild(hostDoc.createTextNode(w.toString())); data.appendChild(hostDoc.createComment(HPD_ID)); permutations = new HashMap<Permutation, Content>(); for (Permutation p : selector.getPermutations()) { final Document d = HtmlDomUtil.clone(hostDoc); Element nocache = HtmlDomUtil.find(d, "gerrit_module"); nocache.getParentNode().removeChild(nocache); p.inject(d); permutations.put(p, new Content(d)); } Element nocache = HtmlDomUtil.find(hostDoc, "gerrit_module"); asScript(nocache); nocache.setAttribute("src", noCacheName); permutations.put(null, new Content(hostDoc)); }

Target:
Page() throws IOException { Document hostDoc = HtmlDomUtil.clone(template); css = injectCssFile(hostDoc, "gerrit_sitecss", site.site_css); header = injectXmlFile(hostDoc, "gerrit_header", site.site_header); footer = injectXmlFile(hostDoc, "gerrit_footer", site.site_footer); final HostPageData pageData = new HostPageData(); pageData.plugnisUrls =getPluginUrls(); pageData.config = config; final StringWriter w = new StringWriter(); w.write("var " + HPD_ID + "="); json(pageData, w); w.write(";"); final Element data = HtmlDomUtil.find(hostDoc, HPD_ID); asScript(data); data.appendChild(hostDoc.createTextNode(w.toString())); data.appendChild(hostDoc.createComment(HPD_ID)); permutations = new HashMap<Permutation, Content>(); for (Permutation p : selector.getPermutations()) { final Document d = HtmlDomUtil.clone(hostDoc); Element nocache = HtmlDomUtil.find(d, "gerrit_module"); nocache.getParentNode().removeChild(nocache); p.inject(d); permutations.put(p, new Content(d)); } Element nocache = HtmlDomUtil.find(hostDoc, "gerrit_module"); asScript(nocache); nocache.setAttribute("src", noCacheName); permutations.put(null, new Content(hostDoc)); }
Source:
protected Boolean isForwardAllowed(final TaskInstance task, final IdentityProvider identityProvider) { if (TaskStatus.TASK_STATUS_READY.equals(task.getStatus())) { if (currentUserIsPotentialOwner(identityProvider, task)) { return true; } if (currentUserIsBusinessAdministrator(identityProvider, task)) { return true; } } else if (TaskStatus.TASK_STATUS_IN_PROGRESS.equals(task.getStatus()) || TaskStatus.TASK_STATUS_RESERVED.equals(task.getStatus())) { if (currentUserIsOwner(identityProvider, task)) { return true; } if (currentUserIsBusinessAdministrator(identityProvider, task)) { return true; } } return false; }

Target:
protected Boolean isForwardAllowed(final TaskInstance task, final IdentityProvider identityProvider) { return isReassignmentAllowed(task, identityProvider); }
Source:
public boolean disableLegacySafetyChecksWarningPotentialDataCorruption() { return !useAsyncLockService(); }

Target:
public boolean disableLegacySafetyChecksWarningPotentialDataCorruption() { return false; }
Source:
public SimpleSessionFactoryBuilder setTcclLookupPrecedenceBefore() { return onBootstraServiceRegistryBuilder( builder -> builder.applyClassLoader( new TcclLookupPrecedenceClassLoader() ) ); }

Target:
public SimpleSessionFactoryBuilder setTcclLookupPrecedenceBefore() { return onBootstraServiceRegistryBuilder( builder -> builder.applyTcclLookupPrecedence( TcclLookupPrecedence.BEFORE ) ); }
Source:
public String getMessage(FormApiException exception) { if (exception.getType() == FormApiException.Type.UNKNOWN_HOST) { return TranslationHandler.getString(Collect.getInstance(), R.string.unknown_host_error, exception.getServerUrl()) + " " + TranslationHandler.getString(Collect.getInstance(), R.string.report_to_project_lead); } return TranslationHandler.getString(Collect.getInstance(), R.string.report_to_project_lead); }

Target:
public String getMessage(FormApiException exception) { switch (exception.getType()) { case UNREACHABLE: return TranslationHandler.getString(context, R.string.unreachable_error, exception.getServerUrl()) + " " + TranslationHandler.getString(context, R.string.report_to_project_lead); case SECURITY_ERROR: return TranslationHandler.getString(context, R.string.security_error, exception.getServerUrl()) + " " + TranslationHandler.getString(context, R.string.report_to_project_lead); default: return TranslationHandler.getString(context, R.string.report_to_project_lead); } }
Source:
private String getClockForPlot(List<WorkloadTaskData> resultData) { String clock = resultData.iterator().next().getClock(); for (ClockTranslatorForPlots cc : ClockTranslatorForPlots.values()) { if (clock.contains(cc.getContent())) return cc.getResult(); } return clock; }

Target:
private String getClockForPlot(List<WorkloadTaskData> resultData) { String clock = "-"; if (resultData.size() > 0) { clock = resultData.get(0).getClock(); if (clockDictionary != null) { for (String key : clockDictionary.keySet()) { if (clock.contains(key)) { return clockDictionary.get(key); } } } } return clock; }
Source:
public void massUpdateStatisticsForVds(Collection<VdsNetworkStatistics> statistics) { try { List<MapSqlParameterSource> executions = new ArrayList<MapSqlParameterSource>(); for (VdsNetworkStatistics stats : statistics) { executions.add(getCustomMapSqlParameterSource() .addValue("id", stats.getId()) .addValue("rx_drop", stats.getReceiveDropRate()) .addValue("rx_rate", stats.getReceiveRate()) .addValue("tx_drop", stats.getTransmitDropRate()) .addValue("tx_rate", stats.getTransmitRate()) .addValue("iface_status", stats.getStatus()) .addValue("vds_id", stats.getVdsId())); } getCallsHandler().executeStoredProcAsBatch("Updatevds_interface_statistics", executions); } catch (Exception e) { log.error("Can't update Vds Statistics", e); } }

Target:
public void massUpdateStatisticsForVds( Collection<VdsNetworkStatistics> statistics) { List<MapSqlParameterSource> executions = new ArrayList<MapSqlParameterSource>(statistics.size()); for (VdsNetworkStatistics stats : statistics) { executions.add(getCustomMapSqlParameterSource() .addValue("id", stats.getId()) .addValue("rx_drop", stats.getReceiveDropRate()) .addValue("rx_rate", stats.getReceiveRate()) .addValue("tx_drop", stats.getTransmitDropRate()) .addValue("tx_rate", stats.getTransmitRate()) .addValue("iface_status", stats.getStatus()) .addValue("vds_id", stats.getVdsId())); } getCallsHandler().executeStoredProcAsBatch("Updatevds_interface_statistics", executions); }
Source:
public List<String> getDnsDetails(Network network) { List<String> dnsServers = null; Boolean configureDns = Boolean.valueOf(_configDao.getValue(NuageVspManager.NuageVspConfigDns.key())); if (configureDns) { Boolean configureExternalDns = Boolean.valueOf(_configDao.getValue(NuageVspManager.NuageVspDnsExternal.key())); DataCenterVO dc = _dataCenterDao.findById(network.getDataCenterId()); dnsServers = new ArrayList<String>(); if (configureExternalDns) { if (dc.getDns1() != null && dc.getDns1().length() > 0) { dnsServers.add(dc.getDns1()); } if (dc.getDns2() != null && dc.getDns2().length() > 0) { dnsServers.add(dc.getDns2()); } } else { if (dc.getInternalDns1() != null && dc.getInternalDns1().length() > 0) { dnsServers.add(dc.getInternalDns1()); } if (dc.getInternalDns2() != null && dc.getInternalDns2().length() > 0) { dnsServers.add(dc.getInternalDns2()); } } } return dnsServers; }

Target:
public List<String> getDnsDetails(Network network) { Boolean configureDns = Boolean.valueOf(_configDao.getValue(NuageVspManager.NuageVspConfigDns.key())); if (!configureDns) { return Lists.newArrayList(); } Boolean configureExternalDns = Boolean.valueOf(_configDao.getValue(NuageVspManager.NuageVspDnsExternal.key())); DataCenterVO dc = _dataCenterDao.findById(network.getDataCenterId()); List<String> dnsServers = new ArrayList<String>(); if (configureExternalDns) { if (!Strings.isNullOrEmpty(dc.getDns1())) { dnsServers.add(dc.getDns1()); } if (!Strings.isNullOrEmpty(dc.getDns2())) { dnsServers.add(dc.getDns2()); } } else { if (!Strings.isNullOrEmpty(dc.getInternalDns1())) { dnsServers.add(dc.getInternalDns1()); } if (!Strings.isNullOrEmpty(dc.getInternalDns2())) { dnsServers.add(dc.getInternalDns2()); } } return dnsServers; }
Source:
public void close() throws JUnitException { final ExecutorService executor = getPool(); executor.shutdown(); try { executor.awaitTermination(1, TimeUnit.MINUTES); } catch (final InterruptedException ie) { throw new JUnitException("Interrupted while waiting for forked tests to complete; " + ie.getMessage(), ie); } }

Target:
public void close() { executorService.shutdown(); Logger logger = LoggerFactory.getLogger(getClass()); try { if (!executorService.awaitTermination(1, TimeUnit.MINUTES)) { logger.warn(() -> "Timed out while waiting for tests to complete."); } } catch (InterruptedException e) { logger.warn(e, () -> "Interrupted while waiting for tests to complete."); Thread.currentThread().interrupt(); } }
Source:
public AtomicObjectFactory(Cache<Object, Object> c, int m) throws InvalidCacheUsageException{ cache = c; maxSize = m; registeredContainers= new LinkedHashMap<ContainerSignature,Container>(){ @Override protected boolean removeEldestEntry(final java.util.Map.Entry<ContainerSignature,Container> eldest) { if(maxSize!=0 && this.size() >= maxSize){ evictionExecutor.submit(new Callable<Void>() { @Override public Void call() throws IOException { try { log.debug("Disposing " + eldest.getValue().toString()); eldest.getValue().dispose(false); } catch (Exception e) { e.printStackTrace(); } return null; } }); return true; } return false; } }; log = LogFactory.getLog(this.getClass()); }

Target:
public AtomicObjectFactory(Cache<Object, Object> c, int m) throws InvalidCacheUsageException{ cache = c; maxSize = m; registeredContainers= new LinkedHashMap<ContainerSignature,Container>(){ @Override protected boolean removeEldestEntry(final java.util.Map.Entry<ContainerSignature,Container> eldest) { if(maxSize!=0 && this.size() >= maxSize){ evictionExecutor.submit(new Callable<Void>() { @Override public Void call() throws IOException { try { if (log.isDebugEnabled()) log.debugf("Disposing %s", eldest.getValue().toString()); eldest.getValue().dispose(false); } catch (Exception e) { e.printStackTrace(); } return null; } }); return true; } return false; } }; log = LogFactory.getLog(this.getClass()); }
Source:
public BatchRefUpdate addCommand(ReceiveCommand... cmd) { commands.addAll(Arrays.asList(cmd)); classifiedUpdates = false; return this; }

Target:
public BatchRefUpdate addCommand(ReceiveCommand... cmd) { return addCommand(Arrays.asList(cmd)); }
Source:
public void testCloseMultipleBlocks() { azureBlobOutputStream.write(bytes, 0, THRESHOLD); azureBlobOutputStream.write(bytes, 0, THRESHOLD); int blockNum = 0; String blockId = String.format("%05d", blockNum); String blockIdEncoded = Base64.getEncoder().encodeToString(blockId.getBytes()); int blockNum1 = 1; String blockId1 = String.format("%05d", blockNum1); String blockIdEncoded1 = Base64.getEncoder().encodeToString(blockId1.getBytes()); PowerMockito.doAnswer(invocation -> { ArrayList<String> blockListArg = (ArrayList<String>) invocation.getArguments()[0]; String blockIdArg = (String) blockListArg.toArray()[0]; String blockIdArg1 = (String) blockListArg.toArray()[1]; Assert.assertEquals(blockIdEncoded, blockIdArg); Assert.assertEquals(blockIdEncoded1, blockIdArg1); Map<String, String> blobMetadata = (Map<String, String>) invocation.getArguments()[2]; Assert.assertEquals(blobMetadata.get(AzureBlobOutputStream.BLOB_RAW_SIZE_BYTES_METADATA), Long.toString(2 * THRESHOLD)); return Mono.just(new SimpleResponse(null, 200, null, null)); }).when(mockBlobAsyncClient).commitBlockListWithResponse(anyList(), any(), any(), any(), any()); azureBlobOutputStream.close(); verify(mockMetrics).updateAzureCommitMetrics(); }

Target:
public void testCloseMultipleBlocks() { azureBlobOutputStream.write(BYTES, 0, THRESHOLD); azureBlobOutputStream.write(BYTES, 0, THRESHOLD); int blockNum = 0; String blockId = String.format("%05d", blockNum); String blockIdEncoded = Base64.getEncoder().encodeToString(blockId.getBytes()); int blockNum1 = 1; String blockId1 = String.format("%05d", blockNum1); String blockIdEncoded1 = Base64.getEncoder().encodeToString(blockId1.getBytes()); PowerMockito.doAnswer(invocation -> { ArrayList<String> blockListArg = (ArrayList<String>) invocation.getArguments()[0]; Assert.assertEquals(Arrays.asList(blockIdEncoded, blockIdEncoded1), blockListArg); Map<String, String> blobMetadata = (Map<String, String>) invocation.getArguments()[2]; Assert.assertEquals(blobMetadata.get(AzureBlobOutputStream.BLOB_RAW_SIZE_BYTES_METADATA), Long.toString(2 * THRESHOLD)); return Mono.just(new SimpleResponse(null, 200, null, null)); }).when(mockBlobAsyncClient).commitBlockListWithResponse(anyList(), any(), any(), any(), any()); azureBlobOutputStream.close(); verify(mockMetrics).updateAzureCommitMetrics(); }
Source:
public Object apply(ChangeResource rsrc) throws BadRequestException, OrmException, NoSuchChangeException { Map<Account.Id, ReviewerResource> reviewers = Maps.newLinkedHashMap(); ReviewDb db = dbProvider.get(); Change.Id changeId = rsrc.getChange().getId(); for (PatchSetApproval patchSetApproval : db.patchSetApprovals().byChange(changeId)) { Account.Id accountId = patchSetApproval.getAccountId(); if (!reviewers.containsKey(accountId)) { Account account = accountCache.get(accountId).getAccount(); reviewers.put(accountId, resourceFactory.create(rsrc, account)); } } return json.format(reviewers.values()); }

Target:
public Object apply(ChangeResource rsrc) throws BadRequestException, OrmException { Map<Account.Id, ReviewerResource> reviewers = Maps.newLinkedHashMap(); ReviewDb db = dbProvider.get(); Change.Id changeId = rsrc.getChange().getId(); for (PatchSetApproval patchSetApproval : db.patchSetApprovals().byChange(changeId)) { Account.Id accountId = patchSetApproval.getAccountId(); if (!reviewers.containsKey(accountId)) { Account account = accountCache.get(accountId).getAccount(); reviewers.put(accountId, resourceFactory.create(rsrc, account)); } } return json.format(reviewers.values()); }
Source:
public void testWorkdirIsParent_CreateRepositoryFromGitDirOnlyWithBareConfigFalse() throws Exception { File gitDir = getFile("workdir", "repoWithBareConfigTrue", "child"); Repository repo = new Repository(gitDir, null); repo.getConfig().setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_BARE, false); repo.getConfig().save(); repo = new Repository(gitDir, null); String workdir = repo.getWorkDir().getName(); assertEquals("repoWithBareConfigTrue", workdir); }

Target:
public void testWorkdirIsParent_CreateRepositoryFromGitDirOnlyWithBareConfigFalse() throws Exception { File gitDir = getFile("workdir", "repoWithBareConfigTrue", "child"); setBare(gitDir, false); Repository repo = new Repository(gitDir, null); assertWorkdirPath(repo, "workdir", "repoWithBareConfigTrue"); }
Source:
static void initialize(String rootPath, PageStoreType storeType) throws IOException { Path storePath = Paths.get(rootPath, storeType.name()); Files.createDirectories(storePath); LOG.info("Clean cache directory {}", rootPath); try (Stream<Path> stream = Files.list(Paths.get(rootPath))) { stream.filter(path -> !storePath.equals(path)) .map(Path::toString) .map(File::new) .forEach(FileUtils::deleteQuietly); } }

Target:
static void initialize(String rootPath, PageStoreType storeType) throws IOException { Path storePath = getStorePath(storeType, rootPath); Files.createDirectories(storePath); LOG.info("Clean cache directory {}", rootPath); try (Stream<Path> stream = Files.list(Paths.get(rootPath))) { stream.filter(path -> !storePath.equals(path)) .forEach(path -> { try { FileUtils.deletePathRecursively(path.toString()); } catch (IOException e) { LOG.warn("failed to delete in cache directory: {}", path, e.toString()); } }); } }
Source:
private RouterConfig createRouterConfig(boolean crossColoEnabled, int successTarget, int parallelism, int maxInflightNum, String customPercentiles, boolean excludeTimeout) { Properties props = new Properties(); props.setProperty("router.hostname", "localhost"); props.setProperty("router.datacenter.name", localDcName); props.setProperty("router.get.cross.dc.enabled", Boolean.toString(crossColoEnabled)); props.setProperty("router.get.success.target", Integer.toString(successTarget)); props.setProperty("router.get.request.parallelism", Integer.toString(parallelism)); props.setProperty("router.get.include.non.originating.dc.replicas", "true"); props.setProperty("router.get.replicas.required", Integer.toString(Integer.MAX_VALUE)); props.setProperty("router.latency.tolerance.quantile", Double.toString(QUANTILE)); props.setProperty("router.operation.tracker.metric.scope", trackerScope.toString()); props.setProperty("router.adaptive.tracker.max.inflight.requests", Integer.toString(maxInflightNum)); props.setProperty("router.operation.tracker.exclude.timeout.enabled", Boolean.toString(excludeTimeout)); if (customPercentiles != null) { props.setProperty("router.operation.tracker.custom.percentiles", customPercentiles); } return new RouterConfig(new VerifiableProperties(props)); }

Target:
private RouterConfig createRouterConfig(boolean crossColoEnabled, int successTarget, int parallelism, int maxInflightNum, String customPercentiles, boolean excludeTimeout) { Properties props = new Properties(); props.setProperty("router.hostname", "localhost"); props.setProperty("router.datacenter.name", localDcName); props.setProperty("router.get.cross.dc.enabled", Boolean.toString(crossColoEnabled)); props.setProperty("router.get.success.target", Integer.toString(successTarget)); props.setProperty("router.get.request.parallelism", Integer.toString(parallelism)); props.setProperty("router.get.include.non.originating.dc.replicas", "true"); props.setProperty("router.get.replicas.required", Integer.toString(Integer.MAX_VALUE)); props.setProperty("router.latency.tolerance.quantile", Double.toString(QUANTILE)); props.setProperty("router.operation.tracker.metric.scope", trackerScope.toString()); props.setProperty("router.operation.tracker.max.inflight.requests", Integer.toString(maxInflightNum)); props.setProperty("router.operation.tracker.exclude.timeout.enabled", Boolean.toString(excludeTimeout)); if (customPercentiles != null) { props.setProperty("router.operation.tracker.custom.percentiles", customPercentiles); } return new RouterConfig(new VerifiableProperties(props)); }
Source:
public boolean configure(final StaplerRequest req, final JSONObject formData) throws FormException { this.setApiKey(formData.getString("apiKey")); this.setHostname(formData.getString("hostname")); this.setBlacklist(formData.getString("blacklist")); this.setWhitelist(formData.getString("whitelist")); if ( formData.getString("tagNode").equals("true") ) { this.setTagNode(true); } else { this.setTagNode(false); } if ( formData.getString("jobRegex").equals("true") ) { this.setJobRegex(true); } else { this.setJobRegex(false); } daemonHost = formData.getString("daemonHost"); if (client != null) { try { client.stop(); String hp = daemonHost.split(":")[0]; int pp = Integer.parseInt(daemonHost.split(":")[1]); client = new NonBlockingStatsDClient("jenkins.job", hp, pp); logger.finer(String.format("Created new DogStatsD client (%s:%S)!", hp, pp)); } catch (Exception e) { logger.severe(String.format("Unable to create new StatsDClient. Exception: %s", e.toString())); } } targetMetricURL = formData.getString("targetMetricURL"); save(); return super.configure(req, formData); }

Target:
public boolean configure(final StaplerRequest req, final JSONObject formData) throws FormException { this.setApiKey(formData.getString("apiKey")); this.setHostname(formData.getString("hostname")); this.setBlacklist(formData.getString("blacklist")); this.setWhitelist(formData.getString("whitelist")); this.setGlobalJobTags(formData.getString("globalJobTags")); if ( formData.getString("tagNode").equals("true") ) { this.setTagNode(true); } else { this.setTagNode(false); } daemonHost = formData.getString("daemonHost"); if (client != null) { try { client.stop(); String hp = daemonHost.split(":")[0]; int pp = Integer.parseInt(daemonHost.split(":")[1]); client = new NonBlockingStatsDClient("jenkins.job", hp, pp); logger.finer(String.format("Created new DogStatsD client (%s:%S)!", hp, pp)); } catch (Exception e) { logger.severe(String.format("Unable to create new StatsDClient. Exception: %s", e.toString())); } } targetMetricURL = formData.getString("targetMetricURL"); save(); return super.configure(req, formData); }
Source:
public void testHdfsUri() throws Exception { URI expected; if (hdfsHost != null) { expected = URI.create("repo:hdfs://" + hdfsHost + ":" + hdfsPort + "/datasets/ns"); } else { expected = URI.create("repo:file:/datasets/ns"); } URI actual = command.getLegacyRepoUri( URI.create("dataset:hdfs:/datasets/ns/events"), "ns"); Assert.assertEquals("Unexpected repository URI", expected, actual); }

Target:
public void testHdfsUri() throws Exception { Assume.assumeTrue(hdfsIsDefault); URI expected = URI.create("repo:hdfs://" + hdfsHost + ":" + hdfsPort + "/datasets/ns"); URI actual = command.getLegacyRepoUri( URI.create("dataset:hdfs:/datasets/ns/events"), "ns"); Assert.assertEquals("Unexpected repository URI", expected, actual); }
Source:
public IInputOrder getInputOrder(String path) { for (InputOrder io : getInputOrderList()) { String ioPath = (new Path(io.getPath())).toOSString(); if (path.compareToIgnoreCase(ioPath) == 0) { return io; } } return null; }

Target:
public IInputOrder getInputOrder(String path) { for (InputOrder io : getInputOrderList()) { if (path.compareToIgnoreCase(io.getPath()) == 0) { return io; } } return null; }
Source:
private void launchTcpSlaveAgentListener() throws IOException { if(tcpSlaveAgentListener != null && tcpSlaveAgentListener.configuredPort!=slaveAgentPort) { tcpSlaveAgentListener.shutdown(); tcpSlaveAgentListener = null; } if(slaveAgentPort!=-1 && tcpSlaveAgentListener == null) { String administrativeMonitorId = getClass().getName()+".tcpBind"; try { tcpSlaveAgentListener = new TcpSlaveAgentListener(slaveAgentPort); AdministrativeMonitor previousMonitor = null; for(AdministrativeMonitor am : AdministrativeMonitor.all()) { if (administrativeMonitorId.equals(am.id)) { previousMonitor = am; break; } } if (previousMonitor != null) { AdministrativeMonitor.all().remove(previousMonitor); } } catch (BindException e) { new AdministrativeError(administrativeMonitorId, "Failed to listen to incoming slave connection", "Failed to listen to incoming slave connection. <a href='configure'>Change the port number</a> to solve the problem.",e); } } }

Target:
private void launchTcpSlaveAgentListener() throws IOException { synchronized(tcpSlaveAgentListenerLock) { if (tcpSlaveAgentListener != null && tcpSlaveAgentListener.configuredPort != slaveAgentPort) { tcpSlaveAgentListener.shutdown(); tcpSlaveAgentListener = null; } if (slaveAgentPort != -1 && tcpSlaveAgentListener == null) { String administrativeMonitorId = getClass().getName() + ".tcpBind"; try { tcpSlaveAgentListener = new TcpSlaveAgentListener(slaveAgentPort); for (Iterator<AdministrativeMonitor> it = AdministrativeMonitor.all().iterator(); it.hasNext(); ) { AdministrativeMonitor am = it.next(); if (administrativeMonitorId.equals(am.id)) { it.remove(); } } } catch (BindException e) { new AdministrativeError(administrativeMonitorId, "Failed to listen to incoming slave connection", "Failed to listen to incoming slave connection. <a href='configure'>Change the port number</a> to solve the problem.", e); } } } }
Source:
private void initializeAdminsAndAddCluster() { clusterName = staticClusterMap.partitionLayout.getClusterName(); for (Map.Entry<String, String> entry : dataCenterToZkAddress.entrySet()) { ZKHelixAdmin admin = new ZKHelixAdmin(entry.getValue()); adminForDc.put(entry.getKey(), admin); if (!admin.getClusters().contains(clusterName)) { admin.addCluster(clusterName); admin.addStateModelDef(clusterName, "LeaderStandby", BuiltInStateModelDefinitions.LeaderStandby.getStateModelDefinition()); } } }

Target:
private void initializeAdminsAndAddCluster() { for (Map.Entry<String, String> entry : dataCenterToZkAddress.entrySet()) { ZKHelixAdmin admin = new ZKHelixAdmin(entry.getValue()); adminForDc.put(entry.getKey(), admin); if (!admin.getClusters().contains(clusterName)) { admin.addCluster(clusterName); admin.addStateModelDef(clusterName, LeaderStandbySMD.name, LeaderStandbySMD.build()); } } }
Source:
public void testSerDe() throws Exception { SslConfiguration serialized = SslConfiguration.builder() .trustStorePath(Paths.get("/truststore.jks")) .trustStoreType(SslConfiguration.StoreType.JKS) .keyStorePath(Paths.get("/keystore.jks")) .keyStoreType(SslConfiguration.StoreType.JKS) .keyStoreKeyAlias("alias") .keyStorePassword("password") .build(); String deserializedCamelCase = "{\"trustStorePath\":\"file:/ + "\"keyStorePath\":\"file:/ + "\"keyStoreType\":\"JKS\",\"keyStoreKeyAlias\":\"alias\"}"; String deserializedKebabCase = "{\"trust-store-path\":\"file:/ + "\"key-store-path\":\"file:/ + "\"key-store-type\":\"JKS\",\"key-store-key-alias\":\"alias\"}"; assertThat(ObjectMappers.newClientObjectMapper().writeValueAsString(serialized)) .isEqualTo(deserializedCamelCase); assertThat(ObjectMappers.newClientObjectMapper().readValue(deserializedCamelCase, SslConfiguration.class)) .isEqualTo(serialized); assertThat(ObjectMappers.newClientObjectMapper().readValue(deserializedKebabCase, SslConfiguration.class)) .isEqualTo(serialized); }

Target:
public void testSerDe() throws Exception { SslConfiguration serialized = SslConfiguration.builder() .trustStorePath(Paths.get("truststore.jks")) .trustStoreType(SslConfiguration.StoreType.JKS) .keyStorePath(Paths.get("keystore.jks")) .keyStoreType(SslConfiguration.StoreType.JKS) .keyStoreKeyAlias("alias") .keyStorePassword("password") .build(); String deserializedCamelCase = "{\"trustStorePath\":\"truststore.jks\",\"trustStoreType\":\"JKS\"," + "\"keyStorePath\":\"keystore.jks\",\"keyStorePassword\":\"password\"," + "\"keyStoreType\":\"JKS\",\"keyStoreKeyAlias\":\"alias\"}"; String deserializedKebabCase = "{\"trust-store-path\":\"truststore.jks\",\"trust-store-type\":\"JKS\"," + "\"key-store-path\":\"keystore.jks\",\"key-store-password\":\"password\"," + "\"key-store-type\":\"JKS\",\"key-store-key-alias\":\"alias\"}"; assertThat(ObjectMappers.newClientObjectMapper().writeValueAsString(serialized)) .isEqualTo(deserializedCamelCase); assertThat(ObjectMappers.newClientObjectMapper().readValue(deserializedCamelCase, SslConfiguration.class)) .isEqualTo(serialized); assertThat(ObjectMappers.newClientObjectMapper().readValue(deserializedKebabCase, SslConfiguration.class)) .isEqualTo(serialized); }
Source:
public Builder parseAnnotationQuery(@Nullable String annotationQuery) { if (annotationQuery == null || annotationQuery.isEmpty()) return this; Map<String, String> map = new LinkedHashMap<>(); for (String ann : annotationQuery.split(" and ", 100)) { int idx = ann.indexOf('='); if (idx == -1) { map.putIfAbsent(ann.trim(), ""); } else { String[] keyValue = ann.split("=", 2); map.put(ann.substring(0, idx).trim(), keyValue.length < 2 ? "" : ann.substring(idx + 1).trim()); } } return annotationQuery(map); }

Target:
public Builder parseAnnotationQuery(@Nullable String annotationQuery) { if (annotationQuery == null || annotationQuery.isEmpty()) return this; Map<String, String> map = new LinkedHashMap<>(); for (String ann : annotationQuery.split(" and ", 100)) { int idx = ann.indexOf('='); if (idx == -1) { ann = ann.trim(); if (!map.containsKey(ann)) map.put(ann, ""); } else { String[] keyValue = ann.split("=", 2); map.put(ann.substring(0, idx).trim(), keyValue.length < 2 ? "" : ann.substring(idx + 1).trim()); } } return annotationQuery(map); }
Source:
private int getContainersFromPreviousAttempts(final RegisterApplicationMasterResponse registerApplicationMasterResponse) { final List<Container> containersFromPreviousAttempts = registerApplicationMasterResponseReflector.getContainersFromPreviousAttempts(registerApplicationMasterResponse); final List<YarnWorkerNode> recoveredWorkers = new ArrayList<>(); log.info("Recovered containers from previous attempts ({}).", containersFromPreviousAttempts.size(), containersFromPreviousAttempts); int maxPriority = 0; for (Container container : containersFromPreviousAttempts) { final YarnWorkerNode worker = new YarnWorkerNode(container, getContainerResourceId(container)); recoveredWorkers.add(worker); maxPriority = Math.max(container.getPriority().getPriority(), maxPriority); } getResourceEventHandler().onPreviousAttemptWorkersRecovered(recoveredWorkers); return maxPriority; }

Target:
private void getContainersFromPreviousAttempts(final RegisterApplicationMasterResponse registerApplicationMasterResponse) { final List<Container> containersFromPreviousAttempts = registerApplicationMasterResponseReflector.getContainersFromPreviousAttempts(registerApplicationMasterResponse); final List<YarnWorkerNode> recoveredWorkers = new ArrayList<>(); log.info("Recovered containers from previous attempts ({}).", containersFromPreviousAttempts.size(), containersFromPreviousAttempts); for (Container container : containersFromPreviousAttempts) { final YarnWorkerNode worker = new YarnWorkerNode(container, getContainerResourceId(container)); recoveredWorkers.add(worker); } getResourceEventHandler().onPreviousAttemptWorkersRecovered(recoveredWorkers); }
Source:
static BluetoothSocket tryConnect(BtHRBase base, final BluetoothDevice device, int i) throws IOException { BluetoothSocket sock = null; base.log("tryConnect(method: " + i + ")"); switch (i) { case 0: sock = device.createRfcommSocketToServiceRecord(MY_UUID); break; case 1: sock = device.createInsecureRfcommSocketToServiceRecord(MY_UUID); break; case 2: { Method m; try { m = device.getClass().getMethod("createInsecureRfcommSocket", int.class); m.setAccessible(true); sock = (BluetoothSocket) m.invoke(device, 1); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } if (sock == null) { throw new IOException("Create socket failed!"); } try { sock.connect(); return sock; } catch (IOException ex) { base.log("closeSocket"); closeSocket(sock); throw ex; } }

Target:
private static BluetoothSocket tryConnect(BtHRBase base, final BluetoothDevice device, int i) throws IOException { BluetoothSocket sock = null; base.log("tryConnect(method: " + i + ")"); switch (i) { case 0: sock = device.createRfcommSocketToServiceRecord(MY_UUID); break; case 1: sock = device.createInsecureRfcommSocketToServiceRecord(MY_UUID); break; case 2: { Method m; try { m = device.getClass().getMethod("createInsecureRfcommSocket", new Class[]{ int.class }); m.setAccessible(true); sock = (BluetoothSocket) m.invoke(device, 1); } catch (NoSuchMethodException | IllegalArgumentException | InvocationTargetException | IllegalAccessException e) { e.printStackTrace(); } } } if (sock == null) { throw new IOException("Create socket failed!"); } try { sock.connect(); return sock; } catch (IOException ex) { base.log("closeSocket"); closeSocket(sock); throw ex; } }
Source:
public static Properties loadProperties(Class<?> clazz, String resource) throws IOException{ try(Reader is = new InputStreamReader(clazz.getResourceAsStream(resource), "UTF-8")) { Properties prop = new Properties(); prop.load(is); return prop; } catch (IOException e) { throw new IOException( String.format("An error occurred while reading properties file: '%1$s'", resource) ); } }

Target:
public static Properties loadProperties(Class<?> clazz, String resource) throws IOException { Reader is = new InputStreamReader(clazz.getResourceAsStream(resource), "UTF-8"); Properties prop = new Properties(); prop.load(is); return prop; }
Source:
private static WorkProcessor<PageWithPosition> pageWithPositions(WorkProcessor<Page> pages, AggregatedMemoryContext aggregatedMemoryContext) { return pages.flatMap(page -> { LocalMemoryContext memoryContext = aggregatedMemoryContext.newLocalMemoryContext(MergeSortedPages.class.getSimpleName()); memoryContext.setBytes(page.getRetainedSizeInBytes()); return WorkProcessor.create(new WorkProcessor.Process<PageWithPosition>() { int position; @Override public ProcessState<PageWithPosition> process() { if (position >= page.getPositionCount()) { memoryContext.close(); return finished(); } return ofResult(new PageWithPosition(page, position++)); } }); }); }

Target:
private static WorkProcessor<PageWithPosition> pageWithPositions(WorkProcessor<Page> pages, AggregatedMemoryContext aggregatedMemoryContext) { return pages.flatMap(page -> { LocalMemoryContext memoryContext = aggregatedMemoryContext.newLocalMemoryContext(MergeSortedPages.class.getSimpleName()); memoryContext.setBytes(page.getRetainedSizeInBytes()); return WorkProcessor.create(new WorkProcessor.Process<PageWithPosition>() { int position; @Override public ProcessState<PageWithPosition> process() { if (position >= page.getPositionCount()) { memoryContext.close(); return ProcessState.finished(); } return ProcessState.ofResult(new PageWithPosition(page, position++)); } }); }); }
Source:
public UIConfiguration getUIConfiguration() { return this.uiConfiguration; }

Target:
public IndexView getUIConfiguration() { return this.indexView; }
Source:
private void setUp(String url) { try { URL webServicePort = new URL(url); jiraSoapServiceLocator = new JiraSoapServiceServiceLocator(); if (webServicePort == null) { jiraSoapService = jiraSoapServiceLocator.getJirasoapserviceV2(); } else { jiraSoapService = jiraSoapServiceLocator.getJirasoapserviceV2(webServicePort); log.info("SOAP Session service endpoint at " + webServicePort.toExternalForm()); } } catch (ServiceException e) { throw new RuntimeException("ServiceException during JiraService contruction", e); } catch (MalformedURLException e) { log.error("malformed url"); } }

Target:
private void setUp(String url) { try { URL webServicePort = new URL(url); jiraSoapServiceLocator = new JiraSoapServiceServiceLocator(); jiraSoapService = jiraSoapServiceLocator.getJirasoapserviceV2(webServicePort); log.info("SOAP Session service endpoint at " + webServicePort.toExternalForm()); } catch (ServiceException e) { throw new RuntimeException("ServiceException during JiraService contruction", e); } catch (MalformedURLException e) { log.error("malformed jiraURI"); } }