auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testDelimiterList() throws InterruptedException { <START> final String containerName = getScratchContainerName(); <END> BlobStore blobStore = view.getBlobStore(); String payload = "foo"; try { createContainer(containerName, defaultLocation); blobStore.putBlob(containerName, blobStore.blobBuilder("test/foo/foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("test/bar/foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("foo").payload(payload).build()); checkListedSet(ImmutableSet.of("foo", "test"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter('/'))); checkListedSet(ImmutableSet.of("test/foo/foo", "test/bar/foo", "foo"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter('\\'))); checkListedSet(ImmutableSet.of("test/foo", "test/bar"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter('/').inDirectory("test"))); checkListedSet(ImmutableSet.of("test/bar/foo"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter('/').inDirectory("test/bar"))); } finally { recycleContainerAndAddToPool(containerName); } }</code><technical_language>Do want getScratchContainerName simply getContainerName? recycled containers instead of allocating a new one</technical_language>

Target:
public void testDelimiterList() throws InterruptedException { final String containerName = getContainerName(); BlobStore blobStore = view.getBlobStore(); String payload = "foo"; try { blobStore.putBlob(containerName, blobStore.blobBuilder("test/foo/foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("test/bar/foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("test-foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("test-bar").payload(payload).build()); checkEqualNames(ImmutableSet.of("foo", "test/", "test-foo", "test-bar"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter("/"))); checkEqualNames(ImmutableSet.of("test/foo/foo", "test/bar/foo", "foo", "test-foo", "test-bar"), blobStore.list(containerName, ListContainerOptions.Builder.delimiter("\\"))); checkEqualNames(ImmutableSet.of("test-", "test/foo/foo", "test/bar/foo", "foo"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter("-"))); } finally { returnContainer(containerName); } }
Source:
<code>public ConceptV5 getByIdWithLicenseCheck(Long id) { ConceptV5 conceptV5 = conceptRepository.findOne(id); <START> if (!checkLicense(conceptV5)) { <END> throw new PermissionDeniedException(); } return conceptV5; }</code><technical_language>repetitive check? done annotation</technical_language>

Target:
public ConceptV5 getByIdWithLicenseCheck(Long id) { return conceptRepository.findOne(id); }
Source:
<code>public void testRenameType() throws Exception { String xsltTemplate = ResourceUtils.create(XsltTransformerTest.class).getResourceAsString("classpath://brooklyn/entity/rebind/transformer/renameType.xslt"); String xslt = TemplateProcessor.processTemplateContents(xsltTemplate, ImmutableMap.of("old_val", "mytype.Before", "new_val", "mytype.After")); String input = <START> "<entity myattrib=\"myval\">"+NL+ <END> " <type myattrib2=\"myval2\">mytype.Before</type>"+NL+ " <nested>"+NL+ " <type myattrib3=\"myval3\">doesNotMatch</type>"+NL+ " <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NL+ " <type myattrib5=\"myval5\">mytype.Before</type>"+NL+ " </nested>"+NL+ " <id>myid</id>"+NL+ "</entity>"; String expected = "<entity myattrib=\"myval\">"+NL+ " <type myattrib2=\"myval2\">mytype.After</type>"+NL+ " <nested>"+NL+ " <type myattrib3=\"myval3\">doesNotMatch</type>"+NL+ " <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NL+ " <type myattrib5=\"myval5\">mytype.After</type>"+NL+ " </nested>"+NL+ " <id>myid</id>"+NL+ "</entity>"; XsltTransformer transformer = new XsltTransformer(xslt); String result = transformer.transform(input); assertEquals(result, expected); }</code><technical_language>do strings need newline separators? test change if XML is collapsed</technical_language>

Target:
public void testRenameType() throws Exception { String xsltTemplate = ResourceUtils.create(XsltTransformerTest.class).getResourceAsString("classpath://brooklyn/entity/rebind/transformer/renameType.xslt"); String xslt = TemplateProcessor.processTemplateContents(xsltTemplate, ImmutableMap.of("old_val", "mytype.Before", "new_val", "mytype.After")); String input = "<entity myattrib=\"myval\">"+NEWLINE+ " <type myattrib2=\"myval2\">mytype.Before</type>"+NEWLINE+ " <nested>"+NEWLINE+ " <type myattrib3=\"myval3\">doesNotMatch</type>"+NEWLINE+ " <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NEWLINE+ " <type myattrib5=\"myval5\">mytype.Before</type>"+NEWLINE+ " </nested>"+NEWLINE+ " <id>myid</id>"+NEWLINE+ "</entity>"; String expected = "<entity myattrib=\"myval\">"+NEWLINE+ " <type myattrib2=\"myval2\">mytype.After</type>"+NEWLINE+ " <nested>"+NEWLINE+ " <type myattrib3=\"myval3\">doesNotMatch</type>"+NEWLINE+ " <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NEWLINE+ " <type myattrib5=\"myval5\">mytype.After</type>"+NEWLINE+ " </nested>"+NEWLINE+ " <id>myid</id>"+NEWLINE+ "</entity>"; XsltTransformer transformer = new XsltTransformer(xslt); String result = transformer.transform(input); assertEquals(result, expected); }
Source:
<code>public <E> Optional<E> getOptional(String key, TypeReference<E> type) { <START> return (Optional<E>) Optional.fromNullable(get(key, mapper.getTypeFactory().constructType(type), null)); <END> }</code><technical_language>I guess change behavior of method. Config class is widely project in users side. (Users create customized DigdagServer DigdagEmbed class) I hope fixing in bq_load operator adding another method Config class getOptionalFromNullable()</technical_language>

Target:
public <E> Optional<E> getOptional(String key, TypeReference<E> type) { return (Optional<E>) get(key, mapper.getTypeFactory().constructType(type), Optional.<E>absent()); }
Source:
<code>private boolean isFullyFetched() { <START> return currentPage.hasMorePages(); <END> }</code><technical_language>!currentPage.hasMorePages()</technical_language>

Target:
private boolean isFullyFetched() { return !currentPage.hasMorePages(); }
Source:
<code>public void testConvertToDataModelTypeWithFiles() { variant.addSourceEntry(variantSourceEntry); BasicDBObject mongoFile = new BasicDBObject(DBObjectToVariantSourceEntryConverter.FILEID_FIELD, variantSourceEntry.getFileId()) .append(DBObjectToVariantSourceEntryConverter.STUDYID_FIELD, variantSourceEntry.getStudyId()); mongoFile.append(DBObjectToVariantSourceEntryConverter.ATTRIBUTES_FIELD, new BasicDBObject("QUAL", "0.01").append("AN", "2")); mongoFile.append(DBObjectToVariantSourceEntryConverter.FORMAT_FIELD, variantSourceEntry.getFormat()); BasicDBObject genotypeCodes = new BasicDBObject(); genotypeCodes.append("def", "0/0"); genotypeCodes.append("0/1", Arrays.asList(1)); mongoFile.append(DBObjectToVariantSourceEntryConverter.SAMPLES_FIELD, genotypeCodes); BasicDBList files = new BasicDBList(); files.add(mongoFile); mongoVariant.append("files", files); List<String> sampleNames = Lists.newArrayList("NA001", "NA002"); <START> uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter converter = new uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter( <END> new DBObjectToVariantSourceEntryConverter( VariantStorageManager.IncludeSrc.FULL, new DBObjectToSamplesConverter(sampleNames)), new DBObjectToVariantStatsConverter()); Variant converted = converter.convert(mongoVariant); assertEquals(variant, converted); }</code><technical_language>Full qualification is needed</technical_language>

Target:
public void testConvertToDataModelTypeWithFiles() { variant.addSourceEntry(variantSourceEntry); BasicDBObject mongoFile = new BasicDBObject(DBObjectToVariantSourceEntryConverter.FILEID_FIELD, variantSourceEntry.getFileId()) .append(DBObjectToVariantSourceEntryConverter.STUDYID_FIELD, variantSourceEntry.getStudyId()); mongoFile.append(DBObjectToVariantSourceEntryConverter.ATTRIBUTES_FIELD, new BasicDBObject("QUAL", "0.01").append("AN", "2")); mongoFile.append(DBObjectToVariantSourceEntryConverter.FORMAT_FIELD, variantSourceEntry.getFormat()); BasicDBObject genotypeCodes = new BasicDBObject(); genotypeCodes.append("def", "0/0"); genotypeCodes.append("0/1", Arrays.asList(1)); mongoFile.append(DBObjectToVariantSourceEntryConverter.SAMPLES_FIELD, genotypeCodes); BasicDBList files = new BasicDBList(); files.add(mongoFile); mongoVariant.append("files", files); List<String> sampleNames = new ArrayList<String>(); sampleNames.add("NA001"); sampleNames.add("NA002"); DBObjectToVariantConverter converter = new DBObjectToVariantConverter( new DBObjectToVariantSourceEntryConverter( new DBObjectToSamplesConverter(sampleNames)), new DBObjectToVariantStatsConverter()); Variant converted = converter.convert(mongoVariant); assertEquals(variant, converted); }
Source:
<code>public static History getRevisions(File file, String rev) throws IOException { ArrayList<String> cmd = new ArrayList<String>(); cmd.add("p4"); cmd.add("filelog"); cmd.add("-lti"); <START> cmd.add(PerforceRepository.protectPerforceFilename(file.getName()) + PerforceRepository.getRevisionCmd(rev)); <END> Executor executor = new Executor(cmd, file.getCanonicalFile().getParentFile()); executor.exec(); return parseFileLog(executor.getOutputReader()); }</code><technical_language>import method</technical_language>

Target:
public static History getRevisions(File file, String rev) throws IOException { ArrayList<String> cmd = new ArrayList<String>(); cmd.add("p4"); cmd.add("filelog"); cmd.add("-lti"); cmd.add(protectPerforceFilename(file.getName()) + PerforceRepository.getRevisionCmd(rev)); Executor executor = new Executor(cmd, file.getCanonicalFile().getParentFile()); executor.exec(); return parseFileLog(executor.getOutputReader()); }
Source:
<code>public LogItemViewHolder(View rootView) { this.rootView = rootView; ButterKnife.inject(this, rootView); <START> rootView.setTag(this); <END> }</code><technical_language>I this side-effect. do in a static method ctor</technical_language>

Target:
public LogItemViewHolder(View rootView) { this.rootView = rootView; ButterKnife.inject(this, rootView); }
Source:
<code>private static void setActivator(Activator a) { plugin = a; <START> pluginId = a.getBundle().getSymbolicName(); <END> }</code><technical_language>This is strange</technical_language>

Target:
private static void setActivator(Activator a) { plugin = a; }
Source:
<code>public static User create(UUID uuid, String name) { Validate.notNull(uuid, "uuid can't be null!"); Validate.notNull(name, "name can't be null!"); Validate.notBlank(name, "name can't be blank!"); <START> Validate.isTrue(FunnyGuilds.USERNAME_PATTERN.matcher(name).matches(), "name is not valid!"); <END> User user = new User(uuid, name); UserUtils.addUser(user); RankManager.getInstance().update(user); return user; }</code><technical_language>Replace UserUtils.validateUsername(String)</technical_language>

Target:
public static User create(UUID uuid, String name) { Validate.notNull(uuid, "uuid can't be null!"); Validate.notNull(name, "name can't be null!"); Validate.notBlank(name, "name can't be blank!"); Validate.isTrue(UserUtils.validateUsername(name), "name is not valid!"); User user = new User(uuid, name); UserUtils.addUser(user); RankManager.getInstance().update(user); return user; }
Source:
<code>public boolean start() throws IOException { connection = new BigtableConnection(config.toHBaseConfig()); table = connection.getTable(TableName.valueOf(config.getTable())); scanner = table.getScanner(scan); <START> return advance(); <END> }</code><technical_language>do advance() call here. sequence of operations for a user get record start(), advance(), getCurrent(). If do advance() call in start() method users miss record</technical_language>

Target:
public boolean start() throws IOException { connection = new BigtableConnection(config.toHBaseConfig()); table = connection.getTable(TableName.valueOf(config.getTableId())); scanner = table.getScanner(scan); return advance(); }
Source:
<code><START> public synchronized void write(char[] cbuf, int off, int len) throws IOException { <END> if (closed) throw new IOException("stream is already closed"); _write(cbuf, off, len); }</code><technical_language>this introduce risk of deadlock</technical_language>

Target:
public void write(char[] cbuf, int off, int len) throws IOException { if (closeCause != null) { throw new IOException("stream is already closed"); } _write(cbuf, off, len); }
Source:
<code>protected void Perform() { if (getVm().getstatus() == VMStatus.Up) { executeVdscommand(); } <START> <END> setSucceeded(true); }</code><technical_language>u update status of device plugged/unplugged</technical_language>

Target:
protected void Perform() { if (getVm().getstatus() == VMStatus.Up) { runVdsCommand(getParameters().getAction().getCommandType(), new HotPlugUnplgNicVDSParameters(getVm().getrun_on_vds().getValue(), getVm().getId(), DbFacade.getInstance().getVmNetworkInterfaceDAO().get(getParameters().getNicId()), vmDevice)); } TransactionSupport.executeInNewTransaction(updateDevice()); setSucceeded(true); }
Source:
<code>public void testAttributeMapping() { Map<String, List<String>> attributeMap = plugin.getAttributeMap(); assertThat(attributeMap.containsKey("invalid-state"), is(true)); <START> assertThat(attributeMap.get("invalid-state").size(), is(2)); <END> assertThat(attributeMap.get("invalid-state").contains("datamanager"), is(true)); assertThat(attributeMap.get("invalid-state").contains("admin"), is(true)); }</code><technical_language>This a hasSize</technical_language>

Target:
public void testAttributeMapping() { Map<String, List<String>> attributeMap = plugin.getAttributeMap(); assertThat(attributeMap.containsKey("invalid-state"), is(true)); assertThat(attributeMap.get("invalid-state").size(), is(2)); assertThat(attributeMap.get("invalid-state").contains("data-manager"), is(true)); assertThat(attributeMap.get("invalid-state").contains("system-admin"), is(true)); }
Source:
<code>public OrderByOperatorFactory( int operatorId, PlanNodeId planNodeId, List<? extends Type> sourceTypes, List<Integer> outputChannels, int expectedPositions, List<Integer> sortChannels, List<SortOrder> sortOrder, PagesIndex.Factory pagesIndexFactory, boolean spillEnabled, Optional<SpillerFactory> spillerFactory) { this.operatorId = operatorId; this.planNodeId = requireNonNull(planNodeId, "planNodeId is null"); this.sourceTypes = ImmutableList.copyOf(requireNonNull(sourceTypes, "sourceTypes is null")); this.outputChannels = requireNonNull(outputChannels, "outputChannels is null"); this.expectedPositions = expectedPositions; this.sortChannels = ImmutableList.copyOf(requireNonNull(sortChannels, "sortChannels is null")); this.sortOrder = ImmutableList.copyOf(requireNonNull(sortOrder, "sortOrder is null")); this.pagesIndexFactory = requireNonNull(pagesIndexFactory, "pagesIndexFactory is null"); this.spillEnabled = spillEnabled; <START> if (spillEnabled) { <END> checkState(spillerFactory.isPresent(), "Spiller Factory is not present when spill is enabled"); } this.spillerFactory = spillerFactory; }</code><technical_language>Change to: checkState(!spillEnabled || spillerFactory.isPresent(), "..</technical_language>

Target:
public OrderByOperatorFactory( int operatorId, PlanNodeId planNodeId, List<? extends Type> sourceTypes, List<Integer> outputChannels, int expectedPositions, List<Integer> sortChannels, List<SortOrder> sortOrder, PagesIndex.Factory pagesIndexFactory, boolean spillEnabled, Optional<SpillerFactory> spillerFactory) { this.operatorId = operatorId; this.planNodeId = requireNonNull(planNodeId, "planNodeId is null"); this.sourceTypes = ImmutableList.copyOf(requireNonNull(sourceTypes, "sourceTypes is null")); this.outputChannels = requireNonNull(outputChannels, "outputChannels is null"); this.expectedPositions = expectedPositions; this.sortChannels = ImmutableList.copyOf(requireNonNull(sortChannels, "sortChannels is null")); this.sortOrder = ImmutableList.copyOf(requireNonNull(sortOrder, "sortOrder is null")); this.pagesIndexFactory = requireNonNull(pagesIndexFactory, "pagesIndexFactory is null"); this.spillEnabled = spillEnabled; checkState(!spillEnabled || spillerFactory.isPresent(), "Spiller Factory is not present when spill is enabled"); this.spillerFactory = spillerFactory; }
Source:
<code>public VirtualGuestToImage(OperatingSystemToImage operatingSystemToImage) { <START> this.operatingSystemToImage = operatingSystemToImage; <END> }</code><technical_language>Add a checkNotNull check here</technical_language>

Target:
protected VirtualGuestToImage(OperatingSystemToImage operatingSystemToImage) { this.operatingSystemToImage = checkNotNull(operatingSystemToImage, "operatingSystemToImage"); }
Source:
<code>private Optional<Long> gettimeofdayImpl(POSIX posix) { Timeval tv = posix.allocateTimeval(); int rv = posix.gettimeofday(tv); if (rv != 0) { <START> LOG.info("Expected 0 return value from gettimeofday(), observed " + rv); <END> return Optional.empty(); } return Optional.of(tv.sec() * 1_000_000 + tv.usec()); }</code><technical_language>Log.debug maybe</technical_language>

Target:
private Optional<Long> gettimeofdayImpl(POSIX posix) { Timeval tv = posix.allocateTimeval(); int rv = posix.gettimeofday(tv); if (rv != 0) { LOG.debug("Expected 0 return value from gettimeofday(), observed " + rv); return Optional.empty(); } return Optional.of(tv.sec() * 1_000_000 + tv.usec()); }
Source:
<code>public String buildQueryParams() { <START> return (this.buildQueryParams(false)); <END> }</code><technical_language>need outer parentheses (applies method too)</technical_language>

Target:
public String buildQueryParams() { return this.buildQueryParams(false); }
Source:
<code>private Map<String, AuthConfig> normalizeDockerHubRegistryUrl(Map<String, AuthConfig> authConfigs) { if (authConfigs.containsKey("docker.io")) { Map<String,AuthConfig> normalizedAuthConfigMap = new HashMap<>(authConfigs); normalizedAuthConfigMap.put(DEFAULT_REGISTRY, normalizedAuthConfigMap.remove("docker.io")); return normalizedAuthConfigMap; <START> } else if (authConfigs.containsKey("index.docker.io")) { <END> Map<String,AuthConfig> normalizedAuthConfigMap = new HashMap<>(authConfigs); normalizedAuthConfigMap.put(DEFAULT_REGISTRY, normalizedAuthConfigMap.remove("index.docker.io")); return normalizedAuthConfigMap; } return authConfigs; }</code><technical_language>If "docker.io" "index.docker.io" present</technical_language>

Target:
private Map<String, AuthConfig> normalizeDockerHubRegistryUrl(Map<String, AuthConfig> authConfigs) { for (String defaultRegistryAlias : DEFAULT_REGISTRY_SYNONYMS) { if (authConfigs.containsKey(defaultRegistryAlias)) { Map<String, AuthConfig> normalizedAuthConfigMap = new HashMap<>(authConfigs); normalizedAuthConfigMap.put(DEFAULT_REGISTRY, normalizedAuthConfigMap.remove(defaultRegistryAlias)); return normalizedAuthConfigMap; } } return authConfigs; }
Source:
<code>public void migrateAfter(Model model, Metamodel metamodel) throws MigrationException { final EPackage viewPkg = getEPackageWithNSPrefix(metamodel, "org.eclipse.emf.ecp.view.model"); <START> final EClass fpdmrClass = (EClass) viewPkg.getEClassifier("FeaturePathDomainModelReference"); END> final EReference feature = (EReference) fpdmrClass.getEStructuralFeature("domainModelEFeature"); final EReference path = (EReference) fpdmrClass.getEStructuralFeature("domainModelEReferencePath"); final EList<Instance> allTableDMRs = model.getAllInstances("table.TableDomainModelReference"); for (final Instance tableDMR : allTableDMRs) { if (null == tableDMR.get(feature)) { continue; } final Instance childDMR = model.newInstance(fpdmrClass); final Object featureInstance = tableDMR.unset(feature); final Object pathInstance = tableDMR.unset(path); childDMR.set(feature, featureInstance); childDMR.set(path, pathInstance); tableDMR.set("domainModelReference", childDMR); } }</code><technical_language>abbrev. is comprehensible. I opt for FeaturePath DMR least</technical_language>

Target:
public void migrateAfter(Model model, Metamodel metamodel) throws MigrationException { final EPackage viewPkg = getEPackageWithNSPrefix(metamodel, "org.eclipse.emf.ecp.view.model"); final EClass featurePathDMREClass = (EClass) viewPkg.getEClassifier("FeaturePathDomainModelReference"); final EReference feature = (EReference) featurePathDMREClass.getEStructuralFeature("domainModelEFeature"); final EReference path = (EReference) featurePathDMREClass.getEStructuralFeature("domainModelEReferencePath"); final EList<Instance> allTableDMRs = model.getAllInstances("table.TableDomainModelReference"); for (final Instance tableDMR : allTableDMRs) { if (null == tableDMR.get(feature)) { continue; } final Instance childDMR = model.newInstance(featurePathDMREClass); final Object featureInstance = tableDMR.unset(feature); final Object pathInstance = tableDMR.unset(path); childDMR.set(feature, featureInstance); childDMR.set(path, pathInstance); tableDMR.set("domainModelReference", childDMR); } }
Source:
<code>public IPath getAbsolutePath() { <START> return new Path(db.getWorkTree().getAbsolutePath() + File.separatorChar <END> + path); }</code><technical_language>add a guard prevent surprises if (db.isBare()) { return null; }</technical_language>

Target:
public IPath getAbsolutePath() { if (db.isBare()) { return null; } return new Path(db.getWorkTree().getAbsolutePath() + File.separatorChar + path); }
Source:
<code>private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForMemoryDumpImage(Guid containerID, Guid storageId, Guid imageId, Guid volumeId) { MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, imageId, volumeId, imageId, volumeId, storageId, getMoveOrCopyImageOperation()); params.setParentCommand(getActionType()); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setForceOverride(getParameters().getForceOverride()); params.setSourceDomainId(getParameters().getSourceDomainId()); params.setStoragePoolId(getParameters().getStoragePoolId()); params.setImportEntity(true); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId())); params.setParentParameters(getParameters()); StorageDomainStatic storageDomain = getStorageDomainStaticDAO().get(storageId); <START> if (storageDomain != null && storageDomain.getStorageType().isBlockDomain()) { <END> params.setUseCopyCollapse(true); params.setVolumeType(VolumeType.Preallocated); params.setVolumeFormat(VolumeFormat.RAW); } return params; }</code><technical_language>is for storageDomain null here</technical_language>

Target:
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForMemoryDumpImage(Guid containerID, Guid storageId, Guid imageId, Guid volumeId) { MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, imageId, volumeId, imageId, volumeId, storageId, getMoveOrCopyImageOperation()); params.setParentCommand(getActionType()); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setForceOverride(getParameters().getForceOverride()); params.setSourceDomainId(getParameters().getSourceDomainId()); params.setStoragePoolId(getParameters().getStoragePoolId()); params.setImportEntity(true); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId())); params.setParentParameters(getParameters()); StorageDomainStatic storageDomain = getStorageDomainStaticDAO().get(storageId); if (storageDomain.getStorageType().isBlockDomain()) { params.setUseCopyCollapse(true); params.setVolumeType(VolumeType.Preallocated); params.setVolumeFormat(VolumeFormat.RAW); } return params; }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case android.R.id.home: finish(); <START> break; <END> default: Log_OC.w(TAG, "Unknown menu item triggered"); return false; } return true; }</code><technical_language>early return</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case android.R.id.home: finish(); return true; default: Log_OC.w(TAG, "Unknown menu item triggered"); return false; } }
Source:
<code>public void testBroadcastWithAdditionalEvals() throws InterruptedException { final ExecutorService executor = Executors.newFixedThreadPool(NUM_THREAD); final AtomicInteger operationIdCounter = new AtomicInteger(0); final int numMoves = 5; final int numAdditionalEvals = 2; final int newEvalIdx = NUM_INIT_EVALS; for (int i = 0; i < numAdditionalEvals; i++) { blockManager.registerEvaluator(EVAL_PREFIX + (newEvalIdx + i), NUM_INIT_EVALS); } final int numActiveEvals = NUM_INIT_EVALS + numAdditionalEvals; final int numOtherEvals = numActiveEvals - 2; final CountDownLatch movedLatch = new CountDownLatch(numMoves); final FinishedCallback finishedCallback = new FinishedCallback(movedLatch); runRandomMove(executor, operationIdCounter, numMoves, numActiveEvals, finishedCallback); movedLatch.await(20000, TimeUnit.MILLISECONDS); final int numBroadcasts = numOtherEvals * (numMoves - finishedCallback.getNumFailedMoves()); <START> while (messageSender.getBroadcastCount() < numBroadcasts) { <END> Thread.sleep(1000); } Thread.sleep(2000); assertEquals(numBroadcasts, messageSender.getBroadcastCount()); }</code><technical_language>avoid busy-waiting, pass a CountDownLatch here, replace getBroadcastCount() a method counts down. sound</technical_language>

