auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testElasticSearchHealthCheck() { final ApiClient webClient = getWebClient(USER_2_USERNAME, testingPostgres); ExtendedGa4GhApi extendedGa4GhApi = new ExtendedGa4GhApi(webClient); MetadataApi metadataApi = new MetadataApi(webClient); try { metadataApi.checkElasticSearch(); } catch (ApiException ex) { assertTrue("Should fail", true); } extendedGa4GhApi.toolsIndexGet(); waitForIndexRefresh(0, extendedGa4GhApi, 0); try { metadataApi.checkElasticSearch(); fail("Should fail even with index because there's no hits"); } catch (ApiException ex) { <START> Assert.assertTrue(ex.getMessage().contains("Internal Server Error")); <END> } WorkflowsApi workflowApi = new WorkflowsApi(webClient); workflowApi.manualRegister("github", "DockstoreTestUser2/dockstore_workflow_cnv", "/workflow/cnv.cwl", "", "cwl", "/test.json"); final Workflow workflowByPathGithub = workflowApi .getWorkflowByPath(WorkflowIT.DOCKSTORE_TEST_USER2_RELATIVE_IMPORTS_WORKFLOW, null, false); final Workflow workflow = workflowApi.refresh(workflowByPathGithub.getId(), false); workflowApi.publish(workflow.getId(), SwaggerUtility.createPublishRequest(true)); waitForIndexRefresh(1, extendedGa4GhApi, 0); try { metadataApi.checkElasticSearch(); } catch (ApiException ex) { fail("Should not fail"); } }</code><technical_language>nitpick: superfluous Assert adds a Codacy alert</technical_language>

Target:
public void testElasticSearchHealthCheck() { final ApiClient webClient = getWebClient(USER_2_USERNAME, testingPostgres); ExtendedGa4GhApi extendedGa4GhApi = new ExtendedGa4GhApi(webClient); MetadataApi metadataApi = new MetadataApi(webClient); try { metadataApi.checkElasticSearch(); } catch (ApiException ex) { assertTrue("Should fail", true); } extendedGa4GhApi.toolsIndexGet(); waitForIndexRefresh(0, extendedGa4GhApi, 0); try { metadataApi.checkElasticSearch(); fail("Should fail even with index because there's no hits"); } catch (ApiException ex) { assertTrue(ex.getMessage().contains("Internal Server Error")); } WorkflowsApi workflowApi = new WorkflowsApi(webClient); workflowApi.manualRegister("github", "DockstoreTestUser2/dockstore_workflow_cnv", "/workflow/cnv.cwl", "", "cwl", "/test.json"); final Workflow workflowByPathGithub = workflowApi .getWorkflowByPath(WorkflowIT.DOCKSTORE_TEST_USER2_RELATIVE_IMPORTS_WORKFLOW, null, false); final Workflow workflow = workflowApi.refresh(workflowByPathGithub.getId(), false); workflowApi.publish(workflow.getId(), SwaggerUtility.createPublishRequest(true)); waitForIndexRefresh(1, extendedGa4GhApi, 0); try { metadataApi.checkElasticSearch(); } catch (ApiException ex) { fail("Should not fail"); } }
Source:
<code>public boolean isReadOnly() { boolean readonly = false; IProxyRepositoryFactory repFactory = ProxyRepositoryFactory.getInstance(); ERepositoryStatus status = repFactory.getStatus(getSelectedRepositoryNode().getObject()); if (status == ERepositoryStatus.LOCK_BY_OTHER || status == ERepositoryStatus.LOCK_BY_USER) { <START> readonly = true; <END> } return readonly; }</code><technical_language>remove condition check offline mode this method, project ref projects in offline mode need care of git TAG mode(all readonly)</technical_language>

Target:
public boolean isReadOnly() { boolean readonly = false; IProxyRepositoryFactory repFactory = ProxyRepositoryFactory.getInstance(); RepositoryNode selectedRepositoryNode = getSelectedRepositoryNode(); ERepositoryStatus status = repFactory.getStatus(selectedRepositoryNode.getObject()); Item item = selectedRepositoryNode.getObject().getProperty().getItem(); ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class); boolean isOpened = coreService.isOpenedItemInEditor(selectedRepositoryNode.getObject()); boolean mainProject = ProjectManager.getInstance().isInCurrentMainProject(selectedRepositoryNode); boolean isSysRoutine = false; if (item instanceof RoutineItem) { if (((RoutineItem) item).isBuiltIn()) { isSysRoutine = true; } } boolean userReadOnlyOnCurrentProject = repFactory.isUserReadOnlyOnCurrentProject(); boolean isOffline = getRepositoryContext().isOffline(); if (isOnTag() || userReadOnlyOnCurrentProject || (isOffline && isOpened) || isSysRoutine || !mainProject || (!isOffline && (status == ERepositoryStatus.LOCK_BY_OTHER || status == ERepositoryStatus.LOCK_BY_USER))) { readonly = true; } return readonly; }
Source:
<code>public void testIsInEuropeanUnion() throws Exception { DatabaseReader reader = new DatabaseReader.Builder(this.geoipFile) .build(); CityResponse city = reader.city(InetAddress.getByName("89.160.20.128")); assertEquals(true, city.getCountry().isInEuropeanUnion()); <START> assertEquals(true, city.getRegisteredCountry().isInEuropeanUnion()); <END> }</code><technical_language>assertTrue</technical_language>

