auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void onUserAction(String userActionName, BaseLoginInteractor interactor, Object... args) { if (authenticationType.equals(AuthenticationType.COOKIE)) { LoginViewModel viewModel = getViewModel(); interactor.start(viewModel.getLogin(), viewModel.getPassword()); } else if (authenticationType.equals(AuthenticationType.BASIC)) { LoginViewModel viewModel = getViewModel(); interactor.start(viewModel.getLogin(), viewModel.getPassword(), viewModel.getBasicAuthMethod()); } else if(authenticationType.equals(AuthenticationType.OAUTH)) { LoginOAuthInteractor oauthInteractor = (LoginOAuthInteractor) interactor; Intent intent = new Intent(getContext(), OAuthActivity.class); intent.putExtra(OAuthActivity.EXTRA_OAUTH_CONFIG, oauthInteractor.getOAuthConfig()); LiferayScreensContext.getActivityFromContext(getContext()) .startActivityForResult(intent, REQUEST_OAUTH_CODE); } }

Target:
protected void onUserAction(String userActionName, BaseLoginInteractor interactor, Object... args) { if (AuthenticationType.COOKIE.equals(authenticationType)) { LoginViewModel viewModel = getViewModel(); interactor.start(viewModel.getLogin(), viewModel.getPassword()); } else if (AuthenticationType.BASIC.equals(authenticationType)) { LoginViewModel viewModel = getViewModel(); interactor.start(viewModel.getLogin(), viewModel.getPassword(), viewModel.getBasicAuthMethod()); } else if(AuthenticationType.OAUTH.equals(authenticationType)) { LoginOAuthInteractor oauthInteractor = (LoginOAuthInteractor) interactor; Intent intent = new Intent(getContext(), OAuthActivity.class); intent.putExtra(OAuthActivity.EXTRA_OAUTH_CONFIG, oauthInteractor.getOAuthConfig()); LiferayScreensContext.getActivityFromContext(getContext()) .startActivityForResult(intent, REQUEST_OAUTH_CODE); } }
Source:
public Span joinTrace(SpanTextMap textMap) { Map<String, String> carrier = TextMapUtil.asMap(textMap); if (Span.SPAN_SAMPLED.equals(carrier.get(TraceMessageHeaders.SPAN_FLAGS_NAME))) { generateIdIfMissing(carrier, TraceMessageHeaders.SPAN_ID_NAME); generateIdIfMissing(carrier, TraceMessageHeaders.TRACE_ID_NAME); } else if (!hasHeader(carrier, TraceMessageHeaders.SPAN_ID_NAME) || !hasHeader(carrier, TraceMessageHeaders.TRACE_ID_NAME)) { return null; } return extractSpanFromHeaders(carrier, Span.builder()); }

Target:
public Span joinTrace(SpanTextMap textMap) { Map<String, String> carrier = TextMapUtil.asMap(textMap); if (Span.SPAN_SAMPLED.equals(carrier.get(TraceMessageHeaders.SPAN_FLAGS_NAME))) { String traceId = generateTraceIdIfMissing(carrier); if (!carrier.containsKey(TraceMessageHeaders.SPAN_ID_NAME)) { carrier.put(TraceMessageHeaders.SPAN_ID_NAME, traceId); } } else if (!hasHeader(carrier, TraceMessageHeaders.SPAN_ID_NAME) || !hasHeader(carrier, TraceMessageHeaders.TRACE_ID_NAME)) { return null; } return extractSpanFromHeaders(carrier, Span.builder()); }
Source:
private Predicate<String> createClassPredicate() { final Collection<String> classes = new HashSet<>(); for (final File buildOutputDirectory : this.compiledCodeDirectories) { if (buildOutputDirectory.exists()) { final DirectoryClassPathRoot dcRoot = new DirectoryClassPathRoot(buildOutputDirectory); classes.addAll(FCollection.map(dcRoot.classNames(), toPredicate())); } } return classes.stream() .map(Glob.toGlobPredicate()) .reduce(x -> false, Predicate::or); }

Target:
private Predicate<String> createClassPredicate() { final Collection<String> classes = new HashSet<>(); for (final File buildOutputDirectory : this.compiledCodeDirectories) { if (buildOutputDirectory.exists()) { final DirectoryClassPathRoot dcRoot = new DirectoryClassPathRoot(buildOutputDirectory); classes.addAll(FCollection.map(dcRoot.classNames(), toPredicate())); } } return Glob.toGlobPredicate(classes); }
Source:
private long sequenceNumberForIndex(final String indexName) { long lastSequenceNumber = 0; Future<Long> sequenceNumber = queue.submit( new Callable<Long>() { @Override public Long call() { long result = 0; String sql = String.format("SELECT last_sequence FROM %s WHERE index_name = \"%s\"", IndexManager.INDEX_METADATA_TABLE_NAME, indexName); Cursor cursor = null; try { cursor = database.rawQuery(sql, new String[]{}); if (cursor.getCount() > 0) { cursor.moveToNext(); result = cursor.getLong(0); } } catch (SQLException e) { logger.log(Level.SEVERE, "Error getting last sequence number. ", e); } finally { DatabaseUtils.closeCursorQuietly(cursor); } return result; } }); try { lastSequenceNumber = sequenceNumber.get(); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Execution error encountered:", e); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Execution interrupted error encountered:", e); } return lastSequenceNumber; }

