auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void provision( InternalEnvironment environment, OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { final String workspaceId = identity.getWorkspaceId(); final Map<String, Pod> pods = new HashMap<>(osEnv.getPods()); osEnv.getPods().clear(); for (Pod pod : pods.values()) { final ObjectMeta podMeta = pod.getMetadata(); podMeta.getLabels().put(CHE_ORIGINAL_NAME_LABEL, podMeta.getName()); final String podName = workspaceId + SEPARATOR + podMeta.getName(); podMeta.setName(podName); osEnv.getPods().put(podName, pod); } final Map<String, Route> routes = new HashMap<>(osEnv.getRoutes()); osEnv.getRoutes().clear(); for (Route route : routes.values()) { final ObjectMeta routeMeta = route.getMetadata(); routeMeta.getLabels().put(CHE_ORIGINAL_NAME_LABEL, routeMeta.getName()); final String routeName = NameGenerator.generate(ROUTE_PREFIX, ROUTE_SUFFIX_SIZE); routeMeta.setName(routeName); osEnv.getRoutes().put(routeName, route); } }

Target:
public void provision( InternalEnvironment environment, OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { final String workspaceId = identity.getWorkspaceId(); final Set<Pod> pods = new HashSet<>(osEnv.getPods().values()); osEnv.getPods().clear(); for (Pod pod : pods) { final ObjectMeta podMeta = pod.getMetadata(); podMeta.getLabels().put(CHE_ORIGINAL_NAME_LABEL, podMeta.getName()); final String podName = workspaceId + SEPARATOR + podMeta.getName(); podMeta.setName(podName); osEnv.getPods().put(podName, pod); } final Set<Route> routes = new HashSet<>(osEnv.getRoutes().values()); osEnv.getRoutes().clear(); for (Route route : routes) { final ObjectMeta routeMeta = route.getMetadata(); routeMeta.getLabels().put(CHE_ORIGINAL_NAME_LABEL, routeMeta.getName()); final String routeName = NameGenerator.generate(ROUTE_PREFIX, ROUTE_SUFFIX_SIZE); routeMeta.setName(routeName); osEnv.getRoutes().put(routeName, route); } }
Source:
ChoicesDisplayDialog(Listener listener, Context context, int listId, ListInfo listInfo, ChoosingSettings settings) { this.listId = listId; this.settings = settings; dialog = new MaterialDialog.Builder(context) .title(R.string.name_chosen) .customView(R.layout.name_choices_dialog, false) .positiveText(android.R.string.yes) .negativeText(R.string.copy_text) .neutralText(R.string.say_name) .onPositive((dialog, which) -> dialog.dismiss()) .onNegative((dialog, which) -> listener.copyNamesToClipboard( NameUtils.flattenListToString(chosenNames, settings), chosenNames.size())) .onNeutral((dialog, which) -> listener.sayNames( NameUtils.flattenListToString(chosenNames, settings))) .autoDismiss(false) .build(); choicesDisplayViewHolder = new ChoicesDisplayViewHolder(dialog.getView(), listInfo); }

Target:
ChoicesDisplayDialog(Listener listener, Context context, int listId, ListInfo listInfo, ChoosingSettings settings) { this.listId = listId; this.settings = settings; chooseNameDialogAdapter = new ChooseNameDialogAdapter(new ArrayList<>(), listInfo); dialog = new MaterialDialog.Builder(context) .title(R.string.name_chosen) .adapter(chooseNameDialogAdapter, new LinearLayoutManager(context)) .positiveText(android.R.string.yes) .negativeText(R.string.copy_text) .neutralText(R.string.say_name) .onPositive((dialog, which) -> dialog.dismiss()) .onNegative((dialog, which) -> listener.copyNamesToClipboard( NameUtils.flattenListToString(chosenNames, settings), chosenNames.size())) .onNeutral((dialog, which) -> listener.sayNames( NameUtils.flattenListToString(chosenNames, settings))) .autoDismiss(false) .build(); }
Source:
public void testNewReservedWordsWarning() { String query = "SELECT CALLED, t.called FROM (VALUES (3)) t(called)"; Session session = testSessionBuilder() .setCatalog("tpch") .setSchema("tiny") .build(); assertWarnings(queryRunner, session, query, ImmutableList.of(PARSER_WARNING.toWarningCode())); }

Target:
public void testNewReservedWordsWarning() { String query = "SELECT CALLED, t.called FROM (VALUES (3)) t(called)"; assertWarnings(queryRunner, TEST_SESSION, query, ImmutableList.of(PARSER_WARNING.toWarningCode())); }
Source:
private ImmutableList<Symbol> pruneMarkDistinctSymbols(MarkDistinctNode node, List<LocalProperty<Symbol>> localProperties) { ImmutableSet.Builder redundantSymbolsBuilder = ImmutableSet.builder(); for (LocalProperty<Symbol> property : localProperties) { if (property instanceof ConstantProperty) { redundantSymbolsBuilder.add(((ConstantProperty<Symbol>) property).getColumn()); } else if (!node.getDistinctSymbols().containsAll(property.getColumns())) { break; } } ImmutableSet redundantSymbols = redundantSymbolsBuilder.build(); return node.getDistinctSymbols().stream() .filter(symbol -> !redundantSymbols.contains(symbol)) .collect(toImmutableList()); }

Target:
private List<Symbol> pruneMarkDistinctSymbols(MarkDistinctNode node, List<LocalProperty<Symbol>> localProperties) { if (localProperties.isEmpty()) { return node.getDistinctSymbols(); } ImmutableSet.Builder<Symbol> redundantSymbolsBuilder = ImmutableSet.builder(); for (LocalProperty<Symbol> property : localProperties) { if (property instanceof ConstantProperty) { redundantSymbolsBuilder.add(((ConstantProperty<Symbol>) property).getColumn()); } else if (!node.getDistinctSymbols().containsAll(property.getColumns())) { break; } } Set<Symbol> redundantSymbols = redundantSymbolsBuilder.build(); List<Symbol> remainingSymbols = node.getDistinctSymbols().stream() .filter(symbol -> !redundantSymbols.contains(symbol)) .collect(toImmutableList()); if (remainingSymbols.isEmpty()) { return ImmutableList.of(node.getDistinctSymbols().get(0)); } return remainingSymbols; }
Source:
protected Set<Set<String>> collectCommonModeSets(Object[] selection) { HashSet<ILaunchDelegate> delegates = new HashSet<>(); Object o = null; for(int i = 0; i < selection.length; i++) { o = selection[i]; if(o instanceof ILaunchDelegate) { delegates.add((ILaunchDelegate) o); } else if(o instanceof ILaunchConfigurationType) { fgCurrentWorkingContext.add(o); Object[] kids = fTreeViewer.getFilteredChildren(o); for (Object kid : kids) { delegates.add((ILaunchDelegate) kids[i]); } } } HashSet<Set<String>> common = new HashSet<>(); List<Set<String>> modes = null; HashSet<Set<String>> pruned = new HashSet<>(); for (ILaunchDelegate delegate : delegates) { modes = delegate.getModes(); for (Set<String> fmodes : modes) { if (isCommonModeset(fmodes, delegates, pruned)) { common.add(fmodes); fgCurrentWorkingContext.add(delegate); } } } return common; }

Target:
protected Set<Set<String>> collectCommonModeSets(Object[] selection) { HashSet<ILaunchDelegate> delegates = new HashSet<>(); Object o = null; for(int i = 0; i < selection.length; i++) { o = selection[i]; if(o instanceof ILaunchDelegate) { delegates.add((ILaunchDelegate) o); } else if(o instanceof ILaunchConfigurationType) { fgCurrentWorkingContext.add(o); Object[] kids = fTreeViewer.getFilteredChildren(o); for (int j = 0; j < kids.length; j++) { delegates.add((ILaunchDelegate) kids[i]); } } } HashSet<Set<String>> common = new HashSet<>(); List<Set<String>> modes = null; HashSet<Set<String>> pruned = new HashSet<>(); for (ILaunchDelegate delegate : delegates) { modes = delegate.getModes(); for (Set<String> fmodes : modes) { if (isCommonModeset(fmodes, delegates, pruned)) { common.add(fmodes); fgCurrentWorkingContext.add(delegate); } } } return common; }
Source:
public void test_arrayOfType() throws ClassNotFoundException { assertThat((Class) Predefined.arrayTypeOf(Object.class), sameInstance((Class) Object[].class)); assertThat((Class) Predefined.arrayTypeOf(byte.class), sameInstance((Class) byte[].class)); try { Predefined.arrayTypeOf(new Object()); Assert.fail(); } catch (Throwable t) { assertThat((Class) t.getClass(), sameInstance((Class) AssertionError.class)); } assertThat((Class) Predefined.objectArrayType(), sameInstance((Class) Object[].class)); }

Target:
public void test_arrayOfType() throws ClassNotFoundException { assertThat((Class) Predefined.arrayTypeOf(Object.class), sameInstance((Class) Object[].class)); assertThat((Class) Predefined.arrayTypeOf(byte.class), sameInstance((Class) byte[].class)); try { Predefined.arrayTypeOf(new Object()); throw new RuntimeException("set a wrong parameter to arrayTypeOf should raise an AssertionError"); } catch (AssertionError ae) { } assertThat((Class) Predefined.objectArrayType(), sameInstance((Class) Object[].class)); }
Source:
public void setUp() throws Exception { super.setUp(); mWifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE); mCm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); PackageManager packageManager = mContext.getPackageManager(); mHasWifi = packageManager.hasSystemFeature(PackageManager.FEATURE_WIFI); mHasTelephony = packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); mBuilder = new JobInfo.Builder(CONNECTIVITY_JOB_ID, kJobServiceComponent); if(!mHasWifi) { return; } mInitialWiFiState = mWifiManager.isWifiEnabled(); mInitialRestrictBackground = SystemUtil .runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_GET_CMD) .contains("enabled"); }

