auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void clean() { logger.debug("Start temp cleaning..."); long cutoff = System.currentTimeMillis() - ONE_DAY_IN_MILLISECONDS; try { Files.list(tempDir) .filter(p -> p.getFileName().toString().startsWith("sonar-runner-batch")) .filter(p -> lastModifiedTime(p) < cutoff) .forEach(Utils::deleteQuietly); logger.debug("Temp cleaning done"); <START> } catch (IOException e) { <END> logger.warn("Failed to clean files in " + tempDir.toString()); } }</code><technical_language>![MAJOR](<LINK_0> log rethrow this exception. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
void clean() { logger.debug("Start temp cleaning..."); long cutoff = System.currentTimeMillis() - ONE_DAY_IN_MILLISECONDS; try { Files.list(tempDir) .filter(p -> p.getFileName().toString().startsWith("sonar-runner-batch")) .filter(p -> lastModifiedTime(p) < cutoff) .forEach(Utils::deleteQuietly); logger.debug("Temp cleaning done"); } catch (IOException e) { logger.warn("Failed to clean files in " + tempDir.toString() + ": " + e.getMessage()); } }
Source:
<code>public void testRejectedMqttConnectMessage() throws Exception { server.getRemotingService().addIncomingInterceptor((MQTTInterceptor) (packet, connection) -> { if (packet.getClass() == MqttConnectMessage.class) { return false; } else { return true; } }); Thread publishThread = new Thread(() -> { MQTTClientProvider publishProvider = getMQTTClientProvider(); try{ initializeConnection(publishProvider); publishProvider.disconnect(); fail("The connection should be rejected!"); } catch (Exception e) { e.printStackTrace(); } }); publishThread.start(); <START> <END> publishThread.join(3000); if (publishThread.isAlive()) { fail("The connection is stuck!"); } }</code><technical_language>If this is expected behaviour ignore exception risk read test logs is some error</technical_language>

Target:
public void testRejectedMqttConnectMessage() throws Exception { CountDownLatch publishThreadReady = new CountDownLatch(1); server.getRemotingService().addIncomingInterceptor((MQTTInterceptor) (packet, connection) -> { if (packet.getClass() == MqttConnectMessage.class) { return false; } else { return true; } }); Thread publishThread = new Thread(() -> { MQTTClientProvider publishProvider = getMQTTClientProvider(); publishThreadReady.countDown(); try { initializeConnection(publishProvider); publishProvider.disconnect(); fail("The connection should be rejected!"); } catch (Exception ignore) { } }); publishThread.start(); publishThreadReady.await(); publishThread.join(3000); if (publishThread.isAlive()) { fail("The connection is stuck!"); } }
Source:
<code>public ResponseEntity setServerSettings(@RequestBody ServerSettingsForm serverSettingsForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String acceptHeader) throws IOException { if (serverSettingsForm == null) { return getBadRequestResponseEntity(FAILED_EMPTY_FORM, acceptHeader); } validateServerSettingsForm(serverSettingsForm, bindingResult); if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_SERVER_SETTINGS, bindingResult); } configurationManagementService.setBaseUrl(serverSettingsForm.getBaseUrl()); configurationManagementService.setPort(serverSettingsForm.getPort()); configurationManagementService.setInstanceName(serverSettingsForm.getInstanceName()); <START> if (serverSettingsForm.getDigestAlgorithmSet() != null) { <END> configurationManagementService.setDigestAlgorithmSet(serverSettingsForm.getDigestAlgorithmSet()); } if (serverSettingsForm.getCorsConfigurationForm() != null) { configurationManagementService.setCorsAllowedOrigins( serverSettingsForm.getCorsConfigurationForm().getAllowedOrigins() ); } if (serverSettingsForm.getSmtpConfigurationForm() != null) { configurationManagementService.setSmtpSettings( serverSettingsForm.getSmtpConfigurationForm().getMutableSmtpConfiguration() ); } if (serverSettingsForm.getProxyConfigurationForm() != null) { configurationManagementService.setProxyConfiguration( null, null, serverSettingsForm.getProxyConfigurationForm().getMutableProxyConfiguration() ); } return getSuccessfulResponseEntity(SUCCESSFUL_SAVE_SERVER_SETTINGS, acceptHeader); }</code><technical_language>Cosmetic: Braces new lines please. :)</technical_language>

Target:
public ResponseEntity setServerSettings(@RequestBody ServerSettingsForm serverSettingsForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String acceptHeader) throws IOException { if (serverSettingsForm == null) { return getBadRequestResponseEntity(FAILED_EMPTY_FORM, acceptHeader); } validateServerSettingsForm(serverSettingsForm, bindingResult); if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_SERVER_SETTINGS, bindingResult); } configurationManagementService.setBaseUrl(serverSettingsForm.getBaseUrl()); configurationManagementService.setPort(serverSettingsForm.getPort()); configurationManagementService.setInstanceName(serverSettingsForm.getInstanceName()); if (serverSettingsForm.getCorsConfigurationForm() != null) { configurationManagementService.setCorsAllowedOrigins( serverSettingsForm.getCorsConfigurationForm().getAllowedOrigins() ); } if (serverSettingsForm.getSmtpConfigurationForm() != null) { configurationManagementService.setSmtpSettings( serverSettingsForm.getSmtpConfigurationForm().getMutableSmtpConfiguration() ); } if (serverSettingsForm.getProxyConfigurationForm() != null) { configurationManagementService.setProxyConfiguration( null, null, serverSettingsForm.getProxyConfigurationForm().getMutableProxyConfiguration() ); } return getSuccessfulResponseEntity(SUCCESSFUL_SAVE_SERVER_SETTINGS, acceptHeader); }
Source:
<code>public SDBInstanceData(ICredential provider, IConfiguration configuration) { this.provider = provider; this.configuration = configuration; <START> String configuredDomain = System.getProperty("priam.sdb.instanceidentity.domain"); <END> if (configuredDomain == null) { domain = DEFAULT_DOMAIN; } else { domain = configuredDomain; } }</code><technical_language>wrap this configuration IConfiguration</technical_language>

