auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static <T> Lazy<Seq<T>> sequence(Iterable<? extends Lazy<? extends T>> values) { Objects.requireNonNull(values, "values is null"); return Lazy.of(() -> Stream.ofAll(values).map(Lazy::get)); }

Target:
public static <T> Lazy<Seq<T>> sequence(Iterable<? extends Lazy<? extends T>> values) { Objects.requireNonNull(values, "values is null"); return Lazy.of(() -> Vector.ofAll(values).map(Lazy::get)); }
Source:
public boolean postSubtitleInfo(long time, long dur, byte[] rawText, int flags) { if ((flags & FLUSH_SUBTITLE_QUEUE) == FLUSH_SUBTITLE_QUEUE) { subtitleLock.writeLock().lock(); try { subEntries.clear(); subEntryPos = -1; } finally { subtitleLock.writeLock().unlock(); } } return insertEntryForPostedInfo(time, dur, rawText); }

Target:
public boolean postSubtitleInfo(long time, long dur, byte[] rawText, int flags) { subtitleLock.writeLock().lock(); try { if ((flags & FLUSH_SUBTITLE_QUEUE) == FLUSH_SUBTITLE_QUEUE) { subEntries.clear(); subEntryPos = -1; } return insertEntryForPostedInfo(time, dur, rawText); } finally { subtitleLock.writeLock().unlock(); } }
Source:
public void testSprintCRUD() { JaxNewAgileTeam newTeam = newJaxAgileTeam(); Response response = agile.createTeam(newTeam); Assert.assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); JaxNewAgileSprint newSprint = new JaxNewAgileSprint(); newSprint.setName("My Sprint"); Long uuid = Lib.generateArtifactIdAsInt(); newSprint.setUuid(uuid); newSprint.setTeamUuid(teamUuid); Response response2 = agile.createSprint(teamUuid, newSprint); Assert.assertEquals(Response.Status.CREATED.getStatusCode(), response2.getStatus()); List<JaxAgileSprint> sprints = agile.getSprints(teamUuid); Assert.assertEquals(1, sprints.size()); JaxAgileSprint sprint = sprints.iterator().next(); Assert.assertEquals("My Sprint", sprint.getName()); Assert.assertEquals(teamUuid, sprint.getTeamUuid()); Assert.assertEquals(uuid.longValue(), sprint.getUuid().longValue()); agile.deleteSprint(teamUuid, sprint.getUuid()); sprints = agile.getSprints(teamUuid); Assert.assertNull(AtsClientService.get().getArtifact(sprint.getUuid())); }

Target:
public void testSprintCRUD() { JaxNewAgileTeam newTeam = newJaxAgileTeam(); Response response = agile.createTeam(newTeam); Assert.assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); JaxNewAgileSprint newSprint = new JaxNewAgileSprint(); newSprint.setName("My Sprint"); Long uuid = Lib.generateArtifactIdAsInt(); newSprint.setUuid(uuid); newSprint.setTeamUuid(teamUuid); Response response2 = agile.createSprint(teamUuid, newSprint); Assert.assertEquals(Response.Status.CREATED.getStatusCode(), response2.getStatus()); List<JaxAgileSprint> sprints = agile.getSprints(teamUuid); Assert.assertEquals(1, sprints.size()); JaxAgileSprint sprint = sprints.iterator().next(); Assert.assertEquals("My Sprint", sprint.getName()); Assert.assertEquals(teamUuid, sprint.getTeamUuid()); Assert.assertEquals(uuid, sprint.getUuid()); agile.deleteSprint(teamUuid, sprint.getUuid()); sprints = agile.getSprints(teamUuid); Assert.assertNull(AtsClientService.get().getArtifact(sprint.getUuid())); }
Source:
@Override public void end() { assert downstream() != null; assert waiting > 0; try { checkState(); waiting = -1; if (rowIdx >= rows.size() && waiting == -1) downstream().end(); } catch (Exception e) { downstream().onError(e); } }

Target:
@Override public void end() { assert downstream() != null; assert waiting > 0; try { checkState(); waiting = -1; if (rowIdx >= rows.size() && requested > 0) downstream().end(); } catch (Exception e) { downstream().onError(e); } }
Source:
public void addEntity(Entity entity) { LOGGER.debug("Adding/Updating the entity in ES"); String fieldToAdd = null; String fieldValueToAdd = ""; try { XContentBuilder builder = jsonBuilder() .startObject(); for(String field: docDef.fields()) { if(entity.get(field) != null) { if(entity.getLanguage() != null && !entity.getLanguage().isEmpty() && isMultilingual) { fieldToAdd = field + "_" + entity.getLanguage(); } else { fieldToAdd = field; } fieldValueToAdd = (String) entity.get(field); builder = builder.field(fieldToAdd, Arrays.asList(fieldValueToAdd)); break; } else { builder = builder.field(field, Collections.emptyList()); } } builder = builder.endObject(); IndexRequest indexRequest = new IndexRequest(INDEX_NAME, docDef.getEntityField(), entity.getId()) .source(builder); SearchResponse existsResponse = client.prepareSearch(INDEX_NAME) .setTypes(docDef.getEntityField()) .setQuery(QueryBuilders.existsQuery(fieldToAdd)) .get(); String script; if(existsResponse != null && existsResponse.getHits() != null && existsResponse.getHits().totalHits() > 0) { script = "ctx._source." + fieldToAdd+".add('"+ fieldValueToAdd + "')"; } else { script = "ctx._source." + fieldToAdd+" =['"+ fieldValueToAdd + "']"; } UpdateRequest upReq = new UpdateRequest(INDEX_NAME, docDef.getEntityField(), entity.getId()) .script(new Script(script)) .upsert(indexRequest); UpdateResponse response = client.update(upReq).get(); LOGGER.debug("Received the following Update response : " + response + " for the following entity: " + entity); } catch(Exception e) { throw new TextIndexException("Unable to Index the Entity in ElasticSearch.", e); } }

