auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap, CurrentStateOutput currentStateOutput) { Map<String, Resource> restOfResources = new HashMap<>(resourceMap); WorkflowControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); BestPossibleStateOutput output = new BestPossibleStateOutput(); final List<String> failureResources = new ArrayList<>(); scheduleWorkflows(resourceMap, cache, restOfResources, failureResources, currentStateOutput, output); for (String jobName : cache.getTaskDataCache().getDispatchedJobs()) { updateResourceMap(jobName, resourceMap, output.getPartitionStateMap(jobName).partitionSet()); restOfResources.remove(jobName); } Map<String, Resource> taskResourcesToDrop = event.getAttribute(AttributeName.TASK_RESOURCES_TO_DROP.name()); for (String resourceName : taskResourcesToDrop.keySet()) { ResourceAssignment emptyAssignment = _workflowDispatcher.buildEmptyAssignment(resourceName, currentStateOutput); _workflowDispatcher.updateBestPossibleStateOutput(resourceName, emptyAssignment, output); } return output; }

Target:
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap, CurrentStateOutput currentStateOutput) { Map<String, Resource> restOfResources = new HashMap<>(resourceMap); WorkflowControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); BestPossibleStateOutput output = new BestPossibleStateOutput(); final List<String> failureResources = new ArrayList<>(); scheduleWorkflows(resourceMap, cache, restOfResources, failureResources, currentStateOutput, output); for (String jobName : cache.getTaskDataCache().getDispatchedJobs()) { updateResourceMap(jobName, resourceMap, output.getPartitionStateMap(jobName).partitionSet()); restOfResources.remove(jobName); } for (String resourceName : restOfResources.keySet()) { _workflowDispatcher.processJobForDrop(resourceName, currentStateOutput, output); } return output; }
Source:
protected void tearDown() throws Exception { setErrorCatchActive(false); if (isOutlineViewOpened) { designerViews.openOutlineView(); } if (isPropertiesViewOpened) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { PlatformUI.getWorkbench().getWorkbenchWindows()[0].getPages()[0].showView(PROPERTIES_VIEW_ID); } catch (PartInitException e) { fail("Could not reopen property view during teardown : " + e.getMessage()); } } }); } SWTBotUtils.waitAllUiEvents(); super.tearDown(); }

Target:
protected void tearDown() throws Exception { if (isOutlineViewOpened) { designerViews.openOutlineView(); } if (isPropertiesViewOpened) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { PlatformUI.getWorkbench().getWorkbenchWindows()[0].getPages()[0].showView(PROPERTIES_VIEW_ID); } catch (PartInitException e) { fail("Could not reopen property view during teardown : " + e.getMessage()); } } }); } SWTBotUtils.waitAllUiEvents(); super.tearDown(); }
Source:
public static ChallengeDto map(Challenge challenge){ if (challenge == null){ return null; } ChallengeDto dto = new ChallengeDto(challenge); dto.setInvitedUsers(challenge.getInvitedUsers().stream().map(UserShowDto::new).collect(Collectors.toList())); return dto; }

Target:
public static ChallengeDto map(Challenge challenge){ if (challenge == null){ return null; } ChallengeDto dto = new ChallengeDto(challenge); if (challenge.getInvitedUsers() != null){ dto.setInvitedUsers(challenge.getInvitedUsers().stream().map(UserShowDto::new).collect(Collectors.toList())); } return dto; }
Source:
public void writeTo(View t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException { final Timer.Context context = metricRegistry.timer(name(t.getClass(), "rendering")).time(); try { for (ViewRenderer renderer : renderers) { if (renderer.isRenderable(t)) { renderer.render(t, detectLocale(headers), entityStream); return; } } throw new ViewRenderException("Unable to find a renderer for " + t.getTemplateName()); } catch (Throwable e) { logger.debug("Template Error", e); throw new WebApplicationException(Response.serverError() .type(MediaType.TEXT_HTML_TYPE) .entity(TEMPLATE_ERROR_MSG) .build()); } finally { context.stop(); } }

Target:
public void writeTo(View t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException { final Timer.Context context = metricRegistry.timer(name(t.getClass(), "rendering")).time(); try { for (ViewRenderer renderer : renderers) { if (renderer.isRenderable(t)) { renderer.render(t, detectLocale(headers), entityStream); return; } } throw new ViewRenderException("Unable to find a renderer for " + t.getTemplateName()); } catch (Exception e) { logger.debug("Template Error", e); throw new WebApplicationException(Response.serverError() .type(MediaType.TEXT_HTML_TYPE) .entity(TEMPLATE_ERROR_MSG) .build()); } finally { context.stop(); } }
Source:
public void reloadServer() throws Exception { ManagementClient mgmtClient = getManagementClient(); long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); mgmtClient.executeForResult(Operations.createOperation(RELOAD, new ModelNode().setEmptyList())); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { controller.getClient().isServerInRunningState(); } catch (RuntimeException ex) { ex.printStackTrace(); break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); Thread.sleep(2 * FREQUENCY); Assert.assertTrue(mgmtClient.isServerInRunningState()); }

Target:
public void reloadServer() throws Exception { ManagementClient mgmtClient = getManagementClient(); long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); mgmtClient.executeForResult(Operations.createOperation(RELOAD, new ModelNode().setEmptyList())); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { controller.getClient().isServerInRunningState(); } catch (RuntimeException ex) { break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); Thread.sleep(2 * FREQUENCY); Assert.assertTrue(mgmtClient.isServerInRunningState()); }
Source:
public Set<String> call() { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> filtered = filterUntrackedFolders( status.getUntracked(), status.getUntrackedFolders()); for (String file : filtered) { if (paths.isEmpty() || paths.contains(file)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), file)); files.add(file); } } if (directories) for (String dir : status.getUntrackedFolders()) if (paths.isEmpty() || paths.contains(dir)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); files.add(dir + "/"); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }

Target:
public Set<String> call() { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> filtered = filterUntrackedFolders( status.getUntracked(), status.getUntrackedFolders()); for (String file : filtered) if (paths.isEmpty() || paths.contains(file)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), file)); files.add(file); } if (directories) for (String dir : status.getUntrackedFolders()) if (paths.isEmpty() || paths.contains(dir)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); files.add(dir + "/"); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }
Source:
public void setUp() { finderUseStartPort = new PortFinder(1200, ImmutableList.of()); for (int i = 1024; i <= 0xFFFF; ++i) { try { new ServerSocket(i).close(); new ServerSocket(i + 1).close(); finderUseCandidatePorts = new PortFinder(1200, ImmutableList.of(i, i + 1)); break; } catch (Exception e) { } } }

Target:
public void setUp() { PortFinder finder1 = EasyMock.createMockBuilder(PortFinder.class) .withConstructor(1200, 1201, ImmutableList.of()) .addMockedMethod("canBind") .createMock(); PortFinder finder2 = EasyMock.createMockBuilder(PortFinder.class) .withConstructor(1024, 1025, ImmutableList.of(1200, 1201)) .addMockedMethod("canBind") .createMock(); finders.add(finder1); finders.add(finder2); }
Source:
IngestJob(Content dataSource, List<AbstractFile> files, IngestJobSettings settings) { this.id = IngestJob.nextId.getAndIncrement(); this.ingestJobPipelines = new ConcurrentHashMap<>(); this.settings = settings; this.files = files; this.dataSources.add(dataSource); this.ingestMode = Mode.BATCH; incompleteJobsCount = new AtomicInteger(1); cancellationReason = CancellationReason.NOT_CANCELLED; }

Target:
IngestJob(Content dataSource, List<AbstractFile> files, IngestJobSettings settings) { this(Arrays.asList(dataSource), settings); this.files.addAll(files); }
Source:
public Server(int port, int blocksize, int numberOfCacheBlocks) { this(port, blocksize, numberOfCacheBlocks, !Boolean.parseBoolean(System.getProperty("BUFFERSERVER.BACK_PRESSURE_DISABLE"))); }

Target:
public Server(int port, int blocksize, int numberOfCacheBlocks) { this.port = port; this.blockSize = blocksize; this.numberOfCacheBlocks = numberOfCacheBlocks; serverHelperExecutor = Executors.newSingleThreadExecutor(new NameableThreadFactory("ServerHelper")); final ArrayBlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(numberOfCacheBlocks); final NameableThreadFactory threadFactory = new NameableThreadFactory("StorageHelper"); storageHelperExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, workQueue, threadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); }
Source:
public ColumnEncoding getColumnEncoding(int sequence) { if (sequence == 0) { return this; } checkState( additionalSequenceEncodings.isPresent(), "Got non-zero sequence: " + sequence + ", but there are no additional sequence encodings, encoding: " + this); return additionalSequenceEncodings.get().get(sequence - 1).getValueEncoding(); }

Target:
public ColumnEncoding getColumnEncoding(int sequence) { if (sequence == 0) { return this; } checkState( additionalSequenceEncodings.isPresent(), "Got non-zero sequence: %d, but there are no additional sequence encodings: %s", sequence, this); return additionalSequenceEncodings.get().get(sequence - 1).getValueEncoding(); }
Source:
public static int calculateRequiredMinimumNumberOfNodes(AdvancedCache<?, ?> cache) { Configuration config = cache.getCacheConfiguration(); ClusteringConfiguration clusteringConfiguration = config.clustering(); CacheMode mode = clusteringConfiguration.cacheMode(); if (mode.isReplicated() || !mode.isClustered()) { return 1; } CacheTopology cacheTopology = cache.getDistributionManager().getCacheTopology(); if (mode.isInvalidation()) { return cacheTopology.getMembers().size(); } int numMembers = cacheTopology.getMembers().size(); int numOwners = clusteringConfiguration.hash().numOwners(); int minNodes; if (mode.isScattered()) { minNodes = numMembers - 1; } else { minNodes = numMembers - numOwners + 1; } long maxSize = config.memory().size(); int evictionRestrictedNodes; if (maxSize > 0) { DataContainer dataContainer = cache.getDataContainer(); long totalData = dataContainer.evictionSize() * numOwners; long capacity = dataContainer.capacity(); evictionRestrictedNodes = (int) (totalData / capacity) + (totalData % capacity != 0 ? 1 : 0); } else { evictionRestrictedNodes = 1; } return Math.max(evictionRestrictedNodes, minNodes); }

Target:
public static int calculateRequiredMinimumNumberOfNodes(AdvancedCache<?, ?> cache) { Configuration config = cache.getCacheConfiguration(); ClusteringConfiguration clusteringConfiguration = config.clustering(); CacheMode mode = clusteringConfiguration.cacheMode(); if (mode.isReplicated() || !mode.isClustered()) { return 1; } CacheTopology cacheTopology = cache.getDistributionManager().getCacheTopology(); if (mode.isInvalidation()) { return cacheTopology.getMembers().size(); } int numMembers = cacheTopology.getMembers().size(); int numOwners = mode.isScattered() ? 2 : clusteringConfiguration.hash().numOwners(); int minNodes = numMembers - numOwners + 1; long maxSize = config.memory().size(); int evictionRestrictedNodes; if (maxSize > 0) { DataContainer dataContainer = cache.getDataContainer(); long totalData = dataContainer.evictionSize() * numOwners; long capacity = dataContainer.capacity(); evictionRestrictedNodes = (int) (totalData / capacity) + (totalData % capacity != 0 ? 1 : 0); } else { evictionRestrictedNodes = 1; } return Math.max(evictionRestrictedNodes, minNodes); }
Source:
private void rollback(Transaction txn, Exception cause) throws Exception { try { txn.rollback(); } catch (Exception e) { } finally { throw cause; } }