Target:
public SDBInstanceData(ICredential provider, IConfiguration configuration) { this.provider = provider; this.configuration = configuration; this.domain = configuration.getInstanceIdentityDomain(); }
Source:
<code>private Range<RowKeyWrapper> rowRangeToRange(RowRange btRange) { final BoundType startBound; final ByteString startKey; switch (btRange.getStartKeyCase()) { case START_KEY_OPEN: startBound = BoundType.OPEN; startKey = btRange.getStartKeyOpen(); break; case START_KEY_CLOSED: startBound = BoundType.CLOSED; startKey = btRange.getStartKeyClosed(); break; case STARTKEY_NOT_SET: startBound = BoundType.CLOSED; startKey = ByteString.EMPTY; break; default: throw new IllegalArgumentException("Unexpected start key case: " + <START> btRange.getStartKeyCase()); <END> } final boolean startUnbounded = startKey.isEmpty(); final BoundType endBound; final ByteString endKey; switch (btRange.getEndKeyCase()) { case END_KEY_OPEN: endBound = BoundType.OPEN; endKey = btRange.getEndKeyOpen(); break; case END_KEY_CLOSED: endBound = BoundType.CLOSED; endKey = btRange.getEndKeyClosed(); break; case ENDKEY_NOT_SET: endBound = BoundType.OPEN; endKey = ByteString.EMPTY; break; default: throw new IllegalArgumentException("Unexpected end key case: " + btRange.getEndKeyCase()); } return boundedRange(startBound, startKey, endBound, endKey); }</code><technical_language>Please fix spacing similar current style. eclipse style xml file root of project</technical_language>

Target:
private Range<RowKeyWrapper> rowRangeToRange(RowRange btRange) { final BoundType startBound; final ByteString startKey; switch (btRange.getStartKeyCase()) { case START_KEY_OPEN: startBound = BoundType.OPEN; startKey = btRange.getStartKeyOpen(); break; case START_KEY_CLOSED: startBound = BoundType.CLOSED; startKey = btRange.getStartKeyClosed(); break; case STARTKEY_NOT_SET: startBound = BoundType.CLOSED; startKey = ByteString.EMPTY; break; default: throw new IllegalArgumentException("Unexpected start key case: " + btRange.getStartKeyCase()); } final BoundType endBound; final ByteString endKey; switch (btRange.getEndKeyCase()) { case END_KEY_OPEN: endBound = BoundType.OPEN; endKey = btRange.getEndKeyOpen(); break; case END_KEY_CLOSED: endBound = BoundType.CLOSED; endKey = btRange.getEndKeyClosed(); break; case ENDKEY_NOT_SET: endBound = BoundType.OPEN; endKey = ByteString.EMPTY; break; default: throw new IllegalArgumentException("Unexpected end key case: " + btRange.getEndKeyCase()); } return boundedRange(startBound, startKey, endBound, endKey); }
Source:
<code>public StreamExecutionListener getBuffer( String query, int windowSize, long windowMillis ) { String cacheId = getCacheKey( query, windowSize, windowMillis ); StreamExecutionListener streamListener = serviceListeners.getIfPresent( cacheId ); if ( streamListener == null ) { if ( stepStream == null ) { stepStream = new StreamList<>(); } Observable<List<RowMetaAndData>> buffer = windowMillis > 0 ? windowSize > 0 ? stepStream.getStream().buffer( windowMillis, TimeUnit.MILLISECONDS, windowSize ) : stepStream.getStream().buffer( windowMillis, TimeUnit.MILLISECONDS ) : stepStream.getStream().buffer( windowSize ); streamListener = new StreamExecutionListener( buffer ); serviceListeners.put( cacheId, streamListener ); } if ( !isRunning.get() ) { <START> isRunning.compareAndSet( false, true ); <END> startService(); } return streamListener; }</code><technical_language>set, test done in if statement. if want atomic operations do compareAndSet call startService() depending return of compareAndSet</technical_language>

Target:
public StreamExecutionListener getBuffer( String query, int windowSize, long windowMillis ) { String cacheId = getCacheKey( query, windowSize, windowMillis ); StreamExecutionListener streamListener = serviceListeners.getIfPresent( cacheId ); if ( streamListener == null ) { if ( stepStream == null ) { stepStream = new StreamList<>(); } Observable<List<RowMetaAndData>> buffer = windowMillis > 0 ? windowSize > 0 ? stepStream.getStream().buffer( windowMillis, TimeUnit.MILLISECONDS, windowSize ) : stepStream.getStream().buffer( windowMillis, TimeUnit.MILLISECONDS ) : stepStream.getStream().buffer( windowSize ); streamListener = new StreamExecutionListener( buffer ); serviceListeners.put( cacheId, streamListener ); } if ( isRunning.compareAndSet( false, true ) ) { startService(); } return streamListener; }
Source:
<code>public ASTAnnotation getAnnotation(String annotQualifiedName) { List<ASTAnnotation> annotations = getDeclaredAnnotations(); for (ASTAnnotation annotation : annotations) { <START> if (annotation.getType() != null) { <END> if (annotQualifiedName.equals(annotation.getType().getName())) { return annotation; } } else { ASTName name = annotation.getFirstDescendantOfType(ASTName.class); if (name != null && TypeHelper.isA(name, annotQualifiedName)) { return annotation; } } } return null; }</code><technical_language>build this behavior right TypeHelper.isA</technical_language>

Target:
public ASTAnnotation getAnnotation(String annotQualifiedName) { List<ASTAnnotation> annotations = getDeclaredAnnotations(); for (ASTAnnotation annotation : annotations) { ASTName name = annotation.getFirstDescendantOfType(ASTName.class); if (name != null && TypeHelper.isA(name, annotQualifiedName)) { return annotation; } } return null; }
Source:
<code>public static void before() { System.setProperty("cassandra.nodetool.jmx_notification_poll_interval_seconds", "1"); <START> DatabaseDescriptor.clientInitialization(); <END> }</code><technical_language>curious need initialize client here. need do this in Cassandra instance itself, test class. Do need for JMX work</technical_language>

