auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String getBranch(final String jobName, final StaplerRequest req) { final String json = req.getParameter("json"); final JSONObject formData = JSONObject.fromObject(json); final TeamBuildPayload payload = EndpointHelper.MAPPER.convertValue(formData, TeamBuildPayload.class); String sourceBranch = payload.BuildVariables.get(QUEUEJOBTASK_MULTIBRANCH_JOB_BRANCH); if (sourceBranch == null || sourceBranch.trim().isEmpty()) { if (jobName.indexOf('/') > 0) { sourceBranch = jobName.substring(jobName.indexOf('/') + 1); } else { sourceBranch = payload.BuildVariables.get(BUILD_SOURCE_BRANCH); } } if (sourceBranch == null || sourceBranch.trim().isEmpty()) { throw new IllegalArgumentException("Could not find branch from job name. If building a multibranch" + "pipeline job, the job name should be in the format of '${multibranch pipeline name}/${branch}.'"); } try { return URLEncoder.encode(sourceBranch.replace("refs/heads/", ""), "UTF-8"); } catch (final UnsupportedEncodingException e) { throw new RuntimeException("Failed to encode branch: " + sourceBranch, e); } }

Target:
private String getBranch(final String jobName, final StaplerRequest req) { final String json = req.getParameter("json"); final JSONObject formData = JSONObject.fromObject(json); final TeamBuildPayload payload = EndpointHelper.MAPPER.convertValue(formData, TeamBuildPayload.class); String sourceBranch = payload.BuildVariables.get(QUEUEJOBTASK_MULTIBRANCH_JOB_BRANCH); if (sourceBranch == null || sourceBranch.trim().isEmpty()) { final int idx = jobName.indexOf('/'); if (idx > 0) { sourceBranch = jobName.substring(idx + 1); } else { sourceBranch = payload.BuildVariables.get(BUILD_SOURCE_BRANCH); } } if (sourceBranch == null || sourceBranch.trim().isEmpty()) { throw new IllegalArgumentException("Could not find branch from job name. If building a multibranch" + "pipeline job, the job name should be in the format of '${multibranch pipeline name}/${branch}.'"); } try { return URLEncoder.encode(sourceBranch.replace("refs/heads/", ""), "UTF-8"); } catch (final UnsupportedEncodingException e) { throw new RuntimeException("Failed to encode branch: " + sourceBranch, e); } }
Source:
public void queueListeningTestCase() { try { jmsQueueTransportListener.start(queueListeningParameters); logger.info("JMS Transport Listener is starting to listen to the queue " + JMSTestConstants.QUEUE_NAME); jmsServer.publishMessagesToQueue(JMSTestConstants.QUEUE_NAME); Assert.assertEquals(queueTestMessageProcessor.getCount(), 10, "Expected message count is not received when " + "listening to queue " + JMSTestConstants.QUEUE_NAME); jmsQueueTransportListener.stop(); } catch (Exception e) { Assert.fail("Error while listening to queue"); } }

Target:
public void queueListeningTestCase() throws ServerConnectorException, InterruptedException, JMSException { jmsQueueTransportListener.start(queueListeningParameters); logger.info("JMS Transport Listener is starting to listen to the queue " + JMSTestConstants.QUEUE_NAME); jmsServer.publishMessagesToQueue(JMSTestConstants.QUEUE_NAME); Assert.assertEquals(queueTestMessageProcessor.getCount(), 10, "Expected message count is not received when " + "listening to queue " + JMSTestConstants.QUEUE_NAME); jmsQueueTransportListener.stop(); }
Source:
public <TM> MessageStream<TM> flatMap(FlatMapFunction<? super M, ? extends TM> flatMapFn) { StreamOperatorSpec<M, TM> op = OperatorSpecs.createFlatMapOperatorSpec(flatMapFn, this.graph.getNextOpId(OpCode.FLAT_MAP)); this.operatorSpec.registerNextOperatorSpec(op); return new MessageStreamImpl<>(this.graph, op); }

Target:
public <TM> MessageStream<TM> flatMap(FlatMapFunction<? super M, ? extends TM> flatMapFn) { String opId = this.graph.getNextOpId(OpCode.FLAT_MAP); StreamOperatorSpec<M, TM> op = OperatorSpecs.createFlatMapOperatorSpec(flatMapFn, opId); this.operatorSpec.registerNextOperatorSpec(op); return new MessageStreamImpl<>(this.graph, op); }
Source:
public @Nullable Integer getThreadOnCpuAtTime(int cpu, long time) { TidAnalysisModule module = fModule.get(); if (module == null) { return null; } int count = 0; while (!module.isQueryable(time) && count < 5) { try { Thread.sleep(100); count++; } catch (InterruptedException e) { break; } } return module.getThreadOnCpuAtTime(cpu, time); }

Target:
public @Nullable Integer getThreadOnCpuAtTime(int cpu, long time) { TidAnalysisModule module = fModule.get(); if (module == null) { return null; } int wait = 0; while (!module.isQueryable(time) && wait < WAIT_TIMEOUT) { try { Thread.sleep(100); wait += 100; } catch (InterruptedException e) { break; } } return module.getThreadOnCpuAtTime(cpu, time); }
Source:
public void exec(final MainRemote.Script script) throws Exception { final File file = File.createTempFile("takes-", ".txt"); file.delete(); final Method method = this.app.getDeclaredMethod( "main", String[].class ); final String[] passed = new String[1 + this.args.length]; passed[0] = String.format("--port=%s", file.getAbsoluteFile()); for (int idx = 0; idx < this.args.length; ++idx) { passed[idx + 1] = this.args[idx]; } final Thread thread = new Thread( new MainRemoteRunnable(method, passed) ); thread.start(); try { script.exec( URI.create( String.format( "http://localhost:%d", MainRemote.port(file) ) ) ); } finally { if (!file.delete()) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, "Can not delete file" ); } thread.interrupt(); } }

