auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LazyFuzzyMatchFnDerivs(Example ex, Callable c, FuzzyMatchFnMode mode, boolean matchAny) { this.ex = ex; if (ex.context != null && ex.context.graph != null && ex.context.graph instanceof FuzzyMatchable) this.matchable = (FuzzyMatchable) ex.context.graph; else this.matchable = null; this.c = c; this.query = (matchAny || c.getChildren().isEmpty()) ? null : c.childStringValue(0); if (c.getRule().rhs.size() == 1 && "$PHRASE".equals(c.getRule().rhs.get(0))) { sentence = ex.getTokens(); } else if (c.getRule().rhs.size() == 1 && "$LEMMA_PHRASE".equals(c.getRule().rhs.get(0))) { sentence = ex.getLemmaTokens(); } else { sentence = null; } this.mode = mode; this.matchAny = matchAny; if (opts.verbose >= 2) LogInfo.logs("FuzzyMatchFn[%s]%s.call: %s", this.mode, (this.matchAny ? "[matchAny]" : ""), this.query); }

Target:
public LazyFuzzyMatchFnDerivs(Example ex, Callable c, FuzzyMatchFnMode mode, boolean matchAny) { this.ex = ex; if (ex.context != null && ex.context.graph != null && ex.context.graph instanceof FuzzyMatchable) this.matchable = (FuzzyMatchable) ex.context.graph; else this.matchable = null; this.c = c; this.query = (matchAny || c.getChildren().isEmpty()) ? null : c.childStringValue(0); if (c.getRule().rhs.size() == 1 && Rule.phraseCat.equals(c.getRule().rhs.get(0))) { sentence = ex.getTokens(); } else if (c.getRule().rhs.size() == 1 && Rule.lemmaPhraseCat.equals(c.getRule().rhs.get(0))) { sentence = ex.getLemmaTokens(); } else { sentence = null; } this.mode = mode; this.matchAny = matchAny; if (opts.verbose >= 2) LogInfo.logs("FuzzyMatchFn[%s]%s.call: %s", this.mode, (this.matchAny ? "[matchAny]" : ""), this.query); }
Source:
public void close() { try { proxy().close(); } catch (ConnectionClosedException | ConnectionShutdownException e) { LOGGER.warn("Store was already closed, since connection was closed"); } }

Target:
public void close() { try { proxy().close(); } catch (ConnectionClosedException | ConnectionShutdownException e) { LOGGER.debug("Store was already closed, since connection was closed"); } }
Source:
private KalturaLiveEntry authenticate(String entryId, int partnerId, String token, KalturaEntryServerNodeType serverIndex) throws KalturaApiException, ClientConnectException, Exception { long currentTime = System.currentTimeMillis(); Object entryLastValidationTime = KalturaEntryDataPersistence.setProperty(entryId, Constants.KALTURA_ENTRY_VALIDATED_TIME, currentTime); KalturaLiveEntry liveEntry = null; if ((entryLastValidationTime == null) || (currentTime - (long) entryLastValidationTime > Constants.KALTURA_MIN_TIME_BETWEEN_AUTHENTICATIONS)) { liveEntry = (KalturaLiveEntry) KalturaAPI.getKalturaAPI().authenticate(entryId, partnerId, token, serverIndex); KalturaEntryDataPersistence.setProperty(entryId, Constants.CLIENT_PROPERTY_KALTURA_LIVE_ENTRY, liveEntry); logger.info("(" + entryId + ") Entry authenticated successfully!"); } else { logger.debug("(" + entryId + ") Entry did not authenticate! Last authentication: [" + (currentTime - (long) entryLastValidationTime) + "] MS ago"); } return liveEntry; }

Target:
private void authenticate(String entryId, int partnerId, String token, KalturaEntryServerNodeType serverIndex) throws KalturaApiException, ClientConnectException, Exception { Object authenticationLock = KalturaEntryDataPersistence.getLock(entryId); synchronized (authenticationLock) { try { logger.debug("(" + entryId + ") Starting authentication process"); if (Boolean.TRUE.equals(KalturaEntryDataPersistence.getPropertyByEntry(entryId, Constants.KALTURA_ENTRY_AUTHENTICATION_ERROR_FLAG))) { throw new Exception("(" + entryId + ") Authentication Error Flag is up!"); } long currentTime = System.currentTimeMillis(); Object entryLastValidationTime = KalturaEntryDataPersistence.setProperty(entryId, Constants.KALTURA_ENTRY_VALIDATED_TIME, currentTime); if ((entryLastValidationTime == null) || (currentTime - (long)entryLastValidationTime > Constants.KALTURA_MIN_TIME_BETWEEN_AUTHENTICATIONS)) { KalturaLiveEntry liveEntry = (KalturaLiveEntry) KalturaAPI.getKalturaAPI().authenticate(entryId, partnerId, token, serverIndex); KalturaEntryDataPersistence.setProperty(entryId, Constants.CLIENT_PROPERTY_KALTURA_LIVE_ENTRY, liveEntry); KalturaEntryDataPersistence.setProperty(entryId, Constants.KALTURA_ENTRY_AUTHENTICATION_ERROR_FLAG, false); logger.info("(" + entryId + ") Entry authenticated successfully!"); } else { logger.debug("(" + entryId + ") Entry did not authenticate! Last authentication: [" + (currentTime - (long)entryLastValidationTime) + "] MS ago"); } } catch (Exception e) { logger.error("(" + entryId + ") Exception was thrown during authentication process"); KalturaEntryDataPersistence.setProperty(entryId, Constants.KALTURA_ENTRY_AUTHENTICATION_ERROR_FLAG, true); KalturaEntryDataPersistence.setProperty(entryId, Constants.KALTURA_ENTRY_VALIDATED_TIME, (long)0); throw e; } } }
Source:
public MenuItem configureMenuItem(Action action, Command command, MenuItem menuItem) { ActionUtils.configureMenuItem(new JabRefAction(action, command, keyBindingRepository, "Menu"), menuItem); setGraphic(menuItem, action); if (command instanceof SimpleCommand) { EasyBind.subscribe( ((SimpleCommand) command).statusMessageProperty(), message -> { Label label = getAssociatedNode(menuItem); if (label != null) { label.setMouseTransparent(false); if (StringUtil.isBlank(message)) { label.setTooltip(null); } else { label.setTooltip(new Tooltip(message)); } } } ); } return menuItem; }