Target:
private long sequenceNumberForIndex(final String indexName) { Future<Long> sequenceNumber = queue.submit( new Callable<Long>() { @Override public Long call() { long result = 0; String sql = String.format("SELECT last_sequence FROM %s WHERE index_name = ?", IndexManager.INDEX_METADATA_TABLE_NAME); Cursor cursor = null; try { cursor = database.rawQuery(sql, new String[]{ indexName }); if (cursor.getCount() > 0) { cursor.moveToNext(); result = cursor.getLong(0); } } catch (SQLException e) { logger.log(Level.SEVERE, "Error getting last sequence number. ", e); } finally { DatabaseUtils.closeCursorQuietly(cursor); } return result; } }); long lastSequenceNumber = 0; try { lastSequenceNumber = sequenceNumber.get(); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Execution error encountered:", e); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Execution interrupted error encountered:", e); } return lastSequenceNumber; }
Source:
private void clearAllNotifications() { int numChildren = mStackScroller.getChildCount(); final ArrayList<View> viewsToHide = new ArrayList<View>(numChildren); for (int i = 0; i < numChildren; i++) { final View child = mStackScroller.getChildAt(i); if (child instanceof ExpandableNotificationRow) { if (mStackScroller.canChildBeDismissed(child)) { if (child.getVisibility() == View.VISIBLE) { viewsToHide.add(child); } } ExpandableNotificationRow row = (ExpandableNotificationRow) child; List<ExpandableNotificationRow> children = row.getNotificationChildren(); if (row.areChildrenExpanded() && children != null) { for (ExpandableNotificationRow childRow : children) { if (childRow.getVisibility() == View.VISIBLE) { viewsToHide.add(childRow); } } } } } if (viewsToHide.isEmpty()) { animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); return; } addPostCollapseAction(new Runnable() { @Override public void run() { mStackScroller.setDismissAllInProgress(false); try { mBarService.onClearAllNotifications(mCurrentUserId); } catch (Exception ex) { } } for (View v : viewsToHide) { if (!(v instanceof ExpandableNotificationRow)) { continue; } StatusBarNotification sbn = ((ExpandableNotificationRow)v).getStatusBarNotification(); if (!sbn.isClearable()) { mStackScroller.snapViewAnimated(v); } } }); performDismissAllAnimations(viewsToHide); }

Target:
private void clearAllNotifications() { int numChildren = mStackScroller.getChildCount(); final ArrayList<View> viewsToHide = new ArrayList<View>(numChildren); for (int i = 0; i < numChildren; i++) { final View child = mStackScroller.getChildAt(i); if (child instanceof ExpandableNotificationRow) { if (mStackScroller.canChildBeDismissed(child)) { if (child.getVisibility() == View.VISIBLE) { viewsToHide.add(child); } } ExpandableNotificationRow row = (ExpandableNotificationRow) child; List<ExpandableNotificationRow> children = row.getNotificationChildren(); if (row.areChildrenExpanded() && children != null) { for (ExpandableNotificationRow childRow : children) { if (childRow.getVisibility() == View.VISIBLE) { viewsToHide.add(childRow); } } } } } if (viewsToHide.isEmpty()) { animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE); return; } addPostCollapseAction(new Runnable() { @Override public void run() { mStackScroller.setDismissAllInProgress(false); try { mBarService.onClearAllNotifications(mCurrentUserId); } catch (Exception ex) { } for (View v : viewsToHide) { if (!(v instanceof ExpandableNotificationRow)) { continue; } StatusBarNotification sbn = ((ExpandableNotificationRow)v).getStatusBarNotification(); if (!sbn.isClearable()) { mStackScroller.snapView(v, false ); } } } }); performDismissAllAnimations(viewsToHide); }
Source:
public void yield_from(){ setRootRule(PythonGrammar.YIELD_EXPR); assertThat(p).matches("yield from foo"); assertThat(p).matches("yield foo"); assertThat(p).notMatches("yield from"); }

Target:
public void yield_from(){ setRootRule(PythonGrammar.YIELD_EXPR); assertThat(p).matches("yield"); assertThat(p).matches("yield from foo"); assertThat(p).matches("yield foo"); assertThat(p).notMatches("yield from"); }
Source:
public InputArgument(Block block, Type signature) { inputText = new SimpleStringProperty(signature.toHaskellType()); this.loadFXML("InputArgument"); inputAnchor = new InputAnchor(block, signature); inputAnchor.layoutXProperty().bind(inputLabel.widthProperty().divide(2)); inputAnchor.isErrorProperty().addListener((ObservableValue<? extends Boolean> value, Boolean oldValue, Boolean newValue) -> setError(newValue)); inputLabel.layoutYProperty().bind(this.heightProperty().divide(2).subtract(inputLabel.heightProperty().divide(2))); this.setPrefHeight(ArgumentSpace.HEIGHT); this.getChildren().add(inputAnchor); }

Target:
public InputArgument(Block block, Type signature) { inputText = new SimpleStringProperty(signature.toHaskellType()); this.loadFXML("InputArgument"); inputAnchor = new InputAnchor(block, signature); inputAnchor.layoutXProperty().bind(inputLabel.widthProperty().divide(2)); inputAnchor.isErrorProperty().addListener(this::checkError); inputLabel.layoutYProperty().bind(this.heightProperty().divide(2).subtract(inputLabel.heightProperty().divide(2))); this.setPrefHeight(ArgumentSpace.HEIGHT); this.getChildren().add(inputAnchor); }
Source:
private String encode(final String value) throws Exception { return URLEncoder.encode(value, StandardCharsets.UTF_8); }

Target:
private String encode(final String value) { return URLEncoder.encode(value, StandardCharsets.UTF_8); }
Source:
public void handle(LeaveGroupResponse leaveResponse, RequestFuture<Void> future) { final List<MemberResponse> members = leaveResponse.memberResponses(); if (members.size() > 1) { future.raise(new IllegalStateException("The expected leave group response " + "should only contain no more than one member info, however get " + members)); } final Errors error = leaveResponse.error(); if (error == Errors.NONE) { log.debug("LeaveGroup response with returned successfully: {}", sentGeneration, response); future.complete(null); } else { log.error("LeaveGroup response with failed with error: {}", sentGeneration, error.message()); future.raise(error); } }

Target:
public void handle(LeaveGroupResponse leaveResponse, RequestFuture<Void> future) { final List<MemberResponse> members = leaveResponse.memberResponses(); if (members.size() > 1) { future.raise(new IllegalStateException("The expected leave group response " + "should only contain no more than one member info, however get " + members)); } final Errors error = leaveResponse.error(); if (error == Errors.NONE) { log.debug("LeaveGroup response with returned successfully: {}", sentGeneration, response); future.complete(null); } else { log.error("LeaveGroup request with failed with error: {}", sentGeneration, error.message()); future.raise(error); } }
Source:
public ObjectRule untitledRaml() { return super.untitledRaml() .with(annotationTypesField()) .with(annotationField()) .with(typesField()) .with(usesField()) .with(exclusiveKeys(BaseRamlGrammar.TYPES_KEY_NAME, BaseRamlGrammar.SCHEMAS_KEY_NAME)); }