Target:
public void testBroadcastWithAdditionalEvals() throws InterruptedException { final ExecutorService executor = Executors.newFixedThreadPool(NUM_THREAD); final AtomicInteger operationIdCounter = new AtomicInteger(0); final int numMoves = 5; final int numAdditionalEvals = 2; final int newEvalIdx = NUM_INIT_EVALS; for (int i = 0; i < numAdditionalEvals; i++) { blockManager.registerEvaluator(EVAL_PREFIX + (newEvalIdx + i), NUM_INIT_EVALS); } final int numActiveEvals = NUM_INIT_EVALS + numAdditionalEvals; final int numOtherEvals = numActiveEvals - 2; final CountDownLatch movedLatch = new CountDownLatch(numMoves); final FinishedCallback finishedCallback = new FinishedCallback(movedLatch); runRandomMove(executor, operationIdCounter, numMoves, numActiveEvals, finishedCallback); assertTrue("Move does not finish within time", movedLatch.await(20000, TimeUnit.MILLISECONDS)); int loop = 0; final int numBroadcasts = numOtherEvals * (numMoves - finishedCallback.getNumFailedMoves()); while (messageSender.getBroadcastCount() < numBroadcasts) { loop++; Thread.sleep(WAIT_INTERVAL_MS); } Thread.sleep(WAIT_INTERVAL_MS * (loop + 1)); assertEquals("There are more broadcasts above expectation", numBroadcasts, messageSender.getBroadcastCount()); }
Source:
<code>public boolean isPortInUse(int port) { ServerSocket serverSocket = null; try { <START> serverSocket = new ServerSocket(port); <END> this.closeTestingServerSocket(serverSocket); } catch (IOException e) { return true; } return false; }</code><technical_language>add a message here: "Checking if port XXXX is in use..."</technical_language>

