auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void uploadFile(final File localTempFile, final String remotePath) { withRetry(new DefaultRetry<Void>(String.format("SFTP upload file '%s'", remotePath)) { @Override public Void call() throws Exception { final FileObject remoteFile = newSftpFile(getSftpFileUri(remotePath)); final OutputStream outputStream = openStream(remoteFile); try (TimeoutCloser ignored = new TimeoutCloser(outputStream)) { appendFile(localTempFile, remoteFile, outputStream); return null; } finally { remoteFile.close(); } } }); }

Target:
void uploadFile(final File localTempFile, final String remotePath) { withRetry(new DefaultRetry<Void>(String.format("SFTP upload file '%s'", remotePath)) { @Override public Void call() throws Exception { final FileObject remoteFile = newSftpFile(getSftpFileUri(remotePath)); final BufferedOutputStream outputStream = openStream(remoteFile); try (TimeoutCloser ignored = new TimeoutCloser(outputStream)) { appendFile(localTempFile, remoteFile, outputStream); return null; } finally { remoteFile.close(); } } }); }
Source:
public static String getResponseType(final ImmutableList<Ds3ResponseCode> responseCodes) { for (final Ds3ResponseCode responseCode : responseCodes) { final int rc = responseCode.getCode(); if (rc >= 200 && rc < 300) { for (final Ds3ResponseType responseType : responseCode.getDs3ResponseTypes()) { if (ConverterUtil.hasContent(responseType.getType()) && !responseType.getType().contentEquals("null")) { return StructHelper.getResponseTypeName(responseType.getType()); } else if (ConverterUtil.hasContent(responseType.getComponentType()) && !responseType.getComponentType().contentEquals("null")) { return StructHelper.getResponseTypeName(responseType.getComponentType()); } } } } return ""; }

Target:
public static String getResponseType(final ImmutableList<Ds3ResponseCode> responseCodes) { for (final Ds3ResponseCode responseCode : responseCodes) { final int rc = responseCode.getCode(); if (rc < 200 || rc >= 300) continue; for (final Ds3ResponseType responseType : responseCode.getDs3ResponseTypes()) { if (ConverterUtil.hasContent(responseType.getType()) && !responseType.getType().contentEquals("null")) { return StructHelper.getResponseTypeName(responseType.getType()); } if (ConverterUtil.hasContent(responseType.getComponentType()) && !responseType.getComponentType().contentEquals("null")) { return StructHelper.getResponseTypeName(responseType.getComponentType()); } } } return ""; }
Source:
public void testRaceCondition() throws InterruptedException { int taskShutdownInMs = (int) (Math.random() * 10000); CountDownLatch containerShutdownLatch = new CountDownLatch(1); Map<String, String> configs = new HashMap<>(); configs.put(JobCoordinatorConfig.JOB_COORDINATOR_FACTORY, "org.apache.samza.standalone.PassthroughJobCoordinatorFactory"); configs.put(JobCoordinatorConfig.JOB_COORDINATION_UTILS_FACTORY, "org.apache.samza.standalone.PassthroughCoordinationUtilsFactory"); configs.put(JobConfig.PROCESSOR_ID(), "0"); configs.put(TaskConfig.GROUPER_FACTORY(), "org.apache.samza.container.grouper.task.GroupByContainerIdsFactory"); configs.put(FaultInjectionStreamApp.INPUT_TOPIC_NAME_PROP, "page-views"); configs.put(TaskConfig.INPUT_STREAMS(), "kafka.page-views"); configs.put("task.shutdown.ms", Integer.toString(taskShutdownInMs)); configs.put(JobConfig.PROCESSOR_ID(), "0"); createTopic(PAGE_VIEWS, 2); produceMessage(PAGE_VIEWS, 0, "p1", "{\"viewId\":\"v1\",\"pageId\":\"p1\",\"userId\":\"u1\"}"); produceMessage(PAGE_VIEWS, 1, "p2", "{\"viewId\":\"v2\",\"pageId\":\"p2\",\"userId\":\"u1\"}"); FaultInjectionStreamApp app = new FaultInjectionStreamApp(); FaultInjectionStreamApp.containerShutdownLatch = containerShutdownLatch; RunApplicationContext context = runApplication(app, "fault-injection-app", configs); containerShutdownLatch.await(); context.getRunner().kill(); context.getRunner().waitForFinish(); assertEquals(context.getRunner().status(), ApplicationStatus.UnsuccessfulFinish); }

Target:
public void testRaceCondition() throws InterruptedException { int taskShutdownInMs = (int) (Math.random() * 10000); CountDownLatch containerShutdownLatch = new CountDownLatch(1); Map<String, String> configs = new HashMap<>(); configs.put(JobCoordinatorConfig.JOB_COORDINATOR_FACTORY, "org.apache.samza.zk.ZkJobCoordinatorFactory"); configs.put(JobCoordinatorConfig.JOB_COORDINATION_UTILS_FACTORY, "org.apache.samza.zk.ZkCoordinationUtilsFactory"); configs.put(JobConfig.PROCESSOR_ID(), "0"); configs.put(TaskConfig.GROUPER_FACTORY(), "org.apache.samza.container.grouper.task.GroupByContainerIdsFactory"); configs.put(FaultInjectionStreamApp.INPUT_TOPIC_NAME_PROP, "page-views"); configs.put(TaskConfig.INPUT_STREAMS(), "kafka.page-views"); configs.put(ZkConfig.ZK_CONNECT, zkConnect()); configs.put(JobConfig.JOB_DEBOUNCE_TIME_MS(), "5000"); configs.put("task.shutdown.ms", Integer.toString(taskShutdownInMs)); configs.put(JobConfig.PROCESSOR_ID(), "0"); createTopic(PAGE_VIEWS, 2); produceMessage(PAGE_VIEWS, 0, "p1", "{\"viewId\":\"v1\",\"pageId\":\"p1\",\"userId\":\"u1\"}"); produceMessage(PAGE_VIEWS, 1, "p2", "{\"viewId\":\"v2\",\"pageId\":\"p2\",\"userId\":\"u1\"}"); FaultInjectionStreamApp app = new FaultInjectionStreamApp(); FaultInjectionStreamApp.containerShutdownLatch = containerShutdownLatch; RunApplicationContext context = runApplication(app, "fault-injection-app", configs); containerShutdownLatch.await(); context.getRunner().kill(); context.getRunner().waitForFinish(); assertEquals(context.getRunner().status(), ApplicationStatus.UnsuccessfulFinish); }
Source:
private void loadConnections() { progressWheel.spin(); countDown(); new FirebaseCollection<>(connectionUrl(), Connection.class) .query(getString(R.string.connectionStatus), 2, new DataCallback<List<Connection>>() { @Override public void onSuccess(List<Connection> data) { stopTimer(); if (!data.isEmpty()) { for (Connection connection : data) { if (!connection.getSender().equals(user.getId()) && connection.getConnectionStatus() == ConnectionStatus.PENDING.getStatus()) { addConnection(connection); } } retry.setVisibility(View.GONE); } else { displayMessage(getString(R.string.no_request_found)); retry.setVisibility(View.VISIBLE); } } @Override public void onError(String errorMessage) { displayMessage(errorMessage); stopTimer(); } }); }