Target:
public ObjectRule untitledRaml() { return super.untitledRaml() .with(annotationTypesField()) .with(annotationField()) .with(typesField()) .with(usesField()) .with(exclusiveKeys(TYPES_KEY_NAME, SCHEMAS_KEY_NAME)); }
Source:
public ListenableFuture<Long> count(Class<?> entityClass) { Assert.notNull(entityClass, "Entity type must not be null"); return doCount(Query.empty(), entityClass, getKeyspace(entityClass), getTableName(entityClass)); }

Target:
public ListenableFuture<Long> count(Class<?> entityClass) { Assert.notNull(entityClass, "Entity type must not be null"); return doCount(Query.empty(), entityClass, constructTableCoordinates(entityClass)); }
Source:
public void parseConfig(List<String> configParts) throws BindingConfigParseException { String id = ""; Boolean group = false; Integer channelID = 0; for (int i = 0; i < configParts.size(); i++) { String paramName = configParts.get(i).split("=")[0].toLowerCase(); String paramValue = configParts.get(i).split("=")[1]; switch (paramName) { case "id": id = paramValue; break; case "group": if (paramValue.equals("1") || paramValue.toLowerCase().equals("true")) { group = true; } break; case "channel": try { channelID = Integer.parseInt(paramValue); } catch (NumberFormatException e) { throw new BindingConfigParseException("Channel ID (" + paramValue + ") is not a number."); } } } if (id.length() != 26) { throw new BindingConfigParseException("The ID must contain exactly 26 digits!"); } for (int i = 0; i < id.length(); i++) { if (id.charAt(i) != '0' && id.charAt(i) != '1') { throw new BindingConfigParseException("The ID must contains only the digits 1 and 0!"); } } if (channelID < 0 && channelID > 15) { throw new BindingConfigParseException("The channel ID must be in a range from 0 to 15!"); } String channelIDCode = StringUtils.leftPad(Integer.toBinaryString(channelID), 4, "0"); commandON = id + getGroupCode(group) + "1" + channelIDCode; commandOFF = id + getGroupCode(group) + "0" + channelIDCode; logger.trace("commandON = {}", commandON); logger.trace("commandOFF = {}", commandOFF); }

Target:
public void parseConfig(List<String> configParts) throws BindingConfigParseException { String id = ""; Boolean group = false; Integer channelID = 0; for (int i = 0; i < configParts.size(); i++) { String paramName = configParts.get(i).split("=")[0].toLowerCase(); String paramValue = configParts.get(i).split("=")[1]; switch (paramName) { case "id": id = paramValue; break; case "group": if (paramValue.equals("1") || paramValue.toLowerCase().equals("true")) { group = true; } break; case "channel": try { channelID = Integer.parseInt(paramValue); } catch (NumberFormatException e) { throw new BindingConfigParseException("Channel ID (" + paramValue + ") is not a number."); } } } if (id.length() != 26) { throw new BindingConfigParseException("The ID must contain exactly 26 digits!"); } for (int i = 0; i < id.length(); i++) { if (id.charAt(i) != '0' && id.charAt(i) != '1') { throw new BindingConfigParseException("The ID must contains only the digits 1 and 0!"); } } if (channelID < 0 || channelID > 15) { throw new BindingConfigParseException("The channel ID must be in a range from 0 to 15!"); } String channelIDCode = StringUtils.leftPad(Integer.toBinaryString(channelID), 4, "0"); commandON = id + getGroupCode(group) + "1" + channelIDCode; commandOFF = id + getGroupCode(group) + "0" + channelIDCode; logger.trace("commandON = {}", commandON); logger.trace("commandOFF = {}", commandOFF); }
Source:
public void init() { if (tpe != null && !tpe.isShutdown()) { tpe.shutdownNow(); } tpe = new ThreadPoolExecutor(1, 2, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(1000)); }

Target:
public void init() { if (tpe != null && !tpe.isShutdown()) { tpe.shutdownNow(); } tpe = new ThreadPoolExecutor(POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<>(QUEUE_SIZE)); }
Source:
default boolean isEmpty() { return this.shadow$isEmpty(); }

Target:
default boolean api$isEmpty() { return this.shadow$isEmpty(); }
Source:
public void startStripe(InputStreamSources dictionaryStreamSources, List<ColumnEncoding> encoding) throws IOException { ColumnEncoding.ColumnEncodingKind kind = encoding.get(streamDescriptor.getStreamId()) .getColumnEncoding(streamDescriptor.getSequence()) .getColumnEncodingKind(); if (kind == DIRECT || kind == DIRECT_V2 || kind == DWRF_DIRECT) { currentReader = directReader; } else if (kind == DICTIONARY) { currentReader = dictionaryReader; } else { throw new IllegalArgumentException("Unsupported encoding " + kind); } currentReader.startStripe(dictionaryStreamSources, encoding); }

Target:
public void startStripe(InputStreamSources dictionaryStreamSources, List<ColumnEncoding> encoding) throws IOException { ColumnEncoding.ColumnEncodingKind kind = encoding.get(streamDescriptor.getStreamId()) .getColumnEncoding(streamDescriptor.getSequence()) .getColumnEncodingKind(); switch (kind) { case DIRECT: case DIRECT_V2: case DWRF_DIRECT: currentReader = directReader; break; case DICTIONARY: currentReader = dictionaryReader; break; default: throw new IllegalArgumentException("Unsupported encoding " + kind); } currentReader.startStripe(dictionaryStreamSources, encoding); }
Source:
private void restartUnhealthy() { runningProcesses.stream() .filter(consumerProcess -> !isHealthy(consumerProcess)) .forEach(consumerProcess -> { Signal restartUnhealthy = Signal.of(RESTART_UNHEALTHY, consumerProcess.getSubscriptionName()); logger.info("Lost contact with consumer {}, last seen {}ms ago. Creating signal {}.", consumerProcess, consumerProcess.lastSeen(), restartUnhealthy); taskQueue.offer(Signal.of(RESTART_UNHEALTHY, consumerProcess.getSubscriptionName())); }); }

