auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static String[] split(String commandLine) { final List<String> list = new ArrayList<String>(); boolean inquote = false; boolean inDblQuote = false; StringBuilder r = new StringBuilder(); for (int ip = 0; ip < commandLine.length();) { final char b = commandLine.charAt(ip++); switch (b) { case '\t': case ' ': if (inquote || inDblQuote) r.append(b); else if (r.length() > 0) { list.add(r.toString()); r = new StringBuilder(); } continue; case '\"': if (inquote) r.append(b); else inDblQuote = !inDblQuote; continue; case '\'': if (inDblQuote) r.append(b); else inquote = !inquote; continue; case '\\': if (inquote || ip == commandLine.length()) r.append(b); else r.append(commandLine.charAt(ip++)); continue; default: r.append(b); continue; } } <START> if (r.length() > 0) { <END> list.add(r.toString()); } return list.toArray(new String[list.size()]); }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
private static String[] split(String commandLine) { final List<String> list = new ArrayList<String>(); boolean inquote = false; boolean inDblQuote = false; StringBuilder r = new StringBuilder(); for (int ip = 0; ip < commandLine.length();) { final char b = commandLine.charAt(ip++); switch (b) { case '\t': case ' ': if (inquote || inDblQuote) r.append(b); else if (r.length() > 0) { list.add(r.toString()); r = new StringBuilder(); } continue; case '\"': if (inquote) r.append(b); else inDblQuote = !inDblQuote; continue; case '\'': if (inDblQuote) r.append(b); else inquote = !inquote; continue; case '\\': if (inquote || ip == commandLine.length()) r.append(b); else r.append(commandLine.charAt(ip++)); continue; default: r.append(b); continue; } } if (r.length() > 0) list.add(r.toString()); return list.toArray(new String[list.size()]); }
Source:
<code>private byte[] bytesFromByteBuffer(PhoenixArray array, ByteBuffer buffer, int noOfElements, Integer byteSize, int capacity) { int temp = noOfElements; if (buffer == null) return null; ByteBufferUtils.writeVLong(buffer, noOfElements); if (byteSize == null) { int fillerForOffsetByteArray = buffer.position(); buffer.position(fillerForOffsetByteArray + Bytes.SIZEOF_INT); ByteBuffer offsetArray = ByteBuffer.allocate(capacity); if(noOfElements < 0){ noOfElements = -noOfElements; } for (int i = 0; i < noOfElements; i++) { if (temp < 0) { offsetArray.putInt(buffer.position()); } else { <START> offsetArray.putShort((short)buffer.position()); <END> } byte[] bytes = array.toBytes(i); buffer.put(bytes); } int offsetArrayPosition = buffer.position(); buffer.put(offsetArray.array()); buffer.position(fillerForOffsetByteArray); buffer.putInt(offsetArrayPosition); } else { for (int i = 0; i < noOfElements; i++) { byte[] bytes = array.toBytes(i); buffer.put(bytes); } } return buffer.array(); }</code><technical_language>do a putShort((short)(buffer.position()-Short.MAX_VALUE)</technical_language>

Target:
private byte[] bytesFromByteBuffer(PhoenixArray array, ByteBuffer buffer, int noOfElements, Integer byteSize, int capacity) { int temp = noOfElements; if (buffer == null) return null; ByteBufferUtils.writeVLong(buffer, noOfElements); if (byteSize == null) { int fillerForOffsetByteArray = buffer.position(); buffer.position(fillerForOffsetByteArray + Bytes.SIZEOF_INT); ByteBuffer offsetArray = ByteBuffer.allocate(capacity); if(noOfElements < 0){ noOfElements = -noOfElements; } for (int i = 0; i < noOfElements; i++) { if (temp < 0) { offsetArray.putInt(buffer.position()); } else { offsetArray.putShort((short)(buffer.position() - Short.MAX_VALUE)); } byte[] bytes = array.toBytes(i); buffer.put(bytes); } int offsetArrayPosition = buffer.position(); buffer.put(offsetArray.array()); buffer.position(fillerForOffsetByteArray); buffer.putInt(offsetArrayPosition); } else { for (int i = 0; i < noOfElements; i++) { byte[] bytes = array.toBytes(i); buffer.put(bytes); } } return buffer.array(); }
Source:
<code>public GlowPlayerProfile createProfile(String name) { checkNotNull(name); <START> return createProfile(null, name); <END> }</code><technical_language>A null uuid is filtered out in [GlowPlayerProfile constructor](<LINK_0></technical_language>

Target:
public GlowPlayerProfile createProfile(String name) { checkNotNull(name); UUID id = ProfileCache.getUuid(name).join(); if (id == null) { throw new IllegalArgumentException("Could not fetch UUID for username: " + name); } return createProfile(id, name); }
Source:
<code>public GameInfoBean getByUid(int uid) { GameInfoBean gameInfoBean = null; try { gameInfoBean = uidToGameInfoBean.get(uid); <START> }catch(NullPointerException e){ <END> logger.error("Can't find in gameInfoBean map",uid); } return gameInfoBean; }</code><technical_language>catch NPE, throwing NPE anyway. uidToGameInfoBean is null code return object null, fine (except log)</technical_language>

Target:
public GameInfoBean getByUid(int uid) { GameInfoBean gameInfoBean = uidToGameInfoBean.get(uid); if (gameInfoBean == null) { logger.warn("Can't find in gameInfoBean map", uid); } return gameInfoBean; }
Source:
<code>public final void trigger(NodeInstance from, String type) { boolean hidden = false; if (getNode().getMetaData().get("hidden") != null) { hidden = true; } if (from != null) { this.metaData.put("IncomingConnection", from.getNode().getMetaData().get("UniqueId")); } <START> if (dynamicParameters != null) { <END> for (Entry<String, Object> entry : dynamicParameters.entrySet()) { setVariable(entry.getKey(), entry.getValue()); } } configureSla(); InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); if (!hidden) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireBeforeNodeTriggered(this, kruntime); } try { getExecutionErrorHandler().processing(this); internalTrigger(from, type); } catch (WorkflowRuntimeException e) { throw e; } catch (Exception e) { throw new WorkflowRuntimeException(this, getProcessInstance(), e); } if (!hidden) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireAfterNodeTriggered(this, kruntime); } }</code><technical_language>Setting level is longer needed</technical_language>