Target:
public void testIsInEuropeanUnion() throws Exception { DatabaseReader reader = new DatabaseReader.Builder(this.geoipFile) .build(); CityResponse city = reader.city(InetAddress.getByName("89.160.20.128")); assertTrue(city.getCountry().isInEuropeanUnion()); assertTrue(city.getRegisteredCountry().isInEuropeanUnion()); }
Source:
<code><START> public Boolean getRootCause() { <END> return rootCause; }</code><technical_language>suggestion public boolean getRootCause() {</technical_language>

Target:
public boolean getRootCause() { return rootCause; }
Source:
<code>public static void main(String[] args) throws Exception { ArgP argp = new ArgP(); CliOptions.addCommon(argp); CliOptions.addAutoMetricFlag(argp); args = CliOptions.parse(argp, args); if (args == null) { usage(argp, 1); } else if (args.length < 1) { usage(argp, 2); } Config config = CliOptions.getConfig(argp); final TSDB tsdb = new TSDB(config); <START> tsdb.getClient().ensureTableExists( <END> config.getString("tsd.storage.hbase.data_table")).joinUninterruptibly(); tsdb.getClient().ensureTableExists( config.getString("tsd.storage.hbase.uid_table")).joinUninterruptibly(); argp = null; try { int points = 0; final long start_time = System.nanoTime(); for (final String path : args) { points += importFile(tsdb.getClient(), tsdb, path); } final double time_delta = (System.nanoTime() - start_time) / 1000000000.0; LOG.info(String.format("Total: imported %d data points in %.3fs" + " (%.1f points/s)", points, time_delta, (points / time_delta))); tsdb.collectStats(new StatsCollector("tsd") { @Override public final void emit(final String line) { System.err.print(line); } }); } finally { try { tsdb.shutdown().joinUninterruptibly(); } catch (Exception e) { LOG.error("Unexpected exception", e); System.exit(1); } } }</code><technical_language>Instead of repeating 4 lines of code in multiple places, do adding a public method TSDB, e.g. checkNecessaryTablesExist()? do: java public Deferred<ArrayList<Object>> checkNecessaryTablesExist() { return Deferred.group(client.ensureTableExists(config.getString("tsd.storage.hbase.data_table")), client.ensureTableExists(config.getString("tsd.storage.hbase.data_table"))); } that</technical_language>

Target:
public static void main(String[] args) throws Exception { ArgP argp = new ArgP(); CliOptions.addCommon(argp); CliOptions.addAutoMetricFlag(argp); args = CliOptions.parse(argp, args); if (args == null) { usage(argp, 1); } else if (args.length < 1) { usage(argp, 2); } Config config = CliOptions.getConfig(argp); final TSDB tsdb = new TSDB(config); tsdb.checkNecessaryTablesExist().joinUninterruptibly(); argp = null; try { int points = 0; final long start_time = System.nanoTime(); for (final String path : args) { points += importFile(tsdb.getClient(), tsdb, path); } final double time_delta = (System.nanoTime() - start_time) / 1000000000.0; LOG.info(String.format("Total: imported %d data points in %.3fs" + " (%.1f points/s)", points, time_delta, (points / time_delta))); tsdb.collectStats(new StatsCollector("tsd") { @Override public final void emit(final String line) { System.err.print(line); } }); } finally { try { tsdb.shutdown().joinUninterruptibly(); } catch (Exception e) { LOG.error("Unexpected exception", e); System.exit(1); } } }
Source:
<code>public void loadState(final Configuration configuration, final Graph... graphs) { if (graphs.length != 1) { throw new IllegalStateException("Must provide one graph to use, received " + graphs.length); } <START> Graph graph = graphs[0]; <END> if (configuration.containsKey(INITIAL_RANK_TRAVERSAL)) this.initialRankTraversal = PureTraversal.loadState(configuration, INITIAL_RANK_TRAVERSAL, graph); if (configuration.containsKey(EDGE_TRAVERSAL)) { this.edgeTraversal = PureTraversal.loadState(configuration, EDGE_TRAVERSAL, graph); this.incidentMessageScope = MessageScope.Local.of(() -> this.edgeTraversal.get().clone()); this.countMessageScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.incidentMessageScope)); } this.vertexCountAsDouble = configuration.getDouble(VERTEX_COUNT, 1.0d); this.alpha = configuration.getDouble(ALPHA, 0.85d); this.totalIterations = configuration.getInt(TOTAL_ITERATIONS, 30); this.property = configuration.getString(PROPERTY, PAGE_RANK); this.vertexComputeKeys = new HashSet<>(Arrays.asList(VertexComputeKey.of(this.property, false), VertexComputeKey.of(EDGE_COUNT, true))); }</code><technical_language>Please add a final graph re-assigned</technical_language>

Target:
public void loadState(final Configuration configuration, final Graph... graphs) { if (graphs.length != 1) { throw new IllegalArgumentException("Must provide one graph to use, received " + graphs.length); } final Graph graph = graphs[0]; if (configuration.containsKey(INITIAL_RANK_TRAVERSAL)) this.initialRankTraversal = PureTraversal.loadState(configuration, INITIAL_RANK_TRAVERSAL, graph); if (configuration.containsKey(EDGE_TRAVERSAL)) { this.edgeTraversal = PureTraversal.loadState(configuration, EDGE_TRAVERSAL, graph); this.incidentMessageScope = MessageScope.Local.of(() -> this.edgeTraversal.get().clone()); this.countMessageScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.incidentMessageScope)); } this.vertexCountAsDouble = configuration.getDouble(VERTEX_COUNT, 1.0d); this.alpha = configuration.getDouble(ALPHA, 0.85d); this.totalIterations = configuration.getInt(TOTAL_ITERATIONS, 30); this.property = configuration.getString(PROPERTY, PAGE_RANK); this.vertexComputeKeys = new HashSet<>(Arrays.asList(VertexComputeKey.of(this.property, false), VertexComputeKey.of(EDGE_COUNT, true))); }
Source:
<code>private void setWindowTitle(boolean pushMode) { final String title; if (pushMode) { title = UIText.RefSpecWizard_pushTitle; } else { title = UIText.RefSpecWizard_fetchTitle; <START> } <END> setWindowTitle(title); }</code><technical_language>braces ({}) for simple one-line statements, please remove them</technical_language>

Target:
private void setWindowTitle(boolean pushMode) { final String title; if (pushMode) title = UIText.RefSpecWizard_pushTitle; else title = UIText.RefSpecWizard_fetchTitle; setWindowTitle(title); }
Source:
<code>public Map<Object, Object> value(Object value) { Map<Object, Object> map = (Map<Object, Object>) value; if (map == null) { return map; } <START> return new HashMap<>(map); <END> }</code><technical_language>is copy necessary</technical_language>