Target:
public boolean isPortInUse(int port) { String message = String.format("Checking if port %s is in use...", port); wizard.showMessage(message); return checkPortUsage(port); }
Source:
<code>public static String resolveAttestationTrustStorePath() { <START> return ConfigUtil.resolvePath(resolveCABasePath(), Config.<String> GetValue(ConfigValues.AttestationTruststore)); <END> }</code><technical_language>resolveCABasePath() exist more</technical_language>

Target:
public static String resolveAttestationTrustStorePath() { return ConfigUtil.resolvePath(Config.<String> GetValue(ConfigValues.DataDir), Config.<String> GetValue(ConfigValues.AttestationTruststore)); }
Source:
<code>public void toggleAllowAllMechanisms() throws Exception { final SnapshotBackup snapshotBackup = new SnapshotBackup(); client.apply(snapshotBackup.backup()); <START> final Address authenticationConfigurationAddress = createAuthenticationConfiguration(); <END> final boolean initialValue = false; try { page.navigate(); page.switchToAuthenticationConfiguration() .getResourceManager() .selectByName(authenticationConfigurationAddress.getLastPairValue()); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ALLOW_ALL_MECHANISMS, !initialValue) .verifyFormSaved() .verifyAttribute(ALLOW_ALL_MECHANISMS, !initialValue); Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent(); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ALLOW_ALL_MECHANISMS, initialValue) .verifyFormSaved() .verifyAttribute(ALLOW_ALL_MECHANISMS, initialValue); } finally { client.apply(snapshotBackup.restore()); } }</code><technical_language>is this called of try block? This questions applies for parts of code</technical_language>