Target:
public static void before() { System.setProperty("cassandra.nodetool.jmx_notification_poll_interval_seconds", "1"); }
Source:
<code>private void loadProperties() { try { FileUtil.loadProperties(Latex2HTMLzero, getClass(), "Latex2HTMLzero.properties"); } catch (IOException e) { <START> GlobalSettings.kem.registerCriticalError("error loading " + "Latex2HTMLzero.properties", e); <END> } try { FileUtil.loadProperties(Latex2HTMLone, getClass(), "Latex2HTMLone.properties"); } catch (IOException e) { GlobalSettings.kem.registerCriticalError("error loading Latex2HTMLone.properties", e); } }</code><technical_language>minor thing: need concatenate strings here</technical_language>

Target:
private void loadProperties() { try { FileUtil.loadProperties(Latex2HTMLzero, getClass(), "Latex2HTMLzero.properties"); } catch (IOException e) { GlobalSettings.kem.registerCriticalError("error loading Latex2HTMLzero.properties", e); } try { FileUtil.loadProperties(Latex2HTMLone, getClass(), "Latex2HTMLone.properties"); } catch (IOException e) { GlobalSettings.kem.registerCriticalError("error loading Latex2HTMLone.properties", e); } }
Source:
<code>private void diffAssignmentNodes(Map<String, List<DatastreamTask>> assignmentsByInstance, Map<String, Set<String>> nodesToRemove, Map<String, Set<String>> nodesToAdd) { for (String instance : assignmentsByInstance.keySet()) { Set<String> assignmentsNames = assignmentsByInstance.get(instance) .stream() .map(DatastreamTask::getDatastreamTaskName) .collect(Collectors.toSet()); <START> Set<String> oldAssignmentNames = new HashSet<>(getInstanceAssignment(instance)); <END> Set<String> removed = new HashSet<>(oldAssignmentNames); removed.removeAll(assignmentsNames); nodesToRemove.put(instance, removed); Set<String> added = new HashSet<>(assignmentsNames); added.removeAll(oldAssignmentNames); nodesToAdd.put(instance, added); } }</code><technical_language>new HashSet<> is needed; oldAssignmentNames is for exclusion a set, returned assignments unique (read straight ZooKeeper). oldAssignmentNames a List<String Collection<String></technical_language>

Target:
private void diffAssignmentNodes(Map<String, List<DatastreamTask>> assignmentsByInstance, Map<String, Set<String>> nodesToRemove, Map<String, Set<String>> nodesToAdd) { for (String instance : assignmentsByInstance.keySet()) { Set<String> assignmentsNames = assignmentsByInstance.get(instance) .stream() .map(DatastreamTask::getDatastreamTaskName) .collect(Collectors.toSet()); List<String> oldAssignmentNames = getInstanceAssignment(instance); Set<String> removed = new HashSet<>(oldAssignmentNames); removed.removeAll(assignmentsNames); nodesToRemove.put(instance, removed); Set<String> added = new HashSet<>(assignmentsNames); added.removeAll(oldAssignmentNames); nodesToAdd.put(instance, added); } }
Source:
<code>protected void executeQueryCommand() { List<GlusterServerService> serviceList = null; if(getParameters().getServiceType() == null) { serviceList = getGlusterServerServiceDao().getByClusterId(getParameters().getId()); } else { serviceList = getGlusterServerServiceDao().getByClusterIdAndServiceType(getParameters().getId(), getParameters().getServiceType()); } <START> if(serviceList != null && serviceList.size() > 0) { <END> getQueryReturnValue().setReturnValue(serviceList); } }</code><technical_language>Question (matter of choise) - prefer set anyway? if serverList is null empty, setReurnValue a null empty list -what's problem that</technical_language>

Target:
protected void executeQueryCommand() { List<GlusterServerService> serviceList = null; if(getParameters().getServiceType() == null) { serviceList = getGlusterServerServiceDao().getByClusterId(getParameters().getId()); } else { serviceList = getGlusterServerServiceDao().getByClusterIdAndServiceType(getParameters().getId(), getParameters().getServiceType()); } getQueryReturnValue().setReturnValue(serviceList); }
Source:
<code>public void testInvalidatingSessionDestroysAllLongRunningConversations() throws Exception { WebClient client = new WebClient(); client.getPage(getPath("/resetSequence", null)); TextPage firstConversation = client.getPage(getPath("/begin", null)); String content = firstConversation.getContent(); String firstCid = getCid(content); assertTrue(content.contains("message: Hello") && content.contains("transient: false")); <START> <END> TextPage secondConversation = client.getPage(getPath("/begin", null)); content = secondConversation.getContent(); assertTrue(content.contains("message: Hello") && content.contains("transient: false")); String secondCid = getCid(content); assertFalse(firstCid.equals(secondCid)); client.getPage(getPath("/invalidateSession", secondCid)); TextPage sequence = client.getPage(getPath("/getSequence", null)); String result = sequence.getContent().trim(); ActionSequence.reset(); ActionSequence.addAction("conversationCreated"); ActionSequence.addAction("conversationCreated"); ActionSequence.addAction("beforeInvalidate"); ActionSequence.addAction("afterInvalidate"); ActionSequence.addAction("conversationDestroyed"); ActionSequence.addAction("conversationDestroyed"); assertEquals(result, ActionSequence.getSequence().dataToCsv()); }</code><technical_language>This 4 lines (maybe 5) in this test. extract some method? I test bit legible</technical_language>