Target:
private void restartUnhealthy() { runningProcesses.stream() .filter(consumerProcess -> !consumerProcess.isHealthy()) .forEach(consumerProcess -> { Signal restartUnhealthy = Signal.of(RESTART_UNHEALTHY, consumerProcess.getSubscriptionName()); logger.info("Lost contact with consumer {}, last seen {}ms ago {}. {}", consumerProcess, consumerProcess.lastSeen(), restartUnhealthy.getLogWithIdAndType()); taskQueue.offer(restartUnhealthy); }); }
Source:
public CoordinatorRuleManager( @Json ObjectMapper jsonMapper, Supplier<TieredBrokerConfig> config, @Coordinator DruidLeaderClient druidLeaderClient ) { this.jsonMapper = jsonMapper; this.config = config; this.druidLeaderClient = druidLeaderClient; this.rules = new AtomicReference<>( new HashMap<String, List<Rule>>() ); }

Target:
public CoordinatorRuleManager( @Json ObjectMapper jsonMapper, Supplier<TieredBrokerConfig> config, @Coordinator DruidLeaderClient druidLeaderClient ) { this.jsonMapper = jsonMapper; this.config = config; this.druidLeaderClient = druidLeaderClient; this.rules = new AtomicReference<>( Collections.emptyMap() ); }
Source:
public ICompletableFuture<Map<K, Object>> executeOnKeysInternalAsync(Set<K> keys, Set<Data> dataKeys, EntryProcessor entryProcessor, final ExecutionCallback<Map<K, Object>> callback) { if (dataKeys.isEmpty()) { toDataCollectionWithNonNullKeyValidation(keys, dataKeys); } Collection<Integer> partitionsForKeys = getPartitionsForKeys(dataKeys); OperationFactory operationFactory = operationProvider.createMultipleEntryOperationFactory(name, dataKeys, entryProcessor); final SimpleCompletableFuture<Map<K, Object>> resultFuture = new SimpleCompletableFuture<Map<K, Object>>(getNodeEngine()); ExecutionCallback<Map<Integer, Object>> partialCallback = new ExecutionCallback<Map<Integer, Object>>() { @Override public void onResponse(Map<Integer, Object> response) { Map<K, Object> result = createHashMap(response.size()); for (Object object : response.values()) { MapEntries mapEntries = (MapEntries) object; mapEntries.putAllToMap(serializationService, result); } resultFuture.setResult(result); if (callback != null) { callback.onResponse(result); } } @Override public void onFailure(Throwable t) { resultFuture.setResult(t); if (callback != null) { callback.onFailure(t); } } }; operationService.invokeOnPartitionsAsync(SERVICE_NAME, operationFactory, partitionsForKeys, partialCallback); return resultFuture; }

Target:
public ICompletableFuture<Map<K, Object>> executeOnKeysInternalAsync(Set<K> keys, Set<Data> dataKeys, EntryProcessor entryProcessor, final ExecutionCallback<Map<K, Object>> callback) { if (dataKeys.isEmpty()) { toDataCollectionWithNonNullKeyValidation(keys, dataKeys); } Collection<Integer> partitionsForKeys = getPartitionsForKeys(dataKeys); OperationFactory operationFactory = operationProvider.createMultipleEntryOperationFactory(name, dataKeys, entryProcessor); final SimpleCompletableFuture<Map<K, Object>> resultFuture = new SimpleCompletableFuture<Map<K, Object>>(getNodeEngine()); ExecutionCallback<Map<Integer, Object>> partialCallback = new ExecutionCallback<Map<Integer, Object>>() { @Override public void onResponse(Map<Integer, Object> response) { Map<K, Object> result = null; try { result = createHashMap(response.size()); for (Object object : response.values()) { MapEntries mapEntries = (MapEntries) object; mapEntries.putAllToMap(serializationService, result); } } catch (Throwable e) { resultFuture.setResult(e); if (callback != null) { callback.onFailure(e); } } resultFuture.setResult(result); if (callback != null) { callback.onResponse(result); } } @Override public void onFailure(Throwable t) { resultFuture.setResult(t); if (callback != null) { callback.onFailure(t); } } }; operationService.invokeOnPartitionsAsync(SERVICE_NAME, operationFactory, partitionsForKeys, partialCallback); return resultFuture; }
Source:
public void testIsAdHocAutostart_true() throws Exception { String id = UUID.randomUUID().toString(); AdHocSubProcess adHocSubProcess = bpmn2.createAdHocSubProcess(); adHocSubProcess.setId(id); CustomElement.autoStart.of(adHocSubProcess).set(Boolean.TRUE); tested = new AdHocSubProcessPropertyReader(adHocSubProcess, definitionResolverReal.getDiagram(), definitionResolverReal); assertTrue(tested.isAdHocAutostart()); }

Target:
public void testIsAdHocAutostart_true() { String id = UUID.randomUUID().toString(); AdHocSubProcess adHocSubProcess = bpmn2.createAdHocSubProcess(); adHocSubProcess.setId(id); CustomElement.autoStart.of(adHocSubProcess).set(Boolean.TRUE); tested = new AdHocSubProcessPropertyReader(adHocSubProcess, definitionResolverReal.getDiagram(), definitionResolverReal); assertTrue(tested.isAdHocAutostart()); }
Source:
public OutputStream setBinaryStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBinaryStream("+pos+");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { @Override public void call() { value = conn.createBlob(in, -1); } }; PipedOutputStream out = new PipedOutputStream(in) { @Override public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return new BufferedOutputStream(out); } catch (Exception e) { throw logAndConvert(e); } }

Target:
public OutputStream setBinaryStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBinaryStream("+pos+");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final JdbcConnection c = conn; final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { @Override public void call() { value = c.createBlob(in, -1); } }; PipedOutputStream out = new PipedOutputStream(in) { @Override public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return new BufferedOutputStream(out); } catch (Exception e) { throw logAndConvert(e); } }
Source:
protected VM getVmFromConfiguration() { QueryReturnValue queryReturnValue = runInternalQuery( QueryType.GetVmConfigurationBySnapshot, new IdQueryParameters(getParameters().getSnapshotId())); return queryReturnValue.getSucceeded() ? queryReturnValue.getReturnValue() : null; }

