auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void addToolbarToDialog(final Fragment context, final Dialog dialog, String title) { if (!context.isAdded() || dialog == null) { return; } Toolbar toolbar; if (dialog.findViewById(android.R.id.list) == null && dialog.findViewById(android.R.id.list_container) == null) { return; } ViewGroup root = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { ViewGroup listContainer = (ViewGroup) dialog.findViewById(android.R.id.list_container); if (listContainer != null) { root = (ViewGroup) listContainer.getParent(); } } if (root == null) { root = (ViewGroup) dialog.findViewById(android.R.id.list).getParent(); } toolbar = (Toolbar) LayoutInflater.from(context.getActivity()) .inflate(org.wordpress.android.R.layout.toolbar, root, false); root.addView(toolbar, 0); dialog.getWindow().setWindowAnimations(R.style.DialogAnimations); TextView titleView = (TextView) toolbar.findViewById(R.id.toolbar_title); titleView.setVisibility(View.VISIBLE); titleView.setText(title); toolbar.setTitle(""); toolbar.setNavigationIcon(org.wordpress.android.R.drawable.ic_arrow_back_white_24dp); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); }

Target:
public static void addToolbarToDialog(final Fragment context, final Dialog dialog, String title) { if (!context.isAdded() || dialog == null) { return; } Toolbar toolbar; if (dialog.findViewById(android.R.id.list) == null && dialog.findViewById(android.R.id.list_container) == null) { return; } @SuppressLint("InlinedApi") View child = dialog.findViewById(android.R.id.list_container); if (child == null) { child = dialog.findViewById(android.R.id.list); if (child == null) return; } ViewGroup root = (ViewGroup) child.getParent(); toolbar = (Toolbar) LayoutInflater.from(context.getActivity()) .inflate(org.wordpress.android.R.layout.toolbar, root, false); root.addView(toolbar, 0); dialog.getWindow().setWindowAnimations(R.style.DialogAnimations); TextView titleView = (TextView) toolbar.findViewById(R.id.toolbar_title); titleView.setVisibility(View.VISIBLE); titleView.setText(title); toolbar.setTitle(""); toolbar.setNavigationIcon(org.wordpress.android.R.drawable.ic_arrow_back_white_24dp); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); }
Source:
public int run(CompiledDefinition compiledDef, KRunOptions options, Function<Module, Rewriter> rewriterGenerator) { String pgmFileName = options.configurationCreation.pgm(); if (!options.configurationCreation.term()) { KExceptionManager.criticalError("Unsupported options: term=false"); } String pgm = files.loadFromWorkingDirectory(pgmFileName); K program = compiledDef.getProgramParser().apply(pgm, Source.apply(pgm)); Rewriter rewriter = rewriterGenerator.apply(compiledDef.executionModule()); K result = rewriter.execute(program); System.err.println("result:" + unparseTerm(result, compiledDef.kompiledDefinition.mainSyntaxModule())); return 0; }

Target:
public int run(CompiledDefinition compiledDef, KRunOptions options, Function<Module, Rewriter> rewriterGenerator) { String pgmFileName = options.configurationCreation.pgm(); if (!options.configurationCreation.term()) { throw KExceptionManager.criticalError("Unsupported options: term=false"); } String pgm = files.loadFromWorkingDirectory(pgmFileName); K program = compiledDef.getProgramParser().apply(pgm, Source.apply(pgm)); Rewriter rewriter = rewriterGenerator.apply(compiledDef.executionModule()); K result = rewriter.execute(program); System.err.println(unparseTerm(result, compiledDef.kompiledDefinition.mainSyntaxModule())); return 0; }
Source:
public void testNotificationsCalledWhenTimelineUpdated() throws InterruptedException { final String eventType1 = UUID.randomUUID().toString(); final String eventType2 = UUID.randomUUID().toString(); final RefreshListener l1 = new RefreshListener(); final TimelineSync t1 = createTimeline(); t1.registerTimelineChangeListener(eventType1, l1.createConsumer()); final RefreshListener l2 = new RefreshListener(); final TimelineSync t2 = createTimeline(); t2.registerTimelineChangeListener(eventType2, l2.createConsumer()); t1.startTimelineUpdate(eventType1, TimeUnit.SECONDS.toMillis(3)); t1.startTimelineUpdate(eventType2, TimeUnit.SECONDS.toMillis(3)); Assert.assertEquals(0, l1.getData().size()); Assert.assertEquals(0, l2.getData().size()); t1.finishTimelineUpdate(eventType1); Thread.sleep(TimeUnit.SECONDS.toMillis(1)); Assert.assertEquals(1, l1.getData().size()); Assert.assertEquals(new Integer(1), l1.getData().get(eventType1)); Assert.assertEquals(0, l2.getData().size()); t1.finishTimelineUpdate(eventType2); Assert.assertEquals(1, l1.getData().size()); Assert.assertEquals(new Integer(1), l1.getData().get(eventType1)); Assert.assertEquals(1, l2.getData().size()); Assert.assertEquals(new Integer(1), l2.getData().get(eventType2)); }

