auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void shouldGoThroughRebalancingCorrectly() throws ExecutionException, InterruptedException { <END> final String repartitionName = "rebalancing-test"; final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); final Repartitioned<String, String> repartitioned = Repartitioned.<String, String>as(repartitionName) .withKeySerde(Serdes.String()) .withValueSerde(Serdes.String()) .withNumberOfPartitions(2); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) .selectKey((key, value) -> key.toString()) .repartition(repartitioned) .groupByKey() .count() .toStream() .to(outputTopic); startStreams(builder); final KafkaStreams kafkaStreamsToClose = startStreams(builder); validateReceivedMessages( new StringDeserializer(), new LongDeserializer(), Arrays.asList( new KeyValue<>("1", 1L), new KeyValue<>("2", 1L) ) ); kafkaStreamsToClose.close(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "C"), new KeyValue<>(2, "D") ) ); validateReceivedMessages( new StringDeserializer(), new LongDeserializer(), Arrays.asList( new KeyValue<>("1", 2L), new KeyValue<>("2", 2L) ) ); final String repartitionTopicName = toRepartitionTopicName(repartitionName); assertTrue(topicExists(repartitionTopicName)); assertEquals(2, getNumberOfPartitionsForTopic(repartitionTopicName)); }</code><technical_language>this test is about, ie, is relate repartition() feature</technical_language>

Target:
public void shouldGoThroughRebalancingCorrectly() throws Exception { final String repartitionName = "rebalancing-test"; final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); final Repartitioned<String, String> repartitioned = Repartitioned.<String, String>as(repartitionName) .withKeySerde(Serdes.String()) .withValueSerde(Serdes.String()) .withNumberOfPartitions(2); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) .selectKey((key, value) -> key.toString()) .repartition(repartitioned) .groupByKey() .count() .toStream() .to(outputTopic); startStreams(builder); final KafkaStreams kafkaStreamsToClose = startStreams(builder); validateReceivedMessages( new StringDeserializer(), new LongDeserializer(), Arrays.asList( new KeyValue<>("1", 1L), new KeyValue<>("2", 1L) ) ); kafkaStreamsToClose.close(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "C"), new KeyValue<>(2, "D") ) ); validateReceivedMessages( new StringDeserializer(), new LongDeserializer(), Arrays.asList( new KeyValue<>("1", 2L), new KeyValue<>("2", 2L) ) ); final String repartitionTopicName = toRepartitionTopicName(repartitionName); assertTrue(topicExists(repartitionTopicName)); assertEquals(2, getNumberOfPartitionsForTopic(repartitionTopicName)); }
Source:
<code>public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); if (getImage().getQuotaId() != null && getImage().getQuotaId().equals(getDestinationQuotaId())) { return list; } list.add(new QuotaStorageConsumptionParameter( getDestinationQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, getParameters().getStorageDomainId(), (double)getImage().getSizeInGigabytes())); <START> if (ImageOperation.Move.equals(getParameters().getOperation())) { <END> if (getImage().getQuotaId() != null && !Guid.Empty.equals(getImage().getQuotaId())) { list.add(new QuotaStorageConsumptionParameter( getImage().getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.RELEASE, getParameters().getSourceDomainId().getValue(), (double)getImage().getSizeInGigabytes())); } } return list; }</code><technical_language>== instead of equals</technical_language>

Target:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); if (getImage().getQuotaId() != null && getImage().getQuotaId().equals(getDestinationQuotaId())) { return list; } list.add(new QuotaStorageConsumptionParameter( getDestinationQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, getParameters().getStorageDomainId(), (double)getImage().getSizeInGigabytes())); if (ImageOperation.Move == getParameters().getOperation()) { if (getImage().getQuotaId() != null && !Guid.Empty.equals(getImage().getQuotaId())) { list.add(new QuotaStorageConsumptionParameter( getImage().getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.RELEASE, getParameters().getSourceDomainId().getValue(), (double)getImage().getSizeInGigabytes())); } } return list; }
Source:
<code>public PcapNgBlock(SeekableByteChannel fileChannel, ByteOrder byteOrder) throws IOException, BadPcapFileException { ByteBuffer pcapPacketHeader; if (fileChannel.size() - fileChannel.position() == 0) { <START> throw new BadPcapFileException("Reaching end of file, cannot read the block."); END> } pcapPacketHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapPacketHeader.order(byteOrder); fileChannel.read(pcapPacketHeader); pcapPacketHeader.flip(); int blockType = pcapPacketHeader.getInt(); setBlockType(blockType); int blockLength = pcapPacketHeader.getInt(); setBlockLength(blockLength); fBody = (ByteBuffer) pcapPacketHeader.position(PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); setBody(fBody); }</code><technical_language>reach end of file, is exception, is normal stop parsing more packets</technical_language>

