auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public DefaultCacheManager(GlobalConfiguration globalConfiguration, Configuration defaultConfiguration, boolean start) { globalConfiguration = globalConfiguration == null ? new GlobalConfigurationBuilder().build() : globalConfiguration; defaultConfiguration = defaultConfiguration == null ? new ConfigurationBuilder().build() : defaultConfiguration; this.configurationManager = new ConfigurationManager(globalConfiguration, defaultConfiguration); this.authzHelper = new AuthorizationHelper(globalConfiguration.security(), AuditContext.CACHEMANAGER, globalConfiguration.globalJmxStatistics().cacheManagerName()); this.globalComponentRegistry = new GlobalComponentRegistry(globalConfiguration, this, caches.keySet()); this.globalComponentRegistry.registerComponent(configurationManager, ConfigurationManager.class); this.globalComponentRegistry.registerComponent(cacheDependencyGraph, CACHE_DEPENDENCY_GRAPH, false); this.globalComponentRegistry.registerComponent(authzHelper, AuthorizationHelper.class); this.stats = new CacheContainerStatsImpl(this); <START> this.health = HealthFactory.create(this); <END> if (start) start(); }</code><technical_language>If Health instance is created DefaultCacheManager I a need for factory</technical_language>

Target:
public DefaultCacheManager(GlobalConfiguration globalConfiguration, Configuration defaultConfiguration, boolean start) { globalConfiguration = globalConfiguration == null ? new GlobalConfigurationBuilder().build() : globalConfiguration; defaultConfiguration = defaultConfiguration == null ? new ConfigurationBuilder().build() : defaultConfiguration; this.configurationManager = new ConfigurationManager(globalConfiguration, defaultConfiguration); this.authzHelper = new AuthorizationHelper(globalConfiguration.security(), AuditContext.CACHEMANAGER, globalConfiguration.globalJmxStatistics().cacheManagerName()); this.globalComponentRegistry = new GlobalComponentRegistry(globalConfiguration, this, caches.keySet()); this.globalComponentRegistry.registerComponent(configurationManager, ConfigurationManager.class); this.globalComponentRegistry.registerComponent(cacheDependencyGraph, CACHE_DEPENDENCY_GRAPH, false); this.globalComponentRegistry.registerComponent(authzHelper, AuthorizationHelper.class); this.stats = new CacheContainerStatsImpl(this); health = new HealthImpl(this); globalComponentRegistry.registerComponent(new HealthJMXExposerImpl(health), HealthJMXExposer.class); if (start) start(); }
Source:
<code>public void testProcessMultipleTasks() throws Exception { CountDownLatch task0ProcessedMessages = new CountDownLatch(1); CountDownLatch task1ProcessedMessages = new CountDownLatch(1); SystemConsumers consumerMultiplexer = mock(SystemConsumers.class); when(consumerMultiplexer.pollIntervalMs()).thenReturn(10); OffsetManager offsetManager = mock(OffsetManager.class); TestTask task0 = new TestTask(true, true, false, task0ProcessedMessages); TestTask task1 = new TestTask(true, false, true, task1ProcessedMessages); TaskInstance t0 = createTaskInstance(task0, taskName0, ssp0, offsetManager, consumerMultiplexer); TaskInstance t1 = createTaskInstance(task1, taskName1, ssp1, offsetManager, consumerMultiplexer); <START> Map<TaskName, RunLoopTask> tasks = new HashMap<>(); <END> tasks.put(taskName0, t0); tasks.put(taskName1, t1); int maxMessagesInFlight = 1; RunLoop runLoop = new RunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, maxIdleMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)).thenReturn(envelope0).thenReturn(envelope1).thenReturn(null); runLoop.run(); task0ProcessedMessages.await(); task1ProcessedMessages.await(); assertEquals(1, task0.processed); assertEquals(1, task0.completed.get()); assertEquals(1, task1.processed); assertEquals(1, task1.completed.get()); assertEquals(2L, containerMetrics.envelopes().getCount()); assertEquals(2L, containerMetrics.processes().getCount()); }</code><technical_language>RunLoopTask mocked in this test instead of a concrete TaskInstance? validate extraction of interface simplify test depend TaskInstance</technical_language>

Target:
public void testProcessMultipleTasks() { SystemConsumers consumerMultiplexer = mock(SystemConsumers.class); RunLoopTask task0 = getMockRunLoopTask(taskName0, ssp0); RunLoopTask task1 = getMockRunLoopTask(taskName1, ssp1); Map<TaskName, RunLoopTask> tasks = new HashMap<>(); tasks.put(taskName0, task0); tasks.put(taskName1, task1); int maxMessagesInFlight = 1; RunLoop runLoop = new RunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, maxIdleMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)).thenReturn(envelope00).thenReturn(envelope11).thenReturn(ssp0EndOfStream).thenReturn(ssp1EndOfStream).thenReturn(null); runLoop.run(); verify(task0).process(eq(envelope00), any(), any()); verify(task1).process(eq(envelope11), any(), any()); assertEquals(4L, containerMetrics.envelopes().getCount()); }
Source:
<code>public void deleteModel() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModel(modelId).subscribe(val -> <START> System.out.printf("Model ID = %s is deleted%n", modelId)); <END> END: com.azure.ai.formrecognizer.FormTrainingAsyncClient.deleteModel#string }</code><technical_language>need subscribe void. update this formTrainingAsyncClient.deleteModel("{modelId}")</technical_language>

Target:
public void deleteModel() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModel(modelId).subscribe(val -> System.out.printf("Model Id: %s is deleted%n", modelId)); END: com.azure.ai.formrecognizer.FormTrainingAsyncClient.deleteModel#string }
Source:
<code>protected <T> boolean matchEntity(VmWatchdog entity, T id) { <START> return true; <END> }</code><technical_language>if true, ---> return entity.getId().equals(id); cut corners</technical_language>

