auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onBindViewHolder(@NonNull SyncedPatientsRecyclerViewAdapter.PatientViewHolder holder, final int position) { holder.update(mItems.get(position)); final Patient patient = mItems.get(position); if (null != patient.getIdentifier()) { String patientIdentifier = String.format(mContext.getResources().getString(R.string.patient_identifier), patient.getIdentifier().getIdentifier()); holder.mIdentifier.setText(patientIdentifier); } if (null != patient.getName()) { holder.mDisplayName.setText(patient.getName().getNameString()); } if (null != patient.getGender()) { if (patient.getPhoto()!=null ){ holder.mGender.setImageBitmap(patient.getPhoto()); } else { <START> if (patient.getGender().equals("M")) { <END> holder.mGender.setImageResource(R.drawable.patient_male); } else { holder.mGender.setImageResource(R.drawable.patient_female); } } } if (patient.getDead()) { holder.mRowLayout.setCardBackgroundColor(mContext.getResources().getColor(R.color.deceased_red)); } try { holder.mBirthDate.setText(DateUtils.convertTime(DateUtils.convertTime(patient.getBirthdate()))); } catch (Exception e) { holder.mBirthDate.setText(""); } }</code><technical_language>Move "M" "F" in application constants</technical_language>

Target:
public void onBindViewHolder(@NonNull SyncedPatientsRecyclerViewAdapter.PatientViewHolder holder, final int position) { holder.update(mItems.get(position)); final Patient patient = mItems.get(position); if (null != patient.getIdentifier()) { String patientIdentifier = String.format(mContext.getResources().getString(R.string.patient_identifier), patient.getIdentifier().getIdentifier()); holder.mIdentifier.setText(patientIdentifier); } if (null != patient.getName()) { holder.mDisplayName.setText(patient.getName().getNameString()); } if (null != patient.getGender()) { if (patient.getPhoto()!=null ){ holder.mGender.setImageBitmap(patient.getPhoto()); } else { if (patient.getGender().equals(ApplicationConstants.MALE)) { holder.mGender.setImageResource(R.drawable.patient_male); } else { holder.mGender.setImageResource(R.drawable.patient_female); } } } if (patient.isDeceased()) { holder.mRowLayout.setCardBackgroundColor(mContext.getResources().getColor(R.color.deceased_red)); } try { holder.mBirthDate.setText(DateUtils.convertTime(DateUtils.convertTime(patient.getBirthdate()))); } catch (Exception e) { holder.mBirthDate.setText(""); } }
Source:
<code>private String header(final Environment env) { final String name = env.param("license", "LICENSE.txt"); final URL url = CheckstyleValidator.toUrl(env, name); final String content; try { <START> content = IOUtils.toString( <END> url.openStream(), Charset.defaultCharset() ).trim().replaceAll("[\\r\\n]+$", ""); } catch (final IOException ex) { throw new IllegalStateException("Failed to read license", ex); } final StringBuilder builder = new StringBuilder(Tv.HUNDRED); final String eol = System.getProperty("line.separator"); builder.append(" "); final String license = builder.toString(); Logger.debug(this, "LICENSE found: %s", url); Logger.debug( this, "LICENSE full text after parsing:\n%s", license ); return license; }</code><technical_language>@korthout cactoos equivalent of trim replaceAll methods</technical_language>

Target:
private String header(final Environment env) { final String name = env.param("license", "LICENSE.txt"); final URL url = CheckstyleValidator.toUrl(env, name); final String content; try { content = new ReplacedText( new TrimmedText( new TextOf( url.openStream() ) ), "[\\r\\n]+$", "" ).asString(); } catch (final IOException ex) { throw new IllegalStateException("Failed to read license", ex); } final StringBuilder builder = new StringBuilder(Tv.HUNDRED); final String eol = System.getProperty("line.separator"); builder.append(" "); final String license = builder.toString(); Logger.debug(this, "LICENSE found: %s", url); Logger.debug( this, "LICENSE full text after parsing:\n%s", license ); return license; }
Source:
<code>public void dispose() { <START> this.mHandler.removeCallbacksAndMessages(null); <END> this.mHandler = null; this.mPhone = null; }</code><technical_language>this.mHandler.removeCallbacksAndMessages(null) instead. Done in Patch set 2</technical_language>

Target:
public void dispose() { }
Source:
<code>synchronized boolean onChannelClosed() throws IOException { numOpenChannels--; <START> <END> if (numBarriersReceived > 0) { resetReceivedBarriers(); notifyAbort(new CheckpointException(CheckpointFailureReason.CHECKPOINT_DECLINED_INPUT_END_OF_STREAM)); return true; } return false; }</code><technical_language>nit: weird newline</technical_language>

Target:
synchronized void onChannelClosed() throws IOException { numOpenChannels--; if (resetPendingCheckpoint()) { handler.notifyAbort( currentReceivedCheckpointId, new CheckpointException(CheckpointFailureReason.CHECKPOINT_DECLINED_INPUT_END_OF_STREAM)); } }
Source:
<code>protected void executeCommand() { try { boolean commandSucceeded = reconstructMaster(); connectAndRefreshAllUpHosts(commandSucceeded); if (!_isLastMaster && commandSucceeded) { SearchParameters p = new SearchParameters( MessageFormat.format(DesktopsInStoragePoolQuery, getStoragePool().getname()), SearchType.VM); p.setMaxCount(Integer.MAX_VALUE); @SuppressWarnings("unchecked") List<VM> vmsInPool = (List<VM>) Backend.getInstance() .runInternalQuery(VdcQueryType.Search, p).getReturnValue(); VmCommand.updateVmInSpm(getStoragePool().getId(), vmsInPool); } setSucceeded(commandSucceeded); } finally { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MarkPoolInReconstructMode, new MarkPoolInReconstructModeVDSCommandParameters(getStoragePoolId() .getValue(), ReconstructMarkAction.ClearCache)); } <START> IrsBrokerCommand.unLockIrsProxyData(getStoragePool().getId()); <END> }</code><technical_language>this finally block</technical_language>

