auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setUpTestData() throws Exception { AbstractAuditBackend backend = (AbstractAuditBackend) this.auditBackend; AuditQueryBuilder builder = new AuditQueryBuilder().predicates( Predicates.eq(LOG_EVENT_ID, ID_FOR_AUDIT_STORAGE_TESTS)); List<LogEntry> logs = backend.queryLogs(builder); if (logs.isEmpty()) { List<String> jsonEntries = new ArrayList<>(); for (int i = 1; i <= NUM_OF_EVENTS; i++) { ObjectNode logEntryJson = mapper.createObjectNode(); logEntryJson.put(LOG_ID, Integer.valueOf(i).longValue()); logEntryJson.put(LOG_EVENT_ID, ID_FOR_AUDIT_STORAGE_TESTS); logEntryJson.put(LOG_DOC_PATH, i % 2 == 0 ? "/is/even" : "/is/odd"); jsonEntries.add(mapper.writeValueAsString(logEntryJson)); } backend.append(jsonEntries); flush(); } }

Target:
public void setUpTestData() throws Exception { AbstractAuditBackend backend = (AbstractAuditBackend) this.auditBackend; AuditQueryBuilder builder = new AuditQueryBuilder().predicates( Predicates.eq(LOG_EVENT_ID, ID_FOR_AUDIT_STORAGE_TESTS)); List<LogEntry> logs = backend.queryLogs(builder); if (logs.isEmpty()) { List<String> jsonEntries = new ArrayList<>(); for (int i = 1; i <= NUM_OF_EVENTS; i++) { ObjectNode logEntryJson = mapper.createObjectNode(); logEntryJson.put(LOG_ID, 1000L + i); logEntryJson.put(LOG_EVENT_ID, ID_FOR_AUDIT_STORAGE_TESTS); logEntryJson.put(LOG_DOC_PATH, i % 2 == 0 ? "/is/even" : "/is/odd"); jsonEntries.add(mapper.writeValueAsString(logEntryJson)); } backend.append(jsonEntries); flush(); } }
Source:
private int getMaxChildrenSeverityInCache(IContainer container) { if (!container.isAccessible()) { return -1; } Set<IResource> children = new HashSet<>(); try { children.addAll(Arrays.asList(container.members())); } catch (CoreException ex) { WorkbenchNavigatorPlugin.log("Cannot access members", WorkbenchNavigatorPlugin.createErrorStatus(ex.getMessage(), ex)); } children.addAll(Arrays.asList(NestedProjectManager.getInstance().getDirectChildrenProjects(container))); int severity = -1; for (IResource child : children) { Integer cachedSeverity = cache.get(child); if (cachedSeverity != null && cachedSeverity.intValue() > severity) { severity = cachedSeverity.intValue(); } } ; return severity; }

Target:
private int getMaxChildrenSeverityInCache(IContainer container) { if (!container.isAccessible()) { return -1; } Set<IResource> children = new HashSet<>(); try { children.addAll(Arrays.asList(container.members())); } catch (CoreException ex) { WorkbenchNavigatorPlugin.log("Cannot access members", WorkbenchNavigatorPlugin.createErrorStatus(ex.getMessage(), ex)); } children.addAll(Arrays.asList(NestedProjectManager.getInstance().getDirectChildrenProjects(container))); int severity = -1; for (IResource child : children) { Integer cachedSeverity = cache.get(child); if (cachedSeverity != null && cachedSeverity.intValue() > severity) { severity = cachedSeverity.intValue(); if (severity >= IMarker.SEVERITY_ERROR) { return severity; } } } ; return severity; }
Source:
void checkAndMaybeComplete() { boolean done = false; if (operationTracker.isDone()) { if (!operationTracker.hasSucceeded()) { failedAttempts++; if (failedAttempts <= routerConfig.routerMaxSlippedPutAttempts) { logger.trace("Attempt to put chunk with id: failed, attempting slipped put ", chunkBlobId); routerMetrics.slippedPutAttemptCount.inc(); prepareForSending(); } else { logger.error("Elapsed slipped puts. Failing the operation for {}", getChunkBlobId()); chunkBlobId = null; setOperationExceptionAndComplete(chunkException); done = true; } } else { chunkException = null; done = true; } } if (done) { state = ChunkState.Complete; } }

Target:
void checkAndMaybeComplete() { boolean done = false; if (operationTracker.isDone()) { if (!operationTracker.hasSucceeded()) { failedAttempts++; if (failedAttempts <= routerConfig.routerMaxSlippedPutAttempts) { logger.trace("Attempt to put chunk with id: failed, attempting slipped put ", chunkBlobId); routerMetrics.slippedPutAttemptCount.inc(); prepareForSending(); } else { logger.error("Slipped puts failed for {}", getChunkBlobId()); chunkBlobId = null; setOperationExceptionAndComplete(chunkException); done = true; } } else { chunkException = null; done = true; } } if (done) { state = ChunkState.Complete; } }
Source:
public VepInputGeneratorStepParametersValidator() { super(new String[]{JobParametersNames.CONFIG_RESTARTABILITY_ALLOW, JobParametersNames.DB_COLLECTIONS_VARIANTS_NAME, JobParametersNames.DB_NAME, JobParametersNames.INPUT_STUDY_ID, JobParametersNames.INPUT_VCF_ID, JobParametersNames.OUTPUT_DIR_ANNOTATION}, new String[]{}); }

Target:
public VepInputGeneratorStepParametersValidator() { super(new String[]{JobParametersNames.DB_COLLECTIONS_VARIANTS_NAME, JobParametersNames.DB_NAME, JobParametersNames.INPUT_STUDY_ID, JobParametersNames.INPUT_VCF_ID, JobParametersNames.OUTPUT_DIR_ANNOTATION}, new String[]{JobParametersNames.CONFIG_RESTARTABILITY_ALLOW}); }
Source:
public default DataStreamGenerator mapVectors(IgniteFunction<Vector, Vector> f) { DataStreamGenerator orig = this; return new DataStreamGenerator() { @Override public Stream<LabeledVector<Vector, Double>> labeled() { return orig.labeled().map(v -> new LabeledVector<>(f.apply(v.features()), v.label())); } }; }