Target:
private void loadConnections() { new FirebaseCollection<>(connectionUrl(), Connection.class) .query(getString(R.string.connectionStatus), 2, new DataCallback<List<Connection>>() { @Override public void onSuccess(List<Connection> data) { int size = data.size(); if (size > 0) { for (Connection connection : data) { if (isConnectionPending(connection)) { addConnection(connection); } } if (connections.size() > 0) { noContacts.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); } } else { displayMessage(getString(R.string.no_request_found)); noContacts.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.VISIBLE); } } @Override public void onError(String errorMessage) { displayMessage(errorMessage); } }); }
Source:
public void updateTailSegment(long newTailSegment) { if (tailSegment.get() >= newTailSegment) { log.debug("New tail segment equals to the old one: {}. Ignore", newTailSegment); return; } dataStore.put(newTailSegment, TAIL_SEGMENT_RECORD); tailSegment.set(newTailSegment); }

Target:
public void updateTailSegment(long newTailSegment) { if (tailSegment.get() >= newTailSegment) { log.debug("New tail segment less than or equals to the old one: {}. Ignore", newTailSegment); return; } log.trace("Update tail segment to: {}", newTailSegment); dataStore.put(TAIL_SEGMENT_RECORD, newTailSegment); tailSegment.set(newTailSegment); }
Source:
private String calculateHref(Object tab) { String href = "#"; if (tab instanceof AbstractTab) { href = ((AbstractTab)tab).getTargetHistoryToken(); } else if (tab instanceof GroupedTabData) { href = ((GroupedTabData)tab).getHistoryToken(); } return href; }

Target:
private String calculateHref(Object tab) { String href = "#"; if (tab instanceof AbstractTab) { href = ((AbstractTab)tab).getTargetHistoryToken(); } return href; }
Source:
protected AtomicHashMap<K, V> getDeltaMapForWrite() { CacheEntry lookedUpEntry = lookupEntryFromCurrentTransaction(); boolean lockedAndCopied = lookedUpEntry != null && lookedUpEntry.isChanged() && toMap(lookedUpEntry.getValue()).copied; if (lockedAndCopied) { return getDeltaMapForRead(); } else { boolean suppressLocks = flagContainer != null && flagContainer.hasFlag(Flag.SKIP_LOCKING); if (!suppressLocks && flagContainer != null) flagContainer.setFlags(Flag.FORCE_WRITE_LOCK); if (trace) { if (suppressLocks) log.trace("Skip locking flag used. Skipping locking."); else log.trace("Forcing write lock even for reads"); } if (suppressLocks) flagContainer.setFlags(Flag.SKIP_LOCKING); AtomicHashMap<K, V> map = getDeltaMapForRead(); AtomicHashMap<K, V> copy = map == null ? new AtomicHashMap<K, V>(true) : map.copy(); copy.initForWriting(); cache.withFlags(Flag.SKIP_REMOTE_LOOKUP, Flag.SKIP_CACHE_LOAD).put(deltaMapKey, copy); return copy; } }

Target:
protected AtomicHashMap<K, V> getDeltaMapForWrite() { CacheEntry lookedUpEntry = lookupEntryFromCurrentTransaction(); boolean lockedAndCopied = lookedUpEntry != null && lookedUpEntry.isChanged() && toMap(lookedUpEntry.getValue()).copied; if (lockedAndCopied) { return getDeltaMapForRead(); } else { boolean suppressLocks = flagContainer != null && flagContainer.hasFlag(Flag.SKIP_LOCKING); if (!suppressLocks && flagContainer != null) flagContainer.setFlags(Flag.FORCE_WRITE_LOCK); if (trace) { if (suppressLocks) log.trace("Skip locking flag used. Skipping locking."); else log.trace("Forcing write lock even for reads"); } if (suppressLocks) flagContainer.setFlags(Flag.SKIP_LOCKING); AtomicHashMap<K, V> map = getDeltaMapForRead(); AtomicHashMap<K, V> copy = map == null ? new AtomicHashMap<K, V>(true) : map.copy(); copy.initForWriting(); cacheForWriting.put(deltaMapKey, copy); return copy; } }
Source:
public void run() { long duration = System.currentTimeMillis() - timestamp; if (duration > highWatermark) { eventHandler.onHighWatermark(duration); } process(); }

Target:
public void run() { eventHandler.onRequestStarted(ephemeralProperties); try { TTransport input = new TMemoryInputTransport(frameBytes, 4, frameBytes.length); TMemoryOutputBuffer output = new TMemoryOutputBuffer(NATS_MAX_MESSAGE_SIZE); try { FProtocol inputProto = inputProtoFactory.getProtocol(input); inputProto.setEphemeralProperties(ephemeralProperties); FProtocol outputProto = outputProtoFactory.getProtocol(output); processor.process(inputProto, outputProto); } catch (TException e) { LOGGER.error("error processing request", e); return; } catch (RuntimeException e) { try { conn.publish(reply, output.getWriteBytes()); conn.flush(Duration.ofSeconds(60)); } catch (Exception ignored) { } return; } if (!output.hasWriteData()) { return; } conn.publish(reply, output.getWriteBytes()); } finally { eventHandler.onRequestEnded(ephemeralProperties); } }
Source:
@Test public void replacementCharacter() throws Exception { SSLSession session = session("" + "-----BEGIN CERTIFICATE-----\n" + "MIIBSDCB86ADAgECAhRLR4TGgXBegg0np90FZ1KPeWpDtjANBgkqhkiG9w0BAQsF\n" + "ADASMRAwDgYDVQQDDAdmb28uY29tMCAXDTIwMTAyOTA2NTkwNVoYDzIxMjAxMDA1\n" + "MDY1OTA1WjASMRAwDgYDVQQDDAdmb28uY29tMFwwDQYJKoZIhvcNAQEBBQADSwAw\n" + "SAJBALQcTVW9aW++ClIV9/9iSzijsPvQGEu/FQOjIycSrSIheZyZmR8bluSNBq0C\n" + "9fpalRKZb0S2tlCTi5WoX8d3K30CAwEAAaMfMB0wGwYDVR0RBBQwEoIH4oShLmNv\n" + "bYIH4oSqLmNvbTANBgkqhkiG9w0BAQsFAANBAA1+/eDvSUGv78iEjNW+1w3OPAwt\n" + "Ij1qLQ/YI8OogZPMk7YY46/ydWWp7UpD47zy/vKmm4pOc8Glc8MoDD6UADs=\n" + "-----END CERTIFICATE-----\n"); assertThat(verifier.verify("���.com", session)).isFalse(); }