Target:
public void toggleAllowAllMechanisms() throws Exception { final Address authenticationConfigurationAddress = createAuthenticationConfiguration(); final boolean initialValue = false; try { elytronAuthenticationOperations.performActionOnAttributeAndRevertItsValueToOriginal( authenticationConfigurationAddress, ALLOW_ALL_MECHANISMS, () -> { page.navigate(); page.switchToAuthenticationConfiguration() .getResourceManager() .selectByName(authenticationConfigurationAddress.getLastPairValue()); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ALLOW_ALL_MECHANISMS, !initialValue) .verifyFormSaved() .verifyAttribute(ALLOW_ALL_MECHANISMS, !initialValue); Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent(); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ALLOW_ALL_MECHANISMS, initialValue) .verifyFormSaved() .verifyAttribute(ALLOW_ALL_MECHANISMS, initialValue); } ); } finally { ops.removeIfExists(authenticationConfigurationAddress); } }
Source:
<code>public boolean isServiceBlockedOnDestination(PerunSession sess, Service service, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException { Destination destination = getDestinationById(sess, destinationId); <START> List<Facility> destinationFacilities = perunBl.getFacilitiesManager().getFacilitiesByDestination(sess, destination.getDestination()); <END> boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "isServiceBlockedOnDestination"); } return getServicesManagerBl().isServiceBlockedOnDestination(service, destinationId); }</code><technical_language>Please BL layer get destination facilities</technical_language>