Target:
public default DataStreamGenerator mapVectors(IgniteFunction<Vector, Vector> f) { return new DataStreamGenerator() { @Override public Stream<LabeledVector<Vector, Double>> labeled() { return DataStreamGenerator.this.labeled() .map(v -> new LabeledVector<>(f.apply(v.features()), v.label())); } }; }
Source:
public List<ProgramState> constrain(ProgramState state, Constraint constraint) { ProgramState newState = state.constrainOwnSV(this, constraint); if (newState == null) { return ImmutableList.of(); } if (constraint.isStricterOrEqualTo(Constraint.TRUTHY)) { return checkRelationsAndConstrain(newState, relationWhenTrue); } else if (constraint.isStricterOrEqualTo(Constraint.FALSY)) { return checkRelationsAndConstrain(newState, relationWhenTrue.not()); } return ImmutableList.of(state); }

Target:
public List<ProgramState> constrain(ProgramState state, Constraint constraint) { ProgramState newState = state.constrainOwnSV(this, constraint); if (newState == null) { return ImmutableList.of(); } if (constraint.isStricterOrEqualTo(Constraint.TRUTHY)) { return checkRelationsAndConstrain(newState, relationWhenTrue); } else if (constraint.isStricterOrEqualTo(Constraint.FALSY)) { return checkRelationsAndConstrain(newState, relationWhenTrue.not()); } return ImmutableList.of(newState); }
Source:
private static PlanFragment createBroadcastJoinPlanFragment(String name, PlanFragment buildFragment) { Symbol symbol = new Symbol("column"); PlanNode tableScan = new TableScanNode( new PlanNodeId(name), new TableHandle( new ConnectorId("test"), new TestingTableHandle(), TestingTransactionHandle.create(), Optional.of(TestingHandle.INSTANCE)), ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column"))); RemoteSourceNode remote = new RemoteSourceNode(new PlanNodeId("build_id"), buildFragment.getId(), ImmutableList.of(), Optional.empty(), REPLICATE); PlanNode join = new JoinNode( new PlanNodeId(name + "_id"), INNER, tableScan, remote, ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(tableScan.getOutputSymbols()) .addAll(remote.getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED)); return createFragment(join); }

Target:
private static PlanFragment createBroadcastJoinPlanFragment(String name, PlanFragment buildFragment) { Symbol symbol = new Symbol("column"); PlanNode tableScan = new TableScanNode( new PlanNodeId(name), new TableHandle( new ConnectorId("test"), new TestingTableHandle(), TestingTransactionHandle.create(), Optional.empty()), ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column"))); RemoteSourceNode remote = new RemoteSourceNode(new PlanNodeId("build_id"), buildFragment.getId(), ImmutableList.of(), Optional.empty(), REPLICATE); PlanNode join = new JoinNode( new PlanNodeId(name + "_id"), INNER, tableScan, remote, ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(tableScan.getOutputSymbols()) .addAll(remote.getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED)); return createFragment(join); }
Source:
public HibernateErrorReportingServiceDao() { this.errorOccurrenceConverter = new ErrorOccurrenceConverter(); }

Target:
public HibernateErrorReportingServiceDao() { }
Source:
public ExtensionListInfo(@Nonnull final IMAPResponse resp) throws ParsingException { super(resp); for (int i = 0; i < attrs.length; i++) { if (NON_EXISTENT.equalsIgnoreCase(attrs[i])) { isNonExistent = true; } else if (SUBSCRIBED.equalsIgnoreCase(attrs[i])) { isSubscribed = true; } else if (REMOTE.equalsIgnoreCase(attrs[i])) { isRemote = true; } else if (HAS_CHILDREN.equalsIgnoreCase(attrs[i])) { isHasChildren = true; } else if (HAS_NO_CHILDREN.equalsIgnoreCase(attrs[i])) { isHasNoChildren = true; } } }

Target:
public ExtensionListInfo(@Nonnull final IMAPResponse resp) throws ParsingException { super(resp); final Set<ExtendedListAttribute> localSet = new HashSet<ExtendedListAttribute>(); for (int i = 0; i < attrs.length; i++) { if (ExtendedListAttribute.NON_EXISTENT.getValue().equalsIgnoreCase(attrs[i])) { localSet.add(ExtendedListAttribute.NON_EXISTENT); this.canOpen = false; } else if (ExtendedListAttribute.SUBSCRIBED.getValue().equalsIgnoreCase(attrs[i])) { localSet.add(ExtendedListAttribute.SUBSCRIBED); } else if (ExtendedListAttribute.REMOTE.getValue().equalsIgnoreCase(attrs[i])) { localSet.add(ExtendedListAttribute.REMOTE); } else if (ExtendedListAttribute.HAS_CHILDREN.getValue().equalsIgnoreCase(attrs[i])) { localSet.add(ExtendedListAttribute.HAS_CHILDREN); } else if (ExtendedListAttribute.HAS_NO_CHILDREN.getValue().equalsIgnoreCase(attrs[i])) { localSet.add(ExtendedListAttribute.HAS_NO_CHILDREN); } } extendedAttrs = Collections.unmodifiableSet(localSet); }
Source:
public IStatus validate(@Nullable IProject project, @Nullable String path) { if (path == null) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, EMPTY_STRING); } Path filePath = checkNotNull(Paths.get(path)); if (filePath.getFileName().toString().endsWith(PCAPNG_EXTENSION)) { try (PcapFile file = new PcapNgFile(filePath)) { } catch (IOException | BadPcapFileException e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString()); } } else { try (PcapFile file = new PcapOldFile(filePath)) { } catch (IOException | BadPcapFileException e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString()); } } return new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID); }

Target:
public IStatus validate(@Nullable IProject project, @Nullable String path) { if (path == null) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, EMPTY_STRING); } Path filePath = checkNotNull(Paths.get(path)); try { fPcapFile = PcapHelper.getPcapFile(filePath); } catch (IOException | BadPcapFileException e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString()); } return new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID); }
Source:
private boolean assignTask(TaskWrapper taskWrapper) { try { WorkerWrapper workerWrapper; if ((workerWrapper = findWorkerRunningTask(taskWrapper)) != null) { final Worker worker = workerWrapper.getWorker(); log.info("Worker[%s] is already running task{%s].", worker.getHost(), taskWrapper.getTask().getId()); TaskStatus taskStatus = jsonMapper.readValue( cf.getData().forPath(JOINER.join(config.getStatusPath(), worker.getHost(), taskWrapper.getTask().getId())), TaskStatus.class ); if (taskStatus.isComplete()) { TaskCallback callback = taskWrapper.getCallback(); if (callback != null) { callback.notify(taskStatus); } new CleanupPaths(worker.getHost(), taskWrapper.getTask().getId()).run(); } else { tasks.put(taskWrapper.getTask().getId(), taskWrapper); } return true; } } catch (Exception e) { throw Throwables.propagate(e); } WorkerWrapper workerWrapper = getWorkerForTask(); if (workerWrapper != null) { announceTask(workerWrapper.getWorker(), taskWrapper); return true; } return false; }

