auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof MaxGauge)) { return false; } MaxGauge m = (MaxGauge) obj; return config.equals(m.getConfig()); <START> } <END></code><technical_language>is use-case for equality of gauge based config only? more sense default equals/hashCode for gauge expect equality checks config directly</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof MaxGauge)) { return false; } MaxGauge m = (MaxGauge) obj; return config.equals(m.getConfig()) && getValue(0).equals(m.getValue(0)); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); currentSelectedTimeInterpolator = new BounceInterpolator(); firstRunThrough = true; <START> <END> Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_animated_pin_drop); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); }</code><technical_language>assigned inline in class member definition</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_animated_pin_drop); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); }
Source:
<code>public IPath saveData(String filename) { IPath newDataLoc = getNewDataLocation(filename, DATA_EXT); IPath defaultDataLoc = PerfPlugin.getDefault().getPerfProfileData(); URI newDataLocURI = null; URI defaultDataLocURI = null; IRemoteFileProxy proxy = null; try { newDataLocURI = new URI(newDataLoc.toPortableString()); defaultDataLocURI = new URI(defaultDataLoc.toPortableString()); proxy = RemoteProxyManager.getInstance().getFileProxy(newDataLocURI); } catch (URISyntaxException e) { <START> e.printStackTrace(); <END> } catch (CoreException e) { e.printStackTrace(); } IFileStore newDataFileStore = proxy.getResource(newDataLocURI.getPath()); IFileStore defaultDataFileStore = proxy.getResource(defaultDataLocURI.getPath()); if (canSave(newDataLoc)) { try { defaultDataFileStore.copy(newDataFileStore, EFS.OVERWRITE, null); PerfPlugin.getDefault().setPerfProfileData(newDataLoc); try { PerfProfileView view = (PerfProfileView) PlatformUI .getWorkbench().getActiveWorkbenchWindow() .getActivePage().showView(PerfPlugin.VIEW_ID); view.setContentDescription(newDataLoc.toOSString()); } catch (PartInitException e) { } return newDataLoc; } catch (CoreException e1) { e1.printStackTrace(); } } return null; }</code><technical_language>Do print StackTrace handle better</technical_language>

Target:
public IPath saveData(String filename) { IPath newDataLoc = getNewDataLocation(filename, DATA_EXT); IPath defaultDataLoc = PerfPlugin.getDefault().getPerfProfileData(); URI newDataLocURI = null; URI defaultDataLocURI = null; IRemoteFileProxy proxy = null; try { newDataLocURI = new URI(newDataLoc.toPortableString()); defaultDataLocURI = new URI(defaultDataLoc.toPortableString()); proxy = RemoteProxyManager.getInstance().getFileProxy(newDataLocURI); } catch (URISyntaxException e) { openErroDialog(Messages.MsgProxyError, Messages.MsgProxyError, newDataLoc.lastSegment()); } catch (CoreException e) { openErroDialog(Messages.MsgProxyError, Messages.MsgProxyError, newDataLoc.lastSegment()); } IFileStore newDataFileStore = proxy.getResource(newDataLocURI.getPath()); IFileStore defaultDataFileStore = proxy.getResource(defaultDataLocURI.getPath()); if (canSave(newDataLoc)) { try { defaultDataFileStore.copy(newDataFileStore, EFS.OVERWRITE, null); PerfPlugin.getDefault().setPerfProfileData(newDataLoc); try { PerfProfileView view = (PerfProfileView) PlatformUI .getWorkbench().getActiveWorkbenchWindow() .getActivePage().showView(PerfPlugin.VIEW_ID); view.setContentDescription(newDataLoc.toOSString()); } catch (PartInitException e) { } return newDataLoc; } catch (CoreException e1) { openErroDialog(Messages.PerfSaveSession_failure_title, Messages.PerfSaveSession_failure_msg, newDataLoc.lastSegment()); } } return null; }
Source:
<code>protected boolean checkIfElementOnPage(String cssSelector) { driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS); try { driver.findElement(By.cssSelector(cssSelector)); } catch (NoSuchElementException ex) { <START> driver.manage().timeouts().implicitlyWait(timeOut, TimeUnit.SECONDS); <END> return false; } catch (StaleElementReferenceException ex) { driver.manage().timeouts().implicitlyWait(timeOut, TimeUnit.SECONDS); return false; } driver.manage().timeouts().implicitlyWait(timeOut, TimeUnit.SECONDS); return true; }</code><technical_language>driver.manage().timeouts().implicitlyWait(timeOut, TimeUnit.SECONDS); move finally statement</technical_language>

Target:
protected boolean checkIfElementOnPage(String cssSelector) { driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS); boolean isElementOnPage = true; try { driver.findElement(By.cssSelector(cssSelector)); } catch (Exception ex) { isElementOnPage = false; } finally { driver.manage().timeouts().implicitlyWait(timeOut, TimeUnit.SECONDS); } return isElementOnPage; }
Source:
<code>public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { return 1; } int result = 0; switch (object.getType()) { case INTEGER: IntegerStateValue other = (IntegerStateValue) object; result = Integer.compare(this.value, other.value); break; case DOUBLE: double otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); <START> double thisDoubleValue = this.value; <END> result = Double.compare(thisDoubleValue, otherDoubleValue); break; case LONG: long otherLongValue = ((LongStateValue) object).unboxLong(); result = Long.compare(this.value, otherLongValue); break; case NULL: result = 1; break; case STRING: result = -1; break; default: break; } return result; }</code><technical_language>remove this line this.value, do in other places</technical_language>

Target:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { return 1; } int result = 0; switch (object.getType()) { case INTEGER: IntegerStateValue other = (IntegerStateValue) object; result = Integer.compare(this.value, other.value); break; case DOUBLE: double otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); result = Double.compare(this.value, otherDoubleValue); break; case LONG: long otherLongValue = ((LongStateValue) object).unboxLong(); result = Long.compare(this.value, otherLongValue); break; case NULL: result = 1; break; case STRING: result = -1; break; default: break; } return result; }
Source:
<code>private static Set<Class<?>> getAllInterfaces(Class<?> clazz) { <START> Set<Class<?>> interfaces = new HashSet<>(); <END> for (Class<?> intf : clazz.getInterfaces()) { if (intf.getInterfaces().length > 0) { interfaces.addAll(getAllInterfaces(intf)); } interfaces.add(intf); } if (clazz.getSuperclass() != null) { interfaces.addAll(getAllInterfaces(clazz.getSuperclass())); } if (clazz.isInterface()) { interfaces.add(clazz); } return interfaces; }</code><technical_language>Instead of comparator fluff a linked hash map here</technical_language>