Target:
public final void trigger(NodeInstance from, String type) { boolean hidden = false; if (getNode().getMetaData().get("hidden") != null) { hidden = true; } if (from != null) { this.metaData.put("IncomingConnection", from.getNode().getMetaData().get(UNIQUE_ID)); } if (dynamicParameters != null) { for (Entry<String, Object> entry : dynamicParameters.entrySet()) { setVariable(entry.getKey(), entry.getValue()); } } configureSla(); InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); if (!hidden) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireBeforeNodeTriggered(this, kruntime); } try { getExecutionErrorHandler().processing(this); internalTrigger(from, type); } catch (WorkflowRuntimeException e) { throw e; } catch (Exception e) { throw new WorkflowRuntimeException(this, getProcessInstance(), e); } if (!hidden) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireAfterNodeTriggered(this, kruntime); } }
Source:
<code>private static VdsDao getVdsDao() { <START> return DbFacade.getInstance().getVdsDao(); <END> }</code><technical_language>Please injection- 'Injector.get(VdsDao.class);'</technical_language>

Target:
private static VdsDao getVdsDao() { return Injector.get(VdsDao.class); }
Source:
<code>private void printHelp(String command, CommandSpec commandSpec, PrintStream os) { if (consolePresent) { os.print(COLOR_CODE); os.print(command); <START> os.print("\033[0m"); <END> } else { os.print(command); } if (commandSpec instanceof OptionsCommandSpec) { OptionsCommandSpec ocs = (OptionsCommandSpec)commandSpec; if (ocs.options != null) { os.print(" [options]"); } } if (commandSpec.requiredArgs != null) { for (Arg arg : commandSpec.requiredArgs) { if (consolePresent) { os.print(" \033[3m" + arg + "\033[0m"); } else { os.print(" <" + arg + ">"); } } } if (commandSpec.optionalArgs != null) { for (Arg arg : commandSpec.optionalArgs) { if (consolePresent) { os.print(" [\033[3m" + arg + "\033[0m"); } else { os.print(" [<" + arg + ">"); } if (arg instanceof VarArg) { os.print(" ..."); } os.print("]"); } } os.println("\n\t" + commandSpec.description); if (commandSpec instanceof OptionsCommandSpec) { OptionsCommandSpec ocs = (OptionsCommandSpec)commandSpec; if (ocs.options != null) { os.println("\tOptions:"); HelpFormatter formatter = new HelpFormatter(); PrintWriter pw = new PrintWriter(os); formatter.printOptions(pw, 80, ocs.options, 12, 4); pw.flush(); } } }</code><technical_language>define COLOR_RESET for this literal string match COLOR_CODE</technical_language>

Target:
private void printHelp(String command, CommandSpec commandSpec, PrintStream os) { if (consolePresent) { os.print(getHighlightColor()); os.print(command); os.print(COLOR_RESET); } else { os.print(command); } if (commandSpec instanceof OptionsCommandSpec) { OptionsCommandSpec ocs = (OptionsCommandSpec)commandSpec; if (ocs.options != null) { os.print(" [options]"); } } if (commandSpec.requiredArgs != null) { for (Arg arg : commandSpec.requiredArgs) { if (consolePresent) { os.print(" " + ITALICS + arg + COLOR_RESET); } else { os.print(" <" + arg + ">"); } } } if (commandSpec.optionalArgs != null) { for (Arg arg : commandSpec.optionalArgs) { if (consolePresent) { os.print(" [" + ITALICS + arg + COLOR_RESET); } else { os.print(" [<" + arg + ">"); } if (arg instanceof VarArg) { os.print(" ..."); } os.print("]"); } } os.println("\n\t" + commandSpec.description); if (commandSpec instanceof OptionsCommandSpec) { OptionsCommandSpec ocs = (OptionsCommandSpec)commandSpec; if (ocs.options != null) { os.println("\tOptions:"); HelpFormatter formatter = new HelpFormatter(); PrintWriter pw = new PrintWriter(os); formatter.printOptions(pw, 80, ocs.options, 12, 4); pw.flush(); } } }
Source:
<code><START> private void onAssignmentAdded(SubscriptionAssignment assignment) { <END> assignments.add(assignment); if (consumerNodeId.equals(assignment.getConsumerNodeId())) { callbacks.forEach(callback -> callback.onSubscriptionAssigned(assignment.getSubscriptionName()) ); } }</code><technical_language>this called for assignment startup: * while warming cache * events ZK start in I protect this kind of obvious duplicates</technical_language>

Target:
private void onAssignmentAdded(SubscriptionAssignment assignment) { try { if (assignments.add(assignment) && consumerNodeId.equals(assignment.getConsumerNodeId())) { callbacks.forEach(callback -> callback.onSubscriptionAssigned(assignment.getSubscriptionName())); } } catch (Exception e) { logger.error("Exception while adding assignment {}", assignment, e); } }
Source:
<code>public String getId() { <START> return "com.fsck.k9"; <END> }</code><technical_language>"fallback-photo" is a fit</technical_language>

Target:
public String getId() { return "fallback-photo"; }
Source:
<code>protected abstract DatastreamProducerRecord translate(ConsumerRecord<?, ?> fromKafka, Instant readTime) throws Exception; protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) throws Exception { for (TopicPartition topicPartition : records.partitions()) { <START> for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { <END> try { sendMessage(record, readTime); } catch (RuntimeException e) { _consumerMetrics.updateErrorRate(1); seekToLastCheckpoint(Collections.singleton(topicPartition)); if (_pausePartitionOnSendFailure) { _logger.warn("Got exception while sending record {}, adding topic partition to auto-pause set", record, topicPartition); _autoPausedSourcePartitions.add(topicPartition); _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); } break; } } } }</code><technical_language>additional work (or possible), is a dynamically turn on/off autoPause create a config? Thinking if in case need disable fly if wrong</technical_language>

Target:
protected abstract DatastreamProducerRecord translate(ConsumerRecord<?, ?> fromKafka, Instant readTime) throws Exception; protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) throws Exception { boolean shouldAddPausePartitionsTask = false; for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { sendMessage(record, readTime); } catch (RuntimeException e) { _consumerMetrics.updateErrorRate(1); seekToLastCheckpoint(Collections.singleton(topicPartition)); if (_pausePartitionOnError) { _logger.warn("Got exception while sending record {}, adding topic partition to auto-pause set", record, topicPartition); _autoPausedSourcePartitions.add(topicPartition); shouldAddPausePartitionsTask = true; } break; } } } if (shouldAddPausePartitionsTask) { _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); } }
Source:
<code>public void setData(List<ImportKeysListEntry> data) { this.mData = data; this.mKeyStates = new KeyState[data.size()]; for (int i = 0; i < mKeyStates.length; i++) { mKeyStates[i] = new KeyState(); } <START> if (mData.size() == 1) <END> getKey(mData.get(0), true); notifyDataSetChanged(); }</code><technical_language>brackets coding style</technical_language>