Target:
private void assignTask(TaskWrapper taskWrapper) { WorkerWrapper workerWrapper = findWorkerRunningTask(taskWrapper); if (workerWrapper != null) { final Worker worker = workerWrapper.getWorker(); try { log.info("Worker[%s] is already running task[%s].", worker.getHost(), taskWrapper.getTask().getId()); TaskStatus taskStatus = jsonMapper.readValue( workerWrapper.getStatusCache() .getCurrentData( JOINER.join(config.getStatusPath(), worker.getHost(), taskWrapper.getTask().getId()) ) .getData(), TaskStatus.class ); if (taskStatus.isComplete()) { TaskCallback callback = taskWrapper.getCallback(); if (callback != null) { callback.notify(taskStatus); } new CleanupPaths(worker.getHost(), taskWrapper.getTask().getId()).run(); } } catch (Exception e) { log.error(e, "Task exists, but hit exception!"); retryTask(new CleanupPaths(worker.getHost(), taskWrapper.getTask().getId()), taskWrapper); } } else { workerWrapper = findWorkerForTask(); if (workerWrapper != null) { announceTask(workerWrapper.getWorker(), taskWrapper); } else { retryTask(null, taskWrapper); } } }
Source:
public TimeZone getTimeZone(){ return Strings.isNullOrEmpty(getString("secor.parser.timezone")) ? TimeZone.getTimeZone("UTC") : TimeZone.getTimeZone(getString("secor.parser.timezone")); }

Target:
public TimeZone getTimeZone() { String timezone = getString("secor.parser.timezone"); return Strings.isNullOrEmpty(timezone) ? TimeZone.getTimeZone("UTC") : TimeZone.getTimeZone(timezone); }
Source:
static public junit.framework.Test suite() { VoltServerConfig config = null; MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder( TestLongRunningReadQuery.class); VoltProjectBuilder project = new VoltProjectBuilder(); final String literalSchema = "CREATE TABLE R1 ( " + " ID BIGINT DEFAULT 0 NOT NULL);" + "" ; try { project.addLiteralSchema(literalSchema); } catch (IOException e) { assertFalse(true); } boolean success; config = new LocalCluster("plansgroupby-onesite.jar", 1, 1, 0, BackendTarget.NATIVE_EE_JNI); success = config.compile(project); assertTrue(success); builder.addServerConfig(config); return builder; }

Target:
static public junit.framework.Test suite() { VoltServerConfig config = null; MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder( TestLongRunningReadQuery.class); VoltProjectBuilder project = new VoltProjectBuilder(); final String literalSchema = "CREATE TABLE R1 ( " + " ID BIGINT DEFAULT 0 NOT NULL);" + "" ; try { project.addLiteralSchema(literalSchema); } catch (IOException e) { assertFalse(true); } boolean success; config = new LocalCluster("longreads-onesite.jar", 1, 1, 0, BackendTarget.NATIVE_EE_JNI); success = config.compile(project); assertTrue(success); builder.addServerConfig(config); return builder; }
Source:
public void onNext(final DataOperation<Long> op) { final LongKeyOperation operation = (LongKeyOperation) op; final String dataType = operation.getDataType(); final List<LongRange> dataKeyRanges = operation.getDataKeyRanges(); final Map<Integer, Pair<Long, Long>> blockToSubKeyRangeMap; final Iterator<LongRange> rangeIterator = dataKeyRanges.iterator(); try { routerLock.readLock().lock(); if (rangeIterator.hasNext()) { final LongRange keyRange = rangeIterator.next(); blockToSubKeyRangeMap = router.resolveBlocks(keyRange.getMinimumLong(), keyRange.getMaximumLong()); } else { LOG.log(Level.SEVERE, "Invalid operation"); resultAggregator.submitLocalResult(operation, Collections.EMPTY_MAP, Collections.EMPTY_LIST); return; } while (rangeIterator.hasNext()) { final LongRange keyRange = rangeIterator.next(); blockToSubKeyRangeMap.putAll(router.resolveBlocks(keyRange.getMinimumLong(), keyRange.getMaximumLong())); } final int numSubOps = blockToSubKeyRangeMap.size(); resultAggregator.registerOp(operation, numSubOps); if (!blockToSubKeyRangeMap.isEmpty()) { if (typeToBlocks.containsKey(dataType)) { enqueueOperation(operation, blockToSubKeyRangeMap); } else { if (operation.getOperationType() == DataOpType.PUT) { initBlocks(dataType); enqueueOperation(operation, blockToSubKeyRangeMap); } } } } finally { routerLock.readLock().unlock(); } }

Target:
public void onNext(final DataOperation<Long> op) { final LongKeyOperation operation = (LongKeyOperation) op; final String dataType = operation.getDataType(); final List<LongRange> dataKeyRanges = operation.getDataKeyRanges(); final Map<Integer, Pair<Long, Long>> blockToSubKeyRangeMap; final Iterator<LongRange> rangeIterator = dataKeyRanges.iterator(); if (rangeIterator.hasNext()) { final LongRange keyRange = rangeIterator.next(); blockToSubKeyRangeMap = blockResolver.resolveBlocksForOrderedKeys(keyRange.getMinimumLong(), keyRange.getMaximumLong()); } else { LOG.log(Level.SEVERE, "Invalid operation"); resultAggregator.submitLocalResult(operation, Collections.EMPTY_MAP, Collections.EMPTY_LIST); return; } while (rangeIterator.hasNext()) { final LongRange keyRange = rangeIterator.next(); blockToSubKeyRangeMap.putAll( blockResolver.resolveBlocksForOrderedKeys(keyRange.getMinimumLong(), keyRange.getMaximumLong())); } final int numSubOps = blockToSubKeyRangeMap.size(); resultAggregator.registerOp(operation, numSubOps); if (!blockToSubKeyRangeMap.isEmpty()) { if (typeToBlocks.containsKey(dataType)) { enqueueOperation(operation, blockToSubKeyRangeMap); } else { if (operation.getOperationType() == DataOpType.PUT) { initBlocks(dataType); enqueueOperation(operation, blockToSubKeyRangeMap); } } } }
Source:
private void sendColorized(String msg, TextColor formatting) { for (String part : msg.split("\n")) { this.player.sendMessage(Text.of(formatting, part)); } }