Target:
protected <T> boolean matchEntity(VmWatchdog entity, T id) { return entity.getId().equals(id); }
Source:
<code><START> public Expression getFillOutlineColor() { <END> if (paint.get("fill-outline-color") != null) { return parse.color(paint, "fill-outline-color", Color.BLACK ); } else { return getFillColor(); } }</code><technical_language>names of Expression-returning methods query methods leave "get" conform convention discussed for MBLayer.java</technical_language>

Target:
public Color getFillOutlineColor(){ if (paint.get("fill-outline-color") != null) { return parse.optional(Color.class, paint, "fill-outline-color", Color.BLACK); } else { return getFillColor(); } }
Source:
<code>public BoundingBox(final List<Point> points) { if (points == null) { this.points = null; } else { <START> this.points = Collections.unmodifiableList(points); <END> } }</code><technical_language>clone list making immutable. Collections.unmodifiableList wraps collection in implementation throws mutating APIs</technical_language>

Target:
public BoundingBox(final List<Point> points) { Objects.requireNonNull(points, "'points' cannot be null."); this.points = Collections.unmodifiableList(new ArrayList<>(points)); }
Source:
<code>private StackServiceRequest getRequest(Map<String, Object> properties) { return new StackServiceRequest( (String) properties.get(STACK_NAME_PROPERTY_ID), (String) properties.get(STACK_VERSION_PROPERTY_ID), <START> (String) properties.get(SERVICE_NAME_PROPERTY_ID)); <END> }</code><technical_language>constructor properly credential store supported enabled; relevant _set_ methods called</technical_language>

Target:
private StackServiceRequest getRequest(Map<String, Object> properties) { return new StackServiceRequest( (String) properties.get(STACK_NAME_PROPERTY_ID), (String) properties.get(STACK_VERSION_PROPERTY_ID), (String) properties.get(SERVICE_NAME_PROPERTY_ID), (String) properties.get(CREDENTIAL_STORE_SUPPORTED), (String) properties.get(CREDENTIAL_STORE_ENABLED)); }
Source:
<code>private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<HashEntry>(tableSize); loadLocks = new ReentrantLock[cfg.getConcurrencyLevel()]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new ReentrantLock(true ); maxBytes = cfg.getBlockLimit(); maxStreamThroughCache = (long) (maxBytes * cfg.getStreamRatio()); blockSize = cfg.getBlockSize(); <START> if ((blockSize & (blockSize - 1)) != 0) <END> throw new IllegalArgumentException(JGitText.get().bSizeMustBePowerOf2); blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); clockHand = new Ref<Object>(new DfsPackKey(), -1, 0, null); clockHand.next = clockHand; packCache = new ConcurrentHashMap<DfsPackDescription, DfsPackFile>( 16, 0.75f, 1); packFiles = Collections.unmodifiableCollection(packCache.values()); statHit = new AtomicLong(); statMiss = new AtomicLong(); }</code><technical_language>style nit: missing braces, a while braces single line blocks, change this for new modified code</technical_language>