Target:
public MenuItem configureMenuItem(Action action, Command command, MenuItem menuItem) { ActionUtils.configureMenuItem(new JabRefAction(action, command, keyBindingRepository, Sources.FromMenu), menuItem); setGraphic(menuItem, action); if (command instanceof SimpleCommand) { EasyBind.subscribe( ((SimpleCommand) command).statusMessageProperty(), message -> { Label label = getAssociatedNode(menuItem); if (label != null) { label.setMouseTransparent(false); if (StringUtil.isBlank(message)) { label.setTooltip(null); } else { label.setTooltip(new Tooltip(message)); } } } ); } return menuItem; }
Source:
static Assignment deserializeAssignmentV1(ByteBuffer buffer) { Struct struct = ASSIGNMENT_V1.read(buffer); ByteBuffer userData = struct.getBytes(USER_DATA_KEY_NAME); List<TopicPartition> partitions = new ArrayList<>(); for (Object structObj : struct.getArray(TOPIC_PARTITIONS_KEY_NAME)) { Struct assignment = (Struct) structObj; String topic = assignment.getString(TOPIC_KEY_NAME); for (Object partitionObj : assignment.getArray(PARTITIONS_KEY_NAME)) { partitions.add(new TopicPartition(topic, (Integer) partitionObj)); } } ConsumerAssignmentData consumerData = new ConsumerAssignmentData(partitions); return new Assignment(userData, consumerData); }

Target:
static Assignment deserializeAssignmentV1(ByteBuffer buffer) { return deserializeAssignmentV0(buffer); }
Source:
protected void upgradeSystemTables() throws StandardException { try { PartitionAdmin admin = SIDriver.driver().getTableFactory().getAdmin(); if (!admin.tableExists(HBaseConfiguration.MASTER_SNAPSHOTS_TABLE_NAME)) { LOG.info("Creating " + HBaseConfiguration.MASTER_SNAPSHOTS_TABLE_NAME); admin.newPartition().withName(HBaseConfiguration.MASTER_SNAPSHOTS_TABLE_NAME, 100).create(); } if (!admin.tableExists(HBaseConfiguration.REPLICA_REPLICATION_PROGRESS_TABLE_NAME)) { LOG.info("Creating " + HBaseConfiguration.REPLICA_REPLICATION_PROGRESS_TABLE_NAME); admin.newPartition().withName(HBaseConfiguration.REPLICA_REPLICATION_PROGRESS_TABLE_NAME, 100).create(); } } catch (IOException e) { LOG.warn("Exception while creating while creating replication tables", e); } }

Target:
protected void upgradeSystemTables() throws StandardException { try { PartitionAdmin admin = SIDriver.driver().getTableFactory().getAdmin(); if (!admin.tableExists(HBaseConfiguration.MASTER_SNAPSHOTS_TABLE_NAME)) { LOG.info("Creating " + HBaseConfiguration.MASTER_SNAPSHOTS_TABLE_NAME); admin.newPartition().withName(HBaseConfiguration.MASTER_SNAPSHOTS_TABLE_NAME, Conglomerate.Priority.HIGH).create(); } if (!admin.tableExists(HBaseConfiguration.REPLICA_REPLICATION_PROGRESS_TABLE_NAME)) { LOG.info("Creating " + HBaseConfiguration.REPLICA_REPLICATION_PROGRESS_TABLE_NAME); admin.newPartition().withName(HBaseConfiguration.REPLICA_REPLICATION_PROGRESS_TABLE_NAME, Conglomerate.Priority.HIGH).create(); } } catch (IOException e) { LOG.warn("Exception while creating while creating replication tables", e); } }
Source:
protected PathFragment readSymbolicLink(Path path) throws IOException { java.nio.file.Path nioPath = getNioPath(path); try { return PathFragment.create(WindowsFileOperations.readSymlinkOrJunction(nioPath.toString())); } catch (IOException e) { throw e.getMessage().endsWith("path is not a link") ? new NotASymlinkException(path) : e; } }

Target:
protected PathFragment readSymbolicLink(Path path) throws IOException { java.nio.file.Path nioPath = getNioPath(path); WindowsFileOperations.ReadSymlinkOrJunctionResult result = WindowsFileOperations.readSymlinkOrJunction(nioPath.toString()); if (result.getStatus() == WindowsFileOperations.ReadSymlinkOrJunctionResult.Status.OK) { return PathFragment.create(result.getResult()); } if (result.getStatus() == WindowsFileOperations.ReadSymlinkOrJunctionResult.Status.NOT_A_LINK) { throw new NotASymlinkException(path); } throw new IOException(result.getResult()); }
Source:
private static void initializeRealm(Realm realm) { boolean commitChanges = false; try { realm.beginTransaction(); long currentVersion = realm.getVersion(); boolean unversioned = currentVersion == UNVERSIONED; commitChanges = unversioned; if (unversioned) { realm.setVersion(realm.configuration.getSchemaVersion()); } final RealmProxyMediator mediator = realm.configuration.getSchemaMediator(); final Set<Class<? extends RealmModel>> modelClasses = mediator.getModelClasses(); final Map<Class<? extends RealmModel>, ColumnInfo> columnInfoMap = new HashMap<Class<? extends RealmModel>, ColumnInfo>(modelClasses.size()); for (Class<? extends RealmModel> modelClass : modelClasses) { if (unversioned) { mediator.createTable(modelClass, realm.sharedRealm); } columnInfoMap.put(modelClass, mediator.validateTable(modelClass, realm.sharedRealm, false)); } realm.schema.columnIndices = new ColumnIndices( (unversioned) ? realm.configuration.getSchemaVersion() : currentVersion, columnInfoMap); if (unversioned) { final Transaction transaction = realm.configuration.getInitialDataTransaction(); if (transaction != null) { transaction.execute(realm); } } } catch (Exception e) { commitChanges = false; throw new RuntimeException(e); } finally { if (commitChanges) { realm.commitTransaction(); } else { realm.cancelTransaction(); } } }