Target:
private void sendColorized(String msg, TextColor formatting) { for (String part : msg.split("\n")) { this.player.sendMessage(Text.of(formatting, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part))); } }
Source:
private static Object toJdbcCompatObject(Connection connection, Object arg) { if (arg == null) { return null; } if (arg instanceof Map) { try { return toPGObjectJson(toJsonString(((Map) arg))); } catch (SQLException | IOException e) { throw new RuntimeException(e); } } if (arg.getClass().isArray()) { arg = Arrays.asList((Object[]) arg); } if (arg instanceof Collection) { Collection values = (Collection) arg; if (values.isEmpty()) { return null; } else if (values.iterator().next() instanceof Map) { try { return connection.createArrayOf(ObjectType.NAME, values.toArray(new Object[0])); } catch (SQLException e) { throw new RuntimeException(e); } } List<Object> convertedValues = new ArrayList<>(values.size()); PGType pgType = null; for (Object value : values) { convertedValues.add(toJdbcCompatObject(connection, value)); if (pgType == null && value != null) { pgType = PGTypes.get(DataTypes.guessType(value)); } } try { return connection.createArrayOf(pgType.typName(), convertedValues.toArray(new Object[0])); } catch (SQLException e) { throw new RuntimeException(e); } } return arg; }

Target:
private static Object toJdbcCompatObject(Connection connection, Object arg) { if (arg == null || arg instanceof Map) { return arg; } if (arg.getClass().isArray()) { arg = Arrays.asList((Object[]) arg); } if (arg instanceof Collection) { Collection values = (Collection) arg; if (values.isEmpty()) { return null; } List<Object> convertedValues = new ArrayList<>(values.size()); PGType pgType = null; for (Object value : values) { convertedValues.add(toJdbcCompatObject(connection, value)); if (pgType == null && value != null) { pgType = PGTypes.get(DataTypes.guessType(value)); } } try { return connection.createArrayOf(pgType.typName(), convertedValues.toArray(new Object[0])); } catch (SQLException e) { throw new RuntimeException(e); } } return arg; }
Source:
public void get(@SpringBean PageModel pageModel, @RequestParam(value = "breadcrumbOverride", required = false) String breadcrumbOverride, @SpringBean("patientService") PatientService patientService, @RequestParam("patientId") String patientId) { String conceptId = Context.getAdministrationService().getGlobalProperty("concept.causeOfDeath"); Patient patient = patientService.getPatientByUuid(patientId); pageModel.put("birthDate", patient.getBirthdate()); pageModel.put("patient", patient); pageModel.put("patientId", patientId); pageModel.put("breadcrumbOverride", breadcrumbOverride); if (conceptId != null && !conceptId.contains("[a-zA-Z]+")) { pageModel.put("conceptAnswers", getConceptAnswerByConcept(Integer.parseInt(conceptId))); } }

Target:
public void get(@SpringBean PageModel pageModel, @RequestParam(value = "breadcrumbOverride", required = false) String breadcrumbOverride, @SpringBean("patientService") PatientService patientService, @RequestParam("patientId") String patientId) { String conceptId = Context.getAdministrationService().getGlobalProperty("concept.causeOfDeath"); Patient patient = patientService.getPatientByUuid(patientId); pageModel.put("birthDate", patient.getBirthdate()); pageModel.put("patient", patient); pageModel.put("patientId", patientId); pageModel.put("breadcrumbOverride", breadcrumbOverride); if (conceptId != null && !conceptId.contains("[a-zA-Z]+")) { pageModel.put("conceptAnswers", getConceptAnswers(Integer.parseInt(conceptId))); } }
Source:
public void testMappingWithoutToDate() throws Exception { GeodesyMLType mobs = marshaller.unmarshal(TestResources.geodesyMLTestDataSiteLogReader("IRKJ_RadioInterference_NoToDate"), GeodesyMLType.class) .getValue(); SiteLogType logItem = GeodesyMLUtils.getElementFromJAXBElements(mobs.getElements(), SiteLogType.class) .findFirst().get(); RadioInterferencesType radioInterferencesDTO = logItem.getRadioInterferencesSet().get(0).getRadioInterferences(); RadioInterference radioInterferenceEntity = mapper.to(radioInterferencesDTO); assertCommon(radioInterferencesDTO, radioInterferenceEntity, MappingDirection.FROM_DTO_TO_ENTITY); MatcherAssert.assertThat(((TimePeriodType) radioInterferencesDTO.getValidTime().getAbstractTimePrimitive().getValue()).getEndPosition().getValue().size(), Is.is(0)); MatcherAssert.assertThat(radioInterferenceEntity.getEffectiveDates().getTo(), IsNull.nullValue()); RadioInterferencesType radioInterferencesDTO2 = mapper.from(radioInterferenceEntity); assertCommon(radioInterferencesDTO, radioInterferenceEntity, MappingDirection.FROM_ENTITY_TO_DTO); MatcherAssert.assertThat(((TimePeriodType) radioInterferencesDTO2.getValidTime().getAbstractTimePrimitive().getValue()).getEndPosition(), IsNull.nullValue()); }

Target:
public void testMappingWithoutToDate() throws Exception { GeodesyMLType mobs = marshaller.unmarshal(TestResources.geodesyMLTestDataSiteLogReader("IRKJ_RadioInterference_NoToDate"), GeodesyMLType.class).getValue(); SiteLogType logItem = GeodesyMLUtils.getElementFromJAXBElements(mobs.getElements(), SiteLogType.class).findFirst().get(); RadioInterferencesType radioInterferencesDTO = logItem.getRadioInterferencesSet().get(0).getRadioInterferences(); RadioInterference radioInterferenceEntity = mapper.to(radioInterferencesDTO); assertCommonFields(radioInterferencesDTO, radioInterferenceEntity, MappingDirection.FROM_DTO_TO_ENTITY); assertThat(((TimePeriodType) radioInterferencesDTO.getValidTime().getAbstractTimePrimitive().getValue()).getEndPosition() .getValue().size(), is(0)); assertThat(radioInterferenceEntity.getEffectiveDates().getTo(), nullValue()); RadioInterferencesType radioInterferencesDTO2 = mapper.from(radioInterferenceEntity); assertCommonFields(radioInterferencesDTO, radioInterferenceEntity, MappingDirection.FROM_ENTITY_TO_DTO); assertThat(((TimePeriodType) radioInterferencesDTO2.getValidTime().getAbstractTimePrimitive().getValue()).getEndPosition(), nullValue()); }
Source:
public Optional<MetacardValidationReport> validateMetacard(Metacard metacard) { Attribute attribute = metacard.getAttribute(sourceAttribute); if (attribute != null && attribute.getValues().stream().filter(Objects::nonNull).count() > 0 && (StringUtils.isEmpty(sourceValue) || attribute.getValues().contains(sourceValue))) { MetacardValidationReportImpl report = new MetacardValidationReportImpl(); Optional<ValidationViolation> violation = relationships.get(relationship).apply(metacard.getAttribute(targetAttribute)); violation.ifPresent(report::addAttributeViolation); return Optional.of(report); } else { return Optional.empty(); } }