Target:
@Test public void replacementCharacter() throws Exception { SSLSession session = session("" + "-----BEGIN CERTIFICATE-----\n" + "MIIBSDCB86ADAgECAhRLR4TGgXBegg0np90FZ1KPeWpDtjANBgkqhkiG9w0BAQsF\n" + "ADASMRAwDgYDVQQDDAdmb28uY29tMCAXDTIwMTAyOTA2NTkwNVoYDzIxMjAxMDA1\n" + "MDY1OTA1WjASMRAwDgYDVQQDDAdmb28uY29tMFwwDQYJKoZIhvcNAQEBBQADSwAw\n" + "SAJBALQcTVW9aW++ClIV9/9iSzijsPvQGEu/FQOjIycSrSIheZyZmR8bluSNBq0C\n" + "9fpalRKZb0S2tlCTi5WoX8d3K30CAwEAAaMfMB0wGwYDVR0RBBQwEoIH4oShLmNv\n" + "bYIH4oSqLmNvbTANBgkqhkiG9w0BAQsFAANBAA1+/eDvSUGv78iEjNW+1w3OPAwt\n" + "Ij1qLQ/YI8OogZPMk7YY46/ydWWp7UpD47zy/vKmm4pOc8Glc8MoDD6UADs=\n" + "-----END CERTIFICATE-----\n"); assertThat(verifier.verify("���.com", session)).isFalse(); assertThat(verifier.verify("℡.com", session)).isFalse(); }
Source:
public void testFailingBulkAction() throws Exception { String result = async.newRequest(BulkRunAction.ID) .set("action", AutomationBulkAction.ACTION_NAME) .set("query", "SELECT * FROM Folder") .set("bucketSize", "10") .set("batchSize", "5") .set("parameters", MAPPER.writeValueAsString("{}")) .executeReturningExceptionEntity(SC_INTERNAL_SERVER_ERROR); assertTrue( result.startsWith("Unknown operation id null in command: org.nuxeo.ecm.core.bulk.message.BulkCommand")); }

Target:
public void testFailingBulkAction() throws Exception { String result = async.newRequest(BulkRunAction.ID) .set("action", AutomationBulkAction.ACTION_NAME) .set("query", "SELECT * FROM Folder") .set("bucketSize", "10") .set("batchSize", "5") .set("parameters", "{}") .executeReturningExceptionEntity(SC_INTERNAL_SERVER_ERROR); assertTrue( result.startsWith("Unknown operation id null in command: org.nuxeo.ecm.core.bulk.message.BulkCommand")); }
Source:
private static void deleteSupplementaryFile(String selection) { java.util.List<IResource> resourceToDelete = new ArrayList<>(); java.util.List<String> ids = XmlUtils.getIdsFromFile(selection); IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(0); for (IProject project : projects) { TmfProjectElement pElement = TmfProjectRegistry.getProject(project); if (pElement != null) { TmfTraceFolder tracesFolder = pElement.getTracesFolder(); for (TmfTraceElement tElement : tracesFolder.getTraces()) { boolean closeEditor = false; for (IResource resource : tElement.getSupplementaryResources()) { for (String id : ids) { if (resource.getName().startsWith(id)) { resourceToDelete.add(resource); closeEditor = true; } } } if (closeEditor) { tElement.closeEditors(); } } } } for (IResource resource : resourceToDelete) { try { resource.delete(false, null); } catch (CoreException e) { Activator.logError(Messages.ManageXMLAnalysisDialog_delete_file_error + resource.getName()); } } }

Target:
private static void deleteSupplementaryFile(String selection) { java.util.List<IResource> resourceToDelete = new ArrayList<>(); java.util.List<String> ids = XmlUtils.getAnalysisIdsFromFile(selection + XmlUtils.XML_EXTENSION); IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(0); for (IProject project : projects) { TmfProjectElement pElement = TmfProjectRegistry.getProject(project); if (pElement != null) { TmfTraceFolder tracesFolder = pElement.getTracesFolder(); for (TmfTraceElement tElement : tracesFolder.getTraces()) { boolean closeEditor = false; for (IResource resource : tElement.getSupplementaryResources()) { for (String id : ids) { if (resource.getName().startsWith(id)) { resourceToDelete.add(resource); closeEditor = true; } } } if (closeEditor) { tElement.closeEditors(); } } } } for (IResource resource : resourceToDelete) { try { resource.delete(false, null); } catch (CoreException e) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_delete_file_error, resource.getName())); } } }
Source:
private static BingTile[] getTilesInBetween(BingTile leftUpperTile, BingTile rightLowerTile, int zoomLevel) { checkArgument(leftUpperTile.getZoomLevel() == rightLowerTile.getZoomLevel()); checkArgument(leftUpperTile.getZoomLevel() > zoomLevel); int divisor = 1 << (leftUpperTile.getZoomLevel() - zoomLevel); int minX = (int) floor(leftUpperTile.getX() / divisor); int maxX = (int) floor(rightLowerTile.getX() / divisor); int minY = (int) floor(leftUpperTile.getY() / divisor); int maxY = (int) floor(rightLowerTile.getY() / divisor); BingTile[] tiles = new BingTile[(maxX - minX + 1) * (maxY - minY + 1)]; int index = 0; for (int x = minX; x <= maxX; x++) { for (int y = minY; y <= maxY; y++) { tiles[index] = BingTile.fromCoordinates(x, y, OPTIMIZED_TILING_MIN_ZOOM_LEVEL); index++; } } return tiles; }