Target:
public void setData(List<ImportKeysListEntry> data) { mData = data; mKeyStates = new KeyState[data.size()]; for (int i = 0; i < mKeyStates.length; i++) { mKeyStates[i] = new KeyState(); ImportKeysListEntry entry = mData.get(i); long keyId = KeyFormattingUtils.convertKeyIdHexToKeyId(entry.getKeyIdHex()); try { KeyRing keyRing; if (entry.isSecretKey()) { keyRing = mProviderHelper.getCanonicalizedSecretKeyRing(keyId); } else { keyRing = mProviderHelper.getCachedPublicKeyRing(keyId); } mKeyStates[i].mAlreadyPresent = true; mKeyStates[i].mVerified = keyRing.getVerified() > 0; } catch (ProviderHelper.NotFoundException | PgpKeyNotFoundException ignored) { } } if (mData.size() == 1) { mCurrent = 0; getKey(mData.get(0), true); } notifyDataSetChanged(); }
Source:
<code>public static void toJSON(OutputWriter writer, ArtifactStores stores) { writer.addLinks( <START> outputLinkWriter -> outputLinkWriter.addLink("self", Routes.ArtifactStoreConfig.BASE)) <END> .addChild("_embedded", embeddedWriter -> embeddedWriter.addChildList("artifact_stores", artifactStoresWriter -> stores.forEach( store -> artifactStoresWriter.addChild( artifactStoreWriter -> ArtifactStoreRepresenter.toJSON(artifactStoreWriter, store))))); }</code><technical_language>Add doc link, find link</technical_language>

Target:
public static void toJSON(OutputWriter writer, ArtifactStores stores) { writer.addLinks( outputLinkWriter -> outputLinkWriter .addLink("self", Routes.ArtifactStoreConfig.BASE) .addAbsoluteLink("doc", Routes.ArtifactStoreConfig.DOC) .addLink("find", Routes.ArtifactStoreConfig.find())) .addChild("_embedded", embeddedWriter -> embeddedWriter.addChildList("artifact_stores", artifactStoresWriter -> stores.forEach( store -> artifactStoresWriter.addChild( artifactStoreWriter -> ArtifactStoreRepresenter.toJSON(artifactStoreWriter, store))))); }
Source:
<code>public void setHtmlTemplate(FreemarkerTemplate htmlTemplate) { <START> if (this.getUseFreemarkerTemplate()) <END> { set(LANDING_PAGE_HTML_TEMPLATE, htmlTemplate); } }</code><technical_language>remove if if statement, set value, user of entity getUseFreemarkerTemplate function choose template of not</technical_language>

Target:
public void setHtmlTemplate(FreemarkerTemplate htmlTemplate) { set(LANDING_PAGE_HTML_TEMPLATE, htmlTemplate); }
Source:
<code>public Schema getSchema(FormatContext context) { if (conf.containsMacro("schema")) { return super.getSchema(context); } if (!Strings.isNullOrEmpty(conf.schema)) { return super.getSchema(context); } String filePath = conf.getProperties().getProperties().getOrDefault("path", null); if (filePath == null) { return super.getSchema(context); } try { Job job = JobUtils.createInstance(); Configuration hconf = job.getConfiguration(); Path file = conf.getFilePathForSchemaGeneration(filePath, NAME, hconf); DatumReader<GenericRecord> dataReader = new GenericDatumReader<GenericRecord>(); SeekableInput seekableInput = new FsInput(file, hconf); FileReader<GenericRecord> dataFileReader = DataFileReader .openReader(seekableInput, dataReader); GenericRecord firstRecord; if (!dataFileReader.hasNext()) { return null; } firstRecord = dataFileReader.next(); return new AvroToStructuredTransformer().convertSchema(firstRecord.getSchema()); } catch (IOException e) { context.getFailureCollector().addFailure("Schema parse error", e.getMessage()); <START> } <END> return super.getSchema(context); }</code><technical_language>Close readers</technical_language>

Target:
public Schema getSchema(FormatContext context) { if (conf.containsMacro("schema")) { return super.getSchema(context); } if (!Strings.isNullOrEmpty(conf.schema)) { return super.getSchema(context); } String filePath = conf.getProperties().getProperties().getOrDefault("path", null); if (filePath == null) { return super.getSchema(context); } try { return getDefaultSchema(context); } catch (IOException e) { throw new IllegalArgumentException("Invalid schema: " + e.getMessage(), e); } }
Source:
<code>private void requestReadMoreItems(final LayoutInflater layoutInflater, final PageTitle myTitle) { if (myTitle == null || TextUtils.isEmpty(myTitle.getPrefixedText())) { hideReadMore(); layoutContent(); return; } new SuggestionsTask(app.getAPIForSite(myTitle.getSite()), myTitle.getSite(), myTitle.getPrefixedText()) { @Override public void onFinish(SearchResults results) { readMoreItems = results; if (!readMoreItems.getPageTitles().isEmpty()) { setupReadMoreSection(layoutInflater, readMoreItems); <START> readMoreContainer.setVisibility(View.VISIBLE); <END> } else { readMoreContainer.setVisibility(View.GONE); } layoutContent(); } @Override public void onCatch(Throwable caught) { Log.w(TAG, "Error while fetching Read More titles.", caught); layoutContent(); } }.execute(); }</code><technical_language>modify hideReadMore() function hide show list.</technical_language>

