auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int hdel(List<ByteArrayWrapper> subList) { AtomicLong numDeleted = new AtomicLong(); region().computeIfPresent(key, (_unused_, oldHash) -> { HashMap<ByteArrayWrapper, ByteArrayWrapper> newHash = new HashMap<>(oldHash); for (ByteArrayWrapper fieldToRemove : subList) { Object oldValue = newHash.remove(fieldToRemove); if (oldValue != null) { numDeleted.incrementAndGet(); } } return newHash; }); return numDeleted.intValue(); }

Target:
public int hdel(List<ByteArrayWrapper> subList) { AtomicLong numDeleted = new AtomicLong(); region().computeIfPresent(key, (_unused_, oldHash) -> { HashMap<ByteArrayWrapper, ByteArrayWrapper> newHash = new HashMap<>(oldHash); for (ByteArrayWrapper fieldToRemove : subList) { newHash.remove(fieldToRemove); } numDeleted.set(oldHash.size() - newHash.size()); return newHash; }); return numDeleted.intValue(); }
Source:
private void onActivateSnapshot() { if (getConfirmWindow() == null) { return; } ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); if (model.getProgress() != null) { return; } if (getSelectedItems().size() != 1) { return; } model.startProgress(null); Frontend.getInstance().runAction(VdcActionType.ActivateGlusterVolumeSnapshot, new GlusterVolumeSnapshotActionParameters(getEntity().getId(), ((GlusterVolumeSnapshotEntity) getSelectedItem()).getSnapshotName(), true), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); localModel.stopProgress(); setConfirmWindow(null); } }); }

Target:
private void onActivateSnapshot() { runAction(VdcActionType.ActivateGlusterVolumeSnapshot, new GlusterVolumeSnapshotActionParameters(getEntity().getId(), ((GlusterVolumeSnapshotEntity) getSelectedItem()).getSnapshotName(), true)); }
Source:
protected boolean canDoAction() { if (getParameters() != null) { if (QuotaHelper.getInstance().checkQuotaValidationForAddEdit(getParameters().getQuota(), getReturnValue().getCanDoActionMessages())) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__RUN.toString()); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM.toString()); } } return true; }

Target:
protected boolean canDoAction() { if (getParameters() == null) { return false; } else if (!QuotaHelper.getInstance().checkQuotaValidationForAddEdit(getParameters().getQuota(), getReturnValue().getCanDoActionMessages())) { return false; } return true; }
Source:
public void testUpgradeViewIndexIdDataType() throws Exception { byte[] rowKey = SchemaUtil.getColumnKey(null, SYSTEM_SCHEMA_NAME, SYSTEM_CATALOG_TABLE, VIEW_INDEX_ID, PhoenixDatabaseMetaData.TABLE_FAMILY); byte[] syscatBytes = PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME.getBytes(); byte[] viewIndexIdTypeCellValueIn414 = PInteger.INSTANCE.toBytes(Types.SMALLINT); byte[] viewIndexIdTypeCellValueIn416 = PInteger.INSTANCE.toBytes(Types.BIGINT); updateViewIndexIdColumnValue(rowKey, syscatBytes, viewIndexIdTypeCellValueIn414); verifyExpectedCellValue(rowKey,syscatBytes, viewIndexIdTypeCellValueIn414); try (PhoenixConnection conn = getConnection(false, null). unwrap(PhoenixConnection.class); HBaseAdmin admin = conn.getQueryServices().getAdmin()) { UpgradeUtil.updateViewIndexIdColumnDataTypeFromShortToLongIfNeeds(conn, admin); } verifyExpectedCellValue(rowKey,syscatBytes, viewIndexIdTypeCellValueIn416); }

Target:
public void testUpgradeViewIndexIdDataType() throws Exception { byte[] rowKey = SchemaUtil.getColumnKey(null, SYSTEM_SCHEMA_NAME, SYSTEM_CATALOG_TABLE, VIEW_INDEX_ID, PhoenixDatabaseMetaData.TABLE_FAMILY); byte[] syscatBytes = PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME.getBytes(); byte[] viewIndexIdTypeCellValueIn414 = PInteger.INSTANCE.toBytes(Types.SMALLINT); byte[] viewIndexIdTypeCellValueIn416 = PInteger.INSTANCE.toBytes(Types.BIGINT); try (PhoenixConnection conn = getConnection(false, null). unwrap(PhoenixConnection.class)) { updateViewIndexIdColumnValue(rowKey, syscatBytes, viewIndexIdTypeCellValueIn414); assertTrue(UpgradeUtil.isUpdateViewIndexIdColumnDataTypeFromShortToLongNeeded( conn, rowKey, syscatBytes)); verifyExpectedCellValue(rowKey, syscatBytes, viewIndexIdTypeCellValueIn414); UpgradeUtil.updateViewIndexIdColumnDataTypeFromShortToLong(conn, rowKey, syscatBytes); verifyExpectedCellValue(rowKey, syscatBytes, viewIndexIdTypeCellValueIn416); assertFalse(UpgradeUtil.isUpdateViewIndexIdColumnDataTypeFromShortToLongNeeded( conn, rowKey, syscatBytes)); } finally { updateViewIndexIdColumnValue(rowKey, syscatBytes, viewIndexIdTypeCellValueIn416); } }
Source:
public void memberShouldNotRedirectPingMessageWhenClientCachedViewIdIsWrong() throws IOException { final String poolName = testName.getMethodName(); parametrizedSetUp(poolName, Collections.singletonList(server1Port)); InternalDistributedMember distributedMember1 = (InternalDistributedMember) server1 .invoke(() -> cacheRule.getCache().getDistributedSystem().getDistributedMember()); client.invoke(() -> { PoolImpl poolImpl = (PoolImpl) PoolManager.find(poolName); distributedMember1.setVmViewId(distributedMember1.getVmViewId() + 1); assertThatThrownBy(() -> { PingOp.execute(poolImpl, new ServerLocation("localhost", server1Port), distributedMember1); }).isInstanceOf(ServerOperationException.class).hasMessageContaining("has different viewId:"); }); }