Target:
private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<HashEntry>(tableSize); loadLocks = new ReentrantLock[cfg.getConcurrencyLevel()]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new ReentrantLock(true ); maxBytes = cfg.getBlockLimit(); maxStreamThroughCache = (long) (maxBytes * cfg.getStreamRatio()); blockSize = cfg.getBlockSize(); if ((blockSize & (blockSize - 1)) != 0) { throw new IllegalArgumentException(JGitText.get().blockSizeNotPowerOf2); } blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); clockHand = new Ref<Object>(new DfsPackKey(), -1, 0, null); clockHand.next = clockHand; packCache = new ConcurrentHashMap<DfsPackDescription, DfsPackFile>( 16, 0.75f, 1); packFiles = Collections.unmodifiableCollection(packCache.values()); statHit = new AtomicLong(); statMiss = new AtomicLong(); }
Source:
<code>private SearchResponse getSearchResponse(ElasticsearchQueryBuilder queryBuilder) { try { return retry() .maxAttempts(maxAttempts) .exponentialBackoff(maxRetryTime, 2.0) <START> .run("searchRequest", () -> { <END> return queryBuilder.buildScrollSearchRequest() .execute() .actionGet(requestTimeout.toMillis()); }); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>nit: expression lambda L214 (remove curly braces)</technical_language>

Target:
private SearchResponse getSearchResponse(ElasticsearchQueryBuilder queryBuilder) { try { return retry() .maxAttempts(maxAttempts) .exponentialBackoff(maxRetryTime) .run("searchRequest", () -> queryBuilder.buildScrollSearchRequest() .execute() .actionGet(requestTimeout.toMillis())); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public static FilterGenerator getInstance() { <START> return Holder.INSTNACE; <END> }</code><technical_language>misspelled INSTANCE</technical_language>

Target:
public static FilterGenerator getInstance() { return Holder.INSTANCE; }
Source:
<code>private static boolean isLocalJarUpToDate(String url, String filePath) { try { URLConnection urlConnection = new URL(url).openConnection(); File file = new File(filePath); System.out.println("Url date=" + new Date(urlConnection.getLastModified())); System.out.println("File date=" + new Date(file.lastModified())); if (!file.exists() || file.lastModified() < urlConnection.getLastModified()) { <START> System.out.println("Local jar " + file + " is obsolete or not present"); <END> } else { System.out.println("Local jar " + file + " is up to date"); return true; } } catch (IOException e) { e.printStackTrace(); } return false; }</code><technical_language>System.out</technical_language>

Target:
private boolean isLocalJarUpToDate(String url, String filePath) { try { URLConnection urlConnection = new URL(url).openConnection(); File file = new File(filePath); logger.info("Url date=" + new Date(urlConnection.getLastModified())); logger.info("File date=" + new Date(file.lastModified())); if (!file.exists() || file.lastModified() < urlConnection.getLastModified()) { logger.info("Local jar " + file + " is obsolete or not present"); } else { logger.info("Local jar " + file + " is up to date"); return true; } } catch (IOException e) { logError("Error when contacting the remote url " + url, e); } return false; }
Source:
<code>public void close() { <START> if (reader != null) { <END> reader.close(); reader = null; } }</code><technical_language>is method Misc.free() this</technical_language>

Target:
public void close() { reader = Misc.free(reader); }
Source:
<code>protected void testAccessControl() throws Exception { InstructorAttributes instructor = typicalBundle.instructors.get("instructor3OfCourse1"); StudentAttributes student = typicalBundle.students.get("student2InCourse1"); String[] submissionParams = new String[] { <START> Const.ParamsNames.COURSE_ID, instructor.courseId, <END> Const.ParamsNames.STUDENT_EMAIL, student.email, Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session" }; verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams); }</code><technical_language>accessing courseId instructor</technical_language>

Target:
protected void testAccessControl() throws Exception { InstructorAttributes instructor = typicalBundle.instructors.get("instructor3OfCourse1"); StudentAttributes student = typicalBundle.students.get("student2InCourse1"); CourseAttributes course = typicalBundle.courses.get("typicalCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.STUDENT_EMAIL, student.email, Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session" }; verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams); ______TS("Instructor cannot view sections without View-Student-In-Sections privilege"); instructor = typicalBundle.instructors.get("helperOfCourse1"); gaeSimulation.loginAsInstructor(instructor.googleId); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.STUDENT_EMAIL, student.email, Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session" }; InstructorStudentRecordsAjaxPageAction a = getAction(submissionParams); ShowPageResult r = getShowPageResult(a); a = getAction(submissionParams); r = getShowPageResult(a); assertEquals( getPageResultDestination(Const.ViewURIs.INSTRUCTOR_STUDENT_RECORDS_AJAX, false, "idOfHelperOfCourse1"), r.getDestinationWithParams()); assertFalse(r.isError); assertEquals("", r.getStatusMessage()); InstructorStudentRecordsAjaxPageData data = (InstructorStudentRecordsAjaxPageData) r.data; assertEquals(0, data.getResultsTables().size()); }
Source:
<code>private File getPathToTile(int x, int y) { File path = new File(cacheDirectory, formatLatLon(x, y) + ".tiff"); if (path.exists()) { return path; } else { path.getParentFile().mkdirs(); if (awsAccessKey == null || awsSecretKey == null) { throw new RuntimeException( "Cannot download NED tiles from S3: awsAccessKey or awsSecretKey properties are not set"); } log.info("Downloading NED degree tile " + path); AWSCredentials awsCredentials = new AWSCredentials(awsAccessKey, awsSecretKey); String key = formatLatLon(x, y) + ".tiff"; try { S3Service s3Service = new RestS3Service(awsCredentials); S3Object object = s3Service.getObject(awsBucketName, key); InputStream istream = object.getDataInputStream(); FileOutputStream ostream = new FileOutputStream(path); byte[] buffer = new byte[4096]; while (true) { int read = istream.read(buffer); if (read == -1) { break; } ostream.write(buffer, 0, read); } ostream.close(); istream.close(); } catch (ServiceException | IOException e) { log.error("Error downloading tile {}! Error: {}.", key, e.getMessage()); path.deleteOnExit(); <START> return null; <END> } return path; } }</code><technical_language>Do want continue here? I system is set download files I prefer ti failed hard - this rig OTP deployment download fails. I is ok do this in OTP1, in OTP2 strategy fare is fail hard for critical errors - relay network communication. this a bit more robust in OTP2 is street graph is build in a separate step - "pipeline" fallback street graph building transit data top of - is responsibility of pipeline, OTP more</technical_language>

Target:
private File getPathToTile(int x, int y) { File path = new File(cacheDirectory, formatLatLon(x, y) + ".tiff"); if (path.exists()) { return path; } else { path.getParentFile().mkdirs(); if (awsAccessKey == null || awsSecretKey == null) { throw new RuntimeException( "Cannot download NED tiles from S3: awsAccessKey or awsSecretKey properties are not set"); } log.info("Downloading NED degree tile " + path); AWSCredentials awsCredentials = new AWSCredentials(awsAccessKey, awsSecretKey); String key = formatLatLon(x, y) + ".tiff"; try { S3Service s3Service = new RestS3Service(awsCredentials); S3Object object = s3Service.getObject(awsBucketName, key); InputStream istream = object.getDataInputStream(); FileOutputStream ostream = new FileOutputStream(path); byte[] buffer = new byte[4096]; while (true) { int read = istream.read(buffer); if (read == -1) { break; } ostream.write(buffer, 0, read); } ostream.close(); istream.close(); } catch (S3ServiceException e) { if (e.getS3ErrorCode().equals("NoSuchKey")) { log.error( graph.addBuilderAnnotation( new Graphwide( String.format("Elevation tile %s missing from s3bucket. Proceeding without tile!", key) ) ) ); return null; } path.deleteOnExit(); throw new RuntimeException(e); } catch (ServiceException | IOException e) { path.deleteOnExit(); throw new RuntimeException(e); } return path; } }
Source:
<code>public String getInvalidityInfoForEmail(String email) { Assumption.assertTrue("Non-null value expected", email != null); String sanitizedValue = Sanitizer.sanitizeForHtml(email); if (email.isEmpty()) { return getInterpolatedErrorMessage( <START> EMAIL_ERROR_MESSAGE, email, EMAIL_FIELD_NAME, REASON_EMPTY, EMAIL_MAX_LENGTH); <END> } else if (isUntrimmed(email)) { return WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE.replace("${fieldName}", EMAIL_FIELD_NAME); } else if (email.length() > EMAIL_MAX_LENGTH) { return getInterpolatedErrorMessage( EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_TOO_LONG, EMAIL_MAX_LENGTH); } else if (!StringHelper.isMatching(email, REGEX_EMAIL)) { return getInterpolatedErrorMessage( EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_INCORRECT_FORMAT, EMAIL_MAX_LENGTH); } return ""; }</code><technical_language>(and in parts here) fine include parameters in line squished all: java return getInterpolatedErrorMessage(EMAIL_ERROR_MESSAGE, email, ..., ...);</technical_language>

Target:
public String getInvalidityInfoForEmail(String email) { Assumption.assertTrue("Non-null value expected", email != null); String sanitizedValue = Sanitizer.sanitizeForHtml(email); if (email.isEmpty()) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, email, EMAIL_FIELD_NAME, REASON_EMPTY, EMAIL_MAX_LENGTH); } else if (isUntrimmed(email)) { return WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE.replace("${fieldName}", EMAIL_FIELD_NAME); } else if (email.length() > EMAIL_MAX_LENGTH) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_TOO_LONG, EMAIL_MAX_LENGTH); } else if (!StringHelper.isMatching(email, REGEX_EMAIL)) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_INCORRECT_FORMAT, EMAIL_MAX_LENGTH); } return ""; }
Source:
<code>public Response deleteSubscriptionConstraints(@PathParam("topicName") String topicName, @PathParam("subscriptionName") String subscriptionName) { <START> service.deleteConstraints(SubscriptionName.fromString(String.format("%s$%s", topicName, subscriptionName))); <END> return Response.status(OK).build(); }</code><technical_language>In opinion is a right place show internal representation of subscription name. do like: new SubscriptionName(subscriptionName, TopicName.fromQualifiedName(topicName))</technical_language>