Target:
public boolean isServiceBlockedOnDestination(PerunSession sess, Service service, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException { Destination destination = getServicesManagerBl().getDestinationById(sess, destinationId); List<Facility> destinationFacilities = perunBl.getFacilitiesManagerBl().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "isServiceBlockedOnDestination"); } return getServicesManagerBl().isServiceBlockedOnDestination(service, destinationId); }
Source:
<code>public List<User> getUsers(PerunSession sess) throws InternalErrorException, PrivilegeException { Utils.checkPerunSession(sess); if(!AuthzResolver.isAuthorized(sess, Role.PERUNADMIN) && <START> !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { <END> throw new PrivilegeException(sess, "getUsers"); } return getUsersManagerBl().getUsers(sess); }</code><technical_language>drop PERUNADMIN check here. in other methods in this file please</technical_language>

Target:
public List<User> getUsers(PerunSession sess) throws InternalErrorException, PrivilegeException { Utils.checkPerunSession(sess); if(!AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "getUsers"); } return getUsersManagerBl().getUsers(sess); }
Source:
<code>public void searchByPatient_shouldGetRetiredVisitsIfIncludeAllIsTrue() throws Exception { Visit visit = service.getVisitByUuid("e1428fea-6b78-11e0-93c3-18a905e044dc"); Assert.assertTrue(visit.isVoided()); handle(newDeleteRequest(getURI() + "/" + getUuid(), new Parameter("reason", "void test reason"))); SimpleObject resultWithVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", <START> "da7f524f-27ce-4bb2-86d6-6d1d05312bd5"), new Parameter("includeAll", "true")))); <END> SimpleObject resultVithoutVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", "da7f524f-27ce-4bb2-86d6-6d1d05312bd5")))); Assert.assertNotEquals(Util.getResultsSize(resultWithVoidedVisits), Util.getResultsSize(resultVithoutVoidedVisits)); }</code><technical_language>repeat da7f524f-27ce-4bb2-86d6-6d1d05312bd5</technical_language>

