auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
StateTransitionResult.Failure establishWebsocketConnection() throws InterruptedException { try { websocket = WebsocketImplProvider.getWebsocketImpl(OkHttpWebsocketImpl.class, connectionInternal, discoveredEndpoints); for (WebsocketRemoteConnectionEndpoint endpoint : discoveredEndpoints.getResult().discoveredRemoteConnectionEndpoints) { boolean connectionSuccessful = websocket.connect(endpoint); if (connectionSuccessful) { break; } } } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { Logger.getAnonymousLogger().log(Level.WARNING, "Couldn't obtain the underlying websocket implementation: ", exception); return new StateTransitionResult.FailureCausedByException<Exception>(exception); } catch (SmackException | XMPPException | WebsocketException exception) { Logger.getAnonymousLogger().log(Level.WARNING, "Couldn't connect to any of the discovered endpoints: ", exception); return new StateTransitionResult.FailureCausedByException<Exception>(exception); } return null; }

Target:
AbstractWebsocket establishWebsocketConnection() throws InterruptedException, WebsocketException { List<WebsocketRemoteConnectionEndpoint> endpoints = discoveredEndpoints.result.discoveredRemoteConnectionEndpoints; if (endpoints.isEmpty()) { throw new WebsocketException(new Throwable("No Endpoints discovered to establish connection")); } List<Throwable> connectionFailureList = new ArrayList<>(); AbstractWebsocket websocket; try { websocket = WebsocketImplProvider.getWebsocketImpl(OkHttpWebsocket.class, connectionInternal, discoveredEndpoints); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { throw new WebsocketException(exception); } for (WebsocketRemoteConnectionEndpoint endpoint : endpoints) { try { websocket.connect(endpoint); connectedEndpoint = endpoint; break; } catch (Throwable t) { connectionFailureList.add(t); if (connectionFailureList.size() == endpoints.size()) { WebsocketException websocketException = new WebsocketException(connectionFailureList); throw new WebsocketException(websocketException); } } } assert connectedEndpoint != null; return websocket; }
Source:
default Spliterator<T> spliterator() { int characteristics = Spliterator.IMMUTABLE; if (isDistinct()) { characteristics |= Spliterator.DISTINCT; } if (isOrdered()) { characteristics |= (Spliterator.ORDERED | Spliterator.SORTED); } if (hasDefiniteSize()) { characteristics |= (Spliterator.SIZED | Spliterator.SUBSIZED); return Spliterators.spliterator(iterator(), length(), characteristics); } return Spliterators.spliteratorUnknownSize(iterator(), characteristics); }

Target:
default Spliterator<T> spliterator() { int characteristics = Spliterator.IMMUTABLE; if (isDistinct()) { characteristics |= Spliterator.DISTINCT; } if (isOrdered()) { characteristics |= (Spliterator.SORTED | Spliterator.ORDERED); } if (isSequential()) { characteristics |= Spliterator.ORDERED; } if (hasDefiniteSize()) { characteristics |= (Spliterator.SIZED | Spliterator.SUBSIZED); return Spliterators.spliterator(iterator(), length(), characteristics); } else { return Spliterators.spliteratorUnknownSize(iterator(), characteristics); } }
Source:
private long getTime(final Operator operator) { final WorkerQueryPartition workerQueryPartition = (WorkerQueryPartition) operator.getQueryPartition(); final long workerStartTimeMillis = workerQueryPartition.getBeginMilliseconds(); final long threadStartTimeMillis = operator.getSubTreeTask().getBeginMilliseconds(); final long startupTimeMillis = threadStartTimeMillis - workerStartTimeMillis; Preconditions.checkArgument(startupTimeMillis >= 0); final long threadStartNanos = operator.getSubTreeTask().getBeginNanoseconds(); final long activeTimeNanos = System.nanoTime() - threadStartNanos; return TimeUnit.MILLISECONDS.toNanos(startupTimeMillis) + activeTimeNanos; }

Target:
private long getTime(final Operator operator) { final WorkerQueryPartition workerQueryPartition = (WorkerQueryPartition) operator.getQueryPartition(); final long workerStartTimeMillis = workerQueryPartition.getBeginMilliseconds(); final long threadStartTimeMillis = operator.getSubTreeTask().getBeginMilliseconds(); final long startupTimeMillis = threadStartTimeMillis - workerStartTimeMillis; Preconditions.checkArgument(startupTimeMillis >= 0, "Thread that works on fragment cannot run before query is initialized."); final long threadStartNanos = operator.getSubTreeTask().getBeginNanoseconds(); final long activeTimeNanos = System.nanoTime() - threadStartNanos; return TimeUnit.MILLISECONDS.toNanos(startupTimeMillis) + activeTimeNanos; }
Source:
private static DatabaseType guessDialect(String name) { DatabaseType type = null; if (name != null) { if (name.toLowerCase().contains("mysql")) { type = DatabaseType.MYSQL; } else if (name.toLowerCase().contains("postgres")) { type = DatabaseType.POSTGRES; } else if (name.toLowerCase().contains("derby")) { type = DatabaseType.DERBY; } else if (name.toLowerCase().contains("hsql") || name.toLowerCase().contains("hypersonic")) { type = DatabaseType.HSQL; } else if (name.toLowerCase().contains("h2")) { type = DatabaseType.H2; } else if (name.toLowerCase().contains("sqlite")) { type = DatabaseType.SQLITE; } else if (name.toLowerCase().contains("db2")) { type = DatabaseType.DB2; } else if (name.toLowerCase().contains("informix")) { type = DatabaseType.INFORMIX; } else if (name.toLowerCase().contains("interbase")) { type = DatabaseType.INTERBASE; } else if (name.toLowerCase().contains("firebird")) { type = DatabaseType.FIREBIRD; } else if (name.toLowerCase().contains("sqlserver") || name.toLowerCase().contains("microsoft")) { type = DatabaseType.SQL_SERVER; } else if (name.toLowerCase().contains("access")) { type = DatabaseType.ACCESS; } else if (name.toLowerCase().contains("oracle")) { type = DatabaseType.ORACLE; } else if (name.toLowerCase().contains("adaptive")) { type = DatabaseType.SYBASE; } } return type; }

Target:
private static DatabaseType guessDialect(String name) { DatabaseType type = null; if (name == null) return null; name = name.toLowerCase(); if (name.contains("mysql")) { type = DatabaseType.MYSQL; } else if (name.contains("postgres")) { type = DatabaseType.POSTGRES; } else if (name.contains("derby")) { type = DatabaseType.DERBY; } else if (name.contains("hsql") || name.contains("hypersonic")) { type = DatabaseType.HSQL; } else if (name.contains("h2")) { type = DatabaseType.H2; } else if (name.contains("sqlite")) { type = DatabaseType.SQLITE; } else if (name.contains("db2")) { type = DatabaseType.DB2; } else if (name.contains("informix")) { type = DatabaseType.INFORMIX; } else if (name.contains("interbase")) { type = DatabaseType.INTERBASE; } else if (name.contains("firebird")) { type = DatabaseType.FIREBIRD; } else if (name.contains("sqlserver") || name.contains("microsoft")) { type = DatabaseType.SQL_SERVER; } else if (name.contains("access")) { type = DatabaseType.ACCESS; } else if (name.contains("oracle")) { type = DatabaseType.ORACLE; } else if (name.contains("adaptive")) { type = DatabaseType.SYBASE; } return type; }
Source:
protected boolean canDoAction() { final boolean wrongInput = getParameters() == null || getMacPool() == null || getMacPoolId() == null; if (!super.canDoAction() || wrongInput) { return false; } final MacPool macPool = getParameters().getMacPool(); if (StringUtils.isEmpty(macPool.getName())) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_MUST_HAVE_NAME); return false; } if (macPool.getRanges() == null || macPool.getRanges().isEmpty()) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_MUST_HAVE_RANGE); return false; } oldMacPool = macPoolDao.get(getMacPoolId()); if (oldMacPool == null) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_DOES_NOT_EXIST); return false; } return true; }