Target:
public Response deleteSubscriptionConstraints(@PathParam("topicName") String topicName, @PathParam("subscriptionName") String subscriptionName) { service.deleteConstraints(new SubscriptionName(subscriptionName, TopicName.fromQualifiedName(topicName))); return Response.status(OK).build(); }
Source:
<code>public void validateAllFilesForDownloadArchival() { <START> selectAllFiles(); <END> boolean guestbookRequired = isDownloadPopupRequired(); boolean downloadOriginal = false; validateFilesForDownload(guestbookRequired, downloadOriginal); }</code><technical_language>I assume this selectAllFiles() is responsible for odd UI behavior... select "Download" Access Dataset dropdown, get ZIP download, files selected in files table... necessary... a get ZIP unexpected UI behavior</technical_language>

Target:
public void validateAllFilesForDownloadArchival() { boolean guestbookRequired = isDownloadPopupRequired(); boolean downloadOriginal = false; validateFilesForDownloadAll(guestbookRequired, downloadOriginal); }
Source:
<code>private void notifySync(Queue<CountDownLatch> latches) { if (latches == null) { return; } <START> while (true) { <END> CountDownLatch latch = latches.poll(); if (latch == null) { break; } latch.countDown(); } }</code><technical_language>This method I talking concurrent writes for key, notify more 1 caller time. I if is if notify 1 latch return</technical_language>

Target:
private void notifySync(Queue<CountDownLatch> latches) { if (latches == null) { return; } CountDownLatch latch = latches.poll(); if (latch != null) { latch.countDown(); } }
Source:
<code>public void testMoveAdminUnitIntoFolder() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("is not a folder or a work and cannot be added to a folder"); <START> FolderObject mockWorkObj = mock(FolderObject.class); <END> when(repositoryObjectLoader.getRepositoryObject(destPid)).thenReturn(mockWorkObj); PID movePid = makePid(); AdminUnit moveObj = mock(AdminUnit.class); when(repositoryObjectLoader.getRepositoryObject(movePid)).thenReturn(moveObj); List<PID> movePids = asList(movePid); service.moveObjects(mockAgent, destPid, movePids); }</code><technical_language>minor, variable name is indicating wrong object type</technical_language>

Target:
public void testMoveAdminUnitIntoFolder() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("is not a folder or a work and cannot be added to a folder"); FolderObject mockFolderObj = mock(FolderObject.class); when(repositoryObjectLoader.getRepositoryObject(destPid)).thenReturn(mockFolderObj); PID movePid = makePid(); AdminUnit moveObj = mock(AdminUnit.class); when(repositoryObjectLoader.getRepositoryObject(movePid)).thenReturn(moveObj); List<PID> movePids = asList(movePid); service.moveObjects(mockAgent, destPid, movePids); }
Source:
<code>private void collectServiceInterfaces(SwitchYardType switchyard) { if (switchyard == null) { return; } ClassLoader oldTCCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader( JavaUtil.getProjectClassLoader( JavaCore.create(WorkspaceSynchronizer.getFile(switchyard.eResource()).getProject()), getClass().getClassLoader())); for (Iterator<EObject> it = EcoreUtil.getAllContents(switchyard, true); it.hasNext();) { EObject eobject = it.next(); if (eobject instanceof Contract) { Interface intf = ((Contract) eobject).getInterface(); if (intf == null) { continue; } try { ServiceInterface si = SwitchYardModelUtils.getServiceInterface(intf); if (si != null) { _serviceInterfaces.put((Contract) eobject, si); } } catch (Exception e) { <START> e.printStackTrace(); <END> if (e instanceof RuntimeException) { String message = e.getMessage(); if (message != null && message.startsWith("SWITCHYARD010004")) { _serviceInterfaces.put((Contract) eobject, INVALID_SERVICE_INTERFACE); } else { _serviceInterfaces.put((Contract) eobject, URESOLVABLE_SERVICE_INTERFACE); } } else { _serviceInterfaces.put((Contract) eobject, URESOLVABLE_SERVICE_INTERFACE); } } } } } catch (Exception e) { _problems.add(new Status(Status.WARNING, Activator.PLUGIN_ID, Messages.WiringValidationContext_statusMessage_errorLoadingServiceInterfaceMetadata, e)); } finally { Thread.currentThread().setContextClassLoader(oldTCCL); } }</code><technical_language>print stacktrace? log error log</technical_language>