Target:
public void addEntity(Entity entity) { LOGGER.debug("Adding/Updating the entity in ES"); String fieldToAdd = null; String fieldValueToAdd = null; try { XContentBuilder builder = jsonBuilder() .startObject(); for(String field: docDef.fields()) { if(entity.get(field) != null) { if(entity.getLanguage() != null && !entity.getLanguage().isEmpty()) { fieldToAdd = normalizeFieldName(field, entity.getLanguage()); } else { fieldToAdd = field; } fieldValueToAdd = (String) entity.get(field); builder = builder.field(fieldToAdd, Arrays.asList(fieldValueToAdd)); break; } else { builder = builder.field(field, Collections.emptyList()); } } builder = builder.endObject(); IndexRequest indexRequest = new IndexRequest(indexName, docDef.getEntityField(), entity.getId()) .source(builder); String addUpdateScript = ADD_UPDATE_SCRIPT.replaceAll("<fieldName>", fieldToAdd); Map<String, Object> params = new HashMap<>(); params.put("fieldValue", fieldValueToAdd); UpdateRequest upReq = new UpdateRequest(indexName, docDef.getEntityField(), entity.getId()) .script(new Script(Script.DEFAULT_SCRIPT_TYPE, Script.DEFAULT_SCRIPT_LANG, addUpdateScript, params)) .upsert(indexRequest); UpdateResponse response = client.update(upReq).get(); LOGGER.debug("Received the following Update response : " + response + " for the following entity: " + entity); } catch(Exception e) { throw new TextIndexException("Unable to Index the Entity in ElasticSearch.", e); } }
Source:
public ParametersMap put(Parameter param, Object value) { if (!isAssignableFrom(param.getJavaType(), value.getClass())) { throw new InvalidParameterValueException(param.getName(), param.getJavaType(), value.getClass()); } paramsMap.put(param, (Serializable) value); return this; }

Target:
public ParametersMap put(Parameter param, Object value) { if (value == null) { remove(param); } else { if (!isAssignableFrom(param.getJavaType(), value.getClass())) { throw new InvalidParameterValueException(param.getName(), param.getJavaType(), value.getClass()); } paramsMap.put(param, (Serializable) value); } return this; }
Source:
public X509Certificate[] getCertificateChain(String alias) { return this.certsByAlias.get(alias); }

Target:
public X509Certificate[] getCertificateChain(String alias) { X509Certificate[] result = this.certsByAlias.get(alias); if (result != null) { return result; } throw new IllegalArgumentException("No certificate found for alias:'" + alias + "'"); }
Source:
private void assignTurns(String[] splitLaneOptions, TurnType t) { for (int i = 0; i < splitLaneOptions.length; i++) { String[] laneOptions = splitLaneOptions[i].split(";"); for (int j = 0; j < laneOptions.length; j++) { int turn; if (laneOptions[j].equals("none") || laneOptions[j].equals("through")) { turn = TurnType.C; } else if (laneOptions[j].equals("slight_right")) { turn = TurnType.TSLR; } else if (laneOptions[j].equals("slight_left")) { turn = TurnType.TSLL; } else if (laneOptions[j].equals("right")) { turn = TurnType.TR; } else if (laneOptions[j].equals("left")) { turn = TurnType.TL; } else if (laneOptions[j].equals("sharp_right")) { turn = TurnType.TSHR; } else if (laneOptions[j].equals("sharp_left")) { turn = TurnType.TSHL; } else if (laneOptions[j].equals("reverse")) { turn = TurnType.TU; } else { continue; } if (TurnType.getPrimaryTurn(t.getLanes()[i]) == 0) { t.setPrimaryTurn(i, turn); } else { t.setSecondaryTurn(i, turn); break; } } } }

Target:
private void assignTurns(String[] splitLaneOptions, TurnType t) { for (int i = 0; i < splitLaneOptions.length; i++) { String[] laneOptions = splitLaneOptions[i].split(";"); for (int j = 0; j < laneOptions.length; j++) { int turn; if (laneOptions[j].equals("none") || laneOptions[j].equals("through")) { turn = TurnType.C; } else if (laneOptions[j].equals("slight_right")) { turn = TurnType.TSLR; } else if (laneOptions[j].equals("slight_left")) { turn = TurnType.TSLL; } else if (laneOptions[j].equals("right")) { turn = TurnType.TR; } else if (laneOptions[j].equals("left")) { turn = TurnType.TL; } else if (laneOptions[j].equals("sharp_right")) { turn = TurnType.TSHR; } else if (laneOptions[j].equals("sharp_left")) { turn = TurnType.TSHL; } else if (laneOptions[j].equals("reverse")) { turn = TurnType.TU; } else { continue; } if (TurnType.getPrimaryTurn(t.getLanes()[i]) == 0) { t.setPrimaryTurn(i, turn); } else { if (turn == t.getValue()) { t.setSecondaryTurn(i, TurnType.getPrimaryTurn(t.getLanes()[i])); t.setPrimaryTurn(i, turn); } else { t.setSecondaryTurn(i, turn); } break; } } } }
Source:
public List<Property<?>> getProperties() { List<Property<?>> result = Lists.newArrayList(); BackdropProvider backdropProvider = CoreRegistry.get(BackdropProvider.class); if (backdropProvider != null) { result.addAll(new ReflectionProvider(backdropProvider).getProperties()); } DefaultRenderingProcess postRenderer = DefaultRenderingProcess.getInstance(); if (postRenderer != null) { result.addAll(new ReflectionProvider(postRenderer).getProperties()); } return result; }

Target:
public List<Property<?>> getProperties() { List<Property<?>> result = Lists.newArrayList(); BackdropProvider backdropProvider = CoreRegistry.get(BackdropProvider.class); if (backdropProvider != null) { result.addAll(new ReflectionProvider(backdropProvider).getProperties()); } BackdropRenderer backdropRenderer = CoreRegistry.get(BackdropRenderer.class); if (backdropRenderer != null) { result.addAll(new ReflectionProvider(backdropRenderer).getProperties()); } DefaultRenderingProcess postRenderer = DefaultRenderingProcess.getInstance(); if (postRenderer != null) { result.addAll(new ReflectionProvider(postRenderer).getProperties()); } return result; }
Source:
public void stop() { this.setActive(false); if (this.selector != null) { try { this.selector.close(); } catch (Exception e) { logger.error("Error closing selector", e); } } if (this.serverChannel == null) { return; } try { this.serverChannel.close(); } catch (IOException e) this.serverChannel = null; super.stop(); }

Target:
public void stop() { this.setActive(false); if (this.selector != null) { try { this.selector.close(); } catch (Exception e) { logger.error("Error closing selector", e); } } if (this.serverChannel != null) { try { this.serverChannel.close(); } catch (IOException e) finally { this.serverChannel = null; } } super.stop(); }
Source:
public void verifyBoardDescription( String description ) { waitForTextToBePresentInElementByElement( boardDescription, description ); PageObjectLogging.log("verifyBoardDescription", "board description verified", true); }