Target:
public void exec(final MainRemote.Script script) throws Exception { final File file = File.createTempFile("takes-", ".txt"); file.delete(); final Method method = this.app.getDeclaredMethod( "main", String[].class ); final String[] passed = new String[1 + this.args.length]; passed[0] = String.format("--port=%s", file.getAbsoluteFile()); for (int idx = 0; idx < this.args.length; ++idx) { passed[idx + 1] = this.args[idx]; } final Thread thread = new Thread( new Runnable() { @Override public void run() { try { method.invoke(null, (Object) passed); } catch (final InvocationTargetException ex) { throw new IllegalStateException(ex); } catch (final IllegalAccessException ex) { throw new IllegalStateException(ex); } } } ); thread.start(); try { script.exec( URI.create( String.format( "http://localhost:%d", MainRemote.port(file) ) ) ); } finally { file.delete(); thread.interrupt(); } }
Source:
public void rollback(Xid xid) throws XAException { if (LOG.isTraceEnabled()) { LOG.trace("DummyXAResource.rollback(xid=" + xid + ")"); } }

Target:
public void rollback(Xid xid) throws XAException { LOG.info("DummyXAResource.rollback(xid=" + xid + ")"); }
Source:
public DeviceInactivePage getInactiveSenses(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("after") final Long afterTimestamp, @QueryParam("before") final Long beforeTimestamp, @QueryParam("limit") final Integer limit) { InactiveDevicesPaginator redisPaginator; if (limit == null) { redisPaginator = new InactiveDevicesPaginator(jedisPool, afterTimestamp, beforeTimestamp, ActiveDevicesTrackerConfiguration.SENSE_ACTIVE_SET_KEY); } else { redisPaginator = new InactiveDevicesPaginator(jedisPool, afterTimestamp, beforeTimestamp, ActiveDevicesTrackerConfiguration.SENSE_ACTIVE_SET_KEY, limit); } return redisPaginator.generatePage(); }

Target:
public DeviceInactivePage getInactiveSenses(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("after") final Long afterTimestamp, @QueryParam("before") final Long beforeTimestamp, @QueryParam("limit") final Integer limit) { return new InactiveDevicesPaginator(jedisPool, afterTimestamp, beforeTimestamp, ActiveDevicesTrackerConfiguration.SENSE_ACTIVE_SET_KEY, limit) .generatePage(); }
Source:
public StoredConfig getSystemConfig() { if (systemConfig.isOutdated()) { try { LOG.debug("loading system config {}", systemConfig); systemConfig.load(); } catch (IOException e) { throw new RuntimeException(e); } catch (ConfigInvalidException e) { throw new RuntimeException( MessageFormat.format( JGitText.get().systemConfigFileInvalid, systemConfig.getFile().getAbsolutePath(), e), e); } } return systemConfig; }

Target:
public StoredConfig getSystemConfig() throws IOException, ConfigInvalidException { if (systemConfig.isOutdated()) { try { LOG.debug("loading system config {}", systemConfig); systemConfig.load(); } catch (ConfigInvalidException e) { LOG.error(MessageFormat.format( JGitText.get().systemConfigFileInvalid, systemConfig.getFile().getAbsolutePath()), e); throw e; } } return systemConfig; }
Source:
private String getColumnString(boolean uppercase, ImmutableList.Builder<String> columnNames, ImmutableList.Builder<Type> columnTypes, ColumnMetadata column) { String columnName = column.getName(); if (uppercase) { columnName = columnName.toUpperCase(ENGLISH); } columnNames.add(columnName); columnTypes.add(column.getType()); StringBuilder sb = new StringBuilder() .append(quoted(columnName)) .append(" ") .append(toSqlType(column.getType())); if (!column.isNullable()) { sb.append(" ").append("NOT NULL"); } if (column.getDefaultValue() != null) { sb.append(" DEFAULT ").append(objectToValue(column.getType(), column.getDefaultValue())); } return sb.toString(); }

Target:
private String getColumnString(boolean uppercase, ImmutableList.Builder<String> columnNames, ImmutableList.Builder<Type> columnTypes, ColumnMetadata column) { String columnName = column.getName(); if (uppercase) { columnName = columnName.toUpperCase(ENGLISH); } columnNames.add(columnName); columnTypes.add(column.getType()); StringBuilder sb = new StringBuilder() .append(quoted(columnName)) .append(" ") .append(toSqlType(column.getType())); if (!column.isNullable()) { sb.append(" NOT NULL"); } if (column.getDefaultValue() != null) { sb.append(" DEFAULT ").append(toLiteral(column.getType(), column.getDefaultValue())); } return sb.toString(); }
Source:
protected void onInitUI() { super.onInitUI(); setPageTitle(Util.C.groupListTitle()); groups = new GroupTable(true , PageLinks.ADMIN_GROUPS); add(groups); final VerticalPanel fp = new VerticalPanel(); fp.setStyleName(Gerrit.RESOURCES.css().addSshKeyPanel()); fp.add(new SmallHeading(Util.C.headingCreateGroup())); addTxt = new NpTextBox(); addTxt.setVisibleLength(60); addTxt.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { doCreateGroup(); } } }); addTxt.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { addNew.setEnabled(!addTxt.getText().trim().isEmpty()); } }); fp.add(addTxt); addNew = new Button(Util.C.buttonCreateGroup()); addNew.setEnabled(false); addNew.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { doCreateGroup(); } }); fp.add(addNew); add(fp); }

Target:
protected void onInitUI() { super.onInitUI(); setPageTitle(Util.C.groupListTitle()); groups = new GroupTable(true , PageLinks.ADMIN_GROUPS); add(groups); final VerticalPanel fp = new VerticalPanel(); fp.setStyleName(Gerrit.RESOURCES.css().addSshKeyPanel()); fp.add(new SmallHeading(Util.C.headingCreateGroup())); addTxt = new NpTextBox(); addTxt.setVisibleLength(60); addTxt.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { doCreateGroup(); } } }); fp.add(addTxt); addNew = new Button(Util.C.buttonCreateGroup()); addNew.setEnabled(false); addNew.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { doCreateGroup(); } }); fp.add(addNew); add(fp); new OnEditEnabler(addNew, addTxt); }
Source:
public static void trySkipCache(int fd, long offset, long len) { if (!initialized || !fadvisePossible || fd < 0) { return; } try { posix_fadvise(fd, offset, len, POSIX_FADV_DONTNEED); } catch (UnsupportedOperationException uoe) { LOG.warn("posix_fadvise is not supported : ", uoe); fadvisePossible = false; } catch (UnsatisfiedLinkError ule) { LOG.warn("Unsatisfied Link error: posix_fadvise failed on file descriptor {}, offset : ", new Object[] {fd, offset, ule}); fadvisePossible = false; } catch (Exception e) { LOG.warn("Unknown exception: posix_fadvise failed on file descriptor {}, offset : ", new Object[] {fd, offset, e}); } }