Target:
private void collectServiceInterfaces(SwitchYardType switchyard) { if (switchyard == null) { return; } ClassLoader oldTCCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader( JavaUtil.getProjectClassLoader( JavaCore.create(WorkspaceSynchronizer.getFile(switchyard.eResource()).getProject()), getClass().getClassLoader())); for (Iterator<EObject> it = EcoreUtil.getAllContents(switchyard, true); it.hasNext();) { EObject eobject = it.next(); if (eobject instanceof Contract) { Interface intf = ((Contract) eobject).getInterface(); if (intf == null) { continue; } try { ServiceInterface si = SwitchYardModelUtils.getServiceInterface(intf); if (si != null) { _serviceInterfaces.put((Contract) eobject, si); } } catch (Exception e) { Activator.getDefault().getLog().log(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Service Interface cannot be loaded.", e)); if (e instanceof RuntimeException) { String message = e.getMessage(); if (message != null && message.startsWith("SWITCHYARD010004")) { _serviceInterfaces.put((Contract) eobject, INVALID_SERVICE_INTERFACE); } else { _serviceInterfaces.put((Contract) eobject, URESOLVABLE_SERVICE_INTERFACE); } } else { _serviceInterfaces.put((Contract) eobject, URESOLVABLE_SERVICE_INTERFACE); } } } } } catch (Exception e) { _problems.add(new Status(Status.WARNING, Activator.PLUGIN_ID, Messages.WiringValidationContext_statusMessage_errorLoadingServiceInterfaceMetadata, e)); } finally { Thread.currentThread().setContextClassLoader(oldTCCL); } }
Source:
<code>public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.CLASSDEF, ctx -> { ClassDef classDef = (ClassDef) ctx.syntaxNode(); if (!isRelevantClass(classDef)) { return; } <START> List<FunctionDef> functions = classDef.body().statements().stream() <END> .filter(s -> s.is(Tree.Kind.FUNCDEF)) .map(s -> (FunctionDef) s) .collect(Collectors.toList()); for (FunctionDef functionDef : functions) { handleFunctionDef(ctx, classDef, functionDef); } }); }</code><technical_language>Beware lose some methods. In Python do like: python class A: if p: def f(self): ... suggest a visitor instead, symbols ClassSymbols.declaredMembers()</technical_language>

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.CLASSDEF, ctx -> { ClassDef classDef = (ClassDef) ctx.syntaxNode(); ClassSymbol classSymbol = TreeUtils.getClassSymbolFromDef(classDef); if (classSymbol == null || !isRelevantClass(classDef, classSymbol)) { return; } CollectFunctionDefsVisitor visitor = new CollectFunctionDefsVisitor(); classDef.body().accept(visitor); visitor.functionDefs.forEach(functionDef -> handleFunctionDef(ctx, classDef, classSymbol, functionDef)); }); }
Source:
<code>private void readInternal(long position, byte[] buffer, int bufferOffset, int bufferLength) { try { long readStart = System.nanoTime(); inputStream.readFully(position, buffer, bufferOffset, bufferLength); stats.readDataBytesPerSecond(bufferLength, System.nanoTime() - readStart); } catch (PrestoException e) { throw e; } catch (Exception e) { <START> throw new PrestoException(HIVE_FILESYSTEM_ERROR, format("Error reading from %s at position %s", id.toString(), position), e); <END> } }</code><technical_language>need toString call</technical_language>

Target:
private void readInternal(long position, byte[] buffer, int bufferOffset, int bufferLength) { try { long readStart = System.nanoTime(); inputStream.readFully(position, buffer, bufferOffset, bufferLength); stats.readDataBytesPerSecond(bufferLength, System.nanoTime() - readStart); } catch (PrestoException e) { throw e; } catch (Exception e) { throw new PrestoException(HIVE_FILESYSTEM_ERROR, format("Error reading from %s at position %s", id, position), e); } }
Source:
<code><START> public void testFileLoggingLoggingLevels() throws Exception { <END> final File path = tempFolder.newFolder(); final String logDirectory = emptyDirectory(path.getAbsolutePath()); LogFileConfiguration config = new LogFileConfiguration(logDirectory) .setUsePlaintext(true) .setMaxRotateCount(0); testWithConfiguration(LogLevel.INFO, config, new Runnable() { @Override public void run() { LogLevel levels[] = { LogLevel.NONE, LogLevel.ERROR, LogLevel.WARNING, LogLevel.INFO, LogLevel.VERBOSE }; for (LogLevel level : levels) { Database.log.getFile().setLevel(level); Log.v("DATABASE", "TEST VERBOSE"); Log.i("DATABASE", "TEST INFO"); Log.w("DATABASE", "TEST WARNING"); Log.e("DATABASE", "TEST ERROR"); } try { for (File log : path.listFiles()) { BufferedReader fin = new BufferedReader(new FileReader(log)); int lineCount = 0; while (fin.readLine() != null) { lineCount++; } if (log.getAbsolutePath().contains("verbose")) { assertEquals(2, lineCount); } else if (log.getAbsolutePath().contains("info")) { assertEquals(3, lineCount); } else if (log.getAbsolutePath().contains("warning")) { assertEquals(4, lineCount); } else if (log.getAbsolutePath().contains("error")) { assertEquals(5, lineCount); } } } catch(Exception e) { fail("Exception during test callback " + e.toString()); } } }); }</code><technical_language>Wondering if need clean folder test is done</technical_language>

Target:
public void testFileLoggingLoggingLevels() throws IOException { final File path = tempFolder.newFolder(); final String logDirectory = emptyDirectory(path.getAbsolutePath()); LogFileConfiguration config = new LogFileConfiguration(logDirectory) .setUsePlaintext(true) .setMaxRotateCount(0); testWithConfiguration(LogLevel.INFO, config, () -> { LogLevel levels[] = { LogLevel.NONE, LogLevel.ERROR, LogLevel.WARNING, LogLevel.INFO, LogLevel.VERBOSE }; for (LogLevel level : levels) { Database.log.getFile().setLevel(level); Log.v(LogDomain.DATABASE, "TEST VERBOSE"); Log.i(LogDomain.DATABASE, "TEST INFO"); Log.w(LogDomain.DATABASE, "TEST WARNING"); Log.e(LogDomain.DATABASE, "TEST ERROR"); } try { for (File log : path.listFiles()) { BufferedReader fin = new BufferedReader(new FileReader(log)); int lineCount = 0; while (fin.readLine() != null) { lineCount++; } if (log.getAbsolutePath().contains("verbose")) { assertEquals(2, lineCount); } else if (log.getAbsolutePath().contains("info")) { assertEquals(3, lineCount); } else if (log.getAbsolutePath().contains("warning")) { assertEquals(4, lineCount); } else if (log.getAbsolutePath().contains("error")) { assertEquals(5, lineCount); } } } catch(Exception e) { fail("Exception during test callback " + e.toString()); } }); }
Source:
<code><START> public String getInstanceBeanName(String instanceName) { <END> return String.format("%s,%s=%s", clusterBeanName(), INSTANCE_DN_KEY, instanceName); }</code><technical_language>I strong preference here. - protected package-private enough here? - Or, other hand, methods public, avoid test codes INSTANCE_DN_KEY RESOURCE_DN_KEY directly. a in this PR, though</technical_language>

Target:
protected String getInstanceBeanName(String instanceName) { return String.format("%s,%s=%s", clusterBeanName(), INSTANCE_DN_KEY, instanceName); }
Source:
<code>protected <T> Class<T> loadClass(BrooklynCatalog catalog, String type) throws ClassNotFoundException { try { Class<T> result = (Class<T>) catalog.getRootClassLoader().loadClass(type); log.debug("Loaded class directly", type); return result; } catch (ClassNotFoundException e) { <START> log.warn("No catalog item for type {}, and could not load class directly; rethrowing", type); <END> throw e; } }</code><technical_language>Exception message wrong (was moved loadEntityType method "no catalog item for type" right include. Change "Could load class directly; rethrowing"</technical_language>

Target:
protected <T> Class<T> loadClass(BrooklynCatalog catalog, String type) throws ClassNotFoundException { try { Class<T> result = (Class<T>) catalog.getRootClassLoader().loadClass(type); log.debug("Loaded class directly", type); return result; } catch (ClassNotFoundException e) { log.warn("Could not load class directly; rethrowing", type); throw e; } }
Source:
<code><START> public PagedArrayList(Collection<? extends T> collection, KeysetPage keyset, long totalSize, int firstResult, int maxResults) { <END> super(collection); this.keyset = keyset; this.totalSize = totalSize; this.page = (int) Math.floor((firstResult == -1 ? 0 : firstResult) * 1d / maxResults) + 1; this.totalPages = totalSize < 1 ? (int) totalSize : (int) Math.ceil(totalSize * 1d / maxResults); this.firstResult = firstResult; this.maxResults = maxResults; }</code><technical_language>share common constructor code</technical_language>

Target:
public PagedArrayList(Collection<? extends T> collection, KeysetPage keyset, long totalSize, int firstResult, int maxResults) { super(collection); this.keyset = keyset; this.totalSize = totalSize; this.page = (int) Math.floor((firstResult == -1 ? 0 : firstResult) * 1d / maxResults) + 1; this.totalPages = totalSize < 1 ? 0 : (int) Math.ceil(totalSize * 1d / maxResults); this.firstResult = firstResult; this.maxResults = maxResults; }
Source:
<code>LocalDateTime extractV4ExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { String ts = ""; try { ts = args.get(SignerConstants.X_AMZ_DATE.toLowerCase()); val reqDate = ZonedDateTime.parse(ts, formatter); log.trace("Request DateTime (Zoned): %s%n", reqDate); val expSeconds = Integer.parseInt(args.get(SignerConstants.X_AMZ_EXPIRES.toLowerCase())); return reqDate.withZoneSameInstant(effectiveTimeZone).toLocalDateTime().plusSeconds(expSeconds); } catch (DateTimeParseException pe) { <START> log.error("%s is not parsable!%n", ts); <END> throw pe; } }</code><technical_language>Wrong variable type in log, {}</technical_language>

Target:
LocalDateTime extractV4ExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { String ts = ""; try { ts = args.get(SignerConstants.X_AMZ_DATE.toLowerCase()); val reqDate = ZonedDateTime.parse(ts, formatter); log.trace("Request DateTime (Zoned): {}", reqDate); val expSeconds = Integer.parseInt(args.get(SignerConstants.X_AMZ_EXPIRES.toLowerCase())); return reqDate.withZoneSameInstant(effectiveTimeZone).toLocalDateTime().plusSeconds(expSeconds); } catch (DateTimeParseException pe) { log.error("{} is not parsable!", ts); throw pe; } }
Source:
<code>private QueryBuilder createQueryClauseSearchAttribute( QueryRule queryRule, EntityType entityType) { List<Attribute> attributePath = getAttributePathExpanded(queryRule.getField(), entityType); Attribute attr = attributePath.get(attributePath.size() - 1); Object queryValue = getQueryValue(attr, queryRule.getValue()); String fieldName = getQueryFieldName(attributePath); AttributeType dataType = attr.getDataType(); switch (dataType) { case DATE: case DATE_TIME: case DECIMAL: case EMAIL: case ENUM: case HTML: case HYPERLINK: case INT: case LONG: case SCRIPT: case STRING: case TEXT: return nestedQueryBuilder( entityType, attributePath, QueryBuilders.simpleQueryStringQuery(queryValue.toString()) .defaultOperator(org.elasticsearch.index.query.Operator.AND) .field(fieldName)); case BOOL: throw new MolgenisQueryException( "Cannot execute search query on [" + dataType + "] attribute"); case CATEGORICAL: case CATEGORICAL_MREF: case XREF: case MREF: case FILE: case ONE_TO_MANY: case COMPOUND: throw new MolgenisQueryException( format( <START> "Illegal data type [%s] for operator [%s]", dataType, QueryRule.Operator.SEARCH)); <END> default: throw new UnexpectedEnumException(dataType); } }</code><technical_language>this need SEARCH_QUERY</technical_language>

Target:
private QueryBuilder createQueryClauseSearchAttribute( QueryRule queryRule, EntityType entityType) { List<Attribute> attributePath = getAttributePathExpanded(queryRule.getField(), entityType); Attribute attr = attributePath.get(attributePath.size() - 1); Object queryValue = getQueryValue(attr, queryRule.getValue()); String fieldName = getQueryFieldName(attributePath); AttributeType dataType = attr.getDataType(); switch (dataType) { case DATE: case DATE_TIME: case DECIMAL: case EMAIL: case ENUM: case HTML: case HYPERLINK: case INT: case LONG: case SCRIPT: case STRING: case TEXT: return nestedQueryBuilder( entityType, attributePath, QueryBuilders.simpleQueryStringQuery(queryValue.toString()) .defaultOperator(org.elasticsearch.index.query.Operator.AND) .field(fieldName)); case BOOL: throw new MolgenisQueryException( "Cannot execute search query on [" + dataType + "] attribute"); case CATEGORICAL: case CATEGORICAL_MREF: case XREF: case MREF: case FILE: case ONE_TO_MANY: case COMPOUND: throw new MolgenisQueryException( format("Illegal data type [%s] for operator [%s]", dataType, Operator.SEARCH_QUERY)); default: throw new UnexpectedEnumException(dataType); } }
Source:
<code>public static String normalizePhone(String phoneNumber) { if (phoneNumber == null) return ""; <START> if (false) { <END> if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return PhoneNumberUtils.formatNumberToE164(phoneNumber, instance.countryIso); } else { return PhoneNumberUtils.formatNumber(instance.toE164(phoneNumber)); } } String normalized = instance.toE164(phoneNumber); Log.d("NORM", phoneNumber + " => " + normalized); return PhoneNumberUtils.formatNumber(normalized); }</code><technical_language>good toggle production</technical_language>

Target:
public static String normalizePhone(String phoneNumber) { if (phoneNumber == null) return ""; if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String e164 = PhoneNumberUtils.formatNumberToE164(phoneNumber, instance.countryIso); if (e164 != null) { return PhoneNumberUtils.formatNumber(e164, instance.countryIso); } } return PhoneNumberUtils.formatNumber(instance.toE164(phoneNumber)); }
Source:
<code>public BytecodeNode generateCall(String name, ScalarFunctionImplementation function, List<BytecodeNode> arguments) { Binding binding = callSiteBinder.bind(function.getMethodHandle()); Optional<BytecodeNode> instance = Optional.empty(); if (function.getInstanceFactory().isPresent()) { FieldDefinition field = cachedInstanceBinder.getCachedInstance(function.getInstanceFactory().get()); instance = Optional.of(scope.getThis().getField(field)); <START> } <END> return generateInvocation(scope, name, function, instance, arguments, callSiteBinder); }</code><technical_language>Remove unused binding variable</technical_language>