Target:
private void rollback(Transaction txn, Exception cause) throws Exception { try { txn.rollback(); } catch (Exception e) { LOGGER.debug(e, "Error while rolling back transaction " + txn); } finally { throw cause; } }
Source:
public void end(boolean interrupted) { LogKitten.d("MotorControl interrupted"); }

Target:
public void end(boolean interrupted) { if (interrupted) { LogKitten.d("MotorControl interrupted"); } }
Source:
public HttpRequest filter(HttpRequest request) throws HttpException { checkNotNull(authToken.identity, "credential returned null"); return request.toBuilder().replaceHeader(AuthHeaders.AUTH_TOKEN, TokenBased()).build(); }

Target:
public HttpRequest filter(HttpRequest request) throws HttpException { return request.toBuilder().replaceHeader(AuthHeaders.AUTH_TOKEN, authToken.identity).build(); }
Source:
public int serialize(ByteBuffer bb) { int start = bb.position(); if (!cachedFlowStateEthernetHeader.isPresent()) { putFlowStateEthernetHeader(); } bb.put(cachedFlowStateEthernetHeader.get()); final ElasticData elasticData = getCore(); if (elasticData.getLength() > 0) { putElasticData(bb, start, elasticData); } return FLOW_STATE_ETHERNET_OVERHEAD + getElasticDataLength(); }

Target:
public int serialize(ByteBuffer bb) { int start = bb.position(); if (cachedFlowStateEthernetHeader == null) { putFlowStateEthernetHeader(); } bb.put(cachedFlowStateEthernetHeader); final ElasticData elasticData = getCore(); if (elasticData.getLength() > 0) { putElasticData(bb, start, elasticData); } return FLOW_STATE_ETHERNET_OVERHEAD + getElasticDataLength(); }
Source:
public void close() throws SQLException { if (closed.compareAndSet(false, true)) { client.close(); } }

Target:
public void close() throws SQLException { closed.set(true); client.close(); }
Source:
private CompletableFuture<Layout> fetchLayout(List<String> layoutServers) { return CompletableFuture.supplyAsync(() -> { List<String> layoutServersCopy = new ArrayList<>(layoutServers); parameters.getBeforeRpcHandler().run(); int systemDownTriggerCounter = 0; while (true) { try { CompletableFuture<Layout> layoutFuture = getLatestLayout(layoutServersCopy); Layout l = layoutFuture.get(); if (latestLayout != null && latestLayout.getEpoch() > l.getEpoch()) { log.warn("fetchLayout: Received a layout with epoch " + " smaller than latestLayout epoch {}, " + "discarded.", l.getEpoch(), latestLayout.getEpoch()); continue; } checkClusterId(l); layout = layoutFuture; latestLayout = l; pruneRemovedRouters(l); return l; } catch (Exception e) { log.warn("Tried to get layout but failed with exception:", e); } log.warn("Couldn't connect to any up-to-date layout servers, retrying in {}, " + "Retried times, systemDownHandlerTriggerLimit = {}", parameters.connectionRetryRate, systemDownTriggerCounter, parameters.getSystemDownHandlerTriggerLimit()); if (++systemDownTriggerCounter >= parameters.getSystemDownHandlerTriggerLimit()) { log.info("fetchLayout: Invoking the systemDownHandler."); parameters.getSystemDownHandler().run(); } Sleep.sleepUninterruptibly(parameters.connectionRetryRate); if (isShutdown) { return null; } } }); }

Target:
private CompletableFuture<Layout> fetchLayout(List<String> layoutServers) { return CompletableFuture.supplyAsync(() -> { List<String> layoutServersCopy = new ArrayList<>(layoutServers); parameters.getBeforeRpcHandler().run(); int systemDownTriggerCounter = 0; while (true) { if (isShutdown) { return null; } try { Layout l = getLatestLayout(layoutServersCopy); if (latestLayout != null && latestLayout.getEpoch() > l.getEpoch()) { log.warn("fetchLayout: Received a layout with epoch " + " smaller than latestLayout epoch {}, " + "discarded.", l.getEpoch(), latestLayout.getEpoch()); } else { checkClusterId(l); latestLayout = l; CompletableFuture<Layout> completedFuture = new CompletableFuture<Layout>(); completedFuture.complete(latestLayout); layout = completedFuture; pruneRemovedRouters(l); return l; } } catch (Exception e) { log.warn("Tried to get layout but failed with exception:", e); } log.warn("Couldn't connect to any up-to-date layout servers, retrying in {}, " + "Retried times, systemDownHandlerTriggerLimit = {}", parameters.connectionRetryRate, systemDownTriggerCounter, parameters.getSystemDownHandlerTriggerLimit()); if (++systemDownTriggerCounter >= parameters.getSystemDownHandlerTriggerLimit()) { log.info("fetchLayout: Invoking the systemDownHandler."); parameters.getSystemDownHandler().run(); } Sleep.sleepUninterruptibly(parameters.connectionRetryRate); } }); }
Source:
private JcrAccessControlList findAccessList( String absPath, boolean searchParents ) throws PathNotFoundException, RepositoryException { CachedNode startingNode = session.cachedNode(session.pathFactory().create(absPath), false); SessionCache sessionCache = session.cache(); Map<String, Set<String>> permissions = startingNode.getPermissions(sessionCache); CachedNode node = startingNode; if ((permissions == null || permissions.isEmpty()) && searchParents) { while (permissions == null || permissions.isEmpty()) { NodeKey parentKey = node.getParentKey(sessionCache); if (parentKey == null) { break; } node = sessionCache.getNode(parentKey); if (node == null) { break; } permissions = node.getPermissions(sessionCache); } } if (permissions == null || node == null) { return null; } String aclPath = startingNode.getKey().equals(node.getKey()) ? absPath : node.getPath(sessionCache).getString(); JcrAccessControlList acl = new JcrAccessControlList(aclPath); for (String principalName : permissions.keySet()) { Set<String> privileges = permissions.get(principalName); acl.addAccessControlEntry(principal(principalName), privileges(privileges)); } return acl; }