Target:
public Optional<MetacardValidationReport> validateMetacard(Metacard metacard) { Attribute attribute = metacard.getAttribute(sourceAttribute); if (attribute != null && attribute.getValues().stream().anyMatch(Objects::nonNull) && (StringUtils.isEmpty(sourceValue) || attribute.getValues().contains(sourceValue))) { MetacardValidationReportImpl report = new MetacardValidationReportImpl(); Attribute actualAttribute = metacard.getAttribute(targetAttribute); Collection<String> actualValues = actualAttribute == null ? Collections.emptyList() : actualAttribute .getValues() .stream() .map(Objects::toString) .filter(StringUtils::isNotEmpty) .collect(Collectors.toList()); Optional<ValidationViolation> violation = relationships.get(relationship).apply(actualValues); violation.ifPresent(report::addAttributeViolation); if (violation.isPresent()) { return Optional.of(report); } else { return Optional.empty(); } } else { return Optional.empty(); } }
Source:
public Mono<NamedEntityResult> recognizePiiEntities(String text) { return recognizePiiEntitiesWithResponse(text, defaultLanguage).flatMap(FluxUtil::toMono); }

Target:
public Mono<RecognizePiiEntitiesResult> recognizePiiEntities(String text) { try { return recognizePiiEntitiesWithResponse(text, defaultLanguage).flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
protected void Perform() { if (StringHelper.isNullOrEmpty(mTicket)) { mTicket = Ticketing.GenerateOTP(); } IVdcUser user = SessionDataContainer.getInstance().getUser(getParameters().getSessionId()); setSucceeded(Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.SetVmTicket, new SetVmTicketVDSCommandParameters(getVdsId(), getVmId(), mTicket, mValidTime, user.getUserName(), user.getUserId())).getSucceeded()); if (getSucceeded()) { setActionReturnValue(mTicket); VM vm = DbFacade.getInstance().getVmDAO().getById(getVmId()); vm.setguest_cur_user_name(getCurrentUser().getUserName()); DbFacade.getInstance().getVmDynamicDAO().update(vm.getDynamicData()); } }

Target:
protected void Perform() { if (StringHelper.isNullOrEmpty(mTicket)) { mTicket = Ticketing.GenerateOTP(); } setSucceeded(Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.SetVmTicket, new SetVmTicketVDSCommandParameters(getVdsId(), getVmId(), mTicket, mValidTime, getCurrentUser().getUserName(), getCurrentUser().getUserId())).getSucceeded()); if (getSucceeded()) { setActionReturnValue(mTicket); VM vm = DbFacade.getInstance().getVmDAO().get(getVmId()); vm.setguest_cur_user_name(getCurrentUser().getUserName()); DbFacade.getInstance().getVmDynamicDAO().update(vm.getDynamicData()); } }
Source:
protected ParameterizedRowMapper<Snapshot> createEntityRowMapper() { return new ParameterizedRowMapper<Snapshot>() { @Override public Snapshot mapRow(ResultSet rs, int rowNum) throws SQLException { Snapshot snapshot = new Snapshot(); snapshot.setId(Guid.createGuidFromString(rs.getString("snapshot_id"))); snapshot.setVmId(new Guid(rs.getString("vm_id"))); snapshot.setType(SnapshotType.valueOf(rs.getString("snapshot_type"))); snapshot.setStatus(SnapshotStatus.valueOf(rs.getString("status"))); snapshot.setDescription(rs.getString("description")); snapshot.setCreationDate(new Date(rs.getTimestamp("creation_date").getTime())); snapshot.setAppList(rs.getString("app_list")); snapshot.setVmConfiguration(rs.getString("vm_configuration")); return snapshot; } }; }

Target:
protected ParameterizedRowMapper<Snapshot> createEntityRowMapper() { return ROW_MAPPER; }
Source:
private void handleOnMediaUploadedSuccess(@NonNull OnMediaUploaded event) { if (event.canceled) { AppLog.i(T.MEDIA, "Upload successfully canceled."); trackUploadMediaEvents(AnalyticsTracker.Stat.MEDIA_UPLOAD_CANCELED, getMediaFromQueueById(event.media.getId()), null); completeUploadWithId(event.media.getId()); uploadNextInQueue(); } else if (event.completed) { AppLog.i(T.MEDIA, "Upload completed - localId=" + event.media.getId() + " title=" + event.media.getTitle()); trackUploadMediaEvents(AnalyticsTracker.Stat.MEDIA_UPLOAD_SUCCESS, getMediaFromQueueById(event.media.getId()), null); completeUploadWithId(event.media.getId()); addMediaToPostCompletedMediaListMap(event.media); uploadNextInQueue(); } else { AppLog.d(T.MEDIA, event.media.getId() + " - progressing " + event.progress); } }

Target:
private void handleOnMediaUploadedSuccess(@NonNull OnMediaUploaded event) { if (event.canceled) { AppLog.i(T.MEDIA, "Upload successfully canceled."); trackUploadMediaEvents(AnalyticsTracker.Stat.MEDIA_UPLOAD_CANCELED, getMediaFromInProgressQueueById(event.media.getId()), null); completeUploadWithId(event.media.getId()); uploadNextInQueue(); } else if (event.completed) { AppLog.i(T.MEDIA, "Upload completed - localId=" + event.media.getId() + " title=" + event.media.getTitle()); trackUploadMediaEvents(AnalyticsTracker.Stat.MEDIA_UPLOAD_SUCCESS, getMediaFromInProgressQueueById(event.media.getId()), null); completeUploadWithId(event.media.getId()); if (event.media.getLocalPostId() != 0) { addMediaToPostCompletedMediaListMap(event.media); } uploadNextInQueue(); } else { AppLog.d(T.MEDIA, event.media.getId() + " - progressing " + event.progress); } }
Source:
public void testMissingSetContent() throws FileNotFoundException { final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile( getProcessorUnderTest(), "org/uberfire/annotations/processors/WorkbenchClientEditorTest4"); assertFailedCompilation(diagnostics); assertCompilationMessage(diagnostics, Kind.ERROR, Diagnostic.NOPOS, Diagnostic.NOPOS, "org.uberfire.annotations.processors.WorkbenchClientEditorTest4Activity: The WorkbenchClientEditor must provide a @SetContent annotated method that has two java.lang.String as parameters."); assertNull(result.getActualCode()); }