Target:
protected void executeCommand() { try { boolean commandSucceeded = reconstructMaster(); connectAndRefreshAllUpHosts(commandSucceeded); if (!_isLastMaster && commandSucceeded) { SearchParameters p = new SearchParameters( MessageFormat.format(DesktopsInStoragePoolQuery, getStoragePool().getname()), SearchType.VM); p.setMaxCount(Integer.MAX_VALUE); @SuppressWarnings("unchecked") List<VM> vmsInPool = (List<VM>) Backend.getInstance() .runInternalQuery(VdcQueryType.Search, p).getReturnValue(); VmCommand.updateVmInSpm(getStoragePool().getId(), vmsInPool); } setSucceeded(commandSucceeded); } finally { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MarkPoolInReconstructMode, new MarkPoolInReconstructModeVDSCommandParameters(getStoragePoolId() .getValue(), ReconstructMarkAction.ClearCache)); IrsBrokerCommand.unLockIrsProxyData(getStoragePool().getId()); } }
Source:
<code>protected boolean isProcessed(String group, TopicPartition topicPartition, long offset) { Properties props = (Properties) consumerProps.clone(); props.put(ConsumerConfig.GROUP_ID_CONFIG, group); try (KafkaConsumer<String, Bytes> consumer = new KafkaConsumer<>(props)) { consumer.assign(Collections.singletonList(topicPartition)); long last = consumer.position(topicPartition); <START> boolean ret = (last > 0) && (last > offset); <END> if (log.isDebugEnabled()) { log.debug("isProcessed " + topicPartition.topic() + ":" + topicPartition.partition() + "/" + group + ":+" + offset + "? " + ret + ", current position: " + last); } return ret; } }</code><technical_language>need for parentheses</technical_language>

Target:
protected boolean isProcessed(String group, TopicPartition topicPartition, long offset) { Properties props = (Properties) consumerProps.clone(); props.put(ConsumerConfig.GROUP_ID_CONFIG, group); try (KafkaConsumer<String, Bytes> consumer = new KafkaConsumer<>(props)) { consumer.assign(Collections.singletonList(topicPartition)); long last = consumer.position(topicPartition); boolean ret = last > 0 && last > offset; if (log.isDebugEnabled()) { log.debug("isProcessed " + topicPartition.topic() + ":" + topicPartition.partition() + "/" + group + ":+" + offset + "? " + ret + ", current position: " + last); } return ret; } }
Source:
<code>private static void initQuotaSeverities() { mSeverities.put(AuditLogType.USER_ADD_QUOTA, AuditLogSeverity.NORMAL); mSeverities.put(AuditLogType.USER_UPDATE_QUOTA, AuditLogSeverity.NORMAL); <START> mSeverities.put(AuditLogType.USER_DELETE_QUOTA, AuditLogSeverity.NORMAL); <END> mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_VDS_GROUP_GRACE_LIMIT, AuditLogSeverity.ALERT); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_VDS_GROUP_LIMIT, AuditLogSeverity.ALERT); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_VDS_GROUP_THRESHOLD, AuditLogSeverity.WARNING); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_STORAGE_GRACE_LIMIT, AuditLogSeverity.ALERT); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_STORAGE_LIMIT, AuditLogSeverity.ALERT); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_STORAGE_THRESHOLD, AuditLogSeverity.WARNING); }</code><technical_language>severities for failures</technical_language>

Target:
private static void initQuotaSeverities() { mSeverities.put(AuditLogType.USER_ADD_QUOTA, AuditLogSeverity.NORMAL); mSeverities.put(AuditLogType.USER_FAILED_ADD_QUOTA, AuditLogSeverity.ERROR); mSeverities.put(AuditLogType.USER_UPDATE_QUOTA, AuditLogSeverity.NORMAL); mSeverities.put(AuditLogType.USER_FAILED_UPDATE_QUOTA, AuditLogSeverity.ERROR); mSeverities.put(AuditLogType.USER_DELETE_QUOTA, AuditLogSeverity.NORMAL); mSeverities.put(AuditLogType.USER_FAILED_DELETE_QUOTA, AuditLogSeverity.ERROR); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_VDS_GROUP_GRACE_LIMIT, AuditLogSeverity.ERROR); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_VDS_GROUP_LIMIT, AuditLogSeverity.ERROR); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_VDS_GROUP_THRESHOLD, AuditLogSeverity.WARNING); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_STORAGE_GRACE_LIMIT, AuditLogSeverity.ERROR); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_STORAGE_LIMIT, AuditLogSeverity.ERROR); mSeverities.put(AuditLogType.USER_EXCEEDED_QUOTA_STORAGE_THRESHOLD, AuditLogSeverity.WARNING); mSeverities.put(AuditLogType.USER_NOT_PERMITTED_TO_CONSUME_QUOTA, AuditLogSeverity.WARNING); }
Source:
<code>int blockFork() { int firstAIMark, firstAIMarkRow, firstAIMarkColumn; for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) { <START> if (fieldArray[i][j] != 0) continue; <END> fieldArray[i][j] = playerMark; firstAIMark = blockPlayerWin(); if (blockPlayerWin() >= 0) { firstAIMarkRow = firstAIMark / fieldSize; firstAIMarkColumn = firstAIMark % fieldSize; fieldArray[firstAIMarkRow][firstAIMarkColumn] = aIMark; } else { fieldArray[i][j] = 0; continue; } if (blockPlayerWin() >= 0) { fieldArray[firstAIMarkRow][firstAIMarkColumn] = 0; if (!autoGameEnabled) fieldArray[i][j] = aIMark; return (i * fieldSize + j); } fieldArray[i][j] = 0; fieldArray[firstAIMarkRow][firstAIMarkColumn] = 0; } return NOTHING_TO_PREVENT; }</code><technical_language>braces</technical_language>

Target:
int blockFork() { int firstAIMark, firstAIMarkRow, firstAIMarkColumn; for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) { if (fieldArray[i][j] != 0) { continue; } fieldArray[i][j] = playerMark; firstAIMark = blockPlayerWin(); if (blockPlayerWin() >= 0) { firstAIMarkRow = firstAIMark / fieldSize; firstAIMarkColumn = firstAIMark % fieldSize; fieldArray[firstAIMarkRow][firstAIMarkColumn] = aIMark; } else { fieldArray[i][j] = 0; continue; } if (blockPlayerWin() >= 0) { fieldArray[firstAIMarkRow][firstAIMarkColumn] = 0; if (!autoGameEnabled) { fieldArray[i][j] = aIMark; } return (i * fieldSize + j); } fieldArray[i][j] = 0; fieldArray[firstAIMarkRow][firstAIMarkColumn] = 0; } return NOTHING_TO_PREVENT; }
Source:
<code>public static MavenConfiguration getMavenConfig() { <START> return safetelyGetConfig(() -> mavenConfig); <END> }</code><technical_language>safetely -> safely</technical_language>