Target:
public void setUp() throws Exception { super.setUp(); mWifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE); mCm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); PackageManager packageManager = mContext.getPackageManager(); mHasWifi = packageManager.hasSystemFeature(PackageManager.FEATURE_WIFI); mHasTelephony = packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); mBuilder = new JobInfo.Builder(CONNECTIVITY_JOB_ID, kJobServiceComponent); mInitialRestrictBackground = SystemUtil .runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_GET_CMD) .contains("enabled"); if(!mHasWifi) { return; } mInitialWiFiState = mWifiManager.isWifiEnabled(); }
Source:
public void setTags(Set<String> tags) { if (tags == null || tags.isEmpty()) return; JSONArray tagArray = new JSONArray(); try { int index = 0; for (String tag : tags) tagArray.put(index++, tag); schema.put(FIELD_SCHEMA_TAGS, tagArray); } catch (JSONException e) { Preconditions.checkState(false, e.getMessage()); } schemaJSON = schema.toString(); }

Target:
public void setTags(Set<String> tags) { if (tags == null || tags.isEmpty()) throw new IllegalArgumentException("tags can't be null or empty."); try { JSONArray tagArray = new JSONArray(tags); schema.put(FIELD_SCHEMA_TAGS, tagArray); } catch (JSONException e) { Preconditions.checkState(false, e.getMessage()); throw new RuntimeException(e); } schemaJSON = schema.toString(); }
Source:
public PodTemplate getTemplate() { if (template == null) { template = getKubernetesCloud().getTemplate(getPodTemplateName()); if (template == null) { throw new IllegalStateException("Not expecting pod template to be null at this point"); } } return template; }

Target:
public PodTemplate getTemplate() { if (template == null) { template = getKubernetesCloud().getTemplateByName(getPodTemplateName()); if (template == null) { throw new IllegalStateException("Not expecting pod template to be null at this point"); } } return template; }
Source:
public void buildExport(OutputStream os) throws IOException { try (Writer writer = new BufferedWriter(new OutputStreamWriter(os))) { writer.write("{\"types\":[\n"); int offset = 0; boolean hasMore = true; boolean first = true; while (hasMore) { List<ResourceType> batch = qResourceType.from(ResourceType.class) .maxResults(MAX_RESULTS) .startOffset(offset) .build() .list(); for (ResourceType rt : batch) { if (!first) { writer.write(",\n"); } else { first = false; } writer.write(JsonUtil.toJson(rt) + "\n"); } hasMore = batch.size() == MAX_RESULTS; offset += MAX_RESULTS; } writer.write("],\"resources\":[\n"); hasMore = true; first = true; offset = 0; while (hasMore) { List<Resource> batch = qResource.from(Resource.class) .maxResults(MAX_RESULTS) .startOffset(offset) .build() .list(); for (Resource r : batch) { if (!first) { writer.write(",\n"); } else { first = false; } writer.write(JsonUtil.toJson(r) + "\n"); } hasMore = batch.size() == MAX_RESULTS; offset += MAX_RESULTS; } writer.write("]}\n"); writer.flush(); } }