Target:
public static void trySkipCache(int fd, long offset, long len) { if (!initialized || !fadvisePossible || fd < 0) { return; } try { posix_fadvise(fd, offset, len, POSIX_FADV_DONTNEED); } catch (UnsupportedOperationException uoe) { log.warn(uoe, "posix_fadvise is not supported"); fadvisePossible = false; } catch (UnsatisfiedLinkError ule) { log.warn(ule, "Unsatisfied Link error: posix_fadvise failed on file descriptor [%d], offset [%d]", fd, offset); fadvisePossible = false; } catch (Exception e) { log.warn(e, "Unknown exception: posix_fadvise failed on file descriptor [%d], offset [%d]", fd, offset); } }
Source:
final void fail(long now, Throwable throwable) { if (aborted) { tries++; failWithTimeout(now, throwable); return; } if ((throwable instanceof UnsupportedVersionException) && handleUnsupportedVersionException((UnsupportedVersionException) throwable)) { log.debug("{} attempting protocol downgrade and then retry.", this); runnable.enqueue(this, now); return; } tries++; nextAllowedTryMs = now + retryBackoffMs; if (calcTimeoutMsRemainingAsInt(now, deadlineMs) < 0) { failWithTimeout(now, throwable); return; } if (!(throwable instanceof RetriableException)) { if (log.isDebugEnabled()) { log.debug("{} failed with non-retriable exception after attempt(s)", this, tries, new Exception(prettyPrintException(throwable))); } handleFailure(throwable); return; } if (tries > maxRetries) { if (log.isDebugEnabled()) { log.debug("{} failed after attempt(s)", this, tries, new Exception(prettyPrintException(throwable))); } handleFailure(throwable); return; } if (log.isDebugEnabled()) { log.debug("{} failed: {}. Beginning retry #{}", this, prettyPrintException(throwable), tries); } runnable.enqueue(this, now); }

Target:
final void fail(long now, Throwable throwable) { if (aborted) { tries++; failWithTimeout(now, throwable); return; } if ((throwable instanceof UnsupportedVersionException) && handleUnsupportedVersionException((UnsupportedVersionException) throwable)) { log.debug("{} attempting protocol downgrade and then retry.", this); runnable.enqueue(this, now); return; } tries++; nextAllowedTryMs = now + retryBackoffMs; if (calcTimeoutMsRemainingAsInt(now, deadlineMs) < 0) { failWithTimeout(now, throwable); return; } if (!(throwable instanceof RetriableException)) { if (log.isDebugEnabled()) { log.debug("{} failed with non-retriable exception after attempt(s)", this, tries, new Exception(prettyPrintException(throwable))); } handleFailure(throwable); return; } if (tries > maxRetries) { failWithTimeout(now, throwable); return; } if (log.isDebugEnabled()) { log.debug("{} failed: {}. Beginning retry #{}", this, prettyPrintException(throwable), tries); } runnable.enqueue(this, now); }
Source:
LedgerMetadataBuilder withEnsembleSize(int ensembleSize) { checkState(ensembles.size() == 0, "Can only set ensemble size when ensembles is empty"); this.ensembleSize = ensembleSize; return this; }

Target:
LedgerMetadataBuilder withEnsembleSize(int ensembleSize) { checkState(ensembles.size() == 0, "Can only set ensemble size before adding ensembles to the builder"); this.ensembleSize = ensembleSize; return this; }
Source:
public ProductProjectionQueryBuilder plusLocaleProjection(@Nullable final String localeProjection) { if (this.localeProjection == null) { this.localeProjection = new ArrayList<>(); } this.localeProjection.add(localeProjection); return this; }

Target:
public ProductProjectionQueryBuilder plusLocaleProjection(@Nullable final String localeProjection) { this.localeProjection.add(localeProjection); return this; }
Source:
public abstract @Nullable PcapPacket parseNextPacket() throws IOException, BadPcapFileException, BadPacketException; public abstract void skipNextPacket() throws IOException, BadPcapFileException; public abstract void seekPacket(long rank) throws IOException, BadPcapFileException; public abstract PcapTimestampScale getTimestampPrecision(); public abstract long getTimeAccuracy(); public abstract long getTimeZoneCorrection(); public abstract long getSnapShotLength(); public abstract long getDataLinkType(); public synchronized long getTotalNbPackets() throws IOException, BadPcapFileException { if (fTotalNumberPackets == -1) { long rank = fCurrentRank; fCurrentRank = fFileIndex.floorKey(rank); while (hasNextPacket()) { skipNextPacket(); } fTotalNumberPackets = fCurrentRank; fCurrentRank = rank; seekPacket(rank); } return fTotalNumberPackets; }

Target:
public abstract @Nullable PcapPacket parseNextPacket() throws IOException, BadPcapFileException, BadPacketException; public abstract boolean skipNextPacket() throws IOException, BadPcapFileException; public void seekPacket(long rank) throws IOException, BadPcapFileException { if (rank < 0) { throw new IllegalArgumentException(); } TreeMap<Long, Long> fileIndex = getFileIndex(); Long positionInBytes = fileIndex.get(rank); if (positionInBytes != null) { getFileChannel().position(positionInBytes.longValue()); setCurrentRank(rank); } else { long floorRank = fileIndex.floorKey(rank); setCurrentRank(floorRank); positionInBytes = fileIndex.get(floorRank); if (positionInBytes != null) { getFileChannel().position(positionInBytes); while (getCurrentRank() < rank && skipNextPacket()) { } } } }
Source:
public void query(final Query query, final int chunkSize, final Consumer<QueryResult> consumer) { if (version().startsWith("0.") || version().startsWith("1.0")) { throw new UnsupportedOperationException("chunking not supported"); } Call<ResponseBody> call = this.influxDBService.query(this.username, this.password, query.getDatabase(), query.getCommandWithUrlEncoded(), chunkSize); call.enqueue(new Callback<ResponseBody>() { @Override public void onResponse(final Call<ResponseBody> call, final Response<ResponseBody> response) { try { if (response.isSuccessful()) { BufferedSource source = response.body().source(); QueryResult result = InfluxDBImpl.this.adapter.fromJson(source); while (result != null) { consumer.accept(result); result = InfluxDBImpl.this.adapter.fromJson(source); } } try (ResponseBody errorBody = response.errorBody()) { throw new InfluxDBException(errorBody.string()); } } catch (EOFException e) { QueryResult queryResult = new QueryResult(); queryResult.setError("DONE"); consumer.accept(queryResult); } catch (IOException e) { QueryResult queryResult = new QueryResult(); queryResult.setError(e.toString()); consumer.accept(queryResult); } } @Override public void onFailure(final Call<ResponseBody> call, final Throwable t) { throw new InfluxDBException(t); } }); }