Target:
public static MavenConfiguration getMavenConfig() { return safelyGetConfig(() -> mavenConfig); }
Source:
<code>private void initSsl(Channel channel) { SslConfiguration ssl = configuration.security().ssl(); SSLContext jdkSslContext = ssl.sslContext(); if (jdkSslContext == null) { jdkSslContext = SslContextFactory.getContext( ssl.keyStoreFileName(), ssl.keyStoreType(), ssl.keyStorePassword(), ssl.keyStoreCertificatePassword(), ssl.keyAlias(), ssl.trustStoreFileName(), ssl.trustStoreType(), ssl.trustStorePassword(), ssl.protocol(), configuration.classLoader()); } <START> SslContext nettySslContext = new JdkSslContext(jdkSslContext, true, ClientAuth.NONE); <END> channel.pipeline().addFirst(nettySslContext.newHandler(channel.alloc(), ssl.sniHostName(), -1), SslHandshakeExceptionHandler.INSTANCE); }</code><technical_language>I a method called SslContext#newClientContext in Netty. here</technical_language>

Target:
private void initSsl(Channel channel) { SslConfiguration ssl = configuration.security().ssl(); SslContext nettySslContext; SSLContext jdkSslContext = ssl.sslContext(); if (jdkSslContext == null) { SslContextBuilder builder = SslContextBuilder.forClient(); try { if (ssl.keyStoreFileName() != null) { builder.keyManager(SslContextFactory.getKeyManagerFactory( ssl.keyStoreFileName(), ssl.keyStoreType(), ssl.keyStorePassword(), ssl.keyStoreCertificatePassword(), ssl.keyAlias(), configuration.classLoader())); } if (ssl.trustStoreFileName() != null) { builder.trustManager(SslContextFactory.getTrustManagerFactory( ssl.trustStoreFileName(), ssl.trustStoreType(), ssl.trustStorePassword(), configuration.classLoader())); } if (ssl.protocol() != null) { builder.protocols(ssl.protocol()); } nettySslContext = builder.build(); } catch (Exception e) { throw new CacheConfigurationException(e); } } else { nettySslContext = new JdkSslContext(jdkSslContext, true, ClientAuth.NONE); } SslHandler sslHandler = nettySslContext.newHandler(channel.alloc(), ssl.sniHostName(), -1); if (ssl.sniHostName() != null) { SSLParameters sslParameters = sslHandler.engine().getSSLParameters(); sslParameters.setServerNames(Collections.singletonList(new SNIHostName(ssl.sniHostName()))); sslHandler.engine().setSSLParameters(sslParameters); } channel.pipeline().addFirst(sslHandler, SslHandshakeExceptionHandler.INSTANCE); }
Source:
<code>public void verifyContributionQuestionDetails(int questionNum, FeedbackContributionQuestionDetails questionDetails) { if (questionDetails.isNotSureAllowed()) { assertTrue(getAllowNotSureConstributionCheckbox(questionNum).isSelected()); } else { assertFalse(getAllowNotSureConstributionCheckbox(questionNum).isSelected()); <START> } <END> }</code><technical_language>Alternatively: java assertEquals(questionDetails.isNotSureAllowed(), getAllowNotSureConstributionCheckbox(questionNum).isSelected());</technical_language>

Target:
public void verifyContributionQuestionDetails(int questionNum, FeedbackContributionQuestionDetails questionDetails) { assertEquals(questionDetails.isNotSureAllowed(), getAllowNotSureContributionCheckbox(questionNum).isSelected()); }
Source:
<code>static void initializeServer(Injector injector, Lifecycle lifecycle, final Server server) { JettyServerInitializer initializer = injector.getInstance(JettyServerInitializer.class); try { initializer.initialize(server, injector); } <START> catch (Exception e) { <END> throw new ProvisionException(e.getMessage()); } lifecycle.addHandler( new Lifecycle.Handler() { @Override public void start() throws Exception { server.start(); } @Override public void stop() { try { server.stop(); } catch (Exception e) { log.warn(e, "Unable to stop Jetty server."); } } } ); }</code><technical_language>This swallow interrupted exceptions, is needed catch exceptions here? Also, is a reason ProvisionException able a "caused by"</technical_language>

Target:
static void initializeServer(Injector injector, Lifecycle lifecycle, final Server server) { JettyServerInitializer initializer = injector.getInstance(JettyServerInitializer.class); try { initializer.initialize(server, injector); } catch (Exception e) { throw new RE(e, "server initialization exception"); } lifecycle.addHandler( new Lifecycle.Handler() { @Override public void start() throws Exception { server.start(); } @Override public void stop() { try { server.stop(); } catch (Exception e) { log.warn(e, "Unable to stop Jetty server."); } } } ); }
Source:
<code>public String toString() { <START> return String.format("Info{ containers = %d, images = %d, storageDriver = %s, " <END> + "driverStatus = %s, systemStatus = %s, cpus = %d, memTotal = %d, " + "name = %s, executionDriver = %s, kernelVersion = %s, debug = %b, " + "fileDescriptors = %d, goroutines = %d, eventsListener = %d, " + "initPath = %s, initSha1 = %s, indexServerAddress = %s, " + "memoryLimit = %b, swapLimit = %b", containers, images, storageDriver, driverStatus, systemStatus, cpus, memTotal, name, executionDriver, kernelVersion, debug, fileDescriptors, goroutines, eventsListener, initPath, initSha1, indexServerAddress, memoryLimit, swapLimit); }</code><technical_language>guava's MoreObjects.toStringHelper() here: java return MoreObjects.toStringHelper(this) .add("containers", containers) ... .toString();</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this).add("containers", containers).add("images", images) .add("storageDriver", storageDriver).add("driverStatus", driverStatus) .add("systemStatus", systemStatus).add("cpus", cpus).add("memTotal", memTotal) .add("name", name).add("executionDriver", executionDriver) .add("kernelVersion", kernelVersion).add("debug", debug) .add("fileDescriptors", fileDescriptors).add("goroutines", goroutines) .add("eventsListener", eventsListener).add("initPath", initPath).add("initSha1", initSha1) .add("indexServerAddress", indexServerAddress).add("memoryLimit", memoryLimit) .add("swapLimit", swapLimit).toString(); }
Source:
<code>public ArtifactDelta getDelta(InputStream baseline, InputStream reactor) throws IOException { TreeMap<String, ArtifactDelta> result = new TreeMap<String, ArtifactDelta>(); Properties props = new Properties(); props.load(baseline); Properties props2 = new Properties(); props2.load(reactor); Set<String> names = new LinkedHashSet<String>(); <START> names.addAll(props.stringPropertyNames()); <END> names.addAll(props2.stringPropertyNames()); for (String name : names) { String value = props.getProperty(name); if (value == null) { result.put(name, new SimpleArtifactDelta("not present in baseline version")); continue; } String value2 = props2.getProperty(name); if (value2 == null) { result.put(name, new SimpleArtifactDelta("present in baseline version only")); continue; } if (value != null ? !value.equals(value2) : value2 != null) { result.put(name, new SimpleArtifactDelta("baseline='" + value + "' != reactor='" + value2 + "'")); } } return !result.isEmpty() ? new CompoundArtifactDelta("properties files differ", result) : null; }</code><technical_language>stringPropertyNames() exists JDK 1.6 I impression require minimum JDK 1.5 for tycho. do want pull minimum JDK required for tycho 1.6</technical_language>

