auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public FilestoreModel.Status downloadBlob(String oid, UserModel user, RepositoryModel repo, OutputStream streamOut) { Status status = canGetObject(oid, user, repo); if (status != Status.Available) { return status; } FilestoreModel item = fileCache.get(oid); if (streamOut != null) { try { <START> FileInputStream streamIn = new FileInputStream(getStoragePath(oid)); <END> IOUtils.copyLarge(streamIn, streamOut); streamOut.flush(); streamIn.close(); } catch (EofException e) { logger.error(MessageFormat.format("Client aborted connection for {0}", oid), e); return Status.Error_Unexpected_Stream_End; } catch (Exception e) { logger.error(MessageFormat.format("Failed to download blob {0}", oid), e); return Status.Error_Unknown; } } return item.getStatus(); }</code><technical_language>try (FileInputStream streamIn = new FileInputStream(getStoragePath(oid)))</technical_language>

Target:
public FilestoreModel.Status downloadBlob(String oid, UserModel user, RepositoryModel repo, OutputStream streamOut) { Status status = canGetObject(oid, user, repo); if (status != Status.Available) { return status; } FilestoreModel item = fileCache.get(oid); if (streamOut != null) { try (FileInputStream streamIn = new FileInputStream(getStoragePath(oid))) { IOUtils.copyLarge(streamIn, streamOut); streamOut.flush(); streamIn.close(); } catch (EofException e) { logger.error(MessageFormat.format("Client aborted connection for {0}", oid), e); return Status.Error_Unexpected_Stream_End; } catch (Exception e) { logger.error(MessageFormat.format("Failed to download blob {0}", oid), e); return Status.Error_Unknown; } } return item.getStatus(); }
Source:
<code>protected void execute() { <START> logger.debug("execute() method is called!"); <END> try { MailConnector connector = connectorBuilder.createAndCheckMailConnector(); service = new MessagesService<T>(connector, eventPublisher); service.receiveMessages(); } catch(ServiceException ex) { logger.error("Cannot receive messages", ex); } catch(ConfigurationException ex) { logger.error("Cannot receive messages", ex); } }</code><technical_language>remove this statement</technical_language>

Target:
protected void execute() { try { MailConnector connector = connectorBuilder.createAndCheckMailConnector(); service = new MessagesService<T>(connector, eventPublisher, config); service.receiveMessages(); } catch (ServiceException ex) { logger.error("Cannot receive messages", ex); } catch (ConfigurationException ex) { logger.error("Cannot receive messages", ex); } }
Source:
<code>public void copyFromLocalFile(File srcFile, URI dstUri) throws Exception { String[] parts = srcFile.getName().split("__"); <START> if (parts.length > 3 && (Integer.parseInt(parts[2]) % UPLOAD_FAILURE_MOD == 0)) { <END> throw new IllegalArgumentException(srcFile.getAbsolutePath()); } try { _localPinotFS.copyFromLocalFile(srcFile, new URI(_basePath + dstUri.getPath())); } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } }</code><technical_language>LLCSegmentName for this logic</technical_language>

Target:
public void copyFromLocalFile(File srcFile, URI dstUri) throws Exception { if (new LLCSegmentName(srcFile.getName()).getSequenceNumber() % UPLOAD_FAILURE_MOD == 0) { throw new IllegalArgumentException(srcFile.getAbsolutePath()); } try { _localPinotFS.copyFromLocalFile(srcFile, new URI(_basePath + dstUri.getPath())); } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } }
Source:
<code>public String toString() { return new StringBuilder() .append(isCounter() ? COUNTER : EMPTY_STRING) <START> .append(LEFT_PARAN) <END> .append(getUnit()) .append(RIGHT_PARAN) .toString(); }</code><technical_language>Again, minor, PAREN*</technical_language>

Target:
public String toString() { return new StringBuilder() .append(isCounter() ? COUNTER : EMPTY_STRING) .append(LEFT_PAREN) .append(getUnit()) .append(RIGHT_PAREN) .toString(); }
Source:
<code>public Object getValue(final Object element, final String property) { switch (property) { case NAME: return ((INamedElement) element).getName(); case TYPE: String type = ((IInterfaceElement) element).getTypeName(); String[] items = ((ComboBoxCellEditor) <START> viewer.getCellEditors()[1]).getItems(); <END> int i = items.length - 1; while (i > 0 && !type.equals(items[i])) { --i; } return i; case COMMENT: return ((INamedElement) element).getComment() != null ? ((INamedElement) element).getComment() : ""; default: return null; } }</code><technical_language>Magic number - index 1</technical_language>

Target:
public Object getValue(final Object element, final String property) { switch (property) { case NAME: return ((INamedElement) element).getName(); case TYPE: String type = ((IInterfaceElement) element).getTypeName(); List<String> items = Arrays .asList(((ComboBoxCellEditor) viewer.getCellEditors()[TYPE_COLUMN_INDEX]).getItems()); return items.indexOf(type); case COMMENT: return ((INamedElement) element).getComment() != null ? ((INamedElement) element).getComment() : ""; default: return null; } }
Source:
<code>private void log(Object message, Object...parameters) { if (DEBUG) { <START> StringBuilder indent = new StringBuilder(); <END> for (int i = 0; i < currentLevel; ++i) { indent.append(" "); } LOG.debug(indent.toString() + message, parameters); } }</code><technical_language>create builder exact capacity need grow appending values. Also, count in message appending instead of concatenating indent message separately</technical_language>

Target:
private void log(Object message, Object...parameters) { if (DEBUG) { StringBuilder indent = new StringBuilder(currentLevel * 2); for (int i = 0; i < currentLevel; ++i) { indent.append(" "); } LOG.debug(indent.toString() + message, parameters); } }
Source:
<code>public String toCommentString() { <START> return "compare-to-reflexive on x0"; <END> }</code><technical_language>Change "compare-to" "compareTo". else appears</technical_language>