Target:
public void verifyBoardDescription( String description ) { waitForTextToBePresentInElementByElement( boardDescription, description ); waitForElementByElement( boardDescription ); Assertion.assertStringContains( boardDescription.getText(), description ); }
Source:
protected void initStructureMergeViewerGroupProvider(Comparison comparison, IComparisonScope comparisonScope) { EMFCompareRCPUIPlugin plugin = EMFCompareRCPUIPlugin.getDefault(); IDifferenceGroupProvider.Descriptor.Registry groupProviderRegistry = plugin .getDifferenceGroupProviderRegistry(); Descriptor defaultGroupProvider = groupProviderRegistry.getDefaultGroupProvider(comparisonScope, comparison); if (defaultGroupProvider != null) { getStructureMergeViewerGrouper().setProvider(defaultGroupProvider.createGroupProvider()); } else { EMFCompareIDEUIPlugin.getDefault().getLog().log( new Status(IStatus.WARNING, EMFCompareIDEUIPlugin.PLUGIN_ID, "Unable to find a default group provider")); getStructureMergeViewerGrouper().setProvider(new DefaultGroupProvider()); } }

Target:
protected void initStructureMergeViewerGroupProvider(Comparison comparison, IComparisonScope comparisonScope) { EMFCompareRCPUIPlugin plugin = EMFCompareRCPUIPlugin.getDefault(); IDifferenceGroupProvider.Descriptor.Registry groupProviderRegistry = plugin .getDifferenceGroupProviderRegistry(); Descriptor defaultGroupProvider = groupProviderRegistry.getDefaultGroupProvider(comparisonScope, comparison); IDifferenceGroupProvider defaultGroup = null; if (defaultGroupProvider != null) { defaultGroup = defaultGroupProvider.createGroupProvider(); } if (defaultGroup == null) { defaultGroup = new DefaultGroupProvider(); } getStructureMergeViewerGrouper().setProvider(defaultGroup); }
Source:
public void addIncludeResource(String resource) { String key = hasIncludeResourceHeader() ? Constants.INCLUDE_RESOURCE : Constants.INCLUDERESOURCE; List<String> entries = getEntries(key, listConverter); entries.add(resource); setEntries(entries, key); }

Target:
public void addIncludeResource(String resource) { String key = hasIncludeResourceInstruction() ? Constants.INCLUDERESOURCE : Constants.INCLUDE_RESOURCE; List<String> entries = getEntries(key, listConverter); entries.add(resource); setEntries(entries, key); }
Source:
public String toString() { StringBuilder sb = new StringBuilder("ConfigRenderOptions("); if (originComments) sb.append("originComments,"); if (comments) sb.append("comments,"); if (formatted) sb.append("formatted,"); if (json) sb.append("json,"); if (comparator != null) sb.append(comparator.getClass().getSimpleName()); if (sb.charAt(sb.length() - 1) == ',') sb.setLength(sb.length() - 1); sb.append(")"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder("ConfigRenderOptions("); if (originComments) sb.append("originComments,"); if (comments) sb.append("comments,"); if (formatted) sb.append("formatted,"); if (json) sb.append("json,"); sb.append(comparator.getClass().getSimpleName()); if (sb.charAt(sb.length() - 1) == ',') sb.setLength(sb.length() - 1); sb.append(")"); return sb.toString(); }
Source:
public RequestTemplate resolve(Map<String, ?> unencoded) { replaceQueryValues(unencoded); Map<String, String> encoded = new LinkedHashMap<String, String>(); for (Entry<String, ?> entry : unencoded.entrySet()) { encoded.put(entry.getKey(), urlEncode(String.valueOf(entry.getValue()))); } String resolvedUrl = expand(url.toString(), encoded).replace("+", "%20"); if (decodeSlash) { resolvedUrl = resolvedUrl.replace("%2F", "/"); } url = new StringBuilder(resolvedUrl); Map<String, Collection<String>> resolvedHeaders = new LinkedHashMap<String, Collection<String>>(); for (String field : headers.keySet()) { Collection<String> resolvedValues = new ArrayList<String>(); for (String value : valuesOrEmpty(headers, field)) { String expandedValueWithEncodedPlus = expand(value, encoded).replaceAll("\\+", "__PLUS__"); String resolved = urlDecode(expandedValueWithEncodedPlus).replaceAll("__PLUS__", "+"); resolvedValues.add(resolved); } resolvedHeaders.put(field, resolvedValues); } headers.clear(); headers.putAll(resolvedHeaders); if (bodyTemplate != null) { body(urlDecode(expand(bodyTemplate, encoded))); } return this; }

Target:
public RequestTemplate resolve(Map<String, ?> unencoded) { replaceQueryValues(unencoded); Map<String, String> encoded = new LinkedHashMap<String, String>(); for (Entry<String, ?> entry : unencoded.entrySet()) { encoded.put(entry.getKey(), urlEncode(String.valueOf(entry.getValue()))); } String resolvedUrl = expand(url.toString(), encoded).replace("+", "%20"); if (decodeSlash) { resolvedUrl = resolvedUrl.replace("%2F", "/"); } url = new StringBuilder(resolvedUrl); Map<String, Collection<String>> resolvedHeaders = new LinkedHashMap<String, Collection<String>>(); for (String field : headers.keySet()) { Collection<String> resolvedValues = new ArrayList<String>(); for (String value : valuesOrEmpty(headers, field)) { String expandedValueWithEncodedPlus = expand(value.replace("+", "%2B"), encoded); String resolved = urlDecode(expandedValueWithEncodedPlus); resolvedValues.add(resolved); } resolvedHeaders.put(field, resolvedValues); } headers.clear(); headers.putAll(resolvedHeaders); if (bodyTemplate != null) { body(urlDecode(expand(bodyTemplate, encoded))); } return this; }
Source:
DataTable getDataTable() { return dataTable; }

Target:
public DataTable getDataTable() { return dataTable; }
Source:
private Object getMapping(String mappingName) { DocumentReference mappingDoc = getMappingDocument(); Object result = getMapping(mappingDoc, mappingName); if (result == null) { try { JSONObject mappings = JSONObject.fromObject(this.bridge.getDocumentContentForDefaultLanguage(mappingDoc)); result = mappings.get(mappingName); } catch (Exception ex) { this.logger.warn("Failed to access mapping: {}", ex.getMessage()); } } return result; }

Target:
private Object getMapping(String mappingName) { DocumentReference mappingDoc = getMappingDocument(); Object result = getMapping(mappingDoc, mappingName); if (result == null) { try { String mappingContent = this.bridge.getDocumentContentForDefaultLanguage(mappingDoc); if (mappingContent.startsWith("{{velocity")) { result = parseVelocityMapping(mappingDoc).get(mappingName); } else if (mappingContent.startsWith("{{groovy")) { result = parseGroovyMapping(mappingDoc).get(mappingName); } else { result = JSONObject.fromObject(mappingContent).get(mappingName); } } catch (Exception ex) { this.logger.warn("Failed to access mapping: {}", ex.getMessage()); } } return result; }
Source:
private Set<Credential> supported(final Collection<? extends Credential> candidateCredentials) { return candidateCredentials.stream().filter(c -> credentials.contains(c.getClass())) .collect(Collectors.toSet()); }

Target:
private Set<Credential> supported(final Collection<? extends Credential> candidateCredentials) { return candidateCredentials.stream().filter(c -> credentials.contains(c.getClass())) .collect(Collectors.toCollection(LinkedHashSet::new)); }
Source:
void class_factory_should_allow_class_assertions() { @SuppressWarnings("deprecation") Object value = Certificate.class; ClassAssert result = assertThat(value).asInstanceOf(CLASS); result.hasAnnotations(Deprecated.class); }

Target:
void class_factory_should_allow_class_assertions() { Object value = Function.class; ClassAssert result = assertThat(value).asInstanceOf(CLASS); result.hasAnnotations(FunctionalInterface.class); }
Source:
private void recoverSegment(PBDSegment qs, boolean deleteEmpty) throws IOException { if (deleteEmpty) { if (qs.getNumEntries() == 0) { qs.setFinal(false); if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Found Empty Segment with entries: " + qs.getNumEntries() + " For: " + qs.file().getName()); m_usageSpecificLog.debug("Segment " + qs.file() + " (final: " + qs.isFinal() + "), will be closed and deleted during init"); } qs.closeAndDelete(); return; } } if (!qs.isFinal()) { LOG.warn("Segment " + qs.file() + " (final: " + qs.isFinal() + "), has been recovered but is not in a final state"); } else if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Segment " + qs.file() + " (final: " + qs.isFinal() + "), has been recovered"); } qs.close(); m_segments.put(qs.segmentIndex(), qs); }

Target:
private void recoverSegment(PBDSegment qs, boolean deleteEmpty) throws IOException { if (deleteEmpty && qs.getNumEntries() == 0) { qs.setFinal(false); if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Found Empty Segment with entries: " + qs.getNumEntries() + " For: " + qs.file().getName()); m_usageSpecificLog.debug("Segment " + qs.file() + " (final: " + qs.isFinal() + "), will be closed and deleted during init"); } qs.closeAndDelete(); return; } if (!qs.isFinal()) { LOG.warn("Segment " + qs.file() + " (final: " + qs.isFinal() + "), has been recovered but is not in a final state"); } else if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Segment " + qs.file() + " (final: " + qs.isFinal() + "), has been recovered"); } qs.close(); m_segments.put(qs.segmentIndex(), qs); }
Source:
void send(DatastreamTask task, ProducerRecord<K, V> producerRecord, Callback onComplete) throws InterruptedException { boolean retry = true; int numberOfAttempts = 0; while (retry) { try { numberOfAttempts++; maybeGetKafkaProducer(task).ifPresent(p -> doSend(p, producerRecord, onComplete)); retry = false; } catch (TimeoutException ex) { _log.warn("Kafka producer buffer is full, retry in ms.", _sendFailureRetryWaitTimeMs, ex); Thread.sleep(_sendFailureRetryWaitTimeMs); } catch (IllegalStateException ex) { _log.warn("Either send is called on a closed producer or broker count is less than minISR, retry in ms.", _sendFailureRetryWaitTimeMs, ex); } catch (KafkaException ex) { Throwable rootCause = ExceptionUtils.getRootCause(ex); if (numberOfAttempts > MAX_SEND_ATTEMPTS || (rootCause instanceof Error || rootCause instanceof RuntimeException)) { _log.error("Send failed for partition with a non retriable exception", producerRecord.partition(), ex); throw generateSendFailure(ex); } else { _log.warn("Send failed for partition with retriable exception, retry out of in ms.", producerRecord.partition(), numberOfAttempts, MAX_SEND_ATTEMPTS, _sendFailureRetryWaitTimeMs, ex); Thread.sleep(_sendFailureRetryWaitTimeMs); } } catch (Exception ex) { _log.error("Send failed for partition with an exception", producerRecord.partition(), ex); throw generateSendFailure(ex); } } }