Target:
private JcrAccessControlList findAccessList( String absPath, boolean searchParents ) throws PathNotFoundException, RepositoryException { CachedNode startingNode = session.cachedNode(session.pathFactory().create(absPath), false); SessionCache sessionCache = session.cache(); Map<String, Set<String>> permissions = startingNode.getPermissions(sessionCache); CachedNode node = startingNode; if (searchParents) { while (permissions == null || permissions.isEmpty()) { NodeKey parentKey = node.getParentKey(sessionCache); if (parentKey == null) { break; } node = sessionCache.getNode(parentKey); if (node == null) { break; } permissions = node.getPermissions(sessionCache); } } if (permissions == null || node == null) { return null; } String aclPath = startingNode.getKey().equals(node.getKey()) ? absPath : node.getPath(sessionCache).getString(); JcrAccessControlList acl = new JcrAccessControlList(aclPath); for (String principalName : permissions.keySet()) { Set<String> privileges = permissions.get(principalName); acl.addAccessControlEntry(principal(principalName), privileges(privileges)); } return acl; }
Source:
protected AmqpSession createSession(String sessionName, Session session, SessionHandler handler) { return new ReactorSession(session, handler, sessionName, reactorProvider, handlerProvider, getClaimsBasedSecurityNode(), tokenManagerProvider, messageSerializer, connectionOptions.getRetry().getTryTimeout(), RetryUtil.getRetryPolicy(connectionOptions.getRetry())); }

Target:
protected AmqpSession createSession(String sessionName, Session session, SessionHandler handler) { return new ReactorSession(session, handler, sessionName, reactorProvider, handlerProvider, getClaimsBasedSecurityNode(), tokenManagerProvider, messageSerializer, connectionOptions.getRetry().getTryTimeout(), retryPolicy); }
Source:
@Override protected Application provideApplication() { return new GuiceApplicationBuilder().build(); }

Target:
protected Application provideApplication() { return new GuiceApplicationBuilder().build(); }
Source:
public void edit(final VolumeRebalanceStatusModel object) { driver.edit(object); rebalanceHostsTable.asEditor().edit(object.getRebalanceSessions()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { PropertyChangedEventArgs e = (PropertyChangedEventArgs) args; if (e.PropertyName.equals("STATUS_UPDATED")) { status.setVisible(object.isStatusAvailable()); } else if (e.PropertyName.equals("STOP_TIME_UPDATED")) { stopTimePanel.setVisible(object.isStopTimeVisible()); status.setVisible(object.isStatusAvailable()); } } }); }

Target:
public void edit(final VolumeRebalanceStatusModel object) { driver.edit(object); rebalanceHostsTable.asEditor().edit(object.getRebalanceSessions()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { status.setVisible(object.isStatusAvailable()); stopTimePanel.setVisible(object.isStopTimeVisible()); } }); }
Source:
private void prepareGuestAgentNetworkDevicesForUpdate() { if (vdsmVm != null) { VmDynamic vdsmVmDynamic = vdsmVm.getVmDynamic(); if (vdsmVmDynamic != null) { if (dbVm != null) { List<VmGuestAgentInterface> vmGuestAgentInterfaces = vdsmVm.getVmGuestAgentInterfaces(); int guestAgentNicHash = vmGuestAgentInterfaces == null ? 0 : vmGuestAgentInterfaces.hashCode(); if (guestAgentNicHash != vdsmVmDynamic.getGuestAgentNicsHash()) { if (vmDynamicToSave == null) { saveDynamic(dbVm.getDynamicData()); } updateGuestAgentInterfacesChanges( vmDynamicToSave, vmGuestAgentInterfaces, guestAgentNicHash); vmsMonitoring.addVmGuestAgentNics(dbVm.getId(), vdsmVm.getVmGuestAgentInterfaces()); } } } } }

Target:
private void prepareGuestAgentNetworkDevicesForUpdate() { if (vdsmVm != null) { VmDynamic vdsmVmDynamic = vdsmVm.getVmDynamic(); if (vdsmVmDynamic != null) { if (dbVm != null) { List<VmGuestAgentInterface> vmGuestAgentInterfaces = vdsmVm.getVmGuestAgentInterfaces(); int guestAgentNicHash = vmGuestAgentInterfaces == null ? 0 : vmGuestAgentInterfaces.hashCode(); if (guestAgentNicHash != vdsmVmDynamic.getGuestAgentNicsHash()) { if (vmDynamicToSave == null) { saveDynamic(dbVm.getDynamicData()); } updateGuestAgentInterfacesChanges( vmDynamicToSave, vmGuestAgentInterfaces, guestAgentNicHash); } } } } }
Source:
public void createTeam(final Team team, final Type type) { final Map<String, AttributeValue> item = new HashMap<>(); item.put("type", new AttributeValue().withS(type.toString())); item.put("name", new AttributeValue().withS(team.name)); item.put("members", new AttributeValue().withSS(team.ids)); final PutItemRequest putItemRequest = new PutItemRequest(); putItemRequest.withTableName(tableName) .withItem(item); dynamoDB.putItem(putItemRequest); }