Target:
public void query(final Query query, final int chunkSize, final Consumer<QueryResult> consumer) { if (version().startsWith("0.") || version().startsWith("1.0")) { throw new UnsupportedOperationException("chunking not supported"); } Call<ResponseBody> call = null; if (query instanceof BoundParameterQuery) { BoundParameterQuery boundParameterQuery = (BoundParameterQuery) query; call = this.influxDBService.query(this.username, this.password, query.getDatabase(), query.getCommandWithUrlEncoded(), chunkSize, boundParameterQuery.getParameterJsonWithUrlEncoded()); } else { call = this.influxDBService.query(this.username, this.password, query.getDatabase(), query.getCommandWithUrlEncoded(), chunkSize); } call.enqueue(new Callback<ResponseBody>() { @Override public void onResponse(final Call<ResponseBody> call, final Response<ResponseBody> response) { try { if (response.isSuccessful()) { BufferedSource source = response.body().source(); while (true) { QueryResult result = InfluxDBImpl.this.adapter.fromJson(source); if (result != null) { consumer.accept(result); } } } try (ResponseBody errorBody = response.errorBody()) { throw new InfluxDBException(errorBody.string()); } } catch (EOFException e) { QueryResult queryResult = new QueryResult(); queryResult.setError("DONE"); consumer.accept(queryResult); } catch (IOException e) { QueryResult queryResult = new QueryResult(); queryResult.setError(e.toString()); consumer.accept(queryResult); } } @Override public void onFailure(final Call<ResponseBody> call, final Throwable t) { throw new InfluxDBException(t); } }); }
Source:
private static void pushMethod(JoinPoint joinPoint) { CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature(); Class<?> clazz = codeSignature.getDeclaringType(); String methodName = codeSignature.getName(); String[] parameterNames = codeSignature.getParameterNames(); Object[] parameterValues = joinPoint.getArgs(); StringBuilder builder = new StringBuilder("⇢ "); builder.append(methodName).append('('); for (int i = 0; i < parameterValues.length; i++) { if (i > 0) { builder.append(", "); } builder.append(parameterNames[i]).append('='); appendObject(builder, parameterValues[i]); } builder.append(')'); builder.append(" @Thread:").append(Thread.currentThread().getName()); Log.d(asTag(clazz), builder.toString()); }

Target:
private static void pushMethod(JoinPoint joinPoint) { CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature(); Class<?> clazz = codeSignature.getDeclaringType(); String methodName = codeSignature.getName(); String[] parameterNames = codeSignature.getParameterNames(); Object[] parameterValues = joinPoint.getArgs(); StringBuilder builder = new StringBuilder("⇢ "); builder.append(methodName).append('('); for (int i = 0; i < parameterValues.length; i++) { if (i > 0) { builder.append(", "); } builder.append(parameterNames[i]).append('='); appendObject(builder, parameterValues[i]); } builder.append(')'); if (!isMainThread()) { builder.append(" @Thread:").append(Thread.currentThread().getName()); } Log.d(asTag(clazz), builder.toString()); }
Source:
private static Boolean loadContacts(Context context) { if (context == null) { return false; } if (MainApplication.contacts != null) { return true; } String jsonData = PreferenceUtils.getString(context, PreferenceUtils.KEY_CONTACTS); if (jsonData.isEmpty()) { return false; } try { MainApplication.contacts = JSONModel.createFromJson(jsonData, MainApplication.Contacts.class); } catch (IOException e) { MainApplication.contacts = new MainApplication.Contacts(); e.printStackTrace(); return false; } return true; }

Target:
private static Boolean loadContacts(Context context) { if (context == null) { return false; } if (MainApplication.contacts != null) { return true; } String jsonData = PreferenceUtils.getString(context, PreferenceUtils.KEY_CONTACTS); if (jsonData.isEmpty()) { return false; } try { MainApplication.contacts = JSONModel.createFromJson(jsonData, MainApplication.Contacts.class); } catch (IOException e) { MainApplication.contacts = new MainApplication.Contacts(); Log.e(TAG, "Reading contacts from JSON failed. Empty contacts created."); e.printStackTrace(); return false; } return true; }
Source:
public Object getPropertyValue(Object id) { if (id.equals(ID_FILE_NAME) && fSourceLookup.getCallsite().getFileName() != null) { return fSourceLookup.getCallsite().getFileName(); } else if (id.equals(ID_FUNCTION_NAME)) { return fSourceLookup.getCallsite().getFunctionName(); } else if (id.equals(ID_LINE_NUMBER)) { return Long.valueOf(fSourceLookup.getCallsite().getLineNumber()); } return null; }

Target:
public Object getPropertyValue(Object id) { if (id.equals(ID_FILE_NAME)) { return fSourceLookup.getCallsite().getFileName(); } else if (id.equals(ID_FUNCTION_NAME)) { return fSourceLookup.getCallsite().getFunctionName(); } else if (id.equals(ID_LINE_NUMBER)) { return Long.valueOf(fSourceLookup.getCallsite().getLineNumber()); } return null; }
Source:
TransportAmazonS3(final Repository local, final URIish uri) throws NotSupportedException { super(local, uri); Properties props = null; File propsFile = new File(local.getDirectory(), uri.getUser()); if (!propsFile.isFile()) propsFile = new File(FS.DETECTED.userHome(), uri.getUser()); if (propsFile.isFile()) { try { props = AmazonS3.properties(propsFile); } catch (IOException e) { throw new NotSupportedException("cannot read " + propsFile, e); } } else { props = new Properties(); props.setProperty("accesskey", uri.getUser()); props.setProperty("secretkey", uri.getPass()); } s3 = new AmazonS3(props); bucket = uri.getHost(); String p = uri.getPath(); if (p.startsWith("/")) p = p.substring(1); if (p.endsWith("/")) p = p.substring(0, p.length() - 1); keyPrefix = p; }