Target:
void send(DatastreamTask task, ProducerRecord<K, V> producerRecord, Callback onComplete) throws InterruptedException { boolean retry = true; int numberOfAttempts = 0; while (retry) { try { ++numberOfAttempts; maybeGetKafkaProducer(task).ifPresent(p -> doSend(p, producerRecord, onComplete)); retry = false; } catch (IllegalStateException e) { _log.warn("Either send is called on a closed producer or broker count is less than minISR, retry in ms.", _sendFailureRetryWaitTimeMs, e); Thread.sleep(_sendFailureRetryWaitTimeMs); } catch (TimeoutException e) { _log.warn("Kafka producer buffer is full, retry in ms.", _sendFailureRetryWaitTimeMs, e); Thread.sleep(_sendFailureRetryWaitTimeMs); } catch (KafkaException e) { Throwable cause = e.getCause(); while (cause instanceof KafkaException) { cause = cause.getCause(); } if (numberOfAttempts > MAX_SEND_ATTEMPTS || ((cause instanceof Error || cause instanceof RuntimeException))) { _log.error("Send failed for partition with a non retriable exception", producerRecord.partition(), e); throw generateSendFailure(e); } else { _log.warn("Send failed for partition with retriable exception, retry out of in ms.", producerRecord.partition(), numberOfAttempts, MAX_SEND_ATTEMPTS, _sendFailureRetryWaitTimeMs, e); Thread.sleep(_sendFailureRetryWaitTimeMs); } } catch (Exception e) { _log.error("Send failed for partition with an exception", producerRecord.partition(), e); throw generateSendFailure(e); } } }
Source:
protected void scale(final int width, final int height, final int toWidth, final int toHeight, final boolean keepAspectRatio) { if (null != getHandler() && null != getHandler().getDiagram()) { final double[] sfactor = LienzoUtils.getScaleFactor(width, height, toWidth, toHeight); if (1 != sfactor[0] || 1 != sfactor[1]) { final double[] factor = getScaleFactor(sfactor, keepAspectRatio); getZoomControl().scale(factor[0], factor[1]); scalePanel(toWidth, toHeight); } } else { LOGGER.log(Level.WARNING, "Nothing to scale!"); } }