Target:
public void testInvalidatingSessionDestroysAllLongRunningConversations() throws Exception { WebClient client = new WebClient(); String firstCid = beginConversation(client, true); String secondCid = beginConversation(client, false); assertFalse(firstCid.equals(secondCid)); client.getPage(getPath("/invalidateSession", secondCid)); TextPage sequence = client.getPage(getPath("/getSequence", null)); String result = sequence.getContent().trim(); ActionSequence.reset(); ActionSequence.addAction(CONVERSATION_CREATED); ActionSequence.addAction(CONVERSATION_CREATED); ActionSequence.addAction(BEFORE_INVALIDATE); ActionSequence.addAction(AFTER_INVALIDATE); ActionSequence.addAction(CONVERSATION_DESTROYED); ActionSequence.addAction(CONVERSATION_DESTROYED); assertEquals(result, ActionSequence.getSequence().dataToCsv()); }
Source:
<code>LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { if ((style & SWT.READ_ONLY) != 0) return LRESULT.ZERO; Point selection = getSelection (); long hwndText = OS.GetDlgItem (handle, CBID_EDIT); int x = selection.x; int y = selection.y; if (x == y) { <START> String actText = getText ().substring (0, getCaretPosition ()); <END> java.util.regex.Matcher m = Text.CTRL_BS_PATTERN.matcher (actText); if (m.find ()) { x = m.start (); y = m.end (); OS.SendMessage (hwndText, OS.EM_SETSEL, x, y); } } if (x < y) { OS.SendMessage (hwndText, OS.EM_REPLACESEL, 1, 0); } return LRESULT.ZERO; } } return result; }</code><technical_language>getText (0, getCaretPosition()) get task done in a single call</technical_language>

Target:
LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { if ((style & SWT.READ_ONLY) != 0) return LRESULT.ZERO; Point selection = getSelection (); long hwndText = OS.GetDlgItem (handle, CBID_EDIT); int x = selection.x; int y = selection.y; if (x == y) { String actText = getText ().substring (0, getCaretPosition ()); java.util.regex.Matcher m = CTRL_BS_PATTERN.matcher (actText); if (m.find ()) { x = m.start (); y = m.end (); OS.SendMessage (hwndText, OS.EM_SETSEL, x, y); } } if (x < y) { OS.SendMessage (hwndText, OS.EM_REPLACESEL, 1, 0); } return LRESULT.ZERO; } } return result; }
Source:
<code>private @Nullable ITmfTrace put(String path, String name, String typeID) throws TmfTraceException, InstantiationException, IllegalAccessException, CoreException, FileNotFoundException, TmfTraceImportException { List<TraceTypeHelper> traceTypes = TmfTraceType.selectTraceType(path, typeID); if (traceTypes.isEmpty()) { throw new FileNotFoundException(); } IResource resource = getResource(path); TraceTypeHelper helper = traceTypes.get(0); ITmfTrace trace = helper.getTraceClass().newInstance(); <START> trace.initTrace(resource, path, ITmfEvent.class, name, typeID); <END> trace.indexTrace(false); TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null)); return trace; }</code><technical_language>opening a trace in unit tests, resource is set null, is required. supplementary files stored... (path of state systems of analyses generated for this trace), orphaned files. resource supplementary files deletable</technical_language>