Target:
private VM getVmFromConfiguration() { QueryReturnValue queryReturnValue = runInternalQuery( QueryType.GetVmConfigurationBySnapshot, new IdQueryParameters(getParameters().getSnapshotId())); return queryReturnValue.getSucceeded() ? queryReturnValue.getReturnValue() : null; }
Source:
public boolean hasNext() { if(currentIteratorHasNext()) { return true; } loadNextChunkIterator(); return currentIteratorHasNext(); }

Target:
public boolean hasNext() { boolean interrupted = Thread.interrupted(); Boolean dataLoaded = null; try { while (!currentIteratorHasNext() && dataLoaded == null) { try { dataLoaded = tryLoadNextChunkIterator(); } catch (InterruptedException ex) { interrupted = true; } } return currentIteratorHasNext(); } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
Source:
private void handleResponsesWithoutContentLength(CarbonMessage cMsg) { if (cMsg.isAlreadyRead()) { MessageDataSource messageDataSource = cMsg.getMessageDataSource(); if (messageDataSource != null) { messageDataSource.serializeData(); cMsg.setEndOfMsgAdded(true); cMsg.getHeaders().remove(Constants.HTTP_CONTENT_LENGTH); } else { LOG.error("Message is already built but cannot find the MessageDataSource"); } } if (cMsg.getHeader(Constants.HTTP_TRANSFER_ENCODING) == null && cMsg.getHeader(Constants.HTTP_CONTENT_LENGTH) == null) { cMsg.setHeader(Constants.HTTP_CONTENT_LENGTH, String.valueOf(cMsg.getFullMessageLength())); } }

Target:
private void handleResponsesWithoutContentLength(CarbonMessage cMsg) { if (cMsg.isAlreadyRead()) { MessageDataSource messageDataSource = cMsg.getMessageDataSource(); if (messageDataSource != null) { messageDataSource.serializeData(); cMsg.setEndOfMsgAdded(true); cMsg.getHeaders().remove(Constants.HTTP_CONTENT_LENGTH); } else { logger.error("Message is already built but cannot find the MessageDataSource"); } } if (cMsg.getHeader(Constants.HTTP_TRANSFER_ENCODING) == null && cMsg.getHeader(Constants.HTTP_CONTENT_LENGTH) == null) { cMsg.setHeader(Constants.HTTP_CONTENT_LENGTH, String.valueOf(cMsg.getFullMessageLength())); } }
Source:
public UpdateQueue(ArrayList<Subscriber> subscribers, ArrayList<Alert> alerts, String pushType, String errorQueue, int retries, int retriesDelay) { this.subscribers = subscribers; this.alerts = alerts; this.pushType = pushType; this.error_queue = errorQueue; this.retries = retries; this.retriesDelay = retriesDelay; }

Target:
public UpdateQueue(ArrayList<Subscriber> subscribers, ArrayList<Alert> alerts, String pushType, String errorQueue, int retries, int retriesDelay) { this.subscribers = subscribers; this.alerts = alerts; this.pushType = pushType; this.error_queue = errorQueue; this.retries = retries; this.retries_delay = retriesDelay; }
Source:
public void reset() { drId = Long.MIN_VALUE; spUniqueId = Long.MIN_VALUE; mpUniqueId = Long.MIN_VALUE; }

Target:
public void reset() { drId = Long.MIN_VALUE; spUniqueId = 0; mpUniqueId = 0; }
Source:
private static double mean(int[] m) { double sum = 0; for (int i = 0; i < m.length; i++) { sum += m[i]; } return sum / m.length; }

Target:
private double mean(int[] m) { double sum = 0; for (int i = 0; i < m.length; i++) { sum += m[i]; } return sum / m.length; }
Source:
private Repository openRepo() throws TransportException { try { RepositoryBuilder builder = new RepositoryBuilder() .setGitDir(remoteGitDir); if (local != null) { builder.setFS(local.getFS()); } return builder.build(); } catch (IOException err) { throw new TransportException(uri, JGitText.get().notAGitDirectory); } }

Target:
private Repository openRepo() throws TransportException { try { return new RepositoryBuilder() .setFS(local != null ? local.getFS() : FS.DETECTED) .setGitDir(remoteGitDir).build(); } catch (IOException err) { throw new TransportException(uri, JGitText.get().notAGitDirectory); } }
Source:
private synchronized boolean isLeader(CorfuMsg msg, IServerRouter r) { boolean lostLeadership = isActive.get() || !isLeader.get(); if (lostLeadership) { log.warn("This node has changed, active={}, leader={}. Dropping message type={}, id={}", isActive.get(), isLeader.get(), msg.getMsgType()); LogReplicationLeadershipLoss payload = new LogReplicationLeadershipLoss(serverContext.getLocalEndpoint()); r.sendResponse(msg, CorfuMsgType.LOG_REPLICATION_LEADERSHIP_LOSS.payloadMsg(payload)); } return !lostLeadership; }

Target:
private synchronized boolean isLeader(CorfuMsg msg, IServerRouter r) { boolean lostLeadership = isActive.get() || !isLeader.get(); if (lostLeadership) { log.warn("This node has changed, active={}, leader={}. Dropping message type={}, id={}", isActive.get(), isLeader.get(), msg.getMsgType(), msg.getRequestID()); LogReplicationLeadershipLoss payload = new LogReplicationLeadershipLoss(serverContext.getLocalEndpoint()); r.sendResponse(msg, CorfuMsgType.LOG_REPLICATION_LEADERSHIP_LOSS.payloadMsg(payload)); } return !lostLeadership; }
Source:
public void previewPageFilesAreDeletedOnCancel() { openGradleNewWizard(); bot.waitUntil(Conditions.shellIsActive(NEW_GRADLE_PROJECT_WIZARD_TITLE)); bot.textWithLabel(ProjectWizardMessages.Label_ProjectName).setText(TEST_PROJECT_NAME); bot.captureScreenshot("new_wiz.png"); SWTBotButton nextButton = bot.button(IDialogConstants.NEXT_LABEL); bot.waitUntil(Conditions.widgetIsEnabled(nextButton)); nextButton.click(); bot.waitUntil(Conditions.shellIsActive(NEW_GRADLE_PROJECT_WIZARD_TITLE)); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.BACK_LABEL))); File workspaceRootDir = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(); System.out.println(workspaceRootDir.getAbsolutePath()); assertTrue(workspaceRootDir.isDirectory()); File[] workspaceRootFiles = workspaceRootDir.listFiles(); assertTrue(workspaceRootFiles.length > 0); Optional<File> firstMatch = FluentIterable.of(workspaceRootFiles) .firstMatch(new FileNamePredicate(TEST_PROJECT_NAME)); assertTrue(firstMatch.isPresent()); File testProjectDir = firstMatch.get(); assertTrue(testProjectDir.isDirectory()); bot.button(IDialogConstants.CANCEL_LABEL).click(); assertFalse(testProjectDir.exists()); }