Target:
public PcapNgBlock(SeekableByteChannel fileChannel, ByteOrder byteOrder) throws IOException, BadPcapFileException { ByteBuffer pcapPacketHeader; pcapPacketHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); pcapPacketHeader.order(byteOrder); fileChannel.read(pcapPacketHeader); pcapPacketHeader.flip(); int blockType = pcapPacketHeader.getInt(); fBlockType = blockType; int blockLength = pcapPacketHeader.getInt(); fBlockLength = blockLength; fBody = ByteBuffer.allocate(blockLength - PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); fBody.order(byteOrder); fileChannel.read(fBody); fBody.flip(); fBody.position(0); }
Source:
<code>public void secureGet() throws Exception { server.useHttps(handshakeCertificates.sslSocketFactory(), false); url = server.url("/"); server.enqueue(new MockResponse()); Response response = client.newCall(request().build()).execute(); assertNotNull(response.body()); response.body().bytes(); logRecorder .assertLogMatch("callStart: Request\\{method=GET, url=" + url + ", tags=\\{\\}\\}") .assertLogMatch("dnsStart: " + url.host()) .assertLogMatch("dnsEnd: \\[.+\\]") .assertLogMatch("connectStart: " + url.host() + "/.+ DIRECT") .assertLogMatch("secureConnectStart") .assertLogMatch("secureConnectEnd: Handshake\\{" + "tlsVersion=TLS_1_[23] " <START> + "cipherSuite=(?:TLS_(?:ECDHE_ECDSA_WITH_|)AES_(?:256_GCM_SHA384|128_GCM_SHA256)) " <END> + "peerCertificates=\\[CN=localhost\\] " + "localCertificates=\\[\\]}") .assertLogMatch("connectEnd: h2") .assertLogMatch( "connectionAcquired: Connection\\{" + url.host() + ":\\d+, proxy=DIRECT hostAddress=" + url.host() + "/.+ cipherSuite=.+ protocol=h2}") .assertLogMatch("requestHeadersStart") .assertLogMatch("requestHeadersEnd") .assertLogMatch("responseHeadersStart") .assertLogMatch( "responseHeadersEnd: Response\\{protocol=h2, code=200, message=, url=" + url + "}") .assertLogMatch("responseBodyStart") .assertLogMatch("responseBodyEnd: byteCount=0") .assertLogMatch("connectionReleased") .assertLogMatch("callEnd") .assertNoMoreLogs(); }</code><technical_language>This reads intentional cipher, instead check starts TLS_</technical_language>

Target:
public void secureGet() throws Exception { server.useHttps(handshakeCertificates.sslSocketFactory(), false); url = server.url("/"); server.enqueue(new MockResponse()); Response response = client.newCall(request().build()).execute(); assertNotNull(response.body()); response.body().bytes(); logRecorder .assertLogMatch("callStart: Request\\{method=GET, url=" + url + ", tags=\\{\\}\\}") .assertLogMatch("dnsStart: " + url.host()) .assertLogMatch("dnsEnd: \\[.+\\]") .assertLogMatch("connectStart: " + url.host() + "/.+ DIRECT") .assertLogMatch("secureConnectStart") .assertLogMatch("secureConnectEnd: Handshake\\{" + "tlsVersion=TLS_1_[23] " + "cipherSuite=TLS_.* " + "peerCertificates=\\[CN=localhost\\] " + "localCertificates=\\[\\]}") .assertLogMatch("connectEnd: h2") .assertLogMatch( "connectionAcquired: Connection\\{" + url.host() + ":\\d+, proxy=DIRECT hostAddress=" + url.host() + "/.+ cipherSuite=.+ protocol=h2}") .assertLogMatch("requestHeadersStart") .assertLogMatch("requestHeadersEnd") .assertLogMatch("responseHeadersStart") .assertLogMatch( "responseHeadersEnd: Response\\{protocol=h2, code=200, message=, url=" + url + "}") .assertLogMatch("responseBodyStart") .assertLogMatch("responseBodyEnd: byteCount=0") .assertLogMatch("connectionReleased") .assertLogMatch("callEnd") .assertNoMoreLogs(); }
Source:
<code>private void notifyAsyncAckReceived(long sendTime, String siteName, Throwable throwable) { log.debugf("Async ack received from %s. Throwable=%s", siteName, throwable); OfflineStatus status = offlineStatus.get(siteName); if (status == null) { return; } if (throwable == null) { if (!status.isOffline()) { status.reset(); } return; } if (isCommunicationError(throwable)) { status.updateOnCommunicationFailure(sendTime); } else if (throwable instanceof ExecutionException && isCommunicationError(throwable.getCause())) { status.updateOnCommunicationFailure(sendTime); <START> } <END> }</code><technical_language>I add this code this: java if (isCommunicationError(throwable)) { status.updateOnCommunicationFailure(sendTime); } java private static boolean isCommunicationError(Throwable throwable) { Throwable error = throwable; if(throwable instanceof ExecutionException) { error = throwable.getCause(); } return error instanceof TimeoutException || error instanceof org.infinispan.util.concurrent.TimeoutException || error instanceof UnreachableException || error instanceof CacheUnreachableException || error instanceof SuspectException; }</technical_language>

Target:
private void notifyAsyncAckReceived(long sendTime, String siteName, Throwable throwable) { log.debugf("Async ack received from %s. Throwable=%s", siteName, throwable); OfflineStatus status = offlineStatus.get(siteName); if (status == null) { return; } if (throwable == null) { if (!status.isOffline()) { status.reset(); } return; } if (isCommunicationError(throwable)) { status.updateOnCommunicationFailure(sendTime); } }
Source:
<code>public <U> List<U> sort(Collection<U> children) { if (children == null || children.isEmpty()) { return Collections.emptyList(); } AvroSchemaFactory<U> factory = getFactory(children.iterator().next()); if (factory == null) { return Collections.emptyList(); } List<U> sortedChildren = new ArrayList<>(children); Collections.sort(sortedChildren, (o1, o2) -> Objects.compare( factory.getQualifiedName(o1), <START> factory.getQualifiedName(o2), <END> String::compareTo)); return sortedChildren; }</code><technical_language>Comparator#comparing call sort sortedChildren instead of calling Collections</technical_language>

