auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private TaskLauncher getReboundTaskLauncherIfStillExist() { TaskLauncher answer = null; boolean nodeConnected = false; boolean isPAMR = taskLauncherNodeUrl.startsWith("pamr://"); long initialTime = System.currentTimeMillis(); String nodeUrl = nodes.get(0).getNodeInformation().getURL(); do { try { logger.debug("List AOs on " + nodeUrl + " (expect only one): "); Object[] aos = NodeFactory.getNode(nodeUrl).getActiveObjects(); nodeConnected = true; logger.debug(Arrays.toString(aos)); answer = (TaskLauncher) aos[0]; } catch (NodeException t) { if (isPAMR) { logger.debug("Failed to access node " + nodeUrl); Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } } catch (Throwable t) { } pamrReconnectionTimeoutSpent = pamrReconnectionTimeoutSpent || <START> (System.currentTimeMillis() - initialTime > 64000); <END> } while (!nodeConnected && isPAMR && !pamrReconnectionTimeoutSpent); if (!nodeConnected || answer == null) { logger.warn("Failed to rebind TaskLauncher of task " + taskId + ". TaskLauncher with node URL: " + nodeUrl + " could not be looked up. Running task cannot be recovered, it will be restarted if possible."); answer = new TaskLauncher(); } return answer; }</code><technical_language>extract constant here? is 64 seconds</technical_language>

Target:
private TaskLauncher getReboundTaskLauncherIfStillExist() { TaskLauncher answer = null; boolean nodeConnected = false; boolean isPAMR = taskLauncherNodeUrl.startsWith(PAMRRemoteObjectFactory.PROTOCOL_ID + "://"); long initialTime = System.currentTimeMillis(); String nodeUrl = nodes.get(0).getNodeInformation().getURL(); boolean taskLauncherFound = false; do { try { logger.debug("List AOs on " + nodeUrl + " (expect only one): "); Object[] aos = NodeFactory.getNode(nodeUrl).getActiveObjects(); nodeConnected = true; logger.debug(Arrays.toString(aos)); taskLauncherFound = aos.length > 0; if (!taskLauncherFound) { break; } answer = (TaskLauncher) aos[0]; } catch (NodeException t) { if (isPAMR) { logger.debug("Failed to access node " + nodeUrl); Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } } catch (Throwable t) { logger.warn("Error while retrieving task launcher", t); } pamrReconnectionTimeoutSpent = pamrReconnectionTimeoutSpent || (System.currentTimeMillis() - initialTime > Agent.MAXIMUM_RETRY_DELAY_MS); } while (!nodeConnected && isPAMR && !pamrReconnectionTimeoutSpent); if (!nodeConnected || answer == null) { logger.warn("Failed to rebind TaskLauncher of task " + taskId + ". TaskLauncher with node URL: " + nodeUrl + " could not be looked up. Running task cannot be recovered, it will be restarted if possible."); answer = new TaskLauncher(); } return answer; }
Source:
<code>public ContentProtos.SegmentEvent.Builder serialize(SegmentEvent event) { Builder builder = ContentProtos.SegmentEvent.newBuilder(); if (event.getCanonicalUri() != null) { builder.setUri(event.getCanonicalUri()); } if (event.getIsChapter() != null) { builder.setChapter(event.getIsChapter()); } if (event.getOffset() != null) { builder.setOffset(event.getOffset().getMillis()); } if (event.getPosition() != null) { builder.setPosition(event.getPosition()); } if (event.getSegment() != null) { <START> builder.setSegment(event.getId().toString()); <END> } Description desc = event.getDescription(); if (desc != null) { if (desc.getTitle() != null) { builder.setTitle(desc.getTitle()); } if (desc.getSynopsis() != null) { builder.setDescription(desc.getSynopsis()); } if (desc.getImage() != null) { builder.setImage(desc.getImage()); } if (desc.getThumbnail() != null) { builder.setThumbnail(desc.getThumbnail()); } } return builder; }</code><technical_language>want toString method here, toString is volatile suitable for outputting API. after</technical_language>

Target:
public ContentProtos.SegmentEvent.Builder serialize(SegmentEvent event) { Builder builder = ContentProtos.SegmentEvent.newBuilder(); if (event.getCanonicalUri() != null) { builder.setUri(event.getCanonicalUri()); } if (event.getIsChapter() != null) { builder.setChapter(event.getIsChapter()); } if (event.getOffset() != null) { builder.setOffset(event.getOffset().getMillis()); } if (event.getPosition() != null) { builder.setPosition(event.getPosition()); } if (event.getSegment() != null) { builder.setSegmentRef(event.getSegment().getId().longValue()); } Description desc = event.getDescription(); if (desc != null) { if (desc.getTitle() != null) { builder.setTitle(desc.getTitle()); } if (desc.getSynopsis() != null) { builder.setDescription(desc.getSynopsis()); } if (desc.getImage() != null) { builder.setImage(desc.getImage()); } if (desc.getThumbnail() != null) { builder.setThumbnail(desc.getThumbnail()); } } return builder; }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setPresenter(mPresenter); setHasOptionsMenu(true); <START> ((PatientDashboardDetailsPresenter) mPresenter).updatePatientDataFromServer(); <END> }</code><technical_language>calling this method subscribe in presenter</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setPresenter(mPresenter); setHasOptionsMenu(true); }
Source:
<code>public double eventElapsedTime(final String eventName) { final long currentTime = System.currentTimeMillis(); long startTime; synchronized (mEventTimings) { <START> startTime = mEventTimings.get(eventName); <END> } return (double)((currentTime - startTime) / 1000); }</code><technical_language>want check if is a timed event for name return 0 in case</technical_language>

Target:
public double eventElapsedTime(final String eventName) { final long currentTime = System.currentTimeMillis(); Long startTime; synchronized (mEventTimings) { startTime = mEventTimings.get(eventName); } return startTime == null ? 0 : (double)((currentTime - startTime) / 1000); }
Source:
<code>default T create(JobContext jobContext, ContainerContext containerContext) { <START> throw new UnsupportedOperationException("Please implement #create(ExternalContext, JobContext, ContainerContext) " <END> + "directly, or at least override this version of create."); }</code><technical_language>For existing users implementing this method, this exception matter. For new users, this happen if override create. If idea is prevent that, remove ", ..." message</technical_language>