Target:
private static ITmfTrace put(String path, String name, String typeID) throws TmfTraceException, InstantiationException, IllegalAccessException, CoreException, FileNotFoundException, TmfTraceImportException { List<TraceTypeHelper> traceTypes = TmfTraceType.selectTraceType(path, typeID); if (traceTypes.isEmpty()) { throw new FileNotFoundException(); } IResource resource = getResource(path); TraceTypeHelper helper = traceTypes.get(0); ITmfTrace trace = helper.getTraceClass().newInstance(); trace.initTrace(resource, path, ITmfEvent.class, name, typeID); return trace; }
Source:
<code>private void assertInitialization() { if (initialized) { return; } <START> LOG.log(Level.INFO, "Waiting for router to be initialized"); <END> try { Thread.sleep(INITIALIZATION_TIMEOUT_MS); if (!initialized) { throw new RuntimeException("Fail to initialize the router"); } } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while waiting for router to be initialized", e); } }</code><technical_language>informative mention long wait in log message</technical_language>

Target:
private void assertInitialization() { if (initialized) { return; } LOG.log(Level.INFO, "Waiting {0} ms for router to be initialized", INITIALIZATION_TIMEOUT_MS); try { Thread.sleep(INITIALIZATION_TIMEOUT_MS); if (!initialized) { throw new RuntimeException("Fail to initialize the router"); } } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while waiting for router to be initialized", e); } }
Source:
<code>private static Tracer createTracer(OxdServerConfiguration configuration, String componentName) { String tracerName = configuration.getTracer(); <START> Tracer tracer = null; <END> if (!configuration.getEnableTracing() || Strings.isNullOrEmpty(tracerName)) { tracer = NoopTracerFactory.create(); } else if ("jaeger".equals(tracerName)) { Configuration.SamplerConfiguration samplerConfig = new Configuration.SamplerConfiguration() .withType(ConstSampler.TYPE) .withParam(1); Configuration.SenderConfiguration senderConfig = new Configuration.SenderConfiguration() .withAgentHost(configuration.getTracerHost()) .withAgentPort(configuration.getTracerPort()); Configuration.ReporterConfiguration reporterConfig = new Configuration.ReporterConfiguration() .withLogSpans(true) .withFlushInterval(1000) .withMaxQueueSize(10000) .withSender(senderConfig); tracer = new Configuration(componentName) .withSampler(samplerConfig) .withReporter(reporterConfig) .getTracer(); } else if ("zipkin".equals(tracerName)) { OkHttpSender sender = OkHttpSender.create( "http://" + configuration.getTracerHost() + ":" + configuration.getTracerPort() + "/api/v1/spans"); Reporter<Span> reporter = AsyncReporter.builder(sender).build(); tracer = BraveTracer.create(Tracing.newBuilder() .localServiceName(componentName) .spanReporter(reporter) .build()); } else { tracer = NoopTracerFactory.create(); } return tracer; }</code><technical_language>refactoring tracer variable is redundanct, right if return result directly</technical_language>

Target:
private static Tracer createTracer(OxdServerConfiguration configuration, String componentName) { String tracerName = configuration.getTracer(); if (!configuration.getEnableTracing() || Strings.isNullOrEmpty(tracerName)) { return NoopTracerFactory.create(); } else if ("jaeger".equals(tracerName)) { Configuration.SamplerConfiguration samplerConfig = new Configuration.SamplerConfiguration() .withType(ConstSampler.TYPE) .withParam(1); Configuration.SenderConfiguration senderConfig = new Configuration.SenderConfiguration() .withAgentHost(configuration.getTracerHost()) .withAgentPort(configuration.getTracerPort()); Configuration.ReporterConfiguration reporterConfig = new Configuration.ReporterConfiguration() .withLogSpans(true) .withFlushInterval(1000) .withMaxQueueSize(10000) .withSender(senderConfig); return new Configuration(componentName) .withSampler(samplerConfig) .withReporter(reporterConfig) .getTracer(); } else if ("zipkin".equals(tracerName)) { OkHttpSender sender = OkHttpSender.create( "http://" + configuration.getTracerHost() + ":" + configuration.getTracerPort() + "/api/v1/spans"); Reporter<Span> reporter = AsyncReporter.builder(sender).build(); return BraveTracer.create(Tracing.newBuilder() .localServiceName(componentName) .spanReporter(reporter) .build()); } else { return NoopTracerFactory.create(); } }
Source:
<code>EmbeddedElasticsearchNode() { try { elasticsearchDirectory = File.createTempFile("elasticsearch-test", Long.toString(System.nanoTime())); elasticsearchDirectory.delete(); elasticsearchDirectory.mkdir(); } catch (IOException e) { throw new UncheckedIOException(e); } String clusterName = "test"; Settings setting = Settings.builder() .put("cluster.name", clusterName) .put("path.home", elasticsearchDirectory.getPath()) .put("path.data", new File(elasticsearchDirectory, "data").getAbsolutePath()) .put("path.logs", new File(elasticsearchDirectory, "logs").getAbsolutePath()) .put("transport.type.default", "local") .put("transport.type", "netty4") .put("http.type", "netty4") .put("http.enabled", "true") .put("path.home", "elasticsearch-test-data") .build(); <START> node = new ElasticsearchNode(setting, Arrays.asList(Netty4Plugin.class)); <END> }</code><technical_language>nit: ImmutableList.of</technical_language>

Target:
EmbeddedElasticsearchNode() { try { elasticsearchDirectory = File.createTempFile("elasticsearch", "test"); elasticsearchDirectory.delete(); elasticsearchDirectory.mkdir(); } catch (IOException e) { throw new UncheckedIOException(e); } Settings setting = Settings.builder() .put("cluster.name", "test") .put("path.home", elasticsearchDirectory.getPath()) .put("path.data", new File(elasticsearchDirectory, "data").getAbsolutePath()) .put("path.logs", new File(elasticsearchDirectory, "logs").getAbsolutePath()) .put("transport.type.default", "local") .put("transport.type", "netty4") .put("http.type", "netty4") .put("http.enabled", "true") .put("path.home", "elasticsearch-test-data") .build(); node = new ElasticsearchNode(setting, ImmutableList.of(Netty4Plugin.class)); }
Source:
<code>public static List<String> propertyToList(String propertyName) { String name = System.getProperty(propertyName); if (name == null) { return null; } <START> return Arrays.asList(name.split(",")); <END> }</code><technical_language>avoid issues leading, intermediate trailing spaces, trim() regex split: suggestion return Arrays.asList(name.trim().split("\\s*,\\s*"));</technical_language>

Target:
public static Optional<List<String>> propertyToList(String propertyName) { String name = System.getProperty(propertyName); if (name == null) { return Optional.empty(); } else if (name.isEmpty()) { return Optional.of(emptyList()); } return Optional.of(Arrays.asList(name.trim().split("\\s*,\\s*"))); }
Source:
<code><START> public void testCompute() { <END> MagicKey key = new MagicKey(cache(0, cacheName)); cache(1, cacheName).put(key, "a"); cache(2, cacheName).compute(key, (k, v) -> v + "b"); InternalCacheEntry<Object, Object> ice = cache(2, cacheName).getAdvancedCache().getDataContainer().get(key); assertNotNull(ice); assertEquals("ab", ice.getValue()); assertOwnershipAndNonOwnership(key, false); }</code><technical_language>In general, test I concerned more scenarios. 1) compute/computeIfPresent/computeIfAbsent existing in cache 2) compute/computeIfPresent for existing removed if lambda computes null. computeIfAbsent do 3) compute/computeIfPresent/computeIfAbsent a is present (computeIfPresent) do 2 commands Compute for compute/computeIfPresent ComputeIfAbsent command. wanna cover scenarios</technical_language>