Target:
private static Set<Class<?>> getAllInterfaces(Class<?> clazz) { Set<Class<?>> interfaces = new LinkedHashSet<>(); for (Class<?> intf : clazz.getInterfaces()) { if (intf.getInterfaces().length > 0) { interfaces.addAll(getAllInterfaces(intf)); } interfaces.add(intf); } if (clazz.getSuperclass() != null) { interfaces.addAll(getAllInterfaces(clazz.getSuperclass())); } if (clazz.isInterface()) { interfaces.add(clazz); } return interfaces; }
Source:
<code>public Object evaluate(DeferredObject[] arguments) throws HiveException { assert maxMindGeocode != null : "Evaluate called without initializing 'geocodeCity'"; result.clear(); if (arguments.length == 1 && argumentOI != null && arguments[0] != null) { String ip = ((StringObjectInspector) argumentOI).getPrimitiveJavaObject(arguments[0].get()); Map<String, Object> geoDataResult = maxMindGeocode.getGeocodedData(ip); <START> if (geoDataResult != null) { <END> for (String field : geoDataResult.keySet()) { Object value = geoDataResult.get(field); if (value != null) { result.put(field, value.toString()); } } } } return result; }</code><technical_language>a Map<String, String>would do do need do casting</technical_language>

Target:
public Object evaluate(DeferredObject[] arguments) throws HiveException { assert maxMindGeocode != null : "Evaluate called without initializing 'geocodeCity'"; result.clear(); if (arguments.length == 1 && argumentOI != null && arguments[0] != null) { String ip = ((StringObjectInspector) argumentOI).getPrimitiveJavaObject(arguments[0].get()); Map<String, String > geoDataResult = maxMindGeocode.getResponse(ip).getMap(); if (geoDataResult != null) { for (String field : geoDataResult.keySet()) { Object value = geoDataResult.get(field); if (value != null) { result.put(field, value.toString()); } } } } return result; }
Source:
<code>private void showConfig(Class clazz) { OzoneConfiguration conf = new OzoneConfiguration(); <START> conf.addResource("http://localhost:9876/conf"); <END> ConfigGroup configGroup = (ConfigGroup) clazz.getAnnotation(ConfigGroup.class); if (configGroup == null) { return; } String prefix = configGroup.prefix(); for (Method method : clazz.getMethods()) { if (method.isAnnotationPresent(Config.class)) { Config config = method.getAnnotation(Config.class); String key = prefix + "." + config.key(); System.out.println(">>> " + key); System.out.println(" default: " + config.defaultValue()); System.out.println(" current: " + conf.get(key)); System.out.println(); System.out.println(config.description()); System.out.println(); System.out.println(); } } }</code><technical_language>Is this SCM-specific</technical_language>

Target:
private void showConfig(Class clazz) { OzoneConfiguration conf = new OzoneConfiguration(); conf.addResource(getHost(conf, new Component(Type.SCM)) + "/conf"); ConfigGroup configGroup = (ConfigGroup) clazz.getAnnotation(ConfigGroup.class); if (configGroup == null) { return; } String prefix = configGroup.prefix(); for (Method method : clazz.getMethods()) { if (method.isAnnotationPresent(Config.class)) { Config config = method.getAnnotation(Config.class); String key = prefix + "." + config.key(); System.out.println(">>> " + key); System.out.println(" default: " + config.defaultValue()); System.out.println(" current: " + conf.get(key)); System.out.println(); System.out.println(config.description()); System.out.println(); System.out.println(); } } }
Source:
<code>private Map<Locator, MetricData> getNumericOrStringDataForRange( List<Locator> locators, Range range, String columnFamily, Granularity gran ) throws IOException { <START> Map<Locator, MetricData> metrics = new HashMap<Locator, MetricData>(); <END> for ( final Locator locator : locators ) { MetricData data = super.getDatapointsForRange( new ArrayList<Locator>() {{ add( locator ); }}, range, columnFamily, gran ).get( locator ); if ( !data.getData().getPoints().isEmpty() ) { metrics.put( locator, data ); } else { metrics.putAll( getStringDataForRange( new ArrayList<Locator>() {{ add( locator ); }}, range ) ); } } return metrics; }</code><technical_language>In AstyanaxReader, is a call Instrumentation.markScanAllColumnFamilies() this method is called. Do want preserve that</technical_language>

Target:
private Map<Locator, MetricData> getNumericOrStringDataForRange( List<Locator> locators, Range range, String columnFamily, Granularity gran ) throws IOException { Instrumentation.markScanAllColumnFamilies(); Map<Locator, MetricData> metrics = new HashMap<Locator, MetricData>(); for ( final Locator locator : locators ) { MetricData data = super.getDatapointsForRange( new ArrayList<Locator>() {{ add( locator ); }}, range, columnFamily, gran ).get( locator ); if ( !data.getData().getPoints().isEmpty() ) { metrics.put( locator, data ); } else { metrics.putAll( getStringDataForRange( new ArrayList<Locator>() {{ add( locator ); }}, range ) ); } } return metrics; }
Source:
<code>static boolean algEquals(String algURI, String algName) { <START> if ((algName.equalsIgnoreCase("DSA") && <END> algURI.equalsIgnoreCase(SignatureMethod.DSA_SHA1)) || (algName.equalsIgnoreCase("RSA") && algURI.equalsIgnoreCase(SignatureMethod.RSA_SHA1))) { return true; } else { return false; } }</code><technical_language>return (algName.equalsIgnoreCase("DSA") && algURI.equalsIgnoreCase(SignatureMethod.DSA_SHA1)) || (algName.equalsIgnoreCase("RSA") && algURI.equalsIgnoreCase(SignatureMethod.RSA_SHA1));</technical_language>