Target:
private static void initializeRealm(Realm realm) { boolean commitChanges = false; try { realm.beginTransaction(); long currentVersion = realm.getVersion(); boolean unversioned = currentVersion == UNVERSIONED; commitChanges = unversioned; if (unversioned) { realm.setVersion(realm.configuration.getSchemaVersion()); } final RealmProxyMediator mediator = realm.configuration.getSchemaMediator(); final Set<Class<? extends RealmModel>> modelClasses = mediator.getModelClasses(); final Map<Class<? extends RealmModel>, ColumnInfo> columnInfoMap = new HashMap<>(modelClasses.size()); if (unversioned) { for (Class<? extends RealmModel> modelClass : modelClasses) { mediator.createTable(modelClass, realm.sharedRealm); } } for (Class<? extends RealmModel> modelClass : modelClasses) { columnInfoMap.put(modelClass, mediator.validateTable(modelClass, realm.sharedRealm, false)); } realm.schema.columnIndices = new ColumnIndices( (unversioned) ? realm.configuration.getSchemaVersion() : currentVersion, columnInfoMap); if (unversioned) { final Transaction transaction = realm.configuration.getInitialDataTransaction(); if (transaction != null) { transaction.execute(realm); } } } catch (Exception e) { commitChanges = false; throw e; } finally { if (commitChanges) { realm.commitTransaction(); } else { realm.cancelTransaction(); } } }
Source:
protected float getAssignmentScore(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { float doubleEstimatedMaxPartitionCount = 2 * clusterContext.getEstimatedMaxPartitionCount(); return node.getAssignedReplicaCount() / doubleEstimatedMaxPartitionCount; }

Target:
protected float getAssignmentScore(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { return node.getAssignedReplicaCount() / (float) clusterContext.getEstimatedMaxPartitionCount(); }
Source:
public void saveOrder_shouldFailIfConceptInPreviousOrderDoesNotMatchThisConcept() throws Exception { executeDataSet("org/openmrs/api/include/OrderServiceTest-globalProperties.xml"); executeDataSet("org/openmrs/api/include/OrderServiceTest-discontinueReason.xml"); OrderService orderService = Context.getOrderService(); Order order = new Order(); order.setAction(Order.Action.DISCONTINUE); order.setDiscontinuedReasonNonCoded("Discontinue this"); order.setPatient(Context.getPatientService().getPatient(7)); order.setConcept(Context.getConceptService().getConcept(3)); order.setCareSetting(orderService.getCareSetting(1)); order.setStartDate(new Date()); Order previousOrder = orderService.getOrder(111); order.setPreviousOrder(previousOrder); orderService.saveOrder(order); }

Target:
public void saveOrder_shouldFailIfConceptInPreviousOrderDoesNotMatchThisConcept() throws Exception { executeDataSet("org/openmrs/api/include/OrderServiceTest-globalProperties.xml"); OrderService orderService = Context.getOrderService(); Order order = new Order(); order.setAction(Order.Action.DISCONTINUE); order.setDiscontinuedReasonNonCoded("Discontinue this"); order.setPatient(Context.getPatientService().getPatient(7)); order.setConcept(Context.getConceptService().getConcept(3)); order.setCareSetting(orderService.getCareSetting(1)); order.setStartDate(new Date()); Order previousOrder = orderService.getOrder(111); order.setPreviousOrder(previousOrder); orderService.saveOrder(order); }
Source:
public boolean compare(ITmfStateValue source, ITmfStateValue dest, ConditionOperator comparisonOperator) { if (source == null) { throw new IllegalArgumentException(); } switch (comparisonOperator) { case EQ: return (source.compareTo(dest) == 0); case NE: return (source.compareTo(dest) != 0); case GE: return (source.compareTo(dest) >= 0); case GT: return (source.compareTo(dest) > 0); case LE: return (source.compareTo(dest) <= 0); case LT: return (source.compareTo(dest) < 0); case NONE: default: throw new IllegalArgumentException("TmfXmlCondition: invalid comparison operator."); } }

Target:
public boolean compare(ITmfStateValue source, ITmfStateValue dest, ConditionOperator comparisonOperator) { if (source == null || dest == null) { throw new IllegalArgumentException(); } switch (comparisonOperator) { case EQ: return (source.compareTo(dest) == 0); case NE: return (source.compareTo(dest) != 0); case GE: return (source.compareTo(dest) >= 0); case GT: return (source.compareTo(dest) > 0); case LE: return (source.compareTo(dest) <= 0); case LT: return (source.compareTo(dest) < 0); case NONE: default: throw new IllegalArgumentException("TmfXmlCondition: invalid comparison operator."); } }
Source:
public ReferenceSequence getSubsequenceAt(String contig, long start, long stop) { SAMSequenceRecord sequence = sequenceDictionary.getSequence(contig); int referenceIndex = sequence.getSequenceIndex(); byte[] bases; try { ReferenceCacheKey key = new ReferenceCacheKey(Thread.currentThread().getId(), referenceIndex); Reference reference = cachedReferencesByThreads.get(key); if (reference == null) { reference = run.getReference(contig); cachedReferencesByThreads.put(key, reference); } bases = reference.getReferenceBases(start - 1, stop - (start - 1)).getBytes(); } catch (ErrorMsg e) { throw new RuntimeException(e); } return new ReferenceSequence(contig, referenceIndex, bases); }

Target:
public ReferenceSequence getSubsequenceAt(String contig, long start, long stop) { SAMSequenceRecord sequence = sequenceDictionary.getSequence(contig); int referenceIndex = sequence.getSequenceIndex(); byte[] bases; try { HashMap<Integer, Reference> localRefs = cachedReferences.get(); if (localRefs == null) { localRefs = new HashMap<Integer, Reference>(); cachedReferences.set(localRefs); } Reference reference = localRefs.get(referenceIndex); if (reference == null) { reference = run.getReference(contig); localRefs.put(referenceIndex, reference); } bases = reference.getReferenceBases(start - 1, stop - (start - 1)).getBytes(); } catch (ErrorMsg e) { throw new RuntimeException(e); } return new ReferenceSequence(contig, referenceIndex, bases); }
Source:
public int hashCode() { return (((int)m_generation) + ((int)(m_generation >> 32))) + partitionId; }

Target:
public int hashCode() { return (((int)m_generation) + ((int)(m_generation >> 32))) + partitionId + tableName.hashCode(); }
Source:
private Number computeActualValue(Object value) { Object transformedValue = valueTransformer.apply(value); if (isNumeric(transformedValue)) { return transformedValue instanceof Number ? (Number) transformedValue : Float.valueOf(transformedValue.toString()); } return null; }

Target:
private Number computeActualValue(Object value) { Object transformedValue = valueTransformer.apply(value); if (isNumeric(transformedValue)) { return transformedValue instanceof Number ? (Number) transformedValue : Float.valueOf(transformedValue.toString()); } throw new IllegalArgumentException("Only numeric values are supported, enable debug log level for more details."); }
Source:
Mono<DigitalTwinsResponse<String>> getDigitalTwinWithResponse(String digitalTwinId, Context context) { return protocolLayer .getDigitalTwins() .getByIdWithResponseAsync(digitalTwinId, context) .flatMap(response -> { try { String jsonResponse = mapper.writeValueAsString(response.getValue()); DigitalTwinsResponseHeaders twinHeaders = mapper.convertValue(response.getDeserializedHeaders(), DigitalTwinsResponseHeaders.class); return Mono.justOrEmpty(new DigitalTwinsResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), jsonResponse, twinHeaders)); } catch (JsonProcessingException e) { logger.error("JsonProcessingException occurred while retrieving a relationship: ", e); return Mono.error(e); } }); }

