auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Set<String> getTagValues() { if (!isInitialized()) { doInitialize(); } String tagValues[] = {"#", "$", "''", "``", "'", "`", ",", ".", ":", "-LRB-", "-RRB-", "CC", "CD", "DT", "EX", "FW", "IN", "JJ", "JJR", "JJS", "LS", "MD", "NN", "NNS", "NNP", "NNPS", "PDT", "POS", "PRP", "PP$", "RB", "RBR", "RBS", "RP", "SYM", "TO", "UH", "VB", "VBD", "VBG", "VBN", "VBP", "VBZ", "WDT", "WP", "WP$", "WRB"}; return new HashSet<String>(Arrays.asList(tagValues)); }

Target:
public Set<String> getTagValues() { if (!isInitialized()) { doInitialize(); } return tagger.getTagValues(); }
Source:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__QUOTA); }

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__UPDATE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__QUOTA); }
Source:
public OnmsNode act(final OnmsNode node) { try { final CompiledScript compiledScript = compileScript(getScript()); if (compiledScript == null) { LOG.warn("No compiled script available for execution."); } else { return sessionUtils.withTransaction(() -> { try { OnmsNode dbNode = node; if(node.getId() > 0) { dbNode = m_nodeDao.get(node.getId()); } final SimpleBindings globals = new SimpleBindings(); globals.put("node", dbNode); globals.put("LOG", LOG); dbNode = (OnmsNode) compiledScript.eval(globals); if(dbNode.getId() > 0) { m_nodeDao.saveOrUpdate(dbNode); } return dbNode; } catch (ScriptException e) { LOG.warn("Error applying ScriptPolicy.", e); } return node; }); } } catch (Exception ex) { LOG.warn("Error compiling script.", ex); } return node; }

Target:
public OnmsNode act(final OnmsNode node) { try { final CompiledScript compiledScript = compileScript(getScript()); if (compiledScript == null) { LOG.warn("No compiled script available for execution."); } else { final SimpleBindings globals = new SimpleBindings(); globals.put("node", node); globals.put("LOG", LOG); return (OnmsNode) compiledScript.eval(globals); } } catch (Exception ex) { LOG.warn("Error applying ScriptPolicy.", ex); } return node; }
Source:
private static long getFirstStrokeTime(final SrlUpdateList updateList) { long firstStrokeTime = 0; boolean isFoundFirstStroke = false; for (int i = 0; i < updateList.getListList().size() && !isFoundFirstStroke; i++) { final Commands.SrlUpdate tmpUpdate = updateList.getListList().get(i); for (int j = 0; j < tmpUpdate.getCommandsCount() && !isFoundFirstStroke; j++) { final Commands.SrlCommand tmpCommand = tmpUpdate.getCommandsList().get(j); if (tmpCommand.getCommandType() == Commands.CommandType.ADD_STROKE) { firstStrokeTime = tmpUpdate.getTime(); isFoundFirstStroke = true; } } } return firstStrokeTime; }

Target:
private static long getFirstStrokeTime(final SrlUpdateList updateList) { for (int i = 0; i < updateList.getListList().size(); i++) { final Commands.SrlUpdate tmpUpdate = updateList.getListList().get(i); for (int j = 0; j < tmpUpdate.getCommandsCount(); j++) { final Commands.SrlCommand tmpCommand = tmpUpdate.getCommandsList().get(j); if (tmpCommand.getCommandType() == Commands.CommandType.ADD_STROKE) { return tmpUpdate.getTime(); } } } return -1; }
Source:
public void deleteTenantMetaData(String tenantUniqueIdentifier) throws TenantMgtException { TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); if (tenantManager != null) { Tenant tenant = null; try { tenant = tenantManager.getTenant(tenantUniqueIdentifier); } catch (UserStoreException e) { throw new TenantManagementServerException("Error while getting the tenant with the tenant unique id :" + tenantUniqueIdentifier + " .", e); } if (tenant != null) { int tenantId = tenant.getId(); String tenantDomain = tenant.getDomain(); try { if (log.isDebugEnabled()) { log.debug(String.format("Starting tenant deletion for domain: %s and tenant id: %d from the " + "system.", tenantDomain, tenantId)); } ServerConfigurationService serverConfigurationService = TenantMgtServiceComponent.getServerConfigurationService(); if (Boolean.parseBoolean(serverConfigurationService.getFirstProperty("Tenant.TenantDelete"))) { TenantMgtUtil.deleteTenant(tenantDomain, tenantManager, tenantId, serverConfigurationService); } else { throw new TenantManagementClientException(ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getCode(), ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getMessage()); } } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } } else { if (log.isDebugEnabled()) { String msg = "Trying to delete a non-existing tenant with tenant unique id : %s ."; log.debug(String.format(msg, tenantUniqueIdentifier)); } } } }

Target:
public void deleteTenantMetaData(String tenantUniqueIdentifier) throws TenantMgtException { ServerConfigurationService serverConfigurationService = TenantMgtServiceComponent.getServerConfigurationService(); if (!Boolean.parseBoolean(serverConfigurationService.getFirstProperty("Tenant.TenantDelete"))) { throw new TenantManagementClientException(ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getCode(), ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getMessage()); } TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); if (tenantManager != null) { Tenant tenant; try { tenant = tenantManager.getTenant(tenantUniqueIdentifier); } catch (UserStoreException e) { throw new TenantManagementServerException("Error while getting the tenant with the tenant " + "unique id :" + tenantUniqueIdentifier + " .", e); } if (tenant != null) { int tenantId = tenant.getId(); String tenantDomain = tenant.getDomain(); try { if (log.isDebugEnabled()) { log.debug(String.format("Starting tenant deletion for domain: %s and tenant id: %d from " + "the system.", tenantDomain, tenantId)); } TenantMgtUtil.deleteTenant(tenantDomain); } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } } else { if (log.isDebugEnabled()) { String msg = "Trying to delete a non-existing tenant with tenant unique id : %s ."; log.debug(String.format(msg, tenantUniqueIdentifier)); } } } }
Source:
private void scheduleReconnect() { new Thread() { @Override public void run() { try { Thread.sleep(reconnectInterval); int attempt = 0; while (!running && !destroyed) { log.info("Reconnecting attempt #{} ...", ++attempt); connect(); if (!running) { Thread.sleep(reconnectInterval); } } if (running) { log.info("Successfully reconnect at attempt #{}", attempt); registerSessionCloseListener(); } } catch (InterruptedException e) { log.info("Interrupted when trying to connect to {}:{}", host, port); } } }.start(); }

