auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void stop(boolean stopGracefully) { synchronized (stateChangeLock) { Preconditions.checkState(started, "not started"); log.info("Beginning shutdown of KafkaSupervisor[%s]", dataSource); try { scheduledExec.shutdownNow(); Optional<TaskRunner> taskRunner = taskMaster.getTaskRunner(); if (taskRunner.isPresent()) { taskRunner.get().unregisterListener(supervisorId); } synchronized (stopLock) { if (stopGracefully) { log.info("Posting GracefulShutdownNotice, signalling managed tasks to complete and publish"); notices.add(new GracefulShutdownNotice()); } else { log.info("Posting ShutdownNotice"); notices.add(new ShutdownNotice()); } long shutdownTimeoutMillis = tuningConfig.getShutdownTimeout().getMillis(); long endTime = System.currentTimeMillis() + shutdownTimeoutMillis; while (!stopped) { long sleepTime = endTime - System.currentTimeMillis(); if (sleepTime <= 0) { log.info("Timed out while waiting for shutdown (timeout [%dms])", shutdownTimeoutMillis); stopped = true; break; } stopLock.wait(sleepTime); } } log.info("Shutdown notice handled"); taskClient.close(); workerExec.shutdownNow(); exec.shutdownNow(); started = false; log.info("KafkaSupervisor[%s] has stopped", dataSource); } catch (Exception e) { log.makeAlert(e, "Exception stopping KafkaSupervisor[%s]", dataSource) .emit(); } } }

Target:
public void stop(boolean stopGracefully) { synchronized (stateChangeLock) { Preconditions.checkState(started, "not started"); log.info("Beginning shutdown of KafkaSupervisor[%s]", dataSource); try { scheduledExec.shutdownNow(); Optional<TaskRunner> taskRunner = taskMaster.getTaskRunner(); if (taskRunner.isPresent()) { taskRunner.get().unregisterListener(supervisorId); } synchronized (stopLock) { if (stopGracefully) { log.info("Posting GracefulShutdownNotice, signalling managed tasks to complete and publish"); notices.add(new GracefulShutdownNotice()); } else { log.info("Posting ShutdownNotice"); notices.add(new ShutdownNotice()); } long shutdownTimeoutMillis = tuningConfig.getShutdownTimeout().getMillis(); long endTime = System.currentTimeMillis() + shutdownTimeoutMillis; while (!stopped) { long sleepTime = endTime - System.currentTimeMillis(); if (sleepTime <= 0) { log.info("Timed out while waiting for shutdown (timeout [%,dms])", shutdownTimeoutMillis); stopped = true; break; } stopLock.wait(sleepTime); } } log.info("Shutdown notice handled"); taskClient.close(); workerExec.shutdownNow(); exec.shutdownNow(); started = false; log.info("KafkaSupervisor[%s] has stopped", dataSource); } catch (Exception e) { log.makeAlert(e, "Exception stopping KafkaSupervisor[%s]", dataSource) .emit(); } } }
Source:
public void checkIndentation() { final DetailAST firstChild = getMainAst().getFirstChild(); final DetailAST parent = getMainAst().getParent(); if (parent.getType() != TokenTypes.SWITCH_RULE && getLineStart(firstChild) == expandedTabsColumnNo(firstChild)) { final IndentLevel level = getIndent(); if (isAcceptableIndent(firstChild, level)) { isLambdaCorrectlyIndented = false; logError(firstChild, "arguments", expandedTabsColumnNo(firstChild), level); } } if (getLineStart(getMainAst()) == expandedTabsColumnNo(getMainAst())) { final IndentLevel level = new IndentLevel(getIndent(), getIndentCheck().getLineWrappingIndentation()); if (isAcceptableIndent(getMainAst(), level)) { isLambdaCorrectlyIndented = false; logError(getMainAst(), "", expandedTabsColumnNo(getMainAst()), level); } } }

Target:
public void checkIndentation() { final DetailAST firstChild = getMainAst().getFirstChild(); final DetailAST parent = getMainAst().getParent(); if (parent.getType() != TokenTypes.SWITCH_RULE && getLineStart(firstChild) == expandedTabsColumnNo(firstChild)) { final int firstChildColumnNo = expandedTabsColumnNo(firstChild); final IndentLevel level = getIndent(); if (isNonAcceptableIndent(firstChildColumnNo, level)) { isLambdaCorrectlyIndented = false; logError(firstChild, "arguments", firstChildColumnNo, level); } } final int mainAstColumnNo = expandedTabsColumnNo(getMainAst()); if (mainAstColumnNo == getLineStart(getMainAst())) { final IndentLevel level = new IndentLevel(getIndent(), getIndentCheck().getLineWrappingIndentation()); if (isNonAcceptableIndent(mainAstColumnNo, level)) { isLambdaCorrectlyIndented = false; logError(getMainAst(), "", mainAstColumnNo, level); } } }
Source:
public void testGetInternalUrlServiceEndpoint() throws Exception { Iterable<Module> modules = ImmutableSet.<Module> of(getLoggingModule(), new InternalUrlModule()); NovaApi novaApi = ContextBuilder.newBuilder(provider).modules(modules).overrides(setupProperties()).buildApi(NovaApi.class); String zone = novaApi.getConfiguredZones().iterator().next(); try { novaApi.getServerApiForZone(zone).list().concat().toList(); } catch (Exception e) { Assert.fail("Could not retrieve servers list", e); } }

Target:
public void testGetInternalUrlServiceEndpoint() throws Exception { String zone = api.getConfiguredZones().iterator().next(); try { api.getServerApiForZone(zone).list().concat().toList(); } catch (Exception e) { Assert.fail("Could not retrieve servers list using the internalUrl", e); } }
Source:
public void testOpenAndCloseInSinkFunction() throws Exception { @SuppressWarnings("unchecked") ElasticsearchSinkFunction<String> sinkFunction = (ElasticsearchSinkFunction<String>) mock(ElasticsearchSinkFunction.class); final DummyElasticsearchSink<String> sink = new DummyElasticsearchSink<>( new HashMap<>(), sinkFunction, new DummyRetryFailureHandler()); sink.open(mock(Configuration.class)); sink.close(); verify(sinkFunction, times(1)).open(); verify(sinkFunction, times(1)).close(); verifyNoMoreInteractions(sinkFunction); }