Target:
default T create(JobContext jobContext, ContainerContext containerContext) { throw new UnsupportedOperationException("Please implement a version of create for the factory implementation."); }
Source:
<code>public ExceptionSupplier<DirContext, NamingException> create() { SocketFactory socketFactory; try { try { File workingDirCA = new File(CA_JKS_LOCATION); File trustFile = new File(workingDirCA, "ca.truststore"); if (trustFile.exists() == false) { setUp(); } <START> } catch (Exception e) <END> KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); keyStore.load(new FileInputStream(getClass().getResource("/ca/jks/ca.truststore").getFile()), PASSWORD); TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustFactory.init(keyStore); SSLContext context = SSLContext.getInstance("TLS"); context.init(null, trustFactory.getTrustManagers(), null); socketFactory = context.getSocketFactory(); } catch (Exception e) { throw new IllegalStateException(e); } return () -> SimpleDirContextFactoryBuilder.builder() .setProviderUrl(String.format("ldap://localhost:%d/", LDAP_PORT)) .setSecurityPrincipal(SERVER_DN) .setSecurityCredential(SERVER_CREDENTIAL) .setSocketFactory(socketFactory) .build().obtainDirContext(DirContextFactory.ReferralMode.IGNORE); }</code><technical_language>happen this empty catch block well. outer try/catch block catches Exception, this try/catch block removed</technical_language>

Target:
public ExceptionSupplier<DirContext, NamingException> create() { SocketFactory socketFactory; try { File workingDirCA = new File(CA_JKS_LOCATION); File trustFile = new File(workingDirCA, "ca.truststore"); if (trustFile.exists() == false) { setUp(); } KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); keyStore.load(new FileInputStream(getClass().getResource("/ca/jks/ca.truststore").getFile()), PASSWORD); TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustFactory.init(keyStore); SSLContext context = SSLContext.getInstance("TLS"); context.init(null, trustFactory.getTrustManagers(), null); socketFactory = context.getSocketFactory(); } catch (Exception e) { throw new IllegalStateException(e); } return () -> SimpleDirContextFactoryBuilder.builder() .setProviderUrl(String.format("ldap://localhost:%d/", LDAP_PORT)) .setSecurityPrincipal(SERVER_DN) .setSecurityCredential(SERVER_CREDENTIAL) .setSocketFactory(socketFactory) .build().obtainDirContext(DirContextFactory.ReferralMode.IGNORE); }
Source:
<code>public OracleMillisecondDiffFunction() { <START> super("1000 * (extract(second from cast(?2 as timestamp) - cast(?1 as timestamp))\n" + <END> " + 60 * (extract(minute from cast(?2 as timestamp) - cast(?1 as timestamp))\n" + " + 60 * (extract(hour from cast(?2 as timestamp) - cast(?1 as timestamp))\n" + " + 24 * (extract(day from cast(?2 as timestamp) - cast(?1 as timestamp))))))"); this.bothParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from t2 - t1)\n" + " + 60 * (extract(minute from t2 - t1)\n" + " + 60 * (extract(hour from t2 - t1)\n" + " + 24 * (extract(day from t2 - t1))))) " + "from (select cast(?1 as timestamp) as t1, cast(?2 as timestamp) as t2 from dual))"); this.firstParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from cast(?2 as timestamp) - t1)\n" + " + 60 * (extract(minute from cast(?2 as timestamp) - t1)\n" + " + 60 * (extract(hour from cast(?2 as timestamp) - t1)\n" + " + 24 * (extract(day from cast(?2 as timestamp) - t1))))) " + "from (select cast(?1 as timestamp) as t1 from dual))"); this.secondParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from t2 - cast(?1 as timestamp))\n" + " + 60 * (extract(minute from t2 - cast(?1 as timestamp))\n" + " + 60 * (extract(hour from t2 - cast(?1 as timestamp))\n" + " + 24 * (extract(day from t2 - cast(?1 as timestamp)))))) " + "from (select cast(?2 as timestamp) as t2 from dual))"); }</code><technical_language>Remove \n please add source: <LINK_0></technical_language>

Target:
public OracleMillisecondDiffFunction() { super("1000 * (extract(second from cast(?2 as timestamp) - cast(?1 as timestamp))" + " + 60 * (extract(minute from cast(?2 as timestamp) - cast(?1 as timestamp))" + " + 60 * (extract(hour from cast(?2 as timestamp) - cast(?1 as timestamp))" + " + 24 * (extract(day from cast(?2 as timestamp) - cast(?1 as timestamp))))))"); this.bothParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from t2 - t1)" + " + 60 * (extract(minute from t2 - t1)" + " + 60 * (extract(hour from t2 - t1)" + " + 24 * (extract(day from t2 - t1))))) " + "from (select cast(?1 as timestamp) as t1, cast(?2 as timestamp) as t2 from dual))"); this.firstParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from cast(?2 as timestamp) - t1)" + " + 60 * (extract(minute from cast(?2 as timestamp) - t1)" + " + 60 * (extract(hour from cast(?2 as timestamp) - t1)" + " + 24 * (extract(day from cast(?2 as timestamp) - t1))))) " + "from (select cast(?1 as timestamp) as t1 from dual))"); this.secondParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from t2 - cast(?1 as timestamp))" + " + 60 * (extract(minute from t2 - cast(?1 as timestamp))" + " + 60 * (extract(hour from t2 - cast(?1 as timestamp))" + " + 24 * (extract(day from t2 - cast(?1 as timestamp)))))) " + "from (select cast(?2 as timestamp) as t2 from dual))"); }
Source:
<code>protected void killSpawnedThreads() { List<Runnable> runnables = defaultExecutorService.shutdownNow(); <START> log.errorf("There were runnables %s left uncompleted in test %s", runnables, getClass().getSimpleName()); <END> for (TrackingThreadFactory factory : requestedThreadFactories) { checkFactoryForLeaks(factory); } }</code><technical_language>log this if runnables is empty</technical_language>