Target:
public void testNotificationsCalledWhenTimelineUpdated() throws InterruptedException { final String eventType1 = UUID.randomUUID().toString(); final String eventType2 = UUID.randomUUID().toString(); final RefreshListener l1 = new RefreshListener(); final TimelineSync t1 = createTimeline(); t1.registerTimelineChangeListener(eventType1, l1.createConsumer()); final RefreshListener l2 = new RefreshListener(); final TimelineSync t2 = createTimeline(); t2.registerTimelineChangeListener(eventType2, l2.createConsumer()); t1.startTimelineUpdate(eventType1, TimeUnit.SECONDS.toMillis(3)); t1.startTimelineUpdate(eventType2, TimeUnit.SECONDS.toMillis(3)); Assert.assertEquals(0, l1.getData().size()); Assert.assertEquals(0, l2.getData().size()); t1.finishTimelineUpdate(eventType1); TestUtils.waitFor(() -> Assert.assertEquals(1, l1.getData().size()), TimeUnit.SECONDS.toMillis(1)); Assert.assertEquals(new Integer(1), l1.getData().get(eventType1)); Assert.assertEquals(0, l2.getData().size()); t1.finishTimelineUpdate(eventType2); Assert.assertEquals(1, l1.getData().size()); Assert.assertEquals(new Integer(1), l1.getData().get(eventType1)); Assert.assertEquals(1, l2.getData().size()); Assert.assertEquals(new Integer(1), l2.getData().get(eventType2)); }
Source:
public void addWorkflowEntry(WorkflowDTO workflow) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; String query = SQLConstants.ADD_WORKFLOW_ENTRY_SQL; try { Timestamp cratedDateStamp = new Timestamp(workflow.getCreatedTime()); connection = APIMgtDBUtil.getConnection(); connection.setAutoCommit(false); prepStmt = connection.prepareStatement(query); prepStmt.setString(1, workflow.getWorkflowReference()); prepStmt.setString(2, workflow.getWorkflowType()); prepStmt.setString(3, workflow.getStatus().toString()); prepStmt.setTimestamp(4, cratedDateStamp); prepStmt.setString(5, workflow.getWorkflowDescription()); prepStmt.setInt(6, workflow.getTenantId()); prepStmt.setString(7, workflow.getTenantDomain()); prepStmt.setString(8, workflow.getExternalWorkflowReference()); byte[] byteData1 = workflow.getMetadata().toJSONString().getBytes("UTF-8"); byte[] byteData2 = workflow.getProperties().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(9, new ByteArrayInputStream(byteData1) ); prepStmt.setBlob(10, new ByteArrayInputStream(byteData2) ); prepStmt.execute(); connection.commit(); } catch (SQLException | UnsupportedEncodingException e) { handleException("Error while adding Workflow : " + workflow.getExternalWorkflowReference() + " to the " + "database", e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, null); } }

Target:
public void addWorkflowEntry(WorkflowDTO workflow) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; String query = SQLConstants.ADD_WORKFLOW_ENTRY_SQL; try { Timestamp cratedDateStamp = new Timestamp(workflow.getCreatedTime()); connection = APIMgtDBUtil.getConnection(); connection.setAutoCommit(false); prepStmt = connection.prepareStatement(query); prepStmt.setString(1, workflow.getWorkflowReference()); prepStmt.setString(2, workflow.getWorkflowType()); prepStmt.setString(3, workflow.getStatus().toString()); prepStmt.setTimestamp(4, cratedDateStamp); prepStmt.setString(5, workflow.getWorkflowDescription()); prepStmt.setInt(6, workflow.getTenantId()); prepStmt.setString(7, workflow.getTenantDomain()); prepStmt.setString(8, workflow.getExternalWorkflowReference()); if(workflow.getMetadata() != null) { byte[] metadataByte = workflow.getMetadata().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(9, new ByteArrayInputStream(metadataByte) ); } else { prepStmt.setBlob(9, (Blob)null); } if(workflow.getProperties() != null) { byte[] propertiesByte = workflow.getProperties().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(10, new ByteArrayInputStream(propertiesByte)); } else { prepStmt.setBlob(10, (Blob)null); } prepStmt.execute(); connection.commit(); } catch (SQLException | UnsupportedEncodingException e) { handleException("Error while adding Workflow : " + workflow.getExternalWorkflowReference() + " to the " + "database", e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, null); } }
Source:
public LayerBuildsAccessor( int layerId, ConcurrentMap<String, CacheEntry> map, ICacheManager cacheMgr, ReadWriteLock cloneLock, NavigableSet<String> sortedKeys, LayerCacheImpl layerCache) { this.layerId = layerId; this.keyPrefix = Integer.toString(layerId) + "-"; this.keyPrefixUpperBound = Integer.toString(layerId) + "."; this.map = map; this.cacheMgr = cacheMgr; this.cloneLock = cloneLock; this.layerCacheRef = new WeakReference<LayerCacheImpl>(layerCache); int count = 0; if (sortedKeys != null) { count = sortedKeys.subSet(keyPrefix, true, keyPrefixUpperBound, false).size(); } this.evictionLatch = new LatchingCounter(count); }

Target:
LayerBuildsAccessor( int layerId, ConcurrentMap<String, CacheEntry> map, ICacheManager cacheMgr, ReadWriteLock cloneLock, NavigableSet<String> sortedKeys, LayerCacheImpl layerCache) { this.layerId = layerId; this.keyPrefix = Integer.toString(layerId) + "-"; this.keyPrefixUpperBound = Integer.toString(layerId) + "."; this.map = map; this.cacheMgr = cacheMgr; this.cloneLock = cloneLock; this.layerCacheRef = new WeakReference<LayerCacheImpl>(layerCache); int count = 0; if (sortedKeys != null) { count = sortedKeys.subSet(keyPrefix, true, keyPrefixUpperBound, false).size(); } this.evictionLatch = new LatchingCounter(count); }
Source:
public List<Programme> next() { try { return ImmutableList.copyOf(currentResponse.getNext().getResults()); } catch (GlycerinException e) { throw Throwables.propagate(e); } }

Target:
public List<Programme> next() { try { if (currentResponse == null) { boolean gotSomething = executeRequest(); if (!gotSomething) { throw new NoSuchElementException(); } } ImmutableList<Programme> programmes = currentResponse.getResults(); if (currentResponse.hasNext()) { currentResponse = currentResponse.getNext(); } else { currentResponse = null; } return programmes; } catch (GlycerinException e) { throw Throwables.propagate(e); } }
Source:
public void testFetchUnreachableBlobWithBitmap() throws Exception { RevBlob blob = remote.blob("foo"); RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob))); generateBitmaps(server); testProtocol = generateReachableCommitUploadPackProtocol(); uri = testProtocol.register(ctx, server); assertFalse(client.hasObject(blob.toObjectId())); try (Transport tn = testProtocol.open(uri, client, "server")) { thrown.expect(TransportException.class); thrown.expectMessage(Matchers.containsString( "want " + blob.name() + " not valid")); tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(blob.name()))); } }