Target:
public <U> List<U> sort(Collection<U> children) { if (children == null || children.isEmpty()) { return Collections.emptyList(); } AvroSchemaFactory<U> factory = getFactory(children.iterator().next()); if (factory == null) { return Collections.emptyList(); } List<U> sortedChildren = new ArrayList<>(children); sortedChildren.sort((o1, o2) -> Objects.compare( factory.getQualifiedName(o1), factory.getQualifiedName(o2), String::compareTo)); return sortedChildren; }
Source:
<code>protected Object createTest() throws Exception { try { checkSupportedVersion(); final TestConfiguration testConfiguration = createTestConfiguration(); weld = new Weld() { protected Deployment createDeployment(ResourceLoader resourceLoader, CDI11Bootstrap bootstrap) { try { <START> return new Weld11TestUrlDeployment(resourceLoader, bootstrap, testConfiguration); <END> } catch (IOException e) { startupException = e; throw new RuntimeException(e); } } protected Deployment createDeployment(ResourceLoader resourceLoader, Bootstrap bootstrap) { try { return new WeldTestUrlDeployment(resourceLoader, bootstrap, testConfiguration); } catch (IOException e) { startupException = e; throw new RuntimeException(e); } }; }; try { container = weld.initialize(); } catch (Throwable e) { if (startupException == null) { startupException = e; } if (e instanceof ClassFormatError) { throw e; } } } catch (ClassFormatError e) { startupException = parseClassFormatError(e); } catch (Throwable e) { startupException = new Exception("Unable to start weld", e); } return createTest(clazz); }</code><technical_language>+1: for shortening constructor arg list</technical_language>

Target:
protected Object createTest() throws Exception { try { checkSupportedVersion(); final TestConfiguration testConfig = createTestConfiguration(); weld = new Weld() { protected Deployment createDeployment(ResourceLoader resourceLoader, CDI11Bootstrap bootstrap) { try { return new Weld11TestUrlDeployment(resourceLoader, bootstrap, testConfig); } catch (IOException e) { startupException = e; throw new RuntimeException(e); } } protected Deployment createDeployment(ResourceLoader resourceLoader, Bootstrap bootstrap) { try { return new WeldTestUrlDeployment(resourceLoader, bootstrap, testConfig); } catch (IOException e) { startupException = e; throw new RuntimeException(e); } }; }; try { container = weld.initialize(); } catch (Throwable e) { if (startupException == null) { startupException = e; } if (e instanceof ClassFormatError) { throw e; } } } catch (ClassFormatError e) { startupException = parseClassFormatError(e); } catch (Throwable e) { startupException = new Exception("Unable to start weld", e); } return createTest(clazz); }
Source:
<code>public Collection<CollectionElementVariable2> createElemConstraintVariables() { Collection<CollectionElementVariable2> newVars= new HashSet<>(); computeContainerStructure(); if (DEBUG_INITIALIZATION) System.out.println("\n*** Creating Element Variables: ***\n"); for (ConstraintVariable2 <START> fAllConstraintVariable : <END> fAllConstraintVariables) { newVars.addAll(createVariablesFor(fAllConstraintVariable)); } return newVars; }</code><technical_language>rename constraintVariable</technical_language>

Target:
public Collection<CollectionElementVariable2> createElemConstraintVariables() { Collection<CollectionElementVariable2> newVars= new HashSet<>(); computeContainerStructure(); if (DEBUG_INITIALIZATION) System.out.println("\n*** Creating Element Variables: ***\n"); for (ConstraintVariable2 constraintVariable : fAllConstraintVariables) { newVars.addAll(createVariablesFor(constraintVariable)); } return newVars; }
Source:
<code>private ObjectId createTree(String... paths) throws IOException { final ObjectInserter odi = db.newObjectInserter(); final DirCache dc = db.readDirCache(); final DirCacheBuilder builder = dc.builder(); for (String path : paths) { DirCacheEntry entry = createEntry(path, FileMode.REGULAR_FILE); builder.add(entry); } builder.finish(); final ObjectId <START> treeId = <END> dc.writeTree(odi); odi.flush(); return treeId; }</code><technical_language>This hides class member variable</technical_language>

Target:
private ObjectId createTree(String... paths) throws IOException { final ObjectInserter odi = db.newObjectInserter(); final DirCache dc = db.readDirCache(); final DirCacheBuilder builder = dc.builder(); for (String path : paths) { DirCacheEntry entry = createEntry(path, FileMode.REGULAR_FILE); builder.add(entry); } builder.finish(); final ObjectId objId = dc.writeTree(odi); odi.flush(); return objId; }
Source:
<code>public static String getHashString(final String s) { String output = ""; try { MessageDigest digest = MessageDigest.getInstance(MD5); digest.update(s.getBytes()); byte messageDigest[] = digest.digest(); StringBuilder hexString = new StringBuilder(); for (byte aMessageDigest : messageDigest) { String h = Integer.toHexString(0xFF & aMessageDigest); while (h.length() < 2) { h = "0" + h; } hexString.append(h); } output = hexString.toString(); <START> } catch (NoSuchAlgorithmException e) { <END> Log.e(TAG, e.getMessage()); } return output; }</code><technical_language>suggest rethrowing this a runtime exception. do if MD5 is available? Is available</technical_language>

Target:
public static String getHashString(final String s) { try { MessageDigest digest = MessageDigest.getInstance(MD5); digest.update(s.getBytes()); byte messageDigest[] = digest.digest(); StringBuilder hexString = new StringBuilder(); for (byte aMessageDigest : messageDigest) { String h = Integer.toHexString(0xFF & aMessageDigest); while (h.length() < 2) { h = "0" + h; } hexString.append(h); } return hexString.toString(); } catch (NoSuchAlgorithmException e) { Log.e(TAG, e.getMessage()); throw new RuntimeException("MD5 message digest not available", e); } }
Source:
<code><START> public void acquireLock() throws IOException { <END> try { m_currentPath = m_zk.create(m_lockPath, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL); synchronized(lock) { while(true) { List<String> nodes = getAllLockingNodes(); Collections.sort(nodes); if (nodes.isEmpty() || m_currentPath.endsWith(nodes.get(0))) { return; } else { lock.wait(); } } } } catch (KeeperException | InterruptedException e) { throw new IOException(e); } }</code><technical_language>give caller more flexibility add another API acquireLockWithTimeout(int milliseconds)</technical_language>