Target:
public Map<Object, Object> value(Object value) { return (Map<Object, Object>) value; }
Source:
<code>public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); if (!feedbackSession.isOpened()) { return new JsonResult("Reminder email could not be sent out " + "as the feedback session is not open for submissions.", HttpStatus.SC_BAD_REQUEST); } <START> String usersToRemind = getNonNullRequestParamValue(Const.ParamsNames.SUBMISSION_REMIND_USERLIST); <END> taskQueuer.scheduleFeedbackSessionRemindersForParticularUsers(courseId, feedbackSessionName, usersToRemind.split(","), userInfo.getId()); return new JsonResult("Reminders sent"); }</code><technical_language>Similarly here; request body</technical_language>

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); if (!feedbackSession.isOpened()) { return new JsonResult("Reminder email could not be sent out " + "as the feedback session is not open for submissions.", HttpStatus.SC_BAD_REQUEST); } FeedbackSessionStudentRemindRequest remindRequest = getAndValidateRequestBody(FeedbackSessionStudentRemindRequest.class); String[] usersToRemind = remindRequest.getUsersToRemind(); taskQueuer.scheduleFeedbackSessionRemindersForParticularUsers(courseId, feedbackSessionName, usersToRemind, userInfo.getId()); return new JsonResult("Reminders sent"); }
Source:
<code>private void printWarning(CommandContext ctx, final ModelControllerClient client, final String name, final String content, final String deployment) throws CommandLineException { <START> if (ctx.isDomainMode()) { <END> for (String sgName : Util.getServerGroups(client)) { if (content == null && deployment != null) { ctx.printLine("WARNING: redeployment is required on deployment " + Arrays.asList(deployment.split(",+")) + " in server group " + sgName); } else { ModelNode linkResources = loadLinkResources(client, name, sgName); if (linkResources != null && !linkResources.keys().isEmpty()) { ctx.printLine("WARNING: redeployment is required on deployment " + linkResources.keys() + " in server group " + sgName); } } } } else { if (content == null && deployment != null) { ctx.printLine("WARNING: redeployment is required on deployment " + Arrays.asList(deployment.split(",+"))); } else { final ModelNode linkResources = loadLinkResources(client, name, null); if (linkResources != null && !linkResources.keys().isEmpty()) ctx.printLine("WARNING: redeployment is required on deployment " + linkResources.keys()); } } }</code><technical_language>if else logic contains some duplication, a refactoring eliminate this duplication. utility method print "WARNING ..." a single occurence of message</technical_language>

Target:
private void printWarning(CommandContext ctx, final ModelControllerClient client, final String name, final String content, final String deployment) throws CommandLineException { if (ctx.isDomainMode()) { for (String sgName : Util.getServerGroups(client)) { printWarningMessage(ctx, client, name, content, deployment, sgName); } } else { printWarningMessage(ctx, client, name, content, deployment, null); } }
Source:
<code>public Resource getMaxShare() { Resource maxResource = maxShare.getResource(scheduler.getClusterResource()); if(Resources.greaterThan(scheduler.getResourceCalculator(), scheduler.getClusterResource(), minShare, maxResource)) { <START> maxResource = minShare; <END> } return maxResource; }</code><technical_language>Is indentation space</technical_language>

Target:
public Resource getMaxShare() { Resource maxResource = maxShare.getResource(scheduler.getClusterResource()); Resource result = Resources.componentwiseMax(maxResource, minShare); if (!Resources.equals(maxResource, result)) { LOG.warn(String.format("Queue %s has max resources %s less than " + "min resources %s", getName(), maxResource, minShare)); } return result; }
Source:
<code>public ForceCloseLogSerializer(final SqlStorage<ForceCloseLogEntry> logStorage) { this.logStorage = logStorage; this.setPurger(new Purger() { @Override public void purge(final SortedIntSet IDs) { logStorage.removeAll(new EntityFilter<LogEntry>() { public int preFilter(int id, Hashtable<String, Object> metaData) { return IDs.contains(id) ? PREFILTER_INCLUDE : PREFILTER_EXCLUDE; } public boolean matches(LogEntry e) { throw new RuntimeException("can't happen"); } }); } }); <START> } <END></code><technical_language>Duplicated in XPathErrorSerializer. worth making subclasses of base class some static purge setup methods call</technical_language>

Target:
public ForceCloseLogSerializer(final SqlStorage<ForceCloseLogEntry> logStorage) { this.logStorage = logStorage; this.setPurger(new AndroidLogPurger<>(logStorage)); }
Source:
<code>public Response add(User user) { validateParameters(user, "userName"); <START> if (!user.getUserName().contains("@")) { <END> validateParameters(user, "domain.id|name"); } String domain = getDomain(user); AdUser adUser = getEntity(AdUser.class, SearchType.AdUser, getSearchPattern(user.getUserName(), domain)); if (adUser == null) { return Response.status(Status.BAD_REQUEST) .entity("No such user: " + user.getUserName() + " in domain " + domain) .build(); } AddUserParameters newUser = new AddUserParameters(); newUser.setVdcUser(map(adUser)); return performCreation(VdcActionType.AddUser, newUser, new UserIdResolver(adUser.getUserId()), BaseResource.class); }</code><technical_language>if username is 'user@', fail request missing domain, end BAD_REQUEST::no-such-user</technical_language>