Target:
protected boolean canDoAction() { final boolean wrongInput = getParameters() == null || getMacPool() == null || getMacPoolId() == null; if (!super.canDoAction() || wrongInput) { return false; } final MacPool macPool = getParameters().getMacPool(); if (StringUtils.isEmpty(macPool.getName())) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_MUST_HAVE_NAME); return false; } if (macPool.getRanges() == null || macPool.getRanges().isEmpty()) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_MUST_HAVE_RANGE); return false; } oldMacPool = getMacPoolDAO().get(getMacPoolId()); if (oldMacPool == null) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_DOES_NOT_EXIST); return false; } return true; }
Source:
@Override Bitmap decode(Uri uri, PicassoBitmapOptions options) throws IOException { options.exifRotation = Utils.getContentProviderExifRotation(context.getContentResolver(), uri); return super.decode(uri, options); }

Target:
@Override Bitmap decode(Uri uri, PicassoBitmapOptions options) throws IOException { if (options != null) { options.exifRotation = getContentProviderExifRotation(context.getContentResolver(), uri); } return super.decode(uri, options); }
Source:
public void onMenuSelected(MenuItem item) { int itemId = item.getItemId(); String itemTitle = item.getTitle().toString(); if (Arrays.asList(filterTitleResources).contains(itemTitle)) { handleFilterRequest(sortingKeys[itemId], filterTitleResources[itemId]); } else if (itemId == 0) { handleSortingRequest(SortMode.ALL, R.string.label_sort_all); } else if (itemId == 1) { handleSortingRequest(SortMode.PROGRESS, R.string.label_sort_progress); } else { Log.d(AwardGridFragment.class.getSimpleName(), "Unknown MenuItem " + item.getTitle()); } }

Target:
public void onMenuSelected(MenuItem item) { int itemId = item.getItemId(); String itemTitle = item.getTitle().toString(); if (Arrays.asList(filterTitleResources).contains(itemTitle)) { handleFilterRequest(sortingKeys[itemId], filterTitleResources[itemId]); } else if (itemTitle.equals(sortTitleResources[0])) { handleSortingRequest(SortMode.ALL, sortTitleResources[0]); } else if (itemTitle.equals(sortTitleResources[1])) { handleSortingRequest(SortMode.PROGRESS, sortTitleResources[1]); } else { Log.d(AwardGridFragment.class.getSimpleName(), "Unknown MenuItem " + item.getTitle()); } }
Source:
public void beginRecognizeCustomFormsWithOptions() throws IOException { File form = new File("{local/file_path/fileName.jpg}"); String modelId = "{custom_trained_model_id}"; boolean includeTextContent = true; byte[] fileContent = Files.readAllBytes(form.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); formRecognizerClient.beginRecognizeCustomForms(new RecognizeCustomFormsOptions(targetStream, form.length(), modelId).setFormContentType(FormContentType.IMAGE_JPEG) .setIncludeFieldElements(includeTextContent).setPollInterval(Duration.ofSeconds(5))).getFinalResult() .forEach(recognizedForm -> recognizedForm.getFields().entrySet().forEach(entry -> { String fieldText = entry.getKey(); FormField fieldValue = entry.getValue(); System.out.printf("Field text: %s%n", fieldText); System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); })); END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomForms#recognizeCustomFormsOptions }

Target:
public void beginRecognizeCustomFormsWithOptions() throws IOException { File form = new File("{local/file_path/fileName.jpg}"); String modelId = "{custom_trained_model_id}"; boolean includeFieldElements = true; byte[] fileContent = Files.readAllBytes(form.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); formRecognizerClient.beginRecognizeCustomForms(new RecognizeCustomFormsOptions(targetStream, form.length(), modelId).setFormContentType(FormContentType.IMAGE_JPEG) .setIncludeFieldElements(includeFieldElements).setPollInterval(Duration.ofSeconds(5))).getFinalResult() .forEach(recognizedForm -> recognizedForm.getFields().entrySet().forEach(entry -> { String fieldText = entry.getKey(); FormField fieldValue = entry.getValue(); System.out.printf("Field text: %s%n", fieldText); System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); })); END: com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomForms#recognizeCustomFormsOptions }
Source:
private static KeyPair parseOpenSSHKeys(ByteIterator byteIterator, FilePasswordProvider passphraseProvider) throws IllegalArgumentException { OpenSSHKeyPairResourceParser resourceParser = new OpenSSHKeyPairResourceParser(); byte[] stream = byteIterator.drain(); try { return resourceParser.extractKeyPairs(null, null, OpenSSHKeyPairResourceParser.BEGIN_MARKER, OpenSSHKeyPairResourceParser.END_MARKER, passphraseProvider, stream, null).iterator().next(); } catch (IOException e) { log.openSshParseError(e.getMessage()); } catch (GeneralSecurityException e) { log.openSshGeneratingError(e.getMessage()); } return null; }