Target:
public void previewPageFilesAreDeletedOnCancel() { openGradleNewWizard(); bot.waitUntil(Conditions.shellIsActive(NEW_GRADLE_PROJECT_WIZARD_TITLE)); bot.textWithLabel(ProjectWizardMessages.Label_ProjectName).setText(TEST_PROJECT_NAME); SWTBotButton nextButton = bot.button(IDialogConstants.NEXT_LABEL); bot.waitUntil(Conditions.widgetIsEnabled(nextButton)); nextButton.click(); bot.waitUntil(Conditions.shellIsActive(NEW_GRADLE_PROJECT_WIZARD_TITLE)); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.BACK_LABEL))); File workspaceRootDir = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(); assertTrue(workspaceRootDir.isDirectory()); File[] workspaceRootFiles = workspaceRootDir.listFiles(); assertTrue(workspaceRootFiles.length > 0); Optional<File> firstMatch = FluentIterable.of(workspaceRootFiles) .firstMatch(new FileNamePredicate(TEST_PROJECT_NAME)); assertTrue(firstMatch.isPresent()); File testProjectDir = firstMatch.get(); assertTrue(testProjectDir.isDirectory()); bot.button(IDialogConstants.CANCEL_LABEL).click(); assertFalse(testProjectDir.exists()); }
Source:
public void testSameHash() { Object key1 = new Object() { @Override public int hashCode() { return 1; } }; Object key2 = new Object() { @Override public int hashCode() { return 1; } }; assertEquals(key1.hashCode(), key2.hashCode()); assertNotEquals(key1, key2); Cache<Object, Integer> cache = new CacheSimple<>(10); cache.put(key1, 1); assertTrue("Same key, expected in cache", cache.containsKey(key1)); assertFalse("Keys with same hash code should not be considered equal", cache.containsKey(key2)); }

Target:
public void testSameHash() { CompoundKey key1 = new CompoundKey(1, 1); CompoundKey key2 = new CompoundKey(1, 2); assertEquals(key1.hashCode(), key2.hashCode()); assertNotEquals(key1, key2); Cache<CompoundKey, Integer> cache = new CacheSimple<>(10); cache.put(key1, 1); assertTrue("Same key, expected to be in cache", cache.containsKey(key1)); assertFalse("Keys with same hash code should not be considered equal", cache.containsKey(key2)); }
Source:
public void execute() { initializeAndStart(); try (QuietClosable ignored = this::closePartitions) { while (!isStopping()) iteration(); } }

Target:
public void execute() { initializeAndStart(); try (UncheckedCloseable suppressible = this::closePartitions) { while (!isStopping()) iteration(); } }
Source:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mInviteCollaboratorsListener = ((InviteCollaboratorsListener) getActivity()); mCollabInitialsView.setInviteCollaboratorsListener(mInviteCollaboratorsListener); }

Target:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mCollabInitialsView.setShowCollaboratorsListener(this); }
Source:
private Object findObject(ResultSet rs, String columnName) throws SQLException { int separatorIndex = columnName.indexOf('.'); if (separatorIndex > 0) { try { return rs.getObject(columnName.substring(separatorIndex)); } catch (SQLException ignored) { } } return rs.getObject(columnName); }

Target:
private Object findObject(ResultSet rs, String columnName) throws SQLException{ return rs.getObject(queryProvider.getSortKeyResultName(columnName)); }
Source:
public boolean pingAgent( String applicationName, String rootInstanceName, String message, long timeout ) throws InterruptedException, IOException { final ManagedApplication ma = this.appNameToManagedApplication.get( applicationName ); if (ma == null) { throw new NoSuchElementException( "No application with name: " + applicationName ); } final Application app = ma.getApplication(); Instance instance = null; for (Instance i : app.getRootInstances()) { if (i.getName().equals( rootInstanceName )) { instance = i; break; } } if (instance == null) { throw new NoSuchElementException( "No root instance with name " + rootInstanceName + " in application " + applicationName); } MsgEcho ping = new MsgEcho( "PING:" + message ); this.messagingClient.sendMessageToAgent( app, instance, ping ); logger.fine( "Sent PING request message=" + message + "timeout=" + timeout + "ms to application=" + applicationName + ", agent=" + rootInstanceName ); boolean hasFound = false; final long deadline = System.currentTimeMillis() + timeout; final String expectedMessage = "PONG:" + message; while (true) { synchronized ( this.echoMessages ) { for (Iterator<MsgEcho> i = echoMessages.iterator(); i.hasNext(); ) { final MsgEcho m = i.next(); if ( m.getContent().equals( expectedMessage ) ) { hasFound = true; i.remove(); break; } } long now = System.currentTimeMillis(); if ( hasFound || now >= deadline ) { break; } this.echoMessages.wait( deadline - now ); } } return hasFound; }