Target:
TransportAmazonS3(final Repository local, final URIish uri) throws NotSupportedException { super(local, uri); Properties props = null; File propsFile = new File(local.getDirectory(), uri.getUser()); if (!propsFile.isFile()) propsFile = new File(local.getFS().userHome(), uri.getUser()); if (propsFile.isFile()) { try { props = AmazonS3.properties(propsFile); } catch (IOException e) { throw new NotSupportedException("cannot read " + propsFile, e); } } else { props = new Properties(); props.setProperty("accesskey", uri.getUser()); props.setProperty("secretkey", uri.getPass()); } s3 = new AmazonS3(props); bucket = uri.getHost(); String p = uri.getPath(); if (p.startsWith("/")) p = p.substring(1); if (p.endsWith("/")) p = p.substring(0, p.length() - 1); keyPrefix = p; }
Source:
public static void registerTags() { PropertyParser.<MaterialBamboo>registerTag("leaf_size", (attribute, material) -> { return new ElementTag(String.valueOf(material.getBamboo().getLeaves())); }); }

Target:
public static void registerTags() { PropertyParser.<MaterialBamboo>registerTag("leaf_size", (attribute, material) -> { return new ElementTag(material.getBamboo().getLeaves().name()); }); }
Source:
private void updateOffset(List<Update> updates) { OptionalLong ol = updates.stream().mapToLong(Update::getUpdateId).max(); if (ol.isPresent()) { this.offset = ol.getAsLong() + 1; log.debug("Next Telegram offset will be " + this.offset); } }

Target:
private void updateOffset(List<Update> updates) { OptionalLong ol = updates.stream().mapToLong(Update::getUpdateId).max(); if (ol.isPresent()) { this.offset = ol.getAsLong() + 1; log.debug("Next Telegram offset will be {}", this.offset); } }
Source:
List<TopicPartition> closeRevokedStandbyTasks(final Map<TaskId, Set<TopicPartition>> revokedTasks) { final List<TopicPartition> revokedChangelogs = new ArrayList<>(); for (final Map.Entry<TaskId, Set<TopicPartition>> entry : revokedTasks.entrySet()) { final TaskId taskId = entry.getKey(); final Task task; if (running.containsKey(taskId)) { task = running.get(taskId); } else if (created.containsKey(taskId)) { task = created.get(taskId); } else { log.error("Could not find the standby task while closing it", taskId); continue; } try { task.close(true, false); } catch (final RuntimeException e) { log.error("Closing the failed due to the following error:", taskTypeName, task.id(), e); } finally { running.remove(taskId); revokedChangelogs.addAll(task.changelogPartitions()); } } return revokedChangelogs; }

Target:
List<TopicPartition> closeRevokedStandbyTasks(final Map<TaskId, Set<TopicPartition>> revokedTasks) { log.debug("Closing revoked standby tasks {}", revokedTasks); final List<TopicPartition> revokedChangelogs = new ArrayList<>(); for (final Map.Entry<TaskId, Set<TopicPartition>> entry : revokedTasks.entrySet()) { final TaskId taskId = entry.getKey(); final Task task; if (running.containsKey(taskId)) { task = running.get(taskId); } else if (created.containsKey(taskId)) { task = created.get(taskId); } else { log.error("Could not find the standby task while closing it", taskId); continue; } try { task.close(true, false); } catch (final RuntimeException e) { log.error("Closing the failed due to the following error:", taskTypeName, task.id(), e); } finally { running.remove(taskId); revokedChangelogs.addAll(task.changelogPartitions()); } } return revokedChangelogs; }
Source:
public void testEvaluationOrder() throws TransformationException { String evaluationorder = "scale/evaluationorder.scale"; String source = "12"; String transformedResponse = processor.transform(evaluationorder, source); Assert.assertEquals("first", transformedResponse); }

Target:
public void testEvaluationOrder() throws TransformationException { String evaluationOrder = "scale/evaluationorder.scale"; String source = "12"; String transformedResponse = processor.transform(evaluationOrder, source); Assert.assertEquals("first", transformedResponse); }
Source:
public void testWithFilledSet() { final AlarmType alarmType = AlarmType.CLOCK_INVALID; final Set<AlarmType> alarmTypeSet = new TreeSet<>(); alarmTypeSet.add(alarmType); final AlarmRegister original = new AlarmRegister(alarmTypeSet); final com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.AlarmRegister mapped = this.mapperFactory .getMapperFacade().map(original, com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.AlarmRegister.class); assertNotNull(mapped); assertEquals(original.getAlarmTypes().size(), mapped.getAlarmTypes().size()); assertEquals(alarmType.name(), mapped.getAlarmTypes().get(0).name()); }

Target:
public void testWithFilledSet() { final Set<AlarmType> alarmTypeSet = new TreeSet<>(); alarmTypeSet.add(ALARMTYPE); final AlarmRegister original = new AlarmRegister(alarmTypeSet); final com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.AlarmRegister mapped = this.monitoringMapper .map(original, com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.AlarmRegister.class); assertNotNull(mapped); assertNotNull(mapped.getAlarmTypes()); assertNotNull(mapped.getAlarmTypes().get(0)); assertEquals(original.getAlarmTypes().size(), mapped.getAlarmTypes().size()); assertEquals(ALARMTYPE.name(), mapped.getAlarmTypes().get(0).name()); }
Source:
public void moveAction(int oldIndex, int newIndex) { var newActions = new ArrayList<ScriptGeneratorAction>(); newActions.addAll(actions); if (newIndex < 0) { newIndex = 0; } else if (newIndex >= this.actions.size()) { newIndex = this.actions.size() - 1; } Collections.swap(newActions, oldIndex, newIndex); firePropertyChange("actions", actions, actions = newActions); }

Target:
public void moveAction(int oldIndex, int newIndex) { if (isValidIndex(oldIndex)) { var newActions = new ArrayList<ScriptGeneratorAction>(); newActions.addAll(actions); if (newIndex < 0) { newIndex = 0; } else if (newIndex >= this.actions.size()) { newIndex = this.actions.size() - 1; } Collections.swap(newActions, oldIndex, newIndex); firePropertyChange("actions", actions, actions = newActions); } }
Source:
private void publishFallback(RecordMetadata md, Exception e) { KafkaCallback cb = new KafkaCallback(cc, position, key, json, succeededMessageCount, failedMessageCount, succeededMessageMeter, failedMessageMeter, null, context, producer); try { producer.sendFallbackAsync(fallbackTopic, key, cb, e); } catch (Exception fallbackEx) { cb.onCompletion(md, fallbackEx); } }