Target:
protected void killSpawnedThreads() { List<Runnable> runnables = defaultExecutorService.shutdownNow(); if (!runnables.isEmpty()) { log.errorf("There were runnables %s left uncompleted in test %s", runnables, getClass().getSimpleName()); } for (TrackingThreadFactory factory : requestedThreadFactories) { checkFactoryForLeaks(factory); } }
Source:
<code>private void initView(Context context) { inflate(context, R.layout.reader_related_posts_view, this); <START> mFeaturedImageWidth = DisplayUtils.dpToPx(getContext(), getResources().getDimensionPixelSize(R.dimen.reader_related_post_image_width)); <END> }</code><technical_language>reconcile 2 Contexts in lines? I mean, is passed a parameter getContext() so, instead other? Thanks</technical_language>

Target:
private void initView(Context context) { inflate(context, R.layout.reader_related_posts_view, this); mFeaturedImageWidth = DisplayUtils.dpToPx(context, context.getResources().getDimensionPixelSize(R.dimen.reader_related_post_image_width)); }
Source:
<code>void start() { long start_ms = System.currentTimeMillis(); long delta_s = 0; FileInputStream sd_pipe = null; try { sd_pipe = new FileInputStream(appConfig.getServiceDiscoveryPipe()); } catch (FileNotFoundException e) { LOGGER.warn("Unable to open named pipe - Service Discovery disabled."); sd_pipe = null; } while (true) { if (appConfig.getExitWatcher().shouldExit()){ LOGGER.info("Exit file detected: stopping JMXFetch."); System.exit(0); } try { if(sd_pipe != null && sd_pipe.available() > 0) { int len = sd_pipe.available(); byte[] buffer = new byte[len]; sd_pipe.read(buffer); <START> reinit.set(process_service_discovery(buffer)); <END> } } catch(IOException e) { LOGGER.warn("Unable to read from pipe - Service Discovery configuration may have been skipped."); } long start = System.currentTimeMillis(); if (this.reinit.get()) { init(true); } if (instances.size() > 0) { doIteration(); } else { LOGGER.warn("No instance could be initiated. Retrying initialization."); appConfig.getStatus().flush(); configs = getConfigs(appConfig); init(true); } long length = System.currentTimeMillis() - start; LOGGER.debug("Iteration ran in " + length + " ms"); try { int loopPeriod = appConfig.getCheckPeriod(); LOGGER.debug("Sleeping for " + loopPeriod + " ms."); Thread.sleep(loopPeriod); } catch (InterruptedException e) { LOGGER.warn(e.getMessage(), e); } } }</code><technical_language>setReinit remove</technical_language>

Target:
void start() { long start_ms = System.currentTimeMillis(); long delta_s = 0; FileInputStream sdPipe = null; try { sdPipe = new FileInputStream(appConfig.getServiceDiscoveryPipe()); } catch (FileNotFoundException e) { LOGGER.warn("Unable to open named pipe - Service Discovery disabled."); sdPipe = null; } while (true) { if (appConfig.getExitWatcher().shouldExit()){ LOGGER.info("Exit file detected: stopping JMXFetch."); System.exit(0); } try { if(sdPipe != null && sdPipe.available() > 0) { int len = sdPipe.available(); byte[] buffer = new byte[len]; sdPipe.read(buffer); setReinit(processServiceDiscovery(buffer)); } } catch(IOException e) { LOGGER.warn("Unable to read from pipe - Service Discovery configuration may have been skipped."); } long start = System.currentTimeMillis(); if (this.reinit.get()) { init(true); } if (instances.size() > 0) { doIteration(); } else { LOGGER.warn("No instance could be initiated. Retrying initialization."); appConfig.getStatus().flush(); configs = getConfigs(appConfig); init(true); } long length = System.currentTimeMillis() - start; LOGGER.debug("Iteration ran in " + length + " ms"); try { int loopPeriod = appConfig.getCheckPeriod(); LOGGER.debug("Sleeping for " + loopPeriod + " ms."); Thread.sleep(loopPeriod); } catch (InterruptedException e) { LOGGER.warn(e.getMessage(), e); } } }
Source:
<code>public boolean isAttachedLabel(String user, String labelId) throws APIManagementException { APIProviderImpl apiProvider = new APIProviderImpl(user); List<API> apiList = apiProvider.getAllAPIs(); List<Label> allLabelsWithID = getAllLabels(MultitenantUtils.getTenantDomain(user)); String labelName = null; for (Label label : allLabelsWithID) { if (labelId.equalsIgnoreCase(label.getLabelId())) { labelName = label.getName(); break; } } <START> if (labelName != null && !labelName.isEmpty()) { <END> UserAwareAPIProvider userAwareAPIProvider = new UserAwareAPIProvider(user); for (API api : apiList) { String uuid = api.getUUID(); API lightweightAPIByUUID = userAwareAPIProvider.getLightweightAPIByUUID(uuid, apiProvider.tenantDomain); List<Label> attachedLabelsWithoutID = lightweightAPIByUUID.getGatewayLabels(); for (Label labelWithoutId : attachedLabelsWithoutID) { if (labelName.equalsIgnoreCase(labelWithoutId.getName())) { return true; } } } } return false; }</code><technical_language>strigutils.isempty()</technical_language>

Target:
public boolean isAttachedLabel(String user, String labelId) throws APIManagementException { APIProviderImpl apiProvider = new APIProviderImpl(user); List<API> apiList = apiProvider.getAllAPIs(); List<Label> allLabelsWithID = getAllLabels(MultitenantUtils.getTenantDomain(user)); String labelName = null; for (Label label : allLabelsWithID) { if (labelId.equalsIgnoreCase(label.getLabelId())) { labelName = label.getName(); break; } } if (labelName != null && StringUtils.isEmpty(labelName)) { UserAwareAPIProvider userAwareAPIProvider = new UserAwareAPIProvider(user); for (API api : apiList) { String uuid = api.getUUID(); API lightweightAPIByUUID = userAwareAPIProvider.getLightweightAPIByUUID(uuid, apiProvider. tenantDomain); List<Label> attachedLabelsWithoutID = lightweightAPIByUUID.getGatewayLabels(); for (Label labelWithoutId : attachedLabelsWithoutID) { if (labelName.equalsIgnoreCase(labelWithoutId.getName())) { return true; } } } } return false; }
Source:
<code>protected ZonedDateTime parseDatestamp(String line, ParseInformation pos) { ZonedDateTime zonedDateTime = null; if (nextIsDatestamp(line, pos)) { <START> zonedDateTime = ZonedDateTime.parse(line.substring(pos.getIndex(), pos.getIndex()+LENGTH_OF_DATESTAMP-1), <END> DATE_TIME_FORMATTER); pos.setIndex(pos.getIndex() + LENGTH_OF_DATESTAMP); if (pos.getFirstDateStamp() == null) { pos.setFirstDateStamp(zonedDateTime); } } return zonedDateTime; }</code><technical_language>do throw out exception handling (DateTimeParseException thrown)? gcviewer.imp.ParseException contains text line, problem occurs helps in understanding, exception occurred</technical_language>