Target:
private void scheduleReconnect() { reconnectingExecutor.submit(new Runnable() { @Override public void run() { try { Thread.sleep(reconnectInterval); int attempt = 0; while (!running && !destroyed) { log.info("Reconnecting attempt #{} ...", ++attempt); connect(); if (!running) { Thread.sleep(reconnectInterval); } } if (running) { log.info("Successfully reconnect at attempt #{}", attempt); registerSessionCloseListener(); } } catch (InterruptedException e) { log.info("Interrupted when trying to connect to {}:{}", host, port); } } }); }
Source:
public ExecutionResult execute(Item item) { ProcessType processType = getProcessType(item); IComponentFilter componentFilter = new NameComponentFilter(COMPONENT_NAME); try { ModifyComponentsAction.searchAndModify(item, processType, componentFilter, Arrays.<IComponentConversion> asList(new IComponentConversion() { public void transform(NodeType node) { ElementParameterType quoteAllValues = ComponentUtilities.getNodeProperty(node, QUOTE_ALL_VALUES_PARAMETER_NAME); if (quoteAllValues == null) { ComponentUtilities.addNodeProperty(node, QUOTE_ALL_VALUES_PARAMETER_NAME, QUOTE_ALL_VALUES_PARAMETER_TYPE); ComponentUtilities.getNodeProperty(node, QUOTE_ALL_VALUES_PARAMETER_NAME).setValue("true"); } } })); } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } return ExecutionResult.SUCCESS_NO_ALERT; }

Target:
public ExecutionResult execute(Item item) { ProcessType processType = getProcessType(item); if (getProject().getLanguage() != ECodeLanguage.JAVA || processType == null) { return ExecutionResult.NOTHING_TO_DO; } IComponentFilter componentFilter = new NameComponentFilter(COMPONENT_NAME); try { ModifyComponentsAction.searchAndModify(item, processType, componentFilter, Arrays.<IComponentConversion> asList(new IComponentConversion() { public void transform(NodeType node) { ElementParameterType quoteAllValues = ComponentUtilities.getNodeProperty(node, QUOTE_ALL_VALUES_PARAMETER_NAME); if (quoteAllValues == null) { ComponentUtilities.addNodeProperty(node, QUOTE_ALL_VALUES_PARAMETER_NAME, QUOTE_ALL_VALUES_PARAMETER_TYPE); ComponentUtilities.setNodeValue(node, QUOTE_ALL_VALUES_PARAMETER_NAME, "true"); } } })); } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } return ExecutionResult.SUCCESS_NO_ALERT; }
Source:
public boolean isSupported(String feature) { return true; }

Target:
public boolean isSupported(String feature) { throwException(); return false; }
Source:
public GitHubSCMSource bindResolve(StaplerRequest staplerRequest, JSONObject json) { boolean configuredByUrl = json.getBoolean("configuredByUrl"); if(configuredByUrl) { this.setRepositoryUrl(json.get("repositoryUrl").toString()); } else { this.repositoryUrl = null; this.apiUri = json.get("apiUri").toString(); this.repoOwner = json.get("repoOwner").toString(); this.repository = json.get("repository").toString(); } return this; }

Target:
public GitHubSCMSource bindResolve(StaplerRequest staplerRequest, JSONObject json) { boolean configuredByUrl = json.getBoolean("configuredByUrl"); if (configuredByUrl) { this.setRepositoryUrl(json.get("repositoryUrl").toString()); } else { this.repositoryUrl = null; setApiUri(json.get("apiUri").toString()); setRepoOwner(json.get("repoOwner").toString()); setRepository(json.get("repository").toString()); } return this; }
Source:
public static void main(String... args) throws IOException { parseArgs(args); Directories.validate(); Core.verbose(TranslationHelper.translate("DEBUG_MODE") + Core.inDebugMode()); try { Core.verbose(TranslationHelper.translate("SETTING_LOOK_AND_FEEL") + UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable t) { t.printStackTrace(); } if (!Core.inDebugMode() && Core.hasValidation() && !Core.isValid()) { if (Core.newVersionAlert() == JOptionPane.YES_OPTION) { Core.downloadNewVersion(); return; } } Core.verbose(TranslationHelper.translate("VALIDATION_ACCOUNT_MANAGER")); AccountManager.validate(); if (username != null && password != null) { new BotUI(username, password); username = null; password = null; return; } Core.verbose(TranslationHelper.translate("STARTING_LOGIN_GUI")); new BotUI(null, null); }

Target:
public static void main(String... args) throws IOException { if (Context.getJavaVersion() >= 9){ UILog.log("Parabot", "Parabot doesn't support Java 9+ currently. Please downgrade to Java 8 to ensure Parabot is working correctly."); System.exit(0); } parseArgs(args); Directories.validate(); Core.verbose(TranslationHelper.translate("DEBUG_MODE") + Core.inDebugMode()); try { Core.verbose(TranslationHelper.translate("SETTING_LOOK_AND_FEEL") + UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable t) { t.printStackTrace(); } if (!Core.inDebugMode() && Core.hasValidation() && !Core.isValid()) { if (Core.newVersionAlert() == JOptionPane.YES_OPTION) { Core.downloadNewVersion(); return; } } Core.verbose(TranslationHelper.translate("VALIDATION_ACCOUNT_MANAGER")); AccountManager.validate(); if (username != null && password != null) { new BotUI(username, password); username = null; password = null; return; } Core.verbose(TranslationHelper.translate("STARTING_LOGIN_GUI")); new BotUI(null, null); }
Source:
public Integer perform(InvocationContext ctx) throws Throwable { long size = cache.getAdvancedCache().withEncoding(IdentityEncoder.class).keySet().stream().count(); if (size > Integer.MAX_VALUE) { return Integer.MAX_VALUE; } else { return (int) size; } }

Target:
public Integer perform(InvocationContext ctx) throws Throwable { long size = cache.keySet().stream().count(); if (size > Integer.MAX_VALUE) { return Integer.MAX_VALUE; } else { return (int) size; } }
Source:
public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); if (value != null && ((value instanceof String && !((String) value).equals("")) || valueTypeCheck(value))) { T pasredValue = value instanceof String ? parse((String) value) : (T) value; String msg = ""; String prefixMsg = getNumberTypeErrorMessage(); if (pasredValue == null) { result.setSuccess(false); msg = getNumberRangeErrorMessage(prefixMsg); validationFailedWith(result, msg); } else if (belowMinimum(pasredValue)) { msg = getNumberBellowMinimumErrorMessage(prefixMsg); validationFailedWith(result, msg); } else if (aboveMaximum(pasredValue)) { msg = getNumberAboveMaximumErrorMessage(prefixMsg); validationFailedWith(result, msg); } } else { validationFailedWith(result, getNumberTypeErrorMessage()); } return result; }