Target:
protected void scale(final int width, final int height, final int toWidth, final int toHeight, final boolean keepAspectRatio) { if (null != getHandler() && null != getHandler().getDiagram()) { final double[] sfactor = LienzoUtils.getScaleFactor(width, height, toWidth, toHeight); if (0 != Double.compare(1,sfactor[0]) || 0 != Double.compare(1, sfactor[1])) { final double[] factor = getScaleFactor(sfactor, keepAspectRatio); getZoomControl().scale(factor[0], factor[1]); scalePanel(toWidth, toHeight); } } else { LOGGER.log(Level.WARNING, "Nothing to scale!"); } }
Source:
public Date getTimeOfEntry() { return this.timeOfEntry; }

Target:
public DateTime getTimeOfEntry() { return this.timeOfEntry; }
Source:
public StatsDEmitter(StatsDEmitterConfig config, ObjectMapper mapper) { this.config = config; this.converter = new DimensionConverter(mapper, config.getDimensionMapPath()); statsd = new NonBlockingStatsDClient( config.getPrefix(), config.getHostname(), config.getPort(), new StatsDClientErrorHandler() { @Override public void handle(Exception exception) { log.error(exception, "Error sending metric to StatsD."); } } ); }

Target:
public StatsDEmitter(StatsDEmitterConfig config, ObjectMapper mapper) { this.config = config; this.converter = new DimensionConverter(mapper, config.getDimensionMapPath()); statsd = new NonBlockingStatsDClient( config.getPrefix(), config.getHostname(), config.getPort(), new StatsDClientErrorHandler() { private int exceptionCount = 0; @Override public void handle(Exception exception) { if (exceptionCount % 1000 == 0) { log.error(exception, "Error sending metric to StatsD."); } exceptionCount += 1; } } ); }
Source:
public static Map<String, String> decodeSmallHeaders(ByteBuf buffer) { short numHeaders = buffer.readUnsignedByte(); Map<String, String> headers = new HashMap<>(numHeaders); for (int i = 0; i < numHeaders; i++) { String key = CodecUtils.decodeSmallString(buffer); String value = CodecUtils.decodeSmallString(buffer); headers.put(key, value); } return headers; }

Target:
public static Map<String, String> decodeSmallHeaders(ByteBuf buffer) { short numHeaders = buffer.readUnsignedByte(); Map<String, String> headers = Maps.newHashMapWithExpectedSize(numHeaders); for (int i = 0; i < numHeaders; i++) { String key = CodecUtils.decodeSmallString(buffer); String value = CodecUtils.decodeSmallString(buffer); headers.put(key, value); } return headers; }
Source:
public void initializeBlockEncodingBuffers(DecodedBlockNode[] decodedBlocks) { if (blockEncodingBuffers == null) { int channelCount = decodedBlocks.length; int initialElementCount = channelCount == 0 ? 0 : min(capacity / channelCount / DEFAULT_ELEMENT_SIZE_IN_BYTES, INITIAL_POSITION_COUNT); blockEncodingBuffers = new BlockEncodingBuffers[channelCount]; for (int i = 0; i < channelCount; i++) { blockEncodingBuffers[i] = createBlockEncodingBuffers(decodedBlocks[i], initialElementCount); } } }

Target:
private void initializeBlockEncodingBuffers(DecodedBlockNode[] decodedBlocks) { if (blockEncodingBuffers == null) { int initialElementCount = min(capacity / channelCount / DEFAULT_ELEMENT_SIZE_IN_BYTES, INITIAL_POSITION_COUNT); blockEncodingBuffers = new BlockEncodingBuffers[channelCount]; for (int i = 0; i < channelCount; i++) { blockEncodingBuffers[i] = createBlockEncodingBuffers(decodedBlocks[i], initialElementCount); } } }
Source:
public void testShutdownRemove() throws Throwable { assertNotNull("No ShutdownHookManager", mgr); assertEquals(0, mgr.getShutdownHooksInOrder().size()); Hook hook1 = new Hook("hook1", 0, false); Hook hook2 = new Hook("hook2", 0, false); mgr.addShutdownHook(hook1, 9); assertTrue(mgr.hasShutdownHook(hook1)); assertEquals(1, mgr.getShutdownHooksInOrder().size()); assertFalse(mgr.removeShutdownHook(hook2)); assertTrue(mgr.removeShutdownHook(hook1)); assertEquals(0, mgr.getShutdownHooksInOrder().size()); }

Target:
public void testShutdownRemove() throws Throwable { assertNotNull("No ShutdownHookManager", mgr); assertEquals(0, mgr.getShutdownHooksInOrder().size()); Hook hook1 = new Hook("hook1", 0, false); Hook hook2 = new Hook("hook2", 0, false); mgr.addShutdownHook(hook1, 9); assertTrue("No hook1", mgr.hasShutdownHook(hook1)); assertEquals(1, mgr.getShutdownHooksInOrder().size()); assertFalse("Delete hook2 should not be allowed", mgr.removeShutdownHook(hook2)); assertTrue("Can't delete hook1", mgr.removeShutdownHook(hook1)); assertEquals(0, mgr.getShutdownHooksInOrder().size()); }
Source:
private boolean TestOperationImplemented(OperationEnum operation, BaseDelegatingResource resource) { Method method = null; switch (operation) { case get: method = ReflectionUtils.findMethod(resource.getClass(), Operation.OPERATION_GET_ALL_METHOD, RequestContext.class); return method != null && !method.getDeclaringClass().getName().endsWith("DelegatingCrudResource"); } return true; }

Target:
private boolean TestOperationImplemented(OperationEnum operation, BaseDelegatingResource resource) { try { switch (operation) { case get: case getSubresource: ((Listable) resource).getAll(BuildDummyRequestContextForOperationTest(operation)); break; case getWithUUID: case getSubresourceWithUUID: resource.getByUniqueId(IMPOSSIBLE_UNIQUE_ID); case postCreate: case postSubresource: resource.save(null); } return true; } catch (ResourceDoesNotSupportOperationException e) { return false; } catch (Exception e) { return true; } }
Source:
protected Builder() { id("profitbricks-rest") .name("DigitalOcean Compute Services") .apiMetadata(new ProfitBricksApiMetadata()) .homepage(URI.create("<LINK_2>")) .console(URI.create("<LINK_0>")) .endpoint("<LINK_1>") .defaultProperties(ProfitBricksProviderMetadata.defaultProperties()); }