Target:
protected ZonedDateTime parseDatestamp(String line, ParseInformation pos) throws ParseException { ZonedDateTime zonedDateTime = null; if (nextIsDatestamp(line, pos)) { try { zonedDateTime = ZonedDateTime.parse(line.substring(pos.getIndex(), pos.getIndex() + LENGTH_OF_DATESTAMP - 1), DATE_TIME_FORMATTER); pos.setIndex(pos.getIndex() + LENGTH_OF_DATESTAMP); if (pos.getFirstDateStamp() == null) { pos.setFirstDateStamp(zonedDateTime); } } catch (DateTimeParseException e){ throw new ParseException(e.toString(), line); } } return zonedDateTime; }
Source:
<code>public DataSize getWrittenDataSize() { return succinctBytes( operatorSummaries.stream() .filter(stats -> stats.getOperatorType().equals(TableWriterOperator.class.getSimpleName())) <START> .map(stats -> stats.getInputDataSize().toBytes()) <END> .reduce(0L, Long::sum)); }</code><technical_language>mapToLong sum()</technical_language>

Target:
public DataSize getWrittenDataSize() { return succinctBytes( operatorSummaries.stream() .filter(stats -> stats.getOperatorType().equals(TableWriterOperator.class.getSimpleName())) .mapToLong(stats -> stats.getInputDataSize().toBytes()) .sum()); }
Source:
<code>private void processRegister(final UserConfigurationResponse response) { try { TransactionManager.callInTransaction(app.getDatabaseHelper() .getConnectionSource(), new Callable<Void>() { public Void call() throws Exception { List<Stream> subscriptions = response.getSubscriptions(); app.addToMutedTopics(response.getMutedTopics()); RuntimeExceptionDao<Stream, Object> streamDao = app .getDao(Stream.class); Log.i("stream", "" + subscriptions.size() + " streams"); streamDao.updateBuilder().updateColumnValue( Stream.SUBSCRIBED_FIELD, false); for (int i = 0; i < subscriptions.size(); i++) { Stream stream = subscriptions.get(i); stream.getParsedColor(); stream.setSubscribed(true); try { streamDao.createOrUpdate(stream); } <START> catch(Exception e) { <END> ZLog.logException(e); } } List<Person> people = response.getRealmUsers(); RuntimeExceptionDao<Person, Object> personDao = app .getDao(Person.class); personDao.updateBuilder().updateColumnValue( Person.ISACTIVE_FIELD, false); for (int i = 0; i < people.size(); i++) { Person person = people.get(i); person.setActive(true); try { personDao.createOrUpdate(person); } catch(Exception e) { ZLog.logException(e); } } return null; } }); activity.runOnUiThread(new Runnable() { @Override public void run() { that.activity.getPeopleAdapter().refresh(); activity.onReadyToDisplay(true); activity.checkAndSetupStreamsDrawer(); } }); } catch (SQLException e) { ZLog.logException(e); } }</code><technical_language>this narrow specific exception type. this for caught Exceptions listed in this PR</technical_language>

Target:
private void processRegister(final UserConfigurationResponse response) { try { TransactionManager.callInTransaction(app.getDatabaseHelper() .getConnectionSource(), new Callable<Void>() { public Void call() throws Exception { List<Stream> subscriptions = response.getSubscriptions(); RuntimeExceptionDao<Stream, Object> streamDao = app .getDao(Stream.class); Log.i("stream", "" + subscriptions.size() + " streams"); streamDao.updateBuilder().updateColumnValue( Stream.SUBSCRIBED_FIELD, false); for (int i = 0; i < subscriptions.size(); i++) { Stream stream = subscriptions.get(i); stream.getParsedColor(); stream.setSubscribed(true); try { streamDao.createOrUpdate(stream); } catch(Exception e) { ZLog.logException(e); } } app.addToMutedTopics(response.getMutedTopics()); List<Person> people = response.getRealmUsers(); RuntimeExceptionDao<Person, Object> personDao = app .getDao(Person.class); personDao.updateBuilder().updateColumnValue( Person.ISACTIVE_FIELD, false); for (int i = 0; i < people.size(); i++) { Person person = people.get(i); person.setActive(true); try { personDao.createOrUpdate(person); } catch(Exception e) { ZLog.logException(e); } } return null; } }); if (!calledFromWidget) { activity.runOnUiThread(new Runnable() { @Override public void run() { that.activity.getPeopleAdapter().refresh(); activity.onReadyToDisplay(true); activity.checkAndSetupStreamsDrawer(); } }); } } catch (SQLException e) { ZLog.logException(e); } }
Source:
<code>public DetailView() { BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(layout); <START> setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); <END> }</code><technical_language>Magic</technical_language>

Target:
public DetailView() { BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(layout); setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER)); }
Source:
<code>public static AbstractRecord create (int type) { try { Class recordClass = RecordType.typeToClass(type); return (AbstractRecord) recordClass.newInstance(); } catch (final NullPointerException ex) { tsLogger.i18NLogger.warn_coordinator_AbstractRecord_npe(Integer.toString(type)); return null; } catch (final Throwable ex) { try { Class rt = RecordType.typeToClass(type); String className = (rt == null) ? "null" : rt.getName(); int mb = 1024 * 1024; Runtime runtime = Runtime.getRuntime(); long used = (runtime.totalMemory() - runtime.freeMemory()) / mb; long free = runtime.freeMemory() / mb; tsLogger.i18NLogger.warn_coordinator_AbstractRecord_create_failure( type, className, used, free, ex); } catch (final Throwable t) { <START> ex.printStackTrace(); <END> } return null; } }</code><technical_language>I assume this printed a logger stdout</technical_language>