Target:
public ArtifactDelta getDelta(InputStream baseline, InputStream reactor) throws IOException { TreeMap<String, ArtifactDelta> result = new TreeMap<String, ArtifactDelta>(); Properties props = new Properties(); props.load(baseline); Properties props2 = new Properties(); props2.load(reactor); Set<String> names = new LinkedHashSet<String>(); addAll(names, props); addAll(names, props2); for (String name : names) { String value = props.getProperty(name); if (value == null) { result.put(name, new SimpleArtifactDelta("not present in baseline version")); continue; } String value2 = props2.getProperty(name); if (value2 == null) { result.put(name, new SimpleArtifactDelta("present in baseline version only")); continue; } if (value != null ? !value.equals(value2) : value2 != null) { result.put(name, new SimpleArtifactDelta("baseline='" + value + "' != reactor='" + value2 + "'")); } } return !result.isEmpty() ? new CompoundArtifactDelta("properties files differ", result) : null; }
Source:
<code>public static int resolveTextDirection (String text) { <START> return 0; <END> }</code><technical_language>Suggest replace with: return SWT.NONE;</technical_language>

Target:
public static int resolveTextDirection (String text) { return SWT.NONE; }
Source:
<code>public byte[] zip(Map<String, byte[]> dataMap) throws BridgeServiceException { if (dataMap == null) { throw new BadRequestException(String.format(Validate.CANNOT_BE_NULL, "dataMap")); <START> } <END> try (final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ZipOutputStream zos = new ZipOutputStream(baos)) { for (Map.Entry<String, byte[]> oneData : dataMap.entrySet()) { ZipEntry zipEntry = new ZipEntry(oneData.getKey()); zos.putNextEntry(zipEntry); zos.write(oneData.getValue()); zos.closeEntry(); } zos.flush(); return baos.toByteArray(); } catch (IOException ex) { throw new BridgeServiceException(ex); } }</code><technical_language>here. I reserve BRE for exceptions ultimately return HTTP error a user. clear if this is true not. elsewhere</technical_language>

Target:
public byte[] zip(Map<String, byte[]> dataMap) throws BridgeServiceException { checkNotNull(dataMap); try (final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ZipOutputStream zos = new ZipOutputStream(baos)) { for (Map.Entry<String, byte[]> oneData : dataMap.entrySet()) { ZipEntry zipEntry = new ZipEntry(oneData.getKey()); zos.putNextEntry(zipEntry); zos.write(oneData.getValue()); zos.closeEntry(); } zos.flush(); return baos.toByteArray(); } catch (IOException ex) { throw new BridgeServiceException(ex); } }
Source:
<code>public void updateIdentifiersDoNotOverwriteExistingIdentifiers() { mockHealthCodeAndAccountRetrieval(); account.setEmailVerified(Boolean.TRUE); account.setPhone(TestConstants.PHONE); account.setPhoneVerified(Boolean.TRUE); account.setExternalId(EXTERNAL_ID); when(accountDao.authenticate(STUDY, PHONE_PASSWORD_SIGN_IN)).thenReturn(account); when(accountDao.getAccount(any())).thenReturn(account); IdentifierUpdate update = new IdentifierUpdate(PHONE_PASSWORD_SIGN_IN, "updated@email.com", <START> new Phone("4082588569", "US"), EXTERNAL_ID); <END> participantService.updateIdentifiers(STUDY, CONTEXT, update); assertEquals(EMAIL, account.getEmail()); assertEquals(Boolean.TRUE, account.getEmailVerified()); assertEquals(TestConstants.PHONE, account.getPhone()); assertEquals(Boolean.TRUE, account.getPhoneVerified()); assertEquals(EXTERNAL_ID, account.getExternalId()); verify(accountDao, never()).updateAccount(any(), eq(false)); verify(accountWorkflowService, never()).sendEmailVerificationToken(any(), any(), any()); }</code><technical_language>this a external ID? Otherwise, distinguish "we overwrite external ID" "we overwrote external ID value"</technical_language>