Target:
public void memberShouldNotRedirectPingMessageWhenClientCachedViewIdIsWrong() { final String poolName = testName.getMethodName(); parametrizedSetUp(poolName, Collections.singletonList(server1Port)); InternalDistributedMember distributedMember1 = (InternalDistributedMember) server1 .invoke(() -> cacheRule.getCache().getDistributedSystem().getDistributedMember()); client.invoke(() -> { PoolImpl poolImpl = (PoolImpl) PoolManager.find(poolName); distributedMember1.setVmViewId(distributedMember1.getVmViewId() + 1); assertThatThrownBy(() -> { PingOp.execute(poolImpl, new ServerLocation("localhost", server1Port), distributedMember1); }).isInstanceOf(ServerOperationException.class).hasMessageContaining("has different viewId:"); }); }
Source:
private static Set<CfgBlock> difference(Set<CfgBlock> a, Set<CfgBlock> b) { Set<CfgBlock> result = new HashSet<>(a); result.removeIf(b::contains); return result; }

Target:
private static Set<CfgBlock> difference(Set<CfgBlock> a, Set<CfgBlock> b) { Set<CfgBlock> result = new HashSet<>(a); result.removeAll(b); return result; }
Source:
public void testkDuplicateKeys() { String baseDir = System.getProperty("basedir"); assumeNotNull(baseDir); String fileName = "AppErrors.properties"; File file = new File(baseDir + "/src/main/resources/bundles/" + fileName); DuplicateKeysCheck.checkDuplicateKeys(file.getAbsolutePath()); }

Target:
public void testkDuplicateKeys() throws FileNotFoundException { String baseDir = System.getProperty("basedir"); assumeNotNull(baseDir); String fileName = "AppErrors.properties"; File file = new File(baseDir + "/src/main/resources/bundles/" + fileName); DuplicateKeysCheck.assertNoDuplicateKeys(file.getAbsolutePath()); }
Source:
static boolean isUserAdminOrMaintainer(Organization organization, Long userId) { OrganizationUser organizationUser = getUserOrgRole(organization, userId); if (organizationUser == null) { return false; } if (organizationUser.getRole() == OrganizationUser.Role.ADMIN || organizationUser.getRole() == OrganizationUser.Role.MAINTAINER) { return true; } return false; }

Target:
static boolean isUserAdminOrMaintainer(Organization organization, Long userId) { if (organization == null) { String msg = "Organization not found"; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_NOT_FOUND); } OrganizationUser organizationUser = getUserOrgRole(organization, userId); if (organizationUser == null) { return false; } if (organizationUser.getRole() == OrganizationUser.Role.ADMIN || organizationUser.getRole() == OrganizationUser.Role.MAINTAINER) { return true; } return false; }
Source:
public void setValue(String value) { if (value == null) { clearSelections(); } if (value.isEmpty()) { return; } setValue(value, false); }

Target:
public void setValue(String value) { setValue(value, false); }
Source:
protected TableEntry getImplicitTable(String tableName, boolean caseSensitive) { final NameSet names = NameSet.immutableCopyOf(schema.getTableNames()); for (String tableName2: names.range(tableName, caseSensitive)) { return tableEntry(tableName2, schema.getTable(tableName2)); } return null; }

Target:
protected TableEntry getImplicitTable(String tableName, boolean caseSensitive) { final String tableName2 = caseSensitive ? tableName : caseInsensitiveLookup( schema.getTableNames(), tableName); if (tableName2 == null) { return null; } final Table table = schema.getTable(tableName2); if (table == null) { return null; } return tableEntry(tableName2, table); }
Source:
public void testJdbcPOJOInputOperatorApplication() throws Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/JdbcProperties.xml")); lma.prepareDAG(new JdbcPOJOInputOperatorApplication(), conf); LocalMode.Controller lc = lma.getController(); lc.setHeartbeatMonitoringEnabled(false); ((StramLocalCluster)lc).setExitCondition(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return TupleCount == 10; } }); lc.run(10000); Assert.assertEquals("rows in db", TupleCount, getNumOfRowsinTable(TABLE_POJO_NAME)); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }

Target:
public void testJdbcPOJOInputOperatorApplication() throws Exception { testApplication(new JdbcPOJOInputOperatorApplication()); }
Source:
public List<Pair<String, String>> getEvents() { return mEventList; }

Target:
public List<Pair<String, String>> getEvents() { return Collections.unmodifiableList(mEventList); }
Source:
public Map<String, String> allocate(Network network, VnicProfile vnicProfile, VmNic nic, VDS host) { Map<String, String> runtimeProperties = new HashMap<>(); runtimeProperties.put("provider_type", "dummy"); return runtimeProperties; }

Target:
public Map<String, String> allocate(Network network, VnicProfile vnicProfile, VmNic nic, VDS host) { Map<String, String> runtimeProperties = new HashMap<>(); runtimeProperties.put("provider_type", "dummy"); runtimeProperties.put("plugin_type", StringUtils.defaultString( provider.getAdditionalProperties().getPluginType())); return runtimeProperties; }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getContentConflictServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } for (GlusterServerHook serverHook: getContentConflictServerHooks()) { VDS vds = getVdsDAO().get(serverHook.getServerId()); if (vds == null || vds.getStatus() != VDSStatus.Up) { String vdsName = vds != null ? vds.getName() : "NO SERVER"; setVdsName(vdsName); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP); addCanDoActionMessage(String.format("$%1$s %2$s", "VdsName", vdsName)); return false; } } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getContentConflictServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } for (GlusterServerHook serverHook: getContentConflictServerHooks()) { VDS vds = getVdsDAO().get(serverHook.getServerId()); if (vds == null || vds.getStatus() != VDSStatus.Up) { String vdsName = vds != null ? vds.getName() : GlusterConstants.NO_SERVER; setVdsName(vdsName); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP); addCanDoActionMessage(String.format("$%1$s %2$s", "VdsName", vdsName)); return false; } } return true; }
Source:
private void updateNotification() { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); String type = sp.getString(PREF_NOTIFICATION_TYPE, "low_priority"); boolean foreground = sp.getBoolean(PREF_FOREGROUND_SERVICE, false); if ("none".equals(type) && foreground) type = "low_priority"; NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); if ((mCurrentState == State.ACTIVE || mCurrentState == State.STARTING) && !type.equals("none")) { Context appContext = getApplicationContext(); NotificationCompat.Builder builder = new NotificationCompat.Builder(appContext) .setContentTitle(getString(R.string.syncthing_active)) .setSmallIcon(R.drawable.ic_stat_notify) .setOngoing(true) .setContentIntent(PendingIntent.getActivity(appContext, 0, new Intent(appContext, MainActivity.class), 0)); if (type.equals("low_priority")) builder.setPriority(NotificationCompat.PRIORITY_MIN); if (foreground) { builder.setContentText(getString(R.string.syncthing_active_foreground)); startForeground(NOTIFICATION_ACTIVE, builder.build()); } else { stopForeground(false); nm.notify(NOTIFICATION_ACTIVE, builder.build()); } } else { stopForeground(false); nm.cancel(NOTIFICATION_ACTIVE); } }