Target:
public boolean acquireLock() { return acquireLockWithTimeout(0); }
Source:
<code>public boolean hasUseBackgroundNetworksPermission(int uid) { return <START> mApps.containsKey(uid); <END> }</code><technical_language>This guarded. need synchronized this</technical_language>

Target:
public synchronized boolean hasUseBackgroundNetworksPermission(int uid) { return mApps.containsKey(uid); }
Source:
<code>protected Map<String, Pair<String, String>> getExclusiveLocks() { return super.getExclusiveLocks(); <START> } <END></code><technical_language>override this method, call super method</technical_language>

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { return singletonMap(getParameters().getVdsId().toString(), makeLockingPair(VDS_FENCE, SAME_ACTION_ON_ENTITY_ALREADY_IN_PROGRESS)); }
Source:
<code>private static Boolean isNewStitchPoint(PointF point) { <START> if (point.x != stitchPoints.get(lastIndex).x || point.y != stitchPoints.get(lastIndex).y) { <END> return true; } return false; }</code><technical_language>simply: return stitchPoints.get(stitchPoints.size() - 1).equals(point) besides that, remove lastIndex, this is unnecessary errorprone manually size of list in a seperate variable</technical_language>

Target:
private Boolean isNewStitchPoint(PointF point) { return !stitchPoints.get(stitchPoints.size() - 1).equals(point); }
Source:
<code>public void initMap(MapFragment newMapFragment) { map = newMapFragment; findViewById(R.id.zoom_to_location).setOnClickListener(v -> map.zoomToPoint(map.getGpsLocation(), true)); findViewById(R.id.zoom_to_bounds).setOnClickListener(v -> map.zoomToBoundingBox(points, 0.8, false)); findViewById(R.id.layer_menu).setOnClickListener(v -> { MapsPreferences.showReferenceLayerDialog(this); }); findViewById(R.id.new_instance).setOnClickListener(v -> { startActivity(new Intent(Intent.ACTION_EDIT, getIntent().getData())); }); map.setGpsLocationEnabled(true); map.setGpsLocationListener(this::onLocationChanged); if (previousState != null) { restoreFromInstanceState(previousState); } map.setFeatureClickListener(this::onFeatureClicked); updateInstanceGeometry(); <START> new Handler().postDelayed(() -> { <END> if (selectedSubmissionId != -1) { onFeatureClicked(selectedSubmissionId); } }, 500); }</code><technical_language>Scheduler</technical_language>

Target:
public void initMap(MapFragment newMapFragment) { map = newMapFragment; findViewById(R.id.zoom_to_location).setOnClickListener(v -> map.zoomToPoint(map.getGpsLocation(), true)); findViewById(R.id.zoom_to_bounds).setOnClickListener(v -> map.zoomToBoundingBox(points, 0.8, false)); findViewById(R.id.layer_menu).setOnClickListener(v -> { MapsPreferences.showReferenceLayerDialog(this); }); findViewById(R.id.new_instance).setOnClickListener(v -> { startActivity(new Intent(Intent.ACTION_EDIT, getIntent().getData())); }); map.setGpsLocationEnabled(true); map.setGpsLocationListener(this::onLocationChanged); if (previousState != null) { restoreFromInstanceState(previousState); } map.setFeatureClickListener(this::onFeatureClicked); map.setClickListener(this::onClick); updateInstanceGeometry(); if (viewModel.getSelectedSubmissionId() != -1) { onFeatureClicked(viewModel.getSelectedSubmissionId()); } }
Source:
<code>protected boolean shouldProcessItemType(Item item) { if (trackerType != null && trackerValues != null) { List<MetadataValue> types = itemService .getMetadata(item, trackerType.split("\\.")[0], trackerType.split("\\.")[1], <START> trackerType.split("\\.").length == 2 ? null : trackerType.split("\\.")[2], Item.ANY); <END> if (!types.isEmpty()) { for (MetadataValue type : types) { if (trackerValues.contains(type.getValue().toLowerCase())) { return false; } } return true; } else { return true; } } else { return true; } }</code><technical_language>This more clear in code</technical_language>

Target:
protected boolean shouldProcessItemType(Item item) { if (trackerTypeMetadataField != null && trackerTypeMetadataValues != null) { String[] metadataFieldSplit = trackerTypeMetadataField.split("\\."); List<MetadataValue> types = itemService .getMetadata(item, metadataFieldSplit[0], metadataFieldSplit[1], metadataFieldSplit.length == 2 ? null : metadataFieldSplit[2], Item.ANY); if (!types.isEmpty()) { for (MetadataValue type : types) { if (trackerTypeMetadataValues.contains(type.getValue().toLowerCase())) { return false; } } return true; } else { return true; } } else { return true; } }
Source:
<code>public void testCacheManager() { GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder(); gcb.globalJmxStatistics().allowDuplicateDomains(true); String tmpDirectory = tmpDirectory(this.getClass()); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.persistence() .addStore(RocksDBStoreConfigurationBuilder.class) .location(tmpDirectory) <START> .expiredLocation(tmpDirectory + "-expired"); <END> EmbeddedCacheManager cm = new DefaultCacheManager(gcb.build(), builder.build()); Cache<String, String> cache = cm.getCache(); cache.put("a", "a"); assertEquals("a", cache.get("a")); cm.stop(); }</code><technical_language>Good one! :)</technical_language>