Target:
private static KeyPair parseOpenSSHKeys(ByteIterator byteIterator, FilePasswordProvider passphraseProvider) throws IllegalArgumentException { OpenSSHKeyPairResourceParser resourceParser = new OpenSSHKeyPairResourceParser(); byte[] stream = byteIterator.drain(); try { return resourceParser.extractKeyPairs(null, null, OpenSSHKeyPairResourceParser.BEGIN_MARKER, OpenSSHKeyPairResourceParser.END_MARKER, passphraseProvider, stream, null).iterator().next(); } catch (IOException e) { throw log.openSshParseError(e.getMessage()); } catch (GeneralSecurityException e) { throw log.openSshGeneratingError(e.getMessage()); } }
Source:
public void testSimpleBlobPutSuccess() throws Exception { requestAndResultsList.clear(); requestAndResultsList.add(new RequestAndResult(chunkSize)); submitPutsAndAssertSuccess(true); for (int i = 0; i < 1; i++) { requestAndResultsList.clear(); requestAndResultsList.add(new RequestAndResult(random.nextInt(chunkSize) + 1)); submitPutsAndAssertSuccess(true); } }

Target:
public void testSimpleBlobPutSuccess() throws Exception { requestAndResultsList.clear(); requestAndResultsList.add(new RequestAndResult(chunkSize)); submitPutsAndAssertSuccess(true); for (int i = 0; i < 10; i++) { requestAndResultsList.clear(); requestAndResultsList.add(new RequestAndResult(random.nextInt(chunkSize) + 1)); submitPutsAndAssertSuccess(true); } }
Source:
public Account modify( @Scope({OAuthScope.USER_EXTENDED}) final AccessToken accessToken, @Valid final Account account) { LOGGER.warn("Last modified (modify) = {}", account.lastModified); final Optional<Account> optionalAccount = accountDAO.update(account, accessToken.accountId); if(!optionalAccount.isPresent()) { LOGGER.warn("Last modified condition did not match data from DB for account_id= {}, diff last_modified (got {})", accessToken.accountId, account.lastModified); final JsonError error = new JsonError(Response.Status.PRECONDITION_FAILED.getStatusCode(), "pre condition failed"); throw new WebApplicationException(Response.status(Response.Status.PRECONDITION_FAILED) .entity(error).build()); } if (account.hasLocation()) { try { final String ip = getIpAddress(request); LOGGER.debug("Insert new account location for account: {}, lat: {}, long: {}, IP: {}", accessToken.accountId, account.latitude, account.longitude, ip); accountLocationDAO.insertNewAccountLatLongIP(accessToken.accountId, ip, account.latitude, account.longitude); } catch (UnableToExecuteStatementException exception) { LOGGER.error("Unable to insert new account location for account: {}", accessToken.accountId); } } return optionalAccount.get(); }

Target:
public Account modify( @Scope({OAuthScope.USER_EXTENDED}) final AccessToken accessToken, @Valid final Account account) { LOGGER.warn("level=warning action=modify-account account_id={} last_modified={}", accessToken.accountId, account.lastModified); final Optional<Account> optionalAccount = accountDAO.update(account, accessToken.accountId); if(!optionalAccount.isPresent()) { LOGGER.warn("level=warning error_message=last-modified-condition-did-not-match-DB-data account_id={} last_modified={}", accessToken.accountId, account.lastModified); final JsonError error = new JsonError(Response.Status.PRECONDITION_FAILED.getStatusCode(), "pre condition failed"); throw new WebApplicationException(Response.status(Response.Status.PRECONDITION_FAILED) .entity(error).build()); } if (account.hasLocation()) { final String ip = BaseResource.getIpAddress(request); try { LOGGER.debug("level=debug action=insert-account-location account_id={} latitude={} longitude={} ip={}", accessToken.accountId, account.latitude, account.longitude, ip); accountLocationDAO.insertNewAccountLatLongIP(accessToken.accountId, ip, account.latitude, account.longitude); } catch (UnableToExecuteStatementException exception) { LOGGER.error("level=error error_message=fail-to-insert-account-location account_id={} latitude={} longitude={} ip={}", accessToken.accountId, account.latitude, account.longitude, ip); } } return optionalAccount.get(); }
Source:
private void registerListeners(Cache<K, V> cache, ServiceProvider serviceLocator, List<LifeCycled> lifeCycledList) { if (!eventListenerConfigurations.isEmpty()) { final CacheEventListenerProvider listenerProvider = serviceLocator.getService(CacheEventListenerProvider.class); if (listenerProvider == null) { throw new IllegalStateException("No CacheEventListenerProvider could be found - did you configure one?"); } for (CacheEventListenerConfiguration config : eventListenerConfigurations) { final CacheEventListener<K, V> listener = listenerProvider.createEventListener(id, config); if (listener != null) { cache.getRuntimeConfiguration().registerCacheEventListener(listener, config.orderingMode(), config.firingMode(), config.fireOn()); lifeCycledList.add(new LifeCycled() { @Override public void init() throws Exception { } @Override public void close() throws Exception { listenerProvider.releaseEventListener(listener); } }); } } } eventNotifier.setListenerSource(cache); }