Target:
private static boolean algEquals(String algURI, String algName) { return (algName.equalsIgnoreCase("DSA") && algURI.equalsIgnoreCase(SignatureMethod.DSA_SHA1)) || (algName.equalsIgnoreCase("RSA") && algURI.equalsIgnoreCase(SignatureMethod.RSA_SHA1)); }
Source:
<code>public void testInputFormatBuilderImplTest_ExecuteHints() { Map<String,String> hints = ImmutableMap.<String,String>builder().put("key1", "value1") .put("key2", "value2").put("key3", "value3").build(); formatBuilderTest.executionHints(hints); Map<String,String> executionHints = formatBuilderTest.getExecutionHints(); <START> assertEquals(executionHints.toString(), hints.toString()); <END> }</code><technical_language>I order of entries in maps undetermined. want sort expected actual ensure this randomly break in future</technical_language>

Target:
public void testInputFormatBuilderImplTest_ExecuteHints() { SortedMap<String,String> hints = new TreeMap<>(); hints.put("key1", "value1"); hints.put("key2", "value2"); hints.put("key3", "value3"); formatBuilderTest.executionHints(hints); SortedMap<String,String> executionHints = formatBuilderTest.getExecutionHints(); assertEquals(hints.toString(), executionHints.toString()); }
Source:
<code>public boolean managedCheckConnection() { boolean isValid = true; try { checkConnection(); } catch (IOException ioEx) { isValid = false; <START> log.error("JMX check connection: {}", ioEx); <END> } return isValid; }</code><technical_language>want log error ? read, this is nominal case</technical_language>

Target:
public boolean managedCheckConnection() { boolean isValid = true; try { checkConnection(); } catch (IOException ioEx) { isValid = false; log.debug("JMX check connection: {}", ioEx); } return isValid; }
Source:
<code>public void onCompletion(Void result, Exception exception) { long processingStartTimeMs = SystemTime.getInstance().milliseconds(); metrics.getSignedUrlSecurityPostProcessRequestTimeInMs.update(processingStartTimeMs - operationStartTimeMs); try { if (exception == null) { String signedUrl = urlSigningService.getSignedUrl(restRequest); LOGGER.debug("Generated from {}", signedUrl, restRequest); restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); restResponseChannel.setHeader(RestUtils.Headers.SIGNED_URL, signedUrl); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, 0); final long processResponseStartTimeMs = SystemTime.getInstance().milliseconds(); securityService.processResponse(restRequest, restResponseChannel, null, <START> (voidResult, processResponseException) -> { <END> metrics.getSignedUrlSecurityResponseTimeInMs.update( SystemTime.getInstance().milliseconds() - processResponseStartTimeMs); callback.onCompletion(null, processResponseException); }); } } catch (Exception e) { exception = e; } finally { metrics.getSignedUrlProcessingTimeInMs.update(SystemTime.getInstance().milliseconds() - processingStartTimeMs); if (exception != null) { callback.onCompletion(null, exception); } } }</code><technical_language>minor: instead of voidResult processResponseResult name</technical_language>