Target:
public void searchByPatient_shouldGetRetiredVisitsIfIncludeAllIsTrue() throws Exception { String patientUUid = "da7f524f-27ce-4bb2-86d6-6d1d05312bd5"; SimpleObject resultWithVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", patientUUid), new Parameter("includeAll", "true")))); SimpleObject resultWithoutVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", patientUUid)))); int visitIncludingVoidedSize = Util.getResultsSize(resultWithVoidedVisits); int visitExcludingVoidedSize = Util.getResultsSize(resultWithoutVoidedVisits); Assert.assertEquals(visitIncludingVoidedSize, 4); Assert.assertEquals(visitExcludingVoidedSize, 3); handle(newDeleteRequest(getURI() + "/" + getUuid(), new Parameter("reason", "void test reason"))); resultWithVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", patientUUid), new Parameter("includeAll", "true")))); resultWithoutVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", patientUUid)))); Assert.assertEquals(Util.getResultsSize(resultWithoutVoidedVisits), 2); Assert.assertEquals(Util.getResultsSize(resultWithVoidedVisits), 4); }
Source:
<code>public void removeFolder(String folderId) { <START> for (String deviceId : deviceFolderMap.keySet()) { <END> if (deviceFolderMap.get(deviceId).containsKey(folderId)) { deviceFolderMap.get(deviceId).remove(folderId); break; } } }</code><technical_language>I need of methods, if getordefault update config</technical_language>

Target:
private void removeFolder(String folderId) { for (HashMap<String, CompletionInfo> folderMap : deviceFolderMap.values()) { if (folderMap.containsKey(folderId)) { folderMap.remove(folderId); break; } } }
Source:
<code><START> public Map<AnyObjectId, List<AnyObjectId>> getGrafts() throws IOException { <END> return getGraftsDatabase().getGrafts(); }</code><technical_language>ObjectId, mapping mutable</technical_language>