Target:
public BytecodeNode generateCall(String name, ScalarFunctionImplementation function, List<BytecodeNode> arguments) { Optional<BytecodeNode> instance = Optional.empty(); if (function.getInstanceFactory().isPresent()) { FieldDefinition field = cachedInstanceBinder.getCachedInstance(function.getInstanceFactory().get()); instance = Optional.of(scope.getThis().getField(field)); } return generateInvocation(scope, name, function, instance, arguments, callSiteBinder); }
Source:
<code>public void blockAndUnblockTwice() throws KettleException, InterruptedException { final ExecutorService executorService = Executors.newFixedThreadPool( 1 ); TransMeta parentMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); TransMeta subMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = new Trans( parentMeta, loggingObject ); SubtransExecutor subtransExecutor = new SubtransExecutor( "subtransname", parentTrans, subMeta, true, new TransExecutorParameters(), "", 1 ); RowMetaInterface rowMeta = parentMeta.getStepFields( "Data Grid" ); List<RowMetaAndData> rows = Arrays.asList( new RowMetaAndData( rowMeta, "Pentaho", 1L ), new RowMetaAndData( rowMeta, "Pentaho", 2L ), new RowMetaAndData( rowMeta, "Pentaho", 3L ), new RowMetaAndData( rowMeta, "Pentaho", 4L ) ); Future future = executorService.submit( () -> safeAcquirePermits( subtransExecutor, 8 ) ); <START> Thread.sleep( 1000 ); <END> subtransExecutor.execute( rows ); subtransExecutor.execute( rows ); final boolean timedOut = !safeWaitForCompletion( future, 3 ); assertFalse( timedOut ); }</code><technical_language>Thread sleeps in tests bite time. A alternative-- define a CompletableFuture set permits acquired in safeAcquirePermits, wait future for some duration. some other blocking technique</technical_language>