Target:
public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); T pasredValue = null; if ((value instanceof String && !StringUtils.isEmpty((String) value))) { pasredValue = parse((String) value); } else if (valueTypeCheck(value)) { pasredValue = (T) value; } else { validationFailedWith(result, getNumberTypeErrorMessage()); return result; } String message = ""; String prefixMsg = getNumberTypeErrorMessage(); if (pasredValue == null) { message = getNumberRangeErrorMessage(prefixMsg); validationFailedWith(result, message); } else if (belowMinimum(pasredValue)) { message = getNumberBellowMinimumErrorMessage(prefixMsg); validationFailedWith(result, message); } else if (aboveMaximum(pasredValue)) { message = getNumberAboveMaximumErrorMessage(prefixMsg); validationFailedWith(result, message); } return result; }
Source:
private AggregationAnalyzer(List<Expression> groupByExpressions, Scope sourceScope, Optional<Scope> orderByScope, Metadata metadata, Analysis analysis) { requireNonNull(groupByExpressions, "groupByExpressions is null"); requireNonNull(sourceScope, "sourceScope is null"); requireNonNull(orderByScope, "orderByScope is null"); requireNonNull(metadata, "metadata is null"); requireNonNull(analysis, "analysis is null"); this.sourceScope = sourceScope; this.orderByScope = orderByScope; this.metadata = metadata; this.analysis = analysis; this.expressions = groupByExpressions.stream() .map(e -> ExpressionTreeRewriter.rewriteWith(new ParameterRewriter(analysis.getParameters()), e)) .collect(toImmutableList()); this.columnReferences = NodeRefCollections.toIdentityMap(analysis.getColumnReferenceFields()); this.groupingFields = groupByExpressions.stream() .filter(columnReferences::containsKey) .map(columnReferences::get) .collect(toImmutableSet()); this.groupingFields.forEach(fieldId -> { checkState(isFieldFromScope(fieldId, sourceScope), "Grouping field %s should originate from %s", fieldId, sourceScope.getRelationType()); }); }

Target:
private AggregationAnalyzer(List<Expression> groupByExpressions, Scope sourceScope, Optional<Scope> orderByScope, Metadata metadata, Analysis analysis) { requireNonNull(groupByExpressions, "groupByExpressions is null"); requireNonNull(sourceScope, "sourceScope is null"); requireNonNull(orderByScope, "orderByScope is null"); requireNonNull(metadata, "metadata is null"); requireNonNull(analysis, "analysis is null"); this.sourceScope = sourceScope; this.orderByScope = orderByScope; this.metadata = metadata; this.analysis = analysis; this.expressions = groupByExpressions.stream() .map(e -> ExpressionTreeRewriter.rewriteWith(new ParameterRewriter(analysis.getParameters()), e)) .collect(toImmutableList()); this.columnReferences = analysis.getColumnReferenceFields(); this.groupingFields = groupByExpressions.stream() .map(NodeRef::of) .filter(columnReferences::containsKey) .map(columnReferences::get) .collect(toImmutableSet()); this.groupingFields.forEach(fieldId -> { checkState(isFieldFromScope(fieldId, sourceScope), "Grouping field %s should originate from %s", fieldId, sourceScope.getRelationType()); }); }
Source:
public ValidationResult isTemplateInUseByVmInStorageDomain(VmTemplate vmTemplate) { List<VM> vmsInExportDomain = getVmsFromExportDomain(storageDomain); List<String> problematicVmNames = new ArrayList<String>(); for (VM vm : vmsInExportDomain) { if (vmTemplate.getId().equals(vm.getVmtGuid())) { problematicVmNames.add(vm.getName()); } } if (!problematicVmNames.isEmpty()) { return new ValidationResult(VdcBllMessages.VMT_CANNOT_REMOVE_DETECTED_DERIVED_VM, String.format("$vmsList %1$s", StringUtils.join(problematicVmNames, ","))); } return ValidationResult.VALID; }

Target:
public ValidationResult isTemplateInUseByVmInStorageDomain(VmTemplate vmTemplate) { if (vmTemplate != null) { List<VM> vmsInExportDomain = getVmsFromExportDomain(storageDomain); List<String> problematicVmNames = new ArrayList<String>(); for (VM vm : vmsInExportDomain) { if (vmTemplate.getId().equals(vm.getVmtGuid())) { problematicVmNames.add(vm.getName()); } } if (!problematicVmNames.isEmpty()) { return new ValidationResult(VdcBllMessages.VMT_CANNOT_REMOVE_DETECTED_DERIVED_VM, ReplacementUtils.replaceWith("vmsList", problematicVmNames)); } } return ValidationResult.VALID; }
Source:
public boolean delete() { boolean result = true; if (folder != null) { result = recursiveDelete(folder); } return result; }

Target:
public void delete() { if (!tryDelete()) { if (assureDeletion) { fail("Unable to clean up temporary folder " + folder); } } }
Source:
public synchronized IdRange nextIdBatch( int size ) { IdRange idBatch = getReusableIdBatch( size ); if ( idBatch.totalSize() > 0 ) { return idBatch; } IdRange range = idQueue.nextIdBatch( size ); if ( range.totalSize() == 0 ) { acquireNextIdBatch(); range = idQueue.nextIdBatch( size ); } return range; }

