auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static String getPaddedMilliseconds(String milliseconds) { milliseconds = milliseconds == null ? "" : milliseconds; if (milliseconds.length() == MILLISECOND_PRECISION) return milliseconds; else if (milliseconds.length() > MILLISECOND_PRECISION) return milliseconds.substring(0, MILLISECOND_PRECISION); else { int digitsToAdd = MILLISECOND_PRECISION - milliseconds.length(); char[] zeroes = new char[digitsToAdd]; Arrays.fill(zeroes, '0'); return milliseconds + new String(zeroes); } }

Target:
private static String getPaddedMilliseconds(String milliseconds) { milliseconds = milliseconds == null ? "" : milliseconds; if (milliseconds.length() == MILLISECOND_PRECISION) { return milliseconds; } else if (milliseconds.length() > MILLISECOND_PRECISION) { return milliseconds.substring(0, MILLISECOND_PRECISION); } else { int digitsToAdd = MILLISECOND_PRECISION - milliseconds.length(); char[] zeroes = new char[digitsToAdd]; Arrays.fill(zeroes, '0'); return milliseconds + new String(zeroes); } }
Source:
public synchronized static Map<String, String> getTasksMap() { return tasksmap; }

Target:
public static Map<String, String> getTasksMap() { return tasksmap; }
Source:
public static void setupMDC(String service) { MDC.put("dt.service", service); String value = StramClientUtils.getHostName(); MDC.put("dt.node", value == null ? "unknown" : value); value = System.getenv(ApplicationConstants.Environment.USER.name()); if (value != null) { MDC.put("dt.user", value); } value = System.getenv(ApplicationConstants.Environment.CONTAINER_ID.name()); if (value != null) { ContainerId containerId = ConverterUtils.toContainerId(value); ApplicationId applicationId = containerId.getApplicationAttemptId().getApplicationId(); MDC.put("dt.containerId", containerId.toString()); MDC.put("dt.applicationId", applicationId.toString()); } value = System.getProperty(APPLICATION_NAME.getLongName()); if (value != null) { MDC.put("dt.application", value); } }

Target:
public static void setupMDC(String service) { MDC.put("apex.service", service); String value = StramClientUtils.getHostName(); MDC.put("apex.node", value == null ? "unknown" : value); value = System.getenv(Environment.USER.key()); if (value != null) { MDC.put("apex.user", value); } value = System.getenv(Environment.CONTAINER_ID.name()); if (value != null) { ContainerId containerId = ConverterUtils.toContainerId(value); ApplicationId applicationId = containerId.getApplicationAttemptId().getApplicationId(); MDC.put("apex.containerId", containerId.toString()); MDC.put("apex.applicationId", applicationId.toString()); } value = System.getProperty(APPLICATION_NAME.getLongName()); if (value != null) { MDC.put("apex.application", value); } }
Source:
static SearchServiceUrlParts parseServiceUrlParts(String endpoint) { ClientLogger logger = new ClientLogger(SearchServiceUrlParser.class); if (StringUtils.isBlank(endpoint)) { throw logger.logExceptionAsError( new IllegalArgumentException("Illegal endpoint URL: endpoint cannot be blank")); } URL url; try { url = new URL(endpoint); } catch (MalformedURLException exc) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: " + exc.getMessage())); } String extractedHost = url.getHost(); if (StringUtils.isBlank(extractedHost) || extractedHost.startsWith(".") || extractedHost.endsWith(".")) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: invalid host")); } String[] tokens = StringUtils.split(extractedHost, "."); if ((tokens.length < 3) || (StringUtils.isBlank(tokens[0]))) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: invalid host")); } String serviceName = tokens[0]; int index = StringUtils.indexOf(extractedHost, "."); String searchDnsSuffix = extractedHost.substring(index + 1); return new SearchServiceUrlParts(serviceName, searchDnsSuffix); }

Target:
static SearchServiceUrlParts parseServiceUrlParts(String endpoint) { ClientLogger logger = new ClientLogger(SearchServiceUrlParser.class); URL url; try { url = new URL(endpoint); } catch (MalformedURLException exc) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: " + exc.getMessage())); } String extractedHost = url.getHost(); if (CoreUtils.isNullOrEmpty(extractedHost) || extractedHost.startsWith(".") || extractedHost.endsWith(".")) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: invalid host")); } String[] tokens = extractedHost.split("\\."); if ((tokens.length < 3) || (CoreUtils.isNullOrEmpty(tokens[0]))) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: invalid host")); } String serviceName = tokens[0]; int index = extractedHost.indexOf("."); String searchDnsSuffix = extractedHost.substring(index + 1); return new SearchServiceUrlParts(serviceName, searchDnsSuffix); }
Source:
public void testPutAll() throws Exception { final Map<String, String> originalStoreContent = getEntryMap(KEY_SET_A, KEY_SET_B); final FakeStore fakeStore = new FakeStore(originalStoreContent); this.store = spy(fakeStore); final Map<String, String> originalWriterContent = getEntryMap(KEY_SET_A, KEY_SET_B, KEY_SET_C); final FakeCacheLoaderWriter fakeLoaderWriter = new FakeCacheLoaderWriter(originalWriterContent); this.cacheLoaderWriter = spy(fakeLoaderWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter); final Map<String, String> contentUpdates = getAltEntryMap("new_", fanIn(KEY_SET_A, KEY_SET_C, KEY_SET_D)); ehcache.putAll(contentUpdates); verify(testCacheEventListener,times(18)).onEvent(argThat(isCreatedOrUpdated)); }