Target:
public void blockAndUnblockTwice() throws KettleException, InterruptedException, ExecutionException, TimeoutException { final ExecutorService executorService = Executors.newFixedThreadPool( 1 ); TransMeta parentMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); TransMeta subMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = new Trans( parentMeta, loggingObject ); SubtransExecutor subtransExecutor = new SubtransExecutor( "subtransname", parentTrans, subMeta, true, new TransExecutorParameters(), "", 1 ); RowMetaInterface rowMeta = parentMeta.getStepFields( "Data Grid" ); List<RowMetaAndData> rows = Arrays.asList( new RowMetaAndData( rowMeta, "Pentaho", 1L ), new RowMetaAndData( rowMeta, "Pentaho", 2L ), new RowMetaAndData( rowMeta, "Pentaho", 3L ), new RowMetaAndData( rowMeta, "Pentaho", 4L ) ); CompletableFuture<Boolean> acquireThreadRunning = new CompletableFuture(); Future future = executorService.submit( () -> safeAcquirePermits( subtransExecutor, 8, acquireThreadRunning ) ); assertTrue( acquireThreadRunning.get( 5, TimeUnit.SECONDS ) ); subtransExecutor.execute( rows ); subtransExecutor.execute( rows ); final boolean timedOut = !safeWaitForCompletion( future, 5 ); assertFalse( timedOut ); }
Source:
<code>protected ValueBlock(CustomUIPane pane, String fxml) { super(pane); value = new SimpleStringProperty("5.0"); this.loadFXML(fxml); try { <START> output = new OutputAnchor(this, new Value(new ConstT("Float"), getValue()).analyze(getPane().getEnvInstance())); <END> } catch (HaskellException e) { throw new TypeUnavailableException(); } outputSpace.getChildren().add(this.getOutputAnchor()); outputSpace.toFront(); output.layoutXProperty().bind(outputSpace.widthProperty().divide(2)); }</code><technical_language>analyze a single a type</technical_language>