Target:
public void onCompletion(Void result, Exception exception) { long processingStartTimeMs = SystemTime.getInstance().milliseconds(); metrics.getSignedUrlSecurityPostProcessRequestTimeInMs.update(processingStartTimeMs - operationStartTimeMs); try { if (exception == null) { String signedUrl = urlSigningService.getSignedUrl(restRequest); LOGGER.debug("Generated from {}", signedUrl, restRequest); restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); restResponseChannel.setHeader(RestUtils.Headers.SIGNED_URL, signedUrl); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, 0); final long processResponseStartTimeMs = SystemTime.getInstance().milliseconds(); securityService.processResponse(restRequest, restResponseChannel, null, (processResponseResult, processResponseException) -> { metrics.getSignedUrlSecurityResponseTimeInMs.update( SystemTime.getInstance().milliseconds() - processResponseStartTimeMs); callback.onCompletion(null, processResponseException); }); } } catch (Exception e) { exception = e; } finally { metrics.getSignedUrlProcessingTimeInMs.update(SystemTime.getInstance().milliseconds() - processingStartTimeMs); if (exception != null) { callback.onCompletion(null, exception); } } }
Source:
<code>public String getSummaryMessage() { NumberFormat formatSize = NumberFormat.getInstance(); formatSize.setMaximumFractionDigits(2); formatSize.setMinimumFractionDigits(2); SizeConverter.Size sizeMoved= SizeConverter.autoConvert(statusSummary.getTotalSizeMoved(),SizeUnit.BYTES); StringBuilder builder = new StringBuilder(); builder.append("Files [scanned: ") .append(statusSummary.getFilesScanned()) .append(", moved: ") .append(statusSummary.getFilesMoved()) .append(", failed: ") .append(statusSummary.getFilesFailed()) .append(", Total size moved: ") <START> .append((formatSize.format(sizeMoved.getValue())).toString().concat(" ").concat(sizeMoved.getUnit().toString())); <END> return builder.toString(); }</code><technical_language>NumberFormat.format(long number) return String, need call toString(). is simpler StringBuilder in this context, i.e.: new StringBuilder(formatSize.format(sizeMoved.getValue()).appent(" ").append(sizeMoved.getUnit()).toString()</technical_language>

Target:
public String getSummaryMessage() { SizeConverter.Size sizeMoved= SizeConverter.autoConvert(statusSummary.getTotalSizeMoved(), SizeUnit.BYTES); StringBuilder builder = new StringBuilder(); builder.append("Files [scanned: ") .append(statusSummary.getFilesScanned()) .append(", moved: ") .append(statusSummary.getFilesMoved()) .append(", failed: ") .append(statusSummary.getFilesFailed()) .append(", Total size moved: ") .append(sizeMoved.getValue().toString().concat(" ").concat(sizeMoved.getUnit().toString())); return builder.toString(); }
Source:
<code>private static void initializeProviders() { RuntimeEnvironment.application = spy(RuntimeEnvironment.application); when(RuntimeEnvironment.application.getApplicationContext()) .thenReturn(RuntimeEnvironment.application); Resources spiedResources = spy(RuntimeEnvironment.application.getResources()); when(RuntimeEnvironment.application.getResources()).thenReturn(spiedResources); <START> when(spiedResources.getString(R.string.default_web_client_id)).thenReturn("abc"); <END> when(spiedResources.getString(R.string.facebook_application_id)).thenReturn("abc"); when(spiedResources.getString(R.string.twitter_consumer_key)).thenReturn("abc"); when(spiedResources.getString(R.string.twitter_consumer_secret)).thenReturn("abc"); }</code><technical_language>nit: want extract this a test helper that: * spies runtime application context * Provides a static method for resource override generally useful</technical_language>

Target:
private static void initializeProviders() { Context context = RuntimeEnvironment.application; when(context.getString(R.string.default_web_client_id)).thenReturn("abc"); when(context.getString(R.string.facebook_application_id)).thenReturn("abc"); when(context.getString(R.string.twitter_consumer_key)).thenReturn("abc"); when(context.getString(R.string.twitter_consumer_secret)).thenReturn("abc"); }
Source:
<code>public static List<Visit> getPatientsWithActiveVisitsFilteredByQuery(List<Visit> visitList, String query) { List<Visit> filteredList = new ArrayList<>(); for (Visit visit : visitList) { <START> Patient patient = new PatientDAO().findPatientByID(visit.getPatient().getId().toString()); <END> List<String> patientsWithActiveVisitsSearchableWords = new ArrayList<>(); patientsWithActiveVisitsSearchableWords.addAll(getVisitSearchableWords(visit)); patientsWithActiveVisitsSearchableWords.addAll(getPatientSearchableWords(patient)); if (doesAnySearchableWordFitQuery(patientsWithActiveVisitsSearchableWords, query)) { filteredList.add(visit); } } return filteredList; }</code><technical_language>I call DAO in Utils</technical_language>

Target:
public static List<Visit> getPatientsWithActiveVisitsFilteredByQuery(List<Visit> visitList, String query) { List<Visit> filteredList = new ArrayList<>(); for (Visit visit : visitList) { Patient patient = visit.getPatient(); List<String> patientsWithActiveVisitsSearchableWords = new ArrayList<>(); patientsWithActiveVisitsSearchableWords.addAll(getVisitSearchableWords(visit)); patientsWithActiveVisitsSearchableWords.addAll(getPatientSearchableWords(patient)); if (doesAnySearchableWordFitQuery(patientsWithActiveVisitsSearchableWords, query)) { filteredList.add(visit); } } return filteredList; }
Source:
<code>public void testUpdateLUNsDeviceSize() { int testDeviceSize = 20; dao.updateLUNsDeviceSize(existingLUN.getLUN_id(), testDeviceSize); LUNs dbLun = dao.get(existingLUN.getLUN_id()); <START> assertEquals("LUNs volume group id wasn't updated", testDeviceSize, dbLun.getDeviceSize()); <END> }</code><technical_language>message is related</technical_language>

Target:
public void testUpdateLUNsDeviceSize() { int testDeviceSize = 20; dao.updateLUNsDeviceSize(existingLUN.getLUN_id(), testDeviceSize); LUNs dbLun = dao.get(existingLUN.getLUN_id()); assertEquals("LUN device size wasn't updated", testDeviceSize, dbLun.getDeviceSize()); }
Source:
<code>public boolean remove(T t) { boolean result = consumers.remove(t); if (result) { <START> changedIteratorFieldUpdater.set(this, consumers.resettableIterator()); <END> } return result; }</code><technical_language>lazeSet is enough for single-writer/single-threaded semantic</technical_language>

Target:
public boolean remove(T t) { boolean result = consumers.remove(t); if (result) { iterator.update(consumers.resettableIterator()); } return result; }
Source:
<code>public void assignTask(Task task, TaskContext context, String excludedUser) { if (!isEnabled()) { <START> logger.debug("AssignmentService is not enabled - to enable it set system property 'org.jbpm.task.assignment.enabled' to true"); <END> return; } if (task.getTaskData().getActualOwner() != null) { logger.debug("Task has already been assigned to single actor {}", task.getId(), task.getTaskData().getActualOwner()); return; } Assignment assignTo = this.strategy.apply(task, context, excludedUser); if (assignTo == null || assignTo.getUser() == null) { logger.warn("Strategy did not return any assignment for task {}", strategy, task); return; } logger.debug("Actual owner returned by strategy is for task {}", strategy, assignTo, task); User actualOwner = taskModelFactory.newUser(assignTo.getUser()); ((InternalTaskData) task.getTaskData()).setActualOwner(actualOwner); ((InternalTaskData) task.getTaskData()).setStatus(Status.Reserved); }</code><technical_language>property name defined a constant - twice</technical_language>

Target:
public void assignTask(Task task, TaskContext context, String excludedUser) { if (!isEnabled()) { logger.debug("AssignmentService is not enabled - to enable it set system property '" + ENABLED_PROPERTY + "' to true"); return; } if (task.getTaskData().getActualOwner() != null) { logger.debug("Task has already been assigned to single actor {}", task.getId(), task.getTaskData().getActualOwner()); return; } Assignment assignTo = this.strategy.apply(task, context, excludedUser); if (assignTo == null || assignTo.getUser() == null) { logger.warn("Strategy did not return any assignment for task {}", strategy, task); return; } logger.debug("Actual owner returned by strategy is for task {}", strategy, assignTo, task); User actualOwner = taskModelFactory.newUser(assignTo.getUser()); ((InternalTaskData) task.getTaskData()).setActualOwner(actualOwner); ((InternalTaskData) task.getTaskData()).setStatus(Status.Reserved); }
Source:
<code>private boolean bootstrap() { ServersInfo serversInfo = ServersInfoExtractor.getInfo(objectEnablers); if (serversInfo.bootstrap == null) { LOG.error("Missing info to boostrap the client"); return false; } <START> if (bootstrapHandler.tryToInitSession(serversInfo.bootstrap)) { <END> LOG.info("Starting bootstrap session "); ServerInfo boostrapServer = serversInfo.bootstrap; BootstrapResponse response = sender.send(boostrapServer.getAddress(), boostrapServer.isSecure(), new BootstrapRequest(endpoint), null); if (response == null) { LOG.error("Bootstrap failed: timeout"); return false; } else if (response.getCode() == ResponseCode.CHANGED) { LOG.info("Bootstrap started"); boolean timeout = !bootstrapHandler.waitBoostrapFinished(BS_TIMEOUT); if (timeout) { LOG.error("Bootstrap sequence timeout"); bootstrapHandler.cancelSession(); return false; } else { serversInfo = ServersInfoExtractor.getInfo(objectEnablers); LOG.info("Bootstrap finished {}", serversInfo); return true; } } else { LOG.error("Bootstrap failed: {}", response.getCode()); return false; } } else { LOG.info("Bootstrap sequence already started"); return false; } }</code><technical_language>try/catch/finaly</technical_language>

Target:
private boolean bootstrap() { ServersInfo serversInfo = ServersInfoExtractor.getInfo(objectEnablers); if (serversInfo.bootstrap == null) { throw new IllegalStateException("Missing info to boostrap the client"); } if (bootstrapHandler.tryToInitSession(serversInfo.bootstrap)) { LOG.info("Starting bootstrap session "); try { ServerInfo boostrapServer = serversInfo.bootstrap; BootstrapResponse response = sender.send(boostrapServer.getAddress(), boostrapServer.isSecure(), new BootstrapRequest(endpoint), null); if (response == null) { LOG.error("Bootstrap failed: timeout"); return false; } else if (response.isSuccess()) { LOG.info("Bootstrap started"); boolean timeout = !bootstrapHandler.waitBoostrapFinished(BS_TIMEOUT); if (timeout) { LOG.error("Bootstrap sequence timeout"); return false; } else { serversInfo = ServersInfoExtractor.getInfo(objectEnablers); LOG.info("Bootstrap finished {}", serversInfo); return true; } } else { LOG.error("Bootstrap failed: {}", response.getCode()); return false; } } finally { bootstrapHandler.closeSession(); } } else { LOG.info("Bootstrap sequence already started"); return false; } }
Source:
<code>Builder codecRegistry(CodecRegistry registry) { this.codecRegistry = checkNotNull(registry, "registry"); <START> this.fieldNamingStrategy = null; <END> return this; }</code><technical_language>kinda ok 1. fully share dislike introducing APIs 2. I guess I get heading, fully understand yet,</technical_language>

Target:
public Builder codecRegistry(CodecRegistry registry) { return codecRegistry(registry, FieldNamingStrategy.DEFAULT); }
Source:
<code>private void makeDelegate() throws IOException { CompressionFactory.LongEncodingWriter writer; long delta; try { delta = LongMath.checkedSubtract(maxVal, minVal); } catch (ArithmeticException e) { delta = -1; } if (uniqueValues.size() <= CompressionFactory.MAX_TABLE_SIZE) { writer = new TableLongEncodingWriter(uniqueValues, valuesAddedInOrder); } else if (delta != -1 && delta != Long.MAX_VALUE) { writer = new DeltaLongEncodingWriter(minVal, delta); } else { writer = new LongsLongEncodingWriter(order); } if (compression == CompressedObjectStrategy.CompressionStrategy.NONE) { delegate = new EntireLayoutLongSupplierSerializer( ioPeon, filenameBase, order, writer ); } else { delegate = new BlockLayoutLongSupplierSerializer( ioPeon, filenameBase, order, writer, compression ); } try (DataInputStream tempIn = new DataInputStream(new BufferedInputStream(ioPeon.makeInputStream(tempFile)))) { delegate.open(); <START> int available = tempIn.available(); <END> while (available > 0) { delegate.add(tempIn.readLong()); available -= Longs.BYTES; } } }</code><technical_language>Hmm, original code kind of sketchy. "available" is: > Returns estimate of number of remaining bytes read (or skipped over) this input stream blocking next invocation of a method for this input stream. this method wants read entire file. I a bug in original code, fix improve speed fix bug. reading numInserted longs instead of checking available()</technical_language>

Target:
private void makeDelegate() throws IOException { CompressionFactory.LongEncodingWriter writer; long delta; try { delta = LongMath.checkedSubtract(maxVal, minVal); } catch (ArithmeticException e) { delta = -1; } if (uniqueValues.size() <= CompressionFactory.MAX_TABLE_SIZE) { writer = new TableLongEncodingWriter(uniqueValues, valuesAddedInOrder); } else if (delta != -1 && delta != Long.MAX_VALUE) { writer = new DeltaLongEncodingWriter(minVal, delta); } else { writer = new LongsLongEncodingWriter(order); } if (compression == CompressedObjectStrategy.CompressionStrategy.NONE) { delegate = new EntireLayoutLongSupplierSerializer( ioPeon, filenameBase, order, writer ); } else { delegate = new BlockLayoutLongSupplierSerializer( ioPeon, filenameBase, order, writer, compression ); } try (DataInputStream tempIn = new DataInputStream(new BufferedInputStream(ioPeon.makeInputStream(tempFile)))) { delegate.open(); int available = numInserted; while (available > 0) { delegate.add(tempIn.readLong()); available--; } } }
Source:
<code>public boolean hasPermission(String sid, Permission p) { <START> final SecurityRealm securityRealm = Jenkins.getInstance().getSecurityRealm(); <END> final IdStrategy groupIdStrategy = securityRealm.getGroupIdStrategy(); final IdStrategy userIdStrategy = securityRealm.getUserIdStrategy(); for (; p != null; p = p.impliedBy) { if (!p.getEnabled()) { continue; } Set<String> set = grantedPermissions.get(p); if (set != null && set.contains(sid)) return true; if (set != null) { for (String s: set) { if (userIdStrategy.equals(s, sid) || groupIdStrategy.equals(s, sid)) { return true; } } } } return false; }</code><technical_language>Null check required</technical_language>

Target:
public boolean hasPermission(String sid, Permission p) { final SecurityRealm securityRealm = Jenkins.getActiveInstance().getSecurityRealm(); final IdStrategy groupIdStrategy = securityRealm.getGroupIdStrategy(); final IdStrategy userIdStrategy = securityRealm.getUserIdStrategy(); for (; p != null; p = p.impliedBy) { if (!p.getEnabled()) { continue; } Set<String> set = grantedPermissions.get(p); if (set != null && set.contains(sid)) return true; if (set != null) { for (String s: set) { if (userIdStrategy.equals(s, sid) || groupIdStrategy.equals(s, sid)) { return true; } } } } return false; }
Source:
<code><START> void updateDataSourcesTable() { <END> if ((null == db) || (null == sleuthKitCase)) { return ; } try { List<DataSource> dataSources = sleuthKitCase.getDataSources(); dataSources.forEach((dataSource) -> { db.insertDataSource(dataSource.getId()); }); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Image Gallery failed to update data_sources table.", ex); } }</code><technical_language>I this method private</technical_language>

Target:
private void updateDataSourcesTable() { if ((null == getDatabase()) || (null == getSleuthKitCase())) { return; } try { List<DataSource> dataSources = getSleuthKitCase().getDataSources(); dataSources.forEach((dataSource) -> { getDatabase().insertDataSource(dataSource.getId()); }); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Image Gallery failed to update data_sources table.", ex); } }
Source:
<code>if (checkUse("use.SunJCE")) { try{ <START> int max = Cipher.getMaxAllowedKeyLength("AES"); <END> KeyGenerator kgen = KeyGenerator.getInstance("AES", "SunJCE"); kgen.init(256); } catch(Throwable e) { final String msg = "Error with SunJCE. Unlimited policy file not installed."; Logger.warning(NSSLoader.class, msg, e); } SunJCE = Security.getProvider("SunJCE"); }</code><technical_language>I find usage of this variable. used? If not, remove it</technical_language>

Target:
if (checkUse("use.SunJCE")) { try{ KeyGenerator kgen = KeyGenerator.getInstance("AES", "SunJCE"); kgen.init(256); } catch(Throwable e) { Logger.warning(NSSLoader.class, "Error with SunJCE. Unlimited policy file not installed.", e); } SunJCE = Security.getProvider("SunJCE"); }
Source:
<code>public void onSubscribe(Subscription subscription) { this.actual.onSubscribe(new Subscription() { @Override public void request(long n) { subscription.request(n); } @Override public void cancel() { <START> terminateSpan(CancelledSubscriptionException.INSTANCE); <END> subscription.cancel(); } }); }</code><technical_language>I generally publicly exposing new exception types especially encourages people lock instrumentation code types. Secondarily, effect desired is add error tag allocating exceptions cheap. If cancel is error, is debatable, please delete exception add a tag("error", "canceled"); if is existing practice in webflux calling canceled exceptions, revisit this well</technical_language>

Target:
public void onSubscribe(Subscription subscription) { this.actual.onSubscribe(subscription); }
Source:
<code>public void nullToSynapseFriendlyNameThrowsException() { assertEquals("", BridgeUtils.toSynapseFriendlyName(null)); <START> } <END></code><technical_language>Minor: need for assert in emptyStringToSynapseFriendlyName(), BridgeUtils throw assert is called</technical_language>

Target:
public void nullToSynapseFriendlyNameThrowsException() { BridgeUtils.toSynapseFriendlyName(null); }
Source:
<code>public Map<String, Object> constructTimeframeArgs() { Map<String, Object> timeframe = null; if (start != null && end != null) { <START> Map<String, Object> absoluteTimeframe = new HashMap<String, Object>(2); <END> absoluteTimeframe.put(KeenQueryConstants.START, start); absoluteTimeframe.put(KeenQueryConstants.END, end); timeframe = new HashMap<String, Object>(1); timeframe.put(KeenQueryConstants.TIMEFRAME, absoluteTimeframe); return timeframe; } return timeframe; }</code><technical_language>I this end re-allocating object is added hash map capacity threshold</technical_language>

Target:
public Map<String, Object> constructTimeframeArgs() { Map<String, Object> timeframe = null; if (start != null && end != null) { Map<String, Object> absoluteTimeframe = new HashMap<String, Object>(3); absoluteTimeframe.put(KeenQueryConstants.START, start); absoluteTimeframe.put(KeenQueryConstants.END, end); timeframe = new HashMap<String, Object>(2); timeframe.put(KeenQueryConstants.TIMEFRAME, absoluteTimeframe); return timeframe; } return timeframe; }
Source:
<code>private Map<String,String> splitURL(String url) throws DotDataException{ String hostId = Host.SYSTEM_HOST; <START> int hostSplit = url.indexOf(":"); <END> if(hostSplit != -1){ String hostName = url.substring(0, url.lastIndexOf(":")); url = url.substring(hostSplit+2); hostId = findHostId(hostName); } return map("siteId", hostId, "uri", url); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Put single-quotes ':' faster "indexOf(char)" method. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private Map<String, String> splitURL(String url) throws DotDataException { String hostId = Host.SYSTEM_HOST; String newURL = ""; int hostSplit = url.indexOf(':'); if (hostSplit != -1) { String hostName = url.substring(0, url.lastIndexOf(':')); newURL = url.substring(hostSplit + INT_2); hostId = findHostId(hostName); } return map("siteId", hostId, "uri", newURL); }
Source:
<code>private String getKeepAliveProperty() { try { return getPropertyAccessor().getProperty(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.KEEP_ALIVE_PROP); } catch (PropertyAccessException ex) { <START> LOG.warn("Unable to access property: ", NhincConstants.KEEP_ALIVE_PROP, ex); <END> return null; } }</code><technical_language>Please LOG.warn("Unable access property: {}", NhincConstants.KEEP_ALIVE_PROP, ex.getLocalizedMessage) reduce stack trace</technical_language>

Target:
private String getKeepAliveProperty() { try { return getPropertyAccessor().getProperty(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.KEEP_ALIVE_PROP); } catch (PropertyAccessException ex) { LOG.warn("Unable to access property: {}", NhincConstants.KEEP_ALIVE_PROP, ex.getLocalizedMessage()); return null; } }
Source:
<code>private void fillTestData(TestData xml, ITDManager po) { for (String uniqueId : po.getUniqueIds()) { xml.addUniqueIds(uniqueId); } int rowCnt = 1; for (IDataSetPO row : po.getDataSets()) { TestDataRow xmlRow = xml.addNewRow(); xmlRow.setRowCount(rowCnt++); int <START> colCnt = <END> 1; for (int col = 0; col < row.getColumnCount(); col++) { TestDataCell xmlCell = xmlRow.addNewData(); xmlCell.setColumnCount(colCnt++); xmlCell.setValue(row.getValueAt(col)); } } }</code><technical_language>Please column index</technical_language>

Target:
private void fillTestData(TestData xml, ITDManager po) { for (String uniqueId : po.getUniqueIds()) { xml.addUniqueIds(uniqueId); } int rowCnt = 1; for (IDataSetPO row : po.getDataSets()) { TestDataRow xmlRow = xml.addNewRow(); xmlRow.setRowCount(rowCnt++); for (int col = 0; col < row.getColumnCount(); col++) { TestDataCell xmlCell = xmlRow.addNewData(); xmlCell.setColumnCount(col + 1); xmlCell.setValue(row.getValueAt(col)); } } }
Source:
<code>public void getFileContentRest() throws Exception { Put.Input in = new Put.Input(); in.content = RestSession.newRawInput(CONTENT_NEW); <START> assertEquals(204, session.putRaw(urlEditFile(), <END> in.content).getStatusCode()); Optional<ChangeEdit> edit = editUtil.byChange(change); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( edit.get(), FILE_NAME, CONTENT_NEW2)); edit = editUtil.byChange(change); RestResponse r = session.get(urlEditFile()); assertEquals(HttpStatus.SC_OK, r.getStatusCode()); String content = r.getEntityContent(); assertEquals(StringUtils.newStringUtf8(CONTENT_NEW2), StringUtils.newStringUtf8(Base64.decodeBase64(content))); }</code><technical_language>Constant</technical_language>

Target:
public void getFileContentRest() throws Exception { Put.Input in = new Put.Input(); in.content = RestSession.newRawInput(CONTENT_NEW); assertEquals(SC_NO_CONTENT, session.putRaw(urlEditFile(), in.content).getStatusCode()); Optional<ChangeEdit> edit = editUtil.byChange(change); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( edit.get(), FILE_NAME, CONTENT_NEW2)); edit = editUtil.byChange(change); RestResponse r = session.get(urlEditFile()); assertEquals(SC_OK, r.getStatusCode()); String content = r.getEntityContent(); assertEquals(StringUtils.newStringUtf8(CONTENT_NEW2), StringUtils.newStringUtf8(Base64.decodeBase64(content))); }
Source:
<code>public void createDecorators(IDecoratorTarget decoratorTarget) { <START> EditPart editPart = decoratorTarget.getAdapter(EditPart.class); <END> if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) { Object model = editPart.getModel(); if ((model instanceof View)) { View view = (View) model; if (!(view instanceof Edge) && !view.isSetElement()) { return; } } EditDomain ed = editPart.getViewer().getEditDomain(); if (!(ed instanceof DiagramEditDomain)) { return; } if (((DiagramEditDomain) ed).getEditorPart() instanceof SiriusDiagramEditor) { decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget)); } } }</code><technical_language>cast removed avoid compilation errors Eclipse versions do generified getAdapter</technical_language>

Target:
public void createDecorators(IDecoratorTarget decoratorTarget) { EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class); if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) { Object model = editPart.getModel(); if ((model instanceof View)) { View view = (View) model; if (!(view instanceof Edge) && !view.isSetElement()) { return; } } EditDomain ed = editPart.getViewer().getEditDomain(); if (!(ed instanceof DiagramEditDomain)) { return; } if (((DiagramEditDomain) ed).getEditorPart() instanceof SiriusDiagramEditor) { decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget)); } } }
Source:
<code>public CheServicesEnvironmentImpl parse(Environment environment) throws IllegalArgumentException, ServerException { checkNotNull(environment, "Environment should not be null"); EnvironmentRecipe recipe = environment.getRecipe(); checkNotNull(recipe, "Environment recipe should not be null"); checkNotNull(recipe.getType(), "Environment recipe type should not be null"); checkArgument(recipe.getContent() != null || recipe.getLocation() != null, "Recipe of environment must contain location or content"); CheServicesEnvironmentImpl cheServicesEnvironment; String envType = recipe.getType(); switch (envType) { case COMPOSE: EnvironmentRecipeParser composeParser = environmentParsers.get(COMPOSE); cheServicesEnvironment = composeParser.parse(recipe); break; <START> case DOCKER_IMAGE: <END> case DOCKER_FILE: cheServicesEnvironment = parseDocker(environment); break; default: throw new IllegalArgumentException(format("Environment type '%s' is not supported. " + "Supported environment types: %s", envType, Joiner.on(", ").join(envTypes))); } cheServicesEnvironment.getServices().forEach((name, service) -> { ExtendedMachine extendedMachine = environment.getMachines().get(name); if (extendedMachine != null) { normalizeMachine(name, service, extendedMachine); } }); return cheServicesEnvironment; }</code><technical_language>values hardcoded</technical_language>