Target:
private static BingTile[] getTilesInBetween(BingTile leftUpperTile, BingTile rightLowerTile, int zoomLevel) { checkArgument(leftUpperTile.getZoomLevel() == rightLowerTile.getZoomLevel()); checkArgument(leftUpperTile.getZoomLevel() > zoomLevel); int divisor = 1 << (leftUpperTile.getZoomLevel() - zoomLevel); int minX = (int) Math.floor(leftUpperTile.getX() / divisor); int maxX = (int) Math.floor(rightLowerTile.getX() / divisor); int minY = (int) Math.floor(leftUpperTile.getY() / divisor); int maxY = (int) Math.floor(rightLowerTile.getY() / divisor); BingTile[] tiles = new BingTile[(maxX - minX + 1) * (maxY - minY + 1)]; int index = 0; for (int x = minX; x <= maxX; x++) { for (int y = minY; y <= maxY; y++) { tiles[index] = BingTile.fromCoordinates(x, y, OPTIMIZED_TILING_MIN_ZOOM_LEVEL); index++; } } return tiles; }
Source:
public static @Nullable String transform(String type, String function, String value) { Logger logger = LoggerFactory.getLogger(Transformation.class); String result; try { result = trans(type, function, value); } catch (TransformationException e) { logger.error("Error executing the transformation '{}': {}", type, e.getMessage()); result = value; } return result; }

Target:
public static @Nullable String transform(String type, String function, String value) { Logger logger = LoggerFactory.getLogger(Transformation.class); String result; try { result = trans(type, function, value); } catch (TransformationException e) { logger.debug("Error executing the transformation '{}': {}", type, e.getMessage()); result = value; } return result; }
Source:
public void clearOkCacheIfNeeded(@Nullable APIStatus status, boolean forceClear) { long lastCacheClear = mPrefs.getLong(STATUS_CACHE_CLEAR_KEY, Long.MIN_VALUE); if (status != null && mOkHttpCache != null && (forceClear || lastCacheClear < status.getLastOkHttpCacheClear())) { Schedulers.io().createWorker().schedule(() -> { Log.i(Constants.LOG_TAG, "Clearing OkHttp cache"); try { mOkHttpCache.evictAll(); mPrefs.edit() .putLong(STATUS_CACHE_CLEAR_KEY, System.currentTimeMillis() / 1000l) .apply(); } catch (IOException e) { e.printStackTrace(); } }); } }

Target:
public void clearOkCacheIfNeeded(@Nullable APIStatus status, boolean forceClear) { long lastCacheClear = mPrefs.getLong(STATUS_CACHE_CLEAR_KEY, Long.MIN_VALUE); if (status != null && mOkHttpCache != null && (forceClear || lastCacheClear < status.getLastOkHttpCacheClear())) { Schedulers.io().createWorker().schedule(() -> { Log.i(Constants.LOG_TAG, "Clearing OkHttp cache"); try { mOkHttpCache.evictAll(); mPrefs.edit() .putLong(STATUS_CACHE_CLEAR_KEY, System.currentTimeMillis() / 1000L) .apply(); } catch (IOException e) { e.printStackTrace(); } }); } }
Source:
private Map<PartitionKeyRange, String> getRangeQueryMap( Map<PartitionKeyRange, List<Pair<String, PartitionKey>>> partitionRangeItemKeyMap, PartitionKeyDefinition partitionKeyDefinition) { String partitionKeyPathString = partitionKeyDefinition.getPaths().get(0); String partitionKeyPath = (new StringBuilder(partitionKeyPathString)).deleteCharAt(0).toString(); Map<PartitionKeyRange, String> rangeQueryMap = new HashMap<>(); for (PartitionKeyRange range : partitionRangeItemKeyMap.keySet()) { StringBuilder queryStringBuilder = new StringBuilder(); queryStringBuilder.append("select * from c where "); List<Pair<String, PartitionKey>> pairsList = partitionRangeItemKeyMap.get(range); for (Pair p : pairsList) { queryStringBuilder.append("(c.id = \""); queryStringBuilder.append(p.getLeft()); queryStringBuilder.append("\" and "); queryStringBuilder.append(" c."); queryStringBuilder.append(partitionKeyPath); queryStringBuilder.append(("=\"")); PartitionKey pkey = (PartitionKey) p.getRight(); String val = pkey.toString(); StringBuilder stringBuilder = new StringBuilder(val); stringBuilder.delete(0, 2); stringBuilder.setLength(stringBuilder.length()-2); queryStringBuilder.append(stringBuilder.toString()); queryStringBuilder.append("\") "); queryStringBuilder.append(" or "); } queryStringBuilder.delete((queryStringBuilder.length() -1) - 4, queryStringBuilder.length()-1); rangeQueryMap.put(range, queryStringBuilder.toString()); } return rangeQueryMap; }

Target:
private Map<PartitionKeyRange, SqlQuerySpec> getRangeQueryMap( Map<PartitionKeyRange, List<Pair<String, PartitionKey>>> partitionRangeItemKeyMap, PartitionKeyDefinition partitionKeyDefinition) { Map<PartitionKeyRange, SqlQuerySpec> rangeQueryMap = new HashMap<>(); String partitionKeySelector = createPkSelector(partitionKeyDefinition); for(Map.Entry<PartitionKeyRange, List<Pair<String, PartitionKey>>> entry: partitionRangeItemKeyMap.entrySet()) { SqlQuerySpec sqlQuerySpec; if (partitionKeySelector.equals("[\"id\"]")) { sqlQuerySpec = createReadManyQuerySpecPartitionKeyIdSame(entry.getValue(), partitionKeySelector); } else { sqlQuerySpec = createReadManyQuerySpec(entry.getValue(), partitionKeySelector); } rangeQueryMap.put(entry.getKey(), sqlQuerySpec); } return rangeQueryMap; }
Source:
private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = asyncTaskDao.getAll(); Set<Guid> asyncTaskManagerManagedCommands = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getCommandId()).collect(Collectors.toSet())); getCommands(false).stream() .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> retrieveCommand(x.getId()).reacquireLocks()); ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled()) .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); }

Target:
private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = asyncTaskDao.getAll(); Set<Guid> asyncTaskManagerManagedCommands = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getCommandId()).collect(Collectors.toSet())); ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled()) .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); getCommands(false).stream() .filter(x -> x.getCommandStatus().isReacquireLocksOnRestart()) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> retrieveCommand(x.getId()).reacquireLocks()); }
Source:
private boolean areProgramsFilterClean(ArtifactReadable webProgram) throws OseeCoreException { List<String> filterData = webProgram.getAttributeValues(CoreAttributeTypes.Description); for (String att : filterData) { if (att.equals("Apply_Filter")) { return false; } } return true; }

Target:
private boolean areProgramsFilterClean(ArtifactReadable webProgram) throws OseeCoreException { List<String> filterData = webProgram.getAttributeValues(CoreAttributeTypes.Description); for (String att : filterData) { if (att.equals(FILTER_KEYWORD)) { return false; } } return true; }
Source:
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.optAttribute("queryid", queryId); xml.optBooleanAttribute("complete", complete); xml.optBooleanAttribute("stable", stable); if (rsmSet == null) { xml.closeEmptyElement(); } else { xml.rightAngleBracket(); xml.element(rsmSet); } return xml; }