Target:
public void testOpenAndCloseInSinkFunction() throws Exception { SimpleClosableSinkFunction<String> sinkFunction = new SimpleClosableSinkFunction<>(); final DummyElasticsearchSink<String> sink = new DummyElasticsearchSink<>( new HashMap<>(), sinkFunction, new DummyRetryFailureHandler()); sink.open(mock(Configuration.class)); sink.close(); Assert.assertTrue(sinkFunction.openCalled); Assert.assertTrue(sinkFunction.closeCalled); }
Source:
public List<LunModel> getLunsToRemove() { if (getIsGrouppedByTarget()) { List<LunModel> luns = new ArrayList<>(); List<SanTargetModel> sanTargetModels = (List<SanTargetModel>) getItems(); for (SanTargetModel sanTargetModel : sanTargetModels) { luns.addAll(sanTargetModel.getLuns().stream() .filter(LunModel::getIsIncluded) .filter(LunModel::isRemoveLunSelected) .distinct() .collect(Collectors.toList())); } return luns; } return ((List<LunModel>) getItems()).stream() .filter(LunModel::getIsIncluded) .filter(LunModel::isRemoveLunSelected) .distinct() .collect(Collectors.toList()); }

Target:
public List<LunModel> getLunsToRemove() { if (getIsGrouppedByTarget()) { return ((List<SanTargetModel>) getItems()).stream() .map(SanTargetModel::getLuns) .flatMap(List::stream) .filter(LunModel::isRemoveLunSelected) .distinct() .collect(Collectors.toList()); } return ((List<LunModel>) getItems()).stream() .filter(LunModel::isRemoveLunSelected) .distinct() .collect(Collectors.toList()); }
Source:
default void referenceOriginalMessage(final Message original, String originalQueue) { String originalQueueOnMessage = original.getAnnotationString(Message.HDR_ORIGINAL_QUEUE); if (originalQueueOnMessage != null) { setBreadcrumb(Message.HDR_ORIGINAL_QUEUE, originalQueueOnMessage); } setAnnotation(Message.HDR_ORIGINAL_QUEUE, originalQueue); Object originalID = original.getAnnotation(Message.HDR_ORIG_MESSAGE_ID); if (originalID != null) { setBreadcrumb(Message.HDR_ORIGINAL_ADDRESS, original.getAnnotationString(Message.HDR_ORIGINAL_ADDRESS)); setBreadcrumb(Message.HDR_ORIG_MESSAGE_ID, originalID); } setAnnotation(Message.HDR_ORIGINAL_ADDRESS, original.getAddress()); setAnnotation(Message.HDR_ORIG_MESSAGE_ID, original.getMessageID()); setExpiration(0); }

Target:
default void referenceOriginalMessage(final Message original, String originalQueue) { Object originalQueueOnMessage = original.getBrokerProperty(Message.HDR_ORIGINAL_QUEUE); if (originalQueueOnMessage != null) { setBreadcrumb(Message.HDR_ORIGINAL_QUEUE, originalQueueOnMessage); } setBrokerProperty(Message.HDR_ORIGINAL_QUEUE, originalQueue); Object originalID = original.getBrokerProperty(Message.HDR_ORIG_MESSAGE_ID); if (originalID != null) { setBreadcrumb(Message.HDR_ORIGINAL_ADDRESS, original.getBrokerProperty(Message.HDR_ORIGINAL_ADDRESS)); setBreadcrumb(Message.HDR_ORIG_MESSAGE_ID, originalID); } setBrokerProperty(Message.HDR_ORIGINAL_ADDRESS, original.getAddress()); setBrokerProperty(Message.HDR_ORIG_MESSAGE_ID, original.getMessageID()); setExpiration(0); }
Source:
public KnoxShellTable select(String cols) { KnoxShellTable table = new KnoxShellTable(); List<List<Comparable<? extends Object>>> columns = new ArrayList<>(); String[] colnames = cols.split(",\\s*"); for (String colName : colnames) { table.header(colName); columns.add(values(headers.indexOf(colName))); } for (int i = 0; i < rows.size(); i++) { table.row(); for (List<Comparable<? extends Object>> col : columns) { table.value(col.get(i)); } } return table; }

Target:
public KnoxShellTable select(String cols) { KnoxShellTable table = new KnoxShellTable(); List<List<Comparable<? extends Object>>> columns = new ArrayList<>(); cols = cols.trim(); String[] colnames = cols.split("\\s*,\\s*"); for (String colName : colnames) { table.header(colName); columns.add(values(headers.indexOf(colName))); } for (int i = 0; i < rows.size(); i++) { table.row(); for (List<Comparable<? extends Object>> col : columns) { table.value(col.get(i)); } } return table; }
Source:
public Collection<TreeNode> getTreeNodes(Diff diff) { final Collection<EStructuralFeature.Setting> settings = treeNodeToDiffCrossReferencer .getNonNavigableInverseReferences(diff, false); final Set<TreeNode> nodes = new LinkedHashSet<TreeNode>(settings.size()); for (EStructuralFeature.Setting setting : settings) { final EObject referencing = setting.getEObject(); if (referencing instanceof TreeNode) { nodes.add((TreeNode)referencing); } } return nodes; }

Target:
public Collection<TreeNode> getTreeNodes(Diff diff) { final Collection<EStructuralFeature.Setting> settings = treeNodeToDiffCrossReferencer .getNonNavigableInverseReferences(diff, false); final List<TreeNode> nodes = new ArrayList<TreeNode>(settings.size()); for (EStructuralFeature.Setting setting : settings) { final EObject referencing = setting.getEObject(); if (referencing instanceof TreeNode) { nodes.add((TreeNode)referencing); } } return nodes; }
Source:
public MatchResult match(FilterNode filterNode, SymbolAliases symbolAliases) { checkState(this.filterNode == null, "joinNode must be null at this point"); this.filterNode = filterNode; this.symbolAliases = symbolAliases; return new MatchResult(match()); }

Target:
public MatchResult match(FilterNode filterNode, SymbolAliases symbolAliases) { checkState(this.filterNode == null, "filterNode must be null at this point"); this.filterNode = filterNode; this.symbolAliases = symbolAliases; return new MatchResult(match()); }
Source:
private boolean internalReceiveCommand(DiyOnXBeeBindingProvider provider, String itemName, Command command) { final String remote = provider.getRemote(itemName); final int[] remoteAddress = FormatUtil.fromReadableAddress(remote); Item item; try { item = itemRegistry.getItem(itemName); } catch (ItemNotFoundException e1) { logger.error("unable to get item " + itemName, e1); return false; } final String commandValue = createCommand(item, command); if(commandValue == null) { logger.warn("unable to create command " + commandValue + " for item " + itemName); return false; } else { logger.debug("created command for item {}", commandValue, itemName); } final String commandString = new StringBuilder().append(provider.getId(itemName)).append('=').append(commandValue).append('\n').toString(); final ZNetTxRequest request = new ZNetTxRequest(new XBeeAddress64(remoteAddress), createPayload(commandString)); xbeeUsageLock.lock(); try { if(xbee == null) { logger.error("cannot send command to " + itemName + " as the XBee module isn't initialized"); return false; } else { final XBeeResponse response = xbee.sendSynchronous(request); return true; } } catch (XBeeTimeoutException e) { logger.error("failed sending " + command + " to " + itemName, e); } catch (XBeeException e) { logger.error("failed sending " + command + " to " + itemName, e); } finally { xbeeUsageLock.unlock(); } return false; }