Target:
private void requestReadMoreItems(final LayoutInflater layoutInflater, final PageTitle myTitle) { if (myTitle == null || TextUtils.isEmpty(myTitle.getPrefixedText())) { hideReadMore(); layoutContent(); return; } new SuggestionsTask(app.getAPIForSite(myTitle.getSite()), myTitle.getSite(), myTitle.getPrefixedText()) { @Override public void onFinish(SearchResults results) { readMoreItems = results; if (!readMoreItems.getPageTitles().isEmpty()) { setupReadMoreSection(layoutInflater, readMoreItems); showReadMore(); } else { hideReadMore(); } layoutContent(); } @Override public void onCatch(Throwable caught) { Log.w(TAG, "Error while fetching Read More titles.", caught); layoutContent(); } }.execute(); }
Source:
<code>private static void testStateSystemExplorer() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); List<String> expectedAnalyses = new ArrayList<>(); expectedAnalyses.addAll(EXPECTED_ANALYSES); expectedAnalyses.sort(null); SWTBotUtils.openView(TmfStateSystemExplorer.ID); SWTBotView sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); SWTBotTree tree = sseBot.bot().tree(); bot.waitUntil(new <START> TreeIsPopulatedCondition(tree)); <END> tree.getAllItems()[0].expand(); List<String> actual = sseBot.bot().tree().getAllItems()[0].getNodes(); actual.sort(null); assertTrue("State systems are not what expected : " + EXPECTED_ANALYSES + " instead " + actual, actual.containsAll(EXPECTED_ANALYSES)); sseBot.close(); SWTBotUtils.openView(TmfStateSystemExplorer.ID); sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); tree = sseBot.bot().tree(); bot.waitUntil(new TreeIsPopulatedCondition(tree)); tree.getAllItems()[0].expand(); actual.clear(); actual.addAll(sseBot.bot().tree().getAllItems()[0].getNodes()); actual.sort(String.CASE_INSENSITIVE_ORDER); assertTrue("State systems are not what expected : " + EXPECTED_ANALYSES + " instead " + actual, actual.containsAll(EXPECTED_ANALYSES)); }</code><technical_language>I replace TreeIsPopulatedCondition bot.waitWhile(Conditions.treeHasRows(tree, 0)); delete this new class</technical_language>

Target:
private static void testStateSystemExplorer() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); List<String> expectedAnalyses = new ArrayList<>(); expectedAnalyses.addAll(EXPECTED_ANALYSES); expectedAnalyses.sort(null); SWTBotUtils.openView(TmfStateSystemExplorer.ID); SWTBotView sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); SWTBotTree tree = sseBot.bot().tree(); bot.waitWhile(treeHasRows(tree, 0)); tree.getAllItems()[0].expand(); List<String> actual = sseBot.bot().tree().getAllItems()[0].getNodes(); assertTrue("State systems are not what expected : " + EXPECTED_ANALYSES + " instead " + actual, actual.containsAll(EXPECTED_ANALYSES)); sseBot.close(); SWTBotUtils.openView(TmfStateSystemExplorer.ID); sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); tree = sseBot.bot().tree(); bot.waitWhile(treeHasRows(tree, 0)); tree.getAllItems()[0].expand(); actual.clear(); actual.addAll(sseBot.bot().tree().getAllItems()[0].getNodes()); assertTrue("State systems are not what expected : " + EXPECTED_ANALYSES + " instead " + actual, actual.containsAll(EXPECTED_ANALYSES)); }
Source:
<code>void shutdownProducer() { Producer<K, V> producer; try { _producerLock.lock(); if (_kafkaProducer == null || closeInProgress) { return; } producer = _kafkaProducer; closeInProgress = true; _kafkaProducer = null; _producerCloseExecutorService.submit(() -> { _log.info("KafkaProducerWrapper: Closing the Kafka Producer"); <START> try { producer.close(CLOSE_TIMEOUT_MS, TimeUnit.MILLISECONDS); NUM_PRODUCERS.decrementAndGet(); _log.info("KafkaProducerWrapper: Kafka Producer is closed"); } finally { try { _producerLock.lock(); closeInProgress = false; _waitOnNoProducerClose.signalAll(); } finally { _producerLock.unlock(); } } <END> }); } finally { _producerLock.unlock(); } }</code><technical_language>move this block a separate function? long a confusing read (first I thought releasing lock in finally blocks, realized is a separate thread)</technical_language>

Target:
void shutdownProducer() { Producer<K, V> producer; try { _producerLock.lock(); if (_kafkaProducer == null || _closeInProgress) { return; } producer = _kafkaProducer; _closeInProgress = true; _kafkaProducer = null; _producerCloseExecutorService.submit(() -> { _log.info("KafkaProducerWrapper: Closing the Kafka Producer"); try { producer.close(CLOSE_TIMEOUT_MS, TimeUnit.MILLISECONDS); NUM_PRODUCERS.decrementAndGet(); _log.info("KafkaProducerWrapper: Kafka Producer is closed"); } finally { markProducerCloseComplete(); } }); } finally { _producerLock.unlock(); } }
Source:
<code>private void sendIPDataImpl(Inet4Address ipAddress, int destPort, IPProtocol protocol, boolean closeSocket, byte[] data) throws TimeoutException, XBeeException { if (ipAddress == null) throw new NullPointerException("IP address cannot be null"); if (data == null) <START> throw new NullPointerException("Data cannot be null"); <END> if (destPort < 0 || destPort > 65535) throw new IllegalArgumentException("Destination port must be between 0 and 65535."); if (isRemote()) throw new OperationNotSupportedException("Cannot send IP data from a remote device."); int sourcePort = this.sourcePort; if (protocol != IPProtocol.UDP) sourcePort = 0; logger.debug(toString() + "Sending IP data to {}:{} >> {}.", ipAddress, destPort, HexUtils.prettyHexString(data)); XBeePacket xbeePacket = new TXIPv4Packet(getNextFrameID(), ipAddress, destPort, sourcePort, protocol, closeSocket ? TXIPv4Packet.OPTIONS_CLOSE_SOCKET: TXIPv4Packet.OPTIONS_LEAVE_SOCKET_OPEN, data); sendAndCheckXBeePacket(xbeePacket, false); }</code><technical_language>Send NullPointerException if protocol is null</technical_language>