Target:
Mono<DigitalTwinsResponse<String>> getDigitalTwinWithResponse(String digitalTwinId, Context context) { return protocolLayer .getDigitalTwins() .getByIdWithResponseAsync(digitalTwinId, context) .flatMap(response -> { try { String jsonResponse = mapper.writeValueAsString(response.getValue()); DigitalTwinsResponseHeaders twinHeaders = mapper.convertValue(response.getDeserializedHeaders(), DigitalTwinsResponseHeaders.class); return Mono.justOrEmpty(new DigitalTwinsResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), jsonResponse, twinHeaders)); } catch (JsonProcessingException e) { logger.error("JsonProcessingException occurred while serializing json object into string: ", e); return Mono.error(e); } }); }
Source:
public void networkMappingsProvidedByParameters() throws Exception { assertThat(validator.networkMappingsProvided("mappings"), isValid()); }

Target:
public void networkMappingsProvidedByParameters() throws Exception { assertThat(validator.networkMappingsProvided(RandomUtils.instance().nextString(10)), isValid()); }
Source:
public void retirePerson(String id) throws ResourceNotFoundException, NotModifiedException { org.openmrs.Person person = Context.getPersonService().getPersonByUuid(id); if (person == null) throw new ResourceNotFoundException(String.format("Person with id '%s' not found", id)); if (person.isPersonVoided()) return; try { person.setVoided(true); person.setPersonVoidedBy(Context.getAuthenticatedUser()); person.setPersonVoidReason("Retired by FHIR Request"); person.setPersonDateVoided(new Date()); Context.getPersonService().voidPerson(person, "Retired by FHIR Request"); } catch (APIException apie) { throw new MethodNotAllowedException(String.format("OpenMRS has failed to retire person '%s': %s", id, apie.getMessage())); } }

Target:
public void retirePerson(String id) throws ResourceNotFoundException, NotModifiedException { org.openmrs.Person person = Context.getPersonService().getPersonByUuid(id); if (person == null) throw new ResourceNotFoundException(String.format("Person with id '%s' not found", id)); if (person.isPersonVoided()) return; try { Context.getPersonService().voidPerson(person, "Voided by FHIR Request"); } catch (APIException apie) { throw new MethodNotAllowedException(String.format("OpenMRS has failed to retire person '%s': %s", id, apie.getMessage())); } }
Source:
public void updatePresentation(@NotNull NodePresentation presentation) { SpanElement spanElement = createSpanElement(styles.styles().presentableTextContainer()); spanElement.setAttribute("file-name", itemPath); spanElement.setAttribute( "occurrence", String.valueOf(searchOccurrence.getLineNumber() + 1) + ":" + searchOccurrence.getLineContent()); SpanElement lineNumberElement = createSpanElement(); lineNumberElement.setInnerHTML( String.valueOf(searchOccurrence.getLineNumber() + 1) + ":&nbsp;&nbsp;&nbsp;"); spanElement.appendChild(lineNumberElement); SpanElement textElement = createSpanElement(); String phrase = searchOccurrence.getPhrase(); String matchedLine = searchOccurrence.getLineContent(); if (matchedLine != null && phrase != null) { String startOfLine = matchedLine.substring(0, matchedLine.indexOf(phrase)); String endOfLine = matchedLine.substring(matchedLine.indexOf(phrase) + phrase.length()); textElement.appendChild(createTextNode(startOfLine)); SpanElement highlightElement = createSpanElement(resources.coreCss().searchMatch()); highlightElement.setInnerText(phrase); textElement.appendChild(highlightElement); textElement.appendChild(createTextNode(endOfLine)); } else { textElement.appendChild(createTextNode("Can't find sources")); } spanElement.appendChild(textElement); presentation.setPresentableIcon(resources.searchMatch()); presentation.setUserElement((Element) spanElement); }

Target:
public void updatePresentation(@NotNull NodePresentation presentation) { SpanElement spanElement = createSpanElement(styles.styles().presentableTextContainer()); spanElement.setAttribute("debugFilePath", itemPath); SpanElement lineNumberElement = createSpanElement(); lineNumberElement.setInnerHTML( String.valueOf(searchOccurrence.getLineNumber() + 1) + ":&nbsp;&nbsp;&nbsp;"); spanElement.appendChild(lineNumberElement); SpanElement textElement = createSpanElement(); String phrase = searchOccurrence.getPhrase(); String matchedLine = searchOccurrence.getLineContent(); if (matchedLine != null && phrase != null) { String startOfLine = matchedLine.substring(0, matchedLine.indexOf(phrase)); String endOfLine = matchedLine.substring(matchedLine.indexOf(phrase) + phrase.length()); textElement.appendChild(createTextNode(startOfLine)); SpanElement highlightElement = createSpanElement(resources.coreCss().searchMatch()); highlightElement.setInnerText(phrase); textElement.appendChild(highlightElement); textElement.appendChild(createTextNode(endOfLine)); } else { textElement.appendChild(createTextNode("Can't find sources")); } spanElement.appendChild(textElement); presentation.setPresentableIcon(resources.searchMatch()); presentation.setUserElement((Element) spanElement); }
Source:
public void run() { if (!node.getClusterService().getClusterState().isJoinAllowed()) { logger.fine("No need to fetch the latest partition table. Cluster state does not allow new members to join."); shouldFetchPartitionTables = false; return; } maxVersion = partitionStateManager.getVersion(); logger.info("Fetching most recent partition table! my version: " + maxVersion); Collection<MigrationInfo> allCompletedMigrations = new HashSet<MigrationInfo>(); Collection<MigrationInfo> allActiveMigrations = new HashSet<MigrationInfo>(); collectAndProcessResults(allCompletedMigrations, allActiveMigrations); logger.info("Most recent partition table version: " + maxVersion); processNewState(allCompletedMigrations, allActiveMigrations); syncPartitionRuntimeState(); }