Target:
public void buildExport(OutputStream os) throws IOException { JsonGenerator jsonGen = JsonUtil.createJsonGenerator(os); jsonGen.writeStartObject(); jsonGen.writeFieldName("types"); jsonGen.writeStartArray(); int offset = 0; boolean hasMore = true; while (hasMore) { List<ResourceType> batch = qResourceType.from(ResourceType.class) .maxResults(MAX_RESULTS) .startOffset(offset) .build() .list(); for (ResourceType rt : batch) { jsonGen.writeObject(rt); } jsonGen.flush(); hasMore = batch.size() == MAX_RESULTS; offset += MAX_RESULTS; } jsonGen.writeEndArray(); jsonGen.writeFieldName("resources"); jsonGen.writeStartArray(); hasMore = true; offset = 0; while (hasMore) { List<Resource> batch = qResource.from(Resource.class) .maxResults(MAX_RESULTS) .startOffset(offset) .build() .list(); for (Resource r : batch) { jsonGen.writeObject(r); } jsonGen.flush(); hasMore = batch.size() == MAX_RESULTS; offset += MAX_RESULTS; } jsonGen.writeEndArray(); jsonGen.writeEndObject(); jsonGen.flush(); }
Source:
public void endAssociation(Xid _tranID, XAResource _theXAResource, int xaState, int txInfoState) throws XAException { int txInfo = getXAResourceState(_theXAResource); XAException toThrow = null; if ((txInfo != TxInfo.NOT_ASSOCIATED) && (txInfo != TxInfo.FAILED)) { try { doEnd(_tranID, _theXAResource, xaState, txInfoState); } catch (XAException e) { if (toThrow == null) { toThrow = e; } else { _theTransaction.getDeferredThrowables().add(e); } } } for (Object resource : _duplicateResources.keySet()) { XAResource dupXar = (XAResource) resource; if (_theXAResource.isSameRM(dupXar)) { try { doEnd(_tranID, dupXar, xaState, txInfoState); } catch (XAException e) { if (e.errorCode != XAException.XAER_PROTO || STRICTJTA12DUPLICATEXAENDPROTOERR) { if (toThrow == null) { toThrow = e; } else { _theTransaction.getDeferredThrowables().add(e); } } } } } if (toThrow != null) { throw toThrow; } }

Target:
public void endAssociation(Xid _tranID, XAResource _theXAResource, int xaState, int txInfoState) throws XAException { int txInfo = getXAResourceState(_theXAResource); XAException toThrow = null; if ((txInfo != TxInfo.NOT_ASSOCIATED) && (txInfo != TxInfo.FAILED)) { try { doEnd(_tranID, _theXAResource, xaState, txInfoState); } catch (XAException e) { toThrow = e; } } for (Object resource : _duplicateResources.keySet()) { XAResource dupXar = (XAResource) resource; if (_theXAResource.isSameRM(dupXar)) { try { doEnd(_tranID, dupXar, xaState, txInfoState); } catch (XAException e) { if (e.errorCode != XAException.XAER_PROTO || STRICTJTA12DUPLICATEXAENDPROTOERR) { if (toThrow == null) { toThrow = e; } else { _theTransaction.getDeferredThrowables().add(e); } } } } } if (toThrow != null) { throw toThrow; } }
Source:
public DimLookup sort() { return new NullValueConverterDimLookup(delegate.sort()); }

Target:
public SortedDimLookup sort() { return new NullValueConverterDimLookup(delegate.sort()); }
Source:
protected void executeCommand() { Set<Guid> volumes = getVolumeChain(); List<Guid> failedGuids = LinqUtils.filter(volumes, new Predicate<Guid>() { @Override public boolean eval(Guid guid) { for (Guid guidToDelete : getParameters().getImageList()) { if (guid.equals(guidToDelete)) { return true; } } return false; } }); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setSucceeded(true); persistCommand(getParameters().getParentCommand()); setCommandStatus(CommandStatus.SUCCEEDED); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } }

Target:
protected void executeCommand() { Set<Guid> volumes = getVolumeChain(); List<Guid> failedGuids = LinqUtils.filter(volumes, new Predicate<Guid>() { @Override public boolean eval(Guid guid) { if (getParameters().getImageList() != null) { for (Guid guidToDelete : getParameters().getImageList()) { if (guid.equals(guidToDelete)) { return true; } } } return false; } }); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setSucceeded(true); persistCommand(getParameters().getParentCommand()); setCommandStatus(CommandStatus.SUCCEEDED); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } }
Source:
public void testConvertSecondsToMinutes() { long seconds = 1800L; Pair<Long, TimeUnit> expectedResults = TimeConverter.autoConvert(seconds, TimeUnit.SECONDS); assertEquals(expectedResults.getFirst().longValue() , 30L); assertEquals(expectedResults.getSecond(), TimeUnit.MINUTES); }

Target:
public void testConvertSecondsToMinutes() { long seconds = 1800L; Pair<Long, TimeUnit> expectedResults = TimeConverter.autoConvert(seconds, TimeUnit.SECONDS); assertEquals(30L, expectedResults.getFirst().longValue()); assertEquals(TimeUnit.MINUTES, expectedResults.getSecond()); }
Source:
public SELF isNotEqualTo(String dateTimeAsString) { Objects.instance().assertNotNull(info, actual); assertDateTimeAsStringParameterIsNotNull(dateTimeAsString); return super.isNotEqualTo(parse(dateTimeAsString)); }