Target:
public void testPutAll() throws Exception { final Map<String, String> originalStoreContent = getEntryMap(KEY_SET_A, KEY_SET_B); final FakeStore fakeStore = new FakeStore(originalStoreContent); this.store = spy(fakeStore); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter); final Map<String, String> contentUpdates = getAltEntryMap("new_", fanIn(KEY_SET_A, KEY_SET_C, KEY_SET_D)); ehcache.putAll(contentUpdates); verify(cacheEventListener,times(18)).onEvent(argThat(isCreatedOrUpdated)); try { ehcache.getRuntimeConfiguration().deregisterCacheEventListener(cacheEventListener); fail(); } catch (UnsupportedOperationException e){ } }
Source:
private void changeDeck(int selectedDeck) { List<Card> cards = new ArrayList<>(); try { mNewDid = mDropDownDecks.get(selectedDeck).getLong("id"); } catch (JSONException e) { e.printStackTrace(); return; } for (int cardPosition : mCheckedCardPositions) { final Card card = getCol().getCard(Long.parseLong(getCards().get(cardPosition).get("id"))); cards.add(card); } List<Card> changedCards = new ArrayList<>(); for (Card card : cards) { if (card.getDid() != mNewDid) { changedCards.add(card); mReloadRequired = true; } } if (changedCards.isEmpty()) { endMultiSelectMode(); mCardsAdapter.notifyDataSetChanged(); return; } DeckTask.launchDeckTask(DeckTask.TASK_TYPE_DISMISS_MULTI, mChangeMultiHandler, new DeckTask.TaskData(new Object[]{changedCards.toArray(new Card[changedCards.size()]), Collection.DismissType.CHANGE_DECK_MULTI, mNewDid})); }

Target:
private void changeDeck(int selectedDeck) { long[] ids = getSelectedCardIds(); try { mNewDid = mDropDownDecks.get(selectedDeck).getLong("id"); } catch (JSONException e) { throw new RuntimeException(e); } if (ids.length == 0) { endMultiSelectMode(); mCardsAdapter.notifyDataSetChanged(); return; } if (CardUtils.isIn(ids, getReviewerCardId())) { mReloadRequired = true; } DeckTask.launchDeckTask(DeckTask.TASK_TYPE_DISMISS_MULTI, mChangeDeckHandler, new DeckTask.TaskData(new Object[]{ids, Collection.DismissType.CHANGE_DECK_MULTI, mNewDid})); }
Source:
public Object onMessage(String id, Object data) { if(id.equals("onPageStarted")) { this.isPageFinished = false; } if (id.equals("onPageFinished")) { this.isPageFinished = true; if (intent != null) { new android.os.Handler().postDelayed( new Runnable() { public void run() { handleNotificationData(intent); } }, 500); } } return super.onMessage(id, data); }

Target:
public Object onMessage(String id, Object data) { if(id.equals("onPageStarted")) { this.isPageFinished = false; } if (id.equals("onPageFinished")) { this.isPageFinished = true; if (this.lastPushIntent != null) { new android.os.Handler().postDelayed( new Runnable() { public void run() { handleNotificationData(lastPushIntent); } }, 500); } } return super.onMessage(id, data); }
Source:
public Long time() { Long time = microseconds(); return time == null ? null : time / 1000; }

Target:
public Long time() { Long time = microseconds(); return time == null ? null : TimeUnit.MICROSECONDS.toMillis(time); }
Source:
public boolean onTouchEvent(MotionEvent event) { try { return super.onTouchEvent(event); } catch (RuntimeException e) { return true; } }

Target:
public boolean onTouchEvent(MotionEvent event) { try { return super.onTouchEvent(event); } catch (RuntimeException e) { return false; } }
Source:
private PerAlleleCollection<Double> getHetGenotypeLogOdds(ReadLikelihoods<Allele> likelihoods, final boolean isGermline, final Strand strand, final String sample) { final OptionalDouble givenAltAlleleFraction = isGermline ? GERMLINE_HET_ALT_FRACTION : NO_FIXED_TUMOR_ALT_FRACTION; final String sampleForAlleleFractions = (sample == matchedNormalSampleName && isGermline) ? matchedNormalSampleName : tumorSampleName; final PerAlleleCollection<Double> hetGenotypeLogLks = getHetGenotypeLogLikelihoods(likelihoods, sampleForAlleleFractions, sample, givenAltAlleleFraction, strand); final PerAlleleCollection<Double> lods = new PerAlleleCollection<>(PerAlleleCollection.Type.ALT_ONLY); final int flipLodFactor = isGermline ? -1 : 1; final List<Allele> altAlleles = likelihoods.alleles().stream().filter(Allele::isNonReference).collect(Collectors.toList()); lods.set(altAlleles, a -> flipLodFactor * (hetGenotypeLogLks.get(a) - hetGenotypeLogLks.getRef())); return lods; }

Target:
private PerAlleleCollection<Double> getHetGenotypeLogOdds(ReadLikelihoods<Allele> likelihoods, final boolean isGermline, final Strand strand, final String sample) { final OptionalDouble givenAltAlleleFraction = isGermline ? GERMLINE_HET_ALT_FRACTION : NO_FIXED_TUMOR_ALT_FRACTION; final String sampleForAlleleFractions = (sample.equals(matchedNormalSampleName) && isGermline) ? matchedNormalSampleName : tumorSampleName; final PerAlleleCollection<Double> hetGenotypeLogLks = getHetGenotypeLogLikelihoods(likelihoods, sampleForAlleleFractions, sample, givenAltAlleleFraction, strand); final PerAlleleCollection<Double> lods = new PerAlleleCollection<>(PerAlleleCollection.Type.ALT_ONLY); final int flipLodFactor = isGermline ? -1 : 1; final List<Allele> altAlleles = likelihoods.alleles().stream().filter(Allele::isNonReference).collect(Collectors.toList()); lods.set(altAlleles, a -> flipLodFactor * (hetGenotypeLogLks.get(a) - hetGenotypeLogLks.getRef())); return lods; }
Source:
public KafkaSupervisorSpec( @JsonProperty("dataSchema") DataSchema dataSchema, @JsonProperty("tuningConfig") KafkaSupervisorTuningConfig tuningConfig, @JsonProperty("ioConfig") KafkaSupervisorIOConfig ioConfig, @JsonProperty("context") Map<String, Object> context, @JsonProperty("suspended") Boolean suspended, @JacksonInject TaskStorage taskStorage, @JacksonInject TaskMaster taskMaster, @JacksonInject IndexerMetadataStorageCoordinator indexerMetadataStorageCoordinator, @JacksonInject KafkaIndexTaskClientFactory kafkaIndexTaskClientFactory, @JacksonInject @Json ObjectMapper mapper, @JacksonInject ServiceEmitter emitter, @JacksonInject DruidMonitorSchedulerConfig monitorSchedulerConfig, @JacksonInject RowIngestionMetersFactory rowIngestionMetersFactory, @JacksonInject SupervisorStateManagerConfig supervisorStateManagerConfig ) { super( dataSchema, tuningConfig != null ? tuningConfig : new KafkaSupervisorTuningConfig( null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ), ioConfig, context, suspended, taskStorage, taskMaster, indexerMetadataStorageCoordinator, kafkaIndexTaskClientFactory, mapper, emitter, monitorSchedulerConfig, rowIngestionMetersFactory, supervisorStateManagerConfig ); }