Target:
public boolean pingAgent( String applicationName, String rootInstanceName, String message, long timeout ) throws InterruptedException, IOException { final ManagedApplication ma = this.appNameToManagedApplication.get( applicationName ); if (ma == null) { throw new NoSuchElementException( "No application with name: " + applicationName ); } final Application app = ma.getApplication(); Instance instance = null; for (Instance i : app.getRootInstances()) { if (i.getName().equals( rootInstanceName )) { instance = i; break; } } if (instance == null) { throw new NoSuchElementException( "No root instance with name " + rootInstanceName + " in application " + applicationName); } final long deadline = System.currentTimeMillis() + timeout; MsgEcho ping = new MsgEcho( "PING:" + message, deadline ); this.messagingClient.sendMessageToAgent( app, instance, ping ); logger.fine( "Sent PING request message=" + message + "timeout=" + timeout + "ms to application=" + applicationName + ", agent=" + rootInstanceName ); return waitForEchoMessage( ping.getUuid(), deadline ) != null; }
Source:
public void testDoDoDelete() throws Exception{ FreeStyleProject project = j.createFreeStyleProject("project"); GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy(); j.jenkins.setAuthorizationStrategy(auth); j.jenkins.setCrumbIssuer(null); HudsonPrivateSecurityRealm realm = new HudsonPrivateSecurityRealm(false); j.jenkins.setSecurityRealm(realm); User user = realm.createAccount("John Smith", "password"); try (ACLContext as = ACL.as(user)) { project.doDoDelete(null, null); fail("User should not have permission to build project"); } catch(Exception e){ if(!(e.getClass().isAssignableFrom(AccessDeniedException2.class))){ fail("AccessDeniedException should be thrown."); } } auth.add(Jenkins.READ, user.getId()); auth.add(Job.READ, user.getId()); auth.add(Job.DELETE, user.getId()); JenkinsRule.WebClient wc = j.createWebClient(); wc.withBasicCredentials(user.getId(), "password"); HtmlPage p = wc.goTo(project.getUrl() + "delete"); List<HtmlForm> forms = p.getForms(); for(HtmlForm form:forms){ if("doDelete".equals(form.getAttribute("action"))){ j.submit(form); } } assertNull("Project should be deleted form memory.", j.jenkins.getItem(project.getDisplayName())); assertFalse("Project should be deleted form disk.", project.getRootDir().exists()); }

Target:
public void testDoDoDelete() throws Exception{ FreeStyleProject project = j.createFreeStyleProject("project"); GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy(); j.jenkins.setAuthorizationStrategy(auth); j.jenkins.setCrumbIssuer(null); j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); User user = User.getById("john", true); try (ACLContext as = ACL.as(user)) { project.doDoDelete(null, null); fail("User should not have permission to build project"); } catch(Exception e){ if(!(e.getClass().isAssignableFrom(AccessDeniedException2.class))){ fail("AccessDeniedException should be thrown."); } } auth.add(Jenkins.READ, user.getId()); auth.add(Job.READ, user.getId()); auth.add(Job.DELETE, user.getId()); JenkinsRule.WebClient wc = j.createWebClient(); wc.withBasicCredentials(user.getId()); HtmlPage p = wc.goTo(project.getUrl() + "delete"); List<HtmlForm> forms = p.getForms(); for(HtmlForm form:forms){ if("doDelete".equals(form.getAttribute("action"))){ j.submit(form); } } assertNull("Project should be deleted form memory.", j.jenkins.getItem(project.getDisplayName())); assertFalse("Project should be deleted form disk.", project.getRootDir().exists()); }
Source:
public ImmutableBitmap getBitmapIndex(final BitmapIndexSelector selector) { final Context cx = Context.enter(); try { ImmutableBitmap bitmap; boolean hasEmptyDimension = false; Indexed<String> dimValuesList = new Indexed[dimension.length]; Iterator<String> dimValuesIterator = new Iterator[dimension.length]; String[] currentDim = new String[dimension.length]; for(int idx = 0; idx < dimension.length; idx++) { dimValuesList[idx] = selector.getDimensionValues(dimension[idx]); if (dimValuesList[idx].size() == 0) { hasEmptyDimension = true; break; } dimValuesIterator[idx] = dimValuesList[idx].iterator(); if (idx != 0) { currentDim[idx] = dimValuesIterator[idx].next(); } } bitmap = selector.getBitmapFactory().makeEmptyImmutableBitmap(); if (!hasEmptyDimension) { int iteratingIndex = 0; while(true) { Iterator<String> iterator = dimValuesIterator[iteratingIndex]; if (iterator.hasNext()) { currentDim[iteratingIndex] = iterator.next(); if (predicate.applyInContext(cx, currentDim)) { ImmutableBitmap overlap = null; for (int idx = 0; idx < dimension.length; idx++) { ImmutableBitmap dimBitMap = selector.getBitmapIndex(dimension[idx], currentDim[idx]); overlap = (overlap == null) ? dimBitMap : overlap.intersection(dimBitMap); } bitmap = bitmap.union(overlap); } if (iteratingIndex > 0) { for (int idx = 0; idx < iteratingIndex; idx++) { dimValuesIterator[idx] = dimValuesList[idx].iterator(); } iteratingIndex = 0; } } else { iteratingIndex++; if (iteratingIndex == dimension.length) break; } } } return bitmap; } finally { Context.exit(); } }

Target:
public ImmutableBitmap getBitmapIndex(final BitmapIndexSelector selector) { final Context cx = Context.enter(); try { ImmutableBitmap bitmap; boolean hasEmptyDimension = false; Indexed<String> dimValuesList = new Indexed[dimension.length]; Iterator<String> dimValuesIterator = new Iterator[dimension.length]; String[] currentDim = new String[dimension.length]; for(int idx = 0; idx < dimension.length; idx++) { dimValuesList[idx] = selector.getDimensionValues(dimension[idx]); if (dimValuesList[idx].size() == 0) { hasEmptyDimension = true; break; } dimValuesIterator[idx] = dimValuesList[idx].iterator(); if (idx != 0) { currentDim[idx] = dimValuesIterator[idx].next(); } } bitmap = selector.getBitmapFactory().makeEmptyImmutableBitmap(); if (!hasEmptyDimension) { int iteratingIndex = 0; while(true) { Iterator<String> iterator = dimValuesIterator[iteratingIndex]; if (iterator.hasNext()) { currentDim[iteratingIndex] = iterator.next(); if (iteratingIndex > 0) { for (int idx = 0; idx < iteratingIndex; idx++) { dimValuesIterator[idx] = dimValuesList[idx].iterator(); currentDim[idx] = dimValuesIterator[idx].next(); } iteratingIndex = 0; } if (predicate.applyInContext(cx, currentDim)) { ImmutableBitmap overlap = null; for (int idx = 0; idx < dimension.length; idx++) { ImmutableBitmap dimBitMap = selector.getBitmapIndex(dimension[idx], currentDim[idx]); overlap = (overlap == null) ? dimBitMap : overlap.intersection(dimBitMap); } bitmap = bitmap.union(overlap); } } else { iteratingIndex++; if (iteratingIndex == dimension.length) break; } } } return bitmap; } finally { Context.exit(); } }
Source:
public void close() throws IOException, SQLException { if (!executorService.isShutdown()) { executorService.shutdown(); } s3.shutdown(); closeCurrentFile().delete(); if (connection != null) { connection.close(); connection = null; } }