Target:
protected Builder() { id("profitbricks-rest") .name("ProfitBricks REST Compute") .apiMetadata(new ProfitBricksApiMetadata()) .homepage(URI.create("<LINK_2>")) .console(URI.create("<LINK_0>")) .iso3166Codes("DE-FKB", "DE-FRA", "US-LAS", "US-LASDEV") .endpoint("<LINK_1>") .defaultProperties(ProfitBricksProviderMetadata.defaultProperties()); }
Source:
public static boolean playerRemoveBlock(World world, BlockPos pos, @Nullable EntityPlayer player, boolean dropBlock) { if (player == null) player = RailcraftFakePlayer.get((WorldServer) world, pos); IBlockState state = getBlockState(world, pos); if (MinecraftForge.EVENT_BUS.post(new BlockEvent.BreakEvent(world, pos, state, player))) return false; if (!state.getBlock().removedByPlayer(state, world, pos, player, dropBlock)) return false; if (dropBlock) { state.getBlock().harvestBlock(world, player, pos, state, getBlockTile(world, pos), player.getHeldItem(player.getActiveHand())); } return true; }

Target:
public static boolean playerRemoveBlock(World world, BlockPos pos, @Nullable EntityPlayer player, boolean dropBlock) { if (player == null) player = RailcraftFakePlayer.get((WorldServer) world, pos); IBlockState state = getBlockState(world, pos); TileEntity te = getBlockTile(world, pos); if (MinecraftForge.EVENT_BUS.post(new BlockEvent.BreakEvent(world, pos, state, player))) return false; if (!state.getBlock().removedByPlayer(state, world, pos, player, dropBlock)) return false; if (dropBlock) { state.getBlock().harvestBlock(world, player, pos, state, te, player.getHeldItem(player.getActiveHand())); } return true; }
Source:
public boolean test( Object value ) { assert false : "StringContainsPredicate.test() has not been tested yet... Add tests and remove assert"; return value != null && value instanceof String && ((String)value).contains( contains ); }

Target:
public boolean test( Object value ) { return value != null && value instanceof String && ((String)value).contains( contains ); }
Source:
public void skipBytes(final int count) { try { for (int s = count; s > 0;) { final int skipped = (int)in.skip(s); if (skipped <= 0) throw new RuntimeIOException("Failed to skip " + s); s -= skipped; } } catch (final IOException e) { throw new RuntimeIOException(e); } }

Target:
public void skipBytes(final int count) { try { for (int s = count; s > 0;) { final int skipped = (int)in.skip(s); if (skipped <= 0) { throw new RuntimeIOException("Failed to skip " + s); } s -= skipped; } } catch (final IOException e) { throw new RuntimeIOException(e); } }
Source:
public Status update(String table, String endpoint, HashMap<String, ByteIterator> values) { int responseCode; try { responseCode = httpExecute(new HttpPut(urlPrefix + endpoint), values.get("data").toString()); } catch (Exception e) { responseCode = handleExceptions(e); } if (logEnabled) { System.out.println(new StringBuilder("PUT Request: ").append(urlPrefix).append(endpoint) .append(" | Response Code: ").append(responseCode).toString()); } return getStatus(responseCode); }

Target:
public Status update(String table, String endpoint, HashMap<String, ByteIterator> values) { int responseCode; try { responseCode = httpExecute(new HttpPut(urlPrefix + endpoint), values.get("data").toString()); } catch (Exception e) { responseCode = handleExceptions(e, urlPrefix + endpoint, HttpMethod.PUT); } if (logEnabled) { System.err.println(new StringBuilder("PUT Request: ").append(urlPrefix).append(endpoint) .append(" | Response Code: ").append(responseCode).toString()); } return getStatus(responseCode); }
Source:
public static Set<SecureStoreData> findSecureStores(File pluginFile, String pluginName) throws InvalidPluginException, IOException, ClassNotFoundException { ImmutableSet.Builder<SecureStoreData> result = new ImmutableSet.Builder<SecureStoreData>(); Iterable<ExtensionMetaData> exports = JarScanner.scan(pluginFile, pluginName, Export.class); for (ExtensionMetaData export : exports) { String className = export.getClassName(); Class<?> clazz = Class.forName(className); if (is("com.google.gerrit.server.securestore.SecureStore", clazz)) { String storeName = export.getAnnotationValue(); SecureStoreData metadata = new SecureStoreData(pluginName, className, pluginFile, storeName); result.add(metadata); } } return result.build(); }

Target:
public static Set<SecureStoreData> findSecureStores(File pluginFile, String pluginName) throws InvalidPluginException, IOException, ClassNotFoundException { ImmutableSet.Builder<SecureStoreData> result = new ImmutableSet.Builder<SecureStoreData>(); Iterable<ExtensionMetaData> exports = JarScanner.scan(pluginFile, pluginName, Export.class); for (ExtensionMetaData export : exports) { String className = export.getClassName(); Optional<String> implementsSecureStore = tryFind(export.getInterfaces(), equalTo(SECURE_STORE_INTERFACE)); if (implementsSecureStore.isPresent()) { String storeName = export.getAnnotationValue(); SecureStoreData metadata = new SecureStoreData(pluginName, className, pluginFile, storeName); result.add(metadata); } } return result.build(); }
Source:
private IASTAttributeList getFallthroughAttributeList(ICPPNodeFactory factory) { IASTAttribute attribute = factory.newAttribute("fallthrough".toCharArray(), null); IASTAttributeList attributeList = factory.newAttributeList(); attributeList.addAttribute(attribute); return attributeList; }

Target:
private IASTAttributeList getFallthroughAttributeList(ICPPNodeFactory factory) { IASTAttribute attribute = factory.newAttribute(StandardAttributes.cFALLTHROUGH, null); IASTAttributeList attributeList = factory.newAttributeList(); attributeList.addAttribute(attribute); return attributeList; }
Source:
public void testEng19702() throws IOException, ProcCallException { if (isHSQL()) { return; } final Client client = getClient(); client.callProcedure("@AdHoc", "INSERT INTO Eng19702_Balance VALUES ('asi', 'abi', '2020-06-09')"); client.callProcedure("@AdHoc", "INSERT INTO Eng19702_BalanceValue VALUES ('asi', 'abi', 1000.0, '2020-05-01')"); assertContentOfTable(new Object[][]{{1000.00}}, client.callProcedure("@AdHoc", "SELECT Checksum from (\n" + " SELECT B.SubscriberId, B.BalanceId,\n" + " B.ExpiryDate,\n" + " SUM(BV.BalanceValue) AS BalanceValue,\n" + " MIN(LastUpdated) AS MinLastUpdated,\n" + " COALESCE(MAX(DECODE(B.BalanceId, 'abi', LastUpdated, NULL)), MAX(LastUpdated)) AS LastUpdated,\n" + " MAX(DECODE(B.BalanceId, 'abi', BV.BalanceValue, 0)) AS Checksum\n" + " FROM Eng19702_Balance B JOIN Eng19702_BalanceValue BV\n" + " ON B.SubscriberId = BV.SubscriberId AND B.SubscriberId = 'asi' AND B.BalanceId = BV.BalanceId\n" + " GROUP BY B.SubscriberId, B.BalanceId) subquery") .getResults()[0]); }