Target:
public KafkaSupervisorSpec( @JsonProperty("dataSchema") DataSchema dataSchema, @JsonProperty("tuningConfig") KafkaSupervisorTuningConfig tuningConfig, @JsonProperty("ioConfig") KafkaSupervisorIOConfig ioConfig, @JsonProperty("context") Map<String, Object> context, @JsonProperty("suspended") Boolean suspended, @JacksonInject TaskStorage taskStorage, @JacksonInject TaskMaster taskMaster, @JacksonInject IndexerMetadataStorageCoordinator indexerMetadataStorageCoordinator, @JacksonInject KafkaIndexTaskClientFactory kafkaIndexTaskClientFactory, @JacksonInject @Json ObjectMapper mapper, @JacksonInject ServiceEmitter emitter, @JacksonInject DruidMonitorSchedulerConfig monitorSchedulerConfig, @JacksonInject RowIngestionMetersFactory rowIngestionMetersFactory, @JacksonInject SupervisorStateManagerConfig supervisorStateManagerConfig ) { super( dataSchema, tuningConfig != null ? tuningConfig : new KafkaSupervisorTuningConfig( null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ), ioConfig, context, suspended, taskStorage, taskMaster, indexerMetadataStorageCoordinator, kafkaIndexTaskClientFactory, mapper, emitter, monitorSchedulerConfig, rowIngestionMetersFactory, supervisorStateManagerConfig ); }
Source:
CosmosSyncUserResponse convertUserResponse(CosmosUserResponse response) { return new CosmosSyncUserResponse(response, this); }

Target:
private CosmosSyncUserResponse convertUserResponse(CosmosUserResponse response) { return new CosmosSyncUserResponse(response, this); }
Source:
public JaxbRule(Rule rule) { id = rule.getId(); priority = rule.getPriority(); userName = rule.getUsername(); roleName = rule.getRolename(); addressRange = rule.getAddressRange() == null ? null : rule.getAddressRange().getCidrSignature(); workspace = rule.getWorkspace(); layer = rule.getLayer(); service = rule.getService() == null ? null : rule.getService().toUpperCase(); request = rule.getRequest(); access = rule.getAccess().toString(); if (rule.getRuleLimits() != null) { limits = new Limits(); limits.setAllowedArea(rule.getRuleLimits().getAllowedArea()); limits.setCatalogMode(rule.getRuleLimits().getCatalogMode().toString()); } if (rule.getLayerDetails() != null) { layerDetails = new LayerDetails(); layerDetails.setAllowedArea(rule.getLayerDetails().getArea()); layerDetails.getAllowedStyles().addAll(rule.getLayerDetails().getAllowedStyles()); if (rule.getLayerDetails().getCatalogMode() != null) { layerDetails.setCatalogMode(rule.getLayerDetails().getCatalogMode().toString()); } else { layerDetails.setCatalogMode(CatalogMode.HIDE.toString()); } layerDetails.setCqlFilterRead(rule.getLayerDetails().getCqlFilterRead()); layerDetails.setCqlFilterWrite(rule.getLayerDetails().getCqlFilterWrite()); layerDetails.setDefaultStyle(rule.getLayerDetails().getDefaultStyle()); layerDetails.setLayerType(rule.getLayerDetails().getType().toString()); for (org.geoserver.geofence.core.model.LayerAttribute att : rule.getLayerDetails().getAttributes()) { layerDetails.getAttributes().add(new LayerAttribute(att)); } } }

Target:
public JaxbRule(Rule rule) { id = rule.getId(); priority = rule.getPriority(); userName = rule.getUsername(); roleName = rule.getRolename(); addressRange = rule.getAddressRange() == null ? null : rule.getAddressRange().getCidrSignature(); workspace = rule.getWorkspace(); layer = rule.getLayer(); service = rule.getService() == null ? null : rule.getService().toUpperCase(); request = rule.getRequest(); access = rule.getAccess().toString(); if (rule.getRuleLimits() != null) { limits = new Limits(); limits.setAllowedArea(rule.getRuleLimits().getAllowedArea()); limits.setCatalogMode(rule.getRuleLimits().getCatalogMode().toString()); } if (rule.getLayerDetails() != null) { layerDetails = new LayerDetails(); layerDetails.setAllowedArea(rule.getLayerDetails().getArea()); layerDetails.getAllowedStyles().addAll(rule.getLayerDetails().getAllowedStyles()); layerDetails.setCatalogMode(rule.getLayerDetails().getCatalogMode().toString()); layerDetails.setCqlFilterRead(rule.getLayerDetails().getCqlFilterRead()); layerDetails.setCqlFilterWrite(rule.getLayerDetails().getCqlFilterWrite()); layerDetails.setDefaultStyle(rule.getLayerDetails().getDefaultStyle()); layerDetails.setLayerType(rule.getLayerDetails().getType().toString()); for (org.geoserver.geofence.core.model.LayerAttribute att : rule.getLayerDetails().getAttributes()) { layerDetails.getAttributes().add(new LayerAttribute(att)); } } }
Source:
public synchronized void closeCursor(String cursorId) { ReadCursor reader = m_readCursors.remove(cursorId); if (reader != null && reader.m_segment != null) { try { reader.m_segment.getReader(cursorId).close(); } catch (IOException e) { } } }