Target:
public Response add(User user) { validateParameters(user, "userName"); if (!isNameConatinsDomain(user)) { validateParameters(user, "domain.id|name"); } String domain = getDomain(user); AdUser adUser = getEntity(AdUser.class, SearchType.AdUser, getSearchPattern(user.getUserName(), domain)); if (adUser == null) { return Response.status(Status.BAD_REQUEST) .entity("No such user: " + user.getUserName() + " in domain " + domain) .build(); } AddUserParameters newUser = new AddUserParameters(); newUser.setVdcUser(map(adUser)); return performCreation(VdcActionType.AddUser, newUser, new UserIdResolver(adUser.getUserId()), BaseResource.class); }
Source:
<code>public void testRowHighlight() { final GridWidgetDnDProxy highlight = mock(GridWidgetDnDProxy.class); final Bounds bounds = new BaseBounds(GRID_X, GRID_Y, GRID_WIDTH, GRID_HEIGHT); final GridData gridData = new BaseGridData(); gridData.appendRow(uiRow); when(state.getEventColumnHighlight()).thenReturn(highlight); when(state.getActiveGridWidget()).thenReturn(gridWidget); when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.ROW_MOVE_PENDING); <START> when(state.getActiveGridRows()).thenReturn(new ArrayList<GridRow>() {{ add(uiRow); }}); <END> when(rendererHelper.getRenderingInformation()).thenReturn(renderingInformation); when(renderingInformation.getBounds()).thenReturn(bounds); when(renderingInformation.getAllRowHeights()).thenReturn(Collections.singletonList(ROW_HEIGHT)); when(gridWidget.getModel()).thenReturn(gridData); when(gridWidget.getHeader()).thenReturn(gridWidgetHeader); when(gridWidget.getWidth()).thenReturn(GRID_WIDTH); when(uiRow.getHeight()).thenReturn(ROW_HEIGHT); handler.onNodeMouseDown(event); verify(highlight).setWidth(GRID_WIDTH); verify(highlight).setHeight(ROW_HEIGHT); verify(highlight).setX(GRID_X); verify(highlight).setY(GRID_Y + HEADER_HEIGHT); verify(layer).batch(); }</code><technical_language>when(state.getActiveGridRows()).thenReturn(Collections.singletonList(uiRow));</technical_language>

Target:
public void testRowHighlight() { final GridWidgetDnDProxy highlight = mock(GridWidgetDnDProxy.class); final Bounds bounds = new BaseBounds(GRID_X, GRID_Y, GRID_WIDTH, GRID_HEIGHT); final GridData gridData = new BaseGridData(); gridData.appendRow(uiRow); when(state.getEventColumnHighlight()).thenReturn(highlight); when(state.getActiveGridWidget()).thenReturn(gridWidget); when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.ROW_MOVE_PENDING); when(state.getActiveGridRows()).thenReturn(Collections.singletonList(uiRow)); when(rendererHelper.getRenderingInformation()).thenReturn(renderingInformation); when(renderingInformation.getBounds()).thenReturn(bounds); when(renderingInformation.getAllRowHeights()).thenReturn(Collections.singletonList(ROW_HEIGHT)); when(gridWidget.getModel()).thenReturn(gridData); when(gridWidget.getHeader()).thenReturn(gridWidgetHeader); when(gridWidget.getWidth()).thenReturn(GRID_WIDTH); when(uiRow.getHeight()).thenReturn(ROW_HEIGHT); handler.onNodeMouseDown(event); verify(highlight).setWidth(GRID_WIDTH); verify(highlight).setHeight(ROW_HEIGHT); verify(highlight).setX(GRID_X); verify(highlight).setY(GRID_Y + HEADER_HEIGHT); verify(layer).batch(); }
Source:
<code>public Description matchClass(ClassTree tree, VisitorState state) { if (MATCHER.matches(tree, state)) { return buildDescription(tree) .setMessage("Immutable type cannot have both inline @Value.Style and meta-annotation applied") <START> .build(); <END> } return Description.NO_MATCH; }</code><technical_language>I describeMatch instead inherits summary message class-level BugPattern annotation</technical_language>

Target:
public Description matchClass(ClassTree tree, VisitorState state) { if (MATCHER.matches(tree, state)) { return describeMatch(tree); } return Description.NO_MATCH; }
Source:
<code>public Lock getLoadLock(String blockName) { <START> int index = (blockName.hashCode() & 0x7fffffff) % loadLocks.length; <END> return loadLocks[index]; }</code><technical_language>point of here. do modulus</technical_language>

Target:
public Lock getLoadLock(String blockName) { if (loadLocks == null) return null; int index = Math.abs(blockName.hashCode() % loadLocks.length); return loadLocks[index]; }
Source:
<code>public Response updateFile(@ApiParam(value = "Full path to a file", required = true) @PathParam("path") String path, InputStream content) throws NotFoundException, ForbiddenException, ServerException { final FileEntry file = projectManager.asFile(path); if (file == null) { throw new NotFoundException("File not found for " + path); } executor.execute(() -> { try { file.updateContent(content); } catch (ForbiddenException e) { LOG.warn(e.getLocalizedMessage()); <START> } catch (ServerException e) { <END> LOG.warn(e.getLocalizedMessage()); } eventService.publish(new ProjectItemModifiedEvent(ProjectItemModifiedEvent.EventType.UPDATED, workspace, file.getProject(), file.getPath().toString(), false)); }); return Response.ok().build(); }</code><technical_language>multicatch ? catch (ForbiddenException | ServerException e)</technical_language>

Target:
public Response updateFile(@ApiParam(value = "Full path to a file", required = true) @PathParam("path") String path, InputStream content) throws NotFoundException, ForbiddenException, ServerException { final FileEntry file = projectManager.asFile(path); if (file == null) { throw new NotFoundException("File not found for " + path); } file.updateContent(content); eventService.publish(new ProjectItemModifiedEvent(ProjectItemModifiedEvent.EventType.UPDATED, workspace, file.getProject(), file.getPath().toString(), false)); return Response.ok().build(); }
Source:
<code><START> public <T> Model<T> getOrNull(Class<T> type, @CheckForNull Class<?> propertyOwner, @Nullable String property) throws NotExportableException { <END> Model m = models.get(type); if(m==null && type.getAnnotation(ExportedBean.class) != null) { m = new Model<T>(this, type, propertyOwner, property); } return m; }</code><technical_language>@CheckForNull return. is this declared throw NotExportableException</technical_language>

Target:
public <T> Model<T> getOrNull(Class<T> type, @CheckForNull Class<?> propertyOwner, @Nullable String property) { Model<T> m = models.get(type); if(m==null && type.getAnnotation(ExportedBean.class) != null) { m = new Model<T>(this, type, propertyOwner, property); } return m; }
Source:
<code>public Object update(String type, String id, ApiRequest request, ResourceManager next) { Service service = objectManager.loadResource(Service.class, id); <START> request = validateLaunchConfigs(service, request); <END> validateSelector(request); validateLbConfig(request, type); validatePorts(service, type, request); RevisionDiffomatic diff = revisionManager.createNewRevision(request.getSchemaFactory(), service, CollectionUtils.toMap(request.getRequestObject())); request.setRequestObject(diff.getNewRevisionData()); Object result = super.update(type, id, request, next); if (result instanceof Service) { service = (Service)result; service = revisionManager.assignRevision(diff, service); processManager.update(service, null); return objectManager.reload(service); } return result; }</code><technical_language>need return request. modifying in validationLaunchConfig</technical_language>