Target:
public SELF isNotEqualTo(String dateTimeAsString) { assertDateTimeAsStringParameterIsNotNull(dateTimeAsString); return super.isNotEqualTo(parse(dateTimeAsString)); }
Source:
public synchronized void close() { if (isClosed) { return; } LOG.info("{}: Close", blobAsyncClient.getBlobUrl().toString()); try { if (byteArrayOutputStream.isPresent()) { byteArrayOutputStream.get().close(); } if (blockList.size() == 0) { return; } CompletableFuture<Void> future = CompletableFuture.allOf(pendingUpload.toArray(new CompletableFuture[0])); LOG.info("Closing blob: PendingUpload:{} ", blobAsyncClient.getBlobUrl().toString(), pendingUpload.size()); future.get((long) flushTimeoutMs, TimeUnit.MILLISECONDS); LOG.info("For blob: committing blockList size:{}", blobAsyncClient.getBlobUrl().toString(), blockList.size()); metrics.updateAzureCommitMetrics(); Map<String, String> blobMetadata = Collections.singletonMap(BLOB_RAW_SIZE_BYTES_METADATA, Long.toString(totalUploadedBlockSize)); blobAsyncClient.commitBlockListWithResponse(blockList, null, blobMetadata, null, null).block(); } catch (InterruptedException | ExecutionException | TimeoutException e) { String msg = String.format("Close blob %s failed with exception. Total pending sends %d", blobAsyncClient.getBlobUrl().toString(), pendingUpload.size()); throw new RuntimeException(msg, e); } catch (Exception e) { String msg = String.format("Close blob %s failed with exception. Resetting the system producer. %s", blobAsyncClient.getBlobUrl().toString(), e.getLocalizedMessage()); throw new RuntimeException(msg, e); } finally { blockList.clear(); pendingUpload.stream().forEach(future -> future.cancel(true)); pendingUpload.clear(); isClosed = true; } }

Target:
public synchronized void close() { if (isClosed) { LOG.info("{}: already closed", blobAsyncClient.getBlobUrl().toString()); return; } LOG.info("{}: Close", blobAsyncClient.getBlobUrl().toString()); try { if (byteArrayOutputStream.isPresent()) { byteArrayOutputStream.get().close(); } if (blockList.size() == 0) { return; } CompletableFuture<Void> future = CompletableFuture.allOf(pendingUpload.toArray(new CompletableFuture[0])); LOG.info("Closing blob: PendingUpload:{} ", blobAsyncClient.getBlobUrl().toString(), pendingUpload.size()); future.get((long) flushTimeoutMs, TimeUnit.MILLISECONDS); LOG.info("For blob: committing blockList size:{}", blobAsyncClient.getBlobUrl().toString(), blockList.size()); metrics.updateAzureCommitMetrics(); Map<String, String> blobMetadata = Collections.singletonMap(BLOB_RAW_SIZE_BYTES_METADATA, Long.toString(totalUploadedBlockSize)); blobAsyncClient.commitBlockListWithResponse(blockList, null, blobMetadata, null, null).block(); } catch (Exception e) { String msg = String.format("Close blob %s failed with exception. Total pending sends %d", blobAsyncClient.getBlobUrl().toString(), pendingUpload.size()); throw new AzureException(msg, e); } finally { blockList.clear(); pendingUpload.stream().forEach(future -> future.cancel(true)); pendingUpload.clear(); isClosed = true; } }
Source:
public List<RadiologyOrder> getRadiologyOrdersByPatient(Patient patient) { Criteria radiologyOrderCriteria = createRadiologyOrderCriteria(); addRestrictionOnPatient(radiologyOrderCriteria, patient); List<RadiologyOrder> result = (List<RadiologyOrder>) radiologyOrderCriteria.list(); return result == null ? new ArrayList<RadiologyOrder>() : result; }

Target:
public List<RadiologyOrder> getRadiologyOrdersByPatient(Patient patient) { Criteria radiologyOrderCriteria = createRadiologyOrderCriteria(); addRestrictionOnPatient(radiologyOrderCriteria, patient); final List<RadiologyOrder> result = (List<RadiologyOrder>) radiologyOrderCriteria.list(); return result == null ? new ArrayList<RadiologyOrder>() : result; }
Source:
public FileManager(Configuration conf, Path hdfsWorkingPath) throws IOException { hfs = FileSystem.get(conf); lfs = FileSystem.getLocal(conf); hdfsWorkPath = hdfsWorkingPath; localWorkPath = new Path(System.getProperty("java.io.tmpdir")); allocatedHdfsPath = new HashMap<Path, OutputStream>(); allocatedLocalPath = new HashMap<Path, OutputStream>(); this.conf = conf; }

Target:
public FileManager(Configuration conf, Path hdfsWorkingPath) throws IOException { hfs = FileSystem.get(conf); lfs = FileSystem.getLocal(conf); hdfsWorkPath = hdfsWorkingPath; localWorkPath = new Path(BspUtils.TMP_DIR); allocatedHdfsPath = new HashMap<Path, OutputStream>(); allocatedLocalPath = new HashMap<Path, OutputStream>(); this.conf = conf; }
Source:
public void handleEvent(IResumedDMEvent event) { IDMContext context = event.getDMContext(); if (isSessionAllStop(event.getDMContext().getSessionId()) ) { List<VisualizerThread> tList = fVisualizer.getModel().getThreads(); for(VisualizerThread t : tList) { t.setState(VisualizerExecutionState.RUNNING); } return; } if (context instanceof IContainerDMContext) { } else if (context instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)context).getThreadId(); VisualizerThread thread = fVisualizer.getModel().getThread(tid); if (thread != null) { assert thread.getState() == VisualizerExecutionState.SUSPENDED || thread.getState() == VisualizerExecutionState.CRASHED; thread.setState(VisualizerExecutionState.RUNNING); fVisualizer.getMulticoreVisualizerCanvas().requestUpdate(); } } }