Target:
public synchronized void closeCursor(String cursorId) { if (m_closed) { return; } ReadCursor reader = m_readCursors.remove(cursorId); if (reader != null && reader.m_segment != null) { try { reader.m_segment.getReader(cursorId).close(); } catch (IOException e) { } } try { boolean isLastSegment = true; for (PBDSegment segment : m_segments.descendingMap().values()) { if (isLastSegment) { isLastSegment = false; continue; } if (canDeleteSegment(segment)) { closeAndDeleteSegmentsBefore(segment.segmentId(), "because of close of cursor"); break; } } } catch (IOException e) { LOG.error("Exception closing and deleting PBD segment", e); } }
Source:
private void handleMetadataOnlyResponseMessage(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
private void handleMetadataOnlyResponseMessage(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
private void testCreatePartitionedBucketedTableAs(HiveStorageFormat storageFormat) { String tableName = "test_create_partitioned_bucketed_table_as"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "WITH (" + "format = '" + storageFormat + "', " + "partitioned_by = ARRAY[ 'orderstatus' ], " + "bucketed_by = ARRAY[ 'custkey', 'custkey2' ], " + "bucket_count = 11 " + ") " + "AS " + "SELECT custkey, custkey AS custkey2, comment, orderstatus " + "FROM tpch.tiny.orders"; assertUpdate( getParallelWriteSession(), createTable, "SELECT COUNT(*) FROM orders"); verifyPartitionedBucketedTable(storageFormat, tableName); assertUpdate("DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(getSession(), tableName)); }

Target:
private void testCreatePartitionedBucketedTableAs(HiveStorageFormat storageFormat) { String tableName = "test_create_partitioned_bucketed_table_as"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "WITH (" + "format = '" + storageFormat + "', " + "partitioned_by = ARRAY[ 'orderstatus' ], " + "bucketed_by = ARRAY[ 'custkey', 'custkey2' ], " + "bucket_count = 11 " + ") " + "AS " + "SELECT custkey, custkey AS custkey2, comment, orderstatus " + "FROM tpch.tiny.orders"; assertUpdate( getParallelWriteSession(), createTable, "SELECT count(*) from orders"); verifyPartitionedBucketedTable(storageFormat, tableName); assertUpdate("DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(getSession(), tableName)); }
Source:
public void testVFE5() { T_check_cast_3 t = new T_check_cast_3(); try { t.run(); fail("expected NoClassDefFoundError"); } catch (NoClassDefFoundError iae) { } }

Target:
public void testVFE5() { T_check_cast_3 t = new T_check_cast_3(); try { t.run(); fail("expected IllegalAccessError"); } catch (IllegalAccessError iae) { } }
Source:
private JSONObject getTopology(StartAction startAction, Map<Integer, String> hostGroups, JoinCoordinator joinCoordinator) { JSONObject topo = null; int sitesperhost = m_catalogContext.getDeployment().getCluster().getSitesperhost(); int kfactor = m_catalogContext.getDeployment().getCluster().getKfactor(); if (startAction == StartAction.JOIN) { assert(joinCoordinator != null); topo = joinCoordinator.getTopology(); } else { final Set<Integer> liveHostIds = m_messenger.getLiveHostIds(); Preconditions.checkArgument(hostGroups.keySet().equals(liveHostIds)); int hostcount = liveHostIds.size(); ClusterConfig clusterConfig = new ClusterConfig(hostcount, sitesperhost, kfactor); if (!clusterConfig.validate()) { VoltDB.crashLocalVoltDB(clusterConfig.getErrorMsg(), false, null); } try { final Multimap<Integer, Long> replicas = m_cartographer.getReplicasForPartitions(m_cartographer.getPartitions()); final Map<Integer, Long> masters = m_cartographer.getHSIdsForSinglePartitionMasters(); replicas.removeAll(MpInitiator.MP_INIT_PID); masters.remove(MpInitiator.MP_INIT_PID); topo = clusterConfig.getTopology(hostGroups, replicas, masters); } catch (Exception e) { VoltDB.crashLocalVoltDB("Unable to calculate topology", false, e); } if (!startAction.doesRejoin()) { topo = registerClusterConfig(topo); } } return topo; }

Target:
private JSONObject getTopology(StartAction startAction, Map<Integer, String> hostGroups, JoinCoordinator joinCoordinator) { JSONObject topo = null; int sitesperhost = m_catalogContext.getDeployment().getCluster().getSitesperhost(); int kfactor = m_catalogContext.getDeployment().getCluster().getKfactor(); if (startAction == StartAction.JOIN) { assert(joinCoordinator != null); topo = joinCoordinator.getTopology(); } else { final Set<Integer> liveHostIds = m_messenger.getLiveHostIds(); Preconditions.checkArgument(hostGroups.keySet().equals(liveHostIds)); int hostcount = liveHostIds.size(); ClusterConfig clusterConfig = new ClusterConfig(hostcount, sitesperhost, kfactor); if (!startAction.doesRejoin() && !clusterConfig.validate()) { VoltDB.crashLocalVoltDB(clusterConfig.getErrorMsg(), false, null); } try { final Multimap<Integer, Long> replicas = m_cartographer.getReplicasForPartitions(m_cartographer.getPartitions()); final Map<Integer, Long> masters = m_cartographer.getHSIdsForSinglePartitionMasters(); replicas.removeAll(MpInitiator.MP_INIT_PID); masters.remove(MpInitiator.MP_INIT_PID); topo = clusterConfig.getTopology(hostGroups, replicas, masters); } catch (Exception e) { VoltDB.crashLocalVoltDB("Unable to calculate topology", false, e); } if (!startAction.doesRejoin()) { topo = registerClusterConfig(topo); } } return topo; }
Source:
lookupOrCreateAdaptiveTrackProjection( TrackBitrateAllocation trackBitrateAllocation) { synchronized (adaptiveTrackProjectionMap) { AdaptiveTrackProjection adaptiveTrackProjection = adaptiveTrackProjectionMap.get( trackBitrateAllocation.targetSSRC); if (adaptiveTrackProjection != null || trackBitrateAllocation.track == null) { return adaptiveTrackProjection; } RTPEncodingDesc[] rtpEncodings = trackBitrateAllocation.track.getRTPEncodings(); if (ArrayUtils.isNullOrEmpty(rtpEncodings)) { return null; } final String endpointID = trackBitrateAllocation.endpointID; final Endpoint endpointOwningTrack = destinationEndpoint.getConference().getLocalEndpoint(endpointID); if (endpointOwningTrack == null) { return null; } final long targetSSRC = trackBitrateAllocation.targetSSRC; adaptiveTrackProjection = new AdaptiveTrackProjection( diagnosticContext, trackBitrateAllocation.track, () -> destinationEndpoint.getConference().requestKeyframe( endpointID, targetSSRC), endpointOwningTrack.getBitrateController().payloadTypes, logger); logger.debug(() -> "new track projection for " + trackBitrateAllocation.track); for (RTPEncodingDesc rtpEncoding : rtpEncodings) { adaptiveTrackProjectionMap.put( rtpEncoding.getPrimarySSRC(), adaptiveTrackProjection); } return adaptiveTrackProjection; } }

Target:
lookupOrCreateAdaptiveTrackProjection( TrackBitrateAllocation trackBitrateAllocation) { synchronized (adaptiveTrackProjectionMap) { AdaptiveTrackProjection adaptiveTrackProjection = adaptiveTrackProjectionMap.get( trackBitrateAllocation.targetSSRC); if (adaptiveTrackProjection != null || trackBitrateAllocation.track == null) { return adaptiveTrackProjection; } RTPEncodingDesc[] rtpEncodings = trackBitrateAllocation.track.getRTPEncodings(); if (ArrayUtils.isNullOrEmpty(rtpEncodings)) { return null; } final String endpointID = trackBitrateAllocation.endpointID; final Endpoint endpointOwningTrack = destinationEndpoint.getConference().getLocalEndpoint(endpointID); if (endpointOwningTrack == null) { return null; } final Map<Byte, PayloadType> endpointOwningTrackPayloadTypes = endpointOwningTrack .getTransceiver() .getReadOnlyStreamInformationStore() .getRtpPayloadTypes(); final long targetSSRC = trackBitrateAllocation.targetSSRC; adaptiveTrackProjection = new AdaptiveTrackProjection( diagnosticContext, trackBitrateAllocation.track, () -> destinationEndpoint.getConference().requestKeyframe( endpointID, targetSSRC), endpointOwningTrackPayloadTypes, logger); logger.debug(() -> "new track projection for " + trackBitrateAllocation.track); for (RTPEncodingDesc rtpEncoding : rtpEncodings) { adaptiveTrackProjectionMap.put( rtpEncoding.getPrimarySSRC(), adaptiveTrackProjection); } return adaptiveTrackProjection; } }
Source:
public void downloadAllServerChanges() { checkMainThread("downloadAllServerChanges() cannot be called from the main thread."); synchronized (waitForChangesMutex) { if (!isClosed) { waitingForServerChanges = new WaitForServerChangesWrapper(); boolean listenerRegistered = nativeWaitForDownloadCompletion(configuration.getPath()); if (!listenerRegistered) { waitingForServerChanges = null; throw new ObjectServerError(ErrorCode.UNKNOWN, "It was not possible to download all changes. Have the Sync Client been started?"); } waitingForServerChanges.waitForServerChanges(); if (!isClosed) { if (!waitingForServerChanges.isSuccess()) { waitingForServerChanges.throwExceptionIfNeeded(); } } waitingForServerChanges = null; } } }

Target:
public void downloadAllServerChanges() throws InterruptedException { checkIfNotOnMainThread("downloadAllServerChanges() cannot be called from the main thread."); synchronized (waitForChangesMutex) { if (!isClosed) { WaitForServerChangesWrapper wrapper = new WaitForServerChangesWrapper(); waitingForServerChanges.set(wrapper); boolean listenerRegistered = nativeWaitForDownloadCompletion(configuration.getPath()); if (!listenerRegistered) { waitingForServerChanges.set(null); throw new ObjectServerError(ErrorCode.UNKNOWN, "It was not possible to download all changes. Has the SyncClient been started?"); } wrapper.waitForServerChanges(); try { if (!isClosed) { if (!wrapper.isSuccess()) { wrapper.throwExceptionIfNeeded(); } } } finally { waitingForServerChanges.set(null); } } } }
Source:
public Date getUpdatedAt() { if (updatedAt == null) { setCreatedAt(new Date(Const.DEFAULT_STUDENT_CREATION_DATE)); } return updatedAt; }

Target:
public Date getUpdatedAt() { return (updatedAt == null) ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP : updatedAt; }
Source:
public boolean check(VM vm) { return vm.getStatus().isSuspended(); }

Target:
public boolean check(VM vm) { return vm.getStatus() != VMStatus.Suspended && vm.getStatus() != VMStatus.SavingState && vm.getStatus() != VMStatus.RestoringState; }
Source:
private static String[] splitTypeNameValue(String typeNameToken) { String[] result; String[] keys = typeNameToken.split("=", 2); for (int i=0; i<keys.length; i++) { } if (keys.length == 2 && !StringUtils.isBlankOrEmptyString(keys[1])) { result = keys; } else { result = new String[2]; result[0] = keys[0]; result[1] = ""; } return result; }

Target:
private static String[] splitTypeNameValue(String typeNameToken) { String[] result; String[] keys = typeNameToken.split("=", 2); if (keys.length == 2) { result = keys; } else { result = new String[2]; result[0] = keys[0]; result[1] = ""; } return result; }
Source:
public static boolean isValid(String path) { try { VALIDATOR.get().validate(path); return true; } catch (Exception e) { LOG.info("Request validation failed", e); return false; } }

Target:
public static boolean isValid(String path) { try { VALIDATOR.get().validate(path); return true; } catch (Exception e) { LOG.info("Path validation failed", e); return false; } }
Source:
public Promise<Void> deleteProject(final String project) { return newPromise(new AsyncPromiseHelper.RequestCall<Void>() { @Override public void makeCall(AsyncCallback<Void> callback) { String url = openshiftPath + "/project/" + project; asyncRequestFactory.createDeleteRequest(url) .loader(loader, "Deleting project...") .send(newCallback(callback)); } }); }

Target:
public Promise<Void> deleteProject(final String project) { return newPromise(new AsyncPromiseHelper.RequestCall<Void>() { @Override public void makeCall(AsyncCallback<Void> callback) { String url = openshiftPath + "/project/" + project; asyncRequestFactory.createDeleteRequest(url) .loader(loader, "Deleting OpenShift project...") .send(newCallback(callback)); } }); }
Source:
private void updateGuideProgress(GuideMediaProgress guide, boolean rateLimit) { if (!rateLimit || System.currentTimeMillis() > mLastProgressUpdate + GUIDE_PROGRESS_INTERVAL_MS) { Log.w(TAG, "Updating progress: " + guide.mMediaProgress + "/" + guide.mTotalMedia); mDb.updateGuideProgress(mSite, mUser, guide.mGuide.getGuideid(), guide.mTotalMedia, guide.mMediaProgress); mLastProgressUpdate = System.currentTimeMillis(); } }

Target:
private void updateGuideProgress(GuideMediaProgress guide, boolean rateLimit) { if (!rateLimit || System.currentTimeMillis() > mLastProgressUpdate + GUIDE_PROGRESS_INTERVAL_MS) { if (BuildConfig.DEBUG) { Log.d(TAG, "Updating progress: " + guide.mMediaProgress + "/" + guide.mTotalMedia); } mDb.updateGuideProgress(mSite, mUser, guide.mGuide.getGuideid(), guide.mTotalMedia, guide.mMediaProgress); mLastProgressUpdate = System.currentTimeMillis(); } }
Source:
private Boolean expectedMatch(ExpectedArtifact e, Artifact a) { log.info("expected artifact fields: {}", e.getFields()); return e.getFields().stream() .filter(field -> field.getFieldType().equals(ExpectedArtifact.ArtifactField.FieldType.MUST_MATCH)) .allMatch(field -> { try { Field declaredField = a.getClass().getDeclaredField(field.getFieldName()); declaredField.setAccessible(true); String actualValue = (String) declaredField.get(a); declaredField.setAccessible(false); return actualValue.equals(field.getValue()); } catch (IllegalAccessException | NoSuchFieldException ex) { log.error(ex.getMessage()); return false; } }); }

Target:
private Boolean expectedMatch(ExpectedArtifact e, Artifact a) { return e.getFields().stream() .filter(field -> field.getFieldType().equals(ExpectedArtifact.ArtifactField.FieldType.MUST_MATCH)) .allMatch(field -> { try { Field declaredField = a.getClass().getDeclaredField(field.getFieldName()); declaredField.setAccessible(true); String actualValue = (String) declaredField.get(a); declaredField.setAccessible(false); return actualValue.equals(field.getValue()); } catch (IllegalAccessException | NoSuchFieldException ex) { log.error(ex.getMessage()); return false; } }); }
Source:
public static String getMavenRepoDir(String defaultName) { return "/tmp/maven/repo/" + defaultName; }

Target:
public static String getMavenRepoDir(String defaultName) { boolean containedMaveRepo = System.getenv().containsKey(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME); if(containedMaveRepo) { String mavenRepoName = ArtifactRepositoryService.GLOBAL_M2_REPO_NAME; return mavenRepoName + defaultName; }else { String tempDir = System.getProperty("java.io.tmpdir"); StringBuffer sb = new StringBuffer(); sb.append(tempDir).append("/maven/repo/").append(defaultName); return sb.toString(); } }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getRngDevice() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_RNG_NOT_FOUND); } if (!getRngDevices().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_RNG_ALREADY_EXISTS); } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (!getRngDevices().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_RNG_ALREADY_EXISTS); } return true; }
Source:
public ImmutableMap<String, String> getDefaultParameters() { return ImmutableMap.<String, String>builder() .put(PARAM_MAC_ADDRESS_AD_SEQUENCE_ID, "555224") .build(); }

Target:
public ImmutableMap<String, String> getDefaultParameters() { return DEFAULT_PARAMETERS; }
Source:
private Channels() { }

Target:
private Channels() { super(); }
Source:
public final void testDiscoverDevicesNDError() throws Exception { DiscoveryListener listener = new DiscoveryListener(); listeners.add(listener); String error = "error"; Mockito.doThrow(new XBeeException(error)).when(deviceMock).sendPacketAsync(Mockito.any(XBeePacket.class)); long start = System.currentTimeMillis(); nd.startDiscoveryProcess(listeners); long endBlock = System.currentTimeMillis(); assertThat("The 'discoverDevices' should not block", endBlock - start < TIMEOUT, is(equalTo(true))); assertThat("The 'discoverDevices' should be running", listener.isFinished(), is(equalTo(false))); while(!listener.isFinished()) { Thread.sleep(100); } long end = System.currentTimeMillis(); assertThat("The 'discoverDevices' process should finish after " + TIMEOUT + " ms", end - start < TIMEOUT + 150 , is(equalTo(true))); assertThat("The discovered devices list should be empty", listener.getDiscoveredDevices().size(), is(equalTo(ndAnswers.size()))); assertThat("The discovery process should finish with the '" + error + "' error", listener.getFinishError(), is(equalTo(error))); }

Target:
public final void testDiscoverDevicesNDError() throws Exception { DiscoveryListener listener = new DiscoveryListener(); listeners.add(listener); String error = "error"; Mockito.doThrow(new XBeeException(error)).when(deviceMock).sendPacketAsync(Mockito.any(XBeePacket.class)); long start = System.currentTimeMillis(); nd.startDiscoveryProcess(listeners); long endBlock = System.currentTimeMillis(); assertThat("The 'discoverDevices' should not block", endBlock - start < TIMEOUT, is(equalTo(true))); assertThat("The 'discoverDevices' should be running", listener.isFinished(), is(equalTo(false))); while(!listener.isFinished()) { Thread.sleep(50); } long end = System.currentTimeMillis(); assertThat("The 'discoverDevices' process should finish after " + TIMEOUT + " ms", end - start < TIMEOUT + 150 , is(equalTo(true))); assertThat("The discovered devices list should be empty", listener.getDiscoveredDevices().size(), is(equalTo(ndAnswers.size()))); assertThat("The discovery process should finish with the '" + error + "' error", listener.getFinishError(), is(equalTo(error))); }
Source:
private Optional<SustainedConnection> findConnectionToMaintain() { synchronized (SustainedConnectionWorker.this) { for (SustainedConnection connection : this.connections) { if (connection.needsRefresh()) { connection.claim(); return Optional.of(connection); } } } return Optional.empty(); }

Target:
private synchronized Optional<SustainedConnection> findConnectionToMaintain() { final long milliseconds = SustainedConnectionWorker.SYSTEM_TIME.milliseconds(); for (SustainedConnection connection : this.connections) { if (connection.needsRefresh(milliseconds)) { connection.claim(); return Optional.of(connection); } } return Optional.empty(); }
Source:
public static JsonObject mapToJson(Map<String, ?> map) { if (map == null) { throw new RuntimeException(CANNOT_CONVERT_NULL_TO_A_JSON_OBJECT); } try { return Json.instance().parse(objectMapper.writeValueAsString(map)); } catch (JsonProcessingException e) { throw new RuntimeException("Error converting map to JSON", e); } }

Target:
public static JsonObject mapToJson(Map<String, ?> map) { Objects.requireNonNull(map, CANNOT_CONVERT_NULL_TO_A_JSON_OBJECT); try { return Json.instance().parse(objectMapper.writeValueAsString(map)); } catch (JsonProcessingException e) { throw new RuntimeException("Error converting map to JSON", e); } }
Source:
private boolean extractAndLoadAgain(Context context, String libraryName, String[] supportedABIs) { final String METHOD_TAG = TAG + ":extractAndLoadAgain"; ApplicationInfo appInfo = context.getApplicationInfo(); String destPath = context.getFilesDir().toString(); Log.i(METHOD_TAG, "Extracting to destination : " + destPath); try { String soName = destPath + File.separator + libraryName; new File(soName).delete(); boolean fileCopied = false; for (String abi : supportedABIs) { Log.i(METHOD_TAG, "Using ABI : " + abi); UnzipUtil.extractFile(appInfo.sourceDir, "lib/" + abi + "/" + libraryName, destPath); if (canReadFile(new File(soName))) { Log.i(METHOD_TAG, "File exists after extracting to " + abi); fileCopied = true; break; } } if (fileCopied) { System.load(soName); return true; } } catch (IOException | UnsatisfiedLinkError e) { Log.e(METHOD_TAG, "An error occurred when extracting and loading libs", e); } return false; }

Target:
private static boolean extractAndLoadAgain(Context context, String libraryName, String[] supportedABIs) { final String METHOD_TAG = TAG + ":extractAndLoadAgain"; ApplicationInfo appInfo = context.getApplicationInfo(); String destPath = context.getFilesDir().toString(); Log.i(METHOD_TAG, "Extracting to destination : " + destPath); try { String soName = destPath + File.separator + libraryName; new File(soName).delete(); boolean fileCopied = false; for (String abi : supportedABIs) { Log.i(METHOD_TAG, "Using ABI : " + abi); UnzipUtil.extractFile(appInfo.sourceDir, "lib/" + abi + "/" + libraryName, destPath); if (canReadFile(new File(soName))) { Log.i(METHOD_TAG, "File exists after extracting to " + abi); fileCopied = true; break; } } if (fileCopied) { System.load(soName); return true; } } catch (IOException | UnsatisfiedLinkError e) { Log.e(METHOD_TAG, "An error occurred when extracting and loading libs", e); } return false; }
Source:
public boolean canUseLlapIo(Configuration conf) { if (AcidUtils.isFullAcidScan(conf)) { if (HiveConf.getBoolVar(conf, ConfVars.LLAP_IO_ACID_ENABLED) && Utilities.getIsVectorized(conf)) { boolean hasDeleteDelta = deltas != null && !deltas.isEmpty(); return VectorizedOrcAcidRowBatchReader.canUseLlapIoForAcid(this, hasDeleteDelta, conf); } else { return false; } } else { return true; } }

Target:
public boolean canUseLlapIo(Configuration conf) { if (AcidUtils.isFullAcidScan(conf)) { if (HiveConf.getBoolVar(conf, ConfVars.LLAP_IO_ACID_ENABLED) && Utilities.getIsVectorized(conf)) { boolean hasDeleteDelta = deltas != null && !deltas.isEmpty(); return VectorizedOrcAcidRowBatchReader.canUseLlapIoForAcid(this, hasDeleteDelta, conf); } else { LOG.info("Skipping Llap IO based on the following: [vectorized={}, hive.llap.io.acid={}] for {}", Utilities.getIsVectorized(conf), HiveConf.getBoolVar(conf, ConfVars.LLAP_IO_ACID_ENABLED), this); return false; } } else { return true; } }
Source:
public DataFetcher(Map<String, DataSource> dataSourceMap) { int numColumns = dataSourceMap.size(); _dictionaryMap = new HashMap<>(numColumns); _singleValueSetMap = new HashMap<>(numColumns); _multiValueSetMap = new HashMap<>(numColumns); int maxNumValuesPerMVEntry = 0; for (Map.Entry<String, DataSource> entry : dataSourceMap.entrySet()) { String column = entry.getKey(); DataSource dataSource = entry.getValue(); _dictionaryMap.put(column, dataSource.getDictionary()); DataSourceMetadata dataSourceMetadata = dataSource.getDataSourceMetadata(); BlockValSet blockValueSet = dataSourceMap.get(column).nextBlock().getBlockValueSet(); if (dataSourceMetadata.isSingleValue()) { _singleValueSetMap.put(column, (SingleValueSet) blockValueSet); } else { _multiValueSetMap.put(column, (MultiValueSet) blockValueSet); maxNumValuesPerMVEntry = Math.max(maxNumValuesPerMVEntry, dataSourceMetadata.getMaxNumValuesPerMVEntry()); } } _reusableMVDictIds = new int[maxNumValuesPerMVEntry]; }

Target:
public DataFetcher(Map<String, DataSource> dataSourceMap) { int numColumns = dataSourceMap.size(); _dictionaryMap = new HashMap<>(numColumns); _singleValueSetMap = new HashMap<>(numColumns); _multiValueSetMap = new HashMap<>(numColumns); int maxNumValuesPerMVEntry = 0; for (Map.Entry<String, DataSource> entry : dataSourceMap.entrySet()) { String column = entry.getKey(); DataSource dataSource = entry.getValue(); _dictionaryMap.put(column, dataSource.getDictionary()); DataSourceMetadata dataSourceMetadata = dataSource.getDataSourceMetadata(); BlockValSet blockValueSet = dataSource.nextBlock().getBlockValueSet(); if (dataSourceMetadata.isSingleValue()) { _singleValueSetMap.put(column, (SingleValueSet) blockValueSet); } else { _multiValueSetMap.put(column, (MultiValueSet) blockValueSet); maxNumValuesPerMVEntry = Math.max(maxNumValuesPerMVEntry, dataSourceMetadata.getMaxNumValuesPerMVEntry()); } } _reusableMVDictIds = new int[maxNumValuesPerMVEntry]; }
Source:
public ReplTxnWork(String dbName, String tableName, Long txnId, OperationType type) { this.txnIds = Lists.newArrayList(); this.txnIds.add(txnId); this.dbName = dbName; this.tableName = tableName; this.operation = type; }

Target:
public ReplTxnWork(String dbName, String tableName, Long txnId, OperationType type) { this.txnIds = Lists.newArrayList(txnId); this.dbName = dbName; this.tableName = tableName; this.operation = type; }
Source:
public AbstractProAi( final String name, final IBattleCalculator battleCalculator, final ProData proData) { super(name); this.proData = proData; calc = new ProOddsCalculator(battleCalculator); combatMoveAi = new ProCombatMoveAi(this); nonCombatMoveAi = new ProNonCombatMoveAi(this); purchaseAi = new ProPurchaseAi(this); retreatAi = new ProRetreatAi(this); scrambleAi = new ProScrambleAi(this); politicsAi = new ProPoliticsAi(this); storedCombatMoveMap = null; storedFactoryMoveMap = null; storedPurchaseTerritories = null; storedPoliticalActions = null; storedStrafingTerritories = new ArrayList<>(); DebugMenu.unregisterMenuCallback("Hard AI"); DebugMenu.registerMenuCallback("Hard AI", this::initialize); }

Target:
public AbstractProAi( final String name, final IBattleCalculator battleCalculator, final ProData proData) { super(name); this.proData = proData; calc = new ProOddsCalculator(battleCalculator); combatMoveAi = new ProCombatMoveAi(this); nonCombatMoveAi = new ProNonCombatMoveAi(this); purchaseAi = new ProPurchaseAi(this); retreatAi = new ProRetreatAi(this); scrambleAi = new ProScrambleAi(this); politicsAi = new ProPoliticsAi(this); storedCombatMoveMap = null; storedFactoryMoveMap = null; storedPurchaseTerritories = null; storedPoliticalActions = null; storedStrafingTerritories = new ArrayList<>(); ProLogUi.registerDebugMenu(); }
Source:
public double getLogProb(MatrixLib value) { checkHasParams(); if (value.numRows() != 1 || value.numCols() != this.k) { throw new IllegalArgumentException( "The matrix provided is of the incorrect dimensions. Expecting a 1 by " + this.k + " row vector but instead got a matrix of dimension " + value.numRows() + " by " + value.numCols()); } double sum = 0.0; for (int i = 0; i < k; i++) { double element = value.elementAt(0, i); if (element < 0 || element % 1 != 0.0) { return Double.NEGATIVE_INFINITY; } sum += element; } if (sum != n) { return Double.NEGATIVE_INFINITY; } double logProb = Util.logFactorial(n); for (int i = 0; i < k; i++) { logProb += value.elementAt(0, i) * Math.log(p[i]); logProb -= Util.logFactorial((int) Math.round(value.elementAt(0, i))); } return logProb; }

Target:
public double getLogProb(MatrixLib value) { checkHasParams(); if (!inSupport(value)) { return Double.NEGATIVE_INFINITY; } double logProb = Util.logFactorial(n); for (int i = 0; i < k; i++) { logProb += value.elementAt(0, i) * Math.log(p[i]); logProb -= Util.logFactorial((int) Math.round(value.elementAt(0, i))); } return logProb; }
Source:
public AdElementListModel() { setRole(new ListModel()); setProfile(new ListModel()); setNamespace(new ListModel()); setSelectAll(new EntityModel()); getSelectAll().setEntity(false); getSelectAll().getEntityChangedEvent().addListener(this); setIsRoleListHiddenModel(new EntityModel()); getIsRoleListHiddenModel().setEntity(false); setIsEveryoneSelectionHidden(new EntityModel()); getIsEveryoneSelectionHidden().setEntity(false); setSearchInProgress(new EntityModel()); getSearchInProgress().setEntity(false); setIsTimerDisabled(true); AsyncDataProvider.getInstance().getAAAProfilesEntriesList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { populateProfiles((List<ProfileEntry>) result); getProfile().getSelectedItemChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if (namespacesMap != null) { populateNamespaces(namespacesMap.get(((ProfileEntry) getProfile().getSelectedItem()).getAuthz())); } } }); } })); AsyncDataProvider.getInstance().getAAANamespaces(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { if (getProfile().getSelectedItem() != null) { namespacesMap = (HashMap<String, List<String>>) result; List<String> selectedNamespaces = namespacesMap.get(((ProfileEntry) (getProfile().getSelectedItem())).getAuthz()); populateNamespaces(selectedNamespaces); } } })); AsyncDataProvider.getInstance().getRoleList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { populateRoles((List<Role>) result); } })); }

Target:
public AdElementListModel() { setRole(new ListModel()); setProfile(new ListModel()); setNamespace(new ListModel()); setSelectAll(new EntityModel()); getSelectAll().setEntity(false); getSelectAll().getEntityChangedEvent().addListener(this); setIsRoleListHiddenModel(new EntityModel()); getIsRoleListHiddenModel().setEntity(false); setIsEveryoneSelectionHidden(new EntityModel()); getIsEveryoneSelectionHidden().setEntity(false); setSearchInProgress(new EntityModel()); getSearchInProgress().setEntity(false); setIsTimerDisabled(true); AsyncDataProvider.getInstance().getAAAProfilesEntriesList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { populateProfiles((List<ProfileEntry>) result); getProfile().getSelectedItemChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { populateNamespaces(); } }); } })); AsyncDataProvider.getInstance().getAAANamespaces(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { if (getProfile().getSelectedItem() != null) { namespacesMap = (HashMap<String, List<String>>) result; populateNamespaces(); } } })); AsyncDataProvider.getInstance().getRoleList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { populateRoles((List<Role>) result); } })); }