Target:
private boolean internalReceiveCommand(DiyOnXBeeBindingProvider provider, String itemName, Command command) { final String remote = provider.getRemote(itemName); final int[] remoteAddress = FormatUtil.fromReadableAddress(remote); Item item; try { item = itemRegistry.getItem(itemName); } catch (ItemNotFoundException e1) { logger.error("unable to get item {}", itemName, e1); return false; } final String commandValue = createCommand(item, command); if (commandValue == null) { logger.warn("unable to create command for item {}", commandValue, itemName); return false; } else { logger.debug("created command for item {}", commandValue, itemName); } final String commandString = new StringBuilder().append(provider.getId(itemName)).append('=') .append(commandValue).append('\n').toString(); final ZNetTxRequest request = new ZNetTxRequest(new XBeeAddress64(remoteAddress), createPayload(commandString)); xbeeUsageLock.lock(); try { if (xbee == null) { logger.error("cannot send command to as the XBee module isn't initialized", itemName); return false; } else { final XBeeResponse response = xbee.sendSynchronous(request); return true; } } catch (XBeeTimeoutException e) { logger.error("failed sending to {}", command, itemName, e); } catch (XBeeException e) { logger.error("failed sending to {}", command, itemName, e); } finally { xbeeUsageLock.unlock(); } return false; }
Source:
public ScmChangedFiles provide(@Nullable ScmConfiguration scmConfiguration, BranchConfiguration branchConfiguration, InputModuleHierarchy inputModuleHierarchy) { if (scmBranchChangedFiles == null) { if (scmConfiguration == null) { scmBranchChangedFiles = new ScmChangedFiles(null); } else { Path rootBaseDir = inputModuleHierarchy.root().getBaseDir(); Collection<Path> changedFiles = loadChangedFilesIfNeeded(scmConfiguration, branchConfiguration, rootBaseDir); scmBranchChangedFiles = new ScmChangedFiles(changedFiles); } } return scmBranchChangedFiles; }

Target:
public ScmChangedFiles provide(@Nullable ScmConfiguration scmConfiguration, BranchConfiguration branchConfiguration, InputModuleHierarchy inputModuleHierarchy) { if (scmBranchChangedFiles == null) { if (scmConfiguration == null) { scmBranchChangedFiles = new ScmChangedFiles(null); } else { Path rootBaseDir = inputModuleHierarchy.root().getBaseDir(); Collection<Path> changedFiles = loadChangedFilesIfNeeded(scmConfiguration, branchConfiguration, rootBaseDir); validatePaths(changedFiles); scmBranchChangedFiles = new ScmChangedFiles(changedFiles); } } return scmBranchChangedFiles; }
Source:
public void setEntity(EntityLocal entity) { super.setEntity(entity); this.producer = getConfig(PRODUCER) == null ? entity: getConfig(PRODUCER); this.sourceSensor = (Sensor<T>) getRequiredConfig(SOURCE_SENSOR); Sensor<?> targetSensorSpecified = getConfig(TARGET_SENSOR); this.targetSensor = targetSensorSpecified!=null ? (Sensor<U>) targetSensorSpecified : (Sensor<U>) this.sourceSensor; if (producer.equals(entity) && targetSensorSpecified==null) { LOG.error("Refusing to add an enricher which reads and publishes on the same sensor: "+ producer+"."+sourceSensor+" (computing transformation)"); return; } subscribe(producer, sourceSensor, this); if (sourceSensor instanceof AttributeSensor) { Object value = producer.getAttribute((AttributeSensor<?>)sourceSensor); if (value!=null) { onEvent(new BasicSensorEvent(sourceSensor, producer, value, -1)); } } }

Target:
public void setEntity(EntityLocal entity) { super.setEntity(entity); this.producer = getConfig(PRODUCER) == null ? entity: getConfig(PRODUCER); this.sourceSensor = (Sensor<T>) getRequiredConfig(SOURCE_SENSOR); Sensor<?> targetSensorSpecified = getConfig(TARGET_SENSOR); this.targetSensor = targetSensorSpecified!=null ? (Sensor<U>) targetSensorSpecified : (Sensor<U>) this.sourceSensor; if (producer.equals(entity) && targetSensorSpecified==null) { LOG.error("Refusing to add an enricher which reads and publishes on the same sensor: "+ producer+"."+sourceSensor+" (computing transformation)"); return; } subscriptions().subscribe(producer, sourceSensor, this); if (sourceSensor instanceof AttributeSensor) { Object value = producer.getAttribute((AttributeSensor<?>)sourceSensor); if (value!=null) { onEvent(new BasicSensorEvent(sourceSensor, producer, value, -1)); } } }
Source:
private static boolean shouldReactToChildVisibilityChanges(MUIElement theElement) { return (theElement instanceof MPartSashContainer || theElement instanceof MPartStack); }

Target:
private static boolean shouldReactToChildVisibilityChanges(MUIElement theElement) { return (theElement instanceof MPartSashContainer || theElement instanceof MPartStack || theElement instanceof MCompositePart) && !theElement.getTags().contains(IPresentationEngine.HIDDEN_EXPLICITLY); }
Source:
public void consumeOnceForEachLeaderPair() { leaderElectionResultsWithDurationInRandomOrder(LEADER_1, LEADER_2, 5, 10); leaderElectionResultsWithDurationInRandomOrder(LEADER_2, LEADER_3, 5, 15); leaderElectionResultsWithDurationInRandomOrder(LEADER_1, LEADER_2, 5, 1); leaderElectionResultsWithDurationInRandomOrder(LEADER_1, LEADER_3, 5, 7); verify(mockConsumer).accept(10L); verify(mockConsumer).accept(15L); verify(mockConsumer).accept(7L); verifyNoMoreInteractions(mockConsumer); }

Target:
public void consumeOnceForEachLeaderPair() { leaderElectionResultsWithDurationInRandomOrder(LEADER_1, LEADER_2, 5, 10); leaderElectionResultsWithDurationInRandomOrder(LEADER_2, LEADER_3, 5, 25); leaderElectionResultsWithDurationInRandomOrder(LEADER_1, LEADER_2, 5, 1); leaderElectionResultsWithDurationInRandomOrder(LEADER_1, LEADER_3, 5, 37); verify(mockConsumer).accept(10L); verify(mockConsumer).accept(25L); verify(mockConsumer).accept(37L); verifyNoMoreInteractions(mockConsumer); }
Source:
public Set<SwaggerError> validate(JsonDocument document, URI baseURI) { Set<SwaggerError> errors = Sets.newHashSet(); JsonNode jsonContent = null; try { jsonContent = document.asJson(); } catch (Exception e) { System.out.println("Loggg"); YEditLog.logException(e); } if (jsonContent != null) { Node yaml = document.getYaml(); if (yaml != null) { errors.addAll(validateAgainstSchema( new ErrorProcessor(yaml, document.getSchema().getRootType().getContent()), document)); errors.addAll(validateModel(document.getModel())); errors.addAll(checkDuplicateKeys(yaml)); errors.addAll(referenceValidator.validate(baseURI, document)); } } return errors; }

Target:
public Set<SwaggerError> validate(JsonDocument document, URI baseURI) { Set<SwaggerError> errors = Sets.newHashSet(); JsonNode jsonContent = null; try { jsonContent = document.asJson(); } catch (Exception e) { YEditLog.logException(e); } if (jsonContent != null) { Node yaml = document.getYaml(); if (yaml != null) { errors.addAll(validateAgainstSchema( new ErrorProcessor(yaml, document.getSchema().getRootType().getContent()), document)); errors.addAll(validateModel(document.getModel())); errors.addAll(checkDuplicateKeys(yaml)); errors.addAll(referenceValidator.validate(baseURI, document)); } } return errors; }
Source:
public static boolean isBinary(byte[] raw) { final int size = raw.length > FIRST_FEW_BYTES ? FIRST_FEW_BYTES : raw.length; return isBinary(raw, size); }

Target:
public static boolean isBinary(byte[] raw) { final int size = Math.min(raw.length, FIRST_FEW_BYTES); return isBinary(raw, size); }
Source:
public GdbTerminalConnector(Process process) { fProcess = process; }

Target:
public GdbTerminalConnector(Process process) { if (process == null) { throw new IllegalArgumentException("Invalid Process"); } fProcess = process; }
Source:
public ApexDangerousMethodsRule() { setProperty(CODECLIMATE_CATEGORIES, new String[] { "Security" }); setProperty(CODECLIMATE_REMEDIATION_MULTIPLIER, 100); setProperty(CODECLIMATE_BLOCK_HIGHLIGHTING, false); }

Target:
public ApexDangerousMethodsRule() { super.addRuleChainVisit(ASTUserClass.class); setProperty(CODECLIMATE_CATEGORIES, new String[] { "Security" }); setProperty(CODECLIMATE_REMEDIATION_MULTIPLIER, 100); setProperty(CODECLIMATE_BLOCK_HIGHLIGHTING, false); }
Source:
public String toString() { return "KafkaSupervisorIOConfig{" + "topic='" + getTopic() + '\'' + ", replicas=" + getReplicas() + ", taskCount=" + getTaskCount() + ", taskDuration=" + getTaskDuration() + ", consumerProperties=" + consumerProperties + ", startDelay=" + getStartDelay() + ", period=" + getPeriod() + ", useEarliestOffset=" + isUseEarliestOffset() + ", completionTimeout=" + getCompletionTimeout() + ", lateMessageRejectionPeriod=" + getLateMessageRejectionPeriod() + ", skipOffsetGaps=" + skipOffsetGaps + '}'; }

Target:
public String toString() { return "KafkaSupervisorIOConfig{" + "topic='" + getTopic() + '\'' + ", replicas=" + getReplicas() + ", taskCount=" + getTaskCount() + ", taskDuration=" + getTaskDuration() + ", consumerProperties=" + consumerProperties + ", startDelay=" + getStartDelay() + ", period=" + getPeriod() + ", useEarliestOffset=" + isUseEarliestOffset() + ", completionTimeout=" + getCompletionTimeout() + ", earlyMessageRejectionPeriod=" + getEarlyMessageRejectionPeriod() + ", lateMessageRejectionPeriod=" + getLateMessageRejectionPeriod() + ", skipOffsetGaps=" + skipOffsetGaps + '}'; }
Source:
protected long saveEvent(String eventType, JSONObject event) { String eventString = event.toString(); if (Utils.isEmptyString(eventString)) { logger.e(TAG, String.format( "Detected empty event string for event type %s, skipping", eventType )); return -1; } if (eventString.getBytes().length >= Constants.MAX_EVENT_SIZE_BYTES) { logger.e(TAG, String.format( "Event %s with properties exceeds 1MB in sizes, skipping", eventType )); return -1; } if (eventType.equals(Constants.IDENTIFY_EVENT) || eventType.equals(Constants.GROUP_IDENTIFY_EVENT)) { lastIdentifyId = dbHelper.addIdentify(eventString); setLastIdentifyId(lastIdentifyId); } else { lastEventId = dbHelper.addEvent(eventString); setLastEventId(lastEventId); } int numEventsToRemove = Math.min( Math.max(1, eventMaxCount/10), Constants.EVENT_REMOVE_BATCH_SIZE ); if (dbHelper.getEventCount() > eventMaxCount) { dbHelper.removeEvents(dbHelper.getNthEventId(numEventsToRemove)); } if (dbHelper.getIdentifyCount() > eventMaxCount) { dbHelper.removeIdentifys(dbHelper.getNthIdentifyId(numEventsToRemove)); } long totalEventCount = dbHelper.getTotalEventCount(); if ((totalEventCount % eventUploadThreshold) == 0 && totalEventCount >= eventUploadThreshold) { updateServer(); } else { updateServerLater(eventUploadPeriodMillis); } return ( eventType.equals(Constants.IDENTIFY_EVENT) || eventType.equals(Constants.GROUP_IDENTIFY_EVENT) ) ? lastIdentifyId : lastEventId; }

Target:
protected long saveEvent(String eventType, JSONObject event) { String eventString = event.toString(); if (Utils.isEmptyString(eventString)) { logger.e(TAG, String.format( "Detected empty event string for event type %s, skipping", eventType )); return -1; } if (eventType.equals(Constants.IDENTIFY_EVENT) || eventType.equals(Constants.GROUP_IDENTIFY_EVENT)) { lastIdentifyId = dbHelper.addIdentify(eventString); setLastIdentifyId(lastIdentifyId); } else { lastEventId = dbHelper.addEvent(eventString); setLastEventId(lastEventId); } int numEventsToRemove = Math.min( Math.max(1, eventMaxCount/10), Constants.EVENT_REMOVE_BATCH_SIZE ); if (dbHelper.getEventCount() > eventMaxCount) { dbHelper.removeEvents(dbHelper.getNthEventId(numEventsToRemove)); } if (dbHelper.getIdentifyCount() > eventMaxCount) { dbHelper.removeIdentifys(dbHelper.getNthIdentifyId(numEventsToRemove)); } long totalEventCount = dbHelper.getTotalEventCount(); if ((totalEventCount % eventUploadThreshold) == 0 && totalEventCount >= eventUploadThreshold) { updateServer(); } else { updateServerLater(eventUploadPeriodMillis); } return ( eventType.equals(Constants.IDENTIFY_EVENT) || eventType.equals(Constants.GROUP_IDENTIFY_EVENT) ) ? lastIdentifyId : lastEventId; }
Source:
private String readKieVersionPropertyString(MavenProject mavenProject) { if (mavenProject.getProperties() != null) { if (mavenProject.getProperties().getProperty(_kieVersionPropertyKey) != null) { return mavenProject.getProperties().getProperty(_kieVersionPropertyKey); } else { return mavenProject.getProperties().getProperty("version.org.kie"); } } return null; }

Target:
private String readKieVersionPropertyString(MavenProject mavenProject) { if (mavenProject != null && mavenProject.getProperties() != null) { Properties properties = mavenProject.getProperties(); if (properties.getProperty(_kieVersionPropertyKey) != null) { return properties.getProperty(_kieVersionPropertyKey); } else { return properties.getProperty(M2EUtils.ALT_KIE_VERSION); } } return null; }
Source:
public ASTField(ASTClass declaringClass, String source, FieldDeclaration field, VariableDeclarationFragment fragment) { this.declaringClass = declaringClass; name = fragment.getName().getIdentifier(); modifiers = field.getModifiers(); start = field.getStartPosition(); Javadoc doc = field.getJavadoc(); List<TagElement> tags = null; if (doc != null) { tags = doc.tags(); for (TagElement tag : tags) { if ("@field".equals(tag.getTagName())) { String data = tag.fragments().get(0).toString(); setMetaData(data); break; } } } type = new ASTType(declaringClass.resolver, field.getType(), fragment.getExtraDimensions()); type64 = this.type; if (GEN64) { String s = source.substring(field.getStartPosition(), field.getStartPosition() + field.getLength()); if (type.isType("int") && s.contains("int ")) type64 = new ASTType("J"); else if (type.isType("float") && s.contains("float ")) type64 = new ASTType("D"); else if (type.isType("[I") && (s.contains("int ") || s.contains("int[] "))) type64 = new ASTType("[J"); else if (type.isType("[F") && (s.contains("float ")|| s.contains("float[] "))) type64 = new ASTType("[D"); else if (type.isType("long") && s.contains("long ")) type = new ASTType("I"); else if (type.isType("double") && s.contains("double ")) type = new ASTType("F"); else if (type.isType("[J") && (s.contains("long ")|| s.contains("long[] "))) type = new ASTType("[I"); else if (type.isType("[D") && (s.contains("double ")|| s.contains("double[] "))) type = new ASTType("[F"); } }

Target:
public ASTField(ASTClass declaringClass, String source, FieldDeclaration field, VariableDeclarationFragment fragment) { this.declaringClass = declaringClass; name = fragment.getName().getIdentifier(); modifiers = field.getModifiers(); start = field.getStartPosition(); Javadoc doc = field.getJavadoc(); List<TagElement> tags = null; if (doc != null) { tags = doc.tags(); for (TagElement tag : tags) { if ("@field".equals(tag.getTagName())) { String data = tag.fragments().get(0).toString(); setMetaData(data); break; } } } type = new ASTType(declaringClass.resolver, field.getType(), fragment.getExtraDimensions()); type64 = this.type; if (GEN64) { String s = source.substring(field.getStartPosition(), field.getStartPosition() + field.getLength()); if (type.isType("int") && s.indexOf("int ") != -1) type64 = new ASTType("J"); else if (type.isType("float") && s.indexOf("float ") != -1) type64 = new ASTType("D"); else if (type.isType("[I") && (s.indexOf("int ") != -1 || s.indexOf("int[] ") != -1)) type64 = new ASTType("[J"); else if (type.isType("[F") && (s.indexOf("float ") != -1|| s.indexOf("float[] ") != -1)) type64 = new ASTType("[D"); else if (type.isType("long") && s.indexOf("long ") != -1) type = new ASTType("I"); else if (type.isType("double") && s.indexOf("double ") != -1) type = new ASTType("F"); else if (type.isType("[J") && (s.indexOf("long ") != -1|| s.indexOf("long[] ") != -1)) type = new ASTType("[I"); else if (type.isType("[D") && (s.indexOf("double ") != -1|| s.indexOf("double[] ") != -1)) type = new ASTType("[F"); } }
Source:
public static <T extends IForgeRegistryEntry<T>> void writeRegistryEntries(@Nonnull ByteBuf out, @Nonnull Collection<T> entries) { writeVarInt(out, entries.size(), 5); Iterator<T> it = entries.iterator(); if (it.hasNext()) { T entry = it.next(); FMLControlledNamespacedRegistry<T> registry = (FMLControlledNamespacedRegistry<T>)GameRegistry.findRegistry(entry.getRegistryType()); writeUTF8String(out, registry.getRegistryName().toString()); do { writeVarInt(out, registry.getId(entry), 5); if (it.hasNext()) { entry = it.next(); } else { break; } } while (true); } }

Target:
public static <T extends IForgeRegistryEntry<T>> void writeRegistryEntries(@Nonnull ByteBuf out, @Nonnull Collection<T> entries) { writeVarInt(out, entries.size(), 5); Iterator<T> it = entries.iterator(); if (it.hasNext()) { T first = it.next(); FMLControlledNamespacedRegistry<T> registry = (FMLControlledNamespacedRegistry<T>)GameRegistry.findRegistry(first.getRegistryType()); writeUTF8String(out, PersistentRegistryManager.getRegistryRegistryName(registry).toString()); writeVarInt(out, registry.getId(first), 5); while (it.hasNext()) { int id = registry.getId(it.next()); if (id == -1) { throw new IllegalArgumentException("Unregistered IForgeRegistryEntry in collection " + entries + "."); } writeVarInt(out, id, 5); } } }
Source:
public void testSetDateEffectiveToNull() throws Exception, UpdateException { ArrayList<Coordinate> coordinates = new ArrayList<>(); Coordinate coordinate = new Coordinate(0, 2); coordinates.add(coordinate); table52.getData() .get(0) .get(2) .setDateValue(null); updateManager.update(table52, coordinates); verify(analyzer).update(anySet()); }

Target:
public void testSetDateEffectiveToNull() throws Exception { ArrayList<Coordinate> coordinates = new ArrayList<>(); Coordinate coordinate = new Coordinate(0, 2); coordinates.add(coordinate); table52.getData() .get(0) .get(2) .setDateValue(null); updateManager.update(table52, coordinates); verify(analyzer).update(setArgumentCaptor.capture()); Set value = setArgumentCaptor.getValue(); assertEquals(1, value.size()); assertEquals(0, value.iterator().next()); }
Source:
private void fireChanges() { fireContentChanged(); RepositoryMapping mapping = RepositoryMapping.getMapping(path); if (mapping != null) { mapping.getRepository().fireEvent(new IndexChangedEvent()); } else { Repository myRepository = repository; if (myRepository != null && !myRepository.isBare()) { refreshRepositoryState(myRepository); } } }

Target:
private void fireChanges() { fireContentChanged(); Repository myRepository = repository; boolean updated = false; if (myRepository != null && !myRepository.isBare()) { updated = refreshRepositoryState(myRepository); } if (!updated) { RepositoryMapping mapping = RepositoryMapping.getMapping(path); if (mapping != null) { mapping.getRepository().fireEvent(new IndexChangedEvent()); } } }
Source:
public User findByUserName(String name) { String sQuery = String.format("select * from %s where userName=:userName", getEntityClass().getSimpleName(), name); OSQLSynchQuery<Long> oQuery = new OSQLSynchQuery<Long>(sQuery); oQuery.setLimit(1); HashMap<String, String> params = new HashMap<String, String>(); params.put("userName", name); List<User> resultList = getDelegate().command(oQuery).execute(params); return resultList.size() > 0 ? resultList.iterator().next() : null; }

Target:
public User findByUserName(String name) { String sQuery = String.format("select * from %s where userName=:userName", getEntityClass().getSimpleName()); OSQLSynchQuery<Long> oQuery = new OSQLSynchQuery<Long>(sQuery); oQuery.setLimit(1); HashMap<String, String> params = new HashMap<String, String>(); params.put("userName", name); List<User> resultList = getDelegate().command(oQuery).execute(params); return !resultList.isEmpty() ? resultList.iterator().next() : null; }
Source:
protected ContentProviderStoreCoreBase(@NonNull final ContentResolver contentResolver) { this(contentResolver, 100, 30); }

Target:
protected ContentProviderStoreCoreBase(@NonNull final ContentResolver contentResolver) { this(contentResolver, DEFAULT_GROUPING_TIMEOUT_MS, DEFAULT_GROUP_MAX_SIZE_MS); }
Source:
TxnContext merge(@Nonnull Table<K, V, M> table, @Nonnull final K key, @Nonnull BiFunction<CorfuRecord<V, M>, CorfuRecord<V,M>, CorfuRecord<V,M>> mergeOperator, @Nonnull final CorfuRecord<V,M> recordDelta) { if (!table.getNamespace().equals(namespace)) { throw new IllegalArgumentException("TxnContext can't apply table from namespace " + table.getNamespace() + " to transaction on namespace " + namespace); } tablesInTxn.add(table); operations.add(() -> { CorfuRecord<V,M> oldRecord = table.get(key); CorfuRecord<V, M> mergedRecord; try { mergedRecord = mergeOperator.apply(oldRecord, recordDelta); } catch (Exception ex) { txAbort(); log.error("TX Abort merge: {}", table.getFullyQualifiedTableName(), ex); throw ex; } table.put(key, mergedRecord.getPayload(), mergedRecord.getMetadata()); table.getMetrics().numMerges.incrementAndGet(); }); return this; }

Target:
TxnContext merge(@Nonnull Table<K, V, M> table, @Nonnull final K key, @Nonnull BiFunction<CorfuRecord<V, M>, CorfuRecord<V,M>, CorfuRecord<V,M>> mergeOperator, @Nonnull final CorfuRecord<V,M> recordDelta) { validateTableWrittenIsInNamespace(table); operations.add(() -> { CorfuRecord<V,M> oldRecord = table.get(key); CorfuRecord<V, M> mergedRecord; try { mergedRecord = mergeOperator.apply(oldRecord, recordDelta); } catch (Exception ex) { txAbort(); log.error("TX Abort merge: {}", table.getFullyQualifiedTableName(), ex); throw ex; } table.put(key, mergedRecord.getPayload(), mergedRecord.getMetadata()); table.getMetrics().incNumMerges(); }); return this; }
Source:
public void testRowsAfterIteratorDetach(String acc, int recordIndex, int flags, String readName, String bases, String quals, int refStart, String cigar, String refName, int mapQ, boolean hasMate, boolean isSecondaryAlignment) { if (!SRAAccession.isSupported()) return; SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open( SamInputResource.of(new SRAAccession(acc)) ); final SAMRecordIterator samRecordIterator = reader.iterator(); while (recordIndex != 0) { Assert.assertTrue(samRecordIterator.hasNext(), "Record set is too small"); samRecordIterator.next(); recordIndex--; } Assert.assertTrue(samRecordIterator.hasNext(), "Record set is too small"); SAMRecord record = samRecordIterator.next(); samRecordIterator.next(); List<SAMValidationError> validationErrors = record.isValid(); Assert.assertNull(validationErrors, "SRA Lazy record is invalid. List of errors: " + (validationErrors != null ? validationErrors.toString() : "")); Assert.assertEquals(record.getReadName(), readName); Assert.assertEquals(new String(record.getReadBases()), bases); Assert.assertEquals(record.getBaseQualityString(), quals); Assert.assertEquals(record.getReadPairedFlag(), hasMate); Assert.assertEquals(record.getFlags(), flags); Assert.assertEquals(record.getNotPrimaryAlignmentFlag(), isSecondaryAlignment); if (refStart == -1) { Assert.assertEquals(record.getReadUnmappedFlag(), true); Assert.assertEquals(record.getAlignmentStart(), 0); Assert.assertEquals(record.getCigarString(), "*"); Assert.assertEquals(record.getReferenceName(), "*"); Assert.assertEquals(record.getMappingQuality(), 0); } else { Assert.assertEquals(record.getReadUnmappedFlag(), false); Assert.assertEquals(record.getAlignmentStart(), refStart); Assert.assertEquals(record.getCigarString(), cigar); Assert.assertEquals(record.getReferenceName(), refName); Assert.assertEquals(record.getMappingQuality(), mapQ); } }

Target:
public void testRowsAfterIteratorDetach(String acc, int recordIndex, int flags, String readName, String bases, String quals, int refStart, String cigar, String refName, int mapQ, boolean hasMate, boolean isSecondaryAlignment) { if (!SRAAccession.isSupported()) return; SAMRecord record = getRecordByIndex(acc, recordIndex, true); checkSAMRecord(record, flags, readName, bases, quals, refStart, cigar, refName, mapQ, hasMate, isSecondaryAlignment); }
Source:
public Document(JsonNode json) { this.jsonFields = new HashMap<>(); json.fields().forEachRemaining( e -> { if ("coreId".equals(e.getKey())) { this.id = (json.get("doi").asText().equals("null")) ? json.get("coreId").asText() : "doi:" + json.get("doi").asText(); } else if ("abstract".equals(e.getKey())) { this.contents = json.get("title").asText() + "\n" + json.get("abstract").asText(); } else { jsonFields.put(e.getKey(), e.getValue()); } }); }

Target:
public Document(JsonNode json) { this.jsonFields = new HashMap<>(); json.fields().forEachRemaining( e -> { if ("coreId".equals(e.getKey())) { this.id = (json.get("doi").asText().equals("null")) ? json.get("coreId").asText() : "doi:" + json.get("doi").asText(); } else if ("abstract".equals(e.getKey())) { this.contents = json.get("title").asText() + "\n" + json.get("abstract").asText(); } else { this.jsonFields.put(e.getKey(), e.getValue()); } }); }
Source:
public <T> T execute(Request<T> request, boolean authenticateIfNeeded, IProgressMonitor monitor) throws IOException, GerritException { String openIdProvider = getOpenIdProvider(); hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); for (int attempt = 0; attempt < 2; attempt++) { if (authenticateIfNeeded && needsAuthentication()) { AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); if (openIdProvider != null || credentials != null) { authenticate(openIdProvider, monitor); } if (!obtainedXsrfKey) { updateXsrfKey(monitor); } } HttpMethodBase method = request.createMethod(); try { WebUtil.execute(httpClient, hostConfiguration, method, monitor); } catch (IOException e) { WebUtil.releaseConnection(method, monitor); throw e; } catch (RuntimeException e) { WebUtil.releaseConnection(method, monitor); throw e; } int code = method.getStatusCode(); if (code == HttpURLConnection.HTTP_OK) { try { return request.process(method); } finally { WebUtil.releaseConnection(method, monitor); } } else { WebUtil.releaseConnection(method, monitor); if (code == HttpURLConnection.HTTP_UNAUTHORIZED || code == HttpURLConnection.HTTP_FORBIDDEN) { authenticate(openIdProvider, monitor); } else { throw new GerritHttpException(code); } } } throw new GerritLoginException(); }

Target:
public <T> T execute(Request<T> request, boolean authenticateIfNeeded, IProgressMonitor monitor) throws IOException, GerritException { String openIdProvider = getOpenIdProvider(); hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); for (int attempt = 0; attempt < 2; attempt++) { if (authenticateIfNeeded) { if (needsAuthentication()) { AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); if (openIdProvider != null || credentials != null) { authenticate(openIdProvider, monitor); } } if (!obtainedXsrfKey) { updateXsrfKey(monitor); } } HttpMethodBase method = request.createMethod(); try { WebUtil.execute(httpClient, hostConfiguration, method, monitor); } catch (IOException e) { WebUtil.releaseConnection(method, monitor); throw e; } catch (RuntimeException e) { WebUtil.releaseConnection(method, monitor); throw e; } int code = method.getStatusCode(); if (code == HttpURLConnection.HTTP_OK) { try { return request.process(method); } finally { WebUtil.releaseConnection(method, monitor); } } else { WebUtil.releaseConnection(method, monitor); if (code == HttpURLConnection.HTTP_UNAUTHORIZED || code == HttpURLConnection.HTTP_FORBIDDEN) { authenticate(openIdProvider, monitor); } else { throw new GerritHttpException(code); } } } throw new GerritLoginException(); }
Source:
public void test_bug_7548161() { long now = System.currentTimeMillis(); long today = now; long tomorrow = now + DateUtils.DAY_IN_MILLIS; long yesterday = now - DateUtils.DAY_IN_MILLIS; assertEquals("Tomorrow", DateUtils.getRelativeTimeSpanString(tomorrow, now, DateUtils.DAY_IN_MILLIS, 0)); assertEquals("Yesterday", DateUtils.getRelativeTimeSpanString(yesterday, now, DateUtils.DAY_IN_MILLIS, 0)); assertEquals("Today", DateUtils.getRelativeTimeSpanString(today, now, DateUtils.DAY_IN_MILLIS, 0)); }

Target:
public void test_bug_7548161() { if (!LocaleUtils.isCurrentLocale(mContext, Locale.US)) { return; } long now = System.currentTimeMillis(); long today = now; long tomorrow = now + DateUtils.DAY_IN_MILLIS; long yesterday = now - DateUtils.DAY_IN_MILLIS; assertEquals("Tomorrow", DateUtils.getRelativeTimeSpanString(tomorrow, now, DateUtils.DAY_IN_MILLIS, 0)); assertEquals("Yesterday", DateUtils.getRelativeTimeSpanString(yesterday, now, DateUtils.DAY_IN_MILLIS, 0)); assertEquals("Today", DateUtils.getRelativeTimeSpanString(today, now, DateUtils.DAY_IN_MILLIS, 0)); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater .inflate(R.layout.activity_fragment_quickreturn_recycler, container, false); recycleView = (RecyclerView) rootView.findViewById(R.id.recycler); toolbar = (Toolbar) rootView.findViewById(R.id.toolbar); ((MainActivity) getActivity()).setSupportActionBar(toolbar); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { EventBusExt.getDefault().register(this); String currentUserId = AppPrefs.getInstance(getActivity()).getCurrentUserId(); TaskQueue.loadQueueDefault(getActivity()) .execute(new GetCurrentUserCampaignTask(currentUserId)); TaskQueue.loadQueueDefault(getActivity()) .execute(new GetPastUserCampaignTask(currentUserId)); View rootView = inflater .inflate(R.layout.activity_fragment_quickreturn_recycler, container, false); recycleView = (RecyclerView) rootView.findViewById(R.id.recycler); toolbar = (Toolbar) rootView.findViewById(R.id.toolbar); TextView title = (TextView) rootView.findViewById(R.id.toolbar_title); toolbar.setTitle(""); title.setText(getString(R.string.app_name)); setToolbarListener.setToolbar(toolbar); return rootView; }
Source:
public Map.Entry<KeyExtent,Bulk.Files> next() { if (!hasNext()) return null; Bulk.Mapping bm = gson.fromJson(reader, Bulk.Mapping.class); if (renameMap != null) { return new AbstractMap.SimpleEntry<>(bm.getKeyExtent(tableId), bm.getFiles().mapNames(renameMap)); } else { return new AbstractMap.SimpleEntry<>(bm.getKeyExtent(tableId), bm.getFiles()); } }

Target:
public Map.Entry<KeyExtent,Bulk.Files> next() { Bulk.Mapping bm = gson.fromJson(reader, Bulk.Mapping.class); if (renameMap != null) { return new AbstractMap.SimpleEntry<>(bm.getKeyExtent(tableId), bm.getFiles().mapNames(renameMap)); } else { return new AbstractMap.SimpleEntry<>(bm.getKeyExtent(tableId), bm.getFiles()); } }
Source:
public void test_run_without_user() throws IOException, InterruptedException { EnvVars launchEnv = newLaunchEnv(); String containerId = dockerClient.run(launchEnv, "learn/tutorial", null, null, Collections.<String, String>emptyMap(), Collections.<String>emptyList(), new EnvVars(), null, "echo", "hello world"); Assert.assertEquals(64, containerId.length()); ContainerRecord containerRecord = dockerClient.getContainerRecord(launchEnv, containerId); Assert.assertEquals(dockerClient.inspect(launchEnv, "learn/tutorial", ".Id"), containerRecord.getImageId()); Assert.assertTrue(containerRecord.getContainerName().length() > 0); Assert.assertTrue(containerRecord.getHost().length() > 0); Assert.assertTrue(containerRecord.getCreated() > 1000000000000L); Assert.assertEquals(Collections.<String>emptyList(), dockerClient.getVolumes(launchEnv, containerId)); Assert.assertNotNull(dockerClient.inspect(launchEnv, containerId, ".Name")); dockerClient.stop(launchEnv, containerId); Assert.assertNull(dockerClient.inspect(launchEnv, containerId, ".Name")); }

Target:
public void test_run_without_user() throws IOException, InterruptedException { EnvVars launchEnv = newLaunchEnv(); String containerId = dockerClient.run(launchEnv, "learn/tutorial", null, null, Collections.<String, String>emptyMap(), Collections.<String>emptyList(), new EnvVars(), null, "cat"); Assert.assertEquals(64, containerId.length()); ContainerRecord containerRecord = dockerClient.getContainerRecord(launchEnv, containerId); Assert.assertEquals(dockerClient.inspect(launchEnv, "learn/tutorial", ".Id"), containerRecord.getImageId()); Assert.assertTrue(containerRecord.getContainerName().length() > 0); Assert.assertTrue(containerRecord.getHost().length() > 0); Assert.assertTrue(containerRecord.getCreated() > 1000000000000L); Assert.assertEquals(Collections.<String>emptyList(), dockerClient.getVolumes(launchEnv, containerId)); Assert.assertNotNull(dockerClient.inspect(launchEnv, containerId, ".Name")); dockerClient.stop(launchEnv, containerId); Assert.assertNull(dockerClient.inspect(launchEnv, containerId, ".Name")); }
Source:
public static void filterAdminOnlyFlowParams(final UserManager userManager, final ExecutionOptions options, final User user, final Props props) throws ExecutorManagerException { if (options == null || options.getFlowParameters() == null) { return; } final Map<String, String> params = options.getFlowParameters(); boolean hasAdminPermission = hasPermission(userManager, user, Type.ADMIN); if (!hasAdminPermission) { params.remove(ExecutionOptions.USE_EXECUTOR); } else { validateIntegerParam(params, ExecutionOptions.USE_EXECUTOR); } boolean disableAdminOnlyForFlowPriority = props.getBoolean(ConfigurationKeys.AZKABAN_DISABLE_ADMIN_ONLY_PERMISSION_FOR_FLOW_PRIORITY, false); if (!hasAdminPermission && !disableAdminOnlyForFlowPriority ) { params.remove(ExecutionOptions.FLOW_PRIORITY); } else { validateIntegerParam(params, ExecutionOptions.FLOW_PRIORITY); } }

Target:
public static void filterAdminOnlyFlowParams(final UserManager userManager, final ExecutionOptions options, final User user, final Props props) throws ExecutorManagerException { if (options == null || options.getFlowParameters() == null) { return; } final Map<String, String> params = options.getFlowParameters(); final boolean hasAdminPermission = hasPermission(userManager, user, Type.ADMIN); if (!hasAdminPermission) { params.remove(ExecutionOptions.USE_EXECUTOR); } else { validateIntegerParam(params, ExecutionOptions.USE_EXECUTOR); } final boolean disableAdminOnlyForFlowPriority = props .getBoolean(ConfigurationKeys.AZKABAN_DISABLE_ADMIN_ONLY_PERMISSION_FOR_FLOW_PRIORITY, false); if (!hasAdminPermission && !disableAdminOnlyForFlowPriority ) { params.remove(ExecutionOptions.FLOW_PRIORITY); } else { validateIntegerParam(params, ExecutionOptions.FLOW_PRIORITY); } }
Source:
private void interpretCommandStatus(String status, ResultHandler handler) { long oid = 0; int count = 0; Matcher matcher = COMMAND_COMPLETE_PATTERN.matcher(status); if (matcher.matches()) { try { if (matcher.group(3) != null) { oid = Long.parseLong(matcher.group(2)); count = Integer.parseInt(matcher.group(3)); } else if (matcher.group(2) != null) { count = Integer.parseInt(matcher.group(2)); } } catch (NumberFormatException e) { handler.handleError(new PSQLException( GT.tr("Unable to parse the count in command completion tag: {0}.", status), PSQLState.CONNECTION_FAILURE)); return; } } handler.handleCommandStatus(status, count, oid); }

Target:
private void interpretCommandStatus(String status, ResultHandler handler) { long oid = 0; long count = 0; Matcher matcher = COMMAND_COMPLETE_PATTERN.matcher(status); if (matcher.matches()) { String group2 = matcher.group(2); String group3 = matcher.group(3); try { if (group3 != null) { oid = Long.parseLong(group2); count = Long.parseLong(group3); } else if (group2 != null) { count = Long.parseLong(group2); } } catch (NumberFormatException e) { handler.handleError(new PSQLException( GT.tr("Unable to parse the count in command completion tag: {0}.", status), PSQLState.CONNECTION_FAILURE)); return; } } int countAsInt = 0; if (count > Integer.MAX_VALUE) { countAsInt = Statement.SUCCESS_NO_INFO; } else if (count > 0) { countAsInt = (int) count; } handler.handleCommandStatus(status, countAsInt, oid); }