auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int getSelectedQuestionNumber(int qnNumber) { if (isQuestionEnabled(qnNumber)) { Select qnNumSelect = new Select(getSelectQuestionNumberDropdown(qnNumber)); return Integer.parseInt(qnNumSelect.getFirstSelectedOption().getText().trim()); } return Integer.parseInt(getSelectQuestionNumberStatic(qnNumber).getText().substring(0, 1)); }

Target:
public int getSelectedQuestionNumber(int qnNumber) { if (isQuestionEnabled(qnNumber)) { Select qnNumSelect = new Select(getSelectQuestionNumberDropdown(qnNumber)); return Integer.parseInt(qnNumSelect.getFirstSelectedOption().getText().trim()); } String questionNumber = getSelectQuestionNumberStatic(qnNumber).getText(); return Integer.parseInt(questionNumber.substring(0, questionNumber.length() - 1)); }
Source:
private void updateSelectionText(IStructuredSelection sel, boolean uncheck) { Object[] obj = fCbtv.getCheckedElements(); obj.getClass(); if (fCbtv.getCheckedElements().length == 0) { t.setText(Messages.NoSelectionDescription); } else if (fCbtv.getCheckedElements().length != 1 && fCbtv.getCheckedElements().length != 0) { t.setText(Messages.TraceControl_MultipleSelectionDescription); } else { TreeParent checkedElement; boolean commentFound = false; if (uncheck) { checkedElement = (TreeParent) obj[0]; } else { checkedElement = (TreeParent) sel.getFirstElement(); } TreeParent currentParent = checkedElement.getParent(); String parentPath = currentParent.getName(); if (fCbtv.getChecked(checkedElement)) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder builder = factory.newDocumentBuilder(); factory.setIgnoringComments(false); String fullPath = parentPath + checkedElement.getName(); Document document = builder.parse(new File(fullPath)); document.getDocumentElement().normalize(); NodeList nl = document.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { if (nl.item(i).getNodeType() == Node.COMMENT_NODE) { commentFound = true; Comment comment = (Comment) nl.item(i); t.setText(comment.getData()); } } if (!commentFound) { t.setText(Messages.TraceControl_SingleSelectionDescription); } } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } }

Target:
private void updateSelectionText(IStructuredSelection sel, boolean uncheck) { Object[] obj = fCbtv.getCheckedElements(); obj.getClass(); if (fCbtv.getCheckedElements().length == 0) { descriptionText.setText(Messages.NoSelectionDescription); } else if (fCbtv.getCheckedElements().length != 1 && fCbtv.getCheckedElements().length != 0) { descriptionText.setText(Messages.TraceControl_MultipleSelectionDescription); } else { TreeParent checkedElement; boolean commentFound = false; if (uncheck) { checkedElement = (TreeParent) obj[0]; } else { checkedElement = (TreeParent) sel.getFirstElement(); } TreeParent currentParent = checkedElement.getParent(); String parentPath = currentParent.getName(); if (fCbtv.getChecked(checkedElement)) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder builder = factory.newDocumentBuilder(); factory.setIgnoringComments(false); String fullPath = parentPath + checkedElement.getName(); Document document = builder.parse(new File(fullPath)); document.getDocumentElement().normalize(); NodeList nl = document.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { if (nl.item(i).getNodeType() == Node.COMMENT_NODE) { commentFound = true; Comment comment = (Comment) nl.item(i); descriptionText.setText(comment.getData()); } } if (!commentFound) { descriptionText.setText(Messages.TraceControl_SingleSelectionDescription); } } catch (ParserConfigurationException e) { } catch (SAXException e) { } catch (IOException e) { } } } }
Source:
ValueExpression(Object value) { this.value = value; }

Target:
ValueExpression(Object value) { if (!isSupportedType(value)) throw new IllegalArgumentException("The given value's type is not supported."); this.value = value; }
Source:
public void pushSaveEvent(User user, Contentlet contentlet, boolean isNew){ SystemEventType systemEventType = getSystemEventType(contentlet, isNew); if (systemEventType != null) { Payload payload = new Payload(contentlet, Visibility.PERMISSION, String.valueOf(PermissionAPI.PERMISSION_READ), user.getUserId()); try { systemEventsAPI.push(new SystemEvent(systemEventType, payload)); } catch (DotDataException e) { throw new BaseRuntimeInternationalizationException(e); } } }

Target:
public void pushSaveEvent(User user, Contentlet contentlet, boolean isNew){ SystemEventType systemEventType = getSystemEventType(contentlet, isNew); if (systemEventType != null) { Payload payload = new Payload(contentlet, Visibility.PERMISSION, String.valueOf(PermissionAPI.PERMISSION_READ)); try { systemEventsAPI.push(new SystemEvent(systemEventType, payload)); } catch (DotDataException e) { throw new CanNotPushSystemEventException(e); } } }
Source:
private static String getTempRepo(){ String tempDir = System.getProperty("java.io.tmpdir"); StringBuffer sb = new StringBuffer(); sb.append(tempDir).append(tempDir.endsWith("/") ? "" : "/").append("maven/repository/"); return sb.toString(); }

Target:
private static String getTempRepo(){ String tempDir = System.getProperty("java.io.tmpdir"); StringBuffer sb = new StringBuffer(); sb.append(tempDir).append(tempDir.endsWith(CommonConstants.SEPARATOR) ? "" : CommonConstants.SEPARATOR).append("maven/repository/"); return sb.toString(); }
Source:
private boolean noContentInTooltip() { String title = getTitle(); return (title == null && options.getWidget() == null && options.getWidgetContentProvider() == null) || (title != null && title.length() == 0); }

Target:
private boolean noContentInTooltip() { String title = getTitle(); return (title == null && widget == null) || (title != null && title.length() == 0); }
Source:
public List<QueryError> update(Iterable<MonitorQuery> queries) throws IOException { if (commitTimeout == 0) { return monitor.update(queries); } else { List<QueryError> errors = new ArrayList<>(); for (MonitorQuery query : queries) { try { for (QueryCacheEntry queryCacheEntry : monitor.decomposeQuery(query)) { pendingDeletes.remove(query.getId()); Indexable update = new Indexable(query.getId(), queryCacheEntry, monitor.buildIndexableQuery(query.getId(), query, queryCacheEntry)); pendingUpdates.put(update.id, update); } } catch (Exception e) { errors.add(new QueryError(query.getId(), query.getQuery(), e.getMessage())); } } scheduleCommit(); return errors; } }