Target:
private void registerListeners(Cache<K, V> cache, ServiceProvider serviceLocator, List<LifeCycled> lifeCycledList) { if (!eventListenerConfigurations.isEmpty()) { final CacheEventListenerProvider listenerProvider; CacheEventListenerProvider provider; if ((provider = serviceLocator.getService(CacheEventListenerProvider.class)) != null) { listenerProvider = provider; } else { listenerProvider = new DefaultCacheEventListenerProvider(); } for (CacheEventListenerConfiguration config : eventListenerConfigurations) { final CacheEventListener<K, V> listener = listenerProvider.createEventListener(id, config); if (listener != null) { cache.getRuntimeConfiguration().registerCacheEventListener(listener, config.orderingMode(), config.firingMode(), config.fireOn()); lifeCycledList.add(new LifeCycled() { @Override public void init() throws Exception { } @Override public void close() throws Exception { listenerProvider.releaseEventListener(listener); } }); } } } eventDispatcher.setListenerSource(cache); }
Source:
public static EngineVersion fromString(String engineVersion) { switch (engineVersion) { case "stable": return STABLE; case "experimental": return EXPERIMENTAL; case "legacy": return LEGACY; case "current": return CURRENT; default: return new EngineVersion(engineVersion); } }

Target:
public static EngineVersion fromString(String engineVersion) { return new EngineVersion(engineVersion); }
Source:
public boolean hasSpatialIndex(FeatureEntry entry) throws IOException { try { Connection cx = connPool.getConnection(); try { String tableName = getSpatialIndexName(entry).replace("\"", ""); PreparedStatement ps = prepare(cx, "SELECT name FROM sqlite_master WHERE type='table' AND name=? ") .set(tableName) .log(Level.FINE).statement(); try { ResultSet rs = ps.executeQuery(); try { return rs.next(); } finally { close(rs); } } finally { close(ps); } } finally { close (cx); } } catch (SQLException e) { throw new IOException(e); } }

Target:
public boolean hasSpatialIndex(FeatureEntry entry) throws IOException { try { Connection cx = connPool.getConnection(); try { String tableName = getSpatialIndexName(entry); PreparedStatement ps = prepare(cx, "SELECT name FROM sqlite_master WHERE type='table' AND name=? ") .set(tableName) .log(Level.FINE).statement(); try { ResultSet rs = ps.executeQuery(); try { return rs.next(); } finally { close(rs); } } finally { close(ps); } } finally { close (cx); } } catch (SQLException e) { throw new IOException(e); } }
Source:
protected SetOperationNode( @JsonProperty("id") PlanNodeId id, @JsonProperty("sources") List<PlanNode> sources, @JsonProperty("outputVariables") List<VariableReferenceExpression> outputVariables, @JsonProperty("outputToInputs") Map<VariableReferenceExpression, List<VariableReferenceExpression>> outputToInputs) { super(id); requireNonNull(sources, "sources is null"); checkArgument(!sources.isEmpty(), "Must have at least one source"); requireNonNull(outputToInputs, "outputToInputs is null"); this.sources = unmodifiableList(new ArrayList<>(sources)); Map<VariableReferenceExpression, List<VariableReferenceExpression>> copiedMap = new LinkedHashMap<>(); outputToInputs.forEach((key, value) -> copiedMap.put(key, unmodifiableList(new ArrayList<>(value)))); this.outputToInputs = unmodifiableMap(new LinkedHashMap<>(copiedMap)); this.outputVariables = unmodifiableList(new ArrayList<>(outputVariables)); for (Collection<VariableReferenceExpression> inputs : this.outputToInputs.values()) { checkArgument( inputs.size() == this.sources.size(), format("Every source needs to map its variables to an output %s operation variables", this.getClass().getSimpleName())); } for (int i = 0; i < sources.size(); i++) { for (List<VariableReferenceExpression> expectedInputs : this.outputToInputs.values()) { checkArgument(sources.get(i).getOutputVariables().contains(expectedInputs.get(i)), "Source does not provide required variables"); } } }

Target:
protected SetOperationNode( @JsonProperty("id") PlanNodeId id, @JsonProperty("sources") List<PlanNode> sources, @JsonProperty("outputVariables") List<VariableReferenceExpression> outputVariables, @JsonProperty("outputToInputs") Map<VariableReferenceExpression, List<VariableReferenceExpression>> outputToInputs) { super(id); requireNonNull(sources, "sources is null"); checkArgument(!sources.isEmpty(), "Must have at least one source"); requireNonNull(outputToInputs, "outputToInputs is null"); this.sources = unmodifiableList(new ArrayList<>(sources)); Map<VariableReferenceExpression, List<VariableReferenceExpression>> copiedMap = new LinkedHashMap<>(); outputToInputs.forEach((key, value) -> copiedMap.put(key, unmodifiableList(new ArrayList<>(value)))); this.outputToInputs = unmodifiableMap(copiedMap); this.outputVariables = unmodifiableList(new ArrayList<>(outputVariables)); for (Collection<VariableReferenceExpression> inputs : this.outputToInputs.values()) { checkArgument( inputs.size() == this.sources.size(), format("Every source needs to map its variables to an output %s operation variables", this.getClass().getSimpleName())); } for (int i = 0; i < sources.size(); i++) { for (List<VariableReferenceExpression> expectedInputs : this.outputToInputs.values()) { checkArgument(sources.get(i).getOutputVariables().contains(expectedInputs.get(i)), "Source does not provide required variables"); } } }
Source:
protected Object makeCalls(final CopyNumberTriStateHiddenMarkovModel model, final TargetCollection<Target> targets, final ReadCountCollection inputCounts) { logger.info("Composing list of segment intervals to genotype ..."); final List<GenotypingSegment> segments = composeGenotypingSegments(segmentsFile, targets); logger.info(String.format("A total of %d segments to genotyping found", segments.size())); final List<ForwardBackwardAlgorithm.Result<Double, Target, CopyNumberTriState>> fbResults = runFWBWAlgorithm(model, inputCounts); for (final GenotypingSegment segment : segments) { final VariantContext variant = composeVariantContext(segment, inputCounts.columnNames(), fbResults); outputWriter.add(variant); } return "SUCCESS"; }