Target:
public void updateIdentifiersDoNotOverwriteExistingIdentifiers() { mockHealthCodeAndAccountRetrieval(); account.setEmailVerified(Boolean.TRUE); account.setPhone(TestConstants.PHONE); account.setPhoneVerified(Boolean.TRUE); account.setExternalId(EXTERNAL_ID); when(accountDao.authenticate(STUDY, PHONE_PASSWORD_SIGN_IN)).thenReturn(account); when(accountDao.getAccount(any())).thenReturn(account); IdentifierUpdate update = new IdentifierUpdate(PHONE_PASSWORD_SIGN_IN, "updated@email.com", new Phone("4082588569", "US"), "newExternalId"); participantService.updateIdentifiers(STUDY, CONTEXT, update); assertEquals(EMAIL, account.getEmail()); assertEquals(Boolean.TRUE, account.getEmailVerified()); assertEquals(TestConstants.PHONE, account.getPhone()); assertEquals(Boolean.TRUE, account.getPhoneVerified()); assertEquals(EXTERNAL_ID, account.getExternalId()); verify(accountDao, never()).updateAccount(any(), Mockito.anyBoolean()); verify(accountWorkflowService, never()).sendEmailVerificationToken(any(), any(), any()); verify(externalIdService, never()).assignExternalId(STUDY, account.getExternalId(), account.getHealthCode()); }
Source:
<code>private void checkWeakProtocol(ExpressionTree expressionTree, String functionName) { <START> Stream<ExpressionTree> expressionTrees = expressionTree.is(Tree.Kind.BITWISE_OR) <END> ? getOperands((BinaryExpressionTree) expressionTree) : Stream.of(expressionTree); expressionTrees.forEach(value -> { if (value.is(Tree.Kind.NAMESPACE_NAME)) { NamespaceNameTree cryptoMethod = (NamespaceNameTree) value; List<String> weakProtocols = WEAK_PROTOCOLS.get(functionName); if (weakProtocols != null && weakProtocols.contains(cryptoMethod.name().text())) { context().newIssue(this, cryptoMethod, MESSAGE); } } }); }</code><technical_language>nitpick: rename expressionTrees protocols (and protocol)</technical_language>

Target:
private void checkWeakProtocol(ExpressionTree expressionTree, String functionName) { Stream<ExpressionTree> protocols = expressionTree.is(Tree.Kind.BITWISE_OR) ? getOperands((BinaryExpressionTree) expressionTree) : Stream.of(expressionTree); List<String> weakProtocols = WEAK_PROTOCOLS.get(functionName); if (weakProtocols != null) { protocols.forEach(protocol -> { if (protocol.is(Tree.Kind.NAMESPACE_NAME)) { NamespaceNameTree cryptoMethod = (NamespaceNameTree) protocol; if (weakProtocols.contains(cryptoMethod.name().text())) { context().newIssue(this, cryptoMethod, MESSAGE); } } }); } }
Source:
<code>protected void InitDetailModels() { super.InitDetailModels(); ObservableCollection<EntityModel> list = new ObservableCollection<EntityModel>(); list.add(new ClusterGeneralModel()); list.add(new ClusterNetworkListModel()); list.add(new ClusterHostListModel()); list.add(new ClusterVmListModel()); <START> list.add(new ClusterServiceModel()); <END> list.add(new PermissionListModel()); setDetailModels(list); }</code><technical_language>create a member for ClusterServiceModel</technical_language>

Target:
protected void InitDetailModels() { super.InitDetailModels(); setClusterServiceModel(new ClusterServiceModel()); ObservableCollection<EntityModel> list = new ObservableCollection<EntityModel>(); list.add(new ClusterGeneralModel()); list.add(new ClusterNetworkListModel()); list.add(new ClusterHostListModel()); list.add(new ClusterVmListModel()); list.add(getClusterServiceModel()); list.add(new PermissionListModel()); setDetailModels(list); }
Source:
<code>public void setup_shouldInstallServerWithGivenJdkAndCreateSdkPropertiesFileIfNotExist() throws Exception{ String serverId = UUID.randomUUID().toString(); addTaskParam("serverId", serverId); executeTask("setup"); assertSuccess(); <START> assertServerInstalled(serverId); <END> assertFilePresent("/sdk.properties"); }</code><technical_language>check java.home set set in openmrs-server.properties..</technical_language>

Target:
public void setup_shouldInstallServerWithGivenJdkAndCreateSdkPropertiesFileIfNotExist() throws Exception{ String serverId = UUID.randomUUID().toString(); addTaskParam("serverId", serverId); executeTask("setup"); assertSuccess(); assertServerInstalled(serverId); assertFilePresent(serverId + File.separator + "openmrs-server.properties"); File serverPropertiesFile = new File(testDirectory.getAbsolutePath() + File.separator + serverId, "openmrs-server.properties"); String javaHomeServerProperty = readValueFromPropertyKey(serverPropertiesFile, "java.home"); String defaultJavaHome = System.getProperty("java.home"); assertThat(defaultJavaHome, is(javaHomeServerProperty)); assertFilePresent("/sdk.properties"); }
Source:
<code>public boolean provides(String pageId) { <START> if (DefaultSessionEditorPage.PAGE_ID.equals(pageId)) { return true; } return false; <END> }</code><technical_language>"return DefaultSessionEditorPage.PAGE_ID.equals(pageId)"</technical_language>

Target:
public boolean provides(String pageId) { return DefaultSessionEditorPage.PAGE_ID.equals(pageId); }
Source:
<code>protected void doAsyncAddEntry(final PendingAddOp op) { if (throttler != null) { throttler.acquire(); } boolean wasClosed = false; synchronized (this) { if (metadata.isClosed()) { wasClosed = true; } else { long currentLength = addToLength(op.payload.readableBytes()); op.setLedgerLength(currentLength); pendingAddOps.add(op); } } if (wasClosed) { try { bk.getMainWorkerPool().submit(new SafeRunnable() { @Override public void safeRun() { LOG.warn("Attempt to add to closed ledger: {}", ledgerId); op.cb.addComplete(BKException.Code.LedgerClosedException, LedgerHandleAdv.this, op.getEntryId(), op.ctx); } @Override public String toString() { return String.format("AsyncAddEntryToClosedLedger(lid=%d)", ledgerId); } }); } catch (RejectedExecutionException e) { op.cb.addComplete(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandleAdv.this, op.getEntryId(), op.ctx); } return; } if (!waitForWritable(distributionSchedule.getWriteSet(op.getEntryId()), <START> op.getEntryId(), 0, waitForWriteSetMs)) { <END> op.allowFastFailOnBlockedServer(); } try { bk.getMainWorkerPool().submitOrdered(ledgerId, op); } catch (RejectedExecutionException e) { op.cb.addComplete(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandleAdv.this, op.getEntryId(), op.ctx); } }</code><technical_language>need is AQ channels, right</technical_language>