Target:
public static AbstractRecord create (int type) { try { Class recordClass = RecordType.typeToClass(type); return (AbstractRecord) recordClass.newInstance(); } catch (final NullPointerException ex) { tsLogger.i18NLogger.warn_coordinator_AbstractRecord_npe(Integer.toString(type)); return null; } catch (final Throwable ex) { Class rt = RecordType.typeToClass(type); String className = (rt == null) ? "null" : rt.getName(); tsLogger.i18NLogger.warn_coordinator_AbstractRecord_create_failure(type, className); ex.printStackTrace(); return null; } }
Source:
<code><START> public String getDescription() { <END> return description; }</code><technical_language>I this getter is needed</technical_language>

Target:
public EntityModel<String> getDescription() { return privateDescription; }
Source:
<code>public void setSeek(SeekCommand seekCommand) { <START> this.fSeek = seekCommand; <END> }</code><technical_language>remove this</technical_language>

Target:
public void setSeek(SeekCommand seekCommand) { fSeek = seekCommand; }
Source:
<code>public void setDosingInstructions_shouldBeSetCorrectly() { DrugOrder drugOrder = new DrugOrder(); ChemoDosingInstructions chemoDosingInstructions = new ChemoDosingInstructions(); <START> chemoDosingInstructions.setDosageAdjustmentPercentage(20.04); <END> chemoDosingInstructions.setDosageDilutionInstructions("10% diluted"); String shouldBeResult = "Dosage Adjustment Percentage : 20.04\nDosage Dilution Instructions : 10% diluted\n"; chemoDosingInstructions.setDosingInstructions(drugOrder); Assert.assertEquals(drugOrder.getDosingType(), ChemoDosingInstructions.class); Assert.assertEquals(drugOrder.getDosingInstructions(), shouldBeResult); }</code><technical_language>Another instance of hard-coded strings... repeated this class :)</technical_language>

Target:
public void setDosingInstructions_shouldBeSetCorrectly() { DrugOrder drugOrder = new DrugOrder(); ChemoDosingInstructions chemoDosingInstructions = new ChemoDosingInstructions(); chemoDosingInstructions.setDosageAdjustmentPercentage(ADJUSTMENT_PERCENTAGE_CONSTANT); chemoDosingInstructions.setDosageDilutionInstructions(DILUTION_INSTRUCTIONS_CONSTANT); String shouldBeResult = ADJUSTMENT_PERCENTAGE + ADJUSTMENT_PERCENTAGE_CONSTANT + "\n" + DILUTION_INSTRUCTIONS + DILUTION_INSTRUCTIONS_CONSTANT + "\n"; chemoDosingInstructions.setDosingInstructions(drugOrder); Assert.assertEquals(drugOrder.getDosingType(), ChemoDosingInstructions.class); Assert.assertEquals(drugOrder.getDosingInstructions(), shouldBeResult); }
Source:
<code><START> Map getObjectsToBeDispatched() { <END> return mObjectsToBeDispatched; }</code><technical_language>Map [](start = 4, length = 3) give type here? #Closed</technical_language>

Target:
Map<String, List<IEvents>> getObjectsToBeDispatched() { return mObjectsToBeDispatched; }
Source:
<code>private SelectionScript replaceBindings(SelectionScript script, Map<String, Serializable> bindings) { String scriptContent = script.getScript(); if (bindings != null) { for (Map.Entry<String, Serializable> entry : bindings.entrySet()) { String reservedKeyword = entry.getKey(); Serializable binding = entry.getValue(); if (binding instanceof Map) { scriptContent = replaceBindingKeysByTheirValue(scriptContent, (Map<String, Serializable>) binding); } else { <START> scriptContent = scriptContent.replace(reservedKeyword, binding.toString()); <END> } } } try { return new SelectionScript(scriptContent, script.getEngineName(), script.getParameters(), script.isDynamic()); } catch (InvalidScriptException e) { logger.warn("Error when replacing bindings of script (revert to use original script):" + System.lineSeparator() + script.toString(), e); return script; } }</code><technical_language>please add a defensive != null check (ideally a else if). Indeed, if binding == null, toString() result in a NPE</technical_language>

Target:
private SelectionScript replaceBindings(SelectionScript script, Map<String, Serializable> bindings) { String scriptContent = script.getScript(); if (bindings != null) { for (Map.Entry<String, Serializable> entry : bindings.entrySet()) { String reservedKeyword = entry.getKey(); Serializable binding = entry.getValue(); if (binding instanceof Map) { scriptContent = replaceBindingKeysByTheirValue(scriptContent, (Map<String, Serializable>) binding); } else { if (binding != null) { scriptContent = scriptContent.replace(reservedKeyword, binding.toString()); } } } } try { return new SelectionScript(scriptContent, script.getEngineName(), script.getParameters(), script.isDynamic()); } catch (InvalidScriptException e) { logger.warn("Error when replacing bindings of script (revert to use original script):" + System.lineSeparator() + script.toString(), e); return script; } }
Source:
<code>public boolean apply(Map.Entry mapEntry) { <START> Thread.dumpStack(); <END> PREDICATE_APPLY_COUNT.incrementAndGet(); return true; }</code><technical_language>debug leftover</technical_language>

Target:
public boolean apply(Map.Entry mapEntry) { PREDICATE_APPLY_COUNT.incrementAndGet(); return true; }
Source:
<code>private String[] addFilePathToArgs(String actualFilePath, String[] configuredArgs) { int argCount = configuredArgs.length; String[] allArgs = new String[argCount + 1]; System.arraycopy(configuredArgs, 0, allArgs, 1, argCount); <START> allArgs[0] = actualFilePath; <END> return allArgs; }</code><technical_language>Move line 51</technical_language>

Target:
private String[] addFilePathToArgs(String actualFilePath, String[] configuredArgs) { int argCount = configuredArgs.length; String[] allArgs = new String[argCount + 1]; allArgs[0] = actualFilePath; System.arraycopy(configuredArgs, 0, allArgs, 1, argCount); return allArgs; }
Source:
<code>public void createNamespaceWithNamespaceLengthLimit() throws AccumuloException, AccumuloSecurityException, NamespaceExistsException { StringBuilder namespaceBuilder = new StringBuilder(); for (int i = 0; i <= MAX_NAMESPACE_LEN; i++) { namespaceBuilder.append('a'); } String namespace = namespaceBuilder.toString(); c.namespaceOperations().create(namespace); <START> assertTrue(!c.namespaceOperations().exists(namespace)); <END> }</code><technical_language>suggestion assertFalse(c.namespaceOperations().exists(namespace));</technical_language>