Target:
public String toCommentString() { return "compareTo-reflexive on x0"; }
Source:
<code>public void update(final Spec spec, final Spec widgets) { try { <START> new JdkRequest(UriBuilder.fromUri(this.home).build()) <END> .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='save']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .body() .set( String.format( "spec=%s&widgets=%s", URLEncoder.encode(spec.asText(), CharEncoding.UTF_8), URLEncoder.encode(widgets.asText(), CharEncoding.UTF_8) ) ) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }</code><technical_language>need UriBuilder</technical_language>

Target:
public void update(final Spec spec, final Spec widgets) { try { new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='save']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .body() .formParam("spec", spec.asText()) .formParam("widgets", widgets.asText()) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
<code>public String getDescription() { <START> return "Returns the list of log files on JobManager."; <END> }</code><technical_language>_[...] JobManager_</technical_language>

Target:
public String getDescription() { return "Returns the list of log files on the JobManager."; }
Source:
<code>private void checkIssueOnFile(String expectedIssueMessage, int... secondaryLines) { assertThat(issues).hasSize(1); Issue issue = issues.iterator().next(); assertThat(issue.primaryLocation().message()).isEqualTo(expectedIssueMessage); List<Flow> flows = issue.flows(); <START> if (secondaryLines == null) { <END> assertThat(flows).hasSize(1); assertThat(flows.get(0).locations()).isEmpty(); } else { assertThat(flows).hasSize(secondaryLines.length); assertThat(flows.stream().map(Flow::locations)).allMatch(flow -> flow.size() == 1); Integer[] expectedLines = IntStream.of(secondaryLines).boxed().toArray(Integer[]::new); assertThat(flows.stream().map(Flow::locations).map(locs -> locs.get(0).textRange().start().line()).collect(Collectors.toList())) .containsExactly(expectedLines); } }</code><technical_language>false</technical_language>

Target:
private void checkIssueOnFile(String expectedIssueMessage, int... secondaryLines) { assertThat(issues).hasSize(1); Issue issue = issues.iterator().next(); assertThat(issue.primaryLocation().message()).isEqualTo(expectedIssueMessage); assertThat(issue.primaryLocation().textRange()).isNull(); List<Flow> flows = issue.flows(); assertThat(flows).hasSize(secondaryLines.length); assertThat(flows.stream().map(Flow::locations)).allMatch(flow -> flow.size() == 1); Integer[] expectedLines = IntStream.of(secondaryLines).boxed().toArray(Integer[]::new); assertThat(flows.stream().map(Flow::locations).map(locs -> locs.get(0).textRange().start().line()).collect(Collectors.toList())) .containsExactly(expectedLines); }
Source:
<code>public void whenNoFreeSlotsThenException() throws Exception { <START> final String parition = "0"; <END> range(0, 5).forEach(x -> { try { final String path = zkPathForConsumer(parition) + "/" + randomUUID(); CURATOR.create().creatingParentsIfNeeded().forPath(path); } catch (Exception e) { throw new AssertionError("Error occurred when accessing Zookeeper"); } }); limitingService.acquireConnectionSlots(client, eventType, ImmutableList.of(parition)); }</code><technical_language>s/parition/partition/</technical_language>

Target:
public void whenNoFreeSlotsThenException() throws Exception { final String partition = "0"; range(0, 5).forEach(x -> { try { final String path = zkPathForConsumer(partition) + "/" + randomUUID(); CURATOR.create().creatingParentsIfNeeded().forPath(path); } catch (Exception e) { throw new AssertionError("Error occurred when accessing Zookeeper"); } }); limitingService.acquireConnectionSlots(client, eventType, ImmutableList.of(partition)); }
Source:
<code>private Task dequeueWork() { final Iterator<Task> iterator = _queue.iterator(); if (!iterator.hasNext()) { throw new IllegalStateException(); } <START> final Task result = iterator.next(); <END> _queue.remove(result); recordCounter("buffer_size", _queue.size()); return result; }</code><technical_language>Another do this: @Nullable final Task result = Iterables.getFirst(_queue); if (result == null) { throw new IllegalStateException("Some useful message here"); }</technical_language>

Target:
private Task dequeueWork() { @Nullable final Task result = Iterables.getFirst(_queue, null); if (result == null) { throw new IllegalStateException("queue is empty"); } _queue.remove(result); return result; }
Source:
<code>private List<storage_pool> buildStoragePoolsList() { List<storage_pool> pools = new LinkedList<storage_pool>(); pools.add(pool1); pools.add(pool2); pools.add(pool3); <START> return pools; <END> }</code><technical_language>return Arrays.asList (pool1, pool2, pool3);</technical_language>

Target:
private List<storage_pool> buildStoragePoolsList() { return Arrays.asList(pool1,pool2,pool3); }
Source:
<code>protected void onPause() { <START> super.onPause(); <END> lifecycleSubject.onNext(LifecycleEvent.PAUSE); }</code><technical_language>super.onXX() call</technical_language>

Target:
protected void onPause() { lifecycleSubject.onNext(LifecycleEvent.PAUSE); super.onPause(); }
Source:
<code>public scala.collection.Iterator<Tuple2<Integer, PrestoSparkRow>> compute(Partition split, TaskContext context) { List<Partition> partitions = seqAsJavaList(((ZippedPartitionsPartition) split).partitions()); <START> List<Iterator<Tuple2<Integer, PrestoSparkRow>>> iterators = unmodifiableList(IntStream.range(0, rdds.size()) <END> .mapToObj(i -> rdds.get(i).iterator(partitions.get(i), context)) .map(JavaConversions::asJavaIterator) .collect(toList())); return asScalaIterator(function.apply(iterators)); }</code><technical_language>int: for-loop + ArrayList here? feeling is Stream API code easy read reasoning (you need i is for-loop). a personal preference</technical_language>

Target:
public scala.collection.Iterator<Tuple2<Integer, PrestoSparkRow>> compute(Partition split, TaskContext context) { List<Partition> partitions = seqAsJavaList(((ZippedPartitionsPartition) split).partitions()); List<Iterator<Tuple2<Integer, PrestoSparkRow>>> iterators = new ArrayList<>(); for (int i = 0; i < rdds.size(); i++) { iterators.add(asJavaIterator(rdds.get(i).iterator(partitions.get(i), context))); } return asScalaIterator(function.apply(unmodifiableList(iterators))); }
Source:
<code>public Indexed<String> getAvailableDimensions() { final LinkedHashSet<String> availableDimensions = new LinkedHashSet<>(); baseAdapter.getAvailableDimensions().forEach(availableDimensions::add); for (JoinableClause clause : clauses) { clause.getJoinable() .getAvailableColumns() .stream() .map(c -> clause.getPrefix() + c) <START> .forEach(availableDimensions::add); <END> } return new ListIndexed<>(Lists.newArrayList(availableDimensions)); }</code><technical_language>This a method JoinableClause</technical_language>

Target:
public Indexed<String> getAvailableDimensions() { final LinkedHashSet<String> availableDimensions = new LinkedHashSet<>(); baseAdapter.getAvailableDimensions().forEach(availableDimensions::add); for (JoinableClause clause : clauses) { availableDimensions.addAll(clause.getAvailableColumnsPrefixed()); } return new ListIndexed<>(Lists.newArrayList(availableDimensions)); }
Source:
<code>public CipherExecutor yubikeyAccountCipherExecutor() { final EncryptionJwtSigningJwtCryptographyProperties crypto = casProperties.getAuthn().getMfa().getYubikey().getCrypto(); if (crypto.isEnabled()) { return new YubikeyAccountCipherExecutor( crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg()); } <START> LOGGER.info("Yubikey account encryption/signing is turned off and " <END> + "MAY NOT be safe in a production environment. " + "Consider using other choices to handle encryption, signing and verification of " + "Yubikey accounts for MFA"); return NoOpCipherExecutor.getInstance(); }</code><technical_language>sort of typo perhaps</technical_language>

Target:
public CipherExecutor yubikeyAccountCipherExecutor() { final EncryptionJwtSigningJwtCryptographyProperties crypto = casProperties.getAuthn().getMfa().getYubikey().getCrypto(); if (crypto.isEnabled()) { return new YubikeyAccountCipherExecutor( crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg()); } LOGGER.info("YubiKey account encryption/signing is turned off and " + "MAY NOT be safe in a production environment. " + "Consider using other choices to handle encryption, signing and verification of " + "YubiKey accounts for MFA"); return NoOpCipherExecutor.getInstance(); }
Source:
<code>protected void completeRemoval(IModule m) { try { IPath archiveDestination = getModuleDeployRoot(new IModule[]{m}); <START> IFilesystemController controller = getFilesystemController(); <END> boolean useAS7Behavior = DeploymentMarkerUtils.supportsJBoss7MarkerDeployment(getServer()); if( useAS7Behavior) { DeploymentMarkerUtils.removedDeployedMarker(archiveDestination, controller); DeploymentMarkerUtils.removedDeployFailedMarker(archiveDestination, controller); } } catch(CoreException ce) { JBossServerCorePlugin.log(ce); } }</code><technical_language>need controller if block :-)</technical_language>