Target:
private void publishFallback(RecordMetadata md, Exception e) { KafkaCallback cb = new KafkaCallback(cc, position, key, json, succeededMessageCount, failedMessageCount, succeededMessageMeter, failedMessageMeter, null, context, producer); producer.sendFallbackAsync(fallbackTopic, key, cb, md, e); }
Source:
public static ReportedConfigurations map(org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations entity, ReportedConfigurations template) { ReportedConfigurations model = template == null ? new ReportedConfigurations() : template; model.setInSync(entity.isNetworkInSync()); List<ReportedConfiguration> reportedConfigurationList = model.getReportedConfigurations(); for (org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration reportedConfiguration : entity.getReportedConfigurationList()) { ReportedConfiguration conf = new ReportedConfiguration(); conf.setInSync(reportedConfiguration.isInSync()); conf.setName(reportedConfiguration.getType().getName()); conf.setValue(reportedConfiguration.getActualValue()); reportedConfigurationList.add(conf); } return model; }

Target:
public static ReportedConfigurations map(org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations entity, ReportedConfigurations template) { ReportedConfigurations model = template == null ? new ReportedConfigurations() : template; model.setInSync(entity.isNetworkInSync()); List<ReportedConfiguration> reportedConfigurationList = model.getReportedConfigurations(); for (org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration reportedConfiguration : entity.getReportedConfigurationList()) { ReportedConfiguration conf = new ReportedConfiguration(); conf.setInSync(reportedConfiguration.isInSync()); conf.setName(reportedConfiguration.getType().getName()); conf.setActualValue(reportedConfiguration.getActualValue()); conf.setExpectedValue(reportedConfiguration.getExpectedValue()); reportedConfigurationList.add(conf); } return model; }
Source:
protected boolean writeNeedsRemoteValue(InvocationContext ctx, WriteCommand command, Object key) { if (command.hasFlag(Flag.CACHE_MODE_LOCAL)) { return false; } if (ctx.isOriginLocal()) { if (!command.readsExistingValues()) { return false; } if (command.hasFlag(Flag.SKIP_REMOTE_LOOKUP)) { return false; } } else { if (!command.alwaysReadsExistingValues()) { return false; } } return true; }

Target:
protected boolean writeNeedsRemoteValue(InvocationContext ctx, WriteCommand command, Object key) { if (command.hasFlag(Flag.CACHE_MODE_LOCAL)) { return false; } if (ctx.isOriginLocal()) { if (!command.readsExistingValues()) { return false; } return !command.hasFlag(Flag.SKIP_REMOTE_LOOKUP); } else { return command.alwaysReadsExistingValues(); } }
Source:
public void testProjectionWithValues() throws Exception { List<Row> data = Arrays.asList( Row.of( (byte) 1, (short) 1, 1, 1L, 1.1f, 1.1, new BigDecimal("1.1"), true, LocalTime.of(1, 1, 1), LocalDate.of(1, 1, 1), LocalDateTime.of(1, 1, 1, 1, 1, 1, 1), Instant.ofEpochMilli(1), "1", new byte[] {1}, new BigDecimal[]{new BigDecimal("1.1")}, createMap("1", new BigDecimal("1.1")) ), Row.of( (byte) 2, (short) 2, 2, 2L, 2.2f, 2.2, new BigDecimal("2.2"), false, LocalTime.of(2, 2, 2), LocalDate.of(2, 2, 2), LocalDateTime.of(2, 2, 2, 2, 2, 2, 2), Instant.ofEpochMilli(2), "2", new byte[] {2}, new BigDecimal[]{new BigDecimal("2.2")}, createMap("2", new BigDecimal("2.2")) ) ); tEnv().createTemporaryFunction("func", new CustomScalarFunction()); Table t = tEnv().fromValues(data) .select(call( "func", IntStream.rangeClosed(0, 15).mapToObj(idx -> $("f" + idx)).toArray(Expression[]::new))); TestCollectionTableFactory.reset(); tEnv().sqlUpdate( "CREATE TABLE SinkTable(str STRING) WITH ('connector' = 'COLLECTION')"); t.insertInto("SinkTable"); tEnv().execute(""); List<Row> actual = TestCollectionTableFactory.getResult(); List<Row> expected = Arrays.asList( Row.of( "1,1,1,1,1.1,1.1,1.1,true,01:01:01,0001-01-01,0001-01-01T01:01:01.000000001," + "1970-01-01T00:00:00.001Z,1,[1],[1.1],{1=1.1}"), Row.of( "2,2,2,2,2.2,2.2,2.2,false,02:02:02,0002-02-02,0002-02-02T02:02:02.000000002," + "1970-01-01T00:00:00.002Z,2,[2],[2.2],{2=2.2}") ); assertThat( new HashSet<>(actual), equalTo(new HashSet<>(expected))); }

Target:
public void testProjectionWithValues() throws Exception { List<Row> data = Arrays.asList( Row.of( (byte) 1, (short) 1, 1, 1L, 1.1f, 1.1, new BigDecimal("1.1"), true, LocalTime.of(1, 1, 1), LocalDate.of(1, 1, 1), LocalDateTime.of(1, 1, 1, 1, 1, 1, 1), Instant.ofEpochMilli(1), "1", new byte[] {1}, new BigDecimal[]{new BigDecimal("1.1")}, createMap("1", new BigDecimal("1.1")) ), Row.of( (byte) 2, (short) 2, 2, 2L, 2.2f, 2.2, new BigDecimal("2.2"), false, LocalTime.of(2, 2, 2), LocalDate.of(2, 2, 2), LocalDateTime.of(2, 2, 2, 2, 2, 2, 2), Instant.ofEpochMilli(2), "2", new byte[] {2}, new BigDecimal[]{new BigDecimal("2.2")}, createMap("2", new BigDecimal("2.2")) ) ); tEnv().createTemporaryFunction("func", new CustomScalarFunction()); Table t = tEnv().fromValues(data) .select(call("func", withColumns(range("f0", "f15")))); TestCollectionTableFactory.reset(); tEnv().sqlUpdate( "CREATE TABLE SinkTable(str STRING) WITH ('connector' = 'COLLECTION')"); t.insertInto("SinkTable"); tEnv().execute(""); List<Row> actual = TestCollectionTableFactory.getResult(); List<Row> expected = Arrays.asList( Row.of( "1,1,1,1,1.1,1.1,1.1,true,01:01:01,0001-01-01,0001-01-01T01:01:01.000000001," + "1970-01-01T00:00:00.001Z,1,[1],[1.1],{1=1.1}"), Row.of( "2,2,2,2,2.2,2.2,2.2,false,02:02:02,0002-02-02,0002-02-02T02:02:02.000000002," + "1970-01-01T00:00:00.002Z,2,[2],[2.2],{2=2.2}") ); assertThat( new HashSet<>(actual), equalTo(new HashSet<>(expected))); }
Source:
public BalanceResource getSubResource(String id) { return inject(new BackendBalanceResource(id, getPolicyUnit(id))); }