Target:
protected void doAsyncAddEntry(final PendingAddOp op) { if (throttler != null) { throttler.acquire(); } boolean wasClosed = false; synchronized (this) { if (metadata.isClosed()) { wasClosed = true; } else { long currentLength = addToLength(op.payload.readableBytes()); op.setLedgerLength(currentLength); pendingAddOps.add(op); } } if (wasClosed) { try { bk.getMainWorkerPool().submit(new SafeRunnable() { @Override public void safeRun() { LOG.warn("Attempt to add to closed ledger: {}", ledgerId); op.cb.addCompleteWithLatency(BKException.Code.LedgerClosedException, LedgerHandleAdv.this, op.getEntryId(), 0, op.ctx); } @Override public String toString() { return String.format("AsyncAddEntryToClosedLedger(lid=%d)", ledgerId); } }); } catch (RejectedExecutionException e) { op.cb.addCompleteWithLatency(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandleAdv.this, op.getEntryId(), 0, op.ctx); } return; } if (!waitForWritable(distributionSchedule.getWriteSet(op.getEntryId()), op.getEntryId(), 0, waitForWriteSetMs)) { op.allowFailFastOnUnwritableChannel(); } try { bk.getMainWorkerPool().executeOrdered(ledgerId, op); } catch (RejectedExecutionException e) { op.cb.addCompleteWithLatency(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandleAdv.this, op.getEntryId(), 0, op.ctx); } }
Source:
<code>public void doRun() { final List<ILinkEvent> links = new ArrayList<>(); final List<IMarkerEvent> markers = new ArrayList<>(); if (fClearZoomedLists) { clearZoomedLists(); } for (ITmfStateSystem ss : fZoomSSList) { List<TimeGraphEntry> entryList = null; synchronized (fSSEntryListMap) { entryList = fSSEntryListMap.get(ss); } if (entryList != null) { zoomByTime(ss, entryList, links, markers, getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor()); } } if (!getMonitor().isCanceled()) { markers.addAll(getTraceMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor())); applyResults(() -> { getTimeGraphViewer().setLinks(links); getTimeGraphViewer().setMarkers(markers); }); } else { <START> getLogger().info(() -> "[zoom thread canceled]"); END> } }</code><technical_language>Instead of getLogger(), define a static LOGGER usual, this class's name. happen Logger object super.fLogger, this class that</technical_language>

Target:
public void doRun() { final List<ILinkEvent> links = new ArrayList<>(); final List<IMarkerEvent> markers = new ArrayList<>(); if (fClearZoomedLists) { clearZoomedLists(); } for (ITmfStateSystem ss : fZoomSSList) { List<TimeGraphEntry> entryList = null; synchronized (fSSEntryListMap) { entryList = fSSEntryListMap.get(ss); } if (entryList != null) { zoomByTime(ss, entryList, links, markers, getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor()); } } if (!getMonitor().isCanceled()) { markers.addAll(getTraceMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor())); applyResults(() -> { getTimeGraphViewer().setLinks(links); getTimeGraphViewer().setMarkers(markers); }); } else { LOGGER.info(() -> "[ZoomThreadCanceled]"); } }
Source:
<code>public void testConnectionLossWhileCreateEphemeral() throws Exception { final String methodName = TestHelper.getTestMethodName(); final ZkClient zkClient = new ZkClient.Builder() .setZkServer(ZK_ADDR) .setOperationRetryTimeout(3000L) .build(); final String expectedSessionId = zkClient.getHexSessionId(); final String path = "/" + methodName; final String data = "data"; Assert.assertFalse(zkClient.exists(path)); TestHelper.stopZkServer(_zkServer); try { final CountDownLatch countDownLatch = new CountDownLatch(1); final AtomicBoolean running = new AtomicBoolean(true); final Thread creationThread = new Thread(() -> { while (running.get()) { try { zkClient.createEphemeral(path, data, expectedSessionId); <START> } catch (ZkTimeoutException e) { <END> if (e.getMessage().endsWith("Retry was caused by " + KeeperException.ConnectionLossException.Code.CONNECTIONLOSS)) { running.set(false); } } } countDownLatch.countDown(); }); creationThread.start(); final boolean creationThreadTerminated = countDownLatch.await(10L, TimeUnit.SECONDS); if (!creationThreadTerminated) { running.set(false); creationThread.join(5000L); Assert.fail("Failed to receive a ConnectionLossException after zookeeper has shutdown."); } } finally { zkClient.close(); _zkServer.start(); } }</code><technical_language>connectionloss keeper exception get converted ZKTimeoutException</technical_language>

Target:
public void testConnectionLossWhileCreateEphemeral() throws Exception { final String methodName = TestHelper.getTestMethodName(); final ZkClient zkClient = new ZkClient.Builder() .setZkServer(ZK_ADDR) .setOperationRetryTimeout(3000L) .build(); final String expectedSessionId = ZKUtil.toHexSessionId(zkClient.getSessionId()); final String path = "/" + methodName; final String data = "data"; Assert.assertFalse(zkClient.exists(path)); TestHelper.stopZkServer(_zkServer); try { final CountDownLatch countDownLatch = new CountDownLatch(1); final AtomicBoolean running = new AtomicBoolean(true); final Thread creationThread = new Thread(() -> { while (running.get()) { try { zkClient.createEphemeral(path, data, expectedSessionId); } catch (ZkTimeoutException e) { if (e.getMessage().endsWith("Retry was caused by " + KeeperException.ConnectionLossException.Code.CONNECTIONLOSS)) { running.set(false); } } } countDownLatch.countDown(); }); creationThread.start(); final boolean creationThreadTerminated = countDownLatch.await(10L, TimeUnit.SECONDS); if (!creationThreadTerminated) { running.set(false); creationThread.join(5000L); Assert.fail("Failed to receive a ConnectionLossException after zookeeper has shutdown."); } } finally { zkClient.close(); _zkServer.start(); } }
Source:
<code><START> public void removeFile(final String fileName) { <END> fParentFiles.remove(fileName); startUpdateTask(Messages.BatchImportTraceWizard_remove + " " + fileName, null); }</code><technical_language>pressing remove button, directory is removed. In case directory</technical_language>