Target:
public void testCompute() { MagicKey key = new MagicKey(cache(0, cacheName)); cache(1, cacheName).put(key, "a"); assertEquals("ab", cache(2, cacheName).compute(key, (k, v) -> v + "b")); assertLocalValue(0, key, "ab"); assertLocalValue(1, key, "a"); assertLocalValue(2, key, "ab"); assertOwnershipAndNonOwnership(key, false); assertEquals("abc", cache(0, cacheName).compute(key, (k, v) -> v + "c")); assertLocalValue(0, key, "abc"); assertOwnershipAndNonOwnership(key, false); assertEquals(null, cache(1, cacheName).compute(key, (k, v) -> "abc".equals(v) ? null : "unexpected")); assertLocalValue(0, key, null); assertLocalValue(1, key, null); assertLocalValue(2, key, "ab"); assertOwnershipAndNonOwnership(key, false); MagicKey otherKey = new MagicKey(cache(0, cacheName)); assertEquals("x", cache(1, cacheName).compute(otherKey, (k, v) -> v == null ? "x" : "unexpected")); assertLocalValue(0, otherKey, "x"); assertLocalValue(1, otherKey, "x"); assertNoLocalValue(2, otherKey); assertOwnershipAndNonOwnership(otherKey, false); assertEquals(null, cache(0, cacheName).compute(otherKey, (k, v) -> "x".equals(v) ? null : "unexpected")); assertLocalValue(0, otherKey, null); assertLocalValue(1, otherKey, null); assertNoLocalValue(2, otherKey); assertOwnershipAndNonOwnership(otherKey, false); assertEquals("y", cache(0, cacheName).compute(otherKey, (k, v) -> v == null ? "y" : "unexpected")); assertLocalValue(0, otherKey, "y"); assertOwnershipAndNonOwnership(otherKey, false); }
Source:
<code>public void setUp() throws IOException { conf = new Configuration(); conf.setInt("tfile.fs.input.buffer.size", tconf.fsInputBufferSize); conf.setInt("tfile.fs.output.buffer.size", tconf.fsOutputBufferSize); <START> path = new Path(ROOT, "/tmp/dtfile"); <END> fs = path.getFileSystem(conf); timer = new NanoTimer(false); rng = new Random(); keyLenGen = new RandomDistribution.Zipf(new Random(rng.nextLong()), tconf.minKeyLen, tconf.maxKeyLen, 1.2); RandomDistribution.DiscreteRNG valLenGen = new RandomDistribution.Flat(new Random(rng.nextLong()), tconf.minValLength, tconf.maxValLength); RandomDistribution.DiscreteRNG wordLenGen = new RandomDistribution.Flat(new Random(rng.nextLong()), tconf.minWordLen, tconf.maxWordLen); kvGen = new KVGenerator(rng, true, keyLenGen, valLenGen, wordLenGen, tconf.dictSize); }</code><technical_language>@tushargosavi create test data files target directory</technical_language>

Target:
public void setUp() throws IOException { conf = new Configuration(); conf.setInt("tfile.fs.input.buffer.size", tconf.fsInputBufferSize); conf.setInt("tfile.fs.output.buffer.size", tconf.fsOutputBufferSize); path = new Path(ROOT, "dtfile"); fs = path.getFileSystem(conf); timer = new NanoTimer(false); rng = new Random(); keyLenGen = new RandomDistribution.Zipf(new Random(rng.nextLong()), tconf.minKeyLen, tconf.maxKeyLen, 1.2); RandomDistribution.DiscreteRNG valLenGen = new RandomDistribution.Flat(new Random(rng.nextLong()), tconf.minValLength, tconf.maxValLength); RandomDistribution.DiscreteRNG wordLenGen = new RandomDistribution.Flat(new Random(rng.nextLong()), tconf.minWordLen, tconf.maxWordLen); kvGen = new KVGenerator(rng, true, keyLenGen, valLenGen, wordLenGen, tconf.dictSize); }
Source:
<code>private static void printEnvironment() { if (fPrintedEnvironment) { return; } Rectangle bounds = Display.getDefault().getBounds(); System.out.println("Display size: " + bounds.width + "x" + bounds.height); String osVersion = System.getProperty("os.version"); if (osVersion != null) { System.out.println("OS version=" + osVersion); } String gtkVersion = System.getProperty("org.eclipse.swt.internal.gtk.version"); if <START> (osVersion != <END> null) { System.out.println("GTK version=" + gtkVersion); String overlayScrollbar = System.getenv("LIBOVERLAY_SCROLLBAR"); if (overlayScrollbar != null) { System.out.println("LIBOVERLAY_SCROLLBAR=" + overlayScrollbar); } String ubuntuMenuProxy = System.getenv("UBUNTU_MENUPROXY"); if (overlayScrollbar != null) { System.out.println("UBUNTU_MENUPROXY=" + ubuntuMenuProxy); } } fPrintedEnvironment = true; }</code><technical_language>I meant gtkVersion here, continued previous if-block</technical_language>

Target:
private static void printEnvironment() { if (fPrintedEnvironment) { return; } Rectangle bounds = Display.getDefault().getBounds(); System.out.println("Display size: " + bounds.width + "x" + bounds.height); String osVersion = System.getProperty("os.version"); if (osVersion != null) { System.out.println("OS version=" + osVersion); } String gtkVersion = System.getProperty("org.eclipse.swt.internal.gtk.version"); if (gtkVersion != null) { System.out.println("GTK version=" + gtkVersion); String overlayScrollbar = System.getenv("LIBOVERLAY_SCROLLBAR"); if (overlayScrollbar != null) { System.out.println("LIBOVERLAY_SCROLLBAR=" + overlayScrollbar); } String ubuntuMenuProxy = System.getenv("UBUNTU_MENUPROXY"); if (overlayScrollbar != null) { System.out.println("UBUNTU_MENUPROXY=" + ubuntuMenuProxy); } } fPrintedEnvironment = true; }
Source:
<code>public void verifyLightboxImage() { waitForElementByElement(imageContainer); <START> PageObjectLogging.log("verifyLightboxImage", "Verify lightbox image appeared", true); <END> }</code><technical_language>consider removing word verify logging description</technical_language>

Target:
public void verifyLightboxImage() { waitForElementByElement(imageContainer); PageObjectLogging.log("verifyLightboxImage", "Lightbox image appeared", true); }
Source:
<code>public int getLogLevel() { <START> return Integer.parseInt(allowedLogLevelVariables[0]); <END> }</code><technical_language>This good, this parse time need numeric value, is frequently. do Srikanta proposed previously int string values</technical_language>