Target:
public void testMissingSetContent() throws FileNotFoundException { final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile( getProcessorUnderTest(), "org/uberfire/annotations/processors/WorkbenchClientEditorTest4"); assertFailedCompilation(diagnostics); assertCompilationMessage(diagnostics, Kind.ERROR, Diagnostic.NOPOS, Diagnostic.NOPOS, "org.uberfire.annotations.processors.WorkbenchClientEditorTest4Activity: The WorkbenchClientEditor must provide a @SetContent annotated method that has two java.lang.String (path and content) as parameters."); assertNull(result.getActualCode()); }
Source:
public EntityModelWidgetWithInfo(EnableableFormLabel label, Widget contentWidget, Align alignment) { this.label = label; if (this.label == null) { this.label = new EnableableFormLabel(); this.label.setVisible(false); } this.contentWidget = contentWidget; this.alignment = alignment; infoIcon = new InfoIcon(SafeHtmlUtils.EMPTY_SAFE_HTML); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); }

Target:
public EntityModelWidgetWithInfo(EnableableFormLabel label, Widget contentWidget, Align alignment) { if (this.label != null) { this.label = label; } else { this.label = new EnableableFormLabel(); this.label.setVisible(false); } this.contentWidget = contentWidget; this.alignment = alignment; infoIcon = new InfoIcon(SafeHtmlUtils.EMPTY_SAFE_HTML); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); }
Source:
public void testEmptyFlatbush() { Rectangle[] items = {}; Flatbush rtree = new Flatbush<Rectangle>(items); assertEquals(rtree.findIntersections(everything).size(), 0); }

Target:
public void testEmptyFlatbush() { Flatbush<Rectangle> rtree = new Flatbush<>(new Rectangle[] {}); assertEquals(findIntersections(rtree, EVERYTHING), ImmutableList.of()); }
Source:
private void initialize() { project = Adapters.adapt(getElement(), IProject.class); if (project == null) { IResource resource = Adapters.adapt(getElement(), IResource.class); Assert.isNotNull(resource, "unable to adapt element to a project"); if (resource instanceof IProject) { project = (IProject) resource; } else if (resource != null) { project = resource.getProject(); } } noDefaultAndApplyButton(); setDescription(NLS.bind(IDEWorkbenchMessages.ProjectReferencesPage_label, project.getName())); }

Target:
private void initialize() { project = Adapters.adapt(getElement(), IProject.class); if (project == null) { IResource resource = Adapters.adapt(getElement(), IResource.class); Assert.isNotNull(resource, "unable to adapt element to a project"); project = resource.getProject(); } noDefaultAndApplyButton(); setDescription(NLS.bind(IDEWorkbenchMessages.ProjectReferencesPage_label, project.getName())); }
Source:
public void setNodesChecked(List<ITreeNode> nodes, boolean b) { List<ITreeNode> changedNodes = new ArrayList<ITreeNode>(); for (ITreeNode node : nodes) { node = resolveNode(node); if (node != null && isCheckable() && node.isEnabled() && isEnabled()) { if (node.isChecked() != b) { if (b) { m_checkedNodes.add(node); } else { m_checkedNodes.remove(node); } changedNodes.add(node); if (b && !isMultiCheck()) { List<ITreeNode> uncheckedNodes = new ArrayList<ITreeNode>(); for (ITreeNode cn : getCheckedNodes()) { if (cn != node) { m_checkedNodes.remove(cn); uncheckedNodes.add(cn); } } break; } } } } if (changedNodes.size() > 0) { fireNodesChecked(changedNodes); } }

Target:
public void setNodesChecked(List<ITreeNode> nodes, boolean b) { if (!isCheckable()) { return; } List<ITreeNode> changedNodes = new ArrayList<ITreeNode>(); for (ITreeNode node : nodes) { node = resolveNode(node); if (node != null) { if (node.isChecked() != b) { if (b) { m_checkedNodes.add(node); } else { m_checkedNodes.remove(node); } changedNodes.add(node); if (b && !isMultiCheck()) { List<ITreeNode> uncheckedNodes = new ArrayList<ITreeNode>(); for (ITreeNode cn : getCheckedNodes()) { if (cn != node) { m_checkedNodes.remove(cn); uncheckedNodes.add(cn); } } break; } } } } if (changedNodes.size() > 0) { fireNodesChecked(changedNodes); } }
Source:
public static Logger getLogger() { Class<?>[] callingClasses = CONTEXT.getCallingClasses(); for (Class<?> callingClass : callingClasses) { String className = callingClass.getName().split("\\$")[0]; if (!className.equals(LoggerFactory.class.getName()) && !className.equals("com.sun.proxy")) { return getLogger(callingClass.getName()); } } Util.report("Failed to detect logger from call stack."); return getLogger(Logger.ROOT_LOGGER_NAME); }

Target:
public static Logger getLogger() { Class<?> autoComputedCallingClass = Util.getCallingClass(); if (autoComputedCallingClass != null) { return getLogger(Util.getCallingClass().getName()); } Util.report("Failed to detect logger name from caller."); return getLogger(Logger.ROOT_LOGGER_NAME); }
Source:
File getScreenshotFile() { String pathOfScreenshot; if (projectAndSceneScreenshotData.sceneName != null) { if (projectAndSceneScreenshotData.isBackpackScene) { pathOfScreenshot = Utils.buildPath(Utils.buildBackpackScenePath(projectAndSceneScreenshotData.sceneName), StageListener.SCREENSHOT_MANUAL_FILE_NAME); } else { pathOfScreenshot = Utils.buildPath(Utils.buildScenePath(projectAndSceneScreenshotData .projectName, projectAndSceneScreenshotData.sceneName), StageListener.SCREENSHOT_MANUAL_FILE_NAME); } } else { pathOfScreenshot = Utils.buildPath(Utils.buildProjectPath(projectAndSceneScreenshotData.projectName), StageListener.SCREENSHOT_MANUAL_FILE_NAME); } File projectAndSceneImageFile = new File(pathOfScreenshot); if (!(projectAndSceneImageFile.exists() && projectAndSceneImageFile.length() > 0)) { projectAndSceneImageFile.delete(); if (projectAndSceneScreenshotData.sceneName != null) { if (projectAndSceneScreenshotData.isBackpackScene) { pathOfScreenshot = Utils.buildPath(Utils.buildBackpackScenePath(projectAndSceneScreenshotData.sceneName), StageListener.SCREENSHOT_AUTOMATIC_FILE_NAME); } else { pathOfScreenshot = Utils.buildPath(Utils.buildScenePath(projectAndSceneScreenshotData .projectName, projectAndSceneScreenshotData.sceneName), StageListener.SCREENSHOT_AUTOMATIC_FILE_NAME); } } else { pathOfScreenshot = Utils.buildPath(Utils.buildProjectPath(projectAndSceneScreenshotData.projectName), StageListener.SCREENSHOT_AUTOMATIC_FILE_NAME); } projectAndSceneImageFile = new File(pathOfScreenshot); } return projectAndSceneImageFile; }