Target:
public Object update(String type, String id, ApiRequest request, ResourceManager next) { Service service = objectManager.loadResource(Service.class, id); validateLaunchConfigs(service, request); validateNetworMode(service, request); validateSelector(request); validateLbConfig(request, type); validatePorts(service, type, request); RevisionDiffomatic diff = revisionManager.createNewRevision(request.getSchemaFactory(), service, CollectionUtils.toMap(request.getRequestObject())); request.setRequestObject(diff.getNewRevisionData()); Object result = super.update(type, id, request, next); if (result instanceof Service) { service = (Service)result; service = revisionManager.assignRevision(diff, service); processManager.update(service, null); return objectManager.reload(service); } return result; }
Source:
<code>public static void main(String[] args) { Javalin app = Javalin.create().start(8080); app.get("/plaintext", ctx -> ctx.result("Hello, World!")); app.get("/json", ctx -> { Map<String, String> hello = new HashMap<>(); <START> hello.put("message", "Hello, World!"); <END> ctx.json(hello); }); }</code><technical_language>Collections.singletonMap("message", "Hello, World!") instead (from java.util.Collections). singletonMap a dedicated Map implementation for a single key is more efficient HashMap. impact of this choice JSON test results is measurable in some of faster Java frameworks, IIRC. If this a more version of Java (after 8), I Map.of("message", "Hello, World!")</technical_language>

Target:
public static void main(String[] args) { Javalin app = Javalin.create().start(8080); app.get("/plaintext", ctx -> ctx.result("Hello, World!")); app.get("/json", ctx -> { ctx.json(Collections.singletonMap("message", "Hello, World!")); }); }
Source:
<code>public void getCopyAuthorization() { <START> final String resourceId = "target-resource-Id"; <END> final String resourceRegion = "target-resource-region"; formTrainingAsyncClient.getCopyAuthorization(resourceId, resourceRegion) .subscribe(copyAuthorization -> System.out.printf("Copy Authorization for model id: %s, access token: %s, expiration time: %s, " + "target resource Id; %s, target resource region: %s%n", copyAuthorization.getModelId(), copyAuthorization.getAccessToken(), copyAuthorization.getExpirationDateTimeTicks(), copyAuthorization.getResourceId(), copyAuthorization.getResourceRegion() )); END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.getCopyAuthorization#string-string }</code><technical_language>final, variables in code snippet</technical_language>

Target:
public void getCopyAuthorization() { String resourceId = "target-resource-Id"; String resourceRegion = "target-resource-region"; formTrainingAsyncClient.getCopyAuthorization(resourceId, resourceRegion) .subscribe(copyAuthorization -> System.out.printf("Copy Authorization for model id: %s, access token: %s, expiration time: %s, " + "target resource Id; %s, target resource region: %s%n", copyAuthorization.getModelId(), copyAuthorization.getAccessToken(), copyAuthorization.getExpiresOn(), copyAuthorization.getResourceId(), copyAuthorization.getResourceRegion() )); END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.getCopyAuthorization#string-string }
Source:
<code>protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() { char nullChar = (char) 0; <START> from("ChatScript://localhost:1024/Harry?chatusername=varun&resetchat=true") <END> .setBody (simple ("Hello" )) .log("Body=${body}") .to("ChatScript://localhost:1024/Harry?chatusername=varun") .log("Chat Reponse=${body}") .setBody (simple ("No" )) .to("ChatScript://localhost:1024/Harry?chatusername=varun") .to("mock:result"); } }; }</code><technical_language>scheme is _ChatScript_ _chatscript_. I _chatscript_ in case scheme in annotations, examples, services..</technical_language>

Target:
protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws JsonProcessingException { String g = "CS" + Math.random(); ChatScriptMessage rqMsg = new ChatScriptMessage(g, "", ""); ChatScriptMessage rq2Msg = new ChatScriptMessage(g, "", "Hello"); ChatScriptMessage rq3Msg = new ChatScriptMessage(g, "", "No"); String rq = ""; String rq2 = ""; String rq3 = ""; try { rq = new ObjectMapper().writeValueAsString(rqMsg); rq2 = new ObjectMapper().writeValueAsString(rq2Msg); rq3 = new ObjectMapper().writeValueAsString(rq3Msg); } catch (JsonProcessingException e) { e.printStackTrace(); } from("timer://foo?repeatCount=1") .setBody(new SimpleExpression(rq)) .to("chatscript://localhost:1024/Harry?resetchat=true") .log("Response 2 = ${body}") .setBody(new SimpleExpression(rq2)) .to("chatscript://localhost:1024/Harry") .log("Response 3 = ${body}") .setBody(new SimpleExpression(rq3)) .to("chatscript://localhost:1024/Harry") .log("Response 4 = ${body}") .to("mock:result"); } }; }
Source:
<code><START> public static Socket openMonitorSession(final String ip, final int port, final String passwd) throws IOException { <END> Socket sk = new Socket(ip, port); sk.setSoTimeout(45 * 1000); BufferedReader inputStream = new BufferedReader(new InputStreamReader(sk.getInputStream())); PrintWriter outputStream = new PrintWriter(sk.getOutputStream(), true); String response = readUntilDelimiter(inputStream); outputStream.write(socketMonitor); outputStream.flush(); response = readUntilDelimiter(inputStream); if (isACK(response) != true) { String nonce = response.substring(2, response.length() - 2); String p = calcPass(passwd, nonce); outputStream.write("*#" + p + "##"); outputStream.flush(); response = readUntilDelimiter(inputStream); if (isACK(response) != true) { throw new IOException(); } } return sk; }</code><technical_language>Again, this is a public method, create a new 3-parameter version instead of modifying this one</technical_language>