Target:
protected void makeCalls(final CopyNumberTriStateHiddenMarkovModel model, final TargetCollection<Target> targets, final ReadCountCollection inputCounts) { logger.info("Composing list of segment intervals to genotype ..."); final List<GenotypingSegment> segments = composeGenotypingSegments(segmentsFile, targets); logger.info(String.format("A total of %d segments to genotype found", segments.size())); final List<ForwardBackwardAlgorithm.Result<Double, Target, CopyNumberTriState>> fbResults = runFWBWAlgorithm(model, inputCounts); for (final GenotypingSegment segment : segments) { final VariantContext variant = composeVariantContext(segment, inputCounts.columnNames(), fbResults); outputWriter.add(variant); } }
Source:
protected boolean attemptHandleIntentForUpload(final Intent intent) { if (intent == null) { return false; } if (HealthReportConstants.UPLOAD_FEATURE_DISABLED) { Logger.debug(LOG_TAG, "Health report upload feature is compile-time disabled; not handling intent."); return false; } final String action = intent.getAction(); Logger.debug(LOG_TAG, "Health report upload feature is compile-time enabled; attempting to " + "handle intent with action " + action + "."); if (HealthReportConstants.ACTION_HEALTHREPORT_UPLOAD_PREF.equals(action)) { handleUploadPrefIntent(intent); return true; } if (Intent.ACTION_BOOT_COMPLETED.equals(action) || Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(action)) { BackgroundService.reflectContextToFennec(this, GlobalConstants.GECKO_PREFERENCES_CLASS, GlobalConstants.GECKO_BROADCAST_HEALTHREPORT_UPLOAD_PREF_METHOD); return true; } return false; }

Target:
private boolean attemptHandleIntentForUpload(final Intent intent) { if (HealthReportConstants.UPLOAD_FEATURE_DISABLED) { Logger.debug(LOG_TAG, "Health report upload feature is compile-time disabled; not handling intent."); return false; } final String action = intent.getAction(); Logger.debug(LOG_TAG, "Health report upload feature is compile-time enabled; attempting to " + "handle intent with action " + action + "."); if (HealthReportConstants.ACTION_HEALTHREPORT_UPLOAD_PREF.equals(action)) { handleUploadPrefIntent(intent); return true; } if (Intent.ACTION_BOOT_COMPLETED.equals(action) || Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(action)) { BackgroundService.reflectContextToFennec(this, GlobalConstants.GECKO_PREFERENCES_CLASS, GlobalConstants.GECKO_BROADCAST_HEALTHREPORT_UPLOAD_PREF_METHOD); return true; } return false; }
Source:
protected static ICPPEvaluation[] instantiateCommaSeparatedSubexpressions( ICPPEvaluation[] subexpressions, ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, int maxdepth, IASTNode point) { ICPPEvaluation[] result = subexpressions; int resultShift = 0; for (int i = 0; i < subexpressions.length; i++) { ICPPEvaluation origEval = subexpressions[i]; ICPPEvaluation newEval; if (origEval instanceof EvalFixed && ((EvalFixed) origEval).getTypeOrFunctionSet(point) instanceof ICPPParameterPackType) { origEval = ((EvalFixed) origEval).getValue().getEvaluation(); int packSize = origEval.determinePackSize(tpMap); if (packSize == CPPTemplates.PACK_SIZE_FAIL || packSize == CPPTemplates.PACK_SIZE_NOT_FOUND) { newEval = origEval; } else if (packSize == CPPTemplates.PACK_SIZE_DEFER) { newEval = origEval; } else { int shift = packSize - 1; ICPPEvaluation[] newResult = new ICPPEvaluation[subexpressions.length + resultShift + shift]; System.arraycopy(result, 0, newResult, 0, i + resultShift); for (int j = 0; j < packSize; ++j) { newEval = origEval.instantiate(tpMap, j, within, maxdepth, point); newResult[i + resultShift + j] = newEval; } result = newResult; resultShift += shift; continue; } } else { newEval = origEval.instantiate(tpMap, packOffset, within, maxdepth, point); } if (result != subexpressions) result[i + resultShift] = newEval; else if (newEval != origEval) { assert resultShift == 0; result = new ICPPEvaluation[subexpressions.length]; System.arraycopy(subexpressions, 0, result, 0, i); result[i] = newEval; } } return result; }

Target:
protected static ICPPEvaluation[] instantiateCommaSeparatedSubexpressions( ICPPEvaluation[] subexpressions, ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, int maxdepth, IASTNode point) { ICPPEvaluation[] result = subexpressions; int resultShift = 0; for (int i = 0; i < subexpressions.length; i++) { ICPPEvaluation origEval = subexpressions[i]; ICPPEvaluation newEval; if (origEval instanceof EvalParameterPack) { origEval = ((EvalParameterPack) origEval).getExpansionPattern(); if (origEval == null) { newEval = EvalFixed.INCOMPLETE; } else { int packSize = origEval.determinePackSize(tpMap); if (packSize == CPPTemplates.PACK_SIZE_FAIL || packSize == CPPTemplates.PACK_SIZE_NOT_FOUND) { newEval = EvalFixed.INCOMPLETE; } else if (packSize == CPPTemplates.PACK_SIZE_DEFER) { newEval = origEval; } else { int shift = packSize - 1; ICPPEvaluation[] newResult = new ICPPEvaluation[subexpressions.length + resultShift + shift]; System.arraycopy(result, 0, newResult, 0, i + resultShift); for (int j = 0; j < packSize; ++j) { newEval = origEval.instantiate(tpMap, j, within, maxdepth, point); newResult[i + resultShift + j] = newEval; } result = newResult; resultShift += shift; continue; } } } else { newEval = origEval.instantiate(tpMap, packOffset, within, maxdepth, point); } if (result != subexpressions) result[i + resultShift] = newEval; else if (newEval != origEval) { assert resultShift == 0; result = new ICPPEvaluation[subexpressions.length]; System.arraycopy(subexpressions, 0, result, 0, i); result[i] = newEval; } } return result; }
Source:
@Test public void testParseAndConvert() throws Exception { checkParseAndConvert( "select * from \"emps\" where \"name\" like '%e%'", "SELECT *\n" + "FROM `emps`\n" + "WHERE `name` LIKE '%e%'", "LogicalProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], " + "commission=[$4])\n" + " LogicalFilter(condition=[LIKE($2, '%e%')])\n" + " EnumerableTableScan(table=[[hr, emps]])\n"); }