Target:
File getScreenshotFile() { String pathOfManualScreenshot; String pathOfAutomaticScreenshot; if (projectAndSceneScreenshotData.sceneName != null) { if (projectAndSceneScreenshotData.isBackpackScene) { String backpackScenePath = Utils.buildBackpackScenePath(projectAndSceneScreenshotData.sceneName); pathOfManualScreenshot = Utils.buildPath(backpackScenePath, StageListener.SCREENSHOT_MANUAL_FILE_NAME); pathOfAutomaticScreenshot = Utils.buildPath(backpackScenePath, StageListener.SCREENSHOT_AUTOMATIC_FILE_NAME); } else { String scenePath = Utils.buildScenePath(projectAndSceneScreenshotData.projectName, projectAndSceneScreenshotData.sceneName); pathOfManualScreenshot = Utils.buildPath(scenePath, StageListener.SCREENSHOT_MANUAL_FILE_NAME); pathOfAutomaticScreenshot = Utils.buildPath(scenePath, StageListener.SCREENSHOT_AUTOMATIC_FILE_NAME); } } else { String projectPath = Utils.buildProjectPath(projectAndSceneScreenshotData.projectName); pathOfManualScreenshot = Utils.buildPath(projectPath, StageListener.SCREENSHOT_MANUAL_FILE_NAME); pathOfAutomaticScreenshot = Utils.buildPath(projectPath, StageListener.SCREENSHOT_AUTOMATIC_FILE_NAME); } File projectAndSceneImageFile = new File(pathOfManualScreenshot); if (!(projectAndSceneImageFile.exists() && projectAndSceneImageFile.length() > 0)) { projectAndSceneImageFile.delete(); projectAndSceneImageFile = new File(pathOfAutomaticScreenshot); } return projectAndSceneImageFile; }
Source:
protected void write(Schema schema, Object datum, Encoder out) throws IOException { if (datum instanceof Byte) datum = ((Byte)datum).intValue(); else if (datum instanceof Short) datum = ((Short)datum).intValue(); else if (datum instanceof Character) datum = (int)(char)(Character)datum; else if (datum instanceof Map) if (ReflectData.isMapWithNonStringKeysSchema(schema)) { datum = ((Map)datum).entrySet(); } try { super.write(schema, datum, out); } catch (NullPointerException e) { NullPointerException result = new NullPointerException("in "+schema.getFullName()+" "+e.getMessage()); result.initCause(e.getCause() == null ? e : e.getCause()); throw result; } }

Target:
protected void write(Schema schema, Object datum, Encoder out) throws IOException { if (datum instanceof Byte) datum = ((Byte)datum).intValue(); else if (datum instanceof Short) datum = ((Short)datum).intValue(); else if (datum instanceof Character) datum = (int)(char)(Character)datum; else if (datum instanceof Map && ReflectData.isNonStringMapSchema(schema)) { datum = ((Map)datum).entrySet(); } try { super.write(schema, datum, out); } catch (NullPointerException e) { NullPointerException result = new NullPointerException("in "+schema.getFullName()+" "+e.getMessage()); result.initCause(e.getCause() == null ? e : e.getCause()); throw result; } }
Source:
public void visitFileInput(PyFileInputTree pyFileInputTree) { scopesByRootTree = new HashMap<>(); pyFileInputTree.accept(new FirstPhaseVisitor()); pyFileInputTree.accept(new SecondPhaseVisitor()); scopesByRootTree.values().stream() .filter(scope -> scope.rootTree instanceof PyFunctionLikeTree) .forEach(scope -> { PyFunctionLikeTree funcDef = (PyFunctionLikeTree) scope.rootTree; for (TreeSymbol symbol : scope.symbols()) { if (funcDef.is(Kind.LAMBDA)) { ((PyLambdaExpressionTreeImpl) funcDef).addLocalVariableSymbol(symbol); } else { ((PyFunctionDefTreeImpl) funcDef).addLocalVariableSymbol(symbol); } } }); scopesByRootTree.values().stream() .filter(scope -> scope.rootTree instanceof PyClassDefTree) .forEach(scope -> { PyClassDefTreeImpl classDef = (PyClassDefTreeImpl) scope.rootTree; scope.symbols.forEach(classDef::addClassField); scope.instanceAttributesByName.values().forEach(classDef::addInstanceField); }); }

Target:
public void visitFileInput(PyFileInputTree pyFileInputTree) { scopesByRootTree = new HashMap<>(); pyFileInputTree.accept(new FirstPhaseVisitor()); pyFileInputTree.accept(new SecondPhaseVisitor()); scopesByRootTree.values().stream() .filter(scope -> scope.rootTree instanceof PyFunctionLikeTree) .forEach(scope -> { PyFunctionLikeTree funcDef = (PyFunctionLikeTree) scope.rootTree; for (TreeSymbol symbol : scope.symbols()) { if (funcDef.is(Kind.LAMBDA)) { ((PyLambdaExpressionTreeImpl) funcDef).addLocalVariableSymbol(symbol); } else { ((PyFunctionDefTreeImpl) funcDef).addLocalVariableSymbol(symbol); } } }); scopesByRootTree.values().stream() .filter(scope -> scope.rootTree.is(Kind.CLASSDEF)) .forEach(scope -> { PyClassDefTreeImpl classDef = (PyClassDefTreeImpl) scope.rootTree; scope.symbols.forEach(classDef::addClassField); scope.instanceAttributesByName.values().forEach(classDef::addInstanceField); }); }
Source:
private boolean satisfiesFlowThreadsAvailableCriteria() { final int flowThreadsAvailableConfig = this.azkabanProps. getInt(ConfigurationKeys.AZKABAN_POLLING_CRITERIA_FLOW_THREADS_AVAILABLE, 0); if (flowThreadsAvailableConfig <= 0) { return true; } final int remainingFlowThreads = FlowRunnerManager.this.getMaxNumRunningFlows() - FlowRunnerManager.this.getNumRunningFlows(); return remainingFlowThreads > 0; }