Target:
public void createNamespaceWithNamespaceLengthLimit() throws AccumuloException, AccumuloSecurityException, NamespaceExistsException { StringBuilder namespaceBuilder = new StringBuilder(); for (int i = 0; i <= MAX_NAMESPACE_LEN; i++) { namespaceBuilder.append('a'); } String namespace = namespaceBuilder.toString(); try { c.namespaceOperations().create(namespace); fail("IllegalArgumentException was not thrown"); } catch (IllegalArgumentException exc) { assertTrue(!c.namespaceOperations().exists(namespace)); } }
Source:
<code>public void completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage) { initialize(); validateExitInformation(executionId, exitCode, endTime); exitMessage = trimExitMessage(exitMessage); taskExecutionDao.completeTaskExecution(executionId, exitCode, endTime, exitMessage); <START> logger.info("Updating: TaskExecution with executionId="+executionId <END> + " with the following {" + "exitCode=" + exitCode + ", endTime=" + endTime + ", exitMessage='" + exitMessage + '\'' + '}'); }</code><technical_language>Hmmm...in hind sight move this debug sensitive data automatically logged</technical_language>

Target:
public void completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage) { initialize(); validateExitInformation(executionId, exitCode, endTime); exitMessage = trimExitMessage(exitMessage); taskExecutionDao.completeTaskExecution(executionId, exitCode, endTime, exitMessage); logger.debug("Updating: TaskExecution with executionId="+executionId + " with the following {" + "exitCode=" + exitCode + ", endTime=" + endTime + ", exitMessage='" + exitMessage + '\'' + '}'); }
Source:
<code>public long writeTo(WritableByteChannel channel) throws IOException { long written = 0; if (sentBytes < sizeInBytes()) { if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.position(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.serializeBlobProperties(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.putShort((short) blobType.ordinal()); if (getVersionId() == PUT_REQUEST_VERSION_V4) { <START> short keyLength = blobKey == null ? 0 : (short) blobKey.length; <END> bufferToSend.putShort(keyLength); if (keyLength > 0) { bufferToSend.put(blobKey); } } bufferToSend.putLong(blobSize); crc.update(bufferToSend.array(), bufferToSend.arrayOffset() + crcStart, bufferToSend.position() - crcStart); crc.update(blob.array(), blob.arrayOffset(), blob.remaining()); crcBuf.putLong(crc.getValue()); crcBuf.flip(); bufferToSend.flip(); } if (bufferToSend.hasRemaining()) { written = channel.write(bufferToSend); } if (!bufferToSend.hasRemaining()) { written += channel.write(blob); okayToWriteCrc = !blob.hasRemaining(); } if (okayToWriteCrc && crcBuf.hasRemaining()) { written += channel.write(crcBuf); } sentBytes += written; } return written; }</code><technical_language>functionality question: is this allowed none? EAR is implemented, a situation is encrypted</technical_language>

Target:
public long writeTo(WritableByteChannel channel) throws IOException { long written = 0; if (sentBytes < sizeInBytes()) { if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.position(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.serializeBlobProperties(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.putShort((short) blobType.ordinal()); if (getVersionId() == PUT_REQUEST_VERSION_V4) { short keyLength = blobKey == null ? 0 : (short) blobKey.remaining(); bufferToSend.putShort(keyLength); if (keyLength > 0) { bufferToSend.put(blobKey); } } bufferToSend.putLong(blobSize); crc.update(bufferToSend.array(), bufferToSend.arrayOffset() + crcStart, bufferToSend.position() - crcStart); crc.update(blob.array(), blob.arrayOffset(), blob.remaining()); crcBuf.putLong(crc.getValue()); crcBuf.flip(); bufferToSend.flip(); } if (bufferToSend.hasRemaining()) { written = channel.write(bufferToSend); } if (!bufferToSend.hasRemaining()) { written += channel.write(blob); okayToWriteCrc = !blob.hasRemaining(); } if (okayToWriteCrc && crcBuf.hasRemaining()) { written += channel.write(crcBuf); } sentBytes += written; } return written; }
Source:
<code>private Map<Guid, List<VM>> mapVmToHost(List<VM> vms) { Map<Guid, List<VM>> hostToHaVmsMapping = new HashMap<Guid, List<VM>>(); for (VM vm : vms) { <START> if (vm.getRunOnVds() != null) { <END> if (!hostToHaVmsMapping.containsKey(vm.getRunOnVds())) { List<VM> vmsOfHost = new ArrayList<VM>(); vmsOfHost.add(vm); hostToHaVmsMapping.put(vm.getRunOnVds(), vmsOfHost); } else { hostToHaVmsMapping.get(vm.getRunOnVds()).add(vm); } } } return hostToHaVmsMapping; }</code><technical_language>safe side Guid.isNullOrEmpty()</technical_language>

Target:
public static Map<Guid, List<VM>> mapVmToHost(List<VM> vms) { Map<Guid, List<VM>> hostToHaVmsMapping = new HashMap<>(); for (VM vm : vms) { if (!Guid.isNullOrEmpty(vm.getRunOnVds())) { if (!hostToHaVmsMapping.containsKey(vm.getRunOnVds())) { List<VM> vmsOfHost = new ArrayList<VM>(); vmsOfHost.add(vm); hostToHaVmsMapping.put(vm.getRunOnVds(), vmsOfHost); } else { hostToHaVmsMapping.get(vm.getRunOnVds()).add(vm); } } } return hostToHaVmsMapping; }
Source:
<code>public void shortCircuitingEnabledWithExplicitModuleCounts() throws InterruptedException { String streamName = "shortCircuitingEnabledWithExplicitModuleCounts"; StreamDefinition sd = new StreamDefinition(streamName, "http | log"); integrationSupport.streamDefinitionRepository().save(sd); Map<String, String> props = new HashMap<String, String>(); props.put("module.http.count", "0"); props.put("module.log.count", "0"); integrationSupport.deployStream(sd, props); List<Binding> bindings = getMessageBusBindingsForStream(streamName); <START> System.out.println(bindings); <END> assertEquals(2, bindings.size()); Binding consumerBinding = bindings.get(0); Binding producerBinding = bindings.get(1); assertEquals("consumer", consumerBinding.getType()); assertEquals("direct", producerBinding.getType()); }</code><technical_language>intend leave this in</technical_language>

Target:
public void shortCircuitingEnabledWithExplicitModuleCounts() throws InterruptedException { String streamName = "shortCircuitingEnabledWithExplicitModuleCounts"; StreamDefinition sd = new StreamDefinition(streamName, "http | log"); integrationSupport.streamDefinitionRepository().save(sd); Map<String, String> props = new HashMap<String, String>(); props.put("module.http.count", "0"); props.put("module.log.count", "0"); integrationSupport.deployStream(sd, props); List<Binding> bindings = getMessageBusBindingsForStream(streamName); assertEquals(2, bindings.size()); Binding consumerBinding = bindings.get(0); Binding producerBinding = bindings.get(1); assertEquals("consumer", consumerBinding.getType()); assertEquals("direct", producerBinding.getType()); }
Source:
<code><START> public static int compareRpmPart(String part1, String part2) { <END> String[] comps1 = part1.split("\\."); String[] comps2 = part2.split("\\."); int i = 0; while (i < comps1.length && i < comps2.length && comps1[i].equals(comps2[i])) { i++; } if (i == comps1.length && i == comps2.length) { return 0; } else if (i == comps1.length) { return -1; } else if (i == comps2.length) { return 1; } else { try { Long result1 = Long.parseLong(comps1[i]); Long result2 = Long.parseLong(comps2[i]); return result1.compareTo(result2); } catch (NumberFormatException ex) { return comps1[i].compareTo(comps2[i]); } } }</code><technical_language>compareRpmParts .. s is missing</technical_language>

Target:
public static int compareRpmPart(String part1, String part2) { StringBuilder[] comps1 = fillCompsArray(part1); StringBuilder[] comps2 = fillCompsArray(part2); int counter = 0; while (comps1[counter] != null && comps2[counter] != null && comps1[counter].toString().equals(comps2[counter].toString())) { counter++; } if (counter == comps2.length) { return 1; } if (counter == comps1.length) { return -1; } Long longVal1 = parseLong(comps1[counter].toString()); Long longVal2 = parseLong(comps2[counter].toString()); if (longVal1 == null && longVal2 == null) { return comps1[counter].toString().compareTo(comps2[counter].toString()); } if (longVal1 != null && longVal2 != null) { return longVal1.compareTo(longVal2); } if (longVal1 == null) { return -1; } if (longVal2 == null) { return 1; } return 0; }
Source:
<code><START> protected AddCinderStorageDomainCommand(Guid <END> commandId) { super(commandId); }</code><technical_language>public</technical_language>

Target:
public AddCinderStorageDomainCommand(Guid commandId) { super(commandId); }
Source:
<code>public String readline() throws IOException { String str = null; boolean done = false; boolean sawCarriage = false; while (!done) { if (offset >= buffer.length || end - offset <= 0) { offset = 0; end = 0; readAmount(DEFAULT_READ_COUNT); } int curIndex = offset; for (; !done && curIndex < end; curIndex++) { if (buffer[curIndex] == '\n') { <START> sb.append(new String(buffer, offset, curIndex - offset)); <END> int count = 0; if (sawCarriage) { count += 1; } str = sb.substring(0, Math.max(0, sb.length() - count)); offset = curIndex + 1; done = true; } else { sawCarriage = buffer[curIndex] == '\r'; } } if (!done) { sb.append(new String(buffer, offset, end - offset)); offset = end; } } sb.setLength(0); return str; }</code><technical_language>need for intermediate String object. sb.append(buffer, offset, curIndex - offset)</technical_language>

Target:
public String readline() throws IOException { String str = null; boolean done = false; boolean sawCarriage = false; while (!done) { if (offset >= buffer.length || end - offset <= 0) { offset = 0; end = 0; readAmount(DEFAULT_READ_COUNT); } int curIndex = offset; for (; !done && curIndex < end; curIndex++) { if (buffer[curIndex] == '\n') { sb.append(buffer, offset, curIndex - offset); int count = 0; if (sawCarriage) { count += 1; } str = sb.substring(0, Math.max(0, sb.length() - count)); offset = curIndex + 1; done = true; } else { sawCarriage = buffer[curIndex] == '\r'; } } if (!done) { sb.append(buffer, offset, end - offset); offset = end; } } sb.setLength(0); return str; }
Source:
<code>private void addObjectInstrumentation(BytecodeInstruction instruction, InsnList instrumentation, MethodNode mn) { if(instruction.isLocalVariableDefinition()) { if(instruction.getASMNode().getOpcode() == Opcodes.ALOAD) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else { instrumentation.add(new InsnNode(Opcodes.ACONST_NULL)); } } else if(instruction.isLocalVariableUse()){ if(instruction.getASMNode().getOpcode() == Opcodes.ASTORE) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else { instrumentation.add(new InsnNode(Opcodes.ACONST_NULL)); } } else if(instruction.isArrayStoreInstruction()) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else if(instruction.isFieldNodeDU()) { Type type = Type.getType(instruction.getFieldType()); if(type.getSort() == Type.OBJECT) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else { instrumentation.add(new InsnNode(Opcodes.ACONST_NULL)); } } else if(instruction.isMethodCall()) { Type type = Type.getReturnType(instruction.getMethodCallDescriptor()); if(type.getSort() == Type.OBJECT) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else { instrumentation.add(new InsnNode(Opcodes.ACONST_NULL)); } <START> } <END> }</code><technical_language>remove this</technical_language>

Target:
private void addObjectInstrumentation(BytecodeInstruction instruction, InsnList instrumentation, MethodNode mn) { if(instruction.isLocalVariableDefinition()) { if(instruction.getASMNode().getOpcode() == Opcodes.ALOAD) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else { instrumentation.add(new InsnNode(Opcodes.ACONST_NULL)); } } else if(instruction.isLocalVariableUse()){ if(instruction.getASMNode().getOpcode() == Opcodes.ASTORE) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else { instrumentation.add(new InsnNode(Opcodes.ACONST_NULL)); } } else if(instruction.isArrayStoreInstruction()) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else if(instruction.isArrayLoadInstruction()) { instrumentation.add(new InsnNode(Opcodes.ACONST_NULL)); } else if(instruction.isFieldNodeDU()) { Type type = Type.getType(instruction.getFieldType()); if(type.getSort() == Type.OBJECT) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else { instrumentation.add(new InsnNode(Opcodes.ACONST_NULL)); } } else if(instruction.isMethodCall()) { Type type = Type.getReturnType(instruction.getMethodCallDescriptor()); if(type.getSort() == Type.OBJECT) { instrumentation.add(new InsnNode(Opcodes.DUP)); } else { instrumentation.add(new InsnNode(Opcodes.ACONST_NULL)); } } else { assert false : "Unknown instruction"; } }
Source:
<code>public List<Pool> createPoolsForSubscription(Subscription sub) { <START> return createPoolsForSubscription(sub, new ArrayList<Pool>()); <END> }</code><technical_language>want a LinkedList here, I ArrayList constructor allocates array initial size 10</technical_language>

Target:
public List<Pool> createPoolsForSubscription(Subscription sub) { return createPoolsForSubscription(sub, new LinkedList<Pool>()); }
Source:
<code>private void processPropertiesXml(File file, AppInfo app) { DTConfiguration config = new DTConfiguration(); try { config.loadFile(file); for (Map.Entry<String, ValueEntry> entry : config.getMap().entrySet()) { String key = entry.getKey(); ValueEntry valueEntry = entry.getValue(); <START> LOG.info("Properties: {}", key, valueEntry.value, valueEntry.description); <END> if (valueEntry.value == null) { if (app == null) { requiredProperties.add(key); } else { app.requiredProperties.add(key); } } else { if (app == null) { defaultProperties.put(key, valueEntry); } else { app.requiredProperties.remove(key); app.defaultProperties.put(key, valueEntry); } } } } catch (Exception ex) { LOG.warn("Ignoring META_INF/properties.xml because of error", ex); } }</code><technical_language>LOG.debug</technical_language>

Target:
private void processPropertiesXml(File file, AppInfo app) { DTConfiguration config = new DTConfiguration(); try { config.loadFile(file); for (Map.Entry<String, String> entry : config) { String key = entry.getKey(); String value = entry.getValue(); if (value == null) { if (app == null) { requiredProperties.add(key); } else { app.requiredProperties.add(key); } } else { String description = key.contains(".attr.") ? null : config.getDescription(key); PropertyInfo propertyInfo = new PropertyInfo(value, description); if (app == null) { defaultProperties.put(key, propertyInfo); } else { app.requiredProperties.remove(key); app.defaultProperties.put(key, propertyInfo); } } } } catch (Exception ex) { LOG.warn("Ignoring META_INF/properties.xml because of error", ex); } }
Source:
<code>private HiveAuthorizationTranslator getAuthorizationTranslator(HiveAuthorizer authorizer) { if(authorizer.getHiveAuthorizationTranslator() == null) { <START> return defaultAuthorizationTranslator ; <END> } }</code><technical_language>extra space</technical_language>

Target:
private HiveAuthorizationTranslator getAuthorizationTranslator(HiveAuthorizer authorizer) throws HiveAuthzPluginException { if (authorizer.getHiveAuthorizationTranslator() == null) { return defaultAuthorizationTranslator; } else { return (HiveAuthorizationTranslator)authorizer.getHiveAuthorizationTranslator(); } }
Source:
<code>public void read(BitBuffer input) throws CTFReaderException { currentField = tagDefinition.getValue(); Definition field = definitions.get(currentField); <START> if( field == null ) { <END> throw new CTFReaderException("Variant was not defined for "+ currentField); } field.read(input); }</code><technical_language>sssspppaaaacccciiiing :/</technical_language>

Target:
public void read(BitBuffer input) throws CTFReaderException { currentField = tagDefinition.getValue(); Definition field = definitions.get(currentField); if (field == null) { throw new CTFReaderException("Variant was not defined for: "+ currentField); } field.read(input); }
Source:
<code>public Flux<AmqpEndpointState> getEndpointStates() { <START> return connectionStates; <END> }</code><technical_language>rename this endpointStates</technical_language>

Target:
public Flux<AmqpEndpointState> getEndpointStates() { return endpointStates; }
Source:
<code>private static String toJson(String source) { Map<String, String> queryPairs; try { queryPairs = gson.<Map<String, String>>fromJson(source, Map.class); } catch (JsonSyntaxException notJsonException) { <START> queryPairs = new HashMap<>(); <END> Map<String, String> pairsToFill = queryPairs; Arrays.stream(source.split("&")) .forEach( p -> { int delimiterIndex = p.indexOf("="); pairsToFill.put(p.substring(0, delimiterIndex), p.substring(delimiterIndex + 1)); }); } return gson.toJson(queryPairs); }</code><technical_language>describe this usecase</technical_language>

Target:
private static String toJson(String source) { if (source == null) { return null; } try { gson.<Map<String, String>>fromJson(source, Map.class); return source; } catch (JsonSyntaxException notJsonException) { Map<String, String> queryPairs = new HashMap<>(); Arrays.stream(source.split("&")) .forEach( p -> { int delimiterIndex = p.indexOf("="); queryPairs.put(p.substring(0, delimiterIndex), p.substring(delimiterIndex + 1)); }); return gson.toJson(queryPairs); } }
Source:
<code>public ClusterFeature get() { Set<AdditionalFeature> addlFeatures = BackendClusterFeatureHelper.getClusterFeatures(this, version); AdditionalFeature feature = addlFeatures.stream() .filter(f -> <START> f.getId().equals(asGuid(id))) <END> .findFirst() .orElseThrow(() -> new WebApplicationException(Response.Status.NOT_FOUND)); return addLinks(ClusterFeaturesMapper.map(feature, null)); }</code><technical_language>base class a "guid" field contains "id" converted "Guid", "guid"</technical_language>

Target:
public ClusterFeature get() { AdditionalFeature feature = BackendClusterFeatureHelper.getClusterFeature(this, version, guid); if (feature == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } return addLinks(map(feature, null)); }