Target:
@Test public void testParseAndConvert() throws Exception { checkParseAndConvert( "select * from \"emps\" where \"name\" like '%e%'", "SELECT *\n" + "FROM `emps`\n" + "WHERE `name` LIKE '%e%'", "LogicalProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n" + " LogicalFilter(condition=[LIKE($2, '%e%')])\n" + " EnumerableTableScan(table=[[hr, emps]])\n"); }
Source:
public static String videoIdFrom(String uri) { if(uri == null){ return null; } for (Pattern p : alternateUris) { Matcher matcher = p.matcher(uri); if (matcher.matches()) { return matcher.group(1); } } return null; }

Target:
public static String videoIdFrom(String uri) throws YouTubeException { checkNotNull(uri); for (Pattern p : alternateUris) { Matcher matcher = p.matcher(uri); if (matcher.matches()) { return matcher.group(1); } } throw new YouTubeException(String.format("Provided URI %s deosn't match any known YouTube URI patterns", uri)); }
Source:
public void extendsMenuItem(Element element, IsValid valid) { extendsOneOfTypes(element, ANDROID_MENU_ITEM_QUALIFIED_NAMES, valid); }

Target:
public void extendsMenuItem(Element element, IsValid valid) { Element enclosingElement = element.getEnclosingElement(); String enclosingQualifiedName = enclosingElement.asType().toString(); TypeElement enclosingTypeElement = annotationHelper.typeElementFromQualifiedName(enclosingQualifiedName); if (enclosingTypeElement != null) { if (thirdPartyLibHelper.usesActionBarSherlock(enclosingTypeElement)) { extendsType(element, CanonicalNameConstants.SHERLOCK_MENU_ITEM, valid); } else { extendsType(element, CanonicalNameConstants.MENU_ITEM, valid); } } }
Source:
private boolean isGoogRequireAssignment(Node statement) { if (!(statement.isConst() || statement.isVar() || statement.isLet())) { return false; } if (statement.getFirstFirstChild() == null) { return false; } Node rightHandSide = statement.getFirstFirstChild(); return rightHandSide.isCall() && rightHandSide.getFirstChild().matchesQualifiedName("goog.require"); }

Target:
private static boolean isGoogRequireAssignment(Node statement) { if (!(statement.isConst() || statement.isVar() || statement.isLet())) { return false; } Node rightHandSide = statement.getFirstFirstChild(); return rightHandSide != null && rightHandSide.isCall() && rightHandSide.getFirstChild().matchesQualifiedName("goog.require"); }
Source:
public final Response add(final String json) { this.logger.debug("Importing new patient from JSON via REST: {}", json); final User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(Right.EDIT, currentUser == null ? null : currentUser.getProfileDocument(), this.currentResolver.resolve(Patient.DEFAULT_DATA_SPACE, EntityType.SPACE))) { throw new WebApplicationException(Status.UNAUTHORIZED); } try { final Response response; if (json != null) { response = json.startsWith("[") ? addPatients(json) : addPatient(json); } else { response = buildResponse(this.repository.create()); } return response; } catch (Exception ex) { this.logger.error("Could not process patient creation request: {}", ex.getMessage(), ex); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } }

Target:
public Response add(final String json) { this.logger.debug("Importing new patient from JSON via REST: {}", json); final User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(Right.EDIT, currentUser == null ? null : currentUser.getProfileDocument(), this.currentResolver.resolve(Patient.DEFAULT_DATA_SPACE, EntityType.SPACE))) { throw new WebApplicationException(Status.UNAUTHORIZED); } try { final Response response; if (json != null) { response = json.startsWith("[") ? addPatients(json) : addPatient(json); } else { response = buildCreatedResponse(this.repository.create()); } return response; } catch (Exception ex) { this.logger.error("Could not process patient creation request: {}", ex.getMessage(), ex); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } }
Source:
private String author(int line) { PersonIdent author = db.getMailmap().map(blame.getSourceAuthor(line)); if (author == null) return ""; String name = showAuthorEmail ? author.getEmailAddress() : author .getName(); return name != null ? name : ""; }

Target:
private String author(int line) { PersonIdent author = blame.getSourceAuthor(line); if (author == null) return ""; String name = showAuthorEmail ? author.getEmailAddress() : author .getName(); return name != null ? name : ""; }
Source:
protected void manualRefresh() { editor.bot().toolbarButton(0).click(); SWTBotUtils.waitProgressMonitorClose("Progress Information"); SWTBotUtils.waitAllUiEvents(); }

Target:
protected void manualRefresh() { editor.bot().toolbarButtonWithTooltip(DiagramDialectUIServices.REFRESH_DIAGRAM).click(); SWTBotUtils.waitProgressMonitorClose("Progress Information"); SWTBotUtils.waitAllUiEvents(); }
Source:
public void reportCurrentNumberOfConsumers() throws Exception { when(topicRepositoryMock.topicExists(anyString())).thenReturn(true); final EventStream eventStream = mock(EventStream.class); Mockito.doAnswer(invocation -> { while (!Thread.interrupted()) { Thread.sleep(100); } return null; }).when(eventStream).streamEvents(any()); when(eventStreamFactoryMock.createEventStream(any(), any(), any())).thenReturn(eventStream); final StreamingResponseBody responseBody = controller.streamEvents(TEST_EVENT_TYPE, 1, 0, 0, 0, 0, null, requestMock, responseMock); final LinkedList<Thread> clients = new LinkedList<>(); final Counter counter = metricRegistry.counter(metricNameFor(TEST_EVENT_TYPE, EventStreamController.CONSUMERS_COUNT_METRIC_NAME)); for (int i = 0; i < 3; i++) { final Thread client = new Thread(() -> { try { responseBody.writeTo(new ByteArrayOutputStream()); } catch (final IOException e) { throw new RuntimeException(e); } }); client.start(); clients.add(client); Thread.sleep(500); executeWithRetry( () -> { assertThat(counter.getCount(), equalTo((long) clients.size())); }, retryForSpecifiedTimeOf(duration("5s")) ); } while (!clients.isEmpty()) { final Thread client = clients.pop(); client.interrupt(); client.join(); assertThat(counter.getCount(), equalTo((long) clients.size())); } }