Target:
public synchronized IdRange nextIdBatch( int size ) { IdRange idBatch = getReusableIdBatch( size ); if ( idBatch.totalSize() > 0 ) { return idBatch; } IdRange range = idQueue.nextIdBatch( size ); if ( range.totalSize() == 0 ) { acquireNextIdBatch(); range = idQueue.nextIdBatch( size ); setHighId( range.getHighId() ); } return range; }
Source:
public ValidatorHandlerImpl getValidatorHandler(IPipeLineSession session, ValidationContext context) throws ConfigurationException { ValidatorHandlerImpl validatorHandler; try { javax.xml.validation.Schema schemaObject; if (xsdVersion == 1.0) { XMLSchemaFactory schemaFactory = new XMLSchemaFactory(); schemaObject = schemaFactory.newSchema(((XercesValidationContext) context).getGrammarPool()); } else { XMLSchema11Factory schemaFactory = new XMLSchema11Factory(); schemaObject = schemaFactory.newSchema(((XercesValidationContext) context).getGrammarPool()); } validatorHandler = (ValidatorHandlerImpl) schemaObject.newValidatorHandler(); } catch (SAXException e) { throw new ConfigurationException(logPrefix + "Cannot create schema", e); } try { validatorHandler.setFeature(VALIDATION_FEATURE_ID, true); validatorHandler.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); validatorHandler.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, isFullSchemaChecking()); validatorHandler.setContentHandler(context.getContentHandler()); validatorHandler.setErrorHandler(context.getErrorHandler()); } catch (SAXNotRecognizedException e) { throw new ConfigurationException(logPrefix + "ValidatorHandler does not recognize necessary feature", e); } catch (SAXNotSupportedException e) { throw new ConfigurationException(logPrefix + "ValidatorHandler does not support necessary feature", e); } return validatorHandler; }

Target:
public ValidatorHandler getValidatorHandler(IPipeLineSession session, ValidationContext context) throws ConfigurationException { ValidatorHandler validatorHandler; try { javax.xml.validation.Schema schemaObject; if (xsdVersion == 1.0) { XMLSchemaFactory schemaFactory = new XMLSchemaFactory(); schemaObject = schemaFactory.newSchema(((XercesValidationContext) context).getGrammarPool()); } else { XMLSchema11Factory schemaFactory = new XMLSchema11Factory(); schemaObject = schemaFactory.newSchema(((XercesValidationContext) context).getGrammarPool()); } validatorHandler = schemaObject.newValidatorHandler(); } catch (SAXException e) { throw new ConfigurationException(logPrefix + "Cannot create schema", e); } try { validatorHandler.setFeature(VALIDATION_FEATURE_ID, true); validatorHandler.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); validatorHandler.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, isFullSchemaChecking()); validatorHandler.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); validatorHandler.setFeature("<LINK_0>", true); SecurityManager securityManager = new SecurityManager(); securityManager.setEntityExpansionLimit(entityExpansionLimit); validatorHandler.setProperty(SECURITY_MANAGER_PROPERTY_ID, securityManager); validatorHandler.setContentHandler(context.getContentHandler()); validatorHandler.setErrorHandler(context.getErrorHandler()); } catch (SAXNotRecognizedException e) { throw new ConfigurationException(logPrefix + "ValidatorHandler does not recognize necessary feature", e); } catch (SAXNotSupportedException e) { throw new ConfigurationException(logPrefix + "ValidatorHandler does not support necessary feature", e); } return validatorHandler; }
Source:
private WritableComparable convertToWritable(Schema.Field field, StructuredRecord input) throws UnsupportedTypeException { Object fieldVal = input.get(field.getName()); Schema fieldSchema = field.getSchema(); Schema.Type fieldType = fieldSchema.getType(); if (fieldSchema.isNullable()) { if (fieldVal == null) { return null; } fieldType = fieldSchema.getNonNullable().getType(); } switch (fieldType) { case NULL: return null; case STRING: return new Text((String) fieldVal); case ENUM: return new Text(fieldVal.toString()); case BOOLEAN: return new BooleanWritable((Boolean) fieldVal); case INT: return new IntWritable((Integer) fieldVal); case LONG: return new LongWritable((Long) fieldVal); case FLOAT: return new FloatWritable((Float) fieldVal); case DOUBLE: return new DoubleWritable((Double) fieldVal); case BYTES: if (fieldVal instanceof byte[]) { return new BytesWritable((byte[]) fieldVal); } else { return new BytesWritable(Bytes.getBytes((ByteBuffer) fieldVal)); } default: throw new UnsupportedTypeException(String.format("%s type is currently not supported in ORC", field.getSchema().getType().name())); } }

Target:
private WritableComparable convertToWritable(Schema.Field field, StructuredRecord input) throws UnsupportedTypeException { Object fieldVal = input.get(field.getName()); Schema fieldSchema = field.getSchema(); Schema.Type fieldType = fieldSchema.getType(); if (fieldSchema.isNullable()) { if (fieldVal == null) { return null; } fieldType = fieldSchema.getNonNullable().getType(); } switch (fieldType) { case NULL: return null; case STRING: return new Text((String) fieldVal); case ENUM: return new Text(fieldVal.toString()); case BOOLEAN: return new BooleanWritable((Boolean) fieldVal); case INT: return new IntWritable((Integer) fieldVal); case LONG: return new LongWritable((Long) fieldVal); case FLOAT: return new FloatWritable((Float) fieldVal); case DOUBLE: return new DoubleWritable((Double) fieldVal); case BYTES: if (fieldVal instanceof byte[]) { return new BytesWritable((byte[]) fieldVal); } else { return new BytesWritable(Bytes.getBytes((ByteBuffer) fieldVal)); } default: throw new UnsupportedTypeException(String.format("Type '%s' of field '%s' is currently not supported in ORC", fieldType.name(), field.getName())); } }
Source:
public HashMap<Pair<Integer, Version>, Boolean> getNicHotplugSupportMap() { List<Version> versions = new ArrayList<Version>(Config.<HashSet<Version>> GetValue(ConfigValues.SupportedClusterLevels)); HashMap<Pair<Integer, Version>, Boolean> hotplugSupportOsIdVersionMap = new HashMap<Pair<Integer, Version>, Boolean>(); for (Integer osId : getOsIds()) { for (Version version : versions) { hotplugSupportOsIdVersionMap.put( new Pair<Integer, Version>(osId, version), hasNicHotplugSupport(osId, version)); } } return hotplugSupportOsIdVersionMap; }

Target:
public Map<Pair<Integer, Version>, Boolean> getNicHotplugSupportMap() { List<Version> versions = new ArrayList<Version>(Config.<HashSet<Version>> GetValue(ConfigValues.SupportedClusterLevels)); Map<Pair<Integer, Version>, Boolean> hotplugSupportOsIdVersionMap = new HashMap<Pair<Integer, Version>, Boolean>(); for (Integer osId : getOsIds()) { for (Version version : versions) { hotplugSupportOsIdVersionMap.put( new Pair<Integer, Version>(osId, version), hasNicHotplugSupport(osId, version)); } } return hotplugSupportOsIdVersionMap; }
Source:
protected void positionAndShowDialog(Command onCompleted) { super.center(); onCompleted.execute(); Element e = this.getElement(); Element child = e.getFirstChildElement(); if (child != null) { int windowInnerHeight = Integer.parseInt(JsWindow.getProp("innerHeight").toString()); if (windowInnerHeight <= 10) return; int eleTop = e.getAbsoluteTop(); if (eleTop < 0) { eleTop = 0; e.getStyle().setTop(0, Unit.PX); } int eleHeight = e.getOffsetHeight(); if (eleHeight + 30 >= windowInnerHeight) { child.getStyle().setProperty("overflowY", "auto"); String overflowX = child.getStyle().getProperty("overflowX"); if (overflowX == null || overflowX.length() < 1) { child.getStyle().setProperty("overflowX", "hidden"); } child.getStyle().setPropertyPx("maxHeight", windowInnerHeight - eleTop - 30); } } }