Target:
public static Socket openMonitorSession(final String ip, final int port, final String passwd) throws IOException { Socket sk = new Socket(ip, port); sk.setSoTimeout(45 * 1000); BufferedReader inputStream = new BufferedReader(new InputStreamReader(sk.getInputStream())); PrintWriter outputStream = new PrintWriter(sk.getOutputStream(), true); String response = readUntilDelimiter(inputStream); outputStream.write(socketMonitor); outputStream.flush(); response = readUntilDelimiter(inputStream); if (!isACK(response)) { String nonce = response.substring(2, response.length() - 2); String p = calcPass(passwd, nonce); outputStream.write("*#" + p + "##"); outputStream.flush(); response = readUntilDelimiter(inputStream); if (!isACK(response)) { throw new IOException("Invalid gateway password"); } } return sk; }
Source:
<code>public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof RecordSchema)) return false; RecordSchema that = (RecordSchema) o; if (!equalCachedHash(that)) return false; if (!equalNames(that)) return false; if (!propsEqual(that)) return false; Set seen = SEEN_EQUALS.get(); SeenPair here = new SeenPair(this, o); if (seen.contains(here)) return true; boolean first = seen.isEmpty(); try { seen.add(here); <START> return (fields == null && that.fields == null) || (fields != null && fields.equals(that.fields)); <END> } finally { if (first) seen.clear(); } }</code><technical_language>Objects.equals(fields, that.fields)</technical_language>

Target:
public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof RecordSchema)) return false; RecordSchema that = (RecordSchema) o; if (!equalCachedHash(that)) return false; if (!equalNames(that)) return false; if (!propsEqual(that)) return false; Set seen = SEEN_EQUALS.get(); SeenPair here = new SeenPair(this, o); if (seen.contains(here)) return true; boolean first = seen.isEmpty(); try { seen.add(here); return Objects.equals(fields, that.fields); } finally { if (first) seen.clear(); } }
Source:
<code>public void penaltyMatrixDiffOrderTooHighTest() { @SuppressWarnings("unused") <START> DoubleMatrix2D p = getPenaltyMatrix(6, 10); <END> }</code><technical_language>above, need assign</technical_language>

Target:
public void penaltyMatrixDiffOrderTooHighTest() { getPenaltyMatrix(6, 10); }
Source:
<code>public void setUp() throws SQLException, IllegalStateException { <START> prepareMariaDB(); <END> createMysqlTable(); StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); tEnv = StreamTableEnvironment.create(env); createFlinkTable(); prepareData(); }</code><technical_language>I suggest prepare DB in a @ClassBefore instead of @Before avoid repeated initialization tests</technical_language>

Target:
public void setUp() throws SQLException, IllegalStateException { createMysqlTable(); StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); tEnv = StreamTableEnvironment.create(env); createFlinkTable(); prepareData(); }
Source:
<code>public void testTwoBrokerCluster() { final KafkaCluster cluster = app.createAndManageChild(EntitySpec.create(KafkaCluster.class) .configure(KafkaCluster.INITIAL_SIZE, 2)); cluster.start(ImmutableList.of(testLocation)); Asserts.succeedsEventually(MutableMap.of("timeout", Duration.TWO_MINUTES), new Callable<Void>() { @Override public Void call() { assertTrue(cluster.getAttribute(Startable.SERVICE_UP)); assertTrue(cluster.getZooKeeper().getAttribute(Startable.SERVICE_UP)); assertEquals(cluster.getCurrentSize().intValue(), 2); return null; } }); Entities.dumpInfo(cluster); KafkaSupport support = new KafkaSupport(cluster); support.sendMessage("brooklyn", "TEST_MESSAGE"); try { <START> Thread.sleep(Duration.seconds(5).toMilliseconds()); <END> String message = support.getMessage("brooklyn"); assertEquals(message, "TEST_MESSAGE"); } catch (InterruptedException e) { e.printStackTrace(); } }</code><technical_language>this exception propagate Time.sleep() in a test</technical_language>

Target:
public void testTwoBrokerCluster() throws InterruptedException { final KafkaCluster cluster = app.createAndManageChild(EntitySpec.create(KafkaCluster.class) .configure(KafkaCluster.INITIAL_SIZE, 2)); cluster.start(ImmutableList.of(testLocation)); Asserts.succeedsEventually(MutableMap.of("timeout", Duration.TWO_MINUTES), new Callable<Void>() { @Override public Void call() { assertTrue(cluster.getAttribute(Startable.SERVICE_UP)); assertTrue(cluster.getZooKeeper().getAttribute(Startable.SERVICE_UP)); assertEquals(cluster.getCurrentSize().intValue(), 2); return null; } }); Entities.dumpInfo(cluster); KafkaSupport support = new KafkaSupport(cluster); support.sendMessage("brooklyn", "TEST_MESSAGE"); Thread.sleep(Duration.seconds(5).toMilliseconds()); String message = support.getMessage("brooklyn"); assertEquals(message, "TEST_MESSAGE"); }
Source:
<code>public void instrument(final InputStream input, final OutputStream output, final String name) throws IOException { <START> final byte[] bytes; <END> try { bytes = Java9Support.readFully(input); } catch (final IOException e) { throw instrumentError(name, e); } output.write(instrument(bytes, name)); }</code><technical_language>I delegate overloaded method here: public void instrument(final InputStream input, final OutputStream output, final String name) throws IOException { output.write(instrument(input, name)); }</technical_language>