Target:
public int getLogLevel() { return numericValue; }
Source:
<code>public Include(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { super(stack); this.req = req; this.res = res; <START> defaultEncoding = "UTF-8"; END> usePageEncoding = false; }</code><technical_language>override defaultEncoding in constructor? set in setDefaultEncoding</technical_language>

Target:
public Include(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { super(stack); this.req = req; this.res = res; useResponseEncoding = false; }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ACTIVITY_REQUEST_DESCRIPTION_EDIT && resultCode == RESULT_OK) { <START> if (!Prefs.shouldShowSuggestedEditsSurvey()) { <END> FeedbackUtil.showMessage(this, getString(R.string.description_edit_success_saved_image_caption_in_lang_snackbar, app.language().getAppLanguageLocalizedName(StringUtils.defaultString(targetLanguageCode, app.language().getAppLanguageCode())))); } layOutGalleryDescription(); setResult(ACTIVITY_RESULT_IMAGE_CAPTION_ADDED); } }</code><technical_language>I hide Snackbar survey Snackbar show Explore feed</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ACTIVITY_REQUEST_DESCRIPTION_EDIT && resultCode == RESULT_OK) { FeedbackUtil.showMessage(this, getString(R.string.description_edit_success_saved_image_caption_in_lang_snackbar, app.language().getAppLanguageLocalizedName(StringUtils.defaultString(targetLanguageCode, app.language().getAppLanguageCode())))); layOutGalleryDescription(); setResult(ACTIVITY_RESULT_IMAGE_CAPTION_ADDED); } }
Source:
<code>protected void onHandleIntent(Intent intent) { if(isNetworkAvailable()) { List<Patient> patientList = new PatientDAO().getAllPatients(); final ListIterator<Patient> it = patientList.listIterator(); while (it.hasNext()) { final Patient patient=it.next(); <START> if(patient.getUuid()==null || patient.getUuid().equals(" ")) { <END> syncPatient(patient); } } } else { notifier.notify("No internet connection. Patient Registration data is saved locally " + "and will sync when internet connection is restored. "); } }</code><technical_language>isSynced anymore</technical_language>