Target:
protected void completeRemoval(IModule m) { try { IPath archiveDestination = getModuleDeployRoot(new IModule[]{m}); boolean useAS7Behavior = DeploymentMarkerUtils.supportsJBoss7MarkerDeployment(getServer()); if( useAS7Behavior) { IFilesystemController controller = getFilesystemController(); DeploymentMarkerUtils.removedDeployedMarker(archiveDestination, controller); DeploymentMarkerUtils.removedDeployFailedMarker(archiveDestination, controller); } } catch(CoreException ce) { JBossServerCorePlugin.log(ce); } }
Source:
<code>public void updateParticipantLanguage(String identifier, String language) { Participant participant = getParticipant(identifier); if(participant != null) { <START> String previousTargetLanguage = participant.getTranslationLanguage(); <END> translationManager.addLanguage(language); translationManager.removeLanguage(previousTargetLanguage); participant.setTranslationLanguage(language); } }</code><technical_language>lines exceed 80 characters</technical_language>

Target:
public void updateParticipantLanguage(String identifier, String language) { Participant participant = getParticipant(identifier); if(participant != null) { String previousLanguage = participant.getTranslationLanguage(); translationManager.addLanguage(language); translationManager.removeLanguage(previousLanguage); participant.setTranslationLanguage(language); } }
Source:
<code>public void testReleasesOnShrink() { ByteBuf b1 = PooledByteBufAllocator.DEFAULT.buffer(2).writeShort(1); <START> ByteBuf b2 = PooledByteBufAllocator.DEFAULT.buffer(2).writeShort(2); <END> ByteBuf composite = PooledByteBufAllocator.DEFAULT.compositeBuffer() .addComponents(b1, b2); assertEquals(4, composite.capacity()); composite.capacity(2); assertEquals(2, composite.capacity()); ReferenceCountUtil.release(composite); assertEquals(0, composite.refCnt()); assertEquals(0, b1.refCnt()); assertEquals(0, b2.refCnt()); }</code><technical_language>Unpooled</technical_language>

Target:
public void testReleasesOnShrink() { ByteBuf b1 = Unpooled.buffer(2).writeShort(1); ByteBuf b2 = Unpooled.buffer(2).writeShort(2); ByteBuf composite = Unpooled.compositeBuffer() .addComponents(b1, b2); assertEquals(4, composite.capacity()); composite.capacity(2); assertEquals(2, composite.capacity()); composite.release(); assertEquals(0, composite.refCnt()); assertEquals(0, b1.refCnt()); assertEquals(0, b2.refCnt()); }
Source:
<code>public void does_nothing_when_organization_disabled() throws Exception { setupDefaultOrganization(); insertOrganization(ORGANIZATION_1, TEMPLATE_1); insertOrganization(ORGANIZATION_2, TEMPLATE_2); insertPermissionTemplate(ORGANIZATION_1, TEMPLATE_1, "Default"); insertPermissionTemplate(ORGANIZATION_2, TEMPLATE_2, "Default"); underTest.execute(); <START> checkGroups(); <END> checkPermTemplateGroups(); }</code><technical_language>suggestion: create a specific method checkNoGroups checkNoPermTemplateGroups</technical_language>