Target:
public void removeFile(final String fileName) { fParentFiles.remove(fileName); fParentFilesToScan.remove(fileName); startUpdateTask(Messages.BatchImportTraceWizard_remove + " " + fileName, null); }
Source:
<code>public void someDataPointsTest() { final Long surveyId = 100L; final List<SurveyedLocale> dataPoints = createDataPoints(surveyId, 10); final SurveyedLocale dataPoint = dataPoints.get(7); <START> assertEquals("7", dataPoint.getIdentifier()); <END> final List<Long> selectedDataPointIds = Arrays.asList(dataPoints.get(5).getKey().getId(), dataPoints.get(6).getKey().getId()); final Long assignmentId = 20L; final Long deviceId = 1L; createDataPointAssignment(assignmentId, deviceId, selectedDataPointIds, surveyId); final DataPointServlet servlet = new DataPointServlet(); final List<SurveyedLocale> someDataPoints = servlet.getDataPointList(surveyId, deviceId); final Set<Long> selectedIds = new HashSet<>(selectedDataPointIds); final Set<Long> foundIds = getEntityIds(someDataPoints); assertEquals(selectedIds, foundIds); }</code><technical_language>is this important for this test</technical_language>

Target:
public void someDataPointsTest() { final Long surveyId = randomId(); final List<SurveyedLocale> dataPoints = createDataPoints(surveyId, 10); final List<Long> selectedDataPointIds = dataPoints.stream() .filter(surveyedLocale -> surveyedLocale.getKey().getId() % 2 == 0) .map(surveyedLocale -> surveyedLocale.getKey().getId()) .collect(Collectors.toList()); final Long assignmentId = randomId(); final Long deviceId = randomId(); createDataPointAssignment(assignmentId, deviceId, selectedDataPointIds, surveyId); final DataPointServlet servlet = new DataPointServlet(); final List<SurveyedLocale> someDataPoints = servlet.getDataPointList(surveyId, deviceId); final Set<Long> selectedIds = new HashSet<>(selectedDataPointIds); final Set<Long> foundIds = getEntityIds(someDataPoints); assertEquals(selectedIds, foundIds); }
Source:
<code>private Byte[] removeCommentsFromTemplate(Byte[] data) { byte[] bytes = new byte[data.length]; int i = 0; for (Byte b : data) { <START> bytes[i++] = b.byteValue(); <END> } String templateString = new String(bytes); Pattern regex = Pattern.compile("(?s)<!--.*?-->", Pattern.DOTALL); Matcher regexMatcher = regex.matcher(templateString); templateString = regexMatcher.replaceAll(""); templateString.replaceAll("(?s)<!--.*?-->", ""); bytes = templateString.getBytes(); Byte[] byteObjects = new Byte[bytes.length]; i = 0; for (byte b : bytes) { byteObjects[i++] = new Byte(b); } return byteObjects; }</code><technical_language>byteValue() is redundant</technical_language>

Target:
private Byte[] removeCommentsFromTemplate(Byte[] data) { byte[] bytes = new byte[data.length]; int i = 0; for (Byte b : data) { bytes[i++] = b; } String templateString = new String(bytes); Pattern regex = Pattern.compile("(?s)<!--.*?-->", Pattern.DOTALL); Matcher regexMatcher = regex.matcher(templateString); templateString = regexMatcher.replaceAll(""); bytes = templateString.getBytes(); Byte[] byteObjects = new Byte[bytes.length]; i = 0; for (byte b : bytes) { byteObjects[i++] = b; } return byteObjects; }
Source:
<code>public double scoreSplit(ClassificationCounter a, ClassificationCounter b) { Pair pair = Pair.with(a, b); Double score = scores.get(pair); if (score == null) { score = scorer.scoreSplit(a, b); scores.put(pair, score); <START> if (scores.size() > maxEntries) { <END> scores.clear(); } } return score; }</code><technical_language>a [Guava Cache](<LINK_0> more here</technical_language>

Target:
public double scoreSplit(ClassificationCounter a, ClassificationCounter b) { Pair pair = Pair.with(a, b); try { return scores.get(pair); } catch (ExecutionException e) { return Double.MIN_VALUE; } }
Source:
<code>private static String testUpdateClientAssociations(Client client) throws MambuApiException { String methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); client.setAssignedBranchKey(DemoUtil.getDemoClient().getAssignedBranchKey()); client.setAssignedCentreKey(DemoUtil.getDemoClient().getAssignedCentreKey()); client.setAssignedUserKey(DemoUtil.getDemoClient().getAssignedUserKey()); client.setFirstName(null); client.setLastName(null); client.setMiddleName(null); client.setEmailAddress(null); client.setMobilePhone1(null); client.setHomePhone(null); client.setState(null); client.setClientRole(null); client.setId(null); client.setPreferredLanguage(null); client.setBirthDate(null); ClientsService clientService = MambuAPIFactory.getClientService(); boolean status = clientService.patchClient(client); System.out.println("Update status=" + status); Client updatedClient = clientService.getClient(client.getEncodedKey()); String updatedId = updatedClient.getId(); System.out.println("\tUpdate AssignedBranchKey=" + updatedClient.getAssignedBranchKey() + "\tAssignedCentreKey=" + updatedClient.getAssignedCentreKey() + "\tAssignedUserKey=" + updatedClient.getAssignedUserKey()); <START> return updatedId; <END> }</code><technical_language>reason for returning this? Do this id in a future test</technical_language>

Target:
private static void testUpdateClientAssociations(Client client) throws MambuApiException { String methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); client.setAssignedBranchKey(DemoUtil.getDemoClient().getAssignedBranchKey()); client.setAssignedCentreKey(DemoUtil.getDemoClient().getAssignedCentreKey()); client.setAssignedUserKey(DemoUtil.getDemoClient().getAssignedUserKey()); client.setFirstName(null); client.setLastName(null); client.setMiddleName(null); client.setEmailAddress(null); client.setMobilePhone1(null); client.setHomePhone(null); client.setState(null); client.setClientRole(null); client.setId(null); client.setPreferredLanguage(null); client.setBirthDate(null); ClientsService clientService = MambuAPIFactory.getClientService(); boolean status = clientService.patchClient(client); System.out.println("Update status=" + status); Client updatedClient = clientService.getClient(client.getEncodedKey()); System.out.println("\tUpdate AssignedBranchKey=" + updatedClient.getAssignedBranchKey() + "\tAssignedCentreKey=" + updatedClient.getAssignedCentreKey() + "\tAssignedUserKey=" + updatedClient.getAssignedUserKey()); }
Source:
<code>public void testEAPStandaloneHornetQCollocatedXml() throws Exception { for (Version version : EAP_VERSIONS) { switch (version) { case EAP_6_0_0: case EAP_6_1_0: case EAP_6_2_0: <START> case EAP_6_3_0: <END> ModelNode model = standaloneXmlTest(getLegacyConfigFile("standalone", version, "hornetq-colocated")); validateWebSubsystem(model, version); validateJsfSubsystem(model, version); validateMessagingSubsystem(model, version); validateThreadsSubsystem(model, version); validateJacordSubsystem(model, version); break; default: } } }</code><technical_language>EAP_6_4_0</technical_language>