Target:
public void close() throws IOException, SQLException { executorService.shutdownNow(); try { executorService.awaitTermination(60, TimeUnit.SECONDS); } catch (InterruptedException e) s3.shutdown(); closeCurrentFile().delete(); if (connection != null) { connection.close(); connection = null; } }
Source:
void trackExpiration(I id) { final ExpirationInfo expiration; synchronized (this) { if (trackedIds.containsKey(id)) { expiration = trackedIds.get(id); if (expiration.nextExpiration != null) { expiration.nextExpiration.previousExpiration = expiration.previousExpiration; } if (expiration.previousExpiration != null) { expiration.previousExpiration.nextExpiration = expiration.nextExpiration; } else if (firstExpiration == expiration && firstExpiration != lastExpiration) { firstExpiration = firstExpiration.nextExpiration; } expiration.previousExpiration = null; } else { expiration = new ExpirationInfo(id); trackedIds.put(id, expiration); } if (lastExpiration == null) { firstExpiration = lastExpiration = expiration; } else if (lastExpiration != expiration) { expiration.previousExpiration = lastExpiration; lastExpiration.nextExpiration = expiration; lastExpiration = expiration; } } synchronized(expiration) { expiration.expiration = System.currentTimeMillis() + timeout; } }

Target:
void trackExpiration(I id) { final ExpirationInfo expiration; synchronized (this) { if (trackedIds.containsKey(id)) { expiration = trackedIds.get(id); if (expiration != lastExpiration) { if (expiration.nextExpiration != null) { expiration.nextExpiration.previousExpiration = expiration.previousExpiration; } if (expiration.previousExpiration != null) { expiration.previousExpiration.nextExpiration = expiration.nextExpiration; } else if (firstExpiration == expiration) { firstExpiration = firstExpiration.nextExpiration; } expiration.previousExpiration = null; expiration.nextExpiration = null; } } else { expiration = new ExpirationInfo(id); trackedIds.put(id, expiration); } if (lastExpiration == null) { firstExpiration = lastExpiration = expiration; } else if (lastExpiration != expiration) { expiration.previousExpiration = lastExpiration; lastExpiration.nextExpiration = expiration; lastExpiration = expiration; } } synchronized(expiration) { expiration.expiration = System.currentTimeMillis() + timeout; } }
Source:
public void onBackPressed() { Drawable drawable = getDrawable(R.drawable.shape); GradientDrawable gradientDrawable = (GradientDrawable) drawable; gradientDrawable.setColor(getPrimaryColor()); checkForReveal = true; if ((editMode && all_photos) || (editMode && fav_photos)) clearSelectedPhotos(); getNavigationBar(); if (editMode) finishEditMode(); else { if (albumsMode) { if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) mDrawerLayout.closeDrawer(GravityCompat.START); else { if (doubleBackToExitPressedOnce && isTaskRoot()) finish(); else if (isTaskRoot()) { doubleBackToExitPressedOnce = true; final View layouttoast; LayoutInflater inflater = getLayoutInflater(); layouttoast = inflater.inflate(R.layout.toast_custom, (ViewGroup) findViewById(R.id.toastcustom)); ((TextView) layouttoast.findViewById(R.id.texttoast)).setText("Press back again to exit"); Toast mytoast = new Toast(getBaseContext()); mytoast.setView(layouttoast); mytoast.setDuration(Toast.LENGTH_SHORT); mytoast.show(); new Handler().postDelayed(new Runnable() { @Override public void run() { doubleBackToExitPressedOnce = false; } }, 2000); } else super.onBackPressed(); } } else { displayAlbums(); } } }

Target:
public void onBackPressed() { Drawable drawable = getDrawable(R.drawable.shape); GradientDrawable gradientDrawable = (GradientDrawable) drawable; gradientDrawable.setColor(getPrimaryColor()); checkForReveal = true; if ((editMode && all_photos) || (editMode && fav_photos)) clearSelectedPhotos(); getNavigationBar(); if (editMode) finishEditMode(); else { if (albumsMode) { if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) mDrawerLayout.closeDrawer(GravityCompat.START); else { if (doubleBackToExitPressedOnce && isTaskRoot()) finish(); else if (isTaskRoot()) { doubleBackToExitPressedOnce = true; final View layouttoast; LayoutInflater inflater = getLayoutInflater(); layouttoast = inflater.inflate(R.layout.toast_custom, (ViewGroup) findViewById(R.id.toastcustom)); ((TextView) layouttoast.findViewById(R.id.texttoast)).setText(R.string.back_to_exit); Toast mytoast = new Toast(getBaseContext()); mytoast.setView(layouttoast); mytoast.setDuration(Toast.LENGTH_SHORT); mytoast.show(); new Handler().postDelayed(new Runnable() { @Override public void run() { doubleBackToExitPressedOnce = false; } }, 2000); } else super.onBackPressed(); } } else { displayAlbums(); } } }
Source:
public boolean needsInput() { if (isSinglePartition() && maxRowsPerPartition.isPresent()) { return partitionRowCount.get(0) < maxRowsPerPartition.get() && !finishing && inputPage == null; } return !finishing && inputPage == null && unfinishedWork == null; }

Target:
public boolean needsInput() { if (isSinglePartition() && maxRowsPerPartition.isPresent()) { return partitionRowCount.get(0) < maxRowsPerPartition.get() && !finishing && !hasUnfinishedInput(); } return !finishing && !hasUnfinishedInput(); }
Source:
public void getZeroScore() { BendableBigDecimalScore score = new BendableBigDecimalScoreDefinition(1, 2).getZeroScore(); assertThat(score.toLevelNumbers()).containsOnly(BigDecimal.ZERO); }

Target:
public void getZeroScore() { BendableBigDecimalScore score = new BendableBigDecimalScoreDefinition(1, 2).getZeroScore(); assertThat(score).isEqualTo(BendableBigDecimalScore.zero(1, 2)); }