Target:
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.optAttribute("queryid", queryId); xml.optBooleanAttribute("complete", complete); xml.optBooleanAttribute("stable", stable); if (rsmSet == null) { xml.setEmptyElement(); } else { xml.rightAngleBracket(); xml.element(rsmSet); } return xml; }
Source:
public final Message<?> receive(long timeout) { ChannelInterceptorList interceptorList = getInterceptors(); Deque<ChannelInterceptor> interceptorStack = null; boolean counted = false; try { if (interceptorList.getInterceptors().size() > 0) { interceptorStack = new ArrayDeque<ChannelInterceptor>(); if (!interceptorList.preReceive(this, interceptorStack)) { return null; } } Message<?> message = this.doReceive(timeout); if (isCountsEnabled()) { getMetrics().afterReceive(); } message = interceptorList.postReceive(message, this); if (interceptorStack != null) { interceptorList.afterReceiveCompletion(message, this, null, interceptorStack); } return message; } catch (RuntimeException e) { if (isCountsEnabled() && !counted) { getMetrics().afterError(); } if (interceptorStack != null) { interceptorList.afterReceiveCompletion(null, this, e, interceptorStack); } throw e; } }

Target:
public final Message<?> receive(long timeout) { ChannelInterceptorList interceptorList = getInterceptors(); Deque<ChannelInterceptor> interceptorStack = null; boolean counted = false; try { if (interceptorList.getInterceptors().size() > 0) { interceptorStack = new ArrayDeque<ChannelInterceptor>(); if (!interceptorList.preReceive(this, interceptorStack)) { return null; } } Message<?> message = this.doReceive(timeout); if (isCountsEnabled()) { getMetrics().afterReceive(); counted = true; } message = interceptorList.postReceive(message, this); if (interceptorStack != null) { interceptorList.afterReceiveCompletion(message, this, null, interceptorStack); } return message; } catch (RuntimeException e) { if (isCountsEnabled() && !counted) { getMetrics().afterError(); } if (interceptorStack != null) { interceptorList.afterReceiveCompletion(null, this, e, interceptorStack); } throw e; } }
Source:
public void handleAsyncUntaggedResponse(ImapResponse response) throws IOException, MessagingException { if (stop) { if (K9MailLib.isDebug()) { Timber.d("Got async untagged response: %s, but stop is set for %s", response, getLogId()); } idleStopper.stopIdle(); } else { if (response.getTag() == null) { if (response.size() > 1) { if (isUntaggedResponseSupported(response)) { wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT); if (K9MailLib.isDebug()) { Timber.d("Got useful async untagged response: %s for %s", response, getLogId()); } synchronized (storedUntaggedResponses) { storedUntaggedResponses.add(response); if (!folder.getConnection().areMoreResponsesAvailable()) { processStoredUntaggedResponses(); } } } } else if (response.isContinuationRequested()) { if (K9MailLib.isDebug()) { Timber.d("Idling %s", getLogId()); } idleStopper.startAcceptingDoneContinuation(folder.getConnection()); wakeLock.release(); } } } }

Target:
public void handleAsyncUntaggedResponse(ImapResponse response) { if (K9MailLib.isDebug()) { Timber.v("Got async response: %s", response); } if (stop) { if (K9MailLib.isDebug()) { Timber.d("Got async untagged response: %s, but stop is set for %s", response, getLogId()); } idleStopper.stopIdle(); } else { if (response.getTag() == null) { if (response.size() > 1) { Object responseType = response.get(1); if (equalsIgnoreCase(responseType, "EXISTS") || equalsIgnoreCase(responseType, "EXPUNGE") || equalsIgnoreCase(responseType, "FETCH")) { wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT); if (K9MailLib.isDebug()) { Timber.d("Got useful async untagged response: %s for %s", response, getLogId()); } idleStopper.stopIdle(); } } else if (response.isContinuationRequested()) { if (K9MailLib.isDebug()) { Timber.d("Idling %s", getLogId()); } idleStopper.startAcceptingDoneContinuation(connection); wakeLock.release(); } } } }
Source:
public void onPlayerLogin(PlayerLoginEvent event) { TFM_ServerInterface.handlePlayerLogin(event); if(TFM_ConfigEntry.FORCE_IP_ENABLED.getBoolean()){ if(!event.getHostname().equalsIgnoreCase(TFM_ConfigEntry.SERVER_HOSTNAME.getString() + ":" + TFM_ConfigEntry.SERVER_PORT.getInteger())){ event.disallow(PlayerLoginEvent.Result.KICK_OTHER, TFM_ConfigEntry.FORCE_IP_KICKMSG.getString()); } } }

Target:
public void onPlayerLogin(PlayerLoginEvent event) { TFM_ServerInterface.handlePlayerLogin(event); if(TFM_ConfigEntry.FORCE_IP_ENABLED.getBoolean()) { if(!event.getHostname().equalsIgnoreCase(TFM_ConfigEntry.SERVER_ADDRESS.getString())) { event.disallow(PlayerLoginEvent.Result.KICK_OTHER, TFM_ConfigEntry.FORCE_IP_KICKMSG.getString().replace("%address%", TFM_ConfigEntry.SERVER_ADDRESS.getString())); } } }
Source:
private CreateFunctionDesc build() throws SemanticException { replCopyTasks.clear(); PrimaryToReplicaResourceFunction conversionFunction = new PrimaryToReplicaResourceFunction(context, metadata, destinationDbName); List<ResourceUri> transformedUris = ImmutableList.copyOf( Lists.transform(metadata.function.getResourceUris(), conversionFunction) ); replCopyTasks.addAll(conversionFunction.replCopyTasks); String fullQualifiedFunctionName = FunctionUtils.qualifyFunctionName( metadata.function.getFunctionName(), destinationDbName ); ReplicationSpec replSpec = (context.dmd == null) ? null : eventOnlyReplicationSpec(context); return new CreateFunctionDesc( fullQualifiedFunctionName, false, metadata.function.getClassName(), transformedUris, replSpec ); }