Target:
public void testEng19702() throws IOException, ProcCallException { if (isHSQL()) { return; } final Client client = getClient(); client.callProcedure("@AdHoc", "INSERT INTO Eng19702_Balance VALUES ('asi', 'abi', '2020-06-09')"); client.callProcedure("@AdHoc", "INSERT INTO Eng19702_BalanceValue VALUES ('asi', 'abi', 1000.0, '2020-05-01')"); assertContentOfTable(new Object[][]{{new BigDecimal("1000.0")}}, client.callProcedure("@AdHoc", "SELECT Checksum from (\n" + " SELECT B.SubscriberId, B.BalanceId,\n" + " B.ExpiryDate,\n" + " SUM(BV.BalanceValue) AS BalanceValue,\n" + " MIN(LastUpdated) AS MinLastUpdated,\n" + " COALESCE(MAX(DECODE(B.BalanceId, 'abi', LastUpdated, NULL)), MAX(LastUpdated)) AS LastUpdated,\n" + " MAX(DECODE(B.BalanceId, 'abi', BV.BalanceValue, 0)) AS Checksum\n" + " FROM Eng19702_Balance B JOIN Eng19702_BalanceValue BV\n" + " ON B.SubscriberId = BV.SubscriberId AND B.SubscriberId = 'asi' AND B.BalanceId = BV.BalanceId\n" + " GROUP BY B.SubscriberId, B.BalanceId) subquery") .getResults()[0]); }
Source:
private void saveSelectedPagesForOffline(@NonNull List<ReadingListPage> selectedPages, boolean forcedSave) { if (!selectedPages.isEmpty()) { for (ReadingListPage page : selectedPages) { updatePageItemUI(page); } ReadingListDbHelper.instance().markPagesForOffline(selectedPages, true, forcedSave); showMultiSelectOfflineStateChangeSnackbar(selectedPages, true); adapter.notifyDataSetChanged(); update(); } }

Target:
private void saveSelectedPagesForOffline(@NonNull List<ReadingListPage> selectedPages, boolean forcedSave) { if (!selectedPages.isEmpty()) { for (ReadingListPage page : selectedPages) { updatePageProgress(page); } ReadingListDbHelper.instance().markPagesForOffline(selectedPages, true, forcedSave); showMultiSelectOfflineStateChangeSnackbar(selectedPages, true); adapter.notifyDataSetChanged(); update(); } }
Source:
private void checkLogData(long address, ILogData logData) { if (logData == null || logData.getType() == DataType.EMPTY) { throw new RuntimeException("Unexpected return of empty data at address " + address + " on read"); } else if (logData.isTrimmed()) { throw new TrimmedException(); } }

Target:
private void checkLogData(long address, ILogData logData) { if (logData == null || logData.getType() == DataType.EMPTY) { throw new RuntimeException("Unexpected return of empty data at address " + address + " on read"); } if (logData.isTrimmed()) { throw new TrimmedException(); } }
Source:
public void introspect() throws IOException { HttpMessage importMessage = requestor.sendQuery( IntrospectionQuery.INTROSPECTION_QUERY, GraphQlParam.RequestMethodOption.POST_JSON); if (importMessage != null) { try { Map<String, Object> result = new Gson() .fromJson( importMessage.getResponseBody().toString(), new TypeToken<Map<String, Object>>() {}.getType()); @SuppressWarnings("unchecked") Document schema = new IntrospectionResultToSchema() .createSchemaDefinition((Map<String, Object>) result.get("data")); String schemaSdl = new SchemaPrinter().print(schema); parse(schemaSdl); } catch (JsonSyntaxException e) { throw new IOException("The response was not valid JSON."); } } }

Target:
public void introspect() throws IOException { HttpMessage importMessage = requestor.sendQuery( IntrospectionQuery.INTROSPECTION_QUERY, GraphQlParam.RequestMethodOption.POST_JSON); if (importMessage == null) { throw new IOException("Could not obtain schema via Introspection."); } try { Map<String, Object> result = new Gson() .fromJson( importMessage.getResponseBody().toString(), new TypeToken<Map<String, Object>>() {}.getType()); @SuppressWarnings("unchecked") Document schema = new IntrospectionResultToSchema() .createSchemaDefinition((Map<String, Object>) result.get("data")); String schemaSdl = new SchemaPrinter().print(schema); parse(schemaSdl); } catch (JsonSyntaxException e) { throw new IOException("The response was not valid JSON."); } }
Source:
public static boolean stateBackendFromApplicationOrConfigOrDefaultUseManagedMemory( Configuration config, Optional<Boolean> stateBackendFromApplicationUsesManagedMemory, ClassLoader classLoader) { checkNotNull(config, "config"); if (stateBackendFromApplicationUsesManagedMemory.isPresent()) { return stateBackendFromApplicationUsesManagedMemory.get(); } try { final StateBackend fromConfig = loadStateBackendFromConfig(config, classLoader, null); if (fromConfig != null) { return fromConfig.useManagedMemory(); } } catch (IllegalConfigurationException | DynamicCodeLoadingException | IOException e) { LOG.warn("Cannot decide whether state backend uses managed memory. Will reserve managed memory by default.", e); return true; } return false; }

Target:
public static boolean stateBackendFromApplicationOrConfigOrDefaultUseManagedMemory( Configuration config, Optional<Boolean> stateBackendFromApplicationUsesManagedMemory, ClassLoader classLoader) { checkNotNull(config, "config"); if (stateBackendFromApplicationUsesManagedMemory.isPresent()) { return stateBackendFromApplicationUsesManagedMemory.get(); } try { final StateBackend fromConfig = loadStateBackendFromConfig(config, classLoader, LOG); if (fromConfig != null) { return fromConfig.useManagedMemory(); } } catch (IllegalConfigurationException | DynamicCodeLoadingException | IOException e) { LOG.warn("Cannot decide whether state backend uses managed memory. Will reserve managed memory by default.", e); return true; } return false; }
Source:
private void startGame() { Tile tile0 = Tile.newRandomTile(); List<Location> locCopy = locations.stream().collect(Collectors.toList()); Collections.shuffle(locCopy); tile0.setLocation(locCopy.get(0)); gameGrid.put(tile0.getLocation(), tile0); Tile tile1 = Tile.newRandomTile(); tile1.setLocation(locCopy.get(1)); gameGrid.put(tile1.getLocation(), tile1); redrawTilesInGameGrid(); }