Target:
public void handleEvent(IResumedDMEvent event) { IDMContext context = event.getDMContext(); if (context != null && isSessionAllStop(context.getSessionId()) ) { List<VisualizerThread> tList = fVisualizer.getModel().getThreads(); for(VisualizerThread t : tList) { t.setState(VisualizerExecutionState.RUNNING); } fVisualizer.getMulticoreVisualizerCanvas().requestUpdate(); return; } if (context instanceof IContainerDMContext) { } else if (context instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)context).getThreadId(); VisualizerThread thread = fVisualizer.getModel().getThread(tid); if (thread != null) { assert thread.getState() == VisualizerExecutionState.SUSPENDED || thread.getState() == VisualizerExecutionState.CRASHED; thread.setState(VisualizerExecutionState.RUNNING); fVisualizer.getMulticoreVisualizerCanvas().requestUpdate(); } } }
Source:
public void close() throws IOException { if (this.isClosed) throw new IllegalStateException("Writer is already closed"); this.isClosed = true; this.blockingClose(); }

Target:
public void close() throws IOException { if (this.isClosed) return; this.isClosed = true; this.blockingCheckAndRethrow(); this.drain(); this.blockingCheckAndRethrow(); this.writer.close(); }
Source:
public void onEpochFinished(final Collection<LassoData> epochData, final EpochInfo epochInfo) { final int epochIdx = epochInfo.getEpochIdx(); pullModels(); final double regLoss = computeLoss(epochData); LOG.log(Level.INFO, "Loss value: {0}", new Object[]{regLoss}); if ((epochIdx + 1) % PRINT_MODEL_PERIOD == 0) { for (int i = 0; i < numFeatures; i++) { LOG.log(Level.INFO, "model : {0}", new Object[]{newModel.get(i)}); } } final int numMiniBatches = epochInfo.getNumMiniBatches(); final int numEMBlocks = epochInfo.getNumEMBlocks(); final double epochElapsedTime = (System.currentTimeMillis() - epochInfo.getEpochStartTime()) / 1000.0D; final WorkerMetrics epochMetric = buildEpochMetric(epochIdx, numMiniBatches, numEMBlocks, epochData.size(), regLoss, epochElapsedTime); LOG.log(Level.INFO, "EpochMetrics {0}", epochMetric); sendMetrics(epochMetric); if (decayRate != 1 && (epochIdx + 1) % decayPeriod == 0) { final double prevStepSize = stepSize; stepSize *= decayRate; LOG.log(Level.INFO, "{0} iterations have passed. Step size decays from {1} to {2}", new Object[]{decayPeriod, prevStepSize, stepSize}); } }

Target:
public void onEpochFinished(final Collection<LassoData> epochData, final EpochInfo epochInfo) { final int epochIdx = epochInfo.getEpochIdx(); pullModels(); final double sampleLossSum = computeLoss(epochData); LOG.log(Level.INFO, "Loss value: {0}", sampleLossSum); if ((epochIdx + 1) % PRINT_MODEL_PERIOD == 0) { for (int i = 0; i < numFeatures; i++) { LOG.log(Level.INFO, "model : {0}", newModel.get(i)); } } final int numMiniBatches = epochInfo.getNumMiniBatches(); final int numEMBlocks = epochInfo.getNumEMBlocks(); final double epochElapsedTime = (System.currentTimeMillis() - epochInfo.getEpochStartTime()) / 1000.0D; final WorkerMetrics epochMetric = buildEpochMetric(epochIdx, numMiniBatches, numEMBlocks, epochData.size(), sampleLossSum, epochElapsedTime); LOG.log(Level.INFO, "EpochMetrics {0}", epochMetric); sendMetrics(epochMetric); if (decayRate != 1 && (epochIdx + 1) % decayPeriod == 0) { final double prevStepSize = stepSize; stepSize *= decayRate; LOG.log(Level.INFO, "{0} iterations have passed. Step size decays from {1} to {2}", new Object[]{decayPeriod, prevStepSize, stepSize}); } }
Source:
public ISO8601DateSerde(SimpleDateFormat df, Class<? extends Date> targetType) { this.df = FastDateFormat.getInstance(df.toPattern(), df.getTimeZone()); this.targetType = targetType; }

Target:
public ISO8601DateSerde(SimpleDateFormat df, Class<? extends Date> targetType) { this(df.toPattern(), df.getTimeZone(), targetType); }
Source:
protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { boolean shouldAddPausePartitionsTask = false; _kafkaPositionTrackerTask.updatePositions(readTime, records, _consumer.metrics(), records.partitions().stream().collect(Collectors.toMap(tp -> tp, tp -> _consumer.position(tp)))); for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { sendMessage(record, readTime); } catch (Exception e) { _consumerMetrics.updateErrorRate(1); seekToLastCheckpoint(Collections.singleton(topicPartition)); if (_pausePartitionOnError) { _logger.warn("Got exception while sending record {}, adding topic partition to auto-pause set", record, topicPartition); Instant start = Instant.now(); _autoPausedSourcePartitions.put(topicPartition, PausedSourcePartitionMetadata.sendError(start, _pauseErrorPartitionDuration)); shouldAddPausePartitionsTask = true; } break; } } } if (shouldAddPausePartitionsTask) { _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); } }

Target:
protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { boolean shouldAddPausePartitionsTask = false; for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { sendMessage(record, readTime); } catch (Exception e) { _consumerMetrics.updateErrorRate(1); seekToLastCheckpoint(Collections.singleton(topicPartition)); if (_pausePartitionOnError) { _logger.warn("Got exception while sending record {}, adding topic partition to auto-pause set", record, topicPartition); Instant start = Instant.now(); _autoPausedSourcePartitions.put(topicPartition, PausedSourcePartitionMetadata.sendError(start, _pauseErrorPartitionDuration)); shouldAddPausePartitionsTask = true; } break; } } } _kafkaPositionTracker.updatePositions(readTime, records, _consumer.metrics(), records.partitions().stream().collect(Collectors.toMap(Function.identity(), tp -> _consumer.position(tp)))); if (shouldAddPausePartitionsTask) { _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); } }
Source:
private void flushStripe(FlushReason flushReason) throws IOException { List<OrcDataOutput> outputData = new ArrayList<>(); long stripeStartOffset = orcDataSink.size(); if (closedStripes.isEmpty()) { outputData.add(createDataOutput(MAGIC)); stripeStartOffset += MAGIC.length(); } outputData.addAll(bufferStripeData(stripeStartOffset, flushReason)); if (flushReason == CLOSED) { outputData.addAll(bufferFileFooter()); } orcDataSink.write(outputData); resetInternalWriters(); dictionaryCompressionOptimizer.reset(); rowGroupRowCount = 0; stripeRowCount = 0; bufferedBytes = toIntExact(columnWriters.stream().mapToLong(ColumnWriter::getBufferedBytes).sum()); }