Target:
public void does_nothing_when_organization_disabled() throws Exception { setupDefaultOrganization(); insertOrganization(ORGANIZATION_1, TEMPLATE_1); insertOrganization(ORGANIZATION_2, TEMPLATE_2); insertPermissionTemplate(ORGANIZATION_1, TEMPLATE_1, "Default"); insertPermissionTemplate(ORGANIZATION_2, TEMPLATE_2, "Default"); underTest.execute(); checkNoGroups(); checkNoPermTemplateGroups(); }
Source:
<code>public AggregationBuilder getClassifierAggregation(String classifierName, String fromDate, String toDate) { String probabilityField = classifierName + "_probability"; <START> DateRangeBuilder db = AggregationBuilders.dateRange("by_date").field("created_at"); <END> if (fromDate == null && toDate != null) { db = db.addUnboundedTo(toDate); } else if (toDate == null && fromDate != null) { db = db.addUnboundedFrom(fromDate); } else { db = db.addRange(fromDate, toDate); } db = db.subAggregation( AggregationBuilders.terms("by_class").field(classifierName) .subAggregation( AggregationBuilders.avg("avg_probability").field(probabilityField) ) .subAggregation( AggregationBuilders.sum("sum_probability").field(probabilityField) ) ); return db; }</code><technical_language>if variables give some hint filterData, (but big variables). Please other places too</technical_language>

Target:
public AggregationBuilder getClassifierAggregation(String classifierName, String fromDate, String toDate) { String probabilityField = classifierName + "_probability"; DateRangeBuilder dateRangeAggregation = AggregationBuilders.dateRange("by_date").field("created_at"); if (fromDate == null && toDate != null) { dateRangeAggregation = dateRangeAggregation.addUnboundedTo(toDate); } else if (toDate == null && fromDate != null) { dateRangeAggregation = dateRangeAggregation.addUnboundedFrom(fromDate); } else { dateRangeAggregation = dateRangeAggregation.addRange(fromDate, toDate); } dateRangeAggregation = dateRangeAggregation.subAggregation( AggregationBuilders.terms("by_class").field(classifierName) .subAggregation( AggregationBuilders.avg("avg_probability").field(probabilityField) ) .subAggregation( AggregationBuilders.sum("sum_probability").field(probabilityField) ) ); return dateRangeAggregation; }
Source:
<code><START> public void startProjectFileListener(Long id) { <END> String projectsPath = ASSETS_PATH + File.separator + "projects"; Project project = projectRepo.findOne(id); if (project != null) { if (project.isHeadless()) { logger.info("Registering headless document listener: " + projectsPath + File.separator + project.getName()); fileObserverRegistry.register(new HeadlessDocumentListener(projectsPath, project.getName())); } else { logger.info("Registering standard document listener: " + projectsPath + File.separator + project.getName()); fileObserverRegistry.register(new StandardDocumentListener(projectsPath, project.getName())); } }; }</code><technical_language>refactor this startProjectFileListeners() startProjectFileListener() share a common internal method? public void startProjectFileListeners() { projectRepo.findAll().forEach(project -> { activateProjectFileListener(project); }); } /** * Initiate project file listener for single project. * * @param id * ID of project initiate listener for. */ public void startProjectFileListener(Long id) { activateProjectFileListener(projectRepo.findOne(id)); }</technical_language>

Target:
public void startProjectFileListener(Long id) { Project project = projectRepo.findOne(id); if (project != null) { this.startProjectFileListener(project); } }
Source:
<code>public Activation getActivation() { if (!initialized) { init(txn, true); } <START> return activation; <END> }</code><technical_language>If returning activation of synchronization, is a chance some other thread is updating (e.g. a call reinitialize), get a partially updated copy? General question: thread deserialize ActivationHolder objects, shared</technical_language>