Target:
public BalanceResource getSubResource(String id) { return inject(new BackendBalanceResource(id)); }
Source:
void createHandle (int index) { state |= HANDLE; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); handle = gtk_box_new (OS.GTK_ORIENTATION_VERTICAL, false, 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); if ((style & SWT.V_SCROLL) != 0) { scrolledHandle = OS.gtk_scrolled_window_new (0, 0); if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_scrolled_window_set_policy (scrolledHandle, OS.GTK_POLICY_NEVER, OS.GTK_POLICY_AUTOMATIC); OS.gtk_container_add (fixedHandle, scrolledHandle); if (OS.GTK_VERSION < OS.VERSION(3, 8, 0)) { OS.gtk_scrolled_window_add_with_viewport (scrolledHandle, handle); } else { OS.gtk_container_add(scrolledHandle, handle); } long viewport = OS.gtk_bin_get_child (scrolledHandle); OS.gtk_viewport_set_shadow_type (viewport, OS.GTK_SHADOW_NONE); } else { OS.gtk_container_add (fixedHandle, handle); } OS.gtk_container_set_border_width (handle, 0); if (OS.GTK_VERSION < OS.VERSION(3, 21, 0)) { setFontDescription(defaultFont().handle); } }

Target:
void createHandle (int index) { state |= HANDLE; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); handle = gtk_box_new (OS.GTK_ORIENTATION_VERTICAL, false, 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); if ((style & SWT.V_SCROLL) != 0) { scrolledHandle = OS.gtk_scrolled_window_new (0, 0); if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_scrolled_window_set_policy (scrolledHandle, OS.GTK_POLICY_NEVER, OS.GTK_POLICY_AUTOMATIC); OS.gtk_container_add (fixedHandle, scrolledHandle); if (OS.GTK_VERSION < OS.VERSION(3, 8, 0)) { OS.gtk_scrolled_window_add_with_viewport (scrolledHandle, handle); } else { OS.gtk_container_add(scrolledHandle, handle); } long viewport = OS.gtk_bin_get_child (scrolledHandle); OS.gtk_viewport_set_shadow_type (viewport, OS.GTK_SHADOW_NONE); } else { OS.gtk_container_add (fixedHandle, handle); } OS.gtk_container_set_border_width (handle, 0); if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { setFontDescription(defaultFont().handle); } }
Source:
public void append(long key, ByteBuffer payLoad) { LongConsumer lambda; if (listener != null && fireEvents) { lambda = (k) -> { Chain beforeAppend = segmentFor(k).getAndAppend(k, payLoad); listener.onAppend(payLoad.duplicate(), beforeAppend); }; } else { lambda = (k) -> segmentFor(k).append(k, payLoad); } try { lambda.accept(key); } catch (OversizeMappingException e) { consumeOversizeMappingException(key, lambda); } }

Target:
public void append(long key, ByteBuffer payLoad) { LongConsumer lambda; if (listener != null && fireEvents) { lambda = (k) -> { Chain beforeAppend = segmentFor(k).getAndAppend(k, payLoad); listener.onAppend(beforeAppend, payLoad.duplicate()); }; } else { lambda = (k) -> segmentFor(k).append(k, payLoad); } try { lambda.accept(key); } catch (OversizeMappingException e) { consumeOversizeMappingException(key, lambda); } }
Source:
public Map<String, String> getBinaryFulltext(String id) { State state = transaction.getStateForRead(id); String fulltext = (String) state.get(KEY_FULLTEXT_BINARY); if (fulltextStoredInBlob) { String key = fulltext; if (key != null) { DocumentBlobManager blobManager = Framework.getService(DocumentBlobManager.class); try { BlobInfo blobInfo = new BlobInfo(); blobInfo.key = key; Blob blob = blobManager.readBlob(blobInfo, getRepositoryName()); fulltext = blob.getString(); } catch (IOException e) { throw new PropertyException("Cannot read fulltext blob for doc: " + id, e); } } } return Collections.singletonMap("binarytext", fulltext); }

Target:
public Map<String, String> getBinaryFulltext(String id) { State state = transaction.getStateForRead(id); String fulltext = (String) state.get(KEY_FULLTEXT_BINARY); if (fulltextStoredInBlob && fulltext != null) { DocumentBlobManager blobManager = Framework.getService(DocumentBlobManager.class); try { BlobInfo blobInfo = new BlobInfo(); blobInfo.key = fulltext; Blob blob = blobManager.readBlob(blobInfo, getRepositoryName()); fulltext = blob.getString(); } catch (IOException e) { throw new PropertyException("Cannot read fulltext blob for doc: " + id, e); } } return Collections.singletonMap(BINARY_FULLTEXT_MAIN_KEY, fulltext); }
Source:
public TestEntity readFrom(ProtoStreamReader reader) throws IOException { return new TestEntity(reader.readString("name1"), reader.readString("name2"), reader.readString("name3"), reader.readString("name4"), reader.readString("name5"), reader.readString("name6")); }

Target:
public TestEntity readFrom(ProtoStreamReader reader) throws IOException { String name1 = reader.readString("name1"); String name2 = reader.readString("name2"); String name3 = reader.readString("name3"); String name4 = reader.readString("name4"); String name5 = reader.readString("name5"); String name6 = reader.readString("name6"); return new TestEntity(name1, name2, name3, name4, name5, name6); }
Source:
public void onLogout() { AsyncQuery query = new AsyncQuery(); query.setHandleFailure(true); query.setModel(this); query.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object ReturnValue) { if (clientAgentType.isIE8OrBelow()) { Window.Location.reload(); } frontend.setLoggedInUser(null); getLoginModel().resetAfterLogout(); AsyncDataProvider.clearCache(); connectAutomaticallyManager.resetAlreadyOpened(); ApplicationInit.super.onLogout(); } }; Frontend.LogoffAsync(frontend.getLoggedInUser(), query); }