Target:
public void update(Iterable<MonitorQuery> queries) throws IOException, UpdateException { if (commitTimeout == 0) { monitor.update(queries); } else { List<QueryError> errors = new ArrayList<>(); for (MonitorQuery query : queries) { try { for (QueryCacheEntry queryCacheEntry : monitor.decomposeQuery(query)) { pendingDeletes.remove(query.getId()); Indexable update = new Indexable(query.getId(), queryCacheEntry, monitor.buildIndexableQuery(query.getId(), query, queryCacheEntry)); pendingUpdates.put(update.id, update); } } catch (Exception e) { errors.add(new QueryError(query, e)); } } scheduleCommit(); if (errors.isEmpty() == false) throw new UpdateException(errors); } }
Source:
private List<Condition> convertCoreConditionsToEmrapiConditions(List<org.openmrs.Condition> coreConditions) { List<Condition> conditions = new ArrayList<Condition>(); for (org.openmrs.Condition coreCondition : coreConditions) { Condition condition = new Condition(); Concept concept = Context.getConceptService().getConceptByUuid(coreCondition.getCondition().getCoded().getUuid()); condition.setId(coreCondition.getId()); condition.setUuid(coreCondition.getUuid()); condition.setAdditionalDetail(coreCondition.getAdditionalDetail()); condition.setConcept(concept); condition.setPatient(coreCondition.getPatient()); if(coreCondition.getCondition().getNonCoded() != null) condition.setConditionNonCoded(coreCondition.getCondition().getNonCoded()); if(coreCondition.getOnsetDate() != null) condition.setOnsetDate(coreCondition.getOnsetDate()); condition.setVoided(coreCondition.getVoided()); condition.setVoidReason(coreCondition.getVoidReason()); condition.setEndDate(coreCondition.getEndDate()); condition.setCreator(coreCondition.getCreator()); condition.setDateCreated(coreCondition.getDateCreated()); condition.setStatus(convertClinicalStatus(coreCondition.getClinicalStatus())); if (coreCondition.getPreviousVersion() != null) { condition.setPreviousCondition(convertCoreConditionToEmrapiCondition(coreCondition.getPreviousVersion())); } conditions.add(condition); } return conditions; }

Target:
private List<Condition> convertCoreConditionsToEmrapiConditions(List<org.openmrs.Condition> coreConditions) { List<Condition> conditions = new ArrayList<Condition>(); for (org.openmrs.Condition coreCondition : coreConditions) { Condition condition = new Condition(); Concept concept; if (coreCondition.getCondition().getCoded() != null) { concept = Context.getConceptService() .getConceptByUuid(coreCondition.getCondition().getCoded().getUuid()); } else { concept = new Concept(); concept.setFullySpecifiedName(new ConceptName(coreCondition.getCondition().getNonCoded(), Context.getLocale())); } condition.setId(coreCondition.getId()); condition.setUuid(coreCondition.getUuid()); condition.setAdditionalDetail(coreCondition.getAdditionalDetail()); condition.setConcept(concept); condition.setPatient(coreCondition.getPatient()); if (coreCondition.getCondition().getNonCoded() != null) { condition.setConditionNonCoded(coreCondition.getCondition().getNonCoded()); } if (coreCondition.getOnsetDate() != null) { condition.setOnsetDate(coreCondition.getOnsetDate()); } condition.setVoided(coreCondition.getVoided()); condition.setVoidReason(coreCondition.getVoidReason()); condition.setEndDate(coreCondition.getEndDate()); condition.setCreator(coreCondition.getCreator()); condition.setDateCreated(coreCondition.getDateCreated()); condition.setStatus(convertClinicalStatus(coreCondition.getClinicalStatus())); if (coreCondition.getPreviousVersion() != null) { condition.setPreviousCondition(convertCoreConditionToEmrapiCondition(coreCondition.getPreviousVersion())); } conditions.add(condition); } return conditions; }
Source:
public void testFailureOnServerErrors() throws Exception { doPut(); List<ServerErrorCode> serverErrors = new ArrayList<>(Arrays.asList(ServerErrorCode.values())); serverErrors.remove(ServerErrorCode.Blob_Deleted); serverErrors.remove(ServerErrorCode.Blob_Expired); serverErrors.remove(ServerErrorCode.No_Error); serverErrors.remove(ServerErrorCode.Blob_Authorization_Failure); serverErrors.remove(ServerErrorCode.Blob_Not_Found); for (ServerErrorCode serverErrorCode : serverErrors) { mockServerLayout.getMockServers().forEach(server -> server.setServerErrorForAllRequests(serverErrorCode)); GetBlobOperation op = createOperationAndComplete(null); assertFailureAndCheckErrorCode(op, serverErrorCode == ServerErrorCode.Disk_Unavailable ? RouterErrorCode.AmbryUnavailable : RouterErrorCode.UnexpectedInternalError); } }

Target:
public void testFailureOnServerErrors() throws Exception { doPut(); EnumSet<ServerErrorCode> serverErrors = EnumSet.complementOf( EnumSet.of(ServerErrorCode.Blob_Deleted, ServerErrorCode.Blob_Expired, ServerErrorCode.No_Error, ServerErrorCode.Blob_Authorization_Failure, ServerErrorCode.Blob_Not_Found)); for (ServerErrorCode serverErrorCode : serverErrors) { mockServerLayout.getMockServers().forEach(server -> server.setServerErrorForAllRequests(serverErrorCode)); GetBlobOperation op = createOperationAndComplete(null); assertFailureAndCheckErrorCode(op, serverErrorCode == ServerErrorCode.Disk_Unavailable ? RouterErrorCode.AmbryUnavailable : RouterErrorCode.UnexpectedInternalError); } }
Source:
public void map(BatchSource<InputRow> source, BatchSink<Collection<Object[]>> sink) { List<InputColumn<?>> cols = getUsedInputColumns(); int size = source.size(); Object[] rows = new Object[size]; for(int i = 0; i < size; i++) { InputRow inputRow = source.getInput(i); Object[] values = new Object[cols.size()]; int j = 0; for(InputColumn<?> col: cols) { values[j] = inputRow.getValue(col); j++; } rows[i] = values; } ProcessStatelessInput input = new ProcessStatelessInput(); input.configuration = getConfiguration(cols); input.data = mapper.valueToTree(rows); logger.debug("Processing remotely rows", size); if (client == null) { if (lastException != null) { throw lastException; } throw new RuntimeException("Remote transformer's connection has already been closed. "); } ProcessStatelessOutput out; try { out = client.processStateless(componentDisplayName, input); } catch (RuntimeException e) { lastException = e; throw e; } convertOutputRows(out.rows, sink, size); }