Target:
public void instrument(final InputStream input, final OutputStream output, final String name) throws IOException { output.write(instrument(input, name)); }
Source:
<code>protected List<FormItem> modifyFormItemsAfterCreation(PluginDescriptor focusedInfrastructurePlugin, PluginDescriptor focusedPolicyPlugin) { List<String> policyDynamicFieldFullNames = focusedPolicyPlugin.getConfigurableFields() .stream() .filter(PluginDescriptor.Field::isDynamic) .map(field -> focusedPolicyPlugin.getPluginName() + field.getName()) .collect(Collectors.toList()); List<String> infrastructureDynamicFieldFullNames = focusedInfrastructurePlugin.getConfigurableFields() .stream() .filter(PluginDescriptor.Field::isDynamic) <START> .map(field -> focusedPolicyPlugin.getPluginName() + <END> field.getName()) .collect(Collectors.toList()); List<String> allDynamicFieldFullNames = new LinkedList<>(); allDynamicFieldFullNames.addAll(policyDynamicFieldFullNames); allDynamicFieldFullNames.addAll(infrastructureDynamicFieldFullNames); List<FormItem> allFormItemsWithHiddenFields = new LinkedList<>(); for (FormItem formItem : this.allFormItems) { allFormItemsWithHiddenFields.add(formItem); if (allDynamicFieldFullNames.stream() .noneMatch(fieldFullName -> isItemEqualToDynamicField(formItem, fieldFullName))) { if (this.allFormItemsPerPlugin.keySet() .stream() .anyMatch(pluginName -> formItem.getName().startsWith(pluginName)) || formItem.getName().equals(INFRASTRUCTURE_FORM_KEY) || formItem.getName().equals(POLICY_FORM_KEY)) { disableNonDynamicItem(allFormItemsWithHiddenFields, formItem); } } } return allFormItemsWithHiddenFields; }</code><technical_language>'focusedInfrastructurePlugin' instead of 'focusedPolicyPlugin'</technical_language>

Target:
protected List<FormItem> modifyFormItemsAfterCreation(PluginDescriptor focusedInfrastructurePlugin, PluginDescriptor focusedPolicyPlugin) { List<String> infrastructureDynamicFieldFullNames = focusedInfrastructurePlugin.getConfigurableFields() .stream() .filter(PluginDescriptor.Field::isDynamic) .map(field -> focusedInfrastructurePlugin.getPluginName() + field.getName()) .collect(Collectors.toList()); List<String> policyDynamicFieldFullNames = focusedPolicyPlugin.getConfigurableFields() .stream() .filter(PluginDescriptor.Field::isDynamic) .map(field -> focusedPolicyPlugin.getPluginName() + field.getName()) .collect(Collectors.toList()); List<String> allDynamicFieldFullNames = new LinkedList<>(); allDynamicFieldFullNames.addAll(infrastructureDynamicFieldFullNames); allDynamicFieldFullNames.addAll(policyDynamicFieldFullNames); List<FormItem> allFormItemsWithHiddenFields = new LinkedList<>(); for (FormItem formItem : this.allFormItems) { allFormItemsWithHiddenFields.add(formItem); if (allDynamicFieldFullNames.stream() .noneMatch(fieldFullName -> isItemEqualToDynamicField(formItem, fieldFullName))) { filterAndDisableNonDynamicItem(allFormItemsWithHiddenFields, formItem); } } return allFormItemsWithHiddenFields; }
Source:
<code>public void appendFrom(ReadableByteChannel channel, long size) throws IOException { if (endOffset.get() + size > capacityInBytes) { metrics.overflowWriteError.inc(); throw new IllegalArgumentException( "Channel cannot be written to segment [" + file.getAbsolutePath() + "] because" + " it exceeds the capacity [" + capacityInBytes + "]"); } else { if (!fileChannel.isOpen()) { throw new ClosedChannelException(); } long bytesWritten = 0; long bytesRead = 0; <START> ByteBuffer bytebuffer = ByteBuffer.allocateDirect((int) size); <END> while (bytesRead < size) { bytesRead += channel.read(bytebuffer); } bytebuffer.flip(); while (bytebuffer.hasRemaining()) { bytesWritten += fileChannel.write(bytebuffer, endOffset.get() + bytesWritten); } endOffset.addAndGet(bytesWritten); } }</code><technical_language>talked offline, <LINK_0> create a separate buffer for thread</technical_language>

Target:
public void appendFrom(ReadableByteChannel channel, long size) throws IOException { if (endOffset.get() + size > capacityInBytes) { metrics.overflowWriteError.inc(); throw new IllegalArgumentException( "Channel cannot be written to segment [" + file.getAbsolutePath() + "] because" + " it exceeds the capacity [" + capacityInBytes + "]"); } else { if (!fileChannel.isOpen()) { throw new ClosedChannelException(); } int bytesWritten = 0; while (bytesWritten < size) { byteBufferForAppend.position(0); if (byteBufferForAppend.capacity() > size - bytesWritten) { byteBufferForAppend.limit((int) size - bytesWritten); } else { byteBufferForAppend.limit(byteBufferForAppend.capacity()); } if (channel.read(byteBufferForAppend) < 0) { throw new IOException("ReadableByteChannel length less than requested size!"); } byteBufferForAppend.flip(); while (byteBufferForAppend.hasRemaining()) { bytesWritten += fileChannel.write(byteBufferForAppend, endOffset.get() + bytesWritten); } } endOffset.addAndGet(bytesWritten); } }
Source:
<code>public static String getResizedImageFile(Context context, Uri uri, float multiplier){ File cacheDir = context.getCacheDir(); <START> File tempAttachmentsDirectory = new File(cacheDir.getPath() + "/tempAttachments/"); <END> tempAttachmentsDirectory.mkdirs(); final File tempFile = new File(tempAttachmentsDirectory, String.valueOf(System.currentTimeMillis()) + ".tmp"); Bitmap bitmap = null; Bitmap resized = null; try { bitmap = MediaStore.Images.Media.getBitmap(context.getContentResolver(), uri); resized = Bitmap.createScaledBitmap(bitmap, (int) (bitmap.getWidth() * multiplier), (int) (bitmap.getHeight() * multiplier), true); FileOutputStream out = new FileOutputStream(tempFile); resized.compress(Bitmap.CompressFormat.PNG, 100, out); out.close(); } catch (IOException e) { e.printStackTrace(); return ""; } return tempFile.getAbsolutePath(); }</code><technical_language>ways get references a temporary file I think. in code for handle this</technical_language>