Target:
public void run() { ClusterState clusterState = node.getClusterService().getClusterState(); if (!clusterState.isMigrationAllowed() && !clusterState.isPartitionPromotionAllowed()) { logger.fine("No need to fetch the latest partition table. " + "Cluster state does not allow to modify partition table."); shouldFetchPartitionTables = false; return; } maxVersion = partitionStateManager.getVersion(); logger.info("Fetching most recent partition table! my version: " + maxVersion); Collection<MigrationInfo> allCompletedMigrations = new HashSet<MigrationInfo>(); Collection<MigrationInfo> allActiveMigrations = new HashSet<MigrationInfo>(); collectAndProcessResults(allCompletedMigrations, allActiveMigrations); logger.info("Most recent partition table version: " + maxVersion); processNewState(allCompletedMigrations, allActiveMigrations); syncPartitionRuntimeState(); }
Source:
public Update createStatement(String sql) { return new Update(this, statementLocator, statementRewriter, statementBuilder, sql, new ConcreteStatementContext(globalStatementAttributes, MappingRegistry.copyOf(mappingRegistry)), timingCollector, foreman, containerFactoryRegistry); }

Target:
public Update createStatement(String sql) { return new Update(this, statementLocator, statementRewriter, statementBuilder, sql, new ConcreteStatementContext(globalStatementAttributes, MappingRegistry.copyOf(mappingRegistry)), timingCollector, foreman, collectorFactoryRegistry); }
Source:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { if (StringUtils.isNotBlank((String) config.get("refresh"))) { refreshInterval = Long.parseLong((String) config.get("refresh")); } setProperlyConfigured(true); } Set<String> configuredDevices = getConfiguredDevices(config); for(String configuredDevice : configuredDevices){ String value = (String) config.get(configuredDevice + "." + SmlReaderConstants.Configuration.CONFIGURATION_KEY_CONNECTION_TYPE); ConnectionType connectionType = ConnectionType.notConfigured; try{ connectionType = ConnectionType.valueOf(value); }catch(IllegalArgumentException | NullPointerException e){ logger.error("The connection type of device '" + configuredDevice + "# is invalid."); setProperlyConfigured(false); break; } if(connectionType == ConnectionType.serial){ createFromSerialConfigurationSettings(configuredDevice, config); } else if(connectionType == ConnectionType.tsap){ createFromTsapConfigurationSettings(configuredDevice, config); } else{ logger.info("There is no device configured to read SML messages from."); setProperlyConfigured(false); break; } } }

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { if (StringUtils.isNotBlank((String) config.get("refresh"))) { refreshInterval = Long.parseLong((String) config.get("refresh")); } } Enumeration<String> keys = config.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); if ("service.pid".equals(key) || "refresh".equals(key)) { continue; } Matcher matcher = SmlReaderConstants.CONFIGURATION_PATTERN.matcher(key); if(!matcher.matches()) { logger.debug("given config key doesn't match a valid binding config.", key); continue; } matcher.reset(); while (matcher.find()) { String deviceId = matcher.group(1); String serialPort = (String) config.get(deviceId + "." + SmlReaderConstants.CONFIGURATION_KEY_SERIALPORT); if(serialPort == null || serialPort.isEmpty()) serialPort = SmlReaderConstants.DEFAULT_SERIAL_PORT; smlDevices.put(deviceId, SmlDevice.createInstance(deviceId, serialPort)); } } setProperlyConfigured(true); }
Source:
public void propertyChange(PropertyChangeEvent event) { String propertyName = event.getPropertyName(); if (!(event.getSource() instanceof CandidatePair)) { return; } CandidatePair pair = (CandidatePair) event.getSource(); if (!pair.getParentComponent().equals(component)) { return; } if (IceMediaStream.PROPERTY_PAIR_STATE_CHANGED.equals(propertyName)) { CandidatePairState newState = (CandidatePairState) event.getNewValue(); if (CandidatePairState.SUCCEEDED.equals(newState)) { addAuthorizedAddress( pair.getRemoteCandidate().getTransportAddress()); } } else if (IceMediaStream.PROPERTY_PAIR_NOMINATED.equals(propertyName)) { if (initializedActive) { return; } initializedActive = true; LocalCandidate localCandidate = pair.getLocalCandidate(); LocalCandidate base = localCandidate.getBase(); if (base != null) localCandidate = base; TransportAddress remoteAddress = null; RemoteCandidate remoteCandidate = pair.getRemoteCandidate(); if (remoteCandidate != null) { remoteAddress = remoteCandidate.getTransportAddress(); } IceSocketWrapper socketWrapper = localCandidate.getCandidateIceSocketWrapper(remoteAddress); initializeActive(socketWrapper, remoteAddress); } }

Target:
public void propertyChange(PropertyChangeEvent event) { if (!(event.getSource() instanceof CandidatePair)) { return; } CandidatePair pair = (CandidatePair) event.getSource(); if (!pair.getParentComponent().equals(component)) { return; } String propertyName = event.getPropertyName(); if (IceMediaStream.PROPERTY_PAIR_STATE_CHANGED.equals(propertyName)) { CandidatePairState newState = (CandidatePairState) event.getNewValue(); if (CandidatePairState.SUCCEEDED.equals(newState)) { addAuthorizedAddress( pair.getRemoteCandidate().getTransportAddress()); } } else if (IceMediaStream.PROPERTY_PAIR_NOMINATED.equals(propertyName)) { synchronized (initializedActiveSyncRoot) { if (initializedActive) { return; } LocalCandidate localCandidate = pair.getLocalCandidate(); LocalCandidate base = localCandidate.getBase(); if (base != null) localCandidate = base; TransportAddress remoteAddress = null; RemoteCandidate remoteCandidate = pair.getRemoteCandidate(); if (remoteCandidate != null) { remoteAddress = remoteCandidate.getTransportAddress(); } IceSocketWrapper socketWrapper = localCandidate .getCandidateIceSocketWrapper(remoteAddress); initializeActive(socketWrapper, remoteAddress); initializedActive = true; } } }
Source:
protected String[] customCommandLineValidation() { final List<String> values = new ArrayList<>(); checkTagValue("RGID", RGID).ifPresent(values::add); checkTagValue("RGLB", RGLB).ifPresent(values::add); checkTagValue("RGPL", RGPL).ifPresent(values::add); checkTagValue("RGPU", RGPU).ifPresent(values::add); checkTagValue("RGSM", RGSM).ifPresent(values::add); checkTagValue("RGCN", RGCN).ifPresent(values::add); checkTagValue("RGDS", RGDS).ifPresent(values::add); checkTagValue("RGKS", RGKS).ifPresent(values::add); checkTagValue("RGFO", RGFO).ifPresent(values::add); checkTagValue("RGPG", RGPG).ifPresent(values::add); checkTagValue("RGPM", RGPM).ifPresent(values::add); if (!values.isEmpty()) { return values.toArray(new String[values.size()]); } return super.customCommandLineValidation(); }