Target:
protected void onHandleIntent(Intent intent) { if(isNetworkAvailable()) { List<Patient> patientList = new PatientDAO().getAllPatients(); final ListIterator<Patient> it = patientList.listIterator(); while (it.hasNext()) { final Patient patient=it.next(); if(!patient.isSynced()) { syncPatient(patient); } } } else { notifier.notify("No internet connection. Patient Registration data is saved locally " + "and will sync when internet connection is restored. "); } }
Source:
<code>public AddressSpaceView(@Nonnull final CorfuRuntime runtime) { super(runtime); CacheBuilder cacheBuilder = CacheBuilder.newBuilder(); if (runtime.getParameters().getMaxCacheEntries() != 0) { cacheBuilder.maximumSize(runtime.getParameters().getMaxCacheEntries()); } if (runtime.getParameters().getMaxCacheWeight() != 0) { cacheBuilder.maximumWeight(runtime.getParameters().getMaxCacheWeight()); <START> cacheBuilder.weigher((k, v) -> (int) (MetricsUtils.sizeOf.deepSizeOf(k) <END> + MetricsUtils.sizeOf.deepSizeOf(v))); } readCache = cacheBuilder.expireAfterAccess(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .expireAfterWrite(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .removalListener(this::handleEviction) .recordStats() .build(); MetricRegistry metrics = CorfuRuntime.getDefaultMetrics(); final String pfx = String.format("%s0x%x.cache.", CorfuComponent.ADDRESS_SPACE_VIEW.toString(), this.hashCode()); metrics.register(pfx + "cache-size", (Gauge<Long>) readCache::size); metrics.register(pfx + "evictions", (Gauge<Long>) () -> readCache.stats().evictionCount()); metrics.register(pfx + "hit-rate", (Gauge<Double>) () -> readCache.stats().hitRate()); metrics.register(pfx + "hits", (Gauge<Long>) () -> readCache.stats().hitCount()); metrics.register(pfx + "misses", (Gauge<Long>) () -> readCache.stats().missCount()); }</code><technical_language>do this</technical_language>

Target:
public AddressSpaceView(@Nonnull final CorfuRuntime runtime) { super(runtime); CacheBuilder cacheBuilder = CacheBuilder.newBuilder(); long maxCacheEntries = runtime.getParameters().getMaxCacheEntries(); long maxCacheWeight = runtime.getParameters().getMaxCacheWeight(); if (maxCacheEntries != 0) { cacheBuilder.maximumSize(runtime.getParameters().getMaxCacheEntries()); } if (maxCacheWeight != 0) { cacheBuilder.maximumWeight(runtime.getParameters().getMaxCacheWeight()); cacheBuilder.weigher((k, v) -> (int) (cacheKeySize + MetricsUtils.sizeOf.deepSizeOf(v))); } if (maxCacheEntries == 0 && maxCacheWeight == 0) { cacheBuilder.maximumSize(defaultMaxCacheEntries); } readCache = cacheBuilder.expireAfterAccess(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .expireAfterWrite(runtime.getParameters().getCacheExpiryTime(), TimeUnit.SECONDS) .removalListener(this::handleEviction) .recordStats() .build(); MetricRegistry metrics = CorfuRuntime.getDefaultMetrics(); final String pfx = String.format("%s0x%x.cache.", CorfuComponent.ADDRESS_SPACE_VIEW.toString(), this.hashCode()); metrics.register(pfx + "cache-size", (Gauge<Long>) readCache::size); metrics.register(pfx + "evictions", (Gauge<Long>) () -> readCache.stats().evictionCount()); metrics.register(pfx + "hit-rate", (Gauge<Double>) () -> readCache.stats().hitRate()); metrics.register(pfx + "hits", (Gauge<Long>) () -> readCache.stats().hitCount()); metrics.register(pfx + "misses", (Gauge<Long>) () -> readCache.stats().missCount()); }
Source:
<code>void resetButtons() { for (int i = 0; i < fieldSize; i++) <START> for (int j = 0; j < fieldSize; j++) arrayOfButtons[i][j].setGraphic(new ImageView(imageEmpty)); <END> field.resetLogic(); }</code><technical_language>braces</technical_language>

Target:
void resetButtons() { for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) { arrayOfButtons[i][j].setGraphic(new ImageView(imageEmpty)); } field.resetLogic(); }
Source:
<code>public Menus buildMenuBar() { return MenuFactory <START> .newTopLevelMenu(translationService.getTranslation(LibraryConstants.AssetSearch)).position(MenuPosition.RIGHT).respondsWith(() -> placeManager.goTo("FindForm")) <END> .endMenu() .build(); }</code><technical_language>minor I more readable splitting this line</technical_language>

Target:
public Menus buildMenuBar() { return MenuFactory .newTopLevelMenu(translationService.getTranslation(LibraryConstants.AssetSearch)) .position(MenuPosition.RIGHT) .respondsWith(() -> { final PlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.ASSET_SEARCH); final PartDefinition part = new PartDefinitionImpl(placeRequest); part.setSelectable(false); placeManager.goTo(part, getRootPanel()); }) .endMenu() .build(); }
Source:
<code><START> @Override public int hashCode() { <END> int result = (value != +0.0f ? Float.floatToIntBits(value) : 0); result = 31 * result + type.hashCode(); result = 31 * result + publisher.hashCode(); return result; }</code><technical_language>Java7 template for equals/hashCode please</technical_language>

Target:
public int hashCode() { return Objects.hash(value, type, publisher); }
Source:
<code>protected URIExtensionIV createInlineIV(URI uri) { if (namespaceIV == null) { return null; } for (String prefix : normalizedPrefixes) { if (uri.stringValue().startsWith(prefix)) { AbstractLiteralIV localNameIv = next.createInlineIV(uri.stringValue().substring( <START> CommonValues.VIAF_HTTP.length())); <END> if (localNameIv == null) { return null; } return new URIExtensionIV(localNameIv, namespaceIV); } } return next.createInlineIV(uri); }</code><technical_language>VIAF_HTTP? prefix.length()</technical_language>

Target:
protected URIExtensionIV createInlineIV(URI uri) { if (namespaceIV == null) { return null; } for (String prefix : normalizedPrefixes) { if (uri.stringValue().startsWith(prefix)) { AbstractLiteralIV localNameIv = next.createInlineIV(uri.stringValue().substring(prefix.length())); if (localNameIv == null) { return null; } return new URIExtensionIV(localNameIv, namespaceIV); } } return next.createInlineIV(uri); }
Source:
<code>public void setAwake(Registration reg) { if (reg.usesQueueMode()) { <START> PresenceStatus status = new PresenceStatus(awakeTimeInfo.usedClientAwakeTime(reg)); <END> PresenceStatus previous = clientStatusList.putIfAbsent(reg.getEndpoint(), status); if (previous != null) { status = previous; } boolean stateChanged = false; synchronized (status) { status.setClientAwakeTime(awakeTimeInfo.usedClientAwakeTime(reg)); stateChanged = status.setAwake(); startClientAwakeTimer(reg, status); } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }</code><technical_language>remove clientAwakeTime attribute PresenceStatus. this quickly, this is need anymore</technical_language>

Target:
public void setAwake(Registration reg) { if (reg.usesQueueMode()) { PresenceStatus status = new PresenceStatus(); PresenceStatus previous = clientStatusList.putIfAbsent(reg.getEndpoint(), status); if (previous != null) { status = previous; } boolean stateChanged = false; synchronized (status) { stateChanged = status.setAwake(); startClientAwakeTimer(reg, status, awakeTimeProvider.getClientAwakeTime(reg)); } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }
Source:
<code>public void writeBehindCache() throws ClassNotFoundException { CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(true); Class<CacheLoaderWriter<?, ?>> klazz = (Class<CacheLoaderWriter<?, ?>>) (Class) (SampleLoaderWriter.class); final Cache<Long, String> writeBehindCache = cacheManager.createCache("writeBehindCache", CacheConfigurationBuilder.newCacheConfigurationBuilder() <START> .withLoaderWriter((SampleLoaderWriter) new SampleLoaderWriter<Long, String>(singletonMap(41L, "zero"))) END> .add(WriteBehindConfigurationBuilder .newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3) .queueSize(3) .concurrencyLevel(1) .enableCoalescing()) .buildConfig(Long.class, String.class)); assertThat(writeBehindCache.get(41L), is("zero")); writeBehindCache.put(42L, "one"); writeBehindCache.put(43L, "two"); writeBehindCache.put(42L, "This goes for the record"); assertThat(writeBehindCache.get(42L), equalTo("This goes for the record")); cacheManager.close(); }</code><technical_language>Generics issue there, need cast</technical_language>

Target:
public void writeBehindCache() throws ClassNotFoundException { CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(true); final Cache<Long, String> writeBehindCache = cacheManager.createCache("writeBehindCache", CacheConfigurationBuilder.newCacheConfigurationBuilder() .withLoaderWriter((SampleLoaderWriter) new SampleLoaderWriter<Long, String>(singletonMap(41L, "zero"))) .add(WriteBehindConfigurationBuilder .newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3) .queueSize(3) .concurrencyLevel(1) .enableCoalescing()) .buildConfig(Long.class, String.class)); assertThat(writeBehindCache.get(41L), is("zero")); writeBehindCache.put(42L, "one"); writeBehindCache.put(43L, "two"); writeBehindCache.put(42L, "This goes for the record"); assertThat(writeBehindCache.get(42L), equalTo("This goes for the record")); cacheManager.close(); }
Source:
<code>public String toString() { return new StringBuilder() .append("Notification [") <START> .append("reference=" + reference) <END> .append(", transactionId=" + transactionId) .append(", status=" + status) .append(", gatewayEventDate=" + gatewayEventDate) .append("]") .toString(); }</code><technical_language>+ string concatenation if a StringBuilder! Do append("reference=").append(reference) instead</technical_language>

Target:
public String toString() { return new StringBuilder() .append("Notification [") .append("reference=") .append(reference) .append(", transactionId=") .append(transactionId) .append(", status=") .append(status) .append(", gatewayEventDate=") .append(gatewayEventDate) .append("]") .toString(); }