Target:
public void map(BatchSource<InputRow> source, BatchSink<Collection<Object[]>> sink) { List<InputColumn<?>> cols = getUsedInputColumns(); int size = source.size(); Object[] rows = new Object[size]; for(int i = 0; i < size; i++) { InputRow inputRow = source.getInput(i); Object[] values = new Object[cols.size()]; int j = 0; for(InputColumn<?> col: cols) { values[j] = inputRow.getValue(col); j++; } rows[i] = values; } ProcessStatelessInput input = new ProcessStatelessInput(); input.configuration = getConfiguration(cols); input.data = mapper.valueToTree(rows); logger.debug("Processing remotely rows", size); if (client == null) { if (failed.get()) { throw new PreviousErrorsExistException(); } throw new RuntimeException("Remote transformer's connection has already been closed. "); } ProcessStatelessOutput out; try { out = client.processStateless(componentDisplayName, input); } catch (RuntimeException e) { boolean alreadyFailed = failed.getAndSet(true); if (!alreadyFailed) { throw e; } else { throw new PreviousErrorsExistException(); } } convertOutputRows(out.rows, sink, size); }
Source:
public Owner updateOwner(@PathParam("owner_key") @Verify(Owner.class) String key, Owner owner) { Owner toUpdate = findOwner(key); EventBuilder eventBuilder = eventFactory.getEventBuilder(Target.OWNER, Type.MODIFIED) .setOldEntity(toUpdate); log.debug("Updating owner: " + key); if (owner.getDisplayName() != null) { toUpdate.setDisplayName(owner.getDisplayName()); } if (owner.getParentOwner() != null) { toUpdate.setParentOwner(owner.getParentOwner()); } if (owner.getDefaultServiceLevel() != null) { if (owner.getDefaultServiceLevel().equals("")) { toUpdate.setDefaultServiceLevel(null); } else { serviceLevelValidator.validate(toUpdate, owner.getDefaultServiceLevel()); toUpdate.setDefaultServiceLevel(owner.getDefaultServiceLevel()); } } if (owner.getContentAccessMode() != null) { StringTokenizer st = new StringTokenizer(toUpdate.getContentAccessModeList(), ","); boolean allowed = false; while (st.hasMoreElements()) { if (st.nextElement().equals(owner.getContentAccessMode()) || "".equals(owner.getContentAccessMode())) { allowed = true; break; } } if (allowed) { String before = toUpdate.getContentAccessMode(); String after = owner.getContentAccessMode(); toUpdate.setContentAccessMode(owner.getContentAccessMode()); } else { throw new BadRequestException( i18n.tr("The content access mode is not allowed for this owner.")); } } ownerCurator.merge(toUpdate); Event e = eventBuilder.setNewEntity(toUpdate).buildEvent(); sink.queueEvent(e); return toUpdate; }

Target:
public Owner updateOwner(@PathParam("owner_key") @Verify(Owner.class) String key, Owner owner) { Owner toUpdate = findOwner(key); EventBuilder eventBuilder = eventFactory.getEventBuilder(Target.OWNER, Type.MODIFIED) .setOldEntity(toUpdate); log.debug("Updating owner: " + key); if (owner.getDisplayName() != null) { toUpdate.setDisplayName(owner.getDisplayName()); } if (owner.getParentOwner() != null) { toUpdate.setParentOwner(owner.getParentOwner()); } if (owner.getDefaultServiceLevel() != null) { if (owner.getDefaultServiceLevel().equals("")) { toUpdate.setDefaultServiceLevel(null); } else { serviceLevelValidator.validate(toUpdate, owner.getDefaultServiceLevel()); toUpdate.setDefaultServiceLevel(owner.getDefaultServiceLevel()); } } if (owner.getContentAccessMode() != null) { if (toUpdate.isAllowedContentAccessMode(owner.contentAccessMode())) { toUpdate.setContentAccessMode(owner.getContentAccessMode()); } else { throw new BadRequestException( i18n.tr("The content access mode is not allowed for this owner.")); } } ownerCurator.merge(toUpdate); Event e = eventBuilder.setNewEntity(toUpdate).buildEvent(); sink.queueEvent(e); return toUpdate; }
Source:
public StreamingRuntimeContext( AbstractStreamOperator<?> operator, Environment env, Map<String, Accumulator<?, ?>> accumulators) { this( env, accumulators, operator.getMetricGroup(), operator.getOperatorID(), operator.getProcessingTimeService(), operator.getKeyedStateStore(), Collections.emptyMap()); }

Target:
public StreamingRuntimeContext( AbstractStreamOperator<?> operator, Environment env, Map<String, Accumulator<?, ?>> accumulators) { this( env, accumulators, operator.getMetricGroup(), operator.getOperatorID(), operator.getProcessingTimeService(), operator.getKeyedStateStore(), env.getExternalResourceInfoProvider()); }
Source:
ColumnIndices updateSchemaCache(ColumnIndices[] globalCacheArray) { final long currentSchemaVersion = sharedRealm.getSchemaVersion(); final long cacheSchemaVersion = schema.getSchemaVersion(); if (currentSchemaVersion == cacheSchemaVersion) { return null; } ColumnIndices createdGlobalCache = null; final RealmProxyMediator mediator = getConfiguration().getSchemaMediator(); ColumnIndices cacheForCurrentVersion = RealmCache.findColumnIndices(globalCacheArray, currentSchemaVersion); if (cacheForCurrentVersion == null) { final Set<Class<? extends RealmModel>> modelClasses = mediator.getModelClasses(); final Map<Class<? extends RealmModel>, ColumnInfo> map; map = new HashMap<>(modelClasses.size()); try { for (Class<? extends RealmModel> clazz : modelClasses) { final ColumnInfo columnInfo = mediator.validateTable(clazz, sharedRealm, true); map.put(clazz, columnInfo); } } catch (RealmMigrationNeededException e) { throw e; } cacheForCurrentVersion = createdGlobalCache = new ColumnIndices(currentSchemaVersion, map); } schema.updateColumnIndices(cacheForCurrentVersion, mediator); return createdGlobalCache; }