Target:
private void updateNotification() { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); String type = sp.getString(PREF_NOTIFICATION_TYPE, "low_priority"); boolean foreground = sp.getBoolean(PREF_FOREGROUND_SERVICE, false); if ("none".equals(type) && foreground) { type = "low_priority"; } NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); if ((mCurrentState == State.ACTIVE || mCurrentState == State.STARTING) && !type.equals("none")) { Context appContext = getApplicationContext(); NotificationCompat.Builder builder = new NotificationCompat.Builder(appContext) .setContentTitle(getString(R.string.syncthing_active)) .setSmallIcon(R.drawable.ic_stat_notify) .setOngoing(true) .setContentIntent(PendingIntent.getActivity(appContext, 0, new Intent(appContext, MainActivity.class), 0)); if (type.equals("low_priority")) builder.setPriority(NotificationCompat.PRIORITY_MIN); if (foreground) { builder.setContentText(getString(R.string.syncthing_active_foreground)); startForeground(NOTIFICATION_ACTIVE, builder.build()); } else { stopForeground(false); nm.notify(NOTIFICATION_ACTIVE, builder.build()); } } else { stopForeground(false); nm.cancel(NOTIFICATION_ACTIVE); } }
Source:
private boolean visit(String resourceName) { if (resourceName.equals(ResourceRequest.ANY)) { return visitAny(); } List<FSSchedulerNode> nodes = nodeTracker.getNodesByResourceName(resourceName); switch (nodes.size()) { case 0: return false; case 1: return visitNode(nodes.remove(0).getRackName()); default: return visitRack(resourceName); } }

Target:
private boolean visit(String resourceName) { if (resourceName.equals(ResourceRequest.ANY)) { return visitAny(); } List<FSSchedulerNode> nodes = nodeTracker.getNodesByResourceName(resourceName); int numNodes = nodes.size(); if (numNodes == 0) { LOG.error("Found ResourceRequest for a non-existent node/rack named " + resourceName); return false; } if (numNodes == 1) { FSSchedulerNode node = nodes.get(0); if (node.getNodeName().equals(resourceName)) { return visitNode(node.getRackName()); } } return visitRack(resourceName); }
Source:
int getMessageInfoAndMetadataListSize() { int size = 0; if (version >= VERSION_5) { size += Short.BYTES; } size += Integer.BYTES; if (messageInfoList == null) { return size; } ListIterator<MessageInfo> infoListIterator = messageInfoList.listIterator(); ListIterator<MessageMetadata> metadataListIterator = messageMetadataList.listIterator(); while (infoListIterator.hasNext()) { MessageInfo messageInfo = infoListIterator.next(); MessageMetadata messageMetadata = metadataListIterator.next(); size += messageInfo.getStoreKey().sizeInBytes(); size += Long.BYTES; size += Long.BYTES; size += 1; if (version < VERSION_1 || version > VERSION_MAX) { throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } if (version >= VERSION_5) { size += 1; } if (version >= VERSION_6) { size += 1; } if (version > VERSION_1) { size += 1; if (messageInfo.getCrc() != null) { size += Long.BYTES; } } if (version > VERSION_2) { size += Short.BYTES; size += Short.BYTES; size += Long.BYTES; } if (version >= VERSION_6) { size += 2; } if (version > VERSION_3) { size += Byte.BYTES; if (messageMetadata != null) { size += messageMetadata.sizeInBytes(); } } } return size; }