Target:
public Map<AnyObjectId, List<ObjectId>> getGrafts() throws IOException { return getGraftsDatabase().getGrafts(); }
Source:
<code>private Pair<Map<DataNodeId, List<RemoteReplicaInfo>>, ReplicaThread> getRemoteReplicasAndReplicaThread(int batchSize, ClusterMap clusterMap, Host localHost, Host remoteHost, StoreKeyFactory storeKeyFactory, StoreKeyConverter storeKeyConverter, Transformer transformer, StoreEventListener listener) { Properties properties = new Properties(); <START> properties.setProperty("replication.quarantine.duration.ms", "3000"); <END> config = new ReplicationConfig(new VerifiableProperties(properties)); ReplicationMetrics replicationMetrics = new ReplicationMetrics(new MetricRegistry(), clusterMap.getReplicaIds(localHost.dataNodeId)); replicationMetrics.populatePerColoMetrics(Collections.singleton(remoteHost.dataNodeId.getDatacenterName())); Map<DataNodeId, List<RemoteReplicaInfo>> replicasToReplicate = Collections.singletonMap(remoteHost.dataNodeId, localHost.getRemoteReplicaInfos(remoteHost, listener)); Map<DataNodeId, Host> hosts = new HashMap<>(); hosts.put(remoteHost.dataNodeId, remoteHost); MockConnectionPool connectionPool = new MockConnectionPool(hosts, clusterMap, batchSize); ReplicaThread replicaThread = new ReplicaThread("threadtest", replicasToReplicate, new MockFindTokenFactory(), clusterMap, new AtomicInteger(0), localHost.dataNodeId, connectionPool, config, replicationMetrics, null, storeKeyFactory, storeKeyConverter, transformer, clusterMap.getMetricRegistry(), false, localHost.dataNodeId.getDatacenterName(), new ResponseHandler(clusterMap), time); return new Pair<>(replicasToReplicate, replicaThread); }</code><technical_language>this config name changed (also set this here?)</technical_language>

Target:
private Pair<Map<DataNodeId, List<RemoteReplicaInfo>>, ReplicaThread> getRemoteReplicasAndReplicaThread(int batchSize, ClusterMap clusterMap, Host localHost, Host remoteHost, StoreKeyFactory storeKeyFactory, StoreKeyConverter storeKeyConverter, Transformer transformer, StoreEventListener listener) { ReplicationMetrics replicationMetrics = new ReplicationMetrics(new MetricRegistry(), clusterMap.getReplicaIds(localHost.dataNodeId)); replicationMetrics.populatePerColoMetrics(Collections.singleton(remoteHost.dataNodeId.getDatacenterName())); Map<DataNodeId, List<RemoteReplicaInfo>> replicasToReplicate = Collections.singletonMap(remoteHost.dataNodeId, localHost.getRemoteReplicaInfos(remoteHost, listener)); Map<DataNodeId, Host> hosts = new HashMap<>(); hosts.put(remoteHost.dataNodeId, remoteHost); MockConnectionPool connectionPool = new MockConnectionPool(hosts, clusterMap, batchSize); ReplicaThread replicaThread = new ReplicaThread("threadtest", replicasToReplicate, new MockFindTokenFactory(), clusterMap, new AtomicInteger(0), localHost.dataNodeId, connectionPool, config, replicationMetrics, null, storeKeyFactory, storeKeyConverter, transformer, clusterMap.getMetricRegistry(), false, localHost.dataNodeId.getDatacenterName(), new ResponseHandler(clusterMap), time); return new Pair<>(replicasToReplicate, replicaThread); }
Source:
<code>public Map<String, Set<String>> readPluginsStorages() { log.debug("Reading extensions storages from plugins"); Map<String, Set<String>> result = new LinkedHashMap<>(); List<PluginWrapper> plugins = pluginManager.getPlugins(); for (PluginWrapper plugin : plugins) { String pluginId = plugin.getDescriptor().getPluginId(); log.debug("Reading extensions storage from plugin '{}'", pluginId); Set<String> bucket = new HashSet<>(); try { Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(getExtensionsResource()); if (urls == null || !urls.hasMoreElements()) { log.debug("Cannot find '{}'", getExtensionsResource()); } else { while (urls.hasMoreElements()) { URL url = urls.nextElement(); <START> if (url != null) { <END> log.debug("Read '{}'", url.getFile()); try (Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) { LegacyExtensionStorage.read(reader, bucket); } } else { log.debug("Cannot find '{}'", getExtensionsResource()); } } } debugExtensions(bucket); result.put(pluginId, bucket); } catch (IOException e) { log.error(e.getMessage(), e); } } return result; }</code><technical_language>Url is null, need for null check</technical_language>

Target:
public Map<String, Set<String>> readPluginsStorages() { log.debug("Reading extensions storages from plugins"); Map<String, Set<String>> result = new LinkedHashMap<>(); List<PluginWrapper> plugins = pluginManager.getPlugins(); for (PluginWrapper plugin : plugins) { String pluginId = plugin.getDescriptor().getPluginId(); log.debug("Reading extensions storage from plugin '{}'", pluginId); Set<String> bucket = new HashSet<>(); try { Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(getExtensionsResource()); if (urls == null || !urls.hasMoreElements()) { log.debug("Cannot find '{}'", getExtensionsResource()); } else { while (urls.hasMoreElements()) { URL url = urls.nextElement(); log.debug("Read '{}'", url.getFile()); try (Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) { LegacyExtensionStorage.read(reader, bucket); } } } debugExtensions(bucket); result.put(pluginId, bucket); } catch (IOException e) { log.error(e.getMessage(), e); } } return result; }
Source:
<code>public void testCountNullableExpression() throws Exception { testQuery( "SELECT COUNT(CASE WHEN dim2 = 'abc' THEN 'yes' WHEN dim2 = 'def' THEN 'yes' END) FROM druid.foo", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) <START> .virtualColumns() <END> .aggregators(aggregators( new FilteredAggregatorFactory( new CountAggregatorFactory("a0"), in("dim2", ImmutableList.of("abc", "def"), null) ) )) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L} ) ); }</code><technical_language>Nit: leave out .virtualColumns() if setting any</technical_language>