Target:
public void testCacheManager() { GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder(); gcb.globalJmxStatistics().allowDuplicateDomains(true); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.persistence() .addStore(RocksDBStoreConfigurationBuilder.class) .location(dataDir) .expiredLocation(expiredDir); EmbeddedCacheManager cm = new DefaultCacheManager(gcb.build(), builder.build()); Cache<String, String> cache = cm.getCache(); cache.put("a", "a"); assertEquals("a", cache.get("a")); cm.stop(); }
Source:
<code><START> public static List<String> operatorSymbols() { <END> return Lists2.map(Arrays.asList(values()), t -> t.name); }</code><technical_language>this is in tests. annotate @VisibleForTesting</technical_language>

Target:
public static List<String> operatorSymbols() { return Lists2.map(Arrays.asList(values()), t -> t.opSymbol); }
Source:
<code><START> public long getCurrentNanoTime() { <END> return System.nanoTime(); }</code><technical_language>I reason encapsulate function call another one</technical_language>

Target:
protected long getCurrentNanoTime() { return System.nanoTime(); }
Source:
<code>private void prepareBrowserStackLocal() { String platformBinaryNameUrl = getPlatformBinaryNameUrl(); File browserStackLocalZipFile = new File(browserStackLocalDirectory.getPath() + File.separator + platformBinaryNameUrl); String url = basicUrl + platformBinaryNameUrl; log.info("Creating directory: " + browserStackLocalDirectory); browserStackLocalDirectory.mkdir(); log.info("downloading zip file from: " + url + " to " + browserStackLocalZipFile.getPath()); Spacelift.task(DownloadTool.class).from(url).to(browserStackLocalZipFile.getPath()).execute().await(); log.info("extracting zip file: " + browserStackLocalZipFile + " to " + browserStackLocalDirectory.getPath()); Spacelift.task(browserStackLocalZipFile, UnzipTool.class).toDir(browserStackLocalDirectory.getPath()).execute() .await(); log.info("marking binary file: " + browserStackLocalFile.getPath() + " as executable"); <START> browserStackLocalFile.setExecutable(true); <END> }</code><technical_language>this potentially throw exception do catch log</technical_language>

Target:
private void prepareBrowserStackLocal() { String platformBinaryNameUrl = getPlatformBinaryNameUrl(); File browserStackLocalZipFile = new File(browserStackLocalDirectory.getPath() + File.separator + platformBinaryNameUrl); String url = basicUrl + platformBinaryNameUrl; log.info("Creating directory: " + browserStackLocalDirectory); browserStackLocalDirectory.mkdir(); log.info("downloading zip file from: " + url + " to " + browserStackLocalZipFile.getPath()); Spacelift.task(DownloadTool.class) .from(url) .to(browserStackLocalZipFile.getPath()) .execute().await(); log.info("extracting zip file: " + browserStackLocalZipFile + " to " + browserStackLocalDirectory.getPath()); Spacelift.task(browserStackLocalZipFile, UnzipTool.class) .toDir(browserStackLocalDirectory.getPath()) .execute().await(); log.info("marking binary file: " + browserStackLocalFile.getPath() + " as executable"); try { browserStackLocalFile.setExecutable(true); } catch (SecurityException se) { log.severe("The downloaded BrowserStackLocal binary: " + browserStackLocalFile + " could not be set as executable. This may cause additional problems."); } }
Source:
<code>public TapePersistenceStrategy(String filePath, final SerializationStrategy<E, ? extends Batch> serializationStrategy) { this.filePath = filePath; <START> this.converter = new FileObjectQueue.Converter<E>() { <END> @Override public E from(byte[] bytes) throws IOException { return serializationStrategy.deserializeData(bytes); } @Override public void toStream(E data, OutputStream bytes) throws IOException { bytes.write(serializationStrategy.serializeData(data)); } }; }</code><technical_language>please move this a class</technical_language>

Target:
public TapePersistenceStrategy(String filePath, final SerializationStrategy<E, ? extends Batch> serializationStrategy) { this.filePath = filePath; this.converter = new DataObjectConverter<>(serializationStrategy); }
Source:
<code>private boolean areBricksInTheList(final List<GlusterBrickEntity> bricks, final List<GlusterBrickEntity> searchBricks) { boolean found = false; for (GlusterBrickEntity paramBrick : bricks) { for (GlusterBrickEntity brick : searchBricks) { <START> if (paramBrick.getId() == brick.getId() || (paramBrick.getBrickDirectory().equals(brick.getBrickDirectory()) <END> && paramBrick.getServerId() == brick.getServerId())) { found = true; break; } if (!found) { return found; } } } return found; }</code><technical_language>Guid compared equals</technical_language>

Target:
private boolean areBricksInTheList(final List<GlusterBrickEntity> bricks, final List<GlusterBrickEntity> searchBricks) { boolean found = false; for (GlusterBrickEntity paramBrick : bricks) { for (GlusterBrickEntity brick : searchBricks) { if (paramBrick.getId().equals(brick.getId()) || (paramBrick.getBrickDirectory().equals(brick.getBrickDirectory()) && paramBrick.getServerId().equals(brick.getServerId()))) { found = true; break; } if (!found) { return found; } found = false; } } return found; }
Source:
<code>public Calendar getCurrentTimeCalendar() { BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext(); WebRequest webRequest = brc.getWebRequest(); if(BLCRequestUtils.isOKtoUseSession(webRequest)) { HttpSession session = brc.getRequest().getSession(); TimeZone timeZone = (TimeZone) session.getAttribute(CLIENT_TIMEZONE); <START> int n = 0; <END> if(timeZone != null) { return SystemTime.asCalendar(Locale.getDefault(), timeZone, true); } } return SystemTime.asCalendar(true); }</code><technical_language>suggestion This code leftover, this removed</technical_language>