Target:
public void reportCurrentNumberOfConsumers() throws Exception { when(eventTypeRepository.findByName(TEST_EVENT_TYPE_NAME)).thenReturn(EVENT_TYPE); final EventStream eventStream = mock(EventStream.class); Mockito.doAnswer(invocation -> { while (!Thread.interrupted()) { Thread.sleep(100); } return null; }).when(eventStream).streamEvents(any()); when(eventStreamFactoryMock.createEventStream(any(), any(), any())).thenReturn(eventStream); final StreamingResponseBody responseBody = controller.streamEvents(TEST_EVENT_TYPE_NAME, 0, 0, 0, 0, 0, null, requestMock, responseMock); final LinkedList<Thread> clients = new LinkedList<>(); final Counter counter = metricRegistry.counter(metricNameFor(TEST_EVENT_TYPE_NAME, EventStreamController.CONSUMERS_COUNT_METRIC_NAME)); for (int i = 0; i < 3; i++) { final Thread client = new Thread(() -> { try { responseBody.writeTo(new ByteArrayOutputStream()); } catch (final IOException e) { throw new RuntimeException(e); } }); client.start(); clients.add(client); Thread.sleep(500); executeWithRetry( () -> assertThat(counter.getCount(), equalTo((long) clients.size())), retryForSpecifiedTimeOf(duration("5s")) ); } while (!clients.isEmpty()) { final Thread client = clients.pop(); client.interrupt(); client.join(); assertThat(counter.getCount(), equalTo((long) clients.size())); } }
Source:
public TimeEvent(ITimeGraphEntry entry, long time, long duration, int value, int activeProperties) { this(new TimeGraphState(time, duration, value), entry); fActiveProperties = activeProperties; }

Target:
public TimeEvent(ITimeGraphEntry entry, long time, long duration, int value, int activeProperties) { this(new TimeGraphState(time, duration, value), entry); fModel.setActiveProperties(activeProperties); }
Source:
public URI resolveResource(Repository repository, String path) throws IOException, IllegalArgumentException { RepositoryPath repositoryPath = resolve(repository).resolve(path); if (RepositoryFiles.isArtifact(repositoryPath)) { ArtifactCoordinates c = RepositoryFiles.readCoordinates(repositoryPath); return c.toResource(); } return URI.create(path); }

Target:
public URI resolveResource(Repository repository, String path) throws IOException { RepositoryPath repositoryPath = resolve(repository).resolve(path); if (RepositoryFiles.isArtifact(repositoryPath)) { ArtifactCoordinates c = RepositoryFiles.readCoordinates(repositoryPath); return c.toResource(); } return URI.create(path); }
Source:
public void testCloseStream() throws InterruptedException { IntegrationFlow server = IntegrationFlows.from(Tcp.inboundGateway(Tcp.netServer(0) .deserializer(new ByteArrayRawSerializer()))) .<byte[], String>transform(p -> "reply:" + new String(p).toUpperCase()) .bridge() .get(); CountDownLatch latch = new CountDownLatch(1); AtomicInteger port = new AtomicInteger(); class Listener implements ApplicationListener<TcpConnectionServerListeningEvent> { @Override public void onApplicationEvent(TcpConnectionServerListeningEvent event) { port.set(event.getPort()); latch.countDown(); } } this.applicationContext.addApplicationListener(new Listener()); this.flowContext.registration(server) .id("streamCloseServer") .register(); assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); IntegrationFlow client = IntegrationFlows.from(MessageChannels.direct()) .handle(Tcp.outboundGateway(Tcp.netClient("localhost", port.get()) .singleUseConnections(true) .serializer(new ByteArrayRawSerializer())) .closeStreamAfterSend(true)) .transform(Transformers.objectToString()) .get(); this.flowContext.registration(client) .id("streamCloseClient") .register(); MessagingTemplate messagingTemplate = new MessagingTemplate(client.getInputChannel()); assertThat(messagingTemplate.convertSendAndReceive("foo", String.class)).isEqualTo("reply:FOO"); }

Target:
public void testCloseStream() throws InterruptedException { IntegrationFlow server = IntegrationFlows.from(Tcp.inboundGateway(Tcp.netServer(0) .deserializer(new ByteArrayRawSerializer()))) .<byte[], String>transform(p -> "reply:" + new String(p).toUpperCase()) .get(); CountDownLatch latch = new CountDownLatch(1); AtomicInteger port = new AtomicInteger(); class Listener implements ApplicationListener<TcpConnectionServerListeningEvent> { @Override public void onApplicationEvent(TcpConnectionServerListeningEvent event) { port.set(event.getPort()); latch.countDown(); } } this.applicationContext.addApplicationListener(new Listener()); this.flowContext.registration(server) .id("streamCloseServer") .register(); assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); IntegrationFlow client = IntegrationFlows.from(MessageChannels.direct()) .handle(Tcp.outboundGateway(Tcp.netClient("localhost", port.get()) .singleUseConnections(true) .serializer(new ByteArrayRawSerializer())) .closeStreamAfterSend(true)) .transform(Transformers.objectToString()) .get(); IntegrationFlowRegistration clientRegistration = this.flowContext.registration(client) .id("streamCloseClient") .register(); assertThat(clientRegistration.getMessagingTemplate() .convertSendAndReceive("foo", String.class)).isEqualTo("reply:FOO"); }
Source:
public void retrieveFilesInEdit() throws Exception { assertThat(modifier.createEdit(change, ps)).isEqualTo(RefUpdate.Result.NEW); Optional<ChangeEdit> edit = editUtil.byChange(change); assertThat(modifier.modifyFile(edit.get(), FILE_NAME, CONTENT_NEW)) .isEqualTo(RefUpdate.Result.FORCED); EditInfo info = toEditInfo(true); assertThat(info.files.size()).isEqualTo(2); List<String> l = Lists.newArrayList(info.files.keySet()); assertThat(l.get(0)).isEqualTo("/COMMIT_MSG"); assertThat(l.get(1)).isEqualTo("foo"); }