Target:
public void testCountNullableExpression() throws Exception { testQuery( "SELECT COUNT(CASE WHEN dim2 = 'abc' THEN 'yes' WHEN dim2 = 'def' THEN 'yes' END) FROM druid.foo", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .aggregators(aggregators( new FilteredAggregatorFactory( new CountAggregatorFactory("a0"), in("dim2", ImmutableList.of("abc", "def"), null) ) )) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L} ) ); }
Source:
<code>protected void resizeAvatar(DocumentModel doc, Blob avatarImage) throws PropertyException { ConversionService conversionService = Framework.getService(ConversionService.class); BlobHolder bh = new SimpleBlobHolder(avatarImage); Map<String, Serializable> parameters = new HashMap<>(); parameters.put("targetWidth", String.valueOf(RESIZED_IMAGE_WIDTH)); parameters.put("targetHeight", String.valueOf(RESIZED_IMAGE_HEIGHT)); try { BlobHolder result = conversionService.convert("resizeAvatar", bh, parameters); if (result != null) { Blob res = result.getBlob(); res.setFilename(avatarImage.getFilename()); <START> doc.setPropertyValue(USER_PROFILE_AVATAR_FIELD, (Serializable) result.getBlob()); <END> } } catch (NuxeoException e) { log.warn("Unable to resize avatar image"); log.debug(e, e); } }</code><technical_language>result.getBlob() -> res here. call blob resizedBlob instead of res</technical_language>

Target:
protected void resizeAvatar(DocumentModel doc, Blob avatarImage) throws PropertyException { ConversionService conversionService = Framework.getService(ConversionService.class); BlobHolder bh = new SimpleBlobHolder(avatarImage); Map<String, Serializable> parameters = new HashMap<>(); parameters.put("targetWidth", String.valueOf(RESIZED_IMAGE_WIDTH)); parameters.put("targetHeight", String.valueOf(RESIZED_IMAGE_HEIGHT)); try { BlobHolder result = conversionService.convert("resizeAvatar", bh, parameters); if (result != null) { Blob blob = result.getBlob(); blob.setFilename(avatarImage.getFilename()); doc.setPropertyValue(USER_PROFILE_AVATAR_FIELD, (Serializable) blob); } } catch (NuxeoException e) { log.warn("Unable to resize avatar image"); log.debug(e, e); } }
Source:
<code>public void memberDeparted(InternalDistributedMember theId, boolean crashed, String reason) { try { boolean wasAdmin = getAdminMemberSet().contains(theId); if (wasAdmin) { AdminConsoleDisconnectMessage message = new AdminConsoleDisconnectMessage(); message.setSender(theId); message.setCrashed(crashed); message.setAlertListenerExpected(true); message.setIgnoreAlertListenerRemovalFailure(true); message.setRecipient(localAddress); message.setReason(reason); handleIncomingDMsg(message); } } catch (DistributedSystemDisconnectedException se) { } <START> dm.handleManagerDeparture(theId, crashed, reason, true); <END> }</code><technical_language>this statement move? in a finally block</technical_language>

Target:
public void memberDeparted(InternalDistributedMember theId, boolean crashed, String reason) { try { boolean wasAdmin = getAdminMemberSet().contains(theId); if (wasAdmin) { AdminConsoleDisconnectMessage message = new AdminConsoleDisconnectMessage(); message.setSender(theId); message.setCrashed(crashed); message.setAlertListenerExpected(true); message.setIgnoreAlertListenerRemovalFailure(true); message.setRecipient(localAddress); message.setReason(reason); handleIncomingDMsg(message); } dm.handleManagerDeparture(theId, crashed, reason); } catch (DistributedSystemDisconnectedException se) { } }
Source:
<code>public SnappyDecompressor(int directBufferSize) { try { SnappyLoader.getVersion(); } catch (Throwable t) { <START> LOG.warn("Error loading snappy libraries: " + t); <END> } this.directBufferSize = directBufferSize; compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf.position(directBufferSize); }</code><technical_language>In original code, throw a runtime exception if native snappy is found. follow? throw new RuntimeException("native snappy library available: " + "SnappyCompressor loaded.");</technical_language>

Target:
public SnappyDecompressor(int directBufferSize) { this.directBufferSize = directBufferSize; compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf.position(directBufferSize); }
Source:
<code>public Contact createOrUpdateContact(Contact contact) throws WebServiceException { try { LOGGER.debug(CREATING + contact.toString()); ByteArrayOutputStream body = JsonUtils.toOutputStream(contact); InputStream response = client.executePost(CONTACTS_ENDPOINT, body, MediaFormat.JSON, MediaFormat.JSON); return (Contact) JsonUtils.toObject(response, CONTACT_TYPE_REF); } catch (RapidProClientException | JsonUtilException e) { <START> LOGGER.error(e.getMessage()); <END> throw new WebServiceException(ERROR_CREATING_OR_UPDATING + contact.toString(), e); } }</code><technical_language>'log & throw'</technical_language>

Target:
public Contact createOrUpdateContact(Contact contact) throws WebServiceException { InputStream response = null; try { LOGGER.debug(CREATING + contact.toString()); byte[] body = JsonUtils.toByteArray(contact); response = client.executePost(CONTACTS_ENDPOINT, body, MediaFormat.JSON, MediaFormat.JSON); return (Contact) JsonUtils.toObject(response, CONTACT_TYPE_REF); } catch (RapidProClientException | JsonUtilException e) { throw new WebServiceException(ERROR_CREATING_OR_UPDATING + contact.getName(), e); } finally { closeInputStream(response); } }
Source:
<code>private static String toLuceneDate(Date date) { try { <START> SimpleDateFormat df = new SimpleDateFormat(LUCENE_DATE_FORMAT); <END> String returnValue = df.format(date); return returnValue; } catch (Exception ex) { Logger.error(ESContentFactoryImpl.class, ex.toString()); return ERROR_DATE; } }</code><technical_language>this a constant</technical_language>

Target:
private static String toLuceneDate(Date date) { try { String returnValue = LUCENE_DATE_FORMAT.format(date); return returnValue; } catch (Exception ex) { Logger.error(ESContentFactoryImpl.class, ex.toString()); return ERROR_DATE; } }