Target:
private CreateFunctionDesc build() throws SemanticException { replCopyTasks.clear(); PrimaryToReplicaResourceFunction conversionFunction = new PrimaryToReplicaResourceFunction(context, metadata, destinationDbName); List<ResourceUri> transformedUris = ImmutableList.copyOf( Lists.transform(metadata.function.getResourceUris(), conversionFunction) ); replCopyTasks.addAll(conversionFunction.replCopyTasks); String fullQualifiedFunctionName = FunctionUtils.qualifyFunctionName( metadata.function.getFunctionName(), destinationDbName ); ReplicationSpec replSpec = (context.dmd == null) ? null : context.eventOnlyReplicationSpec(); return new CreateFunctionDesc( fullQualifiedFunctionName, false, metadata.function.getClassName(), transformedUris, replSpec ); }
Source:
private void onDeviceRejected(String deviceId, String deviceName) { if (deviceId == null) { return; } Log.d(TAG, "Unknown device " + deviceName + "(" + deviceId + ") wants to connect"); String title = mContext.getString(R.string.device_rejected, deviceName.isEmpty() ? deviceId.substring(0, 7) : deviceName); int notificationId = mNotificationHandler.getNotificationIdFromText(title); Intent intentAccept = new Intent(mContext, DeviceActivity.class) .putExtra(DeviceActivity.EXTRA_NOTIFICATION_ID, notificationId) .putExtra(DeviceActivity.EXTRA_IS_CREATE, true) .putExtra(DeviceActivity.EXTRA_DEVICE_ID, deviceId) .putExtra(DeviceActivity.EXTRA_DEVICE_NAME, deviceName); int requestCode = deviceId.hashCode(); PendingIntent piAccept = PendingIntent.getActivity(mContext, requestCode, intentAccept, PendingIntent.FLAG_UPDATE_CURRENT); Intent intentIgnore = new Intent(mContext, SyncthingService.class) .putExtra(SyncthingService.EXTRA_NOTIFICATION_ID, notificationId) .putExtra(SyncthingService.EXTRA_DEVICE_ID, deviceId); intentIgnore.setAction(SyncthingService.ACTION_IGNORE_DEVICE); PendingIntent piIgnore = PendingIntent.getService(mContext, 0, intentIgnore, PendingIntent.FLAG_UPDATE_CURRENT); mNotificationHandler.showConsentNotification(notificationId, title, piAccept, piIgnore); }

Target:
private void onDeviceRejected(String deviceId, String deviceName) { if (deviceId == null) { return; } Log.d(TAG, "Unknown device " + deviceName + "(" + deviceId + ") wants to connect"); String title = mContext.getString(R.string.device_rejected, deviceName.isEmpty() ? deviceId.substring(0, 7) : deviceName); int notificationId = mNotificationHandler.getNotificationIdFromText(title); Intent intentAccept = new Intent(mContext, DeviceActivity.class) .putExtra(DeviceActivity.EXTRA_NOTIFICATION_ID, notificationId) .putExtra(DeviceActivity.EXTRA_IS_CREATE, true) .putExtra(DeviceActivity.EXTRA_DEVICE_ID, deviceId) .putExtra(DeviceActivity.EXTRA_DEVICE_NAME, deviceName); PendingIntent piAccept = PendingIntent.getActivity(mContext, notificationId, intentAccept, PendingIntent.FLAG_UPDATE_CURRENT); Intent intentIgnore = new Intent(mContext, SyncthingService.class) .putExtra(SyncthingService.EXTRA_NOTIFICATION_ID, notificationId) .putExtra(SyncthingService.EXTRA_DEVICE_ID, deviceId); intentIgnore.setAction(SyncthingService.ACTION_IGNORE_DEVICE); PendingIntent piIgnore = PendingIntent.getService(mContext, 0, intentIgnore, PendingIntent.FLAG_UPDATE_CURRENT); mNotificationHandler.showConsentNotification(notificationId, title, piAccept, piIgnore); }
Source:
public Builder createTokenAt(CreateTokenAtStatementBuilder createTokenAt) { this.createTokenAt = createTokenAt; return this; }

Target:
public Builder createTokenAt(CreateTokenAtStatementBuilder createTokenAt) { assertNonNull(createTokenAt, "createTokenAt may not be null"); this.createTokenAt = createTokenAt; return this; }
Source:
private void decodeLocalizedTitles(DBObject dbObject, Described entity) { if (dbObject.containsField(LOCALIZED_TITLES_KEY)) { List<DBObject> localisedTitlesDBO = TranslatorUtils.toDBObjectList(dbObject, LOCALIZED_TITLES_KEY); entity.setLocalizedTitles(Iterables.transform(localisedTitlesDBO, new Function<DBObject, LocalizedTitle>() { @Override public LocalizedTitle apply(DBObject input) { return localizedTitleTranslator.fromDBObject(input, new LocalizedTitle()); } })); } }

Target:
private void decodeLocalizedTitles(DBObject dbObject, Described entity) { List<DBObject> localisedTitlesDBO = TranslatorUtils.toDBObjectList(dbObject, LOCALIZED_TITLES_KEY); entity.setLocalizedTitles(Iterables.transform(localisedTitlesDBO, new Function<DBObject, LocalizedTitle>() { @Override public LocalizedTitle apply(DBObject input) { return localizedTitleTranslator.fromDBObject(input, new LocalizedTitle()); } })); }
Source:
protected String getItem(Map<Object, Object> keys, Object pool, String qualifier, PooledResourceOptions options) { PooledResourceItemGenerator generator = null; List<String> tryItems = new ArrayList<>(); if (options.getRequestedItems() != null) { tryItems.addAll(options.getRequestedItems()); } else { tryItems.add(options.getRequestedItem()); } for (PooledResourceItemGeneratorFactory factory : factories) { generator = factory.getGenerator(pool, qualifier); if (generator != null) { break; } } if (generator == null) { log.error("Failed to find generator for pool [{}]", pool); return null; } for (int i = 0; i < tryItems.size(); i++) { if (tryItems.get(i) != null && generator.isInPool(tryItems.get(i))) { String item = tryItems.get(i); Map<Object, Object> newKeys = new HashMap<Object, Object>(keys); newKeys.put(RESOURCE_POOL.ITEM, item); Map<String, Object> props = objectManager.convertToPropertiesFor(ResourcePool.class, newKeys); try { return objectManager.create(ResourcePool.class, props).getItem(); } catch (DataAccessException e) { log.debug("Failed to create item [{}]", item); } } } while (generator.hasNext()) { String item = generator.next(); Map<Object, Object> newKeys = new HashMap<Object, Object>(keys); newKeys.put(RESOURCE_POOL.ITEM, item); Map<String, Object> props = objectManager.convertToPropertiesFor(ResourcePool.class, newKeys); try { return objectManager.create(ResourcePool.class, props).getItem(); } catch (DataAccessException e) { log.debug("Failed to create item [{}]", item); } } return null; }