Target:
public Calendar getCurrentTimeCalendar() { BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext(); WebRequest webRequest = brc.getWebRequest(); if(BLCRequestUtils.isOKtoUseSession(webRequest)) { HttpSession session = brc.getRequest().getSession(); TimeZone timeZone = (TimeZone) session.getAttribute(CLIENT_TIMEZONE); if(timeZone != null) { return SystemTime.asCalendar(Locale.getDefault(), timeZone, true); } } return SystemTime.asCalendar(true); }
Source:
<code>public CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) { assertRemoteCacheManagerIsStarted(); ReplaceOperation<V> op = operationsFactory.newReplaceOperation(compatKeyIfNeeded(key), keyToBytes(key), valueToBytes(value), lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit, dataFormat); CompletableFuture<V> result = op.execute(); if (statistics) { <START> result.thenRun(() -> clientStatistics.incrementRemoteStores()); <END> } return result; }</code><technical_language>This is trouble cond commands talked about..</technical_language>

Target:
public CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) { assertRemoteCacheManagerIsStarted(); ReplaceOperation<V> op = operationsFactory.newReplaceOperation(keyAsObjectIfNeeded(key), keyToBytes(key), valueToBytes(value), lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit, dataFormat); return op.execute(); }
Source:
<code>synchronized public void send(Collection<PlainCommand> commands) { if (autoflush) { for (PlainCommand command : commands) { send(command); } return; } StringBuilder builder = new StringBuilder(); for (PlainCommand command : commands) { builder.append(command.compose()); <START> builder.append("\n"); <END> } send(builder.toString()); }</code><technical_language>need append new line, AbstractInsertCommand.compose() method this: return sb.append('\n').toString();</technical_language>

Target:
synchronized public void send(Collection<PlainCommand> commands) { if (autoflush) { for (PlainCommand command : commands) { send(command); } return; } StringBuilder builder = new StringBuilder(); for (PlainCommand command : commands) { String rawCommand = command.compose(); builder.append(rawCommand); if (!rawCommand.endsWith("\n")) { builder.append("\n"); } } send(builder.toString()); }
Source:
<code>public CompletableFuture<DnsLookupResponseDTO> execute(DnsLookupRequestDTO request) { <START> String ipAddr = request.getHostRequest(); <END> String queryType = request.getQueryType(); DnsLookupResponseDTO dto = new DnsLookupResponseDTO(); InetAddress addr = InetAddressUtils.addr(ipAddr); if (queryType.equals(QueryType.LOOKUP.toString())) { dto.setHostResponse(addr.getHostAddress()); } else if (queryType.equals(QueryType.REVERSE_LOOKUP.toString())) { dto.setHostResponse(addr.getCanonicalHostName()); } CompletableFuture<DnsLookupResponseDTO> response = new CompletableFuture<DnsLookupResponseDTO>(); response.complete(dto); return response; }</code><technical_language>variable name ipAddr is misleading a hostname</technical_language>

Target:
public CompletableFuture<DnsLookupResponseDTO> execute(DnsLookupRequestDTO request) { String hostRequest = request.getHostRequest(); QueryType queryType = request.getQueryType(); DnsLookupResponseDTO dto = new DnsLookupResponseDTO(); try { InetAddress addr = InetAddressUtils.addr(hostRequest); if (queryType.equals(QueryType.LOOKUP)) { dto.setHostResponse(addr.getHostAddress()); } else if (queryType.equals(QueryType.REVERSE_LOOKUP)) { dto.setHostResponse(addr.getCanonicalHostName()); } } catch (Exception e) { dto.setFailureMessage(e.getMessage()); } CompletableFuture<DnsLookupResponseDTO> response = new CompletableFuture<DnsLookupResponseDTO>(); response.complete(dto); return response; }
Source:
<code>public boolean rejoinNeededOrPending() { if (!subscriptions.partitionsAutoAssigned()) return false; if (assignmentSnapshot != null && !assignmentSnapshot.matches(metadataSnapshot)) { maybeLosePartitions("topic metadata has changed and therefore some topics may not exist any moreq"); return true; } if (joinedSubscription != null && !joinedSubscription.equals(subscriptions.subscription())) { <START> maybeLosePartitions("consumer subscription has changed since last joined generation"); <END> return true; } return super.rejoinNeededOrPending(); }</code><technical_language>I in this case want revoke (not lose) partitions longer in subscription</technical_language>

Target:
public boolean rejoinNeededOrPending() { if (!subscriptions.partitionsAutoAssigned()) return false; if (assignmentSnapshot != null && !assignmentSnapshot.matches(metadataSnapshot)) return true; if (joinedSubscription != null && !joinedSubscription.equals(subscriptions.subscription())) { return true; } return super.rejoinNeededOrPending(); }
Source:
<code>public synchronized void out(@Nullable String line) { if (Strings.isNullOrEmpty(line) || line.equals("Ready")) <START> return; <END> NotifierProcessOutput delegate = getNotifier(); mLogger.verbose("AAPT out(%1$s): %2$s", mProcess.hashCode(), line); if (delegate != null) { mLogger.verbose("AAPT out(%1$s): -> %2$s", mProcess.hashCode(), delegate.mJob); delegate.out(line); } else { mLogger.error(null, "AAPT out(%1$s) : No Delegate set : lost message:%2$s", mProcess.hashCode(), line); } }</code><technical_language>code style curly brace new line for return</technical_language>

Target:
public synchronized void out(@Nullable String line) { if (Strings.isNullOrEmpty(line) || line.equals("Ready")) { return; } NotifierProcessOutput delegate = getNotifier(); mLogger.verbose("AAPT out(%1$s): %2$s", mProcess.hashCode(), line); if (delegate != null) { mLogger.verbose("AAPT out(%1$s): -> %2$s", mProcess.hashCode(), delegate.mJob); delegate.out(line); } else { mLogger.error(null, "AAPT out(%1$s) : No Delegate set : lost message:%2$s", mProcess.hashCode(), line); } }
Source:
<code><START> public Monitor(Map conf) { <END> startTimestampPerId = Maps.newConcurrentMap(); if (RiemannDiscovery.isAWS()) { eventSender = RiemannEventSender.getRiemannEventsSender(); } else { eventSender = new LoggerEventSender(); } customAttributes = extractCustomEventAttributes(conf); }</code><technical_language>Un-delete seocnd constrcutor (public Monitor())</technical_language>