Target:
public CheServicesEnvironmentImpl parse(Environment environment) throws IllegalArgumentException, ServerException { checkNotNull(environment, "Environment should not be null"); EnvironmentRecipe recipe = environment.getRecipe(); checkNotNull(recipe, "Environment recipe should not be null"); checkNotNull(recipe.getType(), "Environment recipe type should not be null"); checkArgument(recipe.getContent() != null || recipe.getLocation() != null, "Recipe of environment must contain location or content"); String envType = recipe.getType(); Set<String> envTypes = getEnvironmentTypes(); if (!envTypes.contains(envType)) { throw new IllegalArgumentException(format("Environment type '%s' is not supported. " + "Supported environment types: %s", envType, Joiner.on(", ").join(envTypes))); } TypeSpecificEnvironmentParser parser = environmentParsers.get(envType); CheServicesEnvironmentImpl cheServicesEnvironment = parser.parse(environment); cheServicesEnvironment.getServices().forEach((name, service) -> { ExtendedMachine extendedMachine = environment.getMachines().get(name); if (extendedMachine != null) { normalizeMachine(name, service, extendedMachine); } }); return cheServicesEnvironment; }
Source:
<code>public void addQuotaPermissionSubject(List<PermissionSubject> quotaPermissionList) { if (getStoragePool() != null && getQuotaId() != null && <START> !getStoragePool().getQuotaEnforcementType().equals(QuotaEnforcementTypeEnum.DISABLED)) { <END> VM vm = getVmDAO().get(getVmId()); if (vm != null && !getQuotaId().equals(vm.getQuotaId())) { quotaPermissionList.add(new PermissionSubject(getQuotaId(), VdcObjectType.Quota, ActionGroup.CONSUME_QUOTA)); } } }</code><technical_language>getVm()</technical_language>