Target:
public void createTeam(final Team team, final Type type) { final Map<String, AttributeValue> item = new HashMap<>(); item.put(TYPE_ATTRIBUTE_NAME, new AttributeValue().withS(type.toString())); item.put(NAME_ATTRIBUTE_NAME, new AttributeValue().withS(team.name)); item.put(MEMBERS_ATTRIBUTE_NAME, new AttributeValue().withSS(team.ids)); final PutItemRequest putItemRequest = new PutItemRequest(); putItemRequest.withTableName(tableName) .withItem(item); dynamoDB.putItem(putItemRequest); }
Source:
public void testGeneratedConfigIni() { try { ILaunchConfiguration[] launchCfgs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(); Arrays.asList(launchCfgs).forEach(c -> { try { if (c.getFile().getName().toString().equalsIgnoreCase(GENERATED_CFGINI_LAUNCH)) { bundleMap = BundleLauncherHelper.getMergedBundleMap(c, false); bundleMap.keySet().stream().filter(b -> { IPluginBase pmb = b.getPluginBase(); String sl = bundleMap.get(pmb); if (sl == null || sl.equalsIgnoreCase("default:default")) { return false; } else { return true; } }).forEach(x -> System.out.println(x.getPluginBase().getId())); assertStartInfo("-1:true", "org.eclipse.osgi"); assertStartInfo("1:true", "org.eclipse.equinox.simpleconfigurator"); assertStartInfo("1:true", "org.apache.felix.scr"); assertStartInfo("2:true", "org.eclipse.equinox.common"); assertStartInfo("default:default", "org.eclipse.equinox.event"); assertStartInfo("default:default", "org.eclipse.equinox.registry"); } } catch (CoreException e) { assumeNoException(e); } }); } catch (Exception e) { assumeNoException(e); } }

Target:
public void testGeneratedConfigIni() { try { ILaunchConfiguration[] launchCfgs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(); Arrays.asList(launchCfgs).forEach(c -> { try { if (c.getFile().getName().toString().equalsIgnoreCase(GENERATED_CFGINI_LAUNCH)) { bundleMap = BundleLauncherHelper.getMergedBundleMap(c, false); assertStartInfo("-1:true", "org.eclipse.osgi"); assertStartInfo("1:true", "org.eclipse.equinox.simpleconfigurator"); assertStartInfo("1:true", "org.apache.felix.scr"); assertStartInfo("2:true", "org.eclipse.equinox.common"); assertStartInfo("default:default", "org.eclipse.equinox.event"); assertStartInfo("default:default", "org.eclipse.equinox.registry"); } } catch (CoreException e) { assumeNoException(e); } }); } catch (Exception e) { assumeNoException(e); } }
Source:
private void startDefaultDbServiceInstance() { try { if (configurationService.getComponentConfiguration(H2DbService.DEFAULT_INSTANCE_PID) == null) { logger.info("Default H2DbService instance configuration not found, creating new instance..."); configurationService.createFactoryConfiguration(H2_DB_SERVICE_FACTORY_PID, H2DbService.DEFAULT_INSTANCE_PID, null, true); } else { logger.info("Default H2DbService instance configuration found"); } } catch (KuraException e) { throw new ComponentException(e); } }

Target:
private void startDefaultDbServiceInstance() { try { if (configurationService.getComponentConfiguration(H2DbService.DEFAULT_INSTANCE_PID) == null) { logger.info("Default H2DbService instance configuration not found, creating new instance..."); configurationService.createFactoryConfiguration(H2_DB_SERVICE_FACTORY_PID, H2DbService.DEFAULT_INSTANCE_PID, null, true); } else { logger.info("Default H2DbService instance configuration found"); } } catch (KuraException e) { logger.error("Failed to retrieve or create default H2DbService factory configuration", e); } }
Source:
private static List<Method> getRelevantMethods(Class<?> clz) { List<Method> methods = new ArrayList<>(); if (methodCache.containsKey(clz)) { return methodCache.get(clz); } for (Method method : clz.getMethods()) { if (method.getName().startsWith("get")) { if (method.getReturnType().getPackage() == BaseResource.class.getPackage()) { methods.add(method); } } } methodCache.put(clz, methods); return methods; }

Target:
private static List<Method> getRelevantMethods(Class<?> clz) { List<Method> methods = methodCache.get(clz); if (methods == null) { methods = new ArrayList<Method>(); for (Method method : clz.getMethods()) { if (method.getName().startsWith("get")) { if (method.getReturnType().getPackage() == BaseResource.class.getPackage()) { methods.add(method); } } } methodCache.put(clz, methods); } return methods; }
Source:
public AbstractTmfStateProvider(ITmfTrace trace, String id, int size, int chunk) { fTrace = trace; fEventsQueue = new BufferedBlockingQueue<>(size, chunk); fStateSystemAssigned = false; fSafeTime = trace.getStartTime().toNanos() - 1; fEventHandlerThread = new Thread(new EventProcessor(), id + " Event Handler"); }

Target:
protected AbstractTmfStateProvider(ITmfTrace trace, String id, int size, int chunk) { fTrace = trace; fEventsQueue = new BufferedBlockingQueue<>(size, chunk); fStateSystemAssigned = false; fSafeTime = trace.getStartTime().toNanos() - 1; fEventHandlerThread = new Thread(new EventProcessor(), id + " Event Handler"); }
Source:
public void testSetIdsListToSearchCriteria(){ mgr.setIdsListToSearchCriteria(sc, idsList); Mockito.verify(sc, times(1)).setParameters(Mockito.same("idIN"), Mockito.same(id1), Mockito.same(id2)); }