Target:
ColumnIndices updateSchemaCache(ColumnIndices[] globalCacheArray) { final long currentSchemaVersion = sharedRealm.getSchemaVersion(); final long cacheSchemaVersion = schema.getSchemaVersion(); if (currentSchemaVersion == cacheSchemaVersion) { return null; } ColumnIndices createdGlobalCache = null; ColumnIndices cacheForCurrentVersion = RealmCache.findColumnIndices(globalCacheArray, currentSchemaVersion); if (cacheForCurrentVersion == null) { final RealmProxyMediator mediator = getConfiguration().getSchemaMediator(); final Set<Class<? extends RealmModel>> modelClasses = mediator.getModelClasses(); final Map<Class<? extends RealmModel>, ColumnInfo> map; map = new HashMap<>(modelClasses.size()); try { for (Class<? extends RealmModel> clazz : modelClasses) { final ColumnInfo columnInfo = mediator.validateTable(clazz, sharedRealm, true); map.put(clazz, columnInfo); } } catch (RealmMigrationNeededException e) { throw e; } cacheForCurrentVersion = createdGlobalCache = new ColumnIndices(currentSchemaVersion, map); } schema.updateColumnIndices(cacheForCurrentVersion); return createdGlobalCache; }
Source:
public void afterJob(JobExecution jobExecution) { if (!deleteFiles) { return; } if (resources != null) { deleteResources(); } else { deleteFilePath(jobExecution); } }

Target:
public void afterJob(JobExecution jobExecution) { if (!deleteFiles) { return; } if (jobExecution.getStatus().equals(BatchStatus.STOPPED) || jobExecution.getStatus().isUnsuccessful()) { logger.warn("Job is stopped, or failed to complete successfully. File deletion will be skipped"); return; } if (resources != null) { deleteResources(); } else { deleteFilePath(jobExecution.getJobParameters().getString(ExpandedJobParametersConverter.ABSOLUTE_FILE_PATH)); } }
Source:
private boolean waitForFinalization() { long startCount = FinalizerDaemon.INSTANCE.progressCounter.get(); sleepFor(MAX_FINALIZE_NANOS); return !(getNeedToWork() && FinalizerDaemon.INSTANCE.progressCounter.get() == startCount && FinalizerDaemon.INSTANCE.finalizingObject != null); }

Target:
private FinalizerReference<?> waitForFinalization() { long startCount = FinalizerDaemon.INSTANCE.progressCounter.get(); sleepFor(MAX_FINALIZE_NANOS); if (getNeedToWork() && FinalizerDaemon.INSTANCE.progressCounter.get() == startCount) { return FinalizerDaemon.INSTANCE.finalizingObject; } else { return null; } }
Source:
public byte[] getCacheKey() { byte[] dimensionBytes = StringUtils.toUtf8(dimension); byte[] valueBytes = StringUtils.toUtf8(value); return ByteBuffer.allocate(2 + dimensionBytes.length + valueBytes.length) .put(DimFilterCacheHelper.EXTRACTION_CACHE_ID) .put(dimensionBytes) .put((byte) 0xF) .put(valueBytes) .array(); }

Target:
public byte[] getCacheKey() { byte[] dimensionBytes = StringUtils.toUtf8(dimension); byte[] valueBytes = StringUtils.toUtf8(value); return ByteBuffer.allocate(2 + dimensionBytes.length + valueBytes.length) .put(DimFilterCacheHelper.EXTRACTION_CACHE_ID) .put(dimensionBytes) .put(DimFilterCacheHelper.STRING_SEPARATOR) .put(valueBytes) .array(); }
Source:
private static BCFluid defineFluid(int[] data, int heat, String name) { final int density = data[0]; final int baseViscosity = data[1]; final int boilPoint = data[2]; final int baseQuanta = data[3]; final int texLight = data[4]; final int texDark = data[5]; final boolean sticky = data[6] == 1; String fullName = name + (heat == 0 ? "" : "_heat_" + heat); int tempAdjustedViscosity = baseViscosity * (4 - heat) / 4; int boilAdjustedDensity = density * (heat >= boilPoint ? -1 : 1); String fluidTexture = "buildcraftenergy:blocks/fluids/" + name + "_heat_" + heat; BCFluid def = new BCFluid(fullName, new ResourceLocation(fluidTexture + "_still"), new ResourceLocation(fluidTexture + "_flow")); def.setBlockName(name + "_heat_" + heat); def.setMapColour(getMapColor(texDark)); def.setFlammable(BCEnergyConfig.enableOilBurn); def.setHeat(heat); def.setUnlocalizedName(name); def.setTemperature(300 + 20 * heat); def.setViscosity(tempAdjustedViscosity); def.setDensity(boilAdjustedDensity); def.setGaseous(def.getDensity() < 0); def.setColour(texLight, texDark); def.setHeatable(true); FluidManager.register(def); BCFluidBlock block = (BCFluidBlock) def.getBlock(); block.setLightOpacity(3); block.setSticky(sticky); block.setQuantaPerBlock(baseQuanta + (baseQuanta > 6 ? heat : heat / 2)); allFluids.add(def); return def; }

Target:
private static BCFluid defineFluid(int[] data, int heat, String name) { final int density = data[0]; final int baseViscosity = data[1]; final int boilPoint = data[2]; final int baseQuanta = data[3]; final int texLight = data[4]; final int texDark = data[5]; final boolean sticky = data[6] == 1; final boolean flammable = BCEnergyConfig.enableOilBurn ? data[7] == 1 : false; String fullName = name + (heat == 0 ? "" : "_heat_" + heat); int tempAdjustedViscosity = baseViscosity * (4 - heat) / 4; int boilAdjustedDensity = density * (heat >= boilPoint ? -1 : 1); String fluidTexture = "buildcraftenergy:blocks/fluids/" + name + "_heat_" + heat; BCFluid def = new BCFluid(fullName, new ResourceLocation(fluidTexture + "_still"), new ResourceLocation(fluidTexture + "_flow")); def.setBlockName(name + "_heat_" + heat); def.setMapColour(getMapColor(texDark)); def.setFlammable(flammable); def.setHeat(heat); def.setUnlocalizedName(name); def.setTemperature(300 + 20 * heat); def.setViscosity(tempAdjustedViscosity); def.setDensity(boilAdjustedDensity); def.setGaseous(def.getDensity() < 0); def.setColour(texLight, texDark); def.setHeatable(true); FluidManager.register(def); BCFluidBlock block = (BCFluidBlock) def.getBlock(); block.setLightOpacity(3); block.setSticky(sticky); block.setQuantaPerBlock(baseQuanta + (baseQuanta > 6 ? heat : heat / 2)); allFluids.add(def); return def; }
Source:
private void doRun() { boolean strictInterval = Boolean.getBoolean("org.opennms.netmgt.collectd.strictInterval"); if (processUpdates() == ABORT_COLLECTION) { LOG.debug("run: Aborting because processUpdates returned ABORT_COLLECTION (probably marked for deletion) for {}", this); return; } if (m_lastScheduledCollectionTime == 0 || !strictInterval) m_lastScheduledCollectionTime = System.currentTimeMillis(); else m_lastScheduledCollectionTime += m_spec.getInterval(); if (!m_spec.scheduledOutage(m_agent)) { try { doCollection(m_lastScheduledCollectionTime); updateStatus(ServiceCollector.COLLECTION_SUCCEEDED, null); } catch (CollectionTimedOut e) { LOG.info(e.getMessage()); updateStatus(ServiceCollector.COLLECTION_FAILED, e); } catch (CollectionWarning e) { LOG.warn(e.getMessage(), e); updateStatus(ServiceCollector.COLLECTION_FAILED, e); } catch (CollectionUnknown e) { LOG.warn(e.getMessage(), e); } catch (CollectionException e) { LOG.error(e.getMessage(), e); updateStatus(ServiceCollector.COLLECTION_FAILED, e); } catch (Throwable e) { LOG.error(e.getMessage(), e); updateStatus(ServiceCollector.COLLECTION_FAILED, new CollectionException("Collection failed unexpectedly: " + e.getClass().getSimpleName() + ": " + e.getMessage(), e)); } } long diff = 0; if (strictInterval) diff = System.currentTimeMillis() - m_lastScheduledCollectionTime; m_scheduler.schedule(m_spec.getInterval() - diff, getReadyRunnable()); }