Target:
public void addQuotaPermissionSubject(List<PermissionSubject> quotaPermissionList) { if (getStoragePool() != null && getQuotaId() != null && !getStoragePool().getQuotaEnforcementType().equals(QuotaEnforcementTypeEnum.DISABLED)) { VM vm = getVm(); if (vm != null && !getQuotaId().equals(vm.getQuotaId())) { quotaPermissionList.add(new PermissionSubject(getQuotaId(), VdcObjectType.Quota, ActionGroup.CONSUME_QUOTA)); } } }
Source:
<code>protected void updateAvatar(){ if (mUser == null || mAvatarController == null){ return; } if (Thread.currentThread() != Looper.getMainLooper().getThread()){ post(new Runnable() { @Override public void run() { updateAvatar(); } }); return; } final File avatarFile = mAvatarController.getAvatarFile(mUser.getId()); if (avatarFile.exists()){ mAvatar.setImageDrawable(Drawable.createFromPath(avatarFile.getAbsolutePath())); mAvatar.setVisibility(View.VISIBLE); mInitials.setVisibility(View.GONE); } else { <START> String name = ""; <END> if (mUser instanceof BoxCollaborator){ name = mUser.getName(); } else if (SdkUtils.isBlank(name) && mUser instanceof BoxUser){ name = ((BoxUser) mUser).getLogin(); } SdkUtils.setInitialsThumb(getContext(), mInitials, name); mAvatar.setVisibility(View.GONE); mInitials.setVisibility(View.VISIBLE); mAvatarDownloadTaskRef = new WeakReference<BoxFutureTask<BoxDownload>>(mAvatarController.executeAvatarDownloadRequest(mUser.getId(), this)); } }</code><technical_language>Move a constant / initialize null instead</technical_language>