Target:
public void testSetIdsListToSearchCriteria(){ mgr.setIdsListToSearchCriteria(sc, idsList); Mockito.verify(sc).setParameters(Mockito.same("idIN"), Mockito.same(id1), Mockito.same(id2)); }
Source:
protected HRegion openHRegion(final CancelableProgressable reporter) throws IOException { try { TableDescriptorChecker.checkCompression(htableDescriptor); LOG.debug("checking encryption for " + this.getRegionInfo().getEncodedName()); TableDescriptorChecker.checkEncryption(conf, htableDescriptor); LOG.debug("checking classloading for " + this.getRegionInfo().getEncodedName()); TableDescriptorChecker.checkClassLoading(conf, htableDescriptor); this.openSeqNum = initialize(reporter); this.mvcc.advanceTo(openSeqNum); if (wal != null && getRegionServerServices() != null && RegionReplicaUtil.isDefaultReplica(getRegionInfo())) { writeRegionOpenMarker(wal, openSeqNum); } } catch (Throwable t) { try { this.close(); } catch (IOException e) { LOG.error("close region exception in openHRegion ", e); } throw t; } return this; }

Target:
protected HRegion openHRegion(final CancelableProgressable reporter) throws IOException { try { TableDescriptorChecker.checkCompression(htableDescriptor); LOG.debug("checking encryption for " + this.getRegionInfo().getEncodedName()); TableDescriptorChecker.checkEncryption(conf, htableDescriptor); LOG.debug("checking classloading for " + this.getRegionInfo().getEncodedName()); TableDescriptorChecker.checkClassLoading(conf, htableDescriptor); this.openSeqNum = initialize(reporter); this.mvcc.advanceTo(openSeqNum); if (wal != null && getRegionServerServices() != null && RegionReplicaUtil.isDefaultReplica(getRegionInfo())) { writeRegionOpenMarker(wal, openSeqNum); } } catch (Throwable t) { try { this.close(); } catch (Throwable e) { LOG.warn("Open region: failed. Try close region but got exception ", this.getRegionInfo(), e); } throw t; } return this; }
Source:
public void testBug1429ParseError() throws Exception { String c = IOUtils.toString(this.getClass().getResourceAsStream("Bug1429.java"), StandardCharsets.UTF_8); parseJava18(c); }

Target:
public void testBug1429ParseError() { String c = readAsString("Bug1429.java"); parseJava18(c); }
Source:
boolean equals(ConfigurationSetting o1, ConfigurationSetting o2) { if (o1 == o2) { return true; } if (!Objects.equals(o1.getKey(), o2.getKey()) || !Objects.equals(o1.getLabel(), o2.getLabel()) || !Objects.equals(o1.getValue(), o2.getValue()) || !Objects.equals(o1.getETag(), o2.getETag()) || !Objects.equals(o1.getLastModified(), o2.getLastModified()) || !Objects.equals(o1.isLocked(), o2.isLocked()) || !Objects.equals(o1.getContentType(), o2.getContentType()) || ImplUtils.isNullOrEmpty(o1.getTags()) != ImplUtils.isNullOrEmpty(o2.getTags())) { return false; } if (!ImplUtils.isNullOrEmpty(o1.getTags())) { return Objects.equals(o1.getTags(), o2.getTags()); } return true; }

Target:
static boolean equals(ConfigurationSetting o1, ConfigurationSetting o2) { if (o1 == o2) { return true; } if (!Objects.equals(o1.getKey(), o2.getKey()) || !Objects.equals(o1.getLabel(), o2.getLabel()) || !Objects.equals(o1.getValue(), o2.getValue()) || !Objects.equals(o1.getETag(), o2.getETag()) || !Objects.equals(o1.getLastModified(), o2.getLastModified()) || !Objects.equals(o1.isLocked(), o2.isLocked()) || !Objects.equals(o1.getContentType(), o2.getContentType()) || ImplUtils.isNullOrEmpty(o1.getTags()) != ImplUtils.isNullOrEmpty(o2.getTags())) { return false; } if (!ImplUtils.isNullOrEmpty(o1.getTags())) { return Objects.equals(o1.getTags(), o2.getTags()); } return true; }
Source:
public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); List<Integer> toHide = new ArrayList<Integer>(); MenuItem item = null; for (int i : toHide) { item = (MenuItem) menu.findItem(i); if (item != null) { item.setVisible(false); item.setEnabled(false); } } }