Target:
protected ValueBlock(CustomUIPane pane, String fxml) { super(pane); value = new SimpleStringProperty("5.0"); this.loadFXML(fxml); try { output = new OutputAnchor(this, new Value(new ConstT("Float"), getValue()).analyze(getPane().getEnvInstance())); } catch (HaskellException e) { throw new TypeUnavailableException(); } outputSpace.setCenter(this.getOutputAnchor()); outputSpace.toFront(); }
Source:
<code>public Map<Integer, List<Cluster>> execute(GraphDatabaseService service) { Queue<Cluster> rootClusters = new PriorityQueue<>((e1, e2) -> e1.getStartRank() - e2.getStartRank() ); Set<String> visited = new HashSet<>(); Map<Integer, List<Cluster>> result = new HashMap<Integer, List<Cluster>>(); ClustersFromQuery clusterFrom = new ClustersFromQuery(visited, startNodes, threshold); rootClusters.addAll(clusterFrom.execute(service)); <START> int minrank = rootClusters.stream().mapToInt(e -> e.getStartRank()).min().getAsInt(); <END> while (!rootClusters.isEmpty()) { Cluster c = rootClusters.poll(); if (c.getStartRank() < minrank || c.getStartRank() > maxRank) { continue; } result.putIfAbsent(c.getStartRank(), new ArrayList<>()); result.get(c.getStartRank()).add(c); c.getNodes().forEach(sn -> { ClustersFromQuery cfq = new ClustersFromQuery(visited, sn.getOutgoing(), threshold); rootClusters.addAll(cfq.execute(service)); }); } return result; }</code><technical_language>Throws exception scrolling end of graph</technical_language>

Target:
public Map<Integer, List<Cluster>> execute(GraphDatabaseService service) { Queue<Cluster> rootClusters = new PriorityQueue<>((e1, e2) -> e1.getStartRank() - e2.getStartRank() ); Set<String> visited = new HashSet<>(); Map<Integer, List<Cluster>> result = new HashMap<Integer, List<Cluster>>(); ClustersFromQuery clusterFrom = new ClustersFromQuery(visited, startNodes, threshold); rootClusters.addAll(clusterFrom.execute(service)); int minrank = rootClusters.stream().mapToInt(e -> e.getStartRank()).min().orElse(0); while (!rootClusters.isEmpty()) { Cluster c = rootClusters.poll(); if (c.getStartRank() < minrank || c.getStartRank() > maxRank) { continue; } result.putIfAbsent(c.getStartRank(), new ArrayList<>()); result.get(c.getStartRank()).add(c); c.getNodes().forEach(sn -> { ClustersFromQuery cfq = new ClustersFromQuery(visited, sn.getOutgoing(), threshold); rootClusters.addAll(cfq.execute(service)); }); } return result; }
Source:
<code>private void makeRollback(OMicroTransaction microTransaction, Exception e) { OLogManager.instance().debug(this, "Error during micro-transaction commit, micro-transaction will be rolled back (tx-id=%d)", e, microTransaction.getId()); <START> rollback(microTransaction); <END> if (e instanceof OException) throw ((OException) e); else throw OException.wrapException(new OStorageException("Error during micro-transaction commit"), e); }</code><technical_language>check RuntimeException OException</technical_language>

Target:
private void makeRollback(OMicroTransaction microTransaction, Exception e) { OLogManager.instance().debug(this, "Error during micro-transaction commit, micro-transaction will be rolled back (tx-id=%d)", e, microTransaction.getId()); rollback(microTransaction); if (e instanceof RuntimeException) throw ((RuntimeException) e); else throw OException.wrapException(new OStorageException("Error during micro-transaction commit"), e); }
Source:
<code>public static String zkSecuritySysConfigString() { String loginConfig = System.getProperty(JAVA_LOGIN_CONFIG_PARAM); String clientEnabled = System.getProperty(ZK_SASL_CLIENT); <START> String contextName = System.getProperty(ZK_LOGIN_CONTEXT_NAME_KEY); <END> return "[" + JAVA_LOGIN_CONFIG_PARAM + "=" + loginConfig + ", " + ZK_SASL_CLIENT + "=" + (clientEnabled == null ? "default:" + DEFAULT_ZK_SASL_CLIENT : clientEnabled) + ", " + ZK_LOGIN_CONTEXT_NAME_KEY + "=" + (contextName == null ? "default:" + DEFAULT_ZK_LOGIN_CONTEXT_NAME : contextName) + "]"; }</code><technical_language>simplify string construction below: java String clientEnabled = System.getProperty(ZK_SASL_CLIENT, "default:" + DEFAULT_ZK_SASL_CLIENT); String contextName = System.getProperty(ZK_LOGIN_CONTEXT_NAME_KEY, "default:" + DEFAULT_ZK_LOGIN_CONTEXT_NAME);</technical_language>

Target:
public static String zkSecuritySysConfigString() { String loginConfig = System.getProperty(JAVA_LOGIN_CONFIG_PARAM); String clientEnabled = System.getProperty(ZK_SASL_CLIENT, "default:" + DEFAULT_ZK_SASL_CLIENT); String contextName = System.getProperty(ZK_LOGIN_CONTEXT_NAME_KEY, "default:" + DEFAULT_ZK_LOGIN_CONTEXT_NAME); return "[" + JAVA_LOGIN_CONFIG_PARAM + "=" + loginConfig + ", " + ZK_SASL_CLIENT + "=" + clientEnabled + ", " + ZK_LOGIN_CONTEXT_NAME_KEY + "=" + contextName + "]"; }