Target:
protected String getItem(Map<Object, Object> keys, Object pool, String qualifier, PooledResourceOptions options) { PooledResourceItemGenerator generator = null; List<String> tryItems = new ArrayList<>(); if (options.getRequestedItems() != null) { tryItems.addAll(options.getRequestedItems()); } else { tryItems.add(options.getRequestedItem()); } for (PooledResourceItemGeneratorFactory factory : factories) { generator = factory.getGenerator(pool, qualifier); if (generator != null) { break; } } if (generator == null) { log.error("Failed to find generator for pool [{}]", pool); return null; } for (String item: tryItems) { if (!StringUtils.isEmpty(item) && generator.isInPool(item)) { Map<Object, Object> newKeys = new HashMap<Object, Object>(keys); newKeys.put(RESOURCE_POOL.ITEM, item); Map<String, Object> props = objectManager.convertToPropertiesFor(ResourcePool.class, newKeys); try { return objectManager.create(ResourcePool.class, props).getItem(); } catch (DataAccessException e) { log.debug("Failed to create item [{}]", item); } } } while (generator.hasNext()) { String item = generator.next(); Map<Object, Object> newKeys = new HashMap<Object, Object>(keys); newKeys.put(RESOURCE_POOL.ITEM, item); Map<String, Object> props = objectManager.convertToPropertiesFor(ResourcePool.class, newKeys); try { return objectManager.create(ResourcePool.class, props).getItem(); } catch (DataAccessException e) { log.debug("Failed to create item [{}]", item); } } return null; }
Source:
public void testMissingUnionBranch() throws Exception { List<SchemaIncompatibilityType> types = new ArrayList<SchemaCompatibility.SchemaIncompatibilityType>(details.size()); for (int i = 0 ; i < details.size() ; i++) { types.add(SchemaIncompatibilityType.MISSING_UNION_BRANCH); } validateIncompatibleSchemas(reader, writer, types, details, location); }

Target:
public void testMissingUnionBranch() throws Exception { List<SchemaIncompatibilityType> types = Collections.nCopies(details.size(), SchemaIncompatibilityType.MISSING_UNION_BRANCH); validateIncompatibleSchemas(reader, writer, types, details, location); }
Source:
public static MetricKey<ASTMethodOrConstructorDeclaration> of(final Metric<ASTMethodOrConstructorDeclaration> metric, final String name) { return new MetricKey<ASTMethodOrConstructorDeclaration>() { @Override public String name() { return name; } @Override public Metric<ASTMethodOrConstructorDeclaration> getCalculator() { return metric; } @Override public boolean supports(ASTMethodOrConstructorDeclaration node) { return metric.supports(node); } @Override public boolean equals(Object obj) { return obj == this; } @Override public int hashCode() { return (metric != null ? metric.hashCode() * 31 : 0) + (name != null ? name.hashCode() : 0); } }; }

Target:
public static MetricKey<ASTMethodOrConstructorDeclaration> of(final Metric<ASTMethodOrConstructorDeclaration> metric, final String name) { return new MetricKey<ASTMethodOrConstructorDeclaration>() { @Override public String name() { return name; } @Override public Metric<ASTMethodOrConstructorDeclaration> getCalculator() { return metric; } @Override public boolean supports(ASTMethodOrConstructorDeclaration node) { return metric.supports(node); } @Override public boolean equals(Object obj) { return obj != null && getClass() == obj.getClass() && Objects.equals(name(), getClass().cast(obj).name()) && Objects.equals(getCalculator(), getClass().cast(obj).getCalculator()); } @Override public int hashCode() { return (metric != null ? metric.hashCode() * 31 : 0) + (name != null ? name.hashCode() : 0); } }; }
Source:
private static void collateVisible(final WComponent component, final List<WComponent> list) { if (component.isVisible()) { if (component instanceof Container) { for (WComponent child : ((Container) component).getChildren()) { collateVisible(child, list); } } list.add(component); } }

Target:
private static void collateVisible(final WComponent component, final List<WComponent> list) { if (component.isVisible()) { if (component instanceof Container) { final int size = ((Container) component).getChildCount(); for (int i = 0; i < size; i++) { collateVisible(((Container) component).getChildAt(i), list); } } list.add(component); } }
Source:
public PagesSpatialIndexSupplier( Session session, LongArrayList addresses, List<Type> types, List<Integer> outputChannels, List<List<Block>> channels, int geometryChannel, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<JoinFilterFunctionCompiler.JoinFilterFunctionFactory> filterFunctionFactory) { STRtree rtree = buildRTree(addresses, channels, geometryChannel); if (rtree.isEmpty()) { index = EMPTY_INDEX; } else { index = new PagesRTreeIndex(session, addresses, types, outputChannels, channels, rtree, spatialRelationshipTest, filterFunctionFactory); } }

Target:
public PagesSpatialIndexSupplier( Session session, LongArrayList addresses, List<Type> types, List<Integer> outputChannels, List<List<Block>> channels, int geometryChannel, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<JoinFilterFunctionCompiler.JoinFilterFunctionFactory> filterFunctionFactory) { this.session = session; this.addresses = addresses; this.types = types; this.outputChannels = outputChannels; this.channels = channels; this.spatialRelationshipTest = spatialRelationshipTest; this.filterFunctionFactory = filterFunctionFactory; this.rtree = buildRTree(addresses, channels, geometryChannel); this.memorySizeInBytes = INSTANCE_SIZE + (rtree.isEmpty() ? 0 : STRTREE_INSTANCE_SIZE + computeMemorySizeInBytes(rtree.getRoot())); }
Source:
public void editSocketBinding() throws Exception { String socketBinding = undertowOps.createSocketBinding(); ModelNodeResult result = operations.readAttribute(HTTPS_LISTENER_ADDRESS, SOCKET_BINDING); try { new ConfigChecker.Builder(client, HTTPS_LISTENER_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, SOCKET_BINDING, socketBinding) .verifyFormSaved() .verifyAttribute(SOCKET_BINDING, socketBinding); } finally { operations.writeAttribute(HTTPS_LISTENER_ADDRESS, SOCKET_BINDING, result.value()); } }