Target:
protected String[] customCommandLineValidation() { final List<String> validationFailures = new ArrayList<>(); checkTagValue("RGID", RGID).ifPresent(validationFailures::add); checkTagValue("RGLB", RGLB).ifPresent(validationFailures::add); checkTagValue("RGPL", RGPL).ifPresent(validationFailures::add); checkTagValue("RGPU", RGPU).ifPresent(validationFailures::add); checkTagValue("RGSM", RGSM).ifPresent(validationFailures::add); checkTagValue("RGCN", RGCN).ifPresent(validationFailures::add); checkTagValue("RGDS", RGDS).ifPresent(validationFailures::add); checkTagValue("RGKS", RGKS).ifPresent(validationFailures::add); checkTagValue("RGFO", RGFO).ifPresent(validationFailures::add); checkTagValue("RGPG", RGPG).ifPresent(validationFailures::add); checkTagValue("RGPM", RGPM).ifPresent(validationFailures::add); if (!validationFailures.isEmpty()) { return validationFailures.toArray(new String[validationFailures.size()]); } return super.customCommandLineValidation(); }
Source:
static List<FormTable> getPageTables(PageResult pageResultItem, List<ReadResult> readResults, Integer pageNumber) { List<FormTable> extractedTablesList = new ArrayList<>(); pageResultItem.getTables().forEach(dataTable -> { IterableStream<FormTableCell> tableCellList = new IterableStream<>(dataTable.getCells().stream() .map(dataTableCell -> new FormTableCell( dataTableCell.getRowIndex(), dataTableCell.getColumnIndex(), dataTableCell.getRowSpan(), dataTableCell.getColumnSpan(), dataTableCell.getText(), toBoundingBox(dataTableCell.getBoundingBox()), dataTableCell.getConfidence(), dataTableCell.isHeader() == null ? false : dataTableCell.isHeader(), dataTableCell.isFooter() == null ? false : dataTableCell.isFooter(), pageNumber, setReferenceElements(dataTableCell.getElements(), readResults, pageNumber) )) .collect(Collectors.toList())); FormTable extractedTable = new FormTable(dataTable.getRows(), dataTable.getColumns(), tableCellList); extractedTablesList.add(extractedTable); }); return extractedTablesList; }

Target:
static List<FormTable> getPageTables(PageResult pageResultItem, List<ReadResult> readResults, Integer pageNumber) { return pageResultItem.getTables().stream() .map(dataTable -> new FormTable(dataTable.getRows(), dataTable.getColumns(), new IterableStream<>(dataTable.getCells().stream() .map(dataTableCell -> new FormTableCell( dataTableCell.getRowIndex(), dataTableCell.getColumnIndex(), dataTableCell.getRowSpan(), dataTableCell.getColumnSpan(), dataTableCell.getText(), toBoundingBox(dataTableCell.getBoundingBox()), dataTableCell.getConfidence(), dataTableCell.isHeader() == null ? false : dataTableCell.isHeader(), dataTableCell.isFooter() == null ? false : dataTableCell.isFooter(), pageNumber, setReferenceElements(dataTableCell.getElements(), readResults, pageNumber))) .collect(Collectors.toList())))) .collect(Collectors.toList()); }
Source:
protected void configure() { if (Boolean.valueOf(System.getenv("CHE_METRICS_ENABLED"))) { if (Boolean.valueOf(System.getenv("CHE_TRACING_ENABLED"))) { bind(ExecutorServiceWrapper.class) .to(MeteredAndTracedExecutorServiceWrapper.class) .asEagerSingleton(); } else { bind(ExecutorServiceWrapper.class) .to(MeteredExecutorServiceWrapper.class) .asEagerSingleton(); ; } } else { if (Boolean.valueOf(System.getenv("CHE_TRACING_ENABLED"))) { bind(ExecutorServiceWrapper.class) .to(TracedExecutorServiceWrapper.class) .asEagerSingleton(); ; } else { bind(ExecutorServiceWrapper.class).to(NoopExecutorServiceWrapper.class).asEagerSingleton(); ; } } bind(ThreadPullLauncher.class).to(ObservableThreadPullLauncher.class); }