Target:
protected void positionAndShowDialog(Command onCompleted) { super.center(); onCompleted.execute(); Element e = this.getElement(); Element child = e.getFirstChildElement(); if (child != null) { int windowInnerHeight = Browser.getWindow().getInnerHeight(); if (windowInnerHeight <= 10) return; int eleTop = e.getAbsoluteTop(); if (eleTop < 0) { eleTop = 0; e.getStyle().setTop(0, Unit.PX); } int eleHeight = e.getOffsetHeight(); if (eleHeight + 30 >= windowInnerHeight) { child.getStyle().setProperty("overflowY", "auto"); String overflowX = child.getStyle().getProperty("overflowX"); if (overflowX == null || overflowX.length() < 1) { child.getStyle().setProperty("overflowX", "hidden"); } child.getStyle().setPropertyPx("maxHeight", windowInnerHeight - eleTop - 30); } } }
Source:
private void setSearchBannerState() { if (!"".equals(adapter.getSearchQuery()) || adapter.isFilteringByCalloutResult()) { showSearchBanner(); clearSearchButton.setVisibility(View.VISIBLE); } else { searchBanner.setVisibility(View.GONE); clearSearchButton.setVisibility(View.GONE); } }

Target:
private void setSearchBannerState() { if (!"".equals(adapter.getSearchQuery())) { showSearchBanner(); clearSearchButton.setVisibility(View.GONE); } else if (adapter.isFilteringByCalloutResult()) { showSearchBanner(); clearSearchButton.setVisibility(View.VISIBLE); } else { searchBanner.setVisibility(View.GONE); clearSearchButton.setVisibility(View.GONE); } }
Source:
public SortBlob() { super(NAME, 1, 2); }

Target:
public SortBlob() { super(NAME, NB_OUTPUT_STREAMS); }
Source:
public ExtensionJobList getExtensionJobs(String extensionName, String sortOrder, String doAsUser) { Comparator<ExtensionJobsBean> compareByJobName = new Comparator<ExtensionJobsBean>() { @Override public int compare(ExtensionJobsBean o1, ExtensionJobsBean o2) { return o1.getJobName().compareToIgnoreCase(o2.getJobName()); } }; TreeMap<String, String> jobAndExtensionNames = new TreeMap<>(); List<ExtensionJobsBean> extensionJobs = null; if (extensionName != null) { extensionJobs = ExtensionStore.getMetaStore().getJobsForAnExtension(extensionName); } else { extensionJobs = ExtensionStore.getMetaStore().getAllExtensionJobs(); } sortOrder = (sortOrder == null) ? ASCENDING_SORT_ORDER : sortOrder; switch (sortOrder.toLowerCase()) { case DESCENDING_SORT_ORDER: Collections.sort(extensionJobs, Collections.reverseOrder(compareByJobName)); break; default: Collections.sort(extensionJobs, compareByJobName); } for (ExtensionJobsBean job : extensionJobs) { jobAndExtensionNames.put(job.getJobName(), job.getExtensionName()); } return new ExtensionJobList(extensionJobs.size(), jobAndExtensionNames); }

Target:
public ExtensionJobList getExtensionJobs(String extensionName, String sortOrder, String doAsUser) { TreeMap<String, String> jobAndExtensionNames = new TreeMap<>(); List<ExtensionJobsBean> extensionJobs = null; if (extensionName != null) { extensionJobs = ExtensionStore.getMetaStore().getJobsForAnExtension(extensionName); } else { extensionJobs = ExtensionStore.getMetaStore().getAllExtensionJobs(); } for (ExtensionJobsBean job : extensionJobs) { jobAndExtensionNames.put(job.getJobName(), job.getExtensionName()); } sortOrder = (sortOrder == null) ? ASCENDING_SORT_ORDER : sortOrder; switch (sortOrder.toLowerCase()) { case DESCENDING_SORT_ORDER: return new ExtensionJobList(extensionJobs.size(), jobAndExtensionNames.descendingMap()); default: return new ExtensionJobList(extensionJobs.size(), jobAndExtensionNames); } }
Source:
private int writeUnitsSection(final int currentRowNum, final HSSFWorkbook xlsBook, final HSSFSheet xlsSheet, final List<VariableDetails> units) { final CellStyle backgroundStyle = xlsBook.createCellStyle(); final HSSFFont blackFont = xlsBook.createFont(); blackFont.setFontName("calibri"); blackFont.setFontHeightInPoints((short) 11); blackFont.setColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); backgroundStyle.setFont(blackFont); int rowNumIndex = currentRowNum; int count = units.size(); for (VariableDetails variableDetail : units) { final HSSFRow row = xlsSheet.createRow(rowNumIndex++); row.setHeightInPoints(16); this.writeCell(LotExcelTemplateGenerator.CODES_SHEET_FIRST_COLUMN_INDEX, variableDetail.getName(), count, xlsBook,row); this.writeCell(LotExcelTemplateGenerator.CODES_SHEET_SECOND_COLUMN_INDEX, variableDetail.getDescription(), count, xlsBook,row); count--; } return rowNumIndex; }