Target:
public void testEAPStandaloneHornetQCollocatedXml() throws Exception { for (Version version : EAP_VERSIONS) { if (version.is6x()) { ModelNode model = standaloneXmlTest(getLegacyConfigFile("standalone", version, "hornetq-colocated")); validateWebSubsystem(model, version); validateJsfSubsystem(model, version); validateMessagingSubsystem(model, version); validateThreadsSubsystem(model, version); validateJacordSubsystem(model, version); } } }
Source:
<code><START> public void addProcessorEntity(String jmVersion, String pid, boolean isLeader) { <END> ProcessorEntity entity = new ProcessorEntity(jmVersion, pid); entity.setIsLeader(isLeader); Random rand = new Random(); entity.setLiveness(rand.nextInt(10000) + 2); TableOperation add = TableOperation.insert(entity); try { table.execute(add); } catch (StorageException e) { LOG.error("Azure storage exception while adding processor entity with job model version: " + jmVersion + "and pid: " + pid, e); throw new AzureException(e); } }</code><technical_language>reminder: add some docs explaining of liveness variable</technical_language>

Target:
public void addProcessorEntity(String jmVersion, String pid, boolean isLeader) { ProcessorEntity entity = new ProcessorEntity(jmVersion, pid); entity.setIsLeader(isLeader); entity.updateLiveness(); TableOperation add = TableOperation.insert(entity); try { table.execute(add); } catch (StorageException e) { LOG.error("Azure storage exception while adding processor entity with job model version: " + jmVersion + "and pid: " + pid, e); throw new AzureException(e); } }
Source:
<code>protected final void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException { <START> if (!acceptsJson(req)) { <END> handleError(new InvalidTokenException(), req, res); return; } JsonParser parser = new JsonParser(); JsonObject json = (JsonObject) parser.parse(req.getReader()); String tokenString = json.get("token").getAsString(); ParsedToken token; try { token = verifier.decode(tokenString); } catch (InvalidTokenException err) { handleError(err, req, res); return; } CurrentUser user = currentUser.get(); if (user instanceof IdentifiedUser) { Account.Id userId = ((IdentifiedUser) user).getAccountId(); if (!token.getAccountId().equals(userId) || !token.getUrl().equals(getReqUrl(req))) { handleError(new InvalidTokenException(), req, res); return; } doRequest(req, res); } else { res.sendError(HttpServletResponse.SC_UNAUTHORIZED); } }</code><technical_language>This a hard failure POST. client expected a text formatted reply operation making. force accept JSON. wanted test Content-Type is JSON. testing here</technical_language>

Target:
protected final void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException { JsonParser parser = new JsonParser(); JsonObject json = (JsonObject) parser.parse(req.getReader()); String tokenString = json.get("_authKey").getAsString(); CurrentUser user = currentUser.get(); Account.Id userId; if (user instanceof IdentifiedUser) { userId = ((IdentifiedUser) user).getAccountId(); } else { res.sendError(HttpServletResponse.SC_UNAUTHORIZED); return; } try { verifier.verify(userId, getReqUrl(req), tokenString); } catch (InvalidTokenException err) { handleError(err, req, res); return; } doRequest(req, res, json); }
Source:
<code>private static Object getColumnValue(String columnName, com.datastax.driver.core.Row row) { ColumnDefinitions columns = row.getColumnDefinitions(); DataType columnType = columns.getType(columnName); switch (columnType.getName()) { case BIGINT: return row.getVarint(columnName); case BOOLEAN: return row.getBool(columnName); case DECIMAL: return row.getDecimal(columnName); case DOUBLE: return row.getDouble(columnName); case FLOAT: return row.getFloat(columnName); case INET: return row.getInet(columnName); case INT: return row.getInt(columnName); <START> case UUID: return row.getUUID(columnName); <END> case TIMESTAMP: return row.getDate(columnName); case LIST: return row.getList(columnName, String.class); case SET: return row.getSet(columnName, String.class); case MAP: return row.getMap(columnName, String.class, String.class); default: return row.getString(columnName); } }</code><technical_language>return a UUID instance, while ColumnType STRING. I suggest create a UUID ColumnType corresponds expected type. principle applies other column types ... Set, Map, Inet more</technical_language>

Target:
private static Object getColumnValue(String columnName, com.datastax.driver.core.Row row) { ColumnDefinitions columns = row.getColumnDefinitions(); DataType columnType = columns.getType(columnName); switch (columnType.getName()) { case BIGINT: return row.getVarint(columnName); case BLOB: return row.getBytes(columnName); case BOOLEAN: return row.getBool(columnName); case DECIMAL: return row.getDecimal(columnName); case DOUBLE: return row.getDouble(columnName); case FLOAT: return row.getFloat(columnName); case INT: return row.getInt(columnName); case TEXT: return row.getString(columnName); case TIMESTAMP: return row.getDate(columnName); case UUID: return row.getUUID(columnName); case VARCHAR: return row.getString(columnName); case VARINT: return row.getVarint(columnName); case LIST: return row.getList(columnName, List.class); case MAP: return row.getMap(columnName, Map.class, String.class); case SET: return row.getSet(columnName, Set.class); case INET: return row.getInet(columnName); default: return row.getString(columnName); } }
Source:
<code>private int getClassPriority(IMethodInstance mi) { int result = 0; Method method = mi.getMethod().getMethod(); Class<?> cls = method.getDeclaringClass(); Priority classPriority = cls.getAnnotation(Priority.class); if (classPriority != null) { result = classPriority.value(); } <START> return result; <END> }</code><technical_language>variable result unnecessary here</technical_language>

Target:
private int getClassPriority(IMethodInstance mi) { Class<?> cls = getDeclaringClassOfMethod(mi); Priority classPriority = cls.getAnnotation(Priority.class); if (classPriority != null) { return classPriority.value(); } return 0; }