Target:
public static String getResizedImageFile(Context context, Uri uri, float multiplier) { File cacheDir = context.getCacheDir(); File tempAttachmentsDirectory = new File(cacheDir.getPath() + RESIZED_ATTACHMENTS_TEMPORARY_DIRECTORY); tempAttachmentsDirectory.mkdirs(); File tempFile = null; Bitmap bitmap = null; Bitmap resized = null; FileOutputStream out = null; try { tempFile = File.createTempFile("TempResizedAttachment", null, tempAttachmentsDirectory); bitmap = MediaStore.Images.Media.getBitmap(context.getContentResolver(), uri); resized = Bitmap.createScaledBitmap(bitmap, (int) (bitmap.getWidth() * multiplier), (int) (bitmap.getHeight() * multiplier), true); out = new FileOutputStream(tempFile); resized.compress(Bitmap.CompressFormat.PNG, 100, out); } catch (IOException e) { Timber.e(e, "Error while resizing image attachment"); return ""; } finally { IOUtils.closeQuietly(out); } return tempFile.getAbsolutePath(); }
Source:
<code>protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { <START> List<VDS> vdss = getVdsDao().getAllForStoragePoolAndStatus(getVdsDao().get(vdsId).getStoragePoolId(), VDSStatus.Up); <END> for (VDS vds : vdss) { if (vds.getGlusterVersion() == null) { log.error("Couldn't found glusterfs-server package on vds (needed for creating gluster storage domain).", vds.getName()); StorageHelperBase.addMessageToAuditLog(AuditLogType.GLUSTER_PACKAGES_NOT_INSTALLED, null, vds.getName()); return new Pair<>(false, null); } } return super.runConnectionStorageToDomain(storageDomain, vdsId, type); }</code><technical_language>This method is called VDS - point in iterating VDSs here, done externally</technical_language>

Target:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { VDS vds = getVdsDao().get(vdsId); if (!isGlusterfsCliInstalled(vds)) { log.error("Coulsn't find glusterfs-cli package on vds (needed for connecting storage domain {}).", vds.getName(), storageDomain.getName()); StorageHelperBase.addMessageToAuditLog(AuditLogType.GLUSTERFS_CLI_PACKAGE_NOT_INSTALLED, null, vds.getName()); return new Pair<>(false, null); } return super.runConnectionStorageToDomain(storageDomain, vdsId, type); }
Source:
<code>public View createPatientRow(Patient patient, View convertView, ViewGroup parent, Context context) { ViewHolder holder; if (convertView == null) { LayoutInflater layoutInflater = LayoutInflater.from(context); convertView = layoutInflater.inflate(R.layout.item_patients_list_multi_checkable, parent, false); holder = new ViewHolder(); holder.genderImg = convertView.findViewById(R.id.genderImg); holder.name = convertView.findViewById(R.id.name); holder.dateOfBirth = convertView.findViewById(R.id.dateOfBirth); <START> holder.distanceToHome = convertView.findViewById(R.id.distanceToHome); <END> holder.identifier = convertView.findViewById(R.id.identifier); holder.tagsScroller = convertView.findViewById(R.id.tags_scroller); holder.tagsLayout = convertView.findViewById(R.id.menu_tags); holder.tags = new ArrayList<>(); convertView.setTag(holder); } holder = (ViewHolder) convertView.getTag(); holder.dateOfBirth.setText(String.format("DOB: %s", getFormattedDate(patient.getBirthdate()))); holder.identifier.setText(patient.getIdentifier()); holder.distanceToHome.setText(getDistanceToHome(patient)); holder.name.setText(getPatientFullName(patient)); holder.genderImg.setImageResource(getGenderImage(patient.getGender())); addTags(holder,patient); return convertView; }</code><technical_language>instead of distanceToHome consider distanceToClientAddress</technical_language>

Target:
public View createPatientRow(Patient patient, View convertView, ViewGroup parent, Context context) { ViewHolder holder; if (convertView == null) { LayoutInflater layoutInflater = LayoutInflater.from(context); convertView = layoutInflater.inflate(R.layout.item_patients_list_multi_checkable, parent, false); holder = new ViewHolder(); holder.genderImg = convertView.findViewById(R.id.genderImg); holder.name = convertView.findViewById(R.id.name); holder.dateOfBirth = convertView.findViewById(R.id.dateOfBirth); holder.distanceToClientAddress = convertView.findViewById(R.id.distanceToClientAddress); holder.identifier = convertView.findViewById(R.id.identifier); holder.tagsScroller = convertView.findViewById(R.id.tags_scroller); holder.tagsLayout = convertView.findViewById(R.id.menu_tags); holder.tags = new ArrayList<>(); convertView.setTag(holder); } holder = (ViewHolder) convertView.getTag(); holder.dateOfBirth.setText(String.format("DOB: %s", getFormattedDate(patient.getBirthdate()))); holder.identifier.setText(patient.getIdentifier()); holder.distanceToClientAddress.setText(getDistanceToClientAddress(patient)); holder.name.setText(getPatientFullName(patient)); holder.genderImg.setImageResource(getGenderImage(patient.getGender())); addTags(holder,patient); return convertView; }
Source:
<code>public synchronized void executeDetectorIncr(String detector) { <START> executeDetectorCount.scope(detector); <END> }</code><technical_language>missing incr()</technical_language>

Target:
public synchronized void executeDetectorIncr(String detector) { executeDetectorCount.scope(detector).incr(); }
Source:
<code>default void log(String msg, DiagnosticEvent event) { FluentLogger.Api severeLogger = logger() .atSevere() .withStackTrace(StackSize.NONE); boolean loggingEnabled = severeLogger.isEnabled(); if (loggingEnabled) { severeLogger.log(msg); severeLogger.log(toJson(event)); } else { @SuppressWarnings("UseOfSystemOutOrSystemErr") PrintStream stderr = System.err; stderr.println(msg); <START> stderr.println(toJson(event)); <END> } }</code><technical_language>Please extract toJson(Event) a variable. in if branches</technical_language>

Target:
default void log(String msg, DiagnosticEvent event) { FluentLogger.Api severeLogger = logger() .atSevere() .withStackTrace(StackSize.NONE); boolean loggingEnabled = severeLogger.isEnabled(); String eventJson = toJson(event); if (loggingEnabled) { severeLogger.log(msg); severeLogger.log(eventJson); } else { @SuppressWarnings("UseOfSystemOutOrSystemErr") PrintStream stderr = System.err; stderr.println(msg); stderr.println(eventJson); } }