Target:
public void editSocketBinding() throws Exception { String socketBinding = undertowOps.createSocketBinding(); ModelNode originalSocketBindingValue = operations.readAttribute(HTTPS_LISTENER_ADDRESS, SOCKET_BINDING, ReadAttributeOption.NOT_INCLUDE_DEFAULTS).value(); try { new ConfigChecker.Builder(client, HTTPS_LISTENER_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, SOCKET_BINDING, socketBinding) .verifyFormSaved() .verifyAttribute(SOCKET_BINDING, socketBinding); } finally { operations.writeAttribute(HTTPS_LISTENER_ADDRESS, SOCKET_BINDING, originalSocketBindingValue); } }
Source:
public void start(ServiceProvider<Service> serviceProvider) { this.clusteringService = serviceProvider.getService(ClusteringService.class); this.managementRegistryService = serviceProvider.getService(ManagementRegistryService.class); this.cacheManager = serviceProvider.getService(CacheManagerProviderService.class).getCacheManager(); this.managementCallExecutor = serviceProvider.getService(ExecutionService.class).getOrderedExecutor( configuration.getManagementCallExecutorAlias(), new LinkedBlockingQueue<Runnable>(configuration.getManagementCallQueueSize())); this.collectorService = new DefaultCollectorService(this); this.collectorService.start(serviceProvider); EntityService entityService = serviceProvider.getService(EntityService.class); this.managementAgentEntityFactory = entityService.newClientEntityFactory( ManagementAgentEntityFactory.ENTITYNAME, ManagementAgentEntity.class, ManagementAgentVersion.LATEST.version(), new ManagementAgentConfig()); this.cacheManager.registerListener(this); }

Target:
public void start(ServiceProvider<Service> serviceProvider) { this.clusteringService = serviceProvider.getService(ClusteringService.class); this.managementRegistryService = serviceProvider.getService(ManagementRegistryService.class); this.cacheManager = serviceProvider.getService(CacheManagerProviderService.class).getCacheManager(); this.managementCallExecutor = serviceProvider.getService(ExecutionService.class).getOrderedExecutor( configuration.getManagementCallExecutorAlias(), new ArrayBlockingQueue<Runnable>(configuration.getManagementCallQueueSize())); this.collectorService = new DefaultCollectorService(this); this.collectorService.start(serviceProvider); EntityService entityService = serviceProvider.getService(EntityService.class); this.managementAgentEntityFactory = entityService.newClientEntityFactory( ManagementAgentEntityFactory.ENTITYNAME, ManagementAgentEntity.class, ManagementAgentVersion.LATEST.version(), new ManagementAgentConfig()); this.cacheManager.registerListener(this); }
Source:
public void testVisibilityDefaultMemberFunction() throws Exception { IBinding[] memberBindings = findQualifiedPossiblyImplicit(pdom, "AClass::defaultMemFun"); int visibility = getMemberVisibility(memberBindings[0]); VisibilityAsserts.assertVisibility(ICPPClassType.v_private, visibility); }

Target:
public void testVisibilityDefaultMemberFunction() throws Exception { IBinding[] memberBindings = findQualifiedPossiblyImplicit(pdom, "AClass::defaultMemFun"); assertVisibility(ICPPClassType.v_private, getMemberVisibility(memberBindings[0])); }
Source:
public List<Unit> getUnits(boolean weightClassSorted, boolean weightSorted, boolean unitTypeSorted) { List<Unit> units = getCopyOfUnits(); Comparator<String> naturalOrderComparator = new NaturalOrderComparator(); units.sort((o1, o2) -> naturalOrderComparator.compare(o1.getName(), o2.getName())); if (weightClassSorted || weightSorted || unitTypeSorted) { if (weightSorted && weightClassSorted) { units.sort((lhs, rhs) -> { int weightClass1 = lhs.getEntity().getWeightClass(); int weightClass2 = rhs.getEntity().getWeightClass(); if (weightClass1 == weightClass2) { return (int) (rhs.getEntity().getWeight() - lhs.getEntity().getWeight()); } else { return weightClass2 - weightClass1; } }); } else if (weightClassSorted) { units.sort(Comparator.comparingInt(o -> o.getEntity().getWeightClass())); } else if (weightSorted) { units.sort((lhs, rhs) -> Double.compare(rhs.getEntity().getWeight(), lhs.getEntity().getWeight())); } if (unitTypeSorted) { units.sort(Comparator.comparingInt(e -> e.getEntity().getUnitType())); } } return units; }

Target:
public List<Unit> getUnits(boolean weightClassSorted, boolean weightSorted, boolean unitTypeSorted) { List<Unit> units = getCopyOfUnits(); units.sort(Comparator.comparing(Unit::getName, new NaturalOrderComparator())); if (weightClassSorted || weightSorted || unitTypeSorted) { if (weightSorted && weightClassSorted) { units.sort((lhs, rhs) -> { int weightClass1 = lhs.getEntity().getWeightClass(); int weightClass2 = rhs.getEntity().getWeightClass(); if (weightClass1 == weightClass2) { return Double.compare(rhs.getEntity().getWeight(), lhs.getEntity().getWeight()); } else { return weightClass2 - weightClass1; } }); } else if (weightClassSorted) { units.sort(Comparator.comparingInt(o -> o.getEntity().getWeightClass())); } else if (weightSorted) { units.sort(Comparator.comparingDouble(o -> o.getEntity().getWeight())); } if (unitTypeSorted) { units.sort(Comparator.comparingInt(e -> e.getEntity().getUnitType())); } } return units; }
Source:
public Spliterator<TruthVersusEval> spliterator() { return Spliterators.spliteratorUnknownSize(this, 0); }

Target:
private Spliterator<TruthVersusEval> spliterator() { return Spliterators.spliteratorUnknownSize(this, 0); }
Source:
public void validate() { if (attributes.attribute(SIMPLE_CACHE).get()) { validateSimpleCacheConfiguration(); } List<RuntimeException> validationExceptions = new ArrayList<>(); for (Builder<?> validatable: asList(clustering, customInterceptors, dataContainer, deadlockDetection, eviction, expiration, indexing, invocationBatching, jmxStatistics, persistence, locking, storeAsBinary, transaction, versioning, unsafe, sites, compatibility)) { try { validatable.validate(); } catch (RuntimeException e) { validationExceptions.add(e); } } for (Builder<?> m : modules) { try { m.validate(); } catch (CacheConfigurationException e) { validationExceptions.add(e); } } CacheConfigurationException.fromMultipleRuntimeExceptions(validationExceptions).ifPresent(e -> { throw e; }); }

Target:
public void validate() { if (attributes.attribute(SIMPLE_CACHE).get()) { validateSimpleCacheConfiguration(); } List<RuntimeException> validationExceptions = new ArrayList<>(); for (Builder<?> validatable: asList(clustering, customInterceptors, dataContainer, deadlockDetection, eviction, expiration, indexing, invocationBatching, jmxStatistics, persistence, locking, storeAsBinary, transaction, versioning, unsafe, sites, compatibility)) { try { validatable.validate(); } catch (RuntimeException e) { validationExceptions.add(e); } } for (Builder<?> m : modules) { try { m.validate(); } catch (RuntimeException e) { validationExceptions.add(e); } } CacheConfigurationException.fromMultipleRuntimeExceptions(validationExceptions).ifPresent(e -> { throw e; }); }