Target:
private void doRun() { boolean strictInterval = Boolean.getBoolean("org.opennms.netmgt.collectd.strictInterval"); if (processUpdates() == ABORT_COLLECTION) { LOG.debug("run: Aborting because processUpdates returned ABORT_COLLECTION (probably marked for deletion) for {}", this); return; } if (m_lastScheduledCollectionTime == 0 || !strictInterval) m_lastScheduledCollectionTime = System.currentTimeMillis(); else m_lastScheduledCollectionTime += m_spec.getInterval(); if (!m_spec.scheduledOutage(m_agent)) { try { doCollection(); updateStatus(ServiceCollector.COLLECTION_SUCCEEDED, null); } catch (CollectionTimedOut e) { LOG.info(e.getMessage()); updateStatus(ServiceCollector.COLLECTION_FAILED, e); } catch (CollectionWarning e) { LOG.warn(e.getMessage(), e); updateStatus(ServiceCollector.COLLECTION_FAILED, e); } catch (CollectionUnknown e) { LOG.warn(e.getMessage(), e); } catch (CollectionException e) { LOG.error(e.getMessage(), e); updateStatus(ServiceCollector.COLLECTION_FAILED, e); } catch (Throwable e) { LOG.error(e.getMessage(), e); updateStatus(ServiceCollector.COLLECTION_FAILED, new CollectionException("Collection failed unexpectedly: " + e.getClass().getSimpleName() + ": " + e.getMessage(), e)); } } long diff = 0; if (strictInterval) { diff = System.currentTimeMillis() - m_lastScheduledCollectionTime; diff = Math.min(diff, m_spec.getInterval()); } m_scheduler.schedule(m_spec.getInterval() - diff, getReadyRunnable()); }
Source:
public File(final File file) throws IllegalArgumentException { Objects.requireNonNull(file); if (file.getSize() <= 0) { throw new IllegalArgumentException("File(): Error - size <= 0."); } datacenter = Datacenter.NULL; setName(file.getName()); transactionTime = 0; createAttribute(file.getSize()); this.setDatacenter(file.getDatacenter()); this.deleted = file.deleted; file.getAttribute().copyValue(this.attribute); this.attribute.setMasterCopy(false); }

Target:
public File(final File file) throws IllegalArgumentException { this(file.getName(),file.getSize()); Objects.requireNonNull(file); this.setDatacenter(file.getDatacenter()); this.deleted = file.deleted; file.getAttribute().copyValue(this.attribute); this.attribute.setMasterCopy(false); }
Source:
private Optional<String> checkForExistingFile(byte[] uploadedFile) throws IOException { try (Stream<java.nio.file.Path> walk = Files.walk(Paths.get(runtimeOptions.getImportsBaseDir()), 1)) { return walk .filter(p -> p.toFile().isFile()) .filter(p -> p.toString().toLowerCase().endsWith(DASHBOARD_EXTENSION)) .filter(p -> isContentEquals(uploadedFile, p)) .map(p -> p.getFileName().toString().replace(DASHBOARD_EXTENSION, "")) .findFirst(); } catch (Exception e) { logger.info("Error checking for duplicated file contents."); logger.debug("Error checking for duplicated file contents.", e); return Optional.empty(); } }

Target:
private Optional<String> checkForExistingFile(byte[] uploadedFile) throws IOException { try (Stream<java.nio.file.Path> walk = Files.walk(Paths.get(runtimeOptions.getImportsBaseDir()), 1)) { return walk .filter(p -> p.toFile().isFile() && p.toString().toLowerCase().endsWith(DASHBOARD_EXTENSION) && isContentEquals(uploadedFile, p)) .map(p -> p.getFileName().toString().replace(DASHBOARD_EXTENSION, "")) .findFirst(); } catch (Exception e) { logger.info("Error checking for duplicated file contents."); logger.debug("Error checking for duplicated file contents.", e); return Optional.empty(); } }
Source:
ParquetWriter( OutputFile file, ParquetFileWriter.Mode mode, WriteSupport<T> writeSupport, CompressionCodecName compressionCodecName, int rowGroupSize, boolean validating, Configuration conf, int maxPaddingSize, ParquetProperties encodingProps, FileEncryptionProperties encryptionProperties) throws IOException { WriteSupport.WriteContext writeContext = writeSupport.init(conf); MessageType schema = writeContext.getSchema(); if (encryptionProperties == null) { encryptionProperties = ParquetOutputFormat.createEncryptionProperties(conf, new Path(file.toString()), writeContext); } ParquetFileWriter fileWriter = new ParquetFileWriter( file, schema, mode, rowGroupSize, maxPaddingSize, encodingProps.getColumnIndexTruncateLength(), encodingProps.getStatisticsTruncateLength(), encodingProps.getPageWriteChecksumEnabled(), encryptionProperties); fileWriter.start(); this.codecFactory = new CodecFactory(conf, encodingProps.getPageSizeThreshold()); CodecFactory.BytesCompressor compressor = codecFactory.getCompressor(compressionCodecName); this.writer = new InternalParquetRecordWriter<T>( fileWriter, writeSupport, schema, writeContext.getExtraMetaData(), rowGroupSize, compressor, validating, encodingProps); }