Target:
protected void configure() { if (Boolean.parseBoolean(System.getenv("CHE_METRICS_ENABLED"))) { if (Boolean.parseBoolean(System.getenv("CHE_TRACING_ENABLED"))) { bind(ExecutorServiceWrapper.class) .to(MeteredAndTracedExecutorServiceWrapper.class) .asEagerSingleton(); } else { bind(ExecutorServiceWrapper.class) .to(MeteredExecutorServiceWrapper.class) .asEagerSingleton(); } } else { if (Boolean.parseBoolean(System.getenv("CHE_TRACING_ENABLED"))) { bind(ExecutorServiceWrapper.class) .to(TracedExecutorServiceWrapper.class) .asEagerSingleton(); } else { bind(ExecutorServiceWrapper.class).to(NoopExecutorServiceWrapper.class).asEagerSingleton(); } } bind(ThreadPullLauncher.class).to(ObservableThreadPullLauncher.class); }
Source:
public void addField(String name, Object value) { if (name == null) { throw new NullPointerException("name"); } if (value == null) { throw new NullPointerException("value"); } try { if (value instanceof Iterable) { addFieldIterable(name, (Iterable) value); } else if (value.getClass().isArray()) { Iterable arrayAsList = Arrays.asList((Object[]) value); addFieldIterable(name, arrayAsList); } else { addFieldString(name, value.toString()); } } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public void addField(String name, Object value) { if (name == null) { throw new NullPointerException("name"); } if (value == null) { throw new NullPointerException("value"); } try { if (value instanceof Iterable) { addFieldIterable(name, (Iterable) value); } else if (value.getClass().isArray()) { addFieldArray(name, value); } else { addFieldString(name, value.toString()); } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
Map<String, Object> constructRequestArgs() { Map<String, Object> queryArgs = new HashMap<String, Object>(); if (eventCollection != null) { queryArgs.put(KeenQueryConstants.EVENT_COLLECTION, eventCollection); } if (interval != null) { queryArgs.put(KeenQueryConstants.INTERVAL, interval); } if (groupBy != null) { queryArgs.put(KeenQueryConstants.GROUP_BY, groupBy); } if (maxAge != null) { queryArgs.put(KeenQueryConstants.MAX_AGE, maxAge); } if (targetProperty != null) { queryArgs.put(KeenQueryConstants.TARGET_PROPERTY, targetProperty); } if (percentile != null) { queryArgs.put(KeenQueryConstants.PERCENTILE, percentile); } if (filters != null) { queryArgs.put(KeenQueryConstants.FILTERS, filters.constructParameterRequestArgs()); } if (timeframe != null) { queryArgs.putAll(timeframe.constructTimeframeArgs()); } return queryArgs; }

Target:
Map<String, Object> constructRequestArgs() { Map<String, Object> queryArgs = new HashMap<String, Object>(); if (eventCollection != null) { queryArgs.put(KeenQueryConstants.EVENT_COLLECTION, eventCollection); } if (interval != null) { queryArgs.put(KeenQueryConstants.INTERVAL, interval); } if (timezone != null) { queryArgs.put(KeenQueryConstants.TIMEZONE, timezone); } if (groupBy != null) { queryArgs.put(KeenQueryConstants.GROUP_BY, groupBy); } if (maxAge != null) { queryArgs.put(KeenQueryConstants.MAX_AGE, maxAge); } if (targetProperty != null) { queryArgs.put(KeenQueryConstants.TARGET_PROPERTY, targetProperty); } if (percentile != null) { queryArgs.put(KeenQueryConstants.PERCENTILE, percentile); } if (filters != null) { queryArgs.put(KeenQueryConstants.FILTERS, filters.constructParameterRequestArgs()); } if (timeframe != null) { queryArgs.putAll(timeframe.constructTimeframeArgs()); } return queryArgs; }
Source:
private void checkWeekProfileMapping(final WeekProfile weekProfile) { assertEquals("weekProfile1", weekProfile.getWeekProfileName()); this.checkDayTypeMapping(weekProfile.getSunday()); this.checkDayTypeMapping(weekProfile.getMonday()); this.checkDayTypeMapping(weekProfile.getTuesday()); this.checkDayTypeMapping(weekProfile.getWednesday()); this.checkDayTypeMapping(weekProfile.getThursday()); this.checkDayTypeMapping(weekProfile.getFriday()); this.checkDayTypeMapping(weekProfile.getSaturday()); }

Target:
private void checkWeekProfileMapping(final WeekProfile weekProfile) { assertNotNull(weekProfile); assertEquals(WEEKPROFILENAME, weekProfile.getWeekProfileName()); this.checkDayTypeMapping(weekProfile.getSunday()); this.checkDayTypeMapping(weekProfile.getMonday()); this.checkDayTypeMapping(weekProfile.getTuesday()); this.checkDayTypeMapping(weekProfile.getWednesday()); this.checkDayTypeMapping(weekProfile.getThursday()); this.checkDayTypeMapping(weekProfile.getFriday()); this.checkDayTypeMapping(weekProfile.getSaturday()); }
Source:
public void testGenerateToolTipText() throws FileNotFoundException { VirtualFile myFile = myFixture.copyFileToProject("themeEditor/styles_1.xml", "res/values/styles.xml"); myFixture.copyFileToProject("themeEditor/attrs.xml", "res/values/attrs.xml"); ConfigurationManager configurationManager = ConfigurationManager.create(myModule); Configuration configuration = configurationManager.getConfiguration(myFile); ThemeResolver themeResolver = new ThemeResolver(configuration); ThemeEditorStyle theme = themeResolver.getTheme("@style/AppTheme"); assert theme != null; Collection<ItemResourceValue> values = theme.getValues(); assertEquals(values.size(), 6); for (ItemResourceValue item : values) { String doc = ThemeEditorUtils.generateToolTipText(item, myModule, configuration); assertNotNull(doc); compareWithAns(doc, myFixture.getTestDataPath() + "/themeEditor/tooltipDocAns/" + item.getName() + ".ans"); } }

Target:
public void testGenerateToolTipText() throws FileNotFoundException { VirtualFile myFile = myFixture.copyFileToProject("themeEditor/styles_1.xml", "res/values/styles.xml"); myFixture.copyFileToProject("themeEditor/attrs.xml", "res/values/attrs.xml"); Configuration configuration = myFacet.getConfigurationManager().getConfiguration(myFile); ThemeResolver themeResolver = new ThemeResolver(configuration); ThemeEditorStyle theme = themeResolver.getTheme("@style/AppTheme"); assertNotNull(theme); Collection<ItemResourceValue> values = theme.getValues(); assertEquals(6, values.size()); for (ItemResourceValue item : values) { String doc = ThemeEditorUtils.generateToolTipText(item, myModule, configuration); compareWithAns(doc, myFixture.getTestDataPath() + "/themeEditor/tooltipDocAns/" + item.getName() + ".ans"); } }
Source:
public void addRoutingTableChangeListener( final RoutingTableChangeListener routingTableChangeListener, Object context, boolean isTriggerCallback) { _routingTableChangeListenerMap.put(routingTableChangeListener, new ListenerContext(context)); logger.info("Attach RoutingTableProviderChangeListener {}.", routingTableChangeListener.getClass().getName(), isTriggerCallback); if (isTriggerCallback) { logger.info("The isTriggerCallback value for the listener is true"); final NotificationContext periodicRefreshContext = new NotificationContext(_helixManager); periodicRefreshContext.setType(NotificationContext.Type.PERIODIC_REFRESH); _routerUpdater.queueEvent(periodicRefreshContext, ClusterEventType.PeriodicalRebalance, null); } }

Target:
public void addRoutingTableChangeListener( final RoutingTableChangeListener routingTableChangeListener, Object context, boolean isTriggerCallback) { _routingTableChangeListenerMap.put(routingTableChangeListener, new ListenerContext(context)); logger.info("Attach RoutingTableProviderChangeListener {}.", routingTableChangeListener.getClass().getName()); if (isTriggerCallback) { logger.info("Force triggering a callback for the new listener in routing table provider"); final NotificationContext periodicRefreshContext = new NotificationContext(_helixManager); periodicRefreshContext.setType(NotificationContext.Type.PERIODIC_REFRESH); _routerUpdater.queueEvent(periodicRefreshContext, ClusterEventType.PeriodicalRebalance, null); } }
Source:
public void mutate(List<Cell> rawList, List<TxnView> txns, List<Cell> results) throws IOException { final boolean dataToReturnIsEmpty = dataToReturn.isEmpty(); final boolean resultsIsEmpty = results.isEmpty(); final boolean maxTombstoneIsNull = maxTombstone == null; final boolean rawListAndTxnListSameSize = rawList.size() == txns.size(); final boolean debugSortCheck = !LOG.isDebugEnabled() || isSorted(rawList); if (!debugSortCheck) { bypassPurge = true; LOG.warn("Skipping tombstone purge. rawList is not sorted."); } if (!dataToReturnIsEmpty) { bypassPurge = true; LOG.warn("Skipping tombstone purge. dataToReturn is not properly initialized."); } if (!resultsIsEmpty) { bypassPurge = true; LOG.warn("Skipping tombstone purge. results list not properly initialized."); } if (!maxTombstoneIsNull) { bypassPurge = true; LOG.warn("Skipping tombstone purge. maxTombstone not properly initialized to null."); } if (!rawListAndTxnListSameSize) { bypassPurge = true; LOG.warn("Skipping tombstone purge. rawList and txn list not the same length."); } assert dataToReturnIsEmpty; assert resultsIsEmpty; assert maxTombstoneIsNull; assert debugSortCheck : "CompactionStateMutate: rawList not sorted"; assert rawListAndTxnListSameSize; try { Iterator<TxnView> it = txns.iterator(); for (Cell aRawList : rawList) { TxnView txn = it.next(); mutate(aRawList, txn); } Stream<Cell> stream = dataToReturn.stream(); if (shouldPurgeDeletes()) stream = stream.filter(not(this::purgeableDeletedRow)); if (shouldPurgeUpdates()) stream = stream.filter(not(this::purgeableOldUpdate)); stream.forEachOrdered(results::add); assert !LOG.isDebugEnabled() || isSorted(results) : "CompactionStateMutate: results not sorted"; } catch (AssertionError e) { LOG.error(e); LOG.error(rawList.toString()); LOG.error(txns.toString()); throw e; } }

Target:
public long mutate(List<Cell> rawList, List<TxnView> txns, List<Cell> results) throws IOException { handleSanityChecks(results, rawList, txns); long totalSize = 0; try { Iterator<TxnView> it = txns.iterator(); for (Cell cell : rawList) { totalSize += KeyValueUtil.length(cell); TxnView txn = it.next(); mutate(cell, txn); } Stream<Cell> stream = dataToReturn.stream(); if (shouldPurgeDeletes()) stream = stream.filter(not(this::purgeableDeletedRow)); if (shouldPurgeUpdates()) stream = stream.filter(not(this::purgeableOldUpdate)); stream.forEachOrdered(results::add); final boolean debugSortCheck = !LOG.isDebugEnabled() || isSorted(results); if (!debugSortCheck) setBypassPurgeWithWarning("CompactionStateMutate: results not sorted."); assert debugSortCheck : "CompactionStateMutate: results not sorted"; return totalSize; } catch (AssertionError e) { LOG.error(e); LOG.error(rawList.toString()); LOG.error(txns.toString()); throw e; } }
Source:
public void populateKeyFields() { this.keys = keyFieldStr.split(","); }

Target:
private void populateKeyFields() { leftStore.setKeys(keyFieldStr.split(",")[0]); rightStore.setKeys(keyFieldStr.split(",")[1]); }
Source:
private Set<SitemapEvent> constructSitemapEvents(Item item, List<Widget> widgets) { Set<SitemapEvent> events = new HashSet<>(); for (Widget w : widgets) { if (w instanceof Frame) { events.addAll(constructSitemapEvents(item, itemUIRegistry.getChildren((Frame) w))); } if (w.getItem() != null && w.getItem().equals(item.getName())) { boolean skipWidget = false; if (w instanceof Chart) { Chart chartWidget = (Chart) w; skipWidget = chartWidget.getRefresh() > 0; } if (!skipWidget || definesVisibility(w, item.getName())) { SitemapWidgetEvent event = new SitemapWidgetEvent(); event.sitemapName = sitemapName; event.pageId = pageId; event.label = itemUIRegistry.getLabel(w); event.labelcolor = itemUIRegistry.getLabelColor(w); event.valuecolor = itemUIRegistry.getValueColor(w); event.widgetId = itemUIRegistry.getWidgetId(w); event.visibility = itemUIRegistry.getVisiblity(w); String widgetTypeName = w.eClass().getInstanceTypeName() .substring(w.eClass().getInstanceTypeName().lastIndexOf(".") + 1); boolean drillDown = "mapview".equalsIgnoreCase(widgetTypeName); Predicate<Item> itemFilter = (i -> i.getType().equals(CoreItemFactory.LOCATION)); event.item = EnrichedItemDTOMapper.map(item, drillDown, itemFilter, null, null); event.state = itemUIRegistry.getState(w).toFullString(); if (event.state != null && event.state.equals(event.item.state)) { event.state = null; } events.add(event); } } } return events; }

Target:
private Set<SitemapEvent> constructSitemapEvents(Item item, List<Widget> widgets) { Set<SitemapEvent> events = new HashSet<>(); for (Widget w : widgets) { if (w instanceof Frame) { events.addAll(constructSitemapEvents(item, itemUIRegistry.getChildren((Frame) w))); } if (w.getItem() != null && w.getItem().equals(item.getName())) { boolean skipWidget = false; if (w instanceof Chart) { Chart chartWidget = (Chart) w; skipWidget = chartWidget.getRefresh() > 0; } if (!skipWidget || definesVisibilityOrColor(w, item.getName())) { SitemapWidgetEvent event = new SitemapWidgetEvent(); event.sitemapName = sitemapName; event.pageId = pageId; event.label = itemUIRegistry.getLabel(w); event.labelcolor = itemUIRegistry.getLabelColor(w); event.valuecolor = itemUIRegistry.getValueColor(w); event.widgetId = itemUIRegistry.getWidgetId(w); event.visibility = itemUIRegistry.getVisiblity(w); String widgetTypeName = w.eClass().getInstanceTypeName() .substring(w.eClass().getInstanceTypeName().lastIndexOf(".") + 1); boolean drillDown = "mapview".equalsIgnoreCase(widgetTypeName); Predicate<Item> itemFilter = (i -> i.getType().equals(CoreItemFactory.LOCATION)); event.item = EnrichedItemDTOMapper.map(item, drillDown, itemFilter, null, null); event.state = itemUIRegistry.getState(w).toFullString(); if (event.state != null && event.state.equals(event.item.state)) { event.state = null; } events.add(event); } } } return events; }
Source:
public static LockManager getInstance() { if (lockManager == null) { lockManager = new LockManager(); } return lockManager; }

Target:
public static LockManager getInstance() { return lockManager; }