Target:
protected void updateAvatar(){ if (mUser == null || mAvatarController == null){ return; } if (Thread.currentThread() != Looper.getMainLooper().getThread()){ post(new Runnable() { @Override public void run() { updateAvatar(); } }); return; } final File avatarFile = mAvatarController.getAvatarFile(mUser.getId()); if (avatarFile.exists()){ mAvatar.setImageDrawable(Drawable.createFromPath(avatarFile.getAbsolutePath())); mAvatar.setVisibility(View.VISIBLE); mInitials.setVisibility(View.GONE); } else { String name = DEFAULT_NAME; if (mUser instanceof BoxCollaborator){ name = mUser.getName(); } else if (SdkUtils.isBlank(name) && mUser instanceof BoxUser){ name = ((BoxUser) mUser).getLogin(); } SdkUtils.setInitialsThumb(getContext(), mInitials, name); mAvatar.setVisibility(View.GONE); mInitials.setVisibility(View.VISIBLE); mAvatarDownloadTaskRef = new WeakReference<BoxFutureTask<BoxDownload>>(mAvatarController.executeAvatarDownloadRequest(mUser.getId(), this)); } }
Source:
<code>public void notifyEvent(ProtocolRead p_i_event) { for (IBticinoEventListener l_event_listener : m_event_listener_list) { try { l_event_listener.handleEvent(p_i_event); } catch (Exception p_ex) { <START> logger.error("notifyEvent, Exception : " + p_ex.getMessage() + " / " + p_ex.toString() + " / " <END> + p_i_event.toString()); } } }</code><technical_language>This a WARN, ERROR. Additionally, need p_ex.toString() p_ex.getMessage(). other. Also, please parameterized logging instead of string concatenation</technical_language>