Target:
private boolean satisfiesFlowThreadsAvailableCriteria() { final boolean flowThreadsAvailableConfig = this.azkabanProps. getBoolean(ConfigurationKeys.AZKABAN_POLLING_CRITERIA_FLOW_THREADS_AVAILABLE, false); if (!flowThreadsAvailableConfig) { return true; } final int remainingFlowThreads = FlowRunnerManager.this.getMaxNumRunningFlows() - FlowRunnerManager.this.getNumRunningFlows(); final boolean flowThreadsAvailable = remainingFlowThreads > 0; if (this.areFlowThreadsAvailable != flowThreadsAvailable) { this.areFlowThreadsAvailable = flowThreadsAvailable; if (flowThreadsAvailable) { FlowRunnerManager.logger.info("Polling criteria satisfied: available flow threads (" + remainingFlowThreads + ")."); } else { FlowRunnerManager.logger.info("Polling criteria NOT satisfied: available flow threads (" + remainingFlowThreads + ")."); } } return flowThreadsAvailable; }
Source:
public void changeInstanceState( ManagedApplication ma, Instance instance, InstanceStatus newStatus ) throws IOException, TargetException { String instancePath = InstanceHelpers.computeInstancePath( instance ); this.logger.fine( "Trying to change the state of " + instancePath + " to " + newStatus + " in " + ma.getName() + "..." ); checkConfiguration(); if( instance.getParent() == null || "target".equals(instance.getComponent().getInstallerName())) { if( newStatus == InstanceStatus.NOT_DEPLOYED && ( instance.getStatus() == InstanceStatus.DEPLOYED_STARTED || instance.getStatus() == InstanceStatus.DEPLOYING || instance.getStatus() == InstanceStatus.STARTING )) undeployRoot( ma, instance ); else if( instance.getStatus() == InstanceStatus.NOT_DEPLOYED && (newStatus == InstanceStatus.DEPLOYED_STARTED || newStatus == InstanceStatus.DEPLOYED_STOPPED)) deployRoot( ma, instance ); else this.logger.warning( "Ignoring a request to update a root instance's state." ); } else { Map<String,byte[]> instanceResources = null; if( newStatus == InstanceStatus.DEPLOYED_STARTED || newStatus == InstanceStatus.DEPLOYED_STOPPED ) instanceResources = ResourceUtils.storeInstanceResources( ma.getApplicationFilesDirectory(), instance ); MsgCmdChangeInstanceState message = new MsgCmdChangeInstanceState( instance, newStatus, instanceResources ); send( ma, message, instance ); this.logger.fine( "A message was (or will be) sent to the agent to change the state of " + instancePath + " in " + ma.getName() + "." ); } }

Target:
public void changeInstanceState( ManagedApplication ma, Instance instance, InstanceStatus newStatus ) throws IOException, TargetException { String instancePath = InstanceHelpers.computeInstancePath( instance ); this.logger.fine( "Trying to change the state of " + instancePath + " to " + newStatus + " in " + ma.getName() + "..." ); checkConfiguration(); if( instance.getParent() == null ) { if( newStatus == InstanceStatus.NOT_DEPLOYED && ( instance.getStatus() == InstanceStatus.DEPLOYED_STARTED || instance.getStatus() == InstanceStatus.DEPLOYING || instance.getStatus() == InstanceStatus.STARTING )) undeployRoot( ma, instance ); else if( instance.getStatus() == InstanceStatus.NOT_DEPLOYED && newStatus == InstanceStatus.DEPLOYED_STARTED ) deployRoot( ma, instance ); else this.logger.warning( "Ignoring a request to update a root instance's state." ); } else { Map<String,byte[]> instanceResources = null; if( newStatus == InstanceStatus.DEPLOYED_STARTED || newStatus == InstanceStatus.DEPLOYED_STOPPED ) instanceResources = ResourceUtils.storeInstanceResources( ma.getApplicationFilesDirectory(), instance ); MsgCmdChangeInstanceState message = new MsgCmdChangeInstanceState( instance, newStatus, instanceResources ); send( ma, message, instance ); this.logger.fine( "A message was (or will be) sent to the agent to change the state of " + instancePath + " in " + ma.getName() + "." ); } }
Source:
public Comparator<String> nameComparator() { final Map<String, Integer> positions = positions(); return new Comparator<String>() { @Override public int compare(String left, String right) { Integer lp = positions.get(left); Integer rp = positions.get(right); if (lp == null) { return rp != null ? 1 : left.compareTo(right); } else if (rp == null) { return lp != null ? -1 : left.compareTo(right); } else if (lp == rp) { return left.compareTo(right); } else { return lp - rp; } } }; }

Target:
public Comparator<String> nameComparator() { final Map<String, Integer> positions = positions(); return new Comparator<String>() { @Override public int compare(String left, String right) { int lp = position(left); int rp = position(right); int cmp = lp - rp; if (cmp == 0) { cmp = left.compareTo(right); } return cmp; } private int position(String name) { Integer p = positions.get(name); return p != null ? p : positions.size(); } }; }
Source:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_USER_ATTR_DEF); attr.setFriendlyName("login-namespace:surf-ram-persistent-shadow"); attr.setDisplayName("FENIX login"); attr.setType(String.class.getName()); attr.setDescription("Login for FENIX. Do not use it directly! " + "Use \"user:virt:login-namespace:surf-ram-persistent\" attribute instead."); return attr; }

Target:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_USER_ATTR_DEF); attr.setFriendlyName("login-namespace:surf-ram-persistent-shadow"); attr.setDisplayName("SURF RAM login"); attr.setType(String.class.getName()); attr.setDescription("Login for SURF RAM. Do not use it directly! " + "Use \"user:virt:login-namespace:surf-ram-persistent\" attribute instead."); return attr; }
Source:
public String getClassName(String tableName) { String className = tableName.substring(0, 1).toUpperCase() + toCamelCase(tableName.substring(1)); return normalizeJavaName(className); }

Target:
public String getClassName(String tableName) { String className = tableName.substring(0, 1).toUpperCase(Locale.ENGLISH) + toCamelCase(tableName.substring(1)); return normalizeJavaName(className); }