Target:
public synchronized Activation getActivation() { if (!initialized) { init(txn, true); } return activation; }
Source:
<code>private static void useBouncyCastleProviderThroughJceApi(BouncyCastleProvider bcProvider) throws Exception { System.out.println("Bouncy Castle JCE Provider:"); System.out.println("version: " + bcProvider.getVersion()); System.out.println("location: " + bcProvider.getClass().getProtectionDomain().getCodeSource().getLocation()); Security.addProvider(bcProvider); KeyGenerator keygenerator = KeyGenerator.getInstance("DES"); Key myDesKey = keygenerator.generateKey(); Cipher desCipher; desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding", bcProvider.getName()); desCipher.init(Cipher.ENCRYPT_MODE, myDesKey); byte[] text = "Nobody can see me".getBytes(); System.out.println("Text [Byte Format]: " + text); System.out.println("Text: " + new String(text)); byte[] textEncrypted = desCipher.doFinal(text); System.out.println("Text Encryted [Byte Format]: " + textEncrypted); desCipher.init(Cipher.DECRYPT_MODE, myDesKey); byte[] textDecrypted = desCipher.doFinal(textEncrypted); <START> System.out.println("Text Decryted: " + new String(textDecrypted)); <END> }</code><technical_language>remove system.outs this method replace logger trace/debug calls</technical_language>

Target:
private static void useBouncyCastleProviderThroughJceApi(BouncyCastleProvider bcProvider) throws Exception { Security.addProvider(bcProvider); KeyGenerator keygenerator = KeyGenerator.getInstance("DES"); Key myDesKey = keygenerator.generateKey(); Cipher desCipher; desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding", bcProvider.getName()); desCipher.init(Cipher.ENCRYPT_MODE, myDesKey); byte[] text = "Nobody can see me".getBytes(); logger.debug("Text [Byte Format]: " + Arrays.toString(text)); logger.debug("Text: " + new String(text)); byte[] textEncrypted = desCipher.doFinal(text); logger.debug("Text Encryted [Byte Format]: " + Arrays.toString(textEncrypted)); desCipher.init(Cipher.DECRYPT_MODE, myDesKey); byte[] textDecrypted = desCipher.doFinal(textEncrypted); logger.debug("Text Decryted: " + new String(textDecrypted)); }
Source:
<code>public boolean exec() throws CliException { String path = args[1]; boolean watch = cl.hasOption("w"); Stat stat; try { stat = zk.exists(path, watch); } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (KeeperException | InterruptedException ex) { throw new CliWrapperException(ex); } if (stat == null) { throw new CliWrapperException(new KeeperException.NoNodeException(path)); } new StatPrinter(out).print(stat); boolean hasD = cl.hasOption("d"); if (hasD) { StatPersisted statPersisted; try { statPersisted = zk.getStatPersisted(path); } catch (KeeperException | InterruptedException e) { e.printStackTrace(); return watch; } CreateMode mode = CreateMode.getNodeMode(statPersisted.getEphemeralOwner()); out.println("node type = " + CreateMode.getModeName(mode.getFlag())); if (mode == CreateMode.PERSISTENT_WITH_TTL) { long ttl = EphemeralType.TTL.getValue(statPersisted.getEphemeralOwner()); out.println("ttl time = " + ttl); long timeDiff = ttl - (Time.currentWallTime() - statPersisted.getMtime()); <START> out.println("remaining time = " + (timeDiff < 0 ? 0 : timeDiff)); <END> } } return watch; }</code><technical_language>put in StatDetailPrinter something</technical_language>

Target:
public boolean exec() throws CliException { String path = args[1]; boolean watch = cl.hasOption("w"); Stat stat; try { stat = zk.exists(path, watch); } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (KeeperException | InterruptedException ex) { throw new CliWrapperException(ex); } if (stat == null) { throw new CliWrapperException(new KeeperException.NoNodeException(path)); } new StatPrinter(out).print(stat); boolean hasD = cl.hasOption("d"); if (hasD) { StatPersisted statPersisted; try { statPersisted = zk.getStatPersisted(path); } catch (KeeperException | InterruptedException e) { e.printStackTrace(); return watch; } new StatPrinter(out).printDetail(statPersisted); } return watch; }
Source:
<code>private void setItemDefinitionNamespace(final ItemDefinition itemDefinition, final String namespace) { <START> final String nameWithNamespace = namespace + "." + itemDefinition.getName(); <END> final List<ItemDefinition> itemComponents = itemDefinition.getItemComponent(); if (itemDefinition.getTypeRef() != null && !isBuiltInType(itemDefinition.getTypeRef())) { itemDefinition.setTypeRef(makeQNameWithNamespace(itemDefinition.getTypeRef(), namespace)); } itemDefinition.setName(nameWithNamespace); setItemDefinitionsNamespace(itemComponents, namespace); }</code><technical_language>Is namespace empty? Is this asked chat if assume it</technical_language>

Target:
private ItemDefinition setItemDefinitionNamespace(final ItemDefinition itemDefinition, final String namespace) { final String nameWithNamespace = namespace + "." + itemDefinition.getName(); final List<ItemDefinition> itemComponents = itemDefinition.getItemComponent(); if (itemDefinition.getTypeRef() != null && !isBuiltInType(itemDefinition.getTypeRef())) { itemDefinition.setTypeRef(makeQNameWithNamespace(itemDefinition.getTypeRef(), namespace)); } itemDefinition.setName(nameWithNamespace); setItemDefinitionsNamespace(itemComponents, namespace); return itemDefinition; }
Source:
<code><START> DirectoryPersistence( Path path, long fsync, int version, List<Migration> migrations, MemoryStorage<T> storage ) { <END> this( path, plainResolve(), fsync, version, migrations, storage ); }</code><technical_language>Dont do that. methods oap public</technical_language>

Target:
public DirectoryPersistence( Path path, long fsync, int version, List<Migration> migrations, MemoryStorage<T> storage ) { this( path, plainResolve(), fsync, version, migrations, storage ); }
Source:
<code>private CorfuRuntime createDefaultRuntimeUsingFollowBackpointers() { CorfuRuntime runtime = createRuntime(DEFAULT_ENDPOINT); <START> runtime.getParameters().setFollowBackpointersEnabled(false) <END> .setCacheDisabled(false); return runtime; }</code><technical_language>this is intended follow backpointers implementation, set true</technical_language>

Target:
private CorfuRuntime createDefaultRuntimeUsingFollowBackpointers() { CorfuRuntime runtime = createRuntime(DEFAULT_ENDPOINT); runtime.getParameters().setFollowBackpointersEnabled(true) .setCacheDisabled(false); return runtime; }
Source:
<code>public void handle(PodEvent event) { final String podName = event.getPodName(); try { <START> for (Entry<String, KubernetesMachineImpl> entry : <END> machines.getMachines(runtimeIdentity).entrySet()) { final KubernetesMachineImpl machine = entry.getValue(); if (machine.getPodName().equals(podName)) { eventPublisher.sendMachineLogEvent( entry.getKey(), event.getMessage(), event.getCreationTimeStamp(), runtimeIdentity); return; } } } catch (InfrastructureException e) { LOG.error("Error while machine fetching for logs publishing. Cause: {}", e.getMessage()); } }</code><technical_language>simpler java for (KubernetesMachineImpl machine : machines.getMachines(runtimeIdentity).values()) { if (machine.getPodName().equals(podName)) { eventPublisher.sendMachineLogEvent(machine.getName(), event.getMessage(), event.getCreationTimeStamp(), runtimeIdentity); return; } }</technical_language>

Target:
public void handle(PodEvent event) { final String podName = event.getPodName(); try { for (KubernetesMachineImpl machine : machines.getMachines(runtimeIdentity).values()) { if (machine.getPodName().equals(podName)) { eventPublisher.sendMachineLogEvent( machine.getName(), event.getMessage(), event.getCreationTimeStamp(), runtimeIdentity); return; } } } catch (InfrastructureException e) { LOG.error("Error while machine fetching for logs publishing. Cause: {}", e.getMessage()); } }
Source:
<code>void resizeControl (int yScroll) { if (control != null && !control.isDisposed ()) { boolean visible = GTK.gtk_expander_get_expanded (handle); GtkAllocation allocation = new GtkAllocation (); GTK.gtk_widget_get_allocation (clientHandle, allocation); int x = (GTK.GTK3) ? 0 : allocation.x; int y = (GTK.GTK3) ? 0 : allocation.y; if (x != -1 && y != -1) { int width = allocation.width; int height = allocation.height; int property = new int [1]; GTK.gtk_widget_style_get (handle, OS.focus_line_width, property, 0); y += property [0] * 2; height -= property [0] * 2; ScrollBar vBar = parent.verticalBar; if (vBar != null) { if (GTK.gtk_widget_get_visible (vBar.handle)) { GTK.gtk_widget_get_allocation (parent.scrolledHandle, allocation); width = allocation.width - parent.vScrollBarWidth () - 2 * parent.spacing; } } if (GTK.GTK3) { <START> GTK.gtk_widget_show(control.topHandle ()); <END> control.setBounds (x, y, width, Math.max (0, height), true, true); } else { control.setBounds (x, y - yScroll, width, Math.max (0, height), true, true); } } control.setVisible (visible); } }</code><technical_language>I this guarded a "if (!visible)" flag prevent showing widgets hidden</technical_language>

Target:
void resizeControl (int yScroll) { if (control != null && !control.isDisposed ()) { boolean visible = GTK.gtk_expander_get_expanded (handle); GtkAllocation allocation = new GtkAllocation (); GTK.gtk_widget_get_allocation (clientHandle, allocation); int x = (GTK.GTK3) ? 0 : allocation.x; int y = (GTK.GTK3) ? 0 : allocation.y; if (x != -1 && y != -1) { int width = allocation.width; int height = allocation.height; int property = new int [1]; GTK.gtk_widget_style_get (handle, OS.focus_line_width, property, 0); y += property [0] * 2; height -= property [0] * 2; ScrollBar vBar = parent.verticalBar; if (vBar != null) { if (GTK.gtk_widget_get_visible (vBar.handle)) { GTK.gtk_widget_get_allocation (parent.scrolledHandle, allocation); width = allocation.width - parent.vScrollBarWidth () - 2 * parent.spacing; } } if (GTK.GTK3) { if (visible) GTK.gtk_widget_show(control.topHandle ()); control.setBounds (x, y, width, Math.max (0, height), true, true); } else { control.setBounds (x, y - yScroll, width, Math.max (0, height), true, true); } } control.setVisible (visible); } }
Source:
<code>public void produceRecord(String streamName, Record record) { String targetStream = metadata.map(streamName); if (!metadata.outputStreams().contains(targetStream)) { throw new IllegalArgumentException("Stream not registered as output: " + targetStream + ":" + streamName); } List<Record> records = streamRecords.getOrDefault(targetStream, new ArrayList<>()); records.add(record); <START> streamRecords.putIfAbsent(targetStream, records); <END> }</code><technical_language>streamRecords.computIfAbsent(targetStream, key -> new ArrayList<>()).add(record);</technical_language>

Target:
public void produceRecord(String streamName, Record record) { String targetStream = metadata.map(streamName); if (!metadata.outputStreams().contains(targetStream)) { throw new IllegalArgumentException("Stream not registered as output: " + targetStream + ":" + streamName); } streamRecords.computeIfAbsent(targetStream, key -> new ArrayList<>()).add(record); }
Source:
<code>JsonUtf8Reader(JsonUtf8Reader copyFrom) { super(copyFrom); BufferedSource sourcePeek = copyFrom.source.peek(); this.source = sourcePeek; this.buffer = sourcePeek.getBuffer(); this.peeked = copyFrom.peeked; this.peekedLong = copyFrom.peekedLong; this.peekedNumberLength = copyFrom.peekedNumberLength; this.peekedString = copyFrom.peekedString; try { <START> this.source.require(copyFrom.buffer.size()); <END> } catch (IOException e) { throw new AssertionError(); } }</code><technical_language>this.source -> sourcePeek a local</technical_language>

Target:
JsonUtf8Reader(JsonUtf8Reader copyFrom) { super(copyFrom); BufferedSource sourcePeek = copyFrom.source.peek(); this.source = sourcePeek; this.buffer = sourcePeek.getBuffer(); this.peeked = copyFrom.peeked; this.peekedLong = copyFrom.peekedLong; this.peekedNumberLength = copyFrom.peekedNumberLength; this.peekedString = copyFrom.peekedString; try { sourcePeek.require(copyFrom.buffer.size()); } catch (IOException e) { throw new AssertionError(); } }
Source:
<code>public Response postAlias(final @PathParam("topology") String topology, final @PathParam("alias") String alias, final @FormParam("value") String value) { <START> if (StringUtils.isBlank(value)) { <END> return status(BAD_REQUEST). entity("Alias value cannot be null or blank"). type(MediaType.APPLICATION_JSON_TYPE).build(); } final AliasService as = getAliasService(); try { as.addAliasForCluster(topology, alias, value); return status(Response.Status.CREATED). entity("{ \"created\" : { \"topology\": \"" + topology + "\", \"alias\": \"" + alias + "\" } }"). type(MediaType.APPLICATION_JSON_TYPE). build(); } catch (AliasServiceException e) { return status(INTERNAL_SERVER_ERROR). entity("Error adding alias " + alias + " for cluster " + topology + ", reason: " + e.toString()). type(MediaType.APPLICATION_JSON_TYPE).build(); } }</code><technical_language>overkill for a full commons-langs3 dependency</technical_language>

Target:
public Response postAlias(final @PathParam("topology") String topology, final @PathParam("alias") String alias, final @FormParam("value") String value) { if (value == null || value.isEmpty()) { return status(BAD_REQUEST). entity("Alias value cannot be null or blank"). type(MediaType.APPLICATION_JSON_TYPE).build(); } final AliasService as = getAliasService(); try { as.addAliasForCluster(topology, alias, value); return status(Response.Status.CREATED). entity("{ \"created\" : { \"topology\": \"" + topology + "\", \"alias\": \"" + alias + "\" } }"). type(MediaType.APPLICATION_JSON_TYPE). build(); } catch (AliasServiceException e) { return status(INTERNAL_SERVER_ERROR). entity("Error adding alias " + alias + " for cluster " + topology + ", reason: " + e.toString()). type(MediaType.APPLICATION_JSON_TYPE).build(); } }
Source:
<code>private void initWebView() { <START> ViewCompat.setNestedScrollingEnabled(webView, true); <END> client = new URLInterceptorWebViewClient(getActivity(), webView); client.setAllLinksAsExternal(isAllLinksExternal()); client.setPageStatusListener(pageStatusListener); }</code><technical_language>IMO work properly webview</technical_language>

Target:
private void initWebView() { client = new URLInterceptorWebViewClient(getActivity(), webView); client.setAllLinksAsExternal(isAllLinksExternal()); client.setPageStatusListener(pageStatusListener); }
Source:
<code>public ObservationListResult getObservationByPatientUUIDAndConceptUUID(String configName, String patientUUID, String conceptUUID) { Validate.notEmpty(patientUUID, "Patient uuid cannot be empty"); Validate.notEmpty(conceptUUID, "Concept uuid cannot be empty"); try { Config config = configService.getConfigByName(configName); return obsResource.getObservationByPatientUUIDAndConceptUUID(config, patientUUID, conceptUUID); } catch (HttpClientErrorException e) { <START> LOGGER.error("Error while fetching observations with Patient uuid: " + patientUUID + " and Concept uuid: " + conceptUUID); <END> return null; } }</code><technical_language>throw exception detailed error message</technical_language>

Target:
public ObservationListResult getObservationByPatientUUIDAndConceptUUID(String configName, String patientUUID, String conceptUUID) { Validate.notEmpty(patientUUID, "Patient uuid cannot be empty"); Validate.notEmpty(conceptUUID, "Concept uuid cannot be empty"); try { Config config = configService.getConfigByName(configName); return obsResource.getObservationByPatientUUIDAndConceptUUID(config, patientUUID, conceptUUID); } catch (HttpClientErrorException e) { throw new OpenMRSException(String.format("Could not get Observation for Patient uuid: %s and Concept: %s. %s %s", patientUUID, conceptUUID, e.getMessage(), e.getResponseBodyAsString()), e); } }
Source:
<code>public void process() { PerformanceMonitor.startActivity("rendering/toneMapping"); toneMappingMaterial.setFloat("viewingDistance", renderingConfig.getViewDistance().getChunkDistance().x * 8.0f, true); toneMappingMaterial.setFloat("daylight", backdropProvider.getDaylight(), true); toneMappingMaterial.setFloat("tick", worldRenderer.getMillisecondsSinceRenderingStart(), true); toneMappingMaterial.setFloat("sunlightValueAtPlayerPos", worldRenderer.getTimeSmoothedMainLightIntensity(), true); cameraDir = activeCamera.getViewingDirection(); cameraPosition = activeCamera.getPosition(); toneMappingMaterial.setFloat("swimming", activeCamera.isUnderWater() ? 1.0f : 0.0f, true); toneMappingMaterial.setFloat3("cameraPosition", cameraPosition.x, cameraPosition.y, cameraPosition.z, true); toneMappingMaterial.setFloat3("cameraDirection", cameraDir.x, cameraDir.y, cameraDir.z, true); toneMappingMaterial.setFloat3("cameraParameters", activeCamera.getzNear(), activeCamera.getzFar(), 0.0f, true); sunDirection = backdropProvider.getSunDirection(false); toneMappingMaterial.setFloat3("sunVec", sunDirection.x, sunDirection.y, sunDirection.z, true); <START> toneMappingMaterial.setFloat("time", worldProvider.getTime().getDays(), true); <END> toneMappingMaterial.setFloat("exposure", screenGrabber.getExposure() * exposureBias, true); toneMappingMaterial.setFloat("whitePoint", whitePoint, true); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }</code><technical_language>Please double-check parameters set here: unnecessary</technical_language>

Target:
public void process() { PerformanceMonitor.startActivity("rendering/toneMapping"); toneMappingMaterial.setFloat("exposure", screenGrabber.getExposure() * exposureBias, true); toneMappingMaterial.setFloat("whitePoint", whitePoint, true); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
<code>public void doCreateAccount(@NonNull String token) { String email = null; if (emailEdit.getText().length() != 0) { email = emailEdit.getText().toString(); } new CreateAccountTask(usernameEdit.getText().toString(), passwordEdit.getText().toString(), passwordRepeatEdit.getText().toString(), token, email) { @Override public void onBeforeExecute() { progressDialog.show(); } @Override public RequestBuilder buildRequest(Api api) { if (captchaHandler.isActive()) { return captchaHandler.populateBuilder(super.buildRequest(api)); } return super.buildRequest(api); } @Override public void onCatch(Throwable caught) { L.d("Caught " + caught.toString()); if (!progressDialog.isShowing()) { return; } progressDialog.dismiss(); FeedbackUtil.showError(CreateAccountActivity.this, caught); } @Override public void onFinish(final CreateAccountResult result) { if (!progressDialog.isShowing()) { return; } createAccountResult = result; if (result instanceof CreateAccountSuccessResult) { progressDialog.dismiss(); captchaHandler.cancelCaptcha(); funnel.logSuccess(); hideSoftKeyboard(CreateAccountActivity.this); Intent resultIntent = new Intent(); resultIntent.putExtra("username", ((CreateAccountSuccessResult) result).getUsername()); resultIntent.putExtra("password", passwordEdit.getText().toString()); setResult(RESULT_ACCOUNT_CREATED, resultIntent); finish(); <START> } else if ("FAIL".equals(result.getStatus())) { <END> progressDialog.dismiss(); captchaHandler.cancelCaptcha(); handleError(result.getMessage()); } } }.execute(); }</code><technical_language>Do want this extra logic here? If succeed, block. If fail here. If fail in some other way, do anything. I this moved thought ask</technical_language>

Target:
public void doCreateAccount(@NonNull String token) { String email = null; if (emailEdit.getText().length() != 0) { email = emailEdit.getText().toString(); } new CreateAccountTask(usernameEdit.getText().toString(), passwordEdit.getText().toString(), passwordRepeatEdit.getText().toString(), token, email) { @Override public void onBeforeExecute() { progressDialog.show(); } @Override public RequestBuilder buildRequest(Api api) { if (captchaHandler.isActive()) { return captchaHandler.populateBuilder(super.buildRequest(api)); } return super.buildRequest(api); } @Override public void onCatch(Throwable caught) { L.d("Caught " + caught.toString()); if (!progressDialog.isShowing()) { return; } progressDialog.dismiss(); FeedbackUtil.showError(CreateAccountActivity.this, caught); } @Override public void onFinish(final CreateAccountResult result) { if (!progressDialog.isShowing()) { return; } createAccountResult = result; if (result instanceof CreateAccountSuccessResult) { progressDialog.dismiss(); captchaHandler.cancelCaptcha(); funnel.logSuccess(); hideSoftKeyboard(CreateAccountActivity.this); Intent resultIntent = new Intent(); resultIntent.putExtra("username", ((CreateAccountSuccessResult) result).getUsername()); resultIntent.putExtra("password", passwordEdit.getText().toString()); setResult(RESULT_ACCOUNT_CREATED, resultIntent); finish(); } else { progressDialog.dismiss(); captchaHandler.cancelCaptcha(); handleError(result.getMessage()); } } }.execute(); }
Source:
<code>public AwsSettings(AwsSettings other) { this.productTypeIsEc2 = other.productTypeIsEc2; this.isEc2Instance = other.isEc2Instance; this.productTypeIsJrsAmi = other.productTypeIsJrsAmi; <START> this.awsRegions = new LinkedList<String>(other.awsRegions); <END> this.productTypeIsMpAmi = other.productTypeIsMpAmi; this.suppressEc2CredentialsWarnings = other.suppressEc2CredentialsWarnings; }</code><technical_language>other.awsRegions null exception thrown in this case. Please add check for null</technical_language>

Target:
public AwsSettings(AwsSettings other) { this.productTypeIsEc2 = other.productTypeIsEc2; this.isEc2Instance = other.isEc2Instance; this.productTypeIsJrsAmi = other.productTypeIsJrsAmi; this.awsRegions = (other.awsRegions != null) ? new LinkedList<String>(other.awsRegions) : null; this.productTypeIsMpAmi = other.productTypeIsMpAmi; this.suppressEc2CredentialsWarnings = other.suppressEc2CredentialsWarnings; }
Source:
<code>public static void sendLocalizedHotBarMessageFromServer(@Nullable EntityPlayer player, String msg, Object... args) { if (player instanceof EntityPlayerMP && Game.isHost(player.worldObj)) { EntityPlayerMP target = (EntityPlayerMP) player; for (int i = 0; i < args.length; i++) { if (args[i] instanceof String) { args[i] = translateMessage((String) args[i]); } else if (args[i] instanceof GameProfile) { String username = ((GameProfile) args[i]).getName(); args[i] = username != null ? username : "[unknown]"; } <START> } <END> target.connection.sendPacket(new SPacketChat(translateMessage(msg, args), (byte) 2)); } }</code><technical_language>Copy paste code block? Split out a function please</technical_language>

Target:
public static void sendLocalizedHotBarMessageFromServer(@Nullable EntityPlayer player, String msg, Object... args) { if (player instanceof EntityPlayerMP && Game.isHost(player.worldObj)) { modifyArgs(args); ((EntityPlayerMP) player).connection.sendPacket(new SPacketChat(translateMessage(msg, args), (byte) 2)); } }
Source:
<code>public void fetch(String remoteName, RefSpec refspec) throws GitException, InterruptedException { <START> fetch(remoteName, refspec); <END> }</code><technical_language>infinite invocation</technical_language>

Target:
public void fetch(String remoteName, RefSpec refspec) throws GitException, InterruptedException { fetch(remoteName, new RefSpec[] {refspec}); }
Source:
<code>void initialize(@NonNull final Cipher cipher, @NonNull final Key key, @NonNull final OutputStream output) throws GeneralSecurityException, IOException; } <START> public interface DecryptBytesHandler<T> { <END> void initialize(@NonNull final Cipher cipher, @NonNull final Key key, @NonNull final T input) throws GeneralSecurityException, IOException; }</code><technical_language>wondering if making this interface generic some confusion, especially CipherStorage implementations explicitly state type of DecryptBytesHandler expect. touch common files much, omit handler in overridden CipherStorageKeystoreAesCbc.decryptBytes</technical_language>

Target:
void initialize(@NonNull final Cipher cipher, @NonNull final Key key, @NonNull final OutputStream output) throws GeneralSecurityException, IOException; } public interface DecryptBytesHandler { void initialize(@NonNull final Cipher cipher, @NonNull final Key key, @NonNull final InputStream input) throws GeneralSecurityException, IOException; }
Source:
<code>public Dirichlet(final double[] alpha) { Utils.nonNull(alpha); Arrays.stream(alpha).forEach(a -> ParamUtils.isPositive(a, "Dirichlet parameters must be positive.")); <START> if (alpha.length < 1) { <END> throw new IllegalArgumentException("Dirichlet parameters must have at least one element"); } this.alpha = Arrays.copyOf(alpha, alpha.length); }</code><technical_language>Utils.validateArg</technical_language>

Target:
public Dirichlet(final double[] alpha) { Utils.nonNull(alpha); Arrays.stream(alpha).forEach(a -> ParamUtils.isPositive(a, "Dirichlet parameters must be positive.")); Utils.validateArg(alpha.length > 0, "Dirichlet parameters must have at least one element"); this.alpha = Arrays.copyOf(alpha, alpha.length); }