Target:
ParquetWriter( OutputFile file, ParquetFileWriter.Mode mode, WriteSupport<T> writeSupport, CompressionCodecName compressionCodecName, int rowGroupSize, boolean validating, Configuration conf, int maxPaddingSize, ParquetProperties encodingProps, FileEncryptionProperties encryptionProperties) throws IOException { WriteSupport.WriteContext writeContext = writeSupport.init(conf); MessageType schema = writeContext.getSchema(); if (encryptionProperties == null) { encryptionProperties = ParquetOutputFormat.createEncryptionProperties(conf, new Path(file.getPath()), writeContext); } ParquetFileWriter fileWriter = new ParquetFileWriter( file, schema, mode, rowGroupSize, maxPaddingSize, encodingProps.getColumnIndexTruncateLength(), encodingProps.getStatisticsTruncateLength(), encodingProps.getPageWriteChecksumEnabled(), encryptionProperties); fileWriter.start(); this.codecFactory = new CodecFactory(conf, encodingProps.getPageSizeThreshold()); CodecFactory.BytesCompressor compressor = codecFactory.getCompressor(compressionCodecName); this.writer = new InternalParquetRecordWriter<T>( fileWriter, writeSupport, schema, writeContext.getExtraMetaData(), rowGroupSize, compressor, validating, encodingProps); }
Source:
private void storeChecksum(String basePath, Repository repository, boolean forceRegeneration) throws ProviderImplementationException, NoSuchAlgorithmException, IOException, ArtifactTransportException { File file = new File(basePath); LayoutProvider layoutProvider = getLayoutProvider(repository, layoutProviderRegistry); List<File> list = Arrays.asList(file.listFiles()); list.stream() .filter(File::isFile) .filter(e -> !ArtifactUtils.isChecksum(e.getPath())) .forEach(e -> { if (!layoutProvider.isExistChecksum(repository, e.getPath()) || forceRegeneration) { ArtifactInputStream is = null; try { String artifactPath = e.getPath() .substring(repository.getBasedir() .length() + 1); is = layoutProvider.getInputStream(repository.getStorage() .getId(), repository.getId(), artifactPath); } catch (IOException | NoSuchAlgorithmException | ArtifactTransportException e1) { e1.printStackTrace(); } writeChecksum(layoutProvider, is, e.getPath()); } }); }

Target:
private void storeChecksum(String basePath, Repository repository, boolean forceRegeneration) throws ProviderImplementationException, NoSuchAlgorithmException, IOException, ArtifactTransportException { File file = new File(basePath); LayoutProvider layoutProvider = getLayoutProvider(repository, layoutProviderRegistry); List<File> list = Arrays.asList(file.listFiles()); list.stream() .filter(File::isFile) .filter(e -> !ArtifactUtils.isChecksum(e.getPath())) .forEach(e -> { if (!layoutProvider.isExistChecksum(repository, e.getPath()) || forceRegeneration) { ArtifactInputStream is = null; try { String artifactPath = e.getPath() .substring(repository.getBasedir() .length() + 1); is = layoutProvider.getInputStream(repository.getStorage() .getId(), repository.getId(), artifactPath); } catch (IOException | NoSuchAlgorithmException | ArtifactTransportException e1) { logger.error(e1.getMessage(), e1); } writeChecksum(layoutProvider, is, e.getPath()); } }); }
Source:
public String runTask(String[] args) throws Exception { int res = ToolRunner.run(new JobClient(), args); return res == 0 ? "Sucess" : "Fail"; }

Target:
public String runTask(String[] args) throws Exception { int res = ToolRunner.run(new JobClient(), args); return res == 0 ? "Success" : "Fail"; }
Source:
private void writeEntityTypes(Iterable<EntityType> entityTypes, ExcelWriter writer) throws IOException { if (!writer.hasSheet(EMX_ENTITIES)) { writer.createSheet(EMX_ENTITIES, newArrayList(ENTITIES_ATTRS.keySet())); } writer.writeRows( StreamSupport.stream(entityTypes.spliterator(), false) .map(entityType -> EntityTypeMapper.map(entityType)), EMX_ENTITIES); }

Target:
private void writeEntityTypes(Iterable<EntityType> entityTypes, ExcelWriter writer) throws IOException { if (!writer.hasSheet(EMX_ENTITIES)) { writer.createSheet(EMX_ENTITIES, newArrayList(ENTITIES_ATTRS.keySet())); } writer.writeRows(Streams.stream(entityTypes).map(EntityTypeMapper::map), EMX_ENTITIES); }
Source:
public static String getConvoKeyAsJsonString(FlowDocument document) { if (document.isInitiator() == null) { return null; } final ConversationKey convoKey = document.isInitiator() ? egressKeyFor(document) : ingressKeyFor(document); return toJsonString(convoKey); }

Target:
public static String getConvoKeyAsJsonString(FlowDocument document) { final ConversationKey convoKey = document.isInitiator() ? egressKeyFor(document) : ingressKeyFor(document); return toJsonString(convoKey); }
Source:
public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); searchView.setVisibility(isVisibleToUser ? View.VISIBLE : View.GONE); onFragmentVisibilityChange(isVisibleToUser); }

Target:
public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); onFragmentVisibilityChange(isVisibleToUser); }
Source:
private void initLocalBuildPipeline( ) { final Stage< Input, SourceConfig > sourceConfigStage = config( "Local Source Config", ( Function< Input, SourceConfig > ) ( s ) -> { return new LocalSourceConfig( ) { }; } ); final Stage< SourceConfig, ProjectConfig > projectConfigStage = config( "Local Project Config", ( Function< SourceConfig, ProjectConfig > ) ( s ) -> { return new LocalProjectConfig( ) { }; } ); final Stage< ProjectConfig, BuildConfig > localBuildConfigStage = config( "Local Build Config", ( Function< ProjectConfig, BuildConfig > ) ( s ) -> { return new LocalBuildConfigImpl( ) { }; } ); final Stage< BuildConfig, BinaryConfig > localBuildExecStage = config( "Local Build Exec", ( Function< BuildConfig, BinaryConfig > ) ( s ) -> { return new LocalBuildExecConfig( ) { }; } ); final Pipeline localBuildPipeline = PipelineFactory .startFrom( sourceConfigStage ) .andThen( projectConfigStage ) .andThen( localBuildConfigStage ) .andThen( localBuildExecStage ) .buildAs( LOCAL_BUILD_PIPELINE ); pipelineRegistry.registerPipeline( localBuildPipeline ); }