Target:
public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); if (!getFile().isShareByLink()) { MenuItem item = menu.findItem(R.id.action_unshare_file); item.setVisible(false); item.setEnabled(false); } }
Source:
public void getUserCardByIdShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.getUserCardById("foobar", new RetrofitPromise<Card>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards/%s", MOCK_URL, "foobar")); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); }

Target:
public void getUserCardByIdShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.getUserCardById("foobar", new RetrofitPromise<Card>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards/%s", MOCK_URL, "foobar")); }
Source:
public boolean isDone() { assert !holdsLock(lock); synchronized (lock) { switch (state) { case WAITING: { return false; } case CANCEL_REQ: case READY: case FAILED: case CANCELLED: case DONE: case CONSUMING: case DISCARDED: { return true; } default: throw new IllegalStateException(); } } }

Target:
boolean isDone() { assert !holdsLock(lock); synchronized (lock) { switch (state) { case WAITING: { return false; } case CANCEL_REQ: case READY: case FAILED: case CANCELLED: case DONE: case CONSUMING: case DISCARDED: { return true; } default: throw new IllegalStateException(); } } }
Source:
public ObjectProperty<ContainerDTO> selectedContainerProperty() { return selectedContainer; }

Target:
public ObjectProperty<ContainerDTO> selectedContainerProperty() { return this.selectedContainer; }
Source:
public void persist(ConfigItem<ConnectorDescription> config) throws PersistenceException, InvalidConfigurationException { LOGGER.debug("persisting ConnectorConfiguration"); Preconditions.checkArgument( supports((Class<? extends ConfigItem<?>>) config.getClass()), "Argument type not supported"); Preconditions.checkNotNull(config, "Config must not be null"); Preconditions.checkNotNull(config.getMetaData().get(Constants.CONNECTOR_PERSISTENT_ID), "No id set!"); Preconditions.checkNotNull(config.getContent(), "Invalid content"); List<ConnectorConfigurationJPAEntity> oldEntities = searchForMetadata(config .getMetaData()); if (oldEntities.size() > 1) { throw new PersistenceException( "Unexpected error: Found more than 1 object fitting the metadata!"); } ConnectorConfigurationJPAEntity entity = ConnectorConfigurationJPAEntity .generateFromConfigItem(config); if (oldEntities.size() == 1) { ConnectorConfigurationJPAEntity old = oldEntities.get(0); old.setConnectorType(entity.getConnectorType()); old.setDomainType(entity.getDomainType()); old.setAttributes(entity.getAttributes()); old.setProperties(entity.getProperties()); try { entityManager.merge(old); } catch (Exception ex) { throw new PersistenceException(ex); } LOGGER.info("updated ConnectorConfiguration"); } if (oldEntities.size() == 0) { try { entityManager.persist(entity); } catch (Exception ex) { throw new PersistenceException(ex); } LOGGER.info("inserted ConnectorConfiguration"); } }

Target:
public void persist(ConfigItem<ConnectorDescription> config) throws PersistenceException, InvalidConfigurationException { LOGGER.debug("persisting ConnectorConfiguration"); Preconditions.checkArgument( supports((Class<? extends ConfigItem<?>>) config.getClass()), "Argument type not supported"); Preconditions.checkNotNull(config, "Config must not be null"); Preconditions.checkNotNull(config.getMetaData().get(Constants.CONNECTOR_PERSISTENT_ID), "No id set!"); Preconditions.checkNotNull(config.getContent(), "Invalid content"); List<ConnectorConfigurationJPAEntity> oldEntities = searchForMetadata(config .getMetaData()); if (oldEntities.size() > 1) { throw new PersistenceException( "Unexpected error: Found more than 1 object fitting the metadata!"); } ConnectorConfigurationJPAEntity entity = ConnectorConfigurationJPAEntity .generateFromConfigItem(config); if (oldEntities.size() == 1) { ConnectorConfigurationJPAEntity old = oldEntities.get(0); old.setConnectorType(entity.getConnectorType()); old.setDomainType(entity.getDomainType()); old.setAttributes(entity.getAttributes()); old.setProperties(entity.getProperties()); try { synchronized (entityManager) { entityManager.merge(old); } } catch (Exception ex) { throw new PersistenceException(ex); } LOGGER.info("updated ConnectorConfiguration"); } else { try { synchronized (entityManager) { entityManager.persist(entity); } } catch (Exception ex) { throw new PersistenceException(ex); } LOGGER.info("inserted ConnectorConfiguration"); } }
Source:
public void queryTable() { TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder() .connectionString("connectionString") .buildAsyncClient(); QueryOptions queryOptions = new QueryOptions(); queryOptions.setFilter("TableName eq OfficeSupplies"); tableServiceAsyncClient.queryTables(queryOptions).subscribe(azureTable -> { logger.info(azureTable.getName()); }, error -> { logger.error("There was an error querying the service. Error: " + error); }); }

Target:
public void queryTable() { TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder() .connectionString("connectionString") .buildAsyncClient(); QueryOptions queryOptions = new QueryOptions().setFilter("TableName eq OfficeSupplies"); tableServiceAsyncClient.queryTables(queryOptions).subscribe(azureTable -> { System.out.println(azureTable.getName()); }, error -> { System.err.println("There was an error querying the service. Error: " + error); }); }
Source:
public PoolConfig() { maxIdleTimeMillis = DEFAULT_MAX_IDLE_TIME_MILLIS; idleConnCleanupTicker = Observable.interval(maxIdleTimeMillis, TimeUnit.MILLISECONDS); idleConnectionsHolder = new FIFOIdleConnectionsHolder<>(); limitDeterminationStrategy = UnboundedPoolLimitDeterminationStrategy.INSTANCE; }

Target:
public PoolConfig() { maxIdleTimeMillis = DEFAULT_MAX_IDLE_TIME_MILLIS; idleConnCleanupTicker = Observable.interval(maxIdleTimeMillis, maxIdleTimeMillis, TimeUnit.MILLISECONDS); idleConnectionsHolder = new FIFOIdleConnectionsHolder<>(); limitDeterminationStrategy = UnboundedPoolLimitDeterminationStrategy.INSTANCE; }
Source:
public synchronized void setMemoryPool(MemoryPool pool) { requireNonNull(pool, "pool is null"); if (memoryPool == pool) { return; } MemoryPool originalPool = memoryPool; memoryPool = pool; ListenableFuture<?> memoryFuture = pool.reserve(queryId, reserved); originalPool.free(queryId, reserved); ListenableFuture<?> revocableMemoryFuture = pool.reserveRevocable(queryId, revocableReserved); originalPool.freeRevocable(queryId, revocableReserved); Futures.allAsList(memoryFuture, revocableMemoryFuture).addListener(() -> { taskContexts.values().forEach(TaskContext::moreMemoryAvailable); }, directExecutor()); }

Target:
public synchronized void setMemoryPool(MemoryPool pool) { requireNonNull(pool, "pool is null"); if (memoryPool == pool) { return; } MemoryPool originalPool = memoryPool; long originalReserved = queryMemoryContext.getUserMemory(); long originalRevocableReserved = queryMemoryContext.getRevocableMemory(); memoryPool = pool; ListenableFuture<?> future = pool.reserve(queryId, originalReserved); originalPool.free(queryId, originalReserved); pool.reserveRevocable(queryId, originalRevocableReserved); originalPool.freeRevocable(queryId, originalRevocableReserved); future.addListener(() -> { taskContexts.values().forEach(TaskContext::moreMemoryAvailable); }, directExecutor()); }
Source:
void handleResponse(ResponseInfo responseInfo) { int correlationId = ((DeleteRequest) responseInfo.getRequest()).getCorrelationId(); DeleteOperation deleteOperation = correlationIdToDeleteOperation.remove(correlationId); if (deleteOperations.contains(deleteOperation)) { deleteOperation.handleResponse(responseInfo, false); if (deleteOperation.isOperationComplete() && deleteOperations.remove(deleteOperation)) { onComplete(deleteOperation); } } else { deleteOperation.handleResponse(responseInfo, true); } }

Target:
void handleResponse(ResponseInfo responseInfo) { int correlationId = ((DeleteRequest) responseInfo.getRequest()).getCorrelationId(); DeleteOperation deleteOperation = correlationIdToDeleteOperation.remove(correlationId); if (deleteOperations.contains(deleteOperation)) { deleteOperation.handleResponse(responseInfo); if (deleteOperation.isOperationComplete() && deleteOperations.remove(deleteOperation)) { onComplete(deleteOperation); } } else { routerMetrics.ignoredResponseCount.inc(); } }
Source:
private String formatDate(InvocationOnMock invocation) { Date date = invocation.getArgument(0); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HH-mm-ss-S"); return dateFormat.format(date); }

Target:
private String formatDate(InvocationOnMock invocation) { Date date = invocation.getArgument(0); return DATE_FORMAT.format(date); }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFLECTIVE_REFRACTIVE); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); setViewportToSizeOf(READ_ONLY_GBUFFER); displayResolutionDependentFBOs.swapReadWriteBuffers(); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFLECTIVE_REFRACTIVE); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); PerformanceMonitor.endActivity(); }
Source:
public int hashCode() { int hash = 0; hash = (hash * 397) ^ (this.regionsContacted == null ? 0 : this.regionsContacted.hashCode()); hash = (hash * 397) ^ (this.greaterThan1Kb == null ? 0 : this.greaterThan1Kb.hashCode()); hash = (hash * 397) ^ (this.consistency == null ? 0 : this.consistency.hashCode()); hash = (hash * 397) ^ (this.databasesName == null ? 0 : this.databasesName.hashCode()); hash = (hash * 397) ^ (this.containerName == null ? 0 : this.containerName.hashCode()); hash = (hash * 397) ^ (this.operation == null ? 0 : this.operation.hashCode()); hash = (hash * 397) ^ (this.resource == null ? 0 : this.resource.hashCode()); hash = (hash * 397) ^ (this.metricInfo == null ? 0 : this.metricInfo.getMetricsName() == null ? 0 : this.metricInfo.getMetricsName().hashCode()); return hash; }