Target:
public void testFetchUnreachableBlobWithBitmap() throws Exception { RevBlob blob = remote.blob("foo"); remote.commit(remote.tree(remote.file("foo", blob))); generateBitmaps(server); testProtocol = generateReachableCommitUploadPackProtocol(); uri = testProtocol.register(ctx, server); assertFalse(client.hasObject(blob.toObjectId())); try (Transport tn = testProtocol.open(uri, client, "server")) { thrown.expect(TransportException.class); thrown.expectMessage(Matchers.containsString( "want " + blob.name() + " not valid")); tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(blob.name()))); } }
Source:
public MetaStateEvent clone() { MetaStateEvent metaStateEvent = new MetaStateEvent(this.getStreamEventCount()); for (MetaStreamEvent metaStreamEvent: this.getMetaStreamEvents()) { metaStateEvent.addEvent(metaStreamEvent.clone()); } metaStateEvent.setOutputDefinition(this.getOutputStreamDefinition()); return metaStateEvent; }

Target:
public MetaStateEvent clone() { MetaStateEvent metaStateEvent = new MetaStateEvent(this.getStreamEventCount()); for (MetaStreamEvent metaStreamEvent: this.getMetaStreamEvents()) { metaStateEvent.addEvent(metaStreamEvent.clone()); } if (this.getOutputStreamDefinition() != null) { metaStateEvent.setOutputDefinition(this.getOutputStreamDefinition().clone()); } return metaStateEvent; }
Source:
protected void executeCommand() { if (getDiskImage() != null) { try { VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { log.errorFormat("Image {0} does not exists in domain {1}. Removing disk from DB only.", getDiskImage().getId(), getParameters().getStorageDomainId()); } else { throw e; } } if (getParameters().isRemoveDuringExecution() && getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { removeImageFromDB(false); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }

Target:
protected void executeCommand() { if (getDiskImage() != null) { try { VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { getReturnValue().setFault(new VdcFault(e, e.getVdsError().getCode())); log.errorFormat("Image {0} does not exist in domain {1}. Removing disk from DB.", getDiskImage().getId(), getParameters().getStorageDomainId()); } else { throw e; } } if (getParameters().isRemoveDuringExecution() && getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { removeImageFromDB(false); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }
Source:
public State clone() { State cloned = new State(); cloned.isSynchronized = this.isSynchronized; cloned.startTime = this.startTime; cloned.endTime = this.endTime; cloned.lastUpdatedTime = this.lastUpdatedTime; cloned.numOfTrail = this.numOfTrail; cloned.numOfSuccess = this.numOfSuccess; cloned.numOfFailure = this.numOfFailure; cloned.numOfIgnored = this.numOfIgnored; cloned.isPaused = this.isPaused; cloned.rampStage = this.rampStage; cloned.lastRampDownTime = this.lastRampDownTime; cloned.cachedNumOfTrail = this.cachedNumOfTrail; cloned.cachedNumOfSuccess = this.cachedNumOfSuccess; cloned.cachedNumOfFailure = this.cachedNumOfFailure; cloned.cachedNumOfIgnored = this.cachedNumOfIgnored; cloned.isActive = true; return cloned; }

Target:
public State clone() { return new State(this.rampStage, this.isActive, this.isPaused, this.isSynchronized, this.startTime, this.endTime, this.lastUpdatedTime, this.lastRampDownTime, this.numOfTrail, this.numOfSuccess, this.numOfFailure, this.numOfIgnored, this.cachedNumOfTrail, this.cachedNumOfSuccess, this.cachedNumOfFailure, this.cachedNumOfIgnored); }
Source:
public TaskLifecycleListener(TaskRepository taskRepository, TaskNameResolver taskNameResolver, ApplicationArguments applicationArguments, TaskExplorer taskExplorer, TaskProperties taskProperties, TaskListenerExecutorObjectFactory taskListenerExecutorObjectFactory, TaskTerminator taskTerminator) { Assert.notNull(taskRepository, "A taskRepository is required"); Assert.notNull(taskNameResolver, "A taskNameResolver is required"); Assert.notNull(taskExplorer, "A taskExplorer is required"); Assert.notNull(taskProperties, "TaskProperties is required"); Assert.notNull(taskListenerExecutorObjectFactory, "A TaskListenerExecutorObjectFactory is required"); Assert.notNull(taskTerminator, "A TaskTerminator is required"); this.taskRepository = taskRepository; this.taskNameResolver = taskNameResolver; this.applicationArguments = applicationArguments; this.taskExplorer = taskExplorer; this.taskProperties = taskProperties; this.taskListenerExecutorObjectFactory = taskListenerExecutorObjectFactory; this.taskMetrics = new TaskMetrics(); this.listenTo("HUP"); this.listenTo("INT"); this.listenTo("TERM"); this.taskTerminator = taskTerminator; }

Target:
public TaskLifecycleListener(TaskRepository taskRepository, TaskNameResolver taskNameResolver, ApplicationArguments applicationArguments, TaskExplorer taskExplorer, TaskProperties taskProperties, TaskListenerExecutorObjectFactory taskListenerExecutorObjectFactory, TaskTerminator taskTerminator) { Assert.notNull(taskRepository, "A taskRepository is required"); Assert.notNull(taskNameResolver, "A taskNameResolver is required"); Assert.notNull(taskExplorer, "A taskExplorer is required"); Assert.notNull(taskProperties, "TaskProperties is required"); Assert.notNull(taskListenerExecutorObjectFactory, "A TaskListenerExecutorObjectFactory is required"); Assert.notNull(taskTerminator, "A TaskTerminator is required"); this.taskRepository = taskRepository; this.taskNameResolver = taskNameResolver; this.applicationArguments = applicationArguments; this.taskExplorer = taskExplorer; this.taskProperties = taskProperties; this.taskListenerExecutorObjectFactory = taskListenerExecutorObjectFactory; this.taskMetrics = new TaskMetrics(); for (SigTermSignals sigTerm : SigTermSignals.values()) { this.listenTo(sigTerm.name()); } this.taskTerminator = taskTerminator; }
Source:
public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addRequiredProperty("name"); description.addRequiredProperty("description"); description.addRequiredProperty("identifierType"); return description; }

Target:
public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("name"); description.addProperty("description"); return description; }
Source:
String getFunctionName(ITmfTrace trace, int processId, long timestamp, ITmfStateValue nameValue) { long address = Long.MAX_VALUE; String name = ""; try { if (nameValue.getType() == Type.STRING) { name = nameValue.unboxStr(); try { address = Long.parseLong(name, 16); } catch (NumberFormatException e) { } } else if (nameValue.getType() == Type.INTEGER) { name = "0x" + Integer.toUnsignedString(nameValue.unboxInt(), 16); address = nameValue.unboxInt(); } else if (nameValue.getType() == Type.LONG) { name = "0x" + Long.toUnsignedString(nameValue.unboxLong(), 16); address = nameValue.unboxLong(); } } catch (StateValueTypeException e) { } if (address != Long.MAX_VALUE) { Collection<ISymbolProvider> providers = fSymbolProviders.get(trace); if (!providers.isEmpty()) { for (ISymbolProvider provider : providers) { String symbol = provider.getSymbolText(processId, timestamp, address); if (symbol != null) { name = symbol; } } } } return name; }

Target:
String getFunctionName(ITmfTrace trace, int processId, long timestamp, ITmfStateValue nameValue) { long address = Long.MAX_VALUE; String name = ""; try { if (nameValue.getType() == Type.STRING) { name = nameValue.unboxStr(); try { address = Long.parseLong(name, 16); } catch (NumberFormatException e) { } } else if (nameValue.getType() == Type.INTEGER) { name = "0x" + Integer.toUnsignedString(nameValue.unboxInt(), 16); address = nameValue.unboxInt(); } else if (nameValue.getType() == Type.LONG) { name = "0x" + Long.toUnsignedString(nameValue.unboxLong(), 16); address = nameValue.unboxLong(); } } catch (StateValueTypeException e) { } if (address != Long.MAX_VALUE) { for (ISymbolProvider provider : fSymbolProviders.get(trace)) { String symbol = provider.getSymbolText(processId, timestamp, address); if (symbol != null) { name = symbol; } } } return name; }
Source:
List<Long> getPositionList() { List<Long> ret = new ArrayList<Long>(); ret.add((long) -1); long count = 0; for (long index = 0; index < this.bitVector.size(); index++) { if (this.bitVector.getBit(index) == this.bit) { count++; } if (count >= this.blockSize) { count = 0; ret.add(index); } } return ret; }

Target:
List<Long> getPositionList() { List<Long> ret = new ArrayList<Long>(); ret.add(-1L); long count = 0; for (long index = 0; index < this.bitVector.size(); index++) { if (this.bitVector.getBit(index) == this.bit) { count++; } if (count >= this.blockSize) { count = 0; ret.add(index); } } return ret; }
Source:
public List<SurveyGroup> listByProjectFolderId(Long parentId) { parentId = parentId < 0 ? null : parentId; return super.listByProperty("parentId", parentId, "Long"); }

Target:
public List<SurveyGroup> listByProjectFolderId(Long parentId) { return super.listByProperty("parentId", parentId, "Long"); }
Source:
public void run() { try { consumer.subscribe(topics); logger.info("Consumer successfully subscribed for topics {}", topics); while (!closed.get()) { ConsumerRecords<?, ?> records = consumer.poll(100); for (ConsumerRecord<?, ?> record : records) { handleRecord(record); } } } catch (WakeupException e) { if (!closed.get()) { throw e; } } finally { consumer.close(); } }

Target:
public void run() { try { consumer.subscribe(topics); logger.info("Consumer successfully subscribed for topics {}", topics); while (isRunning()) { ConsumerRecords<?, ?> records = consumer.poll(100); for (ConsumerRecord<?, ?> record : records) { handleRecord(record); } } } catch (WakeupException e) { if (isRunning()) { throw e; } } finally { consumer.close(); } }
Source:
public Image apply(org.jclouds.docker.domain.Image from) { checkNotNull(from, "image"); String description = checkNotNull(Iterables.getFirst(from.getRepoTags(), null)); OsFamily osFamily = osFamily().apply(description); String osVersion = parseVersion(description); OperatingSystem os = OperatingSystem.builder() .description(description) .family(osFamily) .version(osVersion) .is64Bit(is64bit(from)) .build(); return new ImageBuilder() .ids(from.getId()) .name(get(Splitter.on(":").split(description), 0)) .description(description) .operatingSystem(os) .status(Image.Status.AVAILABLE) .build(); }

Target:
public Image apply(org.jclouds.docker.domain.Image from) { checkNotNull(from, "image"); String description = checkNotNull(Iterables.getFirst(from.getRepoTags(), "image must have at least one repo tag")); OsFamily osFamily = osFamily().apply(description); String osVersion = parseVersion(description); OperatingSystem os = OperatingSystem.builder() .description(description) .family(osFamily) .version(osVersion) .is64Bit(is64bit(from)) .build(); return new ImageBuilder() .ids(from.getId()) .name(get(Splitter.on(":").split(description), 0)) .description(description) .operatingSystem(os) .status(Image.Status.AVAILABLE) .build(); }
Source:
public IConnection update(IConnection conn) { Assert.isLegal(conn instanceof Connection); final Connection connection = (Connection) conn; Display.getDefault().syncExec(new Runnable() { @Override public void run() { connection.setAuthScheme(IAuthorizationContext.AUTHSCHEME_OAUTH); connection.setToken((String) tokenObservable.getValue()); connection.setRememberToken((boolean) rememberTokenObservable.getValue()); } }); return connection; }

Target:
public IConnection update(IConnection conn) { Assert.isLegal(conn instanceof Connection); final Connection connection = (Connection) conn; Display.getDefault().syncExec(new Runnable() { @Override public void run() { connection.setAuthScheme(IAuthorizationContext.AUTHSCHEME_OAUTH); connection.setToken(tokenObservable.getValue()); connection.setRememberToken(rememberTokenObservable.getValue()); } }); return connection; }
Source:
public void testCreate_ensureMetricsAreRegistered() { SharedMetricRegistries.setDefault("test"); SslConfiguration sslConfig = SslConfiguration.of(Paths.get("src/test/resources/trustStore.jks")); ClientConfiguration conf = ClientConfigurations.of( ImmutableList.of("http://localhost"), SslSocketFactories.createSslSocketFactory(sslConfig), SslSocketFactories.createX509TrustManager(sslConfig)); OkHttpClients.create(conf, "test", OkHttpClients.class); SortedMap<String, Meter> meters = SharedMetricRegistries.getDefault().getMeters(); assertThat(meters.get("com.palantir.remoting3.okhttp.OkHttpClients.response.family.informational")).isNotNull(); assertThat(meters.get("com.palantir.remoting3.okhttp.OkHttpClients.response.family.successful")).isNotNull(); assertThat(meters.get("com.palantir.remoting3.okhttp.OkHttpClients.response.family.redirection")).isNotNull(); assertThat(meters.get("com.palantir.remoting3.okhttp.OkHttpClients.response.family.client-error")).isNotNull(); assertThat(meters.get("com.palantir.remoting3.okhttp.OkHttpClients.response.family.server-error")).isNotNull(); }

Target:
public void testCreate_ensureMetricsAreRegistered() { SharedMetricRegistries.setDefault("test"); SslConfiguration sslConfig = SslConfiguration.of(Paths.get("src/test/resources/trustStore.jks")); ClientConfiguration conf = ClientConfigurations.of( ImmutableList.of("http://localhost"), SslSocketFactories.createSslSocketFactory(sslConfig), SslSocketFactories.createX509TrustManager(sslConfig)); OkHttpClients.create(conf, "test", String.class); SortedMap<String, Meter> meters = SharedMetricRegistries.getDefault().getMeters(); assertThat(meters.get("java.lang.String.response.family.informational")).isNotNull(); assertThat(meters.get("java.lang.String.response.family.successful")).isNotNull(); assertThat(meters.get("java.lang.String.response.family.redirection")).isNotNull(); assertThat(meters.get("java.lang.String.response.family.client-error")).isNotNull(); assertThat(meters.get("java.lang.String.response.family.server-error")).isNotNull(); }
Source:
public void actionPerformed(AnActionEvent e) { BaseAction.State s = setupAction(e); List<String> lastTask = Collections.singletonList(s.getLastRanTask()); s.performTasks(lastTask); s.cleanup(); }

Target:
public void actionPerformed(AnActionEvent e) { BaseAction.State s = setupAction(e); try { List<String> lastTask = Collections.singletonList(s.getLastRanTask()); s.performTasks(lastTask); } finally { s.cleanup(); } }
Source:
public KubernetesInternalRuntime getRuntime() throws InfrastructureException { Optional<KubernetesRuntimeState> runtimeStateOpt = runtimeStatuses.get(getIdentity()); String workspaceId = getIdentity().getWorkspaceId(); if (!runtimeStateOpt.isPresent()) { return runtimeFactory.create( this, namespaceFactory.create(workspaceId), getEnvironment().getWarnings()); } KubernetesRuntimeState runtimeState = runtimeStateOpt.get(); LOG.debug("Restoring runtime in workspace {}", runtimeState.getRuntimeId(), workspaceId); KubernetesInternalRuntime runtime = runtimeFactory.create( this, namespaceFactory.create(workspaceId, runtimeState.getNamespace()), getEnvironment().getWarnings()); runtime.scheduleRuntimeStateChecks(); return runtime; }

Target:
public KubernetesInternalRuntime getRuntime() throws InfrastructureException { Optional<KubernetesRuntimeState> runtimeStateOpt = runtimeStatuses.get(getIdentity()); String workspaceId = getIdentity().getWorkspaceId(); if (!runtimeStateOpt.isPresent()) { return runtimeFactory.create( this, namespaceFactory.create(workspaceId), getEnvironment().getWarnings()); } KubernetesRuntimeState runtimeState = runtimeStateOpt.get(); RuntimeIdentity runtimeId = runtimeState.getRuntimeId(); LOG.debug( "Restoring runtime `{}:{}:{}`", runtimeId.getWorkspaceId(), runtimeId.getEnvName(), runtimeId.getOwnerId()); KubernetesInternalRuntime runtime = runtimeFactory.create( this, namespaceFactory.create(workspaceId, runtimeState.getNamespace()), getEnvironment().getWarnings()); runtime.scheduleRuntimeStateChecks(); return runtime; }
Source:
void initializePool(Collection<DiskSpaceRequirements> requirementsList) throws StoreException { reserveFiles.rwLock.writeLock().lock(); try { try { Map<Long, Long> overallRequirements = getOverallRequirements(requirementsList); deleteUnneededSegments(overallRequirements); addRequiredSegments(overallRequirements); poolInitialized = true; } catch (Exception e) { throw new StoreException("Exception while initializing DiskSpaceAllocator pool", e, StoreErrorCodes.Initialization_Error); } } finally { reserveFiles.rwLock.writeLock().unlock(); } }

Target:
void initializePool(Collection<DiskSpaceRequirements> requirementsList) throws StoreException { long startTime = System.currentTimeMillis(); try { if (enablePooling) { if (poolState == PoolState.NOT_INVENTORIED) { throw inventoryException; } Map<Long, Long> overallRequirements = getOverallRequirements(requirementsList); deleteExtraSegments(overallRequirements); addRequiredSegments(overallRequirements); poolState = PoolState.INITIALIZED; } else { logger.info("Disk segment pooling disabled; pool will not be initialized."); } } catch (Exception e) { metrics.diskSpaceAllocatorInitFailureCount.inc(); poolState = PoolState.NOT_INVENTORIED; throw new StoreException("Exception while initializing DiskSpaceAllocator pool", e, StoreErrorCodes.Initialization_Error); } finally { long elapsedTime = System.currentTimeMillis() - startTime; logger.info("initializePool took ms", elapsedTime); metrics.diskSpaceAllocatorStartTimeMs.update(elapsedTime); } }
Source:
public void typeInUserName(String userName) { userNameField.sendKeys(userName); userNameField.sendKeys(Keys.TAB); PageObjectLogging.log("typeInUserName ", "User name field populated " +userName, true, driver); }

Target:
public void typeInUserName(String userName) { userNameField.sendKeys(userName); userNameField.sendKeys(Keys.TAB); PageObjectLogging.log( "typeInUserName ", "User name field populated " + userName, true ); }
Source:
public void spanSubstitution() { StringWriter writer = new StringWriter(); HtmlLanguage language = builder.addSpanFont() .add(SpanType.DELETED) .addSubstitution(SpanType.DELETED, "strike") .document("", "") .name("Test") .create(); DocumentBuilder builder = language.createDocumentBuilder(writer); builder.beginDocument(); builder.beginSpan(SpanType.SPAN, new Attributes(null, null, "text-decoration: line-through", null)); builder.characters("testSPAN"); builder.endSpan(); builder.beginSpan(SpanType.DELETED, new Attributes()); builder.characters("testDELETED"); builder.endSpan(); assertEquals("<strike>testSPAN</strike><strike>testDELETED</strike>", writer.toString()); }

Target:
public void spanSubstitution() { StringWriter writer = new StringWriter(); HtmlLanguage language = builder.addSpanFont() .add(SpanType.DELETED) .addSubstitution(SpanType.DELETED, "strike") .document("", "") .name("Test") .create(); DocumentBuilder builder = language.createDocumentBuilder(writer); builder.beginDocument(); builder.beginSpan(SpanType.DELETED, new Attributes()); builder.characters("test"); builder.endSpan(); assertEquals("<strike>test</strike>", writer.toString()); }
Source:
public static void openQueue(final ArrayList<Song> queue, final int startPosition, final boolean startPlaying) { if (!tryToHandleOpenPlayingQueue(queue, startPosition, startPlaying) && musicService != null) { musicService.openQueue(queue, startPosition, startPlaying); if (!PreferenceUtil.getInstance(musicService).rememberShuffle()) setShuffleMode(MusicService.SHUFFLE_MODE_NONE); } }

Target:
public static void openQueue(final ArrayList<Song> queue, final int startPosition, final boolean startPlaying) { if (!tryToHandleOpenPlayingQueue(queue, startPosition, startPlaying) && musicService != null) { musicService.openQueue(queue, startPosition, startPlaying); if (!PreferenceUtil.getInstance(musicService).rememberShuffle()){ setShuffleMode(MusicService.SHUFFLE_MODE_NONE); } } }
Source:
public SerializableTransactionManager provideTransactionManager(ServicesConfig config, @Named("kvs") KeyValueService kvs, TransactionManagers.LockAndTimestampServices lts, LockClient lockClient, TransactionService transactionService, ConflictDetectionManager conflictManager, SweepStrategyManager sweepStrategyManager, Cleaner cleaner) { return new SerializableTransactionManager( kvs, lts.timelock(), lts.lock(), transactionService, Suppliers.ofInstance(AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS), conflictManager, sweepStrategyManager, cleaner, config.allowAccessToHiddenTables(), () -> AtlasDbConstants.DEFAULT_TRANSACTION_LOCK_ACQUIRE_TIMEOUT_MS); }

Target:
public SerializableTransactionManager provideTransactionManager(ServicesConfig config, @Named("kvs") KeyValueService kvs, TransactionManagers.LockAndTimestampServices lts, LockClient lockClient, TransactionService transactionService, ConflictDetectionManager conflictManager, SweepStrategyManager sweepStrategyManager, Cleaner cleaner) { return new SerializableTransactionManager( kvs, lts.timelock(), lts.lock(), transactionService, Suppliers.ofInstance(AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS), conflictManager, sweepStrategyManager, cleaner, config.allowAccessToHiddenTables()); }
Source:
private List<ResultMap> getStatementResultMaps( String resultMap, Class<?> resultType, String statementId) { resultMap = applyCurrentNamespace(resultMap, true); List<ResultMap> resultMaps = new ArrayList<>(); if (resultMap != null) { String[] resultMapNames = resultMap.split(","); for (String resultMapName : resultMapNames) { try { resultMaps.add(configuration.getResultMap(resultMapName.trim())); } catch (IllegalArgumentException e) { throw new IncompleteElementException("Could not find result map " + resultMapName + " [statementId]" + statementId, e); } } } else if (resultType != null) { ResultMap inlineResultMap = new ResultMap.Builder( configuration, statementId + "-Inline", resultType, new ArrayList<>(), null).build(); resultMaps.add(inlineResultMap); } return resultMaps; }

Target:
private List<ResultMap> getStatementResultMaps( String resultMap, Class<?> resultType, String statementId) { resultMap = applyCurrentNamespace(resultMap, true); List<ResultMap> resultMaps = new ArrayList<>(); if (resultMap != null) { String[] resultMapNames = resultMap.split(","); for (String resultMapName : resultMapNames) { try { resultMaps.add(configuration.getResultMap(resultMapName.trim())); } catch (IllegalArgumentException e) { throw new IncompleteElementException("Could not find result map '" + resultMapName + "' referenced from '" + statementId + "'", e); } } } else if (resultType != null) { ResultMap inlineResultMap = new ResultMap.Builder( configuration, statementId + "-Inline", resultType, new ArrayList<>(), null).build(); resultMaps.add(inlineResultMap); } return resultMaps; }
Source:
public int[] getRequiredTokens() { return new int[] { TokenTypes.RECORD_DEF, }; }

Target:
public int[] getRequiredTokens() { return getAcceptableTokens(); }
Source:
private void verifyUsages(String componentKey, int line, int offset, TextRange... trs) { Collection<TextRange> textRanges = context.referencesForSymbolAt(componentKey, line, offset); if (trs.length == 0) { assertThat(textRanges).isEmpty(); } else { assertThat(textRanges).containsExactly(trs); } }

Target:
private void verifyUsages(String componentKey, int line, int offset, TextRange... trs) { Collection<TextRange> textRanges = context.referencesForSymbolAt(componentKey, line, offset); assertThat(textRanges).containsExactly(trs); }
Source:
protected boolean canDoAction() { earlyUpdateVmDynamicRunOnce(); if (!super.canDoAction()) { return false; } if (getParameters().getSysPrepUserName() == null ^ getParameters().getSysPrepPassword() == null) { return failCanDoAction(VdcBllMessages.VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM); } if (getParameters().getVmInit() != null) { if (!OsRepositoryImpl.INSTANCE.isWindows(getVm().getOs()) && !FeatureSupported.cloudInit(getVm().getVdsGroupCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED); } if (getParameters().getVmInit().isPasswordAlreadyStored()) { VmBase temp = new VmBase(); temp.setId(getParameters().getVmId()); VmHandler.updateVmInitFromDB(temp, false); getParameters().getVmInit().setRootPassword(temp.getVmInit().getRootPassword()); } } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getSysPrepUserName() == null ^ getParameters().getSysPrepPassword() == null) { return failCanDoAction(VdcBllMessages.VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM); } if (getParameters().getVmInit() != null) { if (!OsRepositoryImpl.INSTANCE.isWindows(getVm().getOs()) && !FeatureSupported.cloudInit(getVm().getVdsGroupCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED); } if (getParameters().getVmInit().isPasswordAlreadyStored()) { VmBase temp = new VmBase(); temp.setId(getParameters().getVmId()); VmHandler.updateVmInitFromDB(temp, false); getParameters().getVmInit().setRootPassword(temp.getVmInit().getRootPassword()); } } return true; }
Source:
public static <T> T decodeAvroSpecificRecord(Class<T> clazz, byte[] bytes, T reuse) throws IOException { DatumReader<T> reader = new SpecificDatumReader<>(clazz); Decoder decoder = DecoderFactory.defaultFactory().createBinaryDecoder(bytes, null); return reader.read(reuse, decoder); }

Target:
public static <T extends SpecificRecord> T decodeAvroSpecificRecord(Class<T> clazz, byte[] bytes, T reuse) throws IOException { SpecificDatumReader<T> reader = new SpecificDatumReader<>(clazz); Decoder decoder = DecoderFactory.defaultFactory().createBinaryDecoder(bytes, null); return reader.read(reuse, decoder); }
Source:
private static String parseValue(String n) { String number_value = CharMatcher.WHITESPACE.removeFrom(n); Pattern number_format = Pattern.compile("((\\d)\\d{0,2})(,?\\d{3})*(\\.[\\d]+)?([MBK]?)"); Matcher m = number_format.matcher(number_value); if (!m.find()) { DAO.severe("This is outputing wrong value. Need to be fixed"); } return number_value; }

Target:
private static String parseValue(String n) { String number_value = CharMatcher.WHITESPACE.removeFrom(n); Pattern number_format = Pattern.compile("^(\\d{1,3})(((,\\d{3})*)|((\\.\\d+)?[MBK]))?$"); Matcher m = number_format.matcher(number_value); if (!m.find()) { DAO.severe("This is outputing wrong value. Need to be fixed"); } return number_value; }
Source:
private void waitForImageVerification() throws ProtocolAdapterException, ImageTransferException { final Future<Integer> newStatus = EXECUTOR_SERVICE.submit(new ImageTransferStatusChangeWatcher( ImageTransferStatus.VERIFICATION_INITIATED, properties.getVerificationStatusCheckInterval(), properties.verificationStatusCheckTimeout)); int status; try { status = newStatus.get(); } catch (InterruptedException | ExecutionException e) { throw new ProtocolAdapterException("", e); } if (status == ImageTransferStatus.VERIFICATION_FAILED.getValue()) { throw new ImageTransferException(EXCEPTION_MSG_IMAGE_NOT_VERIFIED); } return; }

Target:
private void waitForImageVerification() throws ProtocolAdapterException, ImageTransferException { final Future<Integer> newStatus = EXECUTOR_SERVICE.submit(new ImageTransferStatusChangeWatcher( ImageTransferStatus.VERIFICATION_INITIATED, properties.getVerificationStatusCheckInterval(), properties .getVerificationStatusCheckTimeout())); int status; try { status = newStatus.get(); } catch (InterruptedException | ExecutionException e) { throw new ProtocolAdapterException("", e); } if (status == ImageTransferStatus.VERIFICATION_FAILED.getValue()) { throw new ImageTransferException(EXCEPTION_MSG_IMAGE_NOT_VERIFIED); } return; }
Source:
public MetadataMap getMetadata() { if (metadata == null) { metadata = new MetadataMap(); } return metadata; }

Target:
public synchronized MetadataMap getMetadata() { if (metadata == null) { metadata = new MetadataMap(); } return metadata; }
Source:
private void performSimpleTest(HikariDataSource dataSource) throws SQLException { if (jdbcUrl.startsWith("jdbc:tc:db2:")) { return; } boolean result = new QueryRunner(dataSource, options.contains(Options.PmdKnownBroken)).query("SELECT 1", rs -> { rs.next(); int resultSetInt = rs.getInt(1); assertEquals("A basic SELECT query succeeds", 1, resultSetInt); return true; }); assertTrue("The database returned a record as expected", result); }

Target:
private void performSimpleTest(HikariDataSource dataSource) throws SQLException { String query = "SELECT 1"; if (jdbcUrl.startsWith("jdbc:tc:db2:")) { query = "SELECT 1 FROM SYSIBM.SYSDUMMY1"; } boolean result = new QueryRunner(dataSource, options.contains(Options.PmdKnownBroken)).query(query, rs -> { rs.next(); int resultSetInt = rs.getInt(1); assertEquals("A basic SELECT query succeeds", 1, resultSetInt); return true; }); assertTrue("The database returned a record as expected", result); }
Source:
private String convertPartitionKeyToString(Object partitionKey) { if (partitionKey instanceof String) { return (String) partitionKey; } else if (partitionKey instanceof byte[]) { return new String((byte[]) partitionKey); } else { throw new SamzaException("EventHub system producer doesn't support the key type"); } }

Target:
private String convertPartitionKeyToString(Object partitionKey) { if (partitionKey instanceof String) { return (String) partitionKey; } else if (partitionKey instanceof byte[]) { return new String((byte[]) partitionKey); } else { throw new SamzaException("Unsupported key type: " + partitionKey.getClass().toString()); } }
Source:
public String getText(Object object) { String label = ((DRepresentationDescriptor) object).getName(); if (label == null || label.length() == 0) { EObject objectToAdapt = ((DRepresentationDescriptor) object).getRepresentation(); if (objectToAdapt == null) { objectToAdapt = ((DRepresentationDescriptor) object).getDescription(); } if (objectToAdapt != null) { final IItemLabelProvider labelProvider = (IItemLabelProvider) getRootAdapterFactory().adapt(objectToAdapt, IItemLabelProvider.class); if (labelProvider != null) { label = labelProvider.getText(objectToAdapt); } } } return label; }

Target:
public String getText(Object object) { String label = ((DRepresentationDescriptor) object).getName(); if (label == null || label.isEmpty()) { EObject objectToAdapt = ((DRepresentationDescriptor) object).getRepresentation(); if (objectToAdapt == null) { objectToAdapt = ((DRepresentationDescriptor) object).getDescription(); } if (objectToAdapt != null) { final IItemLabelProvider labelProvider = (IItemLabelProvider) getRootAdapterFactory().adapt(objectToAdapt, IItemLabelProvider.class); if (labelProvider != null) { label = labelProvider.getText(objectToAdapt); } } } return label; }
Source:
public void initFromPage(int valueCount, ByteBuffer page, int offset) throws IOException { in = new ByteBufferInputStream(page.duplicate(), offset, page.limit() - offset); this.config = DeltaBinaryPackingConfig.readConfig(in); this.page = page; this.totalValueCount = BytesUtils.readUnsignedVarInt(in); allocateValuesBuffer(); bitWidths = new int[config.miniBlockNumInABlock]; valuesBuffer[valuesBuffered++] = BytesUtils.readZigZagVarInt(in); while (valuesBuffered < totalValueCount) { loadNewBlockToBuffer(); } this.nextOffset = page.limit() - in.available(); }

Target:
public void initFromPage(int valueCount, ByteBuffer page, int offset) throws IOException { in = new ByteBufferInputStream(page, offset, page.limit() - offset); this.config = DeltaBinaryPackingConfig.readConfig(in); this.page = page; this.totalValueCount = BytesUtils.readUnsignedVarInt(in); allocateValuesBuffer(); bitWidths = new int[config.miniBlockNumInABlock]; valuesBuffer[valuesBuffered++] = BytesUtils.readZigZagVarInt(in); while (valuesBuffered < totalValueCount) { loadNewBlockToBuffer(); } this.nextOffset = page.limit() - in.available(); }
Source:
public void nodeAssignmentSent(String node, boolean successful) { if (!blacklistSendAssignentFailures) { return; } if (!successful) { int failCount = assignmentFailures.getOrDefault(node, 0) + 1; assignmentFailures.put(node, failCount); } }

Target:
public void nodeAssignmentSent(String node, boolean successful) { if (!blacklistSendAssignentFailures) { return; } if (!successful) { synchronized (assignmentFailures) { int failCount = assignmentFailures.getOrDefault(node, 0) + 1; assignmentFailures.put(node, failCount); } } }
Source:
protected boolean migrateAllVms(ExecutionContext parentContext, boolean HAOnly) { boolean succeeded = true; for (VM vm : vms) { if (vm.isHostedEngine()) { if (!canScheduleVm(vm)) { succeeded = false; appendCustomCommaSeparatedValue("failedVms", vm.getName()); log.error("There is no host capable of running the hosted engine VM"); continue; } if (getVds().getStatus() == VDSStatus.NonOperational) { continue; } } if (vm.getStatus() != VMStatus.MigratingFrom && (!HAOnly || vm.isAutoStartup())) { if (!migrateVm(vm, parentContext)) { succeeded = false; appendCustomCommaSeparatedValue("failedVms", vm.getName()); log.error("Failed to migrate VM '{}'", vm.getName()); } } } return succeeded; }

Target:
protected boolean migrateAllVms(ExecutionContext parentContext, boolean HAOnly) { boolean succeeded = true; for (VM vm : vms) { if (vm.isHostedEngine() && getVds().getStatus() == VDSStatus.NonOperational) { continue; } if (vm.getStatus() != VMStatus.MigratingFrom && (!HAOnly || vm.isAutoStartup())) { if (!migrateVm(vm, parentContext)) { succeeded = false; appendCustomCommaSeparatedValue("failedVms", vm.getName()); log.error("Failed to migrate VM '{}'", vm.getName()); } } } return succeeded; }
Source:
private void buffer(Page page) { for (int position = 0; position < page.getPositionCount(); position++) { pageBuilder.declarePosition(); for (int channel = 0; channel < types.size(); channel++) { Type type = types.get(channel); type.appendTo(page.getBlock(channel), position, pageBuilder.getBlockBuilder(channel)); } } if (pageBuilder.isFull()) { flush(); } }

Target:
private void buffer(Page page) { pageBuilder.declarePositions(page.getPositionCount()); for (int channel = 0; channel < types.size(); channel++) { Type type = types.get(channel); for (int position = 0; position < page.getPositionCount(); position++) { type.appendTo(page.getBlock(channel), position, pageBuilder.getBlockBuilder(channel)); } } if (pageBuilder.isFull()) { flush(); } }
Source:
public void testTemplatedAliasDeclarationValueArgument() throws Exception { parseAndCheckBindings(); BindingAssertionHelper assertionHelper = getAssertionHelper(); ICPPField buff = assertionHelper.assertNonProblem("int buff [Size];", "buff", ICPPField.class); ICPPSpecialization buffRef = assertionHelper.assertNonProblem("myA.buff[0] = 1;", "buff", ICPPSpecialization.class); assertEquals(buff, buffRef.getSpecializedBinding()); assertEquals(buffRef.getTemplateParameterMap().getArgument(0).getNonTypeValue().numericalValue(), Long.valueOf(4)); assertEquals(buffRef.getTemplateParameterMap().getArgument(1).getNonTypeValue().numericalValue(), Long.valueOf(5)); }

Target:
public void testTemplatedAliasDeclarationValueArgument() throws Exception { parseAndCheckBindings(); BindingAssertionHelper assertionHelper = getAssertionHelper(); ICPPField buff = assertionHelper.assertNonProblem("int buff [Size];", "buff", ICPPField.class); ICPPSpecialization buffRef = assertionHelper.assertNonProblem("myA.buff[0] = 1;", "buff", ICPPSpecialization.class); assertEquals(buff, buffRef.getSpecializedBinding()); assertEquals(4L,buffRef.getTemplateParameterMap().getArgument(0).getNonTypeValue().numericalValue()); assertEquals(5L,buffRef.getTemplateParameterMap().getArgument(1).getNonTypeValue().numericalValue()); }