Target:
private int writeUnitsSection(final int currentRowNum, final HSSFWorkbook xlsBook, final HSSFSheet xlsSheet, final List<VariableDetails> units) { final CellStyle backgroundStyle = xlsBook.createCellStyle(); final HSSFFont blackFont = xlsBook.createFont(); blackFont.setFontName("calibri"); blackFont.setFontHeightInPoints((short) 11); blackFont.setColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); backgroundStyle.setFont(blackFont); int rowNumIndex = currentRowNum; int count = units.size(); for (final VariableDetails variableDetail : units) { final HSSFRow row = xlsSheet.createRow(rowNumIndex++); row.setHeightInPoints(16); this.writeCell(LotExcelTemplateGenerator.CODES_SHEET_FIRST_COLUMN_INDEX, variableDetail.getName(), count, xlsBook,row); this.writeCell(LotExcelTemplateGenerator.CODES_SHEET_SECOND_COLUMN_INDEX, variableDetail.getDescription(), count, xlsBook,row); count--; } return rowNumIndex; }
Source:
public void testSerializeDeserialize() throws IOException { ObjectMapper objectMapper = new ObjectMapper(); final OrderType type = OrderType.ASK; final BigDecimal originalAmount = new BigDecimal("100.501"); final CurrencyPair currencyPair = CurrencyPair.BTC_USD; final BigDecimal price = new BigDecimal("250.34"); final Date timestamp = new Date(); final String id = "id"; final String orderId = "OrderId"; final BigDecimal feeAmount = new BigDecimal("0"); final Currency feeCurrency = Currency.BTC; final UserTrade original = new UserTrade( type, originalAmount, currencyPair, price, timestamp, id, orderId, feeAmount, feeCurrency); String json = objectMapper.writeValueAsString(original); assertThat(json).contains("\"currencyPair\":\"BTC/USD\""); UserTrade jsonCopy = objectMapper.readValue(json, UserTrade.class); assertThat(jsonCopy).isEqualToComparingFieldByField(original); }

Target:
public void testSerializeDeserialize() throws IOException { final OrderType type = OrderType.ASK; final BigDecimal originalAmount = new BigDecimal("100.501"); final CurrencyPair currencyPair = CurrencyPair.BTC_USD; final BigDecimal price = new BigDecimal("250.34"); final Date timestamp = new Date(); final String id = "id"; final String orderId = "OrderId"; final BigDecimal feeAmount = new BigDecimal("0"); final Currency feeCurrency = Currency.BTC; final UserTrade original = new UserTrade( type, originalAmount, currencyPair, price, timestamp, id, orderId, feeAmount, feeCurrency); String json = ObjectMapperHelper.toCompactJSON(original); assertThat(json).contains("\"currencyPair\":\"BTC/USD\""); UserTrade jsonCopy = ObjectMapperHelper.readValueStrict(json, UserTrade.class); assertThat(jsonCopy).isEqualToComparingFieldByField(original); }
Source:
public void sendSignInLinkToEmail(@NonNull final String email, @NonNull final ActionCodeSettings actionCodeSettings, @Nullable final IdpResponse idpResponseForLinking, final boolean forceSameDevice) { if (getAuth() == null) { return; } setResult(Resource.<String>forLoading()); final String anonymousUserId = AuthOperationManager.getInstance().canUpgradeAnonymous (getAuth(), getArguments()) ? getAuth().getCurrentUser().getUid() : null; final String sessionId = Utils.generateRandomAlphaNumericString(SESSION_ID_LENGTH); ActionCodeSettings mutatedSettings = addSessionInfoToActionCodeSettings(actionCodeSettings, sessionId, anonymousUserId, idpResponseForLinking, forceSameDevice); getAuth().sendSignInLinkToEmail(email, mutatedSettings) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { EmailLinkPersistenceManager.getInstance().saveEmail(getApplication(), email, sessionId, anonymousUserId); setResult(Resource.forSuccess(email)); } else { setResult(Resource.<String>forFailure(task.getException())); } } }); }

Target:
public void sendSignInLinkToEmail(@NonNull final String email, @NonNull final ActionCodeSettings actionCodeSettings, @Nullable final IdpResponse idpResponseForLinking, final boolean forceSameDevice) { if (getAuth() == null) { return; } setResult(Resource.<String>forLoading()); final String anonymousUserId = AuthOperationManager.getInstance().canUpgradeAnonymous(getAuth(), getArguments()) ? getAuth().getCurrentUser().getUid() : null; final String sessionId = SessionUtils.generateRandomAlphaNumericString(SESSION_ID_LENGTH); ActionCodeSettings mutatedSettings = addSessionInfoToActionCodeSettings(actionCodeSettings, sessionId, anonymousUserId, idpResponseForLinking, forceSameDevice); getAuth().sendSignInLinkToEmail(email, mutatedSettings) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { EmailLinkPersistenceManager.getInstance().saveEmail(getApplication(), email, sessionId, anonymousUserId); setResult(Resource.forSuccess(email)); } else { setResult(Resource.<String>forFailure(task.getException())); } } }); }
Source:
public void open(String uId) throws IOException { successfulWrites = new ArrayList<>(); rejectedWrites = new ArrayList<>(); connection = sink.connect(container); try { if (usePreparedStatement) { statement = connection.prepareStatement(rowProperties.query.getValue()); } else { statement = connection.createStatement(); } } catch (SQLException e) { throw new IOException(e); } result = new Result(); }