Target:
int getMessageInfoAndMetadataListSize() { int size = 0; if (version >= VERSION_5) { size += Short.BYTES; } size += Integer.BYTES; if (messageInfoList == null) { return size; } ListIterator<MessageInfo> infoListIterator = messageInfoList.listIterator(); ListIterator<MessageMetadata> metadataListIterator = messageMetadataList.listIterator(); while (infoListIterator.hasNext()) { MessageInfo messageInfo = infoListIterator.next(); MessageMetadata messageMetadata = metadataListIterator.next(); size += messageInfo.getStoreKey().sizeInBytes(); size += Long.BYTES; size += Long.BYTES; size += Byte.BYTES; if (version < VERSION_1 || version > VERSION_MAX) { throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } if (version >= VERSION_5) { size += Byte.BYTES; } if (version >= VERSION_6) { size += Byte.BYTES; } if (version > VERSION_1) { size += Byte.BYTES; if (messageInfo.getCrc() != null) { size += Long.BYTES; } } if (version > VERSION_2) { size += Short.BYTES; size += Short.BYTES; size += Long.BYTES; } if (version >= VERSION_6) { size += Short.BYTES; } if (version > VERSION_3) { size += Byte.BYTES; if (messageMetadata != null) { size += messageMetadata.sizeInBytes(); } } } return size; }
Source:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } if (getStoragePool() == null) { throw new InvalidQuotaParametersException("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper(this, getReturnValue().getCanDoActionMessages()); quotaConsumptionParametersWrapper.setParameters(getQuotaConsumptionParameters()); if (quotaConsumptionParametersWrapper.getParameters() == null) { throw new InvalidQuotaParametersException("Command: " + this.getClass().getName() + ". No Quota parameters available."); } boolean result = true; setQuotaChanged(result); return result; }

Target:
private boolean internalValidateAndSetQuota() { if (isInternalExecution() || !isQuotaDependant()) { return true; } if (getStoragePool() == null) { throw new InvalidQuotaParametersException("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper(this, getReturnValue().getCanDoActionMessages()); quotaConsumptionParametersWrapper.setParameters(getQuotaConsumptionParameters()); if (quotaConsumptionParametersWrapper.getParameters() == null) { throw new InvalidQuotaParametersException("Command: " + this.getClass().getName() + ". No Quota parameters available."); } boolean result = true; setQuotaChanged(result); return result; }
Source:
public void execute(ActionInvocation invocation) throws Exception { ValueStack stack = invocation.getInvocationContext().getValueStack(); String finalNamespace = this.namespace != null ? TextParseUtil.translateVariables(namespace, stack) : invocation.getProxy().getNamespace(); String finalActionName = TextParseUtil.translateVariables(actionName, stack); String finalMethodName = this.methodName != null ? TextParseUtil.translateVariables(this.methodName, stack) : null; if (isInChainHistory(finalNamespace, finalActionName, finalMethodName)) { addToHistory(finalNamespace, finalActionName, finalMethodName); throw new StrutsException("Infinite recursion detected: " + ActionChainResult.getChainHistory().toString()); } if (ActionChainResult.getChainHistory().isEmpty() && invocation.getProxy() != null) { addToHistory(finalNamespace, invocation.getProxy().getActionName(), invocation.getProxy().getMethod()); } addToHistory(finalNamespace, finalActionName, finalMethodName); HashMap<String, Object> extraContext = new HashMap<>(); extraContext.put(ActionContext.VALUE_STACK, invocation.getInvocationContext().getValueStack()); extraContext.put(ActionContext.PARAMETERS, invocation.getInvocationContext().getParameters()); extraContext.put(CHAIN_HISTORY, ActionChainResult.getChainHistory()); LOG.debug("Chaining to action {}", finalActionName); proxy = actionProxyFactory.createActionProxy(finalNamespace, finalActionName, finalMethodName, extraContext); proxy.execute(); }

Target:
public void execute(ActionInvocation invocation) throws Exception { ValueStack stack = invocation.getInvocationContext().getValueStack(); String finalNamespace = this.namespace != null ? TextParseUtil.translateVariables(namespace, stack) : invocation.getProxy().getNamespace(); String finalActionName = TextParseUtil.translateVariables(actionName, stack); String finalMethodName = this.methodName != null ? TextParseUtil.translateVariables(this.methodName, stack) : null; if (isInChainHistory(finalNamespace, finalActionName, finalMethodName)) { addToHistory(finalNamespace, finalActionName, finalMethodName); throw new StrutsException("Infinite recursion detected: " + ActionChainResult.getChainHistory().toString()); } if (ActionChainResult.getChainHistory().isEmpty() && invocation.getProxy() != null) { addToHistory(finalNamespace, invocation.getProxy().getActionName(), invocation.getProxy().getMethod()); } addToHistory(finalNamespace, finalActionName, finalMethodName); Map<String, Object> extraContext = ActionContext.of(new HashMap<>()) .withValueStack(invocation.getInvocationContext().getValueStack()) .withParameters(invocation.getInvocationContext().getParameters()) .with(CHAIN_HISTORY, ActionChainResult.getChainHistory()) .getContextMap(); LOG.debug("Chaining to action {}", finalActionName); proxy = actionProxyFactory.createActionProxy(finalNamespace, finalActionName, finalMethodName, extraContext); proxy.execute(); }
Source:
private static void recursiveCopy(File srcFile, File destFile, Map<String, String> tokens) { if (srcFile.isDirectory()) { destFile.mkdirs(); if (destFile.mkdirs()) { System.out.println("Created " + destFile.getAbsolutePath()); } else { System.out.println("Failed to create " + destFile.getAbsolutePath()); } for (File child : srcFile.listFiles()) { recursiveCopy(child, new File(destFile, child.getName()), tokens); } } else if (destFile.getName().equals("cake.png")) { String icon = tokens.get("@@icon@@"); if (icon != null && icon.length() > 0) { destFile = new File(destFile.getParentFile(), icon); try { FileUtils.copyFile(srcFile, destFile); } catch (IOException e) { System.out.println("Failed to copy file to " + destFile.getAbsolutePath()); e.printStackTrace(); } } } else { try { String fileContents = FileUtils.readFileToString(srcFile); for (Entry<String, String> entry : tokens.entrySet()) { fileContents = fileContents.replaceAll(entry.getKey(), entry.getValue()); } FileUtils.write(destFile, fileContents); System.out.println("Created file " + destFile.getAbsolutePath()); } catch (IOException e) { System.out.println("Failed to create file " + destFile.getAbsolutePath()); e.printStackTrace(); } } }

Target:
private static void recursiveCopy(File srcFile, File destFile, Map<String, String> tokens) throws IOException { if (srcFile.isDirectory()) { if (!destFile.isDirectory()) { if (destFile.mkdirs()) { System.out.println("Created " + destFile.getAbsolutePath()); } else { throw new IOException("Failed to create " + destFile.getAbsolutePath()); } } for (File child : srcFile.listFiles()) { recursiveCopy(child, new File(destFile, child.getName()), tokens); } } else if (destFile.getName().equals("cake.png")) { String icon = tokens.get("@@icon@@"); if (icon != null && icon.length() > 0) { destFile = new File(destFile.getParentFile(), icon); try { FileUtils.copyFile(srcFile, destFile); } catch (IOException e) { System.out.println("Failed to copy file to " + destFile.getAbsolutePath()); e.printStackTrace(); } } } else { try { String fileContents = FileUtils.readFileToString(srcFile); for (Entry<String, String> entry : tokens.entrySet()) { fileContents = fileContents.replaceAll(entry.getKey(), entry.getValue()); } FileUtils.write(destFile, fileContents); System.out.println("Created file " + destFile.getAbsolutePath()); } catch (IOException e) { System.out.println("Failed to create file " + destFile.getAbsolutePath()); e.printStackTrace(); } } }
Source:
private void refreshAndSelectSite(Map<String, Object> site) { Map<String, Object> primaryBlog = site; refreshBlogContent(primaryBlog); WordPress.setCurrentBlog((Integer) primaryBlog.get("id")); }

Target:
private void refreshAndSelectSite(Map<String, Object> site) { refreshBlogContent(site); WordPress.setCurrentBlog((Integer) site.get("id")); }
Source:
@Override public TypedBytes toBody(Object object) { try { return new JsonTypedBytes(gson.toJson(object).getBytes(UTF_8)); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(UTF_8 + " encoding does not exist.", e); } }

Target:
@Override public TypedBytes toBody(Object object) { try { return new JsonTypedBytes(gson.toJson(object).getBytes(UTF_8)); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } }
Source:
public final ChannelPipeline addFirst(String name, ChannelHandler handler) { final AbstractChannelHandlerContext newCtx; checkMultiplicity(handler); if (name == null) { name = generateName(handler); } synchronized (handlers) { if (context(name) != null) { throw new IllegalArgumentException("Duplicate handler name: " + name); } newCtx = newContext(name, handler); handlers.add(0, newCtx); } EventExecutor executor = executor(); if (executor.inEventLoop()) { addFirst0(newCtx); } else { try { executor.execute(() -> addFirst0(newCtx)); } catch (Throwable cause) { synchronized (handlers) { handlers.remove(newCtx); } throw cause; } } return this; }

Target:
public final ChannelPipeline addFirst(String name, ChannelHandler handler) { checkMultiplicity(handler); if (name == null) { name = generateName(handler); } AbstractChannelHandlerContext newCtx = newContext(name, handler); EventExecutor executor = executor(); boolean inEventLoop = executor.inEventLoop(); synchronized (handlers) { if (context(name) != null) { throw new IllegalArgumentException("Duplicate handler name: " + name); } handlers.add(0, newCtx); if (!inEventLoop) { try { executor.execute(() -> addFirst0(newCtx)); return this; } catch (Throwable cause) { handlers.remove(0); throw cause; } } } addFirst0(newCtx); return this; }
Source:
private void sendMetrics(String queryString, String body) throws IOException { HttpURLConnection conn = createAndConfigureConnection(); writeMetrics(conn, body); int responseCode = conn.getResponseCode(); if (responseCode / 100 != 2) { throw new RuntimeException("Failed to write metrics, response code: " + responseCode + ", response message: " + conn.getResponseMessage()); } String response = readResponse(conn); logger.log(getTraceLevel(), "Response from influx: " + response); }

Target:
private void sendMetrics(String queryString, String body) throws IOException { HttpURLConnection conn = createAndConfigureConnection(); try { sendMetrics(body, conn); } finally { IoUtils.closeQuietly(conn); } }
Source:
public void testList() throws Exception { final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGh47.java"), expected); }

Target:
public void testList() throws Exception { final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGenericWhitespaceList.java"), expected); }
Source:
private void unresolveConstraints(BundleDescriptionImpl bundle) { HostSpecificationImpl host = (HostSpecificationImpl) bundle.getHost(); if (host != null) host.setHosts(null); bundle.setSelectedExports(null); bundle.setResolvedImports(null); bundle.setResolvedRequires(null); bundle.setSubstitutedExports(null); bundle.setSelectedCapabilities(null); bundle.setResolvedCapabilities(null); bundle.setStateWires(null); bundle.clearAddedDynamicImportPackages(); NativeCodeSpecificationImpl nativeCode = (NativeCodeSpecificationImpl) bundle.getNativeCodeSpecification(); if (nativeCode != null) nativeCode.setSupplier(null); ImportPackageSpecification[] imports = bundle.getImportPackages(); for (ImportPackageSpecification import1 : imports) { ((ImportPackageSpecificationImpl) import1).setSupplier(null); } BundleSpecification[] requires = bundle.getRequiredBundles(); for (BundleSpecification require : requires) { ((BundleSpecificationImpl) require).setSupplier(null); } GenericSpecification[] genericRequires = bundle.getGenericRequires(); if (genericRequires.length > 0) for (GenericSpecification genericRequire : genericRequires) { ((GenericSpecificationImpl) genericRequire).setSupplers(null); } bundle.removeDependencies(); }

Target:
private void unresolveConstraints(BundleDescriptionImpl bundle) { HostSpecificationImpl host = (HostSpecificationImpl) bundle.getHost(); if (host != null) host.setHosts(null); bundle.setSelectedExports(null); bundle.setResolvedImports(null); bundle.setResolvedRequires(null); bundle.setSubstitutedExports(null); bundle.setSelectedCapabilities(null); bundle.setResolvedCapabilities(null); bundle.setStateWires(null); bundle.clearAddedDynamicImportPackages(); NativeCodeSpecificationImpl nativeCode = (NativeCodeSpecificationImpl) bundle.getNativeCodeSpecification(); if (nativeCode != null) nativeCode.setSupplier(null); ImportPackageSpecification[] imports = bundle.getImportPackages(); for (ImportPackageSpecification importSpecification : imports) { ((ImportPackageSpecificationImpl) importSpecification).setSupplier(null); } BundleSpecification[] requires = bundle.getRequiredBundles(); for (BundleSpecification require : requires) { ((BundleSpecificationImpl) require).setSupplier(null); } GenericSpecification[] genericRequires = bundle.getGenericRequires(); if (genericRequires.length > 0) for (GenericSpecification genericRequire : genericRequires) { ((GenericSpecificationImpl) genericRequire).setSupplers(null); } bundle.removeDependencies(); }
Source:
public void executeForRefundsOnly(Long startId, OptionalLong maybeMaxId, Long doNotRetryEmitUntilDuration) { try { MDC.put(HEADER_REQUEST_ID, "HistoricalEventEmitterWorker-" + RandomUtils.nextLong(0, 10000)); initializeHistoricalEventEmitter(doNotRetryEmitUntilDuration); maxId = maybeMaxId.orElseGet(refundDao::findMaxId); logger.info("Starting emitting refunds from up to {}", startId, maxId); for (long currentId = startId; currentId <= maxId; currentId++) { Optional<RefundEntity> mayBeRefundEntity = refundDao.findById(currentId); if (mayBeRefundEntity.isPresent()) { final RefundEntity refundEntity = mayBeRefundEntity.get(); historicalEventEmitter.processRefundEvents(refundEntity.getChargeExternalId()); } else { logger.info("Refund [{}/{}] - not found", currentId, maxId); } } } catch (Exception e) { logger.error("Error attempting to process refunds events on job [start={}] [max={}] [error={}]", startId, maxId, e); } finally { MDC.remove(HEADER_REQUEST_ID); } logger.info("Terminating"); }

Target:
public void executeForRefundsOnly(Long startId, OptionalLong maybeMaxId, Long doNotRetryEmitUntilDuration) { try { MDC.put(HEADER_REQUEST_ID, "HistoricalEventEmitterWorker-" + RandomUtils.nextLong(0, 10000)); initializeHistoricalEventEmitter(doNotRetryEmitUntilDuration); maxId = maybeMaxId.orElseGet(refundDao::findMaxId); logger.info("Starting emitting refunds from up to {}", startId, maxId); for (long currentId = startId; currentId <= maxId; currentId++) { long finalCurrentId = currentId; refundDao.findById(currentId) .ifPresentOrElse( refundEntity -> historicalEventEmitter.processRefundEvents(refundEntity.getChargeExternalId()), () -> logger.info("Refund [{}/{}] - not found", finalCurrentId, maxId)); } } catch (Exception e) { logger.error("Error attempting to process refunds events on job [start={}] [max={}] [error={}]", startId, maxId, e); } finally { MDC.remove(HEADER_REQUEST_ID); } logger.info("Terminating"); }
Source:
protected void logToAudit(){ AuditLogableBase auditLogableBase = new AuditLogableBase(){ public AuditLogType getAuditLogTypeValue() { return AuditLogType.IRS_BROKER_COMMAND_FAILURE; } }; auditLogableBase.addCustomValue("message", getReturnStatus().mMessage); AuditLogDirector auditLogDirector = new AuditLogDirector(); auditLogDirector.log(auditLogableBase); }

Target:
protected void logToAudit(){ AuditLogableBase auditLogableBase = new AuditLogableBase(); auditLogableBase.addCustomValue("message", getReturnStatus().mMessage); auditLogDirector.log(auditLogableBase, AuditLogType.IRS_BROKER_COMMAND_FAILURE); }
Source:
@Test public void testAsciiFunc() { tester.setFor(SqlStdOperatorTable.ASCII); tester.checkScalarExact("ASCII('')", "0"); tester.checkScalarExact("ASCII('abc')", "97"); tester.checkScalarExact("ASCII('ABC')", "65"); tester.checkNull("ASCII(cast(null as varchar(1)))"); }

Target:
@Test public void testAsciiFunc() { tester.setFor(SqlStdOperatorTable.ASCII); tester.checkScalarExact("ASCII('')", "0"); tester.checkScalarExact("ASCII('a')", "97"); tester.checkScalarExact("ASCII('1')", "49"); tester.checkScalarExact("ASCII('abc')", "97"); tester.checkScalarExact("ASCII('ABC')", "65"); tester.checkScalarExact("ASCII(_UTF8'\u0082')", "130"); tester.checkScalarExact("ASCII(_UTF8'\u5B57')", "23383"); tester.checkScalarExact("ASCII(_UTF8'Ω')", "937"); tester.checkNull("ASCII(cast(null as varchar(1)))"); }
Source:
public void testSubstrings() { int index = 1; int len = 3; ExtractionFn extractionFn = new SubstringDimExtractionFn(index, len); Set<String> extracted = Sets.newHashSet(); for (String testString : testStrings) { extracted.add(extractionFn.apply(testString)); } Assert.assertEquals(7, extracted.size()); Assert.assertTrue(extracted.contains("ppl")); Assert.assertTrue(extracted.contains("wes")); Assert.assertTrue(extracted.contains("syl")); Assert.assertTrue(extracted.contains("usi")); Assert.assertTrue(extracted.contains("e")); Assert.assertTrue(extracted.contains("ool")); Assert.assertTrue(extracted.contains(null)); }

Target:
public void testSubstrings() { ExtractionFn extractionFn = new SubstringDimExtractionFn(1, 3); Assert.assertEquals("ppl", extractionFn.apply("apple")); Assert.assertEquals("e", extractionFn.apply("be")); Assert.assertEquals("ool", extractionFn.apply("cool")); Assert.assertEquals(null, extractionFn.apply("a")); }
Source:
public void process(MetadataRepository repository, ComplexTypeMetadata type, XSDAnnotation annotation, XmlSchemaAnnotationProcessorState state) { if (annotation != null) { EList<Element> appInfoElements = annotation.getApplicationInformation(); List<Category> categories = new ArrayList<>(); for (Element appInfo : appInfoElements) { String source = appInfo.getAttribute("source"); if (source != null && source.equals("X_Category")) { NodeList childNodes = appInfo.getChildNodes(); Map<Locale, String> labels = new LinkedHashMap<>(); List<String> fields = new ArrayList<>(); String categoryName = null; for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); String localName = node.getLocalName(); if (localName != null) { Node subChild = node.getFirstChild(); if (subChild != null) { String nodeValue = subChild.getNodeValue(); if (nodeValue != null) { if (localName.equalsIgnoreCase("name")) { categoryName = nodeValue; } else if (localName.startsWith("label_")) { String lang = localName.substring(6); Locale locale = new Locale(lang.toLowerCase()); labels.put(locale, nodeValue); } else if (localName.equalsIgnoreCase("field") && nodeValue != null) { fields.add(nodeValue); } } } } } if (categoryName != null) { Category category = new Category(); category.setName(categoryName); category.setLabels(labels); category.setFields(fields); categories.add(category); state.setCategories(categories); } } } } }

Target:
public void process(MetadataRepository repository, ComplexTypeMetadata type, XSDAnnotation annotation, XmlSchemaAnnotationProcessorState state) { if (annotation != null) { EList<Element> appInfoElements = annotation.getApplicationInformation(); List<Category> categories = new ArrayList<>(); for (Element appInfo : appInfoElements) { String source = appInfo.getAttribute("source"); if (source != null && source.equals("X_Category")) { NodeList childNodes = appInfo.getChildNodes(); Map<Locale, String> labels = new LinkedHashMap<>(); List<String> fields = new ArrayList<>(); String categoryName = null; for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); String localName = node.getLocalName(); if (localName != null) { localName = localName.toLowerCase(); Node subChild = node.getFirstChild(); if (subChild != null) { String nodeValue = subChild.getNodeValue(); if (nodeValue != null) { if (localName.equals("name")) { categoryName = nodeValue; } else if (localName.startsWith("label_")) { String lang = localName.substring(6); Locale locale = new Locale(lang); labels.put(locale, nodeValue); } else if (localName.equals("field") && nodeValue != null) { fields.add(nodeValue); } } } } } if (categoryName != null) { Category category = new Category(categoryName, fields, labels); categories.add(category); state.setCategories(categories); } } } } }
Source:
private List<String> sortIds(Set<String> docIdSet, List<Map<String, String>> sortDocument, Map<String, Object> indexes, SQLDatabase db) { boolean smallResultSet = (docIdSet.size() < SMALL_RESULT_SET_SIZE_THRESHOLD); SqlParts orderBy = sqlToSortIds(docIdSet, sortDocument, indexes); List<String> sortedIds = new ArrayList<String>(); if (orderBy != null) { Cursor cursor = null; try { cursor = db.rawQuery(orderBy.sqlWithPlaceHolders, orderBy.placeHolderValues); if (smallResultSet) { while (cursor.moveToNext()) { String candidateId = cursor.getString(0); sortedIds.add(candidateId); } } else { while (cursor.moveToNext()) { String candidateId = cursor.getString(0); if (docIdSet.contains(candidateId)) { sortedIds.add(candidateId); } } } } catch (SQLException e) { logger.log(Level.SEVERE, "Failed to sort doc ids.", e); return null; } finally { DatabaseUtils.closeCursorQuietly(cursor); } } else { return null; } return sortedIds; }

Target:
private List<String> sortIds(Set<String> docIdSet, List<Map<String, String>> sortDocument, Map<String, Object> indexes, SQLDatabase db) { boolean smallResultSet = (docIdSet.size() < SMALL_RESULT_SET_SIZE_THRESHOLD); SqlParts orderBy = sqlToSortIds(docIdSet, sortDocument, indexes); List<String> sortedIds = null; if (orderBy != null) { Cursor cursor = null; try { cursor = db.rawQuery(orderBy.sqlWithPlaceHolders, orderBy.placeHolderValues); while (cursor.moveToNext()) { if (sortedIds == null) { sortedIds = new ArrayList<String>(); } String candidateId = cursor.getString(0); if (smallResultSet) { sortedIds.add(candidateId); } else { if (docIdSet.contains(candidateId)) { sortedIds.add(candidateId); } } } } catch (SQLException e) { logger.log(Level.SEVERE, "Failed to sort doc ids.", e); return null; } finally { DatabaseUtils.closeCursorQuietly(cursor); } } else { sortedIds = null; } return sortedIds; }
Source:
public static Collection<String> attributes() { return Stream.of(Attribute.values()).map(a->a.getAttributeName()).collect(Collectors.toList()); }

Target:
public static Collection<String> attributes() { return Stream.of(Attribute.values()).map(Attribute::getAttributeName).collect(Collectors.toList()); }
Source:
public GroupChatInvitation parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { return new GroupChatInvitation( ParserUtils.getBareJidAttribute(parser, ATTR_JID), parser.getAttributeValue(ATTR_PASSWORD), parser.getAttributeValue(ATTR_REASON), ParserUtils.getBooleanAttribute(parser, ATTR_CONTINUE, false), parser.getAttributeValue(ATTR_THREAD)); }

Target:
public GroupChatInvitation parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { EntityBareJid roomJid = ParserUtils.getBareJidAttribute(parser, ATTR_JID); String password = parser.getAttributeValue(ATTR_PASSWORD); String reason = parser.getAttributeValue(ATTR_REASON); boolean isContinue = ParserUtils.getBooleanAttribute(parser, ATTR_CONTINUE, false); String thread = parser.getAttributeValue(ATTR_THREAD); return new GroupChatInvitation(roomJid, password, reason, isContinue, thread); }
Source:
public void setPortParameters(int baudRate, int dataBits, int stopBits, int parity, int flowControl) throws XBeeException { if (serialPort != null) { try { serialPort.setSerialPortParams(baudRate, dataBits, stopBits, parity); serialPort.setFlowControlMode(flowControl); } catch (UnsupportedCommOperationException e) { throw new XBeeException(XBeeException.INVALID_OPERATION, e.getMessage()); } } }

Target:
public void setPortParameters(int baudRate, int dataBits, int stopBits, int parity, int flowControl) throws XBeeException { parameters = new SerialPortParameters(baudRate, dataBits, stopBits, parity, flowControl); if (serialPort != null) { try { serialPort.setSerialPortParams(baudRate, dataBits, stopBits, parity); serialPort.setFlowControlMode(flowControl); } catch (UnsupportedCommOperationException e) { throw new XBeeException(XBeeException.INVALID_OPERATION, e.getMessage()); } } }
Source:
public void addTail(final MessageReference ref, final boolean direct) { enterCritical(CRITICAL_PATH_ADD_TAIL); try { if (scheduleIfPossible(ref)) { return; } synchronized (directDeliveryGuard) { if (supportsDirectDeliver && !directDeliver && direct && System.currentTimeMillis() - lastDirectDeliveryCheck > CHECK_QUEUE_SIZE_PERIOD) { lastDirectDeliveryCheck = System.currentTimeMillis(); if (intermediateMessageReferences.isEmpty() && messageReferences.isEmpty() && !pageIterator.hasNext() && !pageSubscription.isPaging()) { if (internalFlushExecutor(500, false) && flushDeliveriesInTransit()) { directDeliver = supportsDirectDeliver; } } } } if (direct && supportsDirectDeliver && directDeliver && deliveriesInTransit.getCount() == 0 && deliverDirect(ref)) { return; } queueMemorySize.addAndGet(ref.getMessageMemoryEstimate()); intermediateMessageReferences.add(ref); directDeliver = false; deliverAsync(); } finally { leaveCritical(CRITICAL_PATH_ADD_TAIL); } }

Target:
public void addTail(final MessageReference ref, final boolean direct) { enterCritical(CRITICAL_PATH_ADD_TAIL); try { if (scheduleIfPossible(ref)) { return; } if (supportsDirectDeliver && !directDeliver && direct && System.currentTimeMillis() - lastDirectDeliveryCheck > CHECK_QUEUE_SIZE_PERIOD) { if (logger.isTraceEnabled()) { logger.trace("Checking to re-enable direct deliver on queue " + this.getName()); } lastDirectDeliveryCheck = System.currentTimeMillis(); synchronized (directDeliveryGuard) { if (deliveriesInTransit.getCount() == 0 && getExecutor().isFlushed() && intermediateMessageReferences.isEmpty() && messageReferences.isEmpty() && !pageIterator.hasNext() && !pageSubscription.isPaging()) { directDeliver = supportsDirectDeliver; if (logger.isTraceEnabled()) { logger.trace("Setting direct deliverer to " + supportsDirectDeliver); } } else { if (logger.isTraceEnabled()) { logger.trace("Couldn't set direct deliver back"); } } } } if (direct && supportsDirectDeliver && directDeliver && deliveriesInTransit.getCount() == 0 && deliverDirect(ref)) { return; } queueMemorySize.addAndGet(ref.getMessageMemoryEstimate()); intermediateMessageReferences.add(ref); directDeliver = false; deliverAsync(); } finally { leaveCritical(CRITICAL_PATH_ADD_TAIL); } }
Source:
private TokenBackedBasicResultsPage<RowResult<Set<Long>>, Token> getTimestampsPageInternal( DbReadTable table, RangeRequest range, long timestamp, long batchSize, Token token) { Set<byte[]> rows = Sets.newHashSet(); int maxRows = getMaxRowsFromBatchHint(range.getBatchHint()); try (ClosableIterator<AgnosticLightResultRow> rangeResults = table.getRange(range, timestamp, maxRows)) { while (rows.size() < maxRows && rangeResults.hasNext()) { byte[] rowName = rangeResults.next().getBlob(ROW); if (rowName != null) { rows.add(rowName); } } if (rows.isEmpty()) { return SimpleTokenBackedResultsPage.create(null, ImmutableList.<RowResult<Set<Long>>>of(), false); } } ColumnSelection cols = range.getColumnNames().isEmpty() ? ColumnSelection.all() : ColumnSelection.create(range.getColumnNames()); ResultWithToken result = getTimestampsByCell(table, rows, cols, timestamp, batchSize, range.isReverse(), token); NavigableMap<byte[], SortedMap<byte[], Set<Long>>> cellsByRow = Cells.breakCellsUpByRow(Multimaps.asMap(result.entries)); if (range.isReverse()) { cellsByRow = cellsByRow.descendingMap(); } List<RowResult<Set<Long>>> finalResults = new ArrayList<>(); cellsByRow.entrySet().forEach(entry -> finalResults.add(RowResult.create(entry.getKey(), entry.getValue()))); return SimpleTokenBackedResultsPage.create(result.token, finalResults, result.mayHaveMoreResults); }

Target:
private TokenBackedBasicResultsPage<RowResult<Set<Long>>, Token> getTimestampsPageInternal( DbReadTable table, RangeRequest range, long timestamp, long batchSize, Token token) { Set<byte[]> rows = Sets.newHashSet(); int maxRows = getMaxRowsFromBatchHint(range.getBatchHint()); try (ClosableIterator<AgnosticLightResultRow> rangeResults = table.getRange(range, timestamp, maxRows)) { while (rows.size() < maxRows && rangeResults.hasNext()) { byte[] rowName = rangeResults.next().getBytes(ROW); if (rowName != null) { rows.add(rowName); } } if (rows.isEmpty()) { return SimpleTokenBackedResultsPage.create(null, ImmutableList.<RowResult<Set<Long>>>of(), false); } } ColumnSelection cols = range.getColumnNames().isEmpty() ? ColumnSelection.all() : ColumnSelection.create(range.getColumnNames()); TimestampsByCellResultWithToken result = getTimestampsByCell(table, rows, cols, timestamp, batchSize, range.isReverse(), token); NavigableMap<byte[], SortedMap<byte[], Set<Long>>> cellsByRow = Cells.breakCellsUpByRow(Multimaps.asMap(result.entries)); if (range.isReverse()) { cellsByRow = cellsByRow.descendingMap(); } List<RowResult<Set<Long>>> finalResults = cellsByRow.entrySet().stream() .map(entry -> RowResult.create(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); return SimpleTokenBackedResultsPage.create(result.getToken(), finalResults, result.mayHaveMoreResults()); }
Source:
public @Nullable HostThread resolve(ITmfEvent event) { Object cpuObj = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpuObj == null) { return null; } Integer cpu = (Integer) cpuObj; Iterable<KernelAnalysis> kernelModules = TmfTraceUtils .getAnalysisModulesOfClass(event.getTrace(), KernelAnalysis.class); for (KernelAnalysis analysis : kernelModules) { if (analysis == null) { continue; } Integer tid = KernelThreadInformationProvider.getThreadOnCpu( analysis, cpu, event.getTimestamp().getValue()); if (tid != null) { return new HostThread(event.getTrace().getHostId(), tid); } } return null; }

Target:
public @Nullable Integer resolve(ITmfEvent event) { Object cpuObj = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpuObj == null) { return null; } Integer cpu = (Integer) cpuObj; Iterable<KernelAnalysis> kernelModules = TmfTraceUtils .getAnalysisModulesOfClass(event.getTrace(), KernelAnalysis.class); for (KernelAnalysis analysis : kernelModules) { if (analysis == null) { continue; } Integer tid = KernelThreadInformationProvider.getThreadOnCpu( analysis, cpu, event.getTimestamp().getValue()); if (tid != null) { return tid; } } return null; }