Target:
public int hashCode() { int hash = 0; hash = (hash * 397) ^ (this.regionsContacted == null ? 0 : this.regionsContacted.hashCode()); hash = (hash * 397) ^ (this.greaterThan1Kb == null ? 0 : this.greaterThan1Kb.hashCode()); hash = (hash * 397) ^ (this.consistency == null ? 0 : this.consistency.hashCode()); hash = (hash * 397) ^ (this.databaseName == null ? 0 : this.databaseName.hashCode()); hash = (hash * 397) ^ (this.containerName == null ? 0 : this.containerName.hashCode()); hash = (hash * 397) ^ (this.operation == null ? 0 : this.operation.hashCode()); hash = (hash * 397) ^ (this.resource == null ? 0 : this.resource.hashCode()); hash = (hash * 397) ^ (this.metricInfo == null ? 0 : this.metricInfo.getMetricsName() == null ? 0 : this.metricInfo.getMetricsName().hashCode()); return hash; }
Source:
private void assertValidAudienceClaim(List<String> audience, List<String> value) { if (audience == null || !audience.containsAll(value)) { throw new InvalidClaimException(String.format("The Claim '%s' value doesn't contain the required audience.", PublicClaims.AUDIENCE)); } }

Target:
private void assertValidAudienceClaim(List<String> audience, List<String> value) { if (audience == null || !audience.containsAll(value)) { throw new InvalidClaimException("The Claim 'aud' value doesn't contain the required audience."); } }
Source:
private CommandManager() { CacheManager manager = CacheManager.create(); manager.addCache(initGetCache(EXECUTION_CONTEXT_NAME)); executionContextMap = new EhcacheWrapper<NGuid, ExecutionContext>(manager, EXECUTION_CONTEXT_NAME); }

Target:
private CommandManager() { executionContextMap = new EhcacheWrapper<NGuid, ExecutionContext>(CacheProviderFactory.getCache(EXECUTION_CONTEXT_MAP_NAME)); commandMap = new EhcacheWrapper<NGuid, CommandEntity>(CacheProviderFactory.getCache(COMMAND_MAP_NAME)); }
Source:
private TeamException getTeamException(final Throwable throwable) { Throwable current = throwable; while (current.getCause() != null) { current = current.getCause(); } return new TeamException(current.getMessage(), current); }

Target:
private TeamException getTeamException(final Throwable throwable) { Throwable current = throwable; while (current.getCause() != null) current = current.getCause(); return new TeamException(current.getMessage(), current); }
Source:
private static String toReadWriteStoreKey(SystemStreamPartition ssp, TaskName taskName) { return new String(new JsonSerdeV2<>().toBytes(new StartpointKey(ssp, taskName))); }

Target:
private static String toReadWriteStoreKey(SystemStreamPartition ssp, TaskName taskName) { Preconditions.checkArgument(ssp != null, "SystemStreamPartition should be defined"); Preconditions.checkArgument(StringUtils.isNotBlank(ssp.getSystem()), "System should be defined"); Preconditions.checkArgument(StringUtils.isNotBlank(ssp.getStream()), "Stream should be defined"); Preconditions.checkArgument(ssp.getPartition() != null, "Partition should be defined"); String storeKey = ssp.getSystem() + "." + ssp.getStream() + "." + String.valueOf(ssp.getPartition().getPartitionId()); if (taskName != null) { storeKey += "." + taskName.getTaskName(); } return storeKey; }