Target:
private void flushStripe(FlushReason flushReason) throws IOException { List<OrcDataOutput> outputData = new ArrayList<>(); long stripeStartOffset = orcDataSink.size(); if (closedStripes.isEmpty()) { outputData.add(createDataOutput(MAGIC)); stripeStartOffset += MAGIC.length(); } outputData.addAll(bufferStripeData(stripeStartOffset, flushReason)); if (flushReason == CLOSED) { outputData.addAll(bufferFileFooter()); } orcDataSink.write(outputData); columnWriters.forEach(ColumnWriter::reset); dictionaryCompressionOptimizer.reset(); rowGroupRowCount = 0; stripeRowCount = 0; bufferedBytes = toIntExact(columnWriters.stream().mapToLong(ColumnWriter::getBufferedBytes).sum()); }
Source:
public void heapUsageMetrics(){ navigation.selectRow().invoke("View"); Application.waitUntilVisible(); MetricsAreaFragment metricsArea = jvmPage.getHeapUsageMetricsArea(); double expectedUsedPercentage = metricsArea.getPercentage(USED, MAX); double expectedCommittedPercentage = metricsArea.getPercentage(COMMITTED, MAX); MetricsFragment usedMetrics = metricsArea.getMetricsFragment(USED); MetricsFragment committedMetrics = metricsArea.getMetricsFragment(COMMITTED); assertEquals(expectedUsedPercentage, usedMetrics.getPercentage(), DELTA); assertEquals(expectedCommittedPercentage, committedMetrics.getPercentage(), DELTA); }

Target:
public void heapUsageMetrics(){ MetricsAreaFragment metricsArea = jvmPage.getHeapUsageMetricsArea(); double expectedUsedPercentage = metricsArea.getPercentage(USED, MAX); double expectedCommittedPercentage = metricsArea.getPercentage(COMMITTED, MAX); MetricsFragment usedMetrics = metricsArea.getMetricsFragment(USED); MetricsFragment committedMetrics = metricsArea.getMetricsFragment(COMMITTED); assertEquals(expectedUsedPercentage, usedMetrics.getPercentage(), DELTA); assertEquals(expectedCommittedPercentage, committedMetrics.getPercentage(), DELTA); }
Source:
private void trustStoreFileChooserButton() { trustStoreFileChooserButton = new JButton(JWTI18n.getMessage("jwt.settings.filechooser.button")); trustStoreFileChooserButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trustStoreFileChooser = new JFileChooser(); trustStoreFileChooser.setFileFilter( new FileFilter() { @Override public String getDescription() { return "PKCS12 format"; } @Override public boolean accept(File f) { return f.getName().endsWith(".p12") || f.isDirectory(); } }); trustStoreFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); String path = trustStoreFileChooserTextField.getText(); if (!path.isEmpty()) { File file = new File(path); if (file.exists()) { trustStoreFileChooser.setSelectedFile(file); } } if (trustStoreFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { final File selectedFile = trustStoreFileChooser.getSelectedFile(); trustStorePath = selectedFile.getAbsolutePath(); trustStoreFileChooserTextField.setText(selectedFile.getAbsolutePath()); } } }); }

Target:
private void trustStoreFileChooserButton() { trustStoreFileChooserButton = new JButton(JWTI18n.getMessage("jwt.settings.filechooser.button")); trustStoreFileChooserButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trustStoreFileChooser = new JFileChooser(); trustStoreFileChooser.setFileFilter( new FileFilter() { @Override public String getDescription() { return JWTI18n.getMessage( "jwt.settings.rsa.trustStoreFileDescription"); } @Override public boolean accept(File f) { return f.getName().endsWith(".p12") || f.isDirectory(); } }); trustStoreFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); String path = trustStoreFileChooserTextField.getText(); if (!path.isEmpty()) { File file = new File(path); if (file.exists()) { trustStoreFileChooser.setSelectedFile(file); } } if (trustStoreFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { final File selectedFile = trustStoreFileChooser.getSelectedFile(); trustStorePath = selectedFile.getAbsolutePath(); trustStoreFileChooserTextField.setText(selectedFile.getAbsolutePath()); } } }); }
Source:
public void testTableFinish() { TableWriterNode.WriterTarget writerTarget = new TableWriterNode.WriterTarget() { @Override public String toString() { return null; } }; TableFinishNode tableFinishNode = new TableFinishNode( new PlanNodeId("1"), valuesNode, writerTarget, variableReferenceExpression, Optional.empty(), Optional.empty()); testValidation(tableFinishNode); }

Target:
public void testTableFinish() { TableFinishNode tableFinishNode = new TableFinishNode( new PlanNodeId("1"), valuesNode, new TestingWriterTarget(), VARIABLE_REFERENCE_EXPRESSION, Optional.empty(), Optional.empty()); testValidation(tableFinishNode); }
Source:
public void onNewBatch(String topic, Cluster cluster, int prevPartition) { synchronized (topicCounterMap) { AtomicInteger counter = topicCounterMap.get(topic); topicCounterMap.put(topic, new AtomicInteger(counter.decrementAndGet())); } }

Target:
public void onNewBatch(String topic, Cluster cluster, int prevPartition) { topicCounterMap.computeIfPresent(topic, (k, v) -> new AtomicInteger(v.decrementAndGet())); }
Source:
public void testImportSequenceFile_currentFormatWithHBase094Deserializer() throws Exception { String tableId = "test_" + UUID.randomUUID().toString(); File sequenceFile = tmpFolder.newFile(tableId); SequenceFileIoUtils.createFileWithData(sequenceFile, getTestData()); HBaseImportOptions options = createImportOptions( sequenceFile.getPath(), tableId, true ); options.setFilePattern(options.getFilePattern()); try (BigtableTableUtils tableUtils = tableUtilsFactory.createBigtableTableUtils( tableId, Bytes.toString(CF))) { assertFalse(tableUtils.isTableExists()); tableUtils.createEmptyTable(); try { doImport(options); fail("Expecting RuntimeException"); } catch (RuntimeException expected) } assertFalse(tableUtilsFactory.createBigtableTableUtils( tableId, Bytes.toString(CF)).isTableExists()); }