Target:
public Monitor(Map conf) { startTimestampPerId = Maps.newConcurrentMap(); if (RiemannDiscovery.getInstance().isAWS()) { eventSender = RiemannEventSender.getInstance(); } else { eventSender = new LoggerEventSender(); } customAttributes = extractCustomEventAttributes(conf); }
Source:
<code>private void setStack(DoorsTableRow current, RowType rt) { if (stack.empty()) { stack.push(current); } RowType stackTop = stack.peek().getType(); switch (stackTop) { case SINGLE: handleSingle(current, rt); break; case MULTI_START: case MULTI_MID: handleMulti(current, rt); break; case MULTI_END: break; case FIRST_ROW: <START> break; <END> } }</code><technical_language>default</technical_language>

Target:
private void setStack(DoorsTableRow current, RowType rt) { if (stack.empty()) { stack.push(current); } RowType stackTop = stack.peek().getType(); switch (stackTop) { case SINGLE: handleSingle(current, rt); break; case MULTI_START: case MULTI_MID: handleMulti(current, rt); break; case MULTI_END: break; case FIRST_ROW: break; default: throw new OseeStateException("Unhandled enumeration", current); } }
Source:
<code>private void checkResource(boolean fail, String resource) { if (fail) { <START> LOGGER.error("No " + resource + " resources present"); <END> } }</code><technical_language>error, offer 0.0 cpu resources, 2048 mem resources. While useful framework, error. Debug info</technical_language>

Target:
private void checkResource(boolean fail, String resource) { if (fail) { LOGGER.debug("No " + resource + " resources present"); } }
Source:
<code>public void sizeBatcherTest() throws InterruptedException { TestListenter<Integer> listenter = new TestListenter<Integer>(); final Batcher<Integer> batcher = BatcherBuilder.create(100) .build(listenter); <START> CountDownLatch start = new CountDownLatch(1); <END> CountDownLatch done = setupProducers(batcher, start, 10, 100); start.countDown(); done.await(); sleep(20); batcher.close(); assertEquals(1000, listenter.getCount()); assertTrue(listenter.getNumBatches() >= 10); for (Collection<Integer> batch : listenter.getBatches()) { assertEquals(100, batch.size()); } }</code><technical_language>This is interesting pattern starting multi-threaded producers</technical_language>

Target:
public void sizeBatcherTest() throws InterruptedException { TestListenter<Integer> listenter = new TestListenter<Integer>(); final Batcher<Integer> batcher = BatcherBuilder.create() .sizeBound(100) .build(listenter); CountDownLatch start = new CountDownLatch(1); CountDownLatch done = setupProducers(batcher, start, 10, 100); start.countDown(); done.await(); sleep(20); batcher.close(); assertEquals(1000, listenter.getCount()); assertTrue(listenter.getNumBatches() >= 10); for (Collection<Integer> batch : listenter.getBatches()) { assertEquals(100, batch.size()); } }
Source:
<code>public void beforeServerStopped(KieServer kieServer) { if (routerURL == null) { logger.debug("KieServer router url not given, skipping"); return; } ServiceResponse<KieContainerResourceList> containers = kieServer.listContainers(activeOnly); containers.getResult().getContainers().forEach(ci -> { routers().forEach(url -> { String alias = getContainerAlias(ci); String containerIdPayload = "{" + MessageFormat.format(CONTAINER_JSON, ci.getContainerId(), alias, serverURL, serverId, ci.getReleaseId().toExternalForm()) + "}"; <START> boolean success = send(url + "/admin/remove", ci.getContainerId(), containerIdPayload, false, false); <END> if (success) { logger.info("Removed '{}' as server location for container id '{}'", serverURL, ci.getContainerId()); } }); }); }</code><technical_language>nice URL parts - "/admin/remove"... - stored in some constants find out places in code</technical_language>

Target:
public void beforeServerStopped(KieServer kieServer) { if (routerURL == null) { logger.debug("KieServer router url not given, skipping"); return; } ServiceResponse<KieContainerResourceList> containers = kieServer.listContainers(activeOnly); containers.getResult().getContainers().forEach(ci -> { routers().forEach(url -> { String alias = getContainerAlias(ci); String containerIdPayload = "{" + MessageFormat.format(CONTAINER_JSON, ci.getContainerId(), alias, serverURL, serverId, ci.getReleaseId().toExternalForm()) + "}"; boolean success = send(url + ROUTER_REMOVE_URL, ci.getContainerId(), containerIdPayload, false, false); if (success) { logger.info("Removed '{}' as server location for container id '{}'", serverURL, ci.getContainerId()); } }); }); }
Source:
<code>private static String getMessageToLog(String loggerString, AuditLog auditLog) { String message; if (loggerString.isEmpty()) { message = auditLog.toStringForLogging(); } else { message = MessageFormat.format(loggerString, auditLog.getMessage()); } <START> return MessageFormat.format("EVENT_ID: {0}, {1}", auditLog.getLogType().getValue(), message); <END> }</code><technical_language>@Shirly: do want in logs: ID of event type (for example 27) NAME of event type (in this case 'VDS_STATUS_CHANGE_FAILED_DUE_TO_STOP_SPM_FAILURE')? asking told in do joins in Elastic Search, if want allow filtering event types, users code is 27, VDS_STATUS_CHANGE_FAILED_DUE_TO_STOP_SPM_FAILURE means ..</technical_language>