Target:
public void retrieveFilesInEdit() throws Exception { assertThat(modifier.createEdit(change, ps)).isEqualTo(RefUpdate.Result.NEW); Optional<ChangeEdit> edit = editUtil.byChange(change); assertThat(modifier.modifyFile(edit.get(), FILE_NAME, CONTENT_NEW)) .isEqualTo(RefUpdate.Result.FORCED); EditInfo info = toEditInfo(true); assertThat(info.files).hasSize(2); List<String> l = Lists.newArrayList(info.files.keySet()); assertThat(l.get(0)).isEqualTo("/COMMIT_MSG"); assertThat(l.get(1)).isEqualTo("foo"); }
Source:
public String getFunctionName() { return "openstack"; }

Target:
public String getFunctionName() { return "openstackMachine"; }
Source:
public ExplainCommand() { Options o = CommandLineHelper.getCommonOptions(); o.addOption("i", "input", true, "load ontology from a file"); o.addOption("I", "input-iri", true, "load ontology from an IRI"); o.addOption("r", "reasoner", true, "reasoner to use: ELK, HermiT, JFact"); o.addOption("a", "axiom", true, "the axiom to explain"); o.addOption("m", "max", true, "the maximum number of explanations to retrieve"); o.addOption("f", "format", true, "the explanation result format: MD, OFN, etc."); o.addOption("o", "output", true, "save explanation to a file"); options = o; }

Target:
public ExplainCommand() { Options o = CommandLineHelper.getCommonOptions(); o.addOption("i", "input", true, "load ontology from a file"); o.addOption("I", "input-iri", true, "load ontology from an IRI"); o.addOption("r", "reasoner", true, "reasoner to use: ELK, HermiT, JFact"); o.addOption("a", "axiom", true, "the axiom to explain"); o.addOption("m", "max", true, "the maximum number of explanations to retrieve"); o.addOption("e", "explanation", true, "save explanation to a Markdown file"); o.addOption("f", "format", true, "the format: obo, owl, ttl, owx, omn, ofn, json"); o.addOption("o", "output", true, "save ontology containing only explanation axioms to a file"); options = o; }
Source:
public void onExecute(CommandSender sender, String[] args) { if (sender.hasPermission("slimefun.command.versions") || sender instanceof ConsoleCommandSender) { sender.sendMessage(ChatColors.color("&a" + Bukkit.getName() + " &2" + ReflectionUtils.getVersion())); sender.sendMessage(""); sender.sendMessage(ChatColors.color("&aCS-CoreLib &2v" + SlimefunPlugin.getCSCoreLibVersion())); sender.sendMessage(ChatColors.color("&aSlimefun &2v" + SlimefunPlugin.getVersion()) + (SlimefunPlugin.getMetricsService().getVersion() != null ? " (Metrics build: #" + SlimefunPlugin.getMetricsService().getVersion() + ')' : "") ); if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) { sender.sendMessage(ChatColor.YELLOW + "Backwards compatiblity enabled!"); } sender.sendMessage(""); Collection<Plugin> addons = SlimefunPlugin.getInstalledAddons(); sender.sendMessage(ChatColors.color("&7Installed Addons &8(" + addons.size() + ")")); for (Plugin plugin : addons) { if (Bukkit.getPluginManager().isPluginEnabled(plugin)) { sender.sendMessage(ChatColors.color(" &a" + plugin.getName() + " &2v" + plugin.getDescription().getVersion())); } else { sender.sendMessage(ChatColors.color(" &c" + plugin.getName() + " &4v" + plugin.getDescription().getVersion())); } } } else { SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true); } }

Target:
public void onExecute(CommandSender sender, String[] args) { if (sender.hasPermission("slimefun.command.versions") || sender instanceof ConsoleCommandSender) { String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName(); sender.sendMessage(ChatColors.color("&a" + serverSoftware + " &2" + ReflectionUtils.getVersion())); sender.sendMessage(""); sender.sendMessage(ChatColors.color("&aCS-CoreLib &2v" + SlimefunPlugin.getCSCoreLibVersion())); sender.sendMessage(ChatColors.color("&aSlimefun &2v" + SlimefunPlugin.getVersion())); if (SlimefunPlugin.getMetricsService().getVersion() != null) sender.sendMessage(ChatColors.color("&aMetrics: &2#" + SlimefunPlugin.getMetricsService().getVersion() + ')')); if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) { sender.sendMessage(ChatColor.YELLOW + "Backwards compatibility enabled!"); } sender.sendMessage(""); Collection<Plugin> addons = SlimefunPlugin.getInstalledAddons(); sender.sendMessage(ChatColors.color("&7Installed Addons &8(" + addons.size() + ")")); for (Plugin plugin : addons) { if (Bukkit.getPluginManager().isPluginEnabled(plugin)) { sender.sendMessage(ChatColors.color(" &a" + plugin.getName() + " &2v" + plugin.getDescription().getVersion())); } else { sender.sendMessage(ChatColors.color(" &c" + plugin.getName() + " &4v" + plugin.getDescription().getVersion())); } } } else { SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true); } }
Source:
public void onViewStateRestored(@Nullable Bundle savedInstanceState) { RouteFavoriteDialogFragment dialogFragment = (RouteFavoriteDialogFragment) getFragmentManager().findFragmentByTag(RouteFavoriteDialogFragment.TAG); if (dialogFragment != null) { dialogFragment.setCallback(new RouteFavoriteDialogFragment.Callback() { @Override public void onSelectionComplete(boolean savedFavorite) { if (savedFavorite) { refreshLocal(); } } }); } super.onViewStateRestored(savedInstanceState); }

Target:
public void onViewStateRestored(@Nullable Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); RouteFavoriteDialogFragment dialogFragment = (RouteFavoriteDialogFragment) getFragmentManager().findFragmentByTag(RouteFavoriteDialogFragment.TAG); if (dialogFragment != null) { setCallbackToDialogFragment(dialogFragment); } }