Target:
private void initLocalBuildPipeline( ) { final Stage< Input, SourceConfig > sourceConfigStage = config( "Local Source Config", ( s ) -> new LocalSourceConfig( ) { } ); final Stage< SourceConfig, ProjectConfig > projectConfigStage = config( "Local Project Config", ( s ) -> new LocalProjectConfig( ) { } ); final Stage< ProjectConfig, BuildConfig > localBuildConfigStage = config( "Local Build Config", ( s ) -> new LocalBuildConfigImpl( ) ); final Stage< BuildConfig, BinaryConfig > localBuildExecStage = config( "Local Build Exec", ( s ) -> new LocalBuildExecConfig( ) { } ); final Pipeline localBuildPipeline = PipelineFactory .startFrom( sourceConfigStage ) .andThen( projectConfigStage ) .andThen( localBuildConfigStage ) .andThen( localBuildExecStage ) .buildAs( LOCAL_BUILD_PIPELINE ); pipelineRegistry.registerPipeline( localBuildPipeline ); }
Source:
public void testJvmPauseMonitorConfigured() throws IOException, ConfigException { final Long sleepTime = 444L; final Long warnTH = 5555L; final Long infoTH = 555L; QuorumPeerConfig quorumPeerConfig = new MockQuorumPeerConfig(1); Properties zkProp = getDefaultZKProperties(); zkProp.setProperty("dataDir", new File("myDataDir").getAbsolutePath()); zkProp.setProperty("jvm.pause.monitor", "true"); zkProp.setProperty("jvm.pause.sleep.time.ms", sleepTime.toString()); zkProp.setProperty("jvm.pause.warn-threshold.ms", warnTH.toString()); zkProp.setProperty("jvm.pause.info-threshold.ms", infoTH.toString()); quorumPeerConfig.parseProperties(zkProp); assertEquals(sleepTime, Long.valueOf(quorumPeerConfig.getJvmPauseSleepTimeMs())); assertEquals(warnTH, Long.valueOf(quorumPeerConfig.getJvmPauseWarnThresholdMs())); assertEquals(infoTH, Long.valueOf(quorumPeerConfig.getJvmPauseInfoThresholdMs())); assertTrue(quorumPeerConfig.isJvmPauseMonitorToRun()); }

Target:
public void testJvmPauseMonitorConfigured() throws IOException, ConfigException { final Long sleepTime = 444L; final Long warnTH = 5555L; final Long infoTH = 555L; QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig(); Properties zkProp = getDefaultZKProperties(); zkProp.setProperty("dataDir", new File("myDataDir").getAbsolutePath()); zkProp.setProperty("jvm.pause.monitor", "true"); zkProp.setProperty("jvm.pause.sleep.time.ms", sleepTime.toString()); zkProp.setProperty("jvm.pause.warn-threshold.ms", warnTH.toString()); zkProp.setProperty("jvm.pause.info-threshold.ms", infoTH.toString()); quorumPeerConfig.parseProperties(zkProp); assertEquals(sleepTime, Long.valueOf(quorumPeerConfig.getJvmPauseSleepTimeMs())); assertEquals(warnTH, Long.valueOf(quorumPeerConfig.getJvmPauseWarnThresholdMs())); assertEquals(infoTH, Long.valueOf(quorumPeerConfig.getJvmPauseInfoThresholdMs())); assertTrue(quorumPeerConfig.isJvmPauseMonitorToRun()); }
Source:
public static void init(String sqlDialect) { emf = Persistence.createEntityManagerFactory("aggregationStore"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); em.createNativeQuery("DROP ALL OBJECTS;").executeUpdate(); em.createNativeQuery("RUNSCRIPT FROM 'classpath:create_tables.sql'").executeUpdate(); em.getTransaction().commit(); HikariConfig config = new HikariConfig(); config.setDriverClassName(emf.getProperties().get("javax.persistence.jdbc.driver").toString()); config.setJdbcUrl(emf.getProperties().get("javax.persistence.jdbc.url").toString()); DataSource dataSource = new HikariDataSource(config); metaDataStore = new MetaDataStore(ClassScanner.getAllClasses("com.yahoo.elide.datastores.aggregation.example")); dictionary = new EntityDictionary(new HashMap<>()); dictionary.bindEntity(PlayerStatsWithView.class); dictionary.bindEntity(PlayerStatsView.class); dictionary.bindEntity(PlayerStats.class); dictionary.bindEntity(Country.class); dictionary.bindEntity(SubCountry.class); dictionary.bindEntity(Player.class); dictionary.bindEntity(CountryView.class); dictionary.bindEntity(CountryViewNested.class); dictionary.bindEntity(Continent.class); filterParser = new RSQLFilterDialect(dictionary); metaDataStore.populateEntityDictionary(dictionary); engine = new SQLQueryEngine(metaDataStore, dataSource, sqlDialect); TableId tableId = new TableId("playerStats", "", ""); playerStatsTable = engine.getTable(tableId); ASIA.setName("Asia"); ASIA.setId("1"); NA.setName("North America"); NA.setId("2"); HONG_KONG.setIsoCode("HKG"); HONG_KONG.setName("Hong Kong"); HONG_KONG.setId("344"); HONG_KONG.setContinent(ASIA); USA.setIsoCode("USA"); USA.setName("United States"); USA.setId("840"); USA.setContinent(NA); }