Target:
public void testImportSequenceFile_currentFormatWithHBase094Deserializer() throws Exception { String tableId = "test_" + UUID.randomUUID().toString(); File sequenceFile = tmpFolder.newFile(tableId); SequenceFileIoUtils.createFileWithData(sequenceFile, getTestData()); HBaseImportOptions options = createImportOptions( sequenceFile.getPath(), tableId, true ); options.setFilePattern(options.getFilePattern()); try (BigtableTableUtils tableUtils = tableUtilsFactory.createBigtableTableUtils( tableId, Bytes.toString(CF))) { assertFalse(tableUtils.isTableExists()); tableUtils.createEmptyTable(); try { doImport(options); fail("Expecting failure."); } catch (Throwable expected) { } } assertFalse(tableUtilsFactory.createBigtableTableUtils( tableId, Bytes.toString(CF)).isTableExists()); }
Source:
public ManagedClass infer(Class javaClass) { List<Property> properties = propertyScanner.scan(javaClass); Property foundIdProperty = findIdProperty(properties); if (foundIdProperty != null) { logger.info("javersType type of " +javaClass.getSimpleName()+"(id:"+foundIdProperty.getName()+") inferred as Entity"); return new Entity(javaClass, properties, foundIdProperty); } else { logger.info("javersType of " +javaClass.getSimpleName() + " inferred as ValueObject"); return new ValueObject(javaClass, properties); } }

Target:
public ManagedClass infer(Class javaClass) { List<Property> properties = propertyScanner.scan(javaClass); Property foundIdProperty = findIdProperty(properties); if (foundIdProperty != null) { logger.info("javersType type of {}(id:{}) inferred as Entity", javaClass.getSimpleName(), foundIdProperty.getName()); return new Entity(javaClass, properties, foundIdProperty); } else { logger.info("javersType of inferred as ValueObject", javaClass.getSimpleName()); return new ValueObject(javaClass, properties); } }
Source:
public void removeAllAttributes(PerunSession sess, UserExtSource ues) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException { List<Attribute> attributes = getAttributes(sess, ues); User user; try { user = getPerunBl().getUsersManagerBl().getUserByUserExtSource(sess, ues); } catch (UserNotExistsException ex) { throw new ConsistencyErrorException("Can't get user for userExtSource" + ues); } getAttributesManagerImpl().removeAllAttributes(sess, ues); getPerunBl().getAuditer().log(sess, "All attributes removed for assigned to {}", ues, user); for(Attribute attribute : attributes) attribute.setValue(null); try { checkAttributesValue(sess, ues, attributes); this.checkAttributesDependencies(sess, ues, null, attributes); } catch(WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } for(Attribute attribute: attributes) { try { getAttributesManagerImpl().changedAttributeHook(sess, ues, new Attribute(attribute)); } catch (WrongAttributeValueException ex) { throw new InternalErrorException(ex); } catch (WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } } }

Target:
public void removeAllAttributes(PerunSession sess, UserExtSource ues) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException { List<Attribute> attributes = getAttributes(sess, ues); getAttributesManagerImpl().removeAllAttributes(sess, ues); getPerunBl().getAuditer().log(sess, "All attributes removed for {}", ues); for(Attribute attribute : attributes) attribute.setValue(null); try { checkAttributesValue(sess, ues, attributes); this.checkAttributesDependencies(sess, ues, null, attributes); } catch(WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } for(Attribute attribute: attributes) { try { getAttributesManagerImpl().changedAttributeHook(sess, ues, new Attribute(attribute)); } catch (WrongAttributeValueException ex) { throw new InternalErrorException(ex); } catch (WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } } }
Source:
protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { ITmfTrace trace = getTrace(); if (trace == null) { fInitializationSucceeded = false; fInitialized.countDown(); return false; } IStatus status1 = totalsModule.schedule(); IStatus status2 = eventTypesModule.schedule(); if (!(status1.isOK() && status2.isOK())) { cancelSubAnalyses(); fInitializationSucceeded = false; fInitialized.countDown(); return false; } if (!totalsModule.waitForInitialization() || !eventTypesModule.waitForInitialization()) { fInitializationSucceeded = false; fInitialized.countDown(); return false; } ITmfStateSystem totalsSS = totalsModule.getStateSystem(); ITmfStateSystem eventTypesSS = eventTypesModule.getStateSystem(); if (totalsSS == null || eventTypesSS == null) { fInitializationSucceeded = false; fInitialized.countDown(); throw new IllegalArgumentException("TmfStatisticsModule : Sub-modules initialization succeeded but there is a null state system."); } fStatistics = new TmfStateStatistics(totalsSS, eventTypesSS); fInitializationSucceeded = true; fInitialized.countDown(); if (!(totalsModule.waitForCompletion(monitor) && eventTypesModule.waitForCompletion(monitor))) { return false; } return true; }

Target:
protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { ITmfTrace trace = getTrace(); if (trace == null) { fInitializationSucceeded = false; fInitialized.countDown(); return false; } IStatus status1 = totalsModule.schedule(); IStatus status2 = eventTypesModule.schedule(); if (!(status1.isOK() && status2.isOK())) { cancelSubAnalyses(); fInitializationSucceeded = false; fInitialized.countDown(); return false; } if (!totalsModule.waitForInitialization() || !eventTypesModule.waitForInitialization()) { fInitializationSucceeded = false; fInitialized.countDown(); return false; } ITmfStateSystem totalsSS = totalsModule.getStateSystem(); ITmfStateSystem eventTypesSS = eventTypesModule.getStateSystem(); if (totalsSS == null || eventTypesSS == null) { fInitializationSucceeded = false; fInitialized.countDown(); throw new IllegalStateException("TmfStatisticsModule : Sub-modules initialization succeeded but there is a null state system."); } fStatistics = new TmfStateStatistics(totalsSS, eventTypesSS); fInitializationSucceeded = true; fInitialized.countDown(); if (!(totalsModule.waitForCompletion(monitor) && eventTypesModule.waitForCompletion(monitor))) { return false; } return true; }
Source:
protected void clearStorage(boolean onShutdown) { if (onShutdown) { NodeEngine nodeEngine = mapServiceContext.getNodeEngine(); NativeMemoryConfig nativeMemoryConfig = nodeEngine.getConfig().getNativeMemoryConfig(); boolean shouldClear = (nativeMemoryConfig != null && nativeMemoryConfig.getAllocatorType() != POOLED); if (shouldClear) { storage.clear(true); } storage.destroy(true); } else { storage.clear(false); } mutationObserver.onClear(); }