Target:
public void notifyEvent(ProtocolRead p_i_event) { for (IBticinoEventListener l_event_listener : m_event_listener_list) { try { l_event_listener.handleEvent(p_i_event); } catch (Exception p_ex) { logger.warn("notifyEvent, Exception : {}", p_ex.getMessage()); } } }
Source:
<code>public void writeParamsProps() { <START> final String KEY1 = "key1"; <END> final String VALUE1FIRST = "value1-preserve-this"; final String VALUE1SECOND = "value1prop"; final String KEY2 = "歌古事学週文原問業間革社。"; final String VALUE2 = "良治鮮猿性社費著併病極験。"; final Map<String, String> params = new HashMap<>(); params.put(KEY1, VALUE1FIRST); final KafkaExportParameters kafkaParams = new KafkaExportParameters(params); Properties props = new Properties(); props.put(KEY1, VALUE1SECOND); props.put(KEY2, VALUE2); kafkaParams.setProducerConfig(props); Properties propsAfter = kafkaParams.getProducerConfig(); assertEquals(props, propsAfter); assertEquals(params, params); assertEquals("Should not change identical parameters key", params.get(KEY1), VALUE1FIRST); assertEquals("Props should not have params's key", propsAfter.get(KEY1), VALUE1SECOND); assertNull("Should not have props key", params.get(KEY2)); }</code><technical_language>caps is reserved for public static final fields of a class</technical_language>

Target:
public void writeParamsProps() { final String key1 = "key1"; final String value1First = "value1-preserve-this"; final String value1Second = "value1prop"; final String key2 = "歌古事学週文原問業間革社。"; final String value2 = "良治鮮猿性社費著併病極験。"; final Map<String, String> params = new HashMap<>(); params.put(key1, value1First); final KafkaExportParameters kafkaParams = new KafkaExportParameters(params); Properties props = new Properties(); props.put(key1, value1Second); props.put(key2, value2); kafkaParams.setProducerConfig(props); Properties propsAfter = kafkaParams.getProducerConfig(); assertEquals(props, propsAfter); assertEquals(params, params); assertEquals("Should change identical parameters key", params.get(key1), value1Second); assertEquals("Props should have params's key", propsAfter.get(key1), value1Second); assertNotNull("Should have props key", params.get(key2)); }