Target:
public static void init(String sqlDialect) { HikariConfig config = new HikariConfig(File.separator + "jpah2db.properties"); DataSource dataSource = new HikariDataSource(config); try (Connection h2Conn = dataSource.getConnection()) { h2Conn.createStatement().execute("RUNSCRIPT FROM 'classpath:prepare_tables.sql'"); } catch (SQLException e) { ((HikariDataSource) dataSource).close(); throw new IllegalStateException(e); } metaDataStore = new MetaDataStore(ClassScanner.getAllClasses("com.yahoo.elide.datastores.aggregation.example")); dictionary = new EntityDictionary(new HashMap<>()); dictionary.bindEntity(PlayerStatsWithView.class); dictionary.bindEntity(PlayerStatsView.class); dictionary.bindEntity(PlayerStats.class); dictionary.bindEntity(Country.class); dictionary.bindEntity(SubCountry.class); dictionary.bindEntity(Player.class); dictionary.bindEntity(CountryView.class); dictionary.bindEntity(CountryViewNested.class); dictionary.bindEntity(Continent.class); filterParser = new RSQLFilterDialect(dictionary); metaDataStore.populateEntityDictionary(dictionary); engine = new SQLQueryEngine(metaDataStore, new ConnectionDetails(dataSource, sqlDialect)); TableId tableId = new TableId("playerStats", "", ""); playerStatsTable = engine.getTable(tableId); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getActivity().getApplication()).component().inject(this); if (savedInstanceState == null) { mSite = (SiteModel) getActivity().getIntent().getSerializableExtra(WordPress.SITE); mBrowserType = (MediaBrowserType) getActivity().getIntent().getSerializableExtra(MediaBrowserActivity.ARG_BROWSER_TYPE); mImagesOnly = getActivity().getIntent().getBooleanExtra(MediaBrowserActivity.ARG_IMAGES_ONLY, false); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); mBrowserType = (MediaBrowserType) savedInstanceState.getSerializable(MediaBrowserActivity.ARG_BROWSER_TYPE); mImagesOnly = savedInstanceState.getBoolean(MediaBrowserActivity.ARG_IMAGES_ONLY); } if (mSite == null) { ToastUtils.showToast(getActivity(), R.string.blog_not_found, ToastUtils.Duration.SHORT); getActivity().finish(); } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getActivity().getApplication()).component().inject(this); if (savedInstanceState == null) { mSite = (SiteModel) getActivity().getIntent().getSerializableExtra(WordPress.SITE); mBrowserType = (MediaBrowserType) getActivity().getIntent().getSerializableExtra(MediaBrowserActivity.ARG_BROWSER_TYPE); boolean imagesOnly = getActivity().getIntent().getBooleanExtra(MediaBrowserActivity.ARG_IMAGES_ONLY, false); if (imagesOnly) { mFilter = Filter.IMAGES; } } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); mBrowserType = (MediaBrowserType) savedInstanceState.getSerializable(MediaBrowserActivity.ARG_BROWSER_TYPE); } if (mSite == null) { ToastUtils.showToast(getActivity(), R.string.blog_not_found, ToastUtils.Duration.SHORT); getActivity().finish(); } }
Source:
Priority getPriority() { Priority priority = Priority.LOW; boolean hasMultiple = actions != null && !actions.isEmpty(); if (actions != null && !hasMultiple) { return priority; } if (action != null) { priority = action.getPriority(); } if (hasMultiple) { for (int i = 0, n = actions.size(); i < n; i++) { Priority actionPriority = actions.get(i).getPriority(); if (actionPriority.ordinal() > priority.ordinal()) { priority = actionPriority; } } } return priority; }

Target:
Priority getPriority() { return priority; }
Source:
void applied(long msgId) { inProgressMessages.computeIfPresent(msgId, ((id, state) -> state = true)); if (lwmLock.tryLock()) { try { for (long i = lowerWaterMark + 1; i<= higerWaterMark.get(); i++) { final AtomicBoolean removed = new AtomicBoolean(false); inProgressMessages.computeIfPresent(i, (id, state) -> { if (state == true) { removed.set(true); return null; } return state; }); if (removed.get()) { lowerWaterMark ++; } else { break; } } } finally { lwmLock.unlock(); } } }

Target:
void applied(long msgId) { inProgressMessages.computeIfPresent(msgId, ((id, state) -> state = true)); updateLowerWaterMark(); }
Source:
public String getReplicaPath() { return getMountPath() + File.separator + GetRequest.Cloud_Replica_Keyword + File.separator + partitionId.toPathString(); }

Target:
public String getReplicaPath() { return GetRequest.Cloud_Replica_Keyword + File.separator + getMountPath() + File.separator + partitionId.toPathString(); }
Source:
public SimpleDateFormat getSimpleDateFormat() { if (simpleDateFormat == null) { simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ROOT); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); } return simpleDateFormat; }

Target:
public SimpleDateFormat getSimpleDateFormat() { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ROOT); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return simpleDateFormat; }
Source:
protected QueryExecutionEngine createEngine( Dependencies deps, GraphDatabaseAPI graphAPI ) { GraphDatabaseCypherService queryService = new GraphDatabaseCypherService( graphAPI ); deps.satisfyDependency( queryService ); DependencyResolver resolver = graphAPI.getDependencyResolver(); LogService logService = resolver.resolveDependency( LogService.class ); KernelAPI kernelAPI = resolver.resolveDependency( KernelAPI.class ); Monitors monitors = resolver.resolveDependency( Monitors.class ); LogProvider logProvider = logService.getInternalLogProvider(); CommunityCompatibilityFactory inner = new CommunityCompatibilityFactory( queryService, kernelAPI, monitors, logProvider ); EnterpriseCompatibilityFactory compatibilityFactory = new EnterpriseCompatibilityFactory( inner, queryService, kernelAPI, monitors, logProvider ); deps.satisfyDependency( compatibilityFactory ); try { deps.resolveDependency( Procedures.class ).registerProcedure( QueryEngineProcedures.class ); } catch ( KernelException e ) { throw new IllegalStateException( "Failed to register QueryEngineProcedures", e ); } return new ExecutionEngine( queryService, logProvider, compatibilityFactory ); }

Target:
protected QueryExecutionEngine createEngine( Dependencies deps, GraphDatabaseAPI graphAPI ) { GraphDatabaseCypherService queryService = new GraphDatabaseCypherService( graphAPI ); deps.satisfyDependency( queryService ); DependencyResolver resolver = graphAPI.getDependencyResolver(); LogService logService = resolver.resolveDependency( LogService.class ); KernelAPI kernelAPI = resolver.resolveDependency( KernelAPI.class ); Monitors monitors = resolver.resolveDependency( Monitors.class ); LogProvider logProvider = logService.getInternalLogProvider(); CommunityCompatibilityFactory inner = new CommunityCompatibilityFactory( queryService, kernelAPI, monitors, logProvider ); EnterpriseCompatibilityFactory compatibilityFactory = new EnterpriseCompatibilityFactory( inner, queryService, kernelAPI, monitors, logProvider ); deps.satisfyDependency( compatibilityFactory ); return new ExecutionEngine( queryService, logProvider, compatibilityFactory ); }
Source:
public Set<TopicRef> mapGenresToTopicRefs(Set<String> genres) { Set<String> tags = new HashSet<>(genres.size() + 1); for (String genre : genres) { if (genre.contains("<LINK_0>")) { String tag = paTagMap.get(genre); if (tag != null) { tags.add(tag); } } } if (tags.size() == 1 && tags.contains("film")) { tags.add("action"); } return getTopicRefFromTags(tags); }

Target:
public Set<TopicRef> mapGenresToTopicRefs(Set<String> genres) { Set<String> tags = Sets.newHashSet(); for (String genre : genres) { if (genre.contains("<LINK_0>")) { String tag = paTagMap.get(genre); if (tag != null) { tags.add(tag); } } } if (tags.size() == 1 && tags.contains("film")) { tags.add("action"); } return getTopicRefFromTags(tags); }