Target:
public void open(String uId) throws IOException { successfulWrites = new ArrayList<>(); rejectedWrites = new ArrayList<>(); connection = sink.createConnection(container); mainSchema = sink.getRuntimeSchema(container); try { if (rowProperties.usePreparedStatement()) { statement = connection.prepareStatement(sink.getQuery()); } else { statement = connection.createStatement(); } } catch (SQLException e) { throw new IOException(e); } result = new Result(); }
Source:
public void doLaunch(Context context, View v) { Intent intent = new Intent(settingPojo.settingName); if (!settingPojo.packageName.isEmpty()) { intent.setClassName(settingPojo.packageName, settingPojo.settingName); } intent.setSourceBounds(v.getClipBounds()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }

Target:
public void doLaunch(Context context, View v) { Intent intent = new Intent(settingPojo.settingName); if (!settingPojo.packageName.isEmpty()) { intent.setClassName(settingPojo.packageName, settingPojo.settingName); } if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { intent.setSourceBounds(v.getClipBounds()); } intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
Source:
public void tagged() throws IOException { Assert.assertEquals(null, this.client.getJobs().tagged(JobsTest.DEFAULT_NAME)); final Map<String, Object> opts1 = new HashMap<>(); opts1.put(LuaConfigParameter.TAGS.toString(), Arrays.asList(JobsTest.DEFAULT_NAME)); final String jid1 = this.queue.put(JobsTest.DEFAULT_NAME, null, opts1); final Map<String, Object> opts2 = new HashMap<>(); opts2.put(LuaConfigParameter.TAGS.toString(), Arrays.asList(JobsTest.DEFAULT_NAME)); final String jid2 = this.queue.put(JobsTest.DEFAULT_NAME, null, opts2); Assert.assertNotNull(this.client.getJobs().get(jid1)); Assert.assertNotNull(this.client.getJobs().get(jid2)); Assert.assertEquals(2, this.client.getJobs().tagged(JobsTest.DEFAULT_NAME).size()); Assert.assertTrue(this.client.getJobs().tagged(JobsTest.DEFAULT_NAME).contains(jid1)); Assert.assertTrue(this.client.getJobs().tagged(JobsTest.DEFAULT_NAME).contains(jid2)); }

Target:
public void tagged() throws IOException { Assert.assertNull(this.client.getJobs().tagged(JobsTest.DEFAULT_NAME)); final Map<String, Object> opts1 = new HashMap<>(); opts1.put(LuaConfigParameter.TAGS.toString(), Arrays.asList(JobsTest.DEFAULT_NAME)); final String jid1 = this.queue.put(JobsTest.DEFAULT_NAME, null, opts1); final Map<String, Object> opts2 = new HashMap<>(); opts2.put(LuaConfigParameter.TAGS.toString(), Arrays.asList(JobsTest.DEFAULT_NAME)); final String jid2 = this.queue.put(JobsTest.DEFAULT_NAME, null, opts2); Assert.assertNotNull(this.client.getJobs().get(jid1)); Assert.assertNotNull(this.client.getJobs().get(jid2)); Assert.assertEquals(2, this.client.getJobs().tagged(JobsTest.DEFAULT_NAME).size()); Assert.assertTrue(this.client.getJobs().tagged(JobsTest.DEFAULT_NAME).contains(jid1)); Assert.assertTrue(this.client.getJobs().tagged(JobsTest.DEFAULT_NAME).contains(jid2)); }
Source:
private void initHttpClient() { try { URL hostUrl = getUrl(); if (isSecured()) { int hostPort = hostUrl.getPort() == -1 ? HttpsURL.DEFAULT_PORT : hostUrl.getPort(); Protocol httpsProtocol = new Protocol(String.valueOf(HttpsURL.DEFAULT_SCHEME), (ProtocolSocketFactory) new AuthSSLProtocolSocketFactory(ExternalTrustStoreInitializer.getTrustStore(), Config.<String> getValue(ConfigValues.VdsmSLLProtocol)), hostPort); httpClient.getHostConfiguration().setHost(hostUrl.getHost(), hostPort, httpsProtocol); } else { int hostPort = hostUrl.getPort() == -1 ? HttpURL.DEFAULT_PORT : hostUrl.getPort(); httpClient.getHostConfiguration().setHost(hostUrl.getHost(), hostPort); } objectMapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); if (hostProvider.getUsername() != null && hostProvider.getPassword() != null) { Credentials hostProviderCredentials = new UsernamePasswordCredentials(hostProvider.getUsername(), hostProvider.getPassword()); httpClient.getState().setCredentials(AuthScope.ANY, hostProviderCredentials); httpClient.getParams().setAuthenticationPreemptive(true); } } catch (RuntimeException e) { handleException(e); } }

Target:
private void initHttpClient() { try { URL hostUrl = getUrl(); if (isSecured()) { int hostPort = hostUrl.getPort() == -1 ? HttpsURL.DEFAULT_PORT : hostUrl.getPort(); Protocol httpsProtocol = new Protocol(String.valueOf(HttpsURL.DEFAULT_SCHEME), (ProtocolSocketFactory) new AuthSSLProtocolSocketFactory(ExternalTrustStoreInitializer.getTrustStore(), Config.<String> getValue(ConfigValues.VdsmSSLProtocol)), hostPort); httpClient.getHostConfiguration().setHost(hostUrl.getHost(), hostPort, httpsProtocol); } else { int hostPort = hostUrl.getPort() == -1 ? HttpURL.DEFAULT_PORT : hostUrl.getPort(); httpClient.getHostConfiguration().setHost(hostUrl.getHost(), hostPort); } objectMapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); if (hostProvider.getUsername() != null && hostProvider.getPassword() != null) { Credentials hostProviderCredentials = new UsernamePasswordCredentials(hostProvider.getUsername(), hostProvider.getPassword()); httpClient.getState().setCredentials(AuthScope.ANY, hostProviderCredentials); httpClient.getParams().setAuthenticationPreemptive(true); } } catch (RuntimeException e) { handleException(e); } }
Source:
public MatchResult detailMatches(PlanNode node, StatsProvider stats, Session session, Metadata metadata, SymbolAliases symbolAliases) { checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName()); TopNNode topNNode = (TopNNode) node; if (topNNode.getCount() != count) { return NO_MATCH; } for (Ordering ordering : orderBy) { Symbol symbol = Symbol.from(symbolAliases.get(ordering.getField())); OrderingScheme nodeOrderingScheme = topNNode.getOrderingScheme(); if (!ordering.getSortOrder().equals(nodeOrderingScheme.getOrderings().get(symbol))) { return NO_MATCH; } } return match(); }

Target:
public MatchResult detailMatches(PlanNode node, StatsProvider stats, Session session, Metadata metadata, SymbolAliases symbolAliases) { checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName()); TopNNode topNNode = (TopNNode) node; if (topNNode.getCount() != count) { return NO_MATCH; } for (int i = 0; i < orderBy.size(); ++i) { Ordering ordering = orderBy.get(i); Symbol symbol = Symbol.from(symbolAliases.get(ordering.getField())); OrderingScheme orderingScheme = topNNode.getOrderingScheme(); if (!symbol.equals(orderingScheme.getOrderBy().get(i))) { return NO_MATCH; } if (!ordering.getSortOrder().equals(orderingScheme.getOrdering(symbol))) { return NO_MATCH; } } return match(); }
Source:
public VoltDBLLimit( RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RexNode offset, RexNode limit) { super(cluster, traitSet, input); assert VoltDBLRel.VOLTDB_LOGICAL.equals(getConvention()); m_offset = offset; m_limit = limit; }

Target:
public VoltDBLLimit( RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RexNode offset, RexNode limit) { super(cluster, traitSet, input); assert traitSet.contains(VoltDBLRel.VOLTDB_LOGICAL); m_offset = offset; m_limit = limit; }
Source:
public ExtensionSpider getExtensionSpider() { return this.extension; }