Target:
public void onLogout() { AsyncQuery query = new AsyncQuery(); query.setHandleFailure(true); query.setModel(this); query.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object ReturnValue) { if (clientAgentType.isIE8OrBelow()) { Window.Location.reload(); } frontend.clearLoggedInUser(); getLoginModel().resetAfterLogout(); AsyncDataProvider.clearCache(); connectAutomaticallyManager.resetAlreadyOpened(); ApplicationInit.super.onLogout(); } }; frontend.logoffAsync(frontend.getLoggedInUser(), query); }
Source:
protected boolean maybeInitFilesystem(final List<String> paths) throws IOException { if (getFilesystem() == null) { if (!paths.isEmpty()) { initS3AFileSystem(paths.get(0)); } else { LOG.debug("No path on command line, so not instantiating FS"); } } return getFilesystem() != null; }

Target:
boolean maybeInitFilesystem(final List<String> paths) throws IOException { if (getFilesystem() == null) { if (!paths.isEmpty()) { initS3AFileSystem(paths.get(0)); } else { LOG.debug("No path on command line, so not instantiating FS"); } } return getFilesystem() != null; }
Source:
public void writeRateLimitShouldBeRespectedByConcurrentWritingThreads() throws InterruptedException { int oneTodoSizeInBytes = 167; int numThreads = 5; int numWritesPerThread = 10; ExecutorService executorService = Executors.newFixedThreadPool(numThreads); List<Future> futures = new ArrayList<>(numThreads); long start = System.nanoTime(); IntStream.range(0, numThreads).forEach(i -> futures.add(executorService.submit(() -> { IntStream.range(0, numWritesPerThread).forEach(j -> writeNTodosOfSize(1, 100)); return null; }))); executorService.shutdown(); Preconditions.checkState(executorService.awaitTermination(30L, TimeUnit.SECONDS), "Read tasks did not finish in 30s"); long timeTakenToWriteInSeconds = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start); assertThatAllWritesWereSuccessful(futures); long actualWriteRate = (numThreads * numWritesPerThread * oneTodoSizeInBytes) / timeTakenToWriteInSeconds; assertThat(actualWriteRate).isLessThan( writeBytesPerSecond + (writeBytesPerSecond / 10 )); }

Target:
public void writeRateLimitShouldBeRespectedByConcurrentWritingThreads() throws InterruptedException { int oneTodoSizeInBytes = 167; int numThreads = 5; int numWritesPerThread = 10; ExecutorService executorService = Executors.newFixedThreadPool(numThreads); List<Future> futures = new ArrayList<>(numThreads); long start = System.nanoTime(); IntStream.range(0, numThreads).forEach(i -> futures.add(executorService.submit(() -> { IntStream.range(0, numWritesPerThread).forEach(j -> writeNTodosOfSize(1, 100)); return null; }))); executorService.shutdown(); Preconditions.checkState(executorService.awaitTermination(30L, TimeUnit.SECONDS), "Read tasks did not finish in 30s"); long writeTime = System.nanoTime() - start; assertThatAllWritesWereSuccessful(futures); double actualBytesWritten = numThreads * numWritesPerThread * oneTodoSizeInBytes; double maxReadBytesLimit = readBytesPerSecond * ((double) writeTime / TimeUnit.SECONDS.toNanos(1) + 5 ); assertThat(actualBytesWritten).isLessThan(maxReadBytesLimit); }
Source:
public void search(final String term) { final boolean isNewSearch = Objects.equals(term, currentTerm); final Optional<SearchResult<T>> result; if (isNewSearch) { result = findNextElement(term); } else { result = findFirstElement(term); } currentResult = result.orElse(currentResult); currentTerm = term; triggerOnFoundCommand(); }

Target:
public void search(final String term) { final boolean isNewSearch = !Objects.equals(term, currentTerm); final Optional<SearchResult<T>> result; if (isNewSearch) { result = findFirstElement(term); } else { result = findNextElement(term); } currentResult = result.orElse(null); currentTerm = term; triggerOnFoundCommand(); }
Source:
public void onEntityPathfind(EntityPathfindEvent event) { this.event = event; Entity entity = event.getEntity(); Entity target = event.getTargetEntity(); this.entity = new EntityTag(entity); this.target = target != null ? new EntityTag(target) : null; EntityTag.rememberEntity(entity); EntityTag.rememberEntity(target); fire(event); EntityTag.forgetEntity(entity); EntityTag.forgetEntity(target); }

Target:
public void onEntityPathfind(EntityPathfindEvent event) { this.event = event; this.entity = new EntityTag(event.getEntity()); Entity target = event.getTargetEntity(); this.target = target != null ? new EntityTag(target) : null; fire(event); }
Source:
private <R> R withConnection(Function<Object, R> function) { ConnectionSupplier connectionSupplier; try { connectionSupplier = connectionSupplierFactory.getConnectionSupplier(); try { R result = function.apply(connectionSupplier.getConnection()); connectionSupplier.close(); return result; } catch (Exception e) { connectionSupplier.invalidateConnection(); throw new ConnectionException(COULD_NOT_OBTAIN_A_CONNECTION, e); } } catch (Exception e) { throw new MuleRuntimeException(createStaticMessage(COULD_NOT_OBTAIN_A_CONNECTION), e); } }

Target:
private <R> R withConnection(Function<Object, R> function) { ConnectionSupplier connectionSupplier = getConnectionSupplier(); Object connection = getConnection(connectionSupplier); try { R result = function.apply(connection); connectionSupplier.close(); return result; } catch (Exception e) { if (isFirstPage) { closeDelegate(connection); } connectionSupplier.invalidateConnection(); throw new MuleRuntimeException(createStaticMessage(COULD_NOT_EXECUTE), e); } }
Source:
private boolean isConnectionReset(Throwable t) { return (t instanceof SocketException && (t.getMessage().contains("Connection reset"))) || (t.getCause() != null && isConnectionReset(t.getCause())); }

Target:
private boolean isConnectionReset(Throwable t) { return (t instanceof SocketException && (t.getMessage() != null && t.getMessage().contains("Connection reset"))) || (t.getCause() != null && isConnectionReset(t.getCause())); }