Target:
private static String getMessageToLog(String loggerString, AuditLog auditLog) { String message; if (loggerString.isEmpty()) { message = auditLog.toStringForLogging(); } else { message = MessageFormat.format(loggerString, auditLog.getMessage()); } return MessageFormat.format("EVENT_ID: {0}({1}), {2}", auditLog.getLogType(), auditLog.getLogType().getValue(), message); }
Source:
<code>private void runFormatterWithPlugin() { <START> TestHelper.builder() <END> .withFeatures(failingFeature, successfulFeature, pendingFeature) .withRuntimeArgs("--plugin", "timeline:" + reportDir.getAbsolutePath()) .withStepsToResult(stepsToResult) .withStepsToLocation(stepsToLocation) .withTimeServiceIncrement(STEP_DURATION) .build() .run(); }</code><technical_language>Neat</technical_language>

Target:
private void runFormatterWithPlugin() { TestHelper.builder() .withFeatures(failingFeature, successfulFeature, pendingFeature) .withRuntimeArgs("--plugin", "timeline:" + reportDir.getAbsolutePath()) .withStepsToResult(stepsToResult) .withStepsToLocation(stepsToLocation) .withTimeServiceIncrement(TimeUnit.MILLISECONDS.toNanos(STEP_DURATION_MS)) .build() .run(); }
Source:
<code>public void testSelectInformationSchemaColumns() { assertQuery( <START> "SELECT table_schema FROM information_schema.columns WHERE table_schema = 'tpch' LIMIT 1", <END> "VALUES 'tpch'"); assertQuery( "SELECT table_name FROM information_schema.columns WHERE table_name = 'orders' LIMIT 1", "VALUES 'orders'"); }</code><technical_language>ORDER query deterministic</technical_language>

Target:
public void testSelectInformationSchemaColumns() { assertQuery( "SELECT table_schema FROM information_schema.columns WHERE table_schema = 'tpch' ORDER BY table_schema LIMIT 1", "VALUES 'tpch'"); assertQuery( "SELECT table_name FROM information_schema.columns WHERE table_name = 'orders' ORDER BY table_name LIMIT 1", "VALUES 'orders'"); }
Source:
<code>public void onResume() { super.onResume(); if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0 && <START> getIntent().getAction() == DISCONNECT_ACTION) { <END> Log.d(TAG, "Got disconnect all request"); disconnectAll(); } closeOnDisconnectAll = waitingForDisconnectAll && closeOnDisconnectAll; }</code><technical_language>DISCONNECT_ACTION.equals(getIntent().getAction())</technical_language>

Target:
public void onResume() { super.onResume(); if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0 && DISCONNECT_ACTION.equals(getIntent().getAction())) { Log.d(TAG, "Got disconnect all request"); disconnectAll(); } closeOnDisconnectAll = waitingForDisconnectAll && closeOnDisconnectAll; }
Source:
<code>public void handleSetConfigurationObjectResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handle SetConfigurationObject response for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } <START> this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() <END> .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }</code><technical_language>Extract building of ResponseMessage variable (in eclipse, select text, right-click > refactor > extract local variable / select code + shift+alt+L). This code a bit more readable, especially passing in other besides ResponseMessage</technical_language>

Target:
public void handleSetConfigurationObjectResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handle SetConfigurationObject response for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
<code>public QueryStateTimer(Ticker ticker) { <START> this.ticker = ticker; <END> this.createNanos = tickerNanos(); this.lastHeartbeatNanos = new AtomicReference<>(createNanos); }</code><technical_language>requireNonNull</technical_language>

Target:
public QueryStateTimer(Ticker ticker) { this.ticker = requireNonNull(ticker, "ticker is null"); this.createNanos = tickerNanos(); this.lastHeartbeatNanos = new AtomicReference<>(createNanos); }
Source:
<code>public void parseFiles(Collection<String> paths, Handler handler, SourceVersion sourceVersion) { List<File> files = new ArrayList<>(); for (String path : paths) { files.add(new File(path)); } try { <START> JavacEnvironment env = createEnvironment(files, null, false, null); <END> List<CompilationUnitTree> units = new ArrayList<>(); for (CompilationUnitTree unit : env.task().parse()) { units.add(unit); } env.task().analyze(); processDiagnostics(env.diagnostics()); if (ErrorUtil.errorCount() == 0) { for (CompilationUnitTree ast : units) { com.google.devtools.j2objc.ast.CompilationUnit unit = TreeConverter .convertCompilationUnit(options, env, (JCTree.JCCompilationUnit) ast); processDiagnostics(env.diagnostics()); handler.handleParsedUnit(unit.getSourceFilePath(), unit); } } } catch (IOException e) { ErrorUtil.fatalError(e, "javac file manager error"); } }</code><technical_language>Revert</technical_language>

Target:
public void parseFiles(Collection<String> paths, Handler handler, SourceVersion sourceVersion) { List<File> files = new ArrayList<>(); for (String path : paths) { files.add(new File(path)); } try { JavacEnvironment env = createEnvironment(files, null, false); List<CompilationUnitTree> units = new ArrayList<>(); for (CompilationUnitTree unit : env.task().parse()) { units.add(unit); } env.task().analyze(); processDiagnostics(env.diagnostics()); if (ErrorUtil.errorCount() == 0) { for (CompilationUnitTree ast : units) { com.google.devtools.j2objc.ast.CompilationUnit unit = TreeConverter .convertCompilationUnit(options, env, (JCTree.JCCompilationUnit) ast); processDiagnostics(env.diagnostics()); handler.handleParsedUnit(unit.getSourceFilePath(), unit); } } } catch (IOException e) { ErrorUtil.fatalError(e, "javac file manager error"); } }