Target:
private void startGame() { Tile tileNew = Tile.newRandomTile(); List<Location> locCopy = locations.stream().collect(Collectors.toList()); Collections.shuffle(locCopy); tileNew.setLocation(locCopy.get(0)); gameGrid.put(tileNew.getLocation(), tileNew); Tile tile1 = Tile.newRandomTile(); tile1.setLocation(locCopy.get(1)); gameGrid.put(tile1.getLocation(), tile1); redrawTilesInGameGrid(); }
Source:
private void renderFinalStereoImage(RenderingStage renderingStage) { switch (renderingStage) { case LEFT_EYE: if (postProcessor.isNotTakingScreenshot()) { sceneFinal.bind(); } else { ocUndistorted.bind(); } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(0, 0, fullScale.width() / 2, fullScale.height()); break; case RIGHT_EYE: renderFullscreenQuad(fullScale.width() / 2 + 1, 0, fullScale.width() / 2, fullScale.height()); if (postProcessor.isNotTakingScreenshot()) { bindDisplay(); applyOculusDistortion(sceneFinal); } else { sceneFinal.bind(); applyOculusDistortion(ocUndistorted); postProcessor.saveScreenshot(); } break; case MONO: break; } }

Target:
private void renderFinalStereoImage(RenderingStage renderingStage) { if (postProcessor.isNotTakingScreenshot()) { sceneFinal.bind(); } else { ocUndistorted.bind(); } switch (renderingStage) { case LEFT_EYE: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(0, 0, fullScale.width() / 2, fullScale.height()); break; case RIGHT_EYE: renderFullscreenQuad(fullScale.width() / 2 + 1, 0, fullScale.width() / 2, fullScale.height()); if (postProcessor.isNotTakingScreenshot()) { bindDisplay(); applyOculusDistortion(sceneFinal); } else { sceneFinal.bind(); applyOculusDistortion(ocUndistorted); postProcessor.saveScreenshot(); } break; case MONO: break; } }
Source:
private Collection<List<MatchedAffiliation>> groupByOrganizationId(Iterable<MatchedAffiliation> matchedAffs) { Map<CharSequence, List<MatchedAffiliation>> matchedGroupedByOrgId = Maps.newHashMap(); for (MatchedAffiliation matched : matchedAffs) { if (!matchedGroupedByOrgId.containsKey(matched.getOrganizationId())) { matchedGroupedByOrgId.put(matched.getOrganizationId(), Lists.newArrayList(matched)); } else { matchedGroupedByOrgId.get(matched.getOrganizationId()).add(matched); } } return matchedGroupedByOrgId.values(); }

Target:
private Collection<List<MatchedAffiliation>> groupByOrganizationId(Iterable<MatchedAffiliation> matchedAffs) { Map<CharSequence, List<MatchedAffiliation>> matchedGroupedByOrgId = Maps.newHashMap(); for (MatchedAffiliation matched : matchedAffs) { if (matchedGroupedByOrgId.containsKey(matched.getOrganizationId())) { matchedGroupedByOrgId.get(matched.getOrganizationId()).add(matched); } else { matchedGroupedByOrgId.put(matched.getOrganizationId(), Lists.newArrayList(matched)); } } return matchedGroupedByOrgId.values(); }
Source:
public void findConceptsByName_shouldGetCorrectConceptByName() { mDatabase.conceptRoomDAO().saveConcept(expectedConceptEntity1); mDatabase.conceptRoomDAO().saveConcept(expectedConceptEntity2); mDatabase.conceptRoomDAO().findConceptsByName(expectedConceptEntity1.getName()).subscribe(new SingleObserver<List<ConceptEntity>>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(List<ConceptEntity> conceptEntities) { Assert.assertEquals(conceptEntities.get(0), expectedConceptEntity1); Assert.assertEquals(conceptEntities.get(1), expectedConceptEntity2); } @Override public void onError(Throwable e) { Log.i(TAG, e.getMessage()); } }); }

Target:
public void findConceptsByName_shouldGetCorrectConceptByName() { mDatabase.conceptRoomDAO().saveConcept(expectedConceptEntity1); mDatabase.conceptRoomDAO().saveConcept(expectedConceptEntity2); mDatabase.conceptRoomDAO().findConceptsByName(expectedConceptEntity1.getName()) .test() .assertValue(conceptEntities -> { ConceptEntity actualEntity = conceptEntities.get(0); return Objects.equals(actualEntity.getUuid(), expectedConceptEntity1.getUuid()) && Objects.equals(actualEntity.getName(), expectedConceptEntity1.getName()) && Objects.equals(actualEntity.getDisplay(), expectedConceptEntity1.getDisplay()); }); }
Source:
public void onScrollChanged(int oldScrollY, int scrollY, boolean isHumanScroll) { if (webview == null) { return; } if (scrollY <= webview.getHeight()) { ViewAnimations.ensureTranslationY(pageActions, 0); return; } int animMargin; if (oldScrollY > scrollY) { int minMargin = 0; int scrollDelta = oldScrollY - scrollY; int newMargin = (int) pageActions.getTranslationY() - scrollDelta; animMargin = Math.max(minMargin, newMargin); } else { int scrollDelta = scrollY - oldScrollY; int minMargin = pageActions.getHeight(); int newMargin = (int) pageActions.getTranslationY() + scrollDelta; animMargin = Math.min(minMargin, newMargin); } pageActions.setTranslationY(animMargin); }

Target:
public void onScrollChanged(int oldScrollY, int scrollY, boolean isHumanScroll) { if (webView == null) { return; } if (scrollY <= webView.getHeight()) { ViewAnimations.ensureTranslationY(pageActions, 0); return; } int animMargin; int scrollDelta = scrollY - oldScrollY; int newMargin = (int) pageActions.getTranslationY() + scrollDelta; if (oldScrollY < scrollY) { int minMargin = pageActions.getHeight(); animMargin = Math.min(minMargin, newMargin); } else { int minMargin = 0; animMargin = Math.max(minMargin, newMargin); } pageActions.setTranslationY(animMargin); }
Source:
public String toString() { if (getName() == null) { return getPersonId(); } else { if (getPersonId() == null) { return ""; } else { if (getName().equals(getPersonId())) { return getName(); } else { return getName() + " <" + getPersonId() + ">"; } } } }

Target:
public String toString() { if (getName() == null) { return getPersonId(); } else { if (getPersonId() == null) { return getName(); } else { if (getName().equals(getPersonId())) { return getName(); } else { return getName() + " <" + getPersonId() + ">"; } } } }