Target:
private void sendIPDataImpl(Inet4Address ipAddress, int destPort, IPProtocol protocol, boolean closeSocket, byte[] data) throws TimeoutException, XBeeException { if (ipAddress == null) throw new NullPointerException("IP address cannot be null"); if (protocol == null) throw new NullPointerException("Protocol cannot be null"); if (data == null) throw new NullPointerException("Data cannot be null"); if (destPort < 0 || destPort > 65535) throw new IllegalArgumentException("Destination port must be between 0 and 65535."); if (isRemote()) throw new OperationNotSupportedException("Cannot send IP data from a remote device."); int sourcePort = this.sourcePort; if (protocol != IPProtocol.UDP) sourcePort = 0; logger.debug(toString() + "Sending IP data to {}:{} >> {}.", ipAddress, destPort, HexUtils.prettyHexString(data)); XBeePacket xbeePacket = new TXIPv4Packet(getNextFrameID(), ipAddress, destPort, sourcePort, protocol, closeSocket ? TXIPv4Packet.OPTIONS_CLOSE_SOCKET: TXIPv4Packet.OPTIONS_LEAVE_SOCKET_OPEN, data); sendAndCheckXBeePacket(xbeePacket, false); }
Source:
<code>@Override public void visit(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException { assert clo != null; List<GridDhtLocalPartition> parts = cctx.topology().localPartitions(); if (parts.isEmpty()) return; partsCnt.set(parts.size()); GridCompoundFuture<SchemaIndexCacheStat, SchemaIndexCacheStat> fut = null; if (parallelism > 1) { fut = new GridCompoundFuture<>(new SchemaIndexCacheStatFutureReducer()); for (int i = 1; i < parallelism; i++) fut.add(processPartitionsAsync(parts, clo, i)); fut.markInitialized(); } final SchemaIndexCacheStat stat; try { stat = processPartitions(parts, clo, 0); } catch (Throwable e) { U.error(log, "Error during parallel index create/rebuild.", e); stop = true; resetPartitionsCount(); throw e; } <START> if (fut != null && stat != null) { <END> final SchemaIndexCacheStat st = fut.get(); stat.scanned += st.scanned; stat.types.putAll(st.types); } printIndexStats(stat); }</code><technical_language>change waiting complete compound future, skip it. strange</technical_language>

Target:
@Override public void visit(SchemaIndexCacheVisitorClosure clo) { assert nonNull(clo); List<GridDhtLocalPartition> locParts = cctx.topology().localPartitions(); if (locParts.isEmpty()) { buildIdxFut.onDone(); return; } cctx.group().metrics().addIndexBuildCountPartitionsLeft(locParts.size()); beforeExecute(); AtomicInteger partsCnt = new AtomicInteger(locParts.size()); AtomicBoolean stop = new AtomicBoolean(); GridCompoundFuture<SchemaIndexCacheStat, SchemaIndexCacheStat> buildIdxCompoundFut = new GridCompoundFuture<>(); for (GridDhtLocalPartition locPart : locParts) { GridWorkerFuture<SchemaIndexCacheStat> workerFut = new GridWorkerFuture<>(); GridWorker worker = new SchemaIndexCachePartitionWorker(cctx, locPart, stop, cancel, clo, workerFut, rowFilter, partsCnt); workerFut.setWorker(worker); buildIdxCompoundFut.add(workerFut); cctx.kernalContext().buildIndexExecutorService().execute(worker); } buildIdxCompoundFut.listen(fut -> { Throwable err = fut.error(); if (isNull(err) && collectStat && log.isInfoEnabled()) { try { GridCompoundFuture<SchemaIndexCacheStat, SchemaIndexCacheStat> compoundFut = (GridCompoundFuture<SchemaIndexCacheStat, SchemaIndexCacheStat>)fut; SchemaIndexCacheStat resStat = new SchemaIndexCacheStat(); compoundFut.futures().stream() .map(IgniteInternalFuture::result) .filter(Objects::nonNull) .forEach(resStat::accumulate); log.info(indexStatStr(resStat)); } catch (Exception e) { log.error("Error when trying to print index build/rebuild statistics [cacheName=" + cctx.cache().name() + ", grpName=" + cctx.group().name() + "]", e); } } buildIdxFut.onDone(err); }); buildIdxCompoundFut.markInitialized(); }
Source:
<code>public TupleTypeValue(List<TypeValue> subtypes) { <START> this.subtypes = subtypes; <END> }</code><technical_language>ImmutableList.copyOf()</technical_language>

Target:
public TupleTypeValue(List<TypeValue> subtypes) { this.subtypes = ImmutableList.copyOf(subtypes); }
Source:
<code>public boolean getDualCommitEnabled() { <START> return Boolean.parseBoolean(getStringLastValue("kafka.dual.commit.enabled", "true")); <END> }</code><technical_language>prefer default in properties file</technical_language>

Target:
public String getDualCommitEnabled() { return getString("kafka.dual.commit.enabled"); }
Source:
<code>public OpenWireProtocolManager(OpenWireProtocolManagerFactory factory, ActiveMQServer server) { this.factory = factory; this.server = server; this.wireFactory = new OpenWireFormatFactory(); wireFactory.setCacheEnabled(false); advisoryProducerId.setConnectionId(ID_GENERATOR.generateId()); scheduledPool = server.getScheduledPool(); this.wireFormat = (OpenWireFormat) wireFactory.createWireFormat(); final ClusterManager clusterManager = this.server.getClusterManager(); ClusterConnection cc = clusterManager.getDefaultConnection(null); if (cc != null) { cc.addClusterTopologyListener(this); } <START> if (supportAdvisory) { <END> clusterManager.addToIgnoredAddressPrefixes(AdvisorySupport.ADVISORY_TOPIC_PREFIX); } else { clusterManager.removeFromIgnoredAddressPrefixes(AdvisorySupport.ADVISORY_TOPIC_PREFIX); } }</code><technical_language>I dependent supportAdvisory. acceptors.. IPs.. this called twice. I add filter, check if filter is part of expression called it</technical_language>

Target:
public OpenWireProtocolManager(OpenWireProtocolManagerFactory factory, ActiveMQServer server) { this.factory = factory; this.server = server; this.wireFactory = new OpenWireFormatFactory(); wireFactory.setCacheEnabled(false); advisoryProducerId.setConnectionId(ID_GENERATOR.generateId()); scheduledPool = server.getScheduledPool(); this.wireFormat = (OpenWireFormat) wireFactory.createWireFormat(); final ClusterManager clusterManager = this.server.getClusterManager(); ClusterConnection cc = clusterManager.getDefaultConnection(null); if (cc != null) { cc.addClusterTopologyListener(this); } if (supportAdvisory) { clusterManager.addToIgnoredAddressPrefixes(AdvisorySupport.ADVISORY_TOPIC_PREFIX); } }
Source:
<code>public void clean() { ShellHandler.getInstance().closeAllNonWorbenchShells(); <START> new ProjectExplorer().deleteAllProjects(); <END> try { new WaitWhile(new JobIsRunning(), TimePeriod.LONG); new ServerAdapter(Version.OPENSHIFT3, OpenShiftResources.NODEJS_SERVICE).delete(); } catch (OpenShiftToolsException ex) { } }</code><technical_language>ProjectExplorer is open</technical_language>

Target:
public void clean() { ProjectExplorer pe = new ProjectExplorer(); pe.open(); pe.deleteAllProjects(); try { new WaitWhile(new JobIsRunning(), TimePeriod.LONG); new ServerAdapter(Version.OPENSHIFT3, OpenShiftResources.NODEJS_SERVICE).delete(); } catch (OpenShiftToolsException ex) { } }
Source:
<code>public static Map<Guid, List<VM>> mapHaVmToHostByCluster(Guid clusterId) { List<VM> vms = DbFacade.getInstance().getVmDao().getAllForVdsGroup(clusterId); <START> if (vms == null) { <END> return Collections.EMPTY_MAP; } vms = LinqUtils.filter(vms, new Predicate<VM>() { @Override public boolean eval(VM v) { return v.isAutoStartup(); } }); return HaReservationHandling.mapVmToHost(vms); }</code><technical_language>isEmpty()</technical_language>

Target:
public static Map<Guid, List<VM>> mapHaVmToHostByCluster(Guid clusterId) { List<VM> vms = DbFacade.getInstance().getVmDao().getAllForVdsGroup(clusterId); if (vms == null || vms.isEmpty()) { return Collections.EMPTY_MAP; } vms = LinqUtils.filter(vms, new Predicate<VM>() { @Override public boolean eval(VM v) { return v.isAutoStartup(); } }); return mapVmToHost(vms); }
Source:
<code>public BoxRequestsMetadata.DeleteFileMetadata getDeleteMetadataTemplateRequest(String id, String template) { <START> BoxRequestsMetadata.DeleteFileMetadata request = new BoxRequestsMetadata.DeleteFileMetadata(getFileMetadataUrl(id, template), mSession); <END> return request; }</code><technical_language>re-route this new API ? avoid duplicating this code</technical_language>

Target:
public BoxRequestsMetadata.DeleteFileMetadata getDeleteMetadataTemplateRequest(String id, String template) { return getDeleteFileMetadataTemplateRequest(id, template); }
Source:
<code>public String toString() { final int resultSize = computeLength(); if (resultSize <= 0) { <START> return StringUtils.EMPTY; <END> } char[] result = new char[resultSize]; int offset = 0; if ((separators & HAS_LEADING) != 0) { result[offset++] = SEPARATOR; } final int len = segments.length - 1; if (len >= 0) { for (int i = 0; i < len; i++) { final int size = segments[i].length(); segments[i].getChars(0, size, result, offset); offset += size; result[offset++] = SEPARATOR; } final int size = segments[len].length(); segments[len].getChars(0, size, result, offset); offset += size; } if ((separators & HAS_TRAILING) != 0) { result[offset] = SEPARATOR; } return new String(result); }</code><technical_language>"" instead of StringUtils.EMPTY, is overkill</technical_language>

Target:
public String toString() { final int resultSize = computeLength(); if (resultSize <= 0) { return ""; } char[] result = new char[resultSize]; int offset = 0; if ((separators & HAS_LEADING) != 0) { result[offset++] = SEPARATOR; } final int len = segments.length - 1; if (len >= 0) { for (int i = 0; i < len; i++) { final int size = segments[i].length(); segments[i].getChars(0, size, result, offset); offset += size; result[offset++] = SEPARATOR; } final int size = segments[len].length(); segments[len].getChars(0, size, result, offset); offset += size; } if ((separators & HAS_TRAILING) != 0) { result[offset] = SEPARATOR; } return new String(result); }
Source:
<code>private void removeApplicationSignUp(ApplicationContext applicationContext){ try { if (log.isInfoEnabled()) { log.info(String.format("Removing application signup: [application-id] %s", applicationContext.getApplicationId())); } StratosManagerServiceClient serviceClient = StratosManagerServiceClient.getInstance(); <START> ApplicationSignUp applicationSignUp[] = serviceClient.getApplicationSignUps(applicationContext.getApplicationId()); <END> for(ApplicationSignUp appSignUp : applicationSignUp) { serviceClient.removeApplicationSignUp(appSignUp.getApplicationId(), appSignUp.getTenantId()); } }catch(Exception e){ String message = "Could not remove application signup(s)"; log.error(message, e); throw new RuntimeException(message, e); } }</code><technical_language>need check null executing for loop. Thanks</technical_language>

Target:
private void removeApplicationSignUp(ApplicationContext applicationContext){ try { if (log.isInfoEnabled()) { log.info(String.format("Removing application signup: [application-id] %s", applicationContext.getApplicationId())); } StratosManagerServiceClient serviceClient = StratosManagerServiceClient.getInstance(); ApplicationSignUp applicationSignUp[] = serviceClient.getApplicationSignUps(applicationContext.getApplicationId()); if ( applicationSignUp != null){ for(ApplicationSignUp appSignUp : applicationSignUp) { if ( appSignUp != null) { serviceClient.removeApplicationSignUp(appSignUp.getApplicationId(), appSignUp.getTenantId()); } } } }catch(Exception e){ String message = "Could not remove application signup(s)"; log.error(message, e); throw new RuntimeException(message, e); } }
Source:
<code>public void perform_read_bulk_operations() { final int count = 10; final List<I> ids = new LinkedList<>(); for (int i = 0; i < count; i++) { final I id = newId(); final ProjectId projectId = ProjectId.newBuilder() .setId(id.toString()) .build(); final Project state = Project.newBuilder() .setId(projectId) .build(); final Any packedState = AnyPacker.pack(state); final EntityStorageRecord record = EntityStorageRecord.newBuilder() .setState(packedState) .setWhenModified(Timestamps.getCurrentTime()) .setVersion(1) .build(); storage.write(id, record); if (i % 2 == 0) { ids.add(id); } } final Iterable<EntityStorageRecord> read = storage.readBulk(ids); assertSize(ids.size(), read); for (EntityStorageRecord record : read) { final Any packedState = record.getState(); final Project state = AnyPacker.unpack(packedState); final ProjectId id = state.getId(); final String stringIdRepr = id.getId(); <START> boolean isIdPresent = false; <END> for (I genericId : ids) { isIdPresent = genericId.toString() .equals(stringIdRepr); if (isIdPresent) { break; } } assertTrue(isIdPresent); } }</code><technical_language>is a getter-method, idPresent</technical_language>

Target:
public void perform_read_bulk_operations() { final List<I> ids = fillStorage(10).subList(0, 5); final Iterable<EntityStorageRecord> read = storage.readBulk(ids); assertSize(ids.size(), read); for (EntityStorageRecord record : read) { checkProjectIdIsInList(record, ids); } }
Source:
<code><START> private CorsResponseHelper getCorsResponseHelper() { <END> if (corsResponseHelper == null) { corsResponseHelper = new CorsResponseHelper() .setAllowCredentials(allowCredentials) .setAllowOrigin(allowOrigin) .setAllowOnlyRequestedMethod(allowOnlyRequestedMethod) .setAllowMethods(allowMethods) .setAllowOnlyRequestedMethod(allowOnlyRequestedMethod) .setAllowOnlyRequestedHeaders(allowOnlyRequestedHeader) .setAllowHeaders(allowHeaders); } return corsResponseHelper; }</code><technical_language>nice this protected access developers override return a subclass of CorsResponseHelper (or a differently-initialized instance of CorsResponseHelper). Otherwise, need override afterHandle</technical_language>

Target:
protected CorsResponseHelper getCorsResponseHelper() { if (corsResponseHelper == null) { corsResponseHelper = new CorsResponseHelper() .setAllowedCredentials(allowedCredentials) .setAllowedOrigins(allowedOrigins) .setAllowAllRequestedHeaders(allowAllRequestedHeaders) .setAllowedHeaders(allowedHeaders) .setExposedHeaders(exposedHeaders); } return corsResponseHelper; }
Source:
<code>public OntologyTerm getTerm(String id) { OntologyTerm result = this.cache.get(id); if (result == null) { <START> id = id.replaceAll("\\s", ""); <END> HttpGet method = new HttpGet(this.fetchServiceURL + "symbol/" + id); method.setHeader(HttpHeaders.ACCEPT, ContentType.APPLICATION_JSON.getMimeType()); try (CloseableHttpResponse httpResponse = this.client.execute(method)) { String response = IOUtils.toString(httpResponse.getEntity().getContent(), Consts.UTF_8); JSONObject responseJSON = (JSONObject) JSONSerializer.toJSON(response); JSONArray docs = responseJSON.getJSONObject(RESPONSE_KEY).getJSONArray(DATA_KEY); if (docs.size() == 1) { result = new JSONOntologyTerm(docs.getJSONObject(0), this); this.cache.set(id, result); } else { this.cache.set(id, EMPTY_MARKER); } } catch (IOException ex) { this.logger.warn("Failed to fetch gene definition: {}", ex.getMessage()); } } return (result == EMPTY_MARKER) ? null : result; }</code><technical_language>OK remove whitespace? encode ID instead</technical_language>

Target:
public OntologyTerm getTerm(String id) { OntologyTerm result = this.cache.get(id); String safeID; if (result == null) { try { safeID = URLEncoder.encode(id, Consts.UTF_8.name()); } catch (UnsupportedEncodingException e) { safeID = id.replaceAll("\\s", ""); this.logger.warn("Could not find the encoding: {}", Consts.UTF_8.name()); } HttpGet method = new HttpGet(this.fetchServiceURL + "symbol/" + safeID); method.setHeader(HttpHeaders.ACCEPT, ContentType.APPLICATION_JSON.getMimeType()); try (CloseableHttpResponse httpResponse = this.client.execute(method)) { String response = IOUtils.toString(httpResponse.getEntity().getContent(), Consts.UTF_8); JSONObject responseJSON = (JSONObject) JSONSerializer.toJSON(response); JSONArray docs = responseJSON.getJSONObject(RESPONSE_KEY).getJSONArray(DATA_KEY); if (docs.size() == 1) { result = new JSONOntologyTerm(docs.getJSONObject(0), this); this.cache.set(id, result); } else { this.cache.set(id, EMPTY_MARKER); } } catch (IOException ex) { this.logger.warn("Failed to fetch gene definition: {}", ex.getMessage()); } } return (result == EMPTY_MARKER) ? null : result; }
Source:
<code>public void testMessageOrderingWhenConsuming() throws IOException, InterruptedException { String queueName = "message_ordering_test"; String address = queueName + ".address"; int count = 1000; CountDownLatch latch = new CountDownLatch(count - 1); List<String> sendingOrder = IntStream.range(1, count).boxed().map(Object::toString).collect(Collectors.toList()); ArrayBlockingQueue<String> receiveOrderQueue = new ArrayBlockingQueue<>(count); receiveOrderQueue.addAll(sendingOrder); AMQP.Queue.DeclareOk ok = channel.queueDeclare(queueName, false, false, true, null); assertNotNull(ok.getQueue()); AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder().contentType("text/plain").contentEncoding("UTF-8").build(); for (String msg : sendingOrder) channel.basicPublish("", queueName, properties, msg.getBytes("UTF-8")); vertx.eventBus().consumer(address, msg -> { String expectedMessage = receiveOrderQueue.poll(); assertNotNull(msg); JsonObject json = (JsonObject) msg.body(); assertNotNull(json); String body = json.getString("body"); assertNotNull(body); log.info("received: " + body + " expected: " + expectedMessage); assertTrue(body.equals(expectedMessage)); latch.countDown(); }); client.basicConsume(queueName, address, onSuccess(v -> { })); awaitLatch(latch); <START> testComplete(); <END> }</code><technical_language>testComplete called here, is necessary called asynchronously if call await() in junit thread</technical_language>

Target:
public void testMessageOrderingWhenConsuming() throws IOException { String queueName = "message_ordering_test"; String address = queueName + ".address"; int count = 1000; List<String> sendingOrder = IntStream.range(1, count).boxed().map(Object::toString).collect(Collectors.toList()); AMQP.Queue.DeclareOk ok = channel.queueDeclare(queueName, false, false, true, null); assertNotNull(ok.getQueue()); AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder().contentType("text/plain").contentEncoding("UTF-8").build(); for (String msg : sendingOrder) channel.basicPublish("", queueName, properties, msg.getBytes("UTF-8")); List<String> receivedOrder = Collections.synchronizedList(new ArrayList<>()); vertx.eventBus().consumer(address, msg -> { assertNotNull(msg); JsonObject json = (JsonObject) msg.body(); assertNotNull(json); String body = json.getString("body"); assertNotNull(body); receivedOrder.add(body); }); client.basicConsume(queueName, address, onSuccess(v -> { })); assertWaitUntil(() -> receivedOrder.size() == sendingOrder.size()); for (int i = 0; i < sendingOrder.size(); i++) { assertTrue(sendingOrder.get(i).equals(receivedOrder.get(i))); } }
Source:
<code>public Transaction accessTransaction() { <START> if ( this.currentHibernateTransaction == null <END> || ( this.currentHibernateTransaction.getStatus() != TransactionStatus.ACTIVE && !isClosed() ) ) { this.currentHibernateTransaction = new TransactionImpl( getTransactionCoordinator(), getExceptionConverter(), getFactory().getSessionFactoryOptions().getJpaCompliance(), isClosed() ); } if ( !isClosed() || (waitingForAutoClose && factory.isOpen()) ) { getTransactionCoordinator().pulse(); } return this.currentHibernateTransaction; }</code><technical_language>this is correct a JPA perspective. JPA EntityTransaction is "serially ... commit multiple transactions". JPA expects EntityTransaction returned time EntityManager#getTransaction is called: EntityTransaction t = manager().getTransaction(); assertSame( t, manager().getTransaction() ); assertFalse( t.isActive() ); t.begin(); assertSame( t, manager().getTransaction() ); assertTrue( t.isActive() ); t.commit(); assertSame( t, manager().getTransaction() ); assertFalse( t.isActive() ); manager().close(); assertSame( t, manager().getTransaction() ); assertFalse( t.isActive() ); stands create a new EntityTransaction soon transaction is accessed commit. I spec requires this (^^) behavior though, TCK surely enforce it</technical_language>

Target:
public Transaction accessTransaction() { if ( this.currentHibernateTransaction == null ) { this.currentHibernateTransaction = new TransactionImpl( getTransactionCoordinator(), getExceptionConverter(), this ); } if ( !isClosed() || (waitingForAutoClose && factory.isOpen()) ) { getTransactionCoordinator().pulse(); } return this.currentHibernateTransaction; }
Source:
<code>public LeasedConnection connect(Properties connectionProperties) throws ConnectionException { LeasedConnection connection = LeasedConnectionFactory.connect(servers, connectionProperties); try { EntityRef<DynamicTopologyEntity, Object, DynamicTopologyEntity.Settings> ref = connection.getEntityRef(DynamicTopologyEntity.class, 1, DynamicTopologyEntityConstants.ENTITY_NAME); DynamicTopologyEntity dynamicTopologyEntity = ref.fetchEntity(null); dynamicTopologyEntity.setListener(new DynamicTopologyEntity.Listener() { @Override public void onNodeRemoval(int stripeId, Node removedNode) { servers.remove(removedNode.getNodeAddress()); } @Override public void onNodeAddition(int stripeId, Node addedNode) { servers.add(addedNode.getNodeAddress()); } }); return new LeasedConnection() { @Override public void close() throws IOException { <START> dynamicTopologyEntity.close(); <END> connection.close(); } @Override public <T extends Entity, C, U> EntityRef<T, C, U> getEntityRef(Class<T> cls, long version, String name) throws EntityNotProvidedException { return connection.getEntityRef(cls, version, name); } }; } catch (Exception e) { throw new ConnectionException(e); } }</code><technical_language>I blindly translate exceptions thrown in in ConnectionException. Some of happen if screw packaging, mapped AssertionError similar</technical_language>

Target:
public LeasedConnection connect(Properties connectionProperties) throws ConnectionException { LeasedConnection connection = LeasedConnectionFactory.connect(servers, connectionProperties); try { EntityRef<DynamicTopologyEntity, Object, DynamicTopologyEntity.Settings> ref = connection.getEntityRef(DynamicTopologyEntity.class, 1, DynamicTopologyEntityConstants.ENTITY_NAME); DynamicTopologyEntity dynamicTopologyEntity = ref.fetchEntity(null); dynamicTopologyEntity.setListener(new DynamicTopologyEntity.Listener() { @Override public void onNodeRemoval(int stripeId, Node removedNode) { servers.remove(removedNode.getNodeAddress()); } @Override public void onNodeAddition(int stripeId, Node addedNode) { servers.add(addedNode.getNodeAddress()); } }); return new LeasedConnection() { @Override public <T extends Entity, C, U> EntityRef<T, C, U> getEntityRef(Class<T> cls, long version, String name) throws EntityNotProvidedException { return connection.getEntityRef(cls, version, name); } @Override public void close() throws IOException { Future<?> close = dynamicTopologyEntity.releaseEntity(); try { close.get(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { throw new IOException(e.getCause()); } catch (TimeoutException e) { } finally { connection.close(); } } }; } catch (EntityNotProvidedException | EntityVersionMismatchException | EntityNotFoundException e) { throw new AssertionError(e); } }
Source:
<code>protected static int getPartitionIdFromZKPath(String zkPath) { <START> String array[] = zkPath.split("/"); <END> return Integer.valueOf(array[array.length - 1]); }</code><technical_language>this is more efficient as: Integer.parseInt(zkPath.subString(zkPath.lastIndexOf('/') + 1))</technical_language>

Target:
protected static int getPartitionIdFromZKPath(String zkPath) { return Integer.parseInt(zkPath.substring(zkPath.lastIndexOf('/') + 1)); }
Source:
<code>public void setGrantType(String grantType) { <START> setProperty(GRANT_TYPE, grantType); <END> }</code><technical_language>sole grantType stormpath_token please assert parameter is stormpath_token. Additionally public (protected minimum), invoked internally this class is created</technical_language>

Target:
protected void setGrantType(String grantType) { setProperty(GRANT_TYPE, grantType); }
Source:
<code>public FlowTypeTree FLOW_FUNCTION_TYPE_OR_HIGHER() { return b.<FlowTypeTree>nonterminal(Kind.FLOW_FUNCTION_TYPE) .is(b.firstOf( f.flowFunctionType( b.optional(FLOW_GENERIC_PARAMETER_CLAUSE()), FLOW_FUNCTION_TYPE_PARAMETER_CLAUSE(), b.token(JavaScriptPunctuator.DOUBLEARROW), <START> FLOW_TYPE()), <END> f.flowFunctionType(FLOW_UNION_TYPE_OR_HIGHER(), b.token(JavaScriptPunctuator.DOUBLEARROW), FLOW_FUNCTION_TYPE_OR_HIGHER()), FLOW_UNION_TYPE_OR_HIGHER() )); }</code><technical_language>@inverno grammar rule for single parameter version</technical_language>

Target:
public FlowTypeTree FLOW_FUNCTION_TYPE_OR_HIGHER() { return b.<FlowTypeTree>nonterminal(Kind.FLOW_FUNCTION_TYPE) .is(b.firstOf( f.flowFunctionType( b.optional(FLOW_GENERIC_PARAMETER_CLAUSE()), b.firstOf(FLOW_FUNCTION_TYPE_PARAMETER_CLAUSE(), f.flowFunctionTypeSingleParameterClause(FLOW_UNION_TYPE_OR_HIGHER())), b.token(JavaScriptPunctuator.DOUBLEARROW), FLOW_TYPE()), FLOW_UNION_TYPE_OR_HIGHER())); }