Target:
protected void clearStorage(boolean onShutdown) { if (onShutdown) { NodeEngine nodeEngine = mapServiceContext.getNodeEngine(); NativeMemoryConfig nativeMemoryConfig = nodeEngine.getConfig().getNativeMemoryConfig(); boolean shouldClear = (nativeMemoryConfig != null && nativeMemoryConfig.getAllocatorType() != POOLED); if (shouldClear) { storage.clear(true); mutationObserver.onClear(); } storage.destroy(true); mutationObserver.onDestroy(true); } else { storage.clear(false); mutationObserver.onClear(); } }
Source:
public Object execute(ExecutionEvent aEvent) throws ExecutionException { final GerritTableView reviewTableView = GerritTableView .getActiveView(); final TableViewer viewer = reviewTableView.getTableViewer(); final ISelection tableSelection = viewer.getSelection(); final Job job = new Job(COMMAND_MESSAGE) { @Override protected IStatus run(IProgressMonitor monitor) { if (tableSelection.isEmpty()) { GerritUi.Ftracer.traceInfo("Selected table selection is EMPTY " ); } else { if (tableSelection instanceof IStructuredSelection ) { Object obj = ((IStructuredSelection) tableSelection).getFirstElement(); if (obj instanceof GerritTask) { item = (GerritTask) obj; try { reviewTableView.setStarred(item.getTaskId(), !item.getStarred(), monitor); item.toggleStarred(GerritTask.IS_STARRED, Boolean.toString(!Boolean.valueOf(item.getAttribute(GerritTask.IS_STARRED)))); } catch (CoreException e) { UIUtils.showErrorDialog(e.getMessage(), e.getStatus().getException().getMessage()); } Display.getDefault().asyncExec(new Runnable() { public void run() { viewer.update(item, null); } }); } } } return Status.OK_STATUS; }}; job.setUser(false); job.schedule(); return null; }

Target:
public Object execute(ExecutionEvent aEvent) throws ExecutionException { final GerritTableView reviewTableView = GerritTableView.getActiveView(); final TableViewer viewer = reviewTableView.getTableViewer(); final ISelection tableSelection = viewer.getSelection(); if (tableSelection.isEmpty()) { GerritUi.Ftracer.traceInfo("Selected table selection is EMPTY "); return null; } final Job job = new Job(COMMAND_MESSAGE) { @Override protected IStatus run(IProgressMonitor monitor) { if (tableSelection instanceof IStructuredSelection) { Object obj = ((IStructuredSelection) tableSelection) .getFirstElement(); if (obj instanceof GerritTask) { item = (GerritTask) obj; try { reviewTableView.setStarred(item.getTaskId(), !item.getStarred(), monitor); item.setAttribute( GerritTask.IS_STARRED, Boolean.toString(!Boolean.valueOf(item .getAttribute(GerritTask.IS_STARRED)))); } catch (CoreException e) { UIUtils.showErrorDialog(e.getMessage(), e .getStatus().getException().getMessage()); } Display.getDefault().asyncExec(new Runnable() { public void run() { viewer.update(item, null); } }); } } return Status.OK_STATUS; } }; job.setUser(false); job.schedule(); return null; }
Source:
public static void addDisposableListChangeListener( final IListChangeListener listener, final IObservableList observable, Control control) { Assert.isLegal(listener != null); Assert.isLegal(observable != null); Assert.isLegal(control != null); if (control.isDisposed()) { return; } observable.addListChangeListener(listener); control.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { observable.removeListChangeListener(listener); } }); }

Target:
public static void addDisposableListChangeListener( final IListChangeListener listener, final IObservableList observable, Control control) { Assert.isNotNull(listener); Assert.isNotNull(observable); Assert.isNotNull(control); if (control.isDisposed()) { return; } observable.addListChangeListener(listener); control.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { observable.removeListChangeListener(listener); } }); }
Source:
public WPDeleteSitePreference(Context context, AttributeSet attrs) { super(context, attrs); mButtonTextColor = ContextCompat.getColor(context, R.color.black); TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.WPIconWidgetPreference); for (int i = 0; i < array.getIndexCount(); ++i) { int index = array.getIndex(i); if (index == R.styleable.WPDeleteSitePreference_buttonText) { mButtonText = array.getString(index); } else if (index == R.styleable.WPDeleteSitePreference_buttonTextColor) { mButtonTextColor = array.getColor(index, ContextCompat.getColor(context, R.color.black)); } else if (index == R.styleable.WPDeleteSitePreference_buttonTextAllCaps) { mButtonTextAllCaps = array.getBoolean(index, false); } } array.recycle(); }

Target:
public WPDeleteSitePreference(Context context, AttributeSet attrs) { super(context, attrs); mButtonTextColor = ContextCompat.getColor(context, R.color.black); TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.WPDeleteSitePreference); for (int i = 0; i < array.getIndexCount(); ++i) { int index = array.getIndex(i); if (index == R.styleable.WPDeleteSitePreference_buttonText) { mButtonText = array.getString(index); } else if (index == R.styleable.WPDeleteSitePreference_buttonTextColor) { mButtonTextColor = array.getColor(index, ContextCompat.getColor(context, R.color.black)); } else if (index == R.styleable.WPDeleteSitePreference_buttonTextAllCaps) { mButtonTextAllCaps = array.getBoolean(index, false); } } array.recycle(); }
Source:
public static String createArrayFieldNameFromCountField(String countField){ if(countField == null){ return null; } if(!doesFieldNameMatchArrayCountPattern(countField)){ return countField; } return countField.substring(0, countField.length() - 1); }

Target:
public static String createArrayFieldNameFromCountField(String countField){ if(doesFieldNameMatchArrayCountPattern(countField)){ return countField.substring(0, countField.length() - 1); } return countField; }