Target:
protected ExtensionSpider getExtensionSpider() { return this.extension; }
Source:
public void actionPerformed(@Nonnull GuiButton guiButton) throws IOException { super.actionPerformed(guiButton); if (guiButton.id == ID_META + buttonIdOffset) { filter.setMatchMeta(useMetaB.isSelected()); sendFilterChange(); } else if (guiButton.id == ID_NBT + buttonIdOffset) { filter.setMatchNBT(useNbtB.isSelected()); sendFilterChange(); } else if (guiButton.id == ID_STICKY + buttonIdOffset) { filter.setSticky(stickyB.isSelected()); sendFilterChange(); } else if (guiButton.id == ID_ORE_DICT + buttonIdOffset) { filter.setUseOreDict(useOreDictB.isSelected()); sendFilterChange(); } else if (guiButton.id == ID_DAMAGE + buttonIdOffset) { filter.setDamageMode(damageB.getMode().getMode()); sendFilterChange(); } else if (guiButton.id == ID_WHITELIST + buttonIdOffset) { filter.setBlacklist(!filter.isBlacklist()); sendFilterChange(); } }

Target:
public void actionPerformed(@Nonnull GuiButton guiButton) throws IOException { super.actionPerformed(guiButton); if (guiButton.id == ID_META) { filter.setMatchMeta(useMetaB.isSelected()); sendFilterChange(); } else if (guiButton.id == ID_NBT) { filter.setMatchNBT(useNbtB.isSelected()); sendFilterChange(); } else if (guiButton.id == ID_STICKY) { filter.setSticky(stickyB.isSelected()); sendFilterChange(); } else if (guiButton.id == ID_ORE_DICT) { filter.setUseOreDict(useOreDictB.isSelected()); sendFilterChange(); } else if (guiButton.id == ID_DAMAGE) { filter.setDamageMode(damageB.getMode().getMode()); sendFilterChange(); } else if (guiButton.id == ID_WHITELIST) { filter.setBlacklist(!filter.isBlacklist()); sendFilterChange(); } }
Source:
MetaLocationCache(MasterServices master) { int syncIntervalSeconds = master.getConfiguration().getInt(SYNC_INTERVAL_SECONDS, DEFAULT_SYNC_INTERVAL_SECONDS); int fetchTimeoutMs = master.getConfiguration().getInt(FETCH_TIMEOUT_MS, DEFAULT_FETCH_TIMEOUT_MS); master.getChoreService().scheduleChore(new ScheduledChore( getClass().getSimpleName() + "-Sync-Chore", this, syncIntervalSeconds, 0, TimeUnit.SECONDS) { @Override protected void chore() { AsyncClusterConnection conn = master.getAsyncClusterConnection(); if (conn != null) { addListener(conn.getAllMetaRegionLocations(fetchTimeoutMs), (locs, error) -> { if (error != null) { LOG.warn("Failed to fetch all meta region locations from active master", error); return; } CacheHolder ch = new CacheHolder(locs); holder = ch; }); } } }); }

Target:
MetaLocationCache(MasterServices master) { int syncIntervalSeconds = master.getConfiguration().getInt(SYNC_INTERVAL_SECONDS, DEFAULT_SYNC_INTERVAL_SECONDS); int fetchTimeoutMs = master.getConfiguration().getInt(FETCH_TIMEOUT_MS, DEFAULT_FETCH_TIMEOUT_MS); master.getChoreService().scheduleChore(new ScheduledChore( getClass().getSimpleName() + "-Sync-Chore", this, syncIntervalSeconds, 0, TimeUnit.SECONDS) { @Override protected void chore() { AsyncClusterConnection conn = master.getAsyncClusterConnection(); if (conn != null) { addListener(conn.getAllMetaRegionLocations(fetchTimeoutMs), (locs, error) -> { if (error != null) { LOG.warn("Failed to fetch all meta region locations from active master", error); return; } holder = new CacheHolder(locs); }); } } }); }
Source:
public Future<SocketIOTransport> websocket(final AsyncHttpRequest req, String protocol, final WebSocketConnectCallback callback) { WebSocketImpl.addWebSocketUpgradeHeaders(req, protocol); final SimpleFuture<SocketIOTransport> ret = new SimpleFuture<SocketIOTransport>(); Cancellable connect = execute(req, new HttpConnectCallback() { @Override public void onConnectCompleted(Exception ex, AsyncHttpResponse response) { if (ex != null) { if (ret.setComplete(ex)) { if (callback != null) callback.onCompleted(ex, null); } return; } WebSocket ws = WebSocketImpl.finishHandshake(req.getHeaders().getHeaders(), response); if (ws == null) { if (!ret.setComplete(new WebSocketHandshakeException("Unable to complete websocket handshake"))) return; } else { if (!ret.setComplete(new WebSocketTransport(ws))) return; } if (callback != null) callback.onCompleted(ex, ws); } }); ret.setParent(connect); return ret; }

Target:
public Future<WebSocket> websocket(final AsyncHttpRequest req, String protocol, final WebSocketConnectCallback callback) { WebSocketImpl.addWebSocketUpgradeHeaders(req, protocol); final SimpleFuture<WebSocket> ret = new SimpleFuture<WebSocket>(); Cancellable connect = execute(req, new HttpConnectCallback() { @Override public void onConnectCompleted(Exception ex, AsyncHttpResponse response) { if (ex != null) { if (ret.setComplete(ex)) { if (callback != null) callback.onCompleted(ex, null); } return; } WebSocket ws = WebSocketImpl.finishHandshake(req.getHeaders().getHeaders(), response); if (ws == null) { if (!ret.setComplete(new WebSocketHandshakeException("Unable to complete websocket handshake"))) return; } else { if (!ret.setComplete(ws)) return; } if (callback != null) callback.onCompleted(ex, ws); } }); ret.setParent(connect); return ret; }
Source:
public void scheduleEmailCheckJob(Integer interval) { MotechEvent event = new MotechEvent(EbodacConstants.EMAIL_CHECK_EVENT); Period period = Period.minutes(interval); DateTime startDate = DateTime.now(); RepeatingPeriodSchedulableJob job = new RepeatingPeriodSchedulableJob(event, startDate.toDate(), null, period, true); motechSchedulerService.safeScheduleRepeatingPeriodJob(job); }

Target:
public void scheduleEmailCheckJob(Integer interval) { MotechEvent event = new MotechEvent(EbodacConstants.EMAIL_CHECK_EVENT); Period period = Period.minutes(interval); DateTime startDate = DateTime.now().plusMinutes(1); RepeatingPeriodSchedulableJob job = new RepeatingPeriodSchedulableJob(event, startDate.toDate(), null, period, true); motechSchedulerService.safeScheduleRepeatingPeriodJob(job); }