auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void updateBackup() { if (getCurrentStorageItem().getRole() == StorageDomainType.ISO || getCurrentStorageItem().getRole() == StorageDomainType.ImportExport <START> || getCurrentStorageItem() != null) { <END> getBackup().setIsAvailable(false); getBackup().setEntity(false); return; } boolean backupSupported = (Boolean) AsyncDataProvider.getInstance().getConfigValuePreConverted( ConfigValues.BackupSupported, getDataCenter().getSelectedItem().getCompatibilityVersion().toString()); getBackup().setIsAvailable(backupSupported); getBackup().setEntity(isNewStorage() ? false : getStorage().isBackup()); }</code><technical_language>If getCurrentStorageItem() is null getCurrentStorageItem().getRole() NPE? I this if (getCurrentStorageItem() == null || getCurrentStorageItem().getRole() == StorageDomainType.ISO || getCurrentStorageItem().getRole() == StorageDomainType.ImportExport)</technical_language>

Target:
private void updateBackup() { if (getCurrentStorageItem() != null && getDataCenter().getSelectedItems() != null) { if (getCurrentStorageItem().getRole() == StorageDomainType.ISO || getCurrentStorageItem().getRole() == StorageDomainType.ImportExport) { getBackup().setIsAvailable(false); getBackup().setEntity(false); return; } else { boolean backupSupported = (Boolean) AsyncDataProvider.getInstance().getConfigValuePreConverted( ConfigValues.BackupSupported, getDataCenter().getSelectedItem().getCompatibilityVersion().toString()); getBackup().setIsAvailable(backupSupported); getBackup().setEntity(isNewStorage() ? false : getStorage().isBackup()); } } }
Source:
<code>private void addMessage(String message) { <START> addMessage(-2, message); <END> }</code><technical_language>2? a psf variable define it. Is -1 somewhere? If so, fixed too. If I it, I apologise..</technical_language>

Target:
private void addMessage(String message) { addMessage(ROW_NOT_SET, message); }
Source:
<code><START> public void clickBackToWikiLink() { <END> backToWiki.click(); }</code><technical_language>public PostsListPage return this for chaining purpose</technical_language>

Target:
public PostsListPage clickBackToWikiLink() { backToWiki.click(); return this; }
Source:
<code>public List<Object[]> getTestGroups(Set<Long> taskIds){ return entityManager.createNativeQuery("select task.id, task.taskId, task.sessionId from TaskData task inner join " + "(select taskData.id, taskData.taskId, workloadData.parentId, taskData.sessionId from TaskData taskData " + "inner join WorkloadData workloadData on taskData.taskId=workloadData.taskId " + "and taskData.sessionId=workloadData.sessionId where taskData.id in (:ids)) parents " + <START> "on task.taskId=parents.parentId and task.sessionId=parents.sessionId;").setParameter("ids", taskIds).getResultList(); <END> }</code><technical_language>please format query</technical_language>

Target:
public List<Object[]> getTestGroups(Set<Long> taskIds){ return entityManager.createNativeQuery("select task.id, task.taskId, task.sessionId from TaskData task " + "inner join " + "(select taskData.id, taskData.taskId, workloadData.parentId, taskData.sessionId from TaskData taskData " + "inner join WorkloadData workloadData on taskData.taskId=workloadData.taskId " + "and taskData.sessionId=workloadData.sessionId " + "where taskData.id in (:ids)) parents " + "on task.taskId=parents.parentId " + "and task.sessionId=parents.sessionId;") .setParameter("ids", taskIds).getResultList(); }
Source:
<code>public void testRememberShapeAfterOrientationChange() { onView(withId(shape)) .perform(click()) .check(matches(isSelected())); onToolBarView() .performCloseToolOptions(); onView(isRoot()) .perform(click()); Bitmap expectedBitmap = PaintroidApplication.drawingSurface.getBitmapCopy(); onTopBarView() .performUndo(); activityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(shape)) .check(matches(isSelected())); onToolBarView() .performCloseToolOptions(); <START> onView(isRoot()) <END> .perform(click()); assertTrue(expectedBitmap.sameAs(PaintroidApplication.drawingSurface.getBitmapCopy())); }</code><technical_language>Please click drawing surface. purpose click have? If supposed stamp picture, onDrawingSurfaceView().perform(touchAt(DrawingSurfaceLocationProvider.TOOL_POSITION));</technical_language>

Target:
public void testRememberShapeAfterOrientationChange() { onView(withId(shape)) .perform(click()) .check(matches(isSelected())); onToolBarView() .performCloseToolOptions(); onDrawingSurfaceView() .perform(touchAt(DrawingSurfaceLocationProvider.TOOL_POSITION)); Bitmap expectedBitmap = PaintroidApplication.drawingSurface.getBitmapCopy(); onTopBarView() .performUndo(); activityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(shape)) .check(matches(isSelected())); onToolBarView() .performCloseToolOptions(); onDrawingSurfaceView() .perform(touchAt(DrawingSurfaceLocationProvider.TOOL_POSITION)); assertTrue(expectedBitmap.sameAs(PaintroidApplication.drawingSurface.getBitmapCopy())); }
Source:
<code><START> public void testConfigureButton() throws Exception { <END> final Button button = mock(Button.class); final Button otherButton = mock(Button.class); final Runnable runnable = mock(Runnable.class); tested.configureButton(button, "COLUMNS", true, mock(Tooltip.class), "tooltip", otherButton, runnable); verify(button, times(1)).setType(eq(ButtonType.INFO)); ArgumentCaptor<ClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(ClickHandler.class); verify(button, times(1)).addClickHandler(clickHandlerArgumentCaptor.capture()); reset(button); clickHandlerArgumentCaptor.getValue().onClick(mock(ClickEvent.class)); verify(button, times(1)).setType(eq(ButtonType.INFO)); verify(otherButton, times(1)).setType(eq(ButtonType.LINK)); verify(runnable, times(1)).run(); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void testConfigureButton() { final Button button = mock(Button.class); final Button otherButton = mock(Button.class); final Runnable runnable = mock(Runnable.class); tested.configureButton(button, "COLUMNS", true, mock(Tooltip.class), "tooltip", otherButton, runnable); verify(button, times(1)).setType(eq(ButtonType.INFO)); ArgumentCaptor<ClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(ClickHandler.class); verify(button, times(1)).addClickHandler(clickHandlerArgumentCaptor.capture()); reset(button); clickHandlerArgumentCaptor.getValue().onClick(mock(ClickEvent.class)); verify(button, times(1)).setType(eq(ButtonType.INFO)); verify(otherButton, times(1)).setType(eq(ButtonType.LINK)); verify(runnable, times(1)).run(); }
Source:
<code>private String getValueForOptionalKey(JSONObject object, String key) throws JSONException { <START> return object.has(key) ? object.getJSONObject(key).optString("value") : ""; <END> }</code><technical_language>bad, I forgot get... throws a checked exception. So, opt... for is better, too, remove throws JSONException this caller method</technical_language>

Target:
private String getValueForOptionalKey(JSONObject object, String key) { return object.has(key) ? object.optJSONObject(key).optString("value") : ""; }
Source:
<code>public ResponseEntity<?> updateTicketType(@PathVariable Long typeId, @RequestBody @Validated TicketType type) { TicketType ticketType = ticketService.updateTicketType(typeId, type); <START> if (ticketType == null) { <END> return createResponseEntity(HttpStatus.BAD_REQUEST, "TicketType not found!"); } else { return createResponseEntity(HttpStatus.OK, "TicketType successfully updated.", ticketType); } }</code><technical_language>This is a weird check for a controller. this null exactly? call service here..</technical_language>

Target:
public ResponseEntity<?> updateTicketType(@PathVariable Long typeId, @RequestBody @Validated TicketType type) { TicketType ticketType = ticketService.updateTicketType(typeId, type); return createResponseEntity(HttpStatus.OK, "TicketType successfully updated.", ticketType); }
Source:
<code>private void cacheGraph() { Timer timer = Timer.getAndStart(); buckets = new ArrayList<SortedSet<SequenceSegment>>(); for (int index = 0; index < numberBuckets; index++) { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") <START> TreeSet<SequenceSegment> newSegments = new TreeSet<SequenceSegment>(); <END> buckets.add(index, newSegments); } for (SequenceSegment vertex : graph.getAllVertices()) { cacheVertex(vertex); } timer.stopAndLog("Graph caching"); }</code><technical_language>TreeSet type</technical_language>

Target:
private void cacheGraph() { Timer timer = Timer.getAndStart(); buckets = new ArrayList<Bucket>(); for (int index = 0; index < numberBuckets; index++) { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") Bucket bucket = new Bucket(); buckets.add(index, bucket); } for (SequenceSegment vertex : graph.getAllVertices()) { cacheVertex(vertex); } timer.stopAndLog("Graph caching"); }
Source:
<code>public void initScm(@CommandLine.Option(names = { "--clusterid" }, description = "Optional: The cluster id to use when formatting SCM", paramLabel = "id") String clusterId) throws Exception { commonInit(); boolean result = receiver.init(conf, clusterId); if (!result) { <START> throw new IOException("SCM Init failed. Check the log for more details"); <END> } }</code><technical_language>print exception ? is a bad experience ? @elek ? @arp7</technical_language>

Target:
public void initScm(@CommandLine.Option(names = { "--clusterid" }, description = "Optional: The cluster id to use when formatting SCM", paramLabel = "id") String clusterId) throws Exception { commonInit(); boolean result = receiver.init(conf, clusterId); if (!result) { throw new IOException("scm init failed"); } }
Source:
<code>public void postConstruct() { super.postConstruct(); String sqlUrl = getConfig(DB_SETUP_SQL_URL); if ("".equals(sqlUrl)) sqlUrl = null; MySqlNode mysql = (MySqlNode) addChild( <START> getManagementSupport().getManagementContext(true).getEntityManager().createEntity( <END> BasicEntitySpec.newInstance(MySqlNode.class) .configure("creationScriptUrl", sqlUrl)) ); ControlledDynamicWebAppCluster web = (ControlledDynamicWebAppCluster) addChild( getManagementSupport().getManagementContext(true).getEntityManager().createEntity( BasicEntitySpec.newInstance(ControlledDynamicWebAppCluster.class) .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+")) .configure(JavaWebAppService.ROOT_WAR, getConfig(WAR_PATH)) .configure(JavaEntityMethods.javaSysProp("brooklyn.example.db.url"), formatString("jdbc:%s%s?user=%s\\&password=%s", attributeWhenReady(mysql, MySqlNode.MYSQL_URL), DB_TABLE, DB_USERNAME, DB_PASSWORD)) .configure(DynamicCluster.INITIAL_SIZE, 2) .configure(WebAppService.ENABLED_PROTOCOLS, Arrays.asList(getConfig(USE_HTTPS) ? "https" : "http")) )); web.getCluster().addPolicy(AutoScalerPolicy.builder(). metric(DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW_PER_NODE). metricRange(10, 100). sizeRange(2, 5). build()); addEnricher(SensorPropagatingEnricher.newInstanceListeningTo(web, WebAppServiceConstants.ROOT_URL, DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW)); addEnricher(new SensorTransformingEnricher<Integer,Integer>(web, DynamicWebAppCluster.GROUP_SIZE, APPSERVERS_COUNT, Functions.<Integer>identity())); }</code><technical_language>I call getEntityManager().createEntity(...), including ugly getManagementSupport().getManagementContext(true)..</technical_language>

Target:
public void postConstruct() { super.postConstruct(); String sqlUrl = getConfig(DB_SETUP_SQL_URL); if ("".equals(sqlUrl)) sqlUrl = null; MySqlNode mysql = (MySqlNode) addChild( getEntityManager().createEntity( BasicEntitySpec.newInstance(MySqlNode.class) .configure("creationScriptUrl", sqlUrl)) ); ControlledDynamicWebAppCluster web = (ControlledDynamicWebAppCluster) addChild( getEntityManager().createEntity( BasicEntitySpec.newInstance(ControlledDynamicWebAppCluster.class) .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+")) .configure(JavaWebAppService.ROOT_WAR, getConfig(WAR_PATH)) .configure(JavaEntityMethods.javaSysProp("brooklyn.example.db.url"), formatString("jdbc:%s%s?user=%s\\&password=%s", attributeWhenReady(mysql, MySqlNode.MYSQL_URL), DB_TABLE, DB_USERNAME, DB_PASSWORD)) .configure(DynamicCluster.INITIAL_SIZE, 2) .configure(WebAppService.ENABLED_PROTOCOLS, Arrays.asList(getConfig(USE_HTTPS) ? "https" : "http")) )); web.getCluster().addPolicy(AutoScalerPolicy.builder(). metric(DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW_PER_NODE). metricRange(10, 100). sizeRange(2, 5). build()); addEnricher(SensorPropagatingEnricher.newInstanceListeningTo(web, WebAppServiceConstants.ROOT_URL, DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW)); addEnricher(new SensorTransformingEnricher<Integer,Integer>(web, DynamicWebAppCluster.GROUP_SIZE, APPSERVERS_COUNT, Functions.<Integer>identity())); }
Source:
<code>public void dispose() { <START> if (disposables != null && !disposables.isDisposed()) { <END> disposables.clear(); } }</code><technical_language>checks do need performed</technical_language>

Target:
public void dispose() { disposables.clear(); }
Source:
<code><START> @Override public SCMNavigator newInstance(String name) { <END> return null; }</code><technical_language>style guide</technical_language>

Target:
public SCMNavigator newInstance(String name) { return null; }
Source:
<code>private @Nullable T getValue() { if (!isValid) return null; if (resolved != null) return resolved.get(); if (supplier != null) { resolved = new AtomicReference<>(null); T temp = supplier.get(); if (temp == null) { <START> throw new NullPointerException("Supplier should not return null value"); <END> } resolved.set(temp); return resolved.get(); } return null; }</code><technical_language>do want throw exception caught consumer. Logging noisily is go</technical_language>

Target:
private @Nullable T getValue() { if (!isValid) return null; if (resolved != null) return resolved.get(); if (supplier != null) { resolved = new AtomicReference<>(null); T temp = supplier.get(); if (temp == null) { LOGGER.catching(Level.WARN, new NullPointerException("Supplier should not return null value")); return null; } resolved.set(temp); return resolved.get(); } return null; }
Source:
<code><START> public List<String> getStrings() { <END> if (null == strings) { synchronized (this) { if (null == this.strings) { strings = new ArrayList<>(); strings.add("Hello"); System.out.println(); strings.add("World"); } } } return strings; }</code><technical_language>please a name for method here, this compile..</technical_language>

Target:
public List<String> getStrings() { if (strings == null) { synchronized (this) { if (strings == null) { strings = new ArrayList<>(); strings.add("Hello"); strings.add("World"); } } } return strings; }
Source:
<code>public void <START> testBug535308b() <END> { Map options = getCompilerOptions(); options.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.ERROR); runNegativeTest( new String[] { "X.java", "public class X {\n" + " public int someTest() {\n" + " boolean unused = false;\n" + " final boolean thisIsFalse = false;\n" + " if (getSomeValue() == thisIsFalse) {\n" + " return 0;\n" + " }\n" + " return 1;\n" + " }\n" + "\n" + " private boolean getSomeValue() {\n" + " return true;\n" + " }\n" + "}" }, "----------\n" + "1. ERROR in X.java (at line 3)\n" + " boolean unused = false;\n" + " ^^^^^^\n" + "The value of the local variable unused is not used\n" + "----------\n", this.LIBS, true , options); }</code><technical_language>I fail difference previous test. Is any</technical_language>

Target:
public void testBug535308b() { Map options = getCompilerOptions(); options.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.ERROR); runNegativeTest( new String[] { "X.java", "public class X {\n" + " public int someTest() {\n" + " boolean unused = false;\n" + " final boolean thisIsFalse = false;\n" + " if (getSomeValue() != thisIsFalse) {\n" + " return 0;\n" + " }\n" + " return 1;\n" + " }\n" + "\n" + " private boolean getSomeValue() {\n" + " return true;\n" + " }\n" + "}" }, "----------\n" + "1. ERROR in X.java (at line 3)\n" + " boolean unused = false;\n" + " ^^^^^^\n" + "The value of the local variable unused is not used\n" + "----------\n", this.LIBS, true , options); }
Source:
<code>private boolean endCallback(Guid cmdId, CommandCallback callback, CommandStatus status) { try { if (status == CommandStatus.FAILED) { callback.onFailed(cmdId, getChildCommandIds(cmdId)); } else { callback.onSucceeded(cmdId, getChildCommandIds(cmdId)); } } catch (Exception ex) { if (callback.repeatEndMethodsOnFail(cmdId)) { log.error("Failed invoking callback end method '{}' for command '{}' with exception '{}', the callback" + " is marked for end method retries", getCallbackMethod(status), cmdId, <START> ex.getMessage()); <END> return true; } else { log.error("Failed invoking callback end method '{}' for command '{}' with exception '{}'", getCallbackMethod(status), cmdId, ex.getMessage()); } } return false; }</code><technical_language>please print stacktrace in debug mode</technical_language>

Target:
private boolean endCallback(Guid cmdId, CommandCallback callback, CommandStatus status) { try { if (status == CommandStatus.FAILED) { callback.onFailed(cmdId, getChildCommandIds(cmdId)); } else { callback.onSucceeded(cmdId, getChildCommandIds(cmdId)); } } catch (Exception ex) { if (callback.repeatEndMethodsOnFail(cmdId)) { log.error("Failed invoking callback end method '{}' for command '{}' with exception '{}', the callback" + " is marked for end method retries", getCallbackMethod(status), cmdId, ex.getMessage()); log.debug(ex.getStackTrace().toString()); return true; } else { log.error("Failed invoking callback end method '{}' for command '{}' with exception '{}'", getCallbackMethod(status), cmdId, ex.getMessage()); log.debug(ex.getStackTrace().toString()); } } return false; }
Source:
<code>private void updateSaltComponent(Stack stack) throws IOException { ClusterComponent saltComponent = clusterComponentProvider.getComponent(stack.getCluster().getId(), ComponentType.SALT_STATE); byte[] stateConfigZip = hostOrchestrator.getStateConfigZip(); if (saltComponent == null) { <START> saltComponent = new ClusterComponent(ComponentType.SALT_STATE, <END> new Json(singletonMap(ComponentType.SALT_STATE.name(), Base64.encodeBase64String(stateConfigZip))), stack.getCluster()); } else { saltComponent.setAttributes(new Json(singletonMap(ComponentType.SALT_STATE.name(), Base64.encodeBase64String(stateConfigZip)))); } clusterComponentProvider.store(saltComponent); }</code><technical_language>component creation is duplicated for save update</technical_language>

Target:
private void updateSaltComponent(Stack stack) { ClusterComponent saltComponent = clusterComponentProvider.getComponent(stack.getCluster().getId(), ComponentType.SALT_STATE); try { byte[] stateConfigZip = hostOrchestrator.getStateConfigZip(); if (saltComponent == null) { saltComponent = createSaltComponent(stack, stateConfigZip); } else { saltComponent.setAttributes(new Json(singletonMap(ComponentType.SALT_STATE.name(), Base64.encodeBase64String(stateConfigZip)))); } clusterComponentProvider.store(saltComponent); } catch (IOException e) { throw new CloudbreakServiceException(e); } }
Source:
<code>GanttCSVExport(TaskManager taskManager, HumanResourceManager resourceManager, RoleManager roleManager, CSVOptions csvOptions) { myTaskManager = Preconditions.checkNotNull(taskManager); myTaskCustomPropertyManager = Preconditions.checkNotNull(taskManager.getCustomPropertyManager()); myHumanResourceManager = Preconditions.checkNotNull(resourceManager); myHumanResourceCustomPropertyManager = Preconditions.checkNotNull(resourceManager.getCustomPropertyManager()); myRoleManager = Preconditions.checkNotNull(roleManager); <START> this.csvOptions = csvOptions; <END> }</code><technical_language>.. get Preconditions check</technical_language>

Target:
GanttCSVExport(TaskManager taskManager, HumanResourceManager resourceManager, RoleManager roleManager, CSVOptions csvOptions) { myTaskManager = Preconditions.checkNotNull(taskManager); myTaskCustomPropertyManager = Preconditions.checkNotNull(taskManager.getCustomPropertyManager()); myHumanResourceManager = Preconditions.checkNotNull(resourceManager); myHumanResourceCustomPropertyManager = Preconditions.checkNotNull(resourceManager.getCustomPropertyManager()); myRoleManager = Preconditions.checkNotNull(roleManager); myCsvOptions = Preconditions.checkNotNull(csvOptions); }
Source:
<code>public void testIntentToLoginActivity() { <START> ActivityScenario activityScenario = ActivityScenario.launch(SplashScreenActivity.class); <END> if (!PrefManager.isAuthenticated()) { onView(withId(R.id.login_layout)).check(matches(isDisplayed())); } }</code><technical_language>if declare ActivityScenario variable globally initialize start of test another method named setup annotated keyword</technical_language>

Target:
public void testIntentToLoginActivity() { if (!PrefManager.isAuthenticated()) { onView(withId(R.id.login_layout)).check(matches(isDisplayed())); } }
Source:
<code>private String startRequest(Request req) { List<RequestInterceptor> interceptors = getInterceptors(false); for (RequestInterceptor requestInterceptor : interceptors) { if (requestInterceptor != null) { try { <START> requestInterceptor.onStart(req.getRequestId(), null); <END> } catch (RequestInterruptionException e) { String message = "Request stopped from starting by exception from the interceptor ("+requestInterceptor+"): " + e.getMessage(); log.warn(message); throw new RequestInterruptionException(message, e); } catch (Exception e) { log.warn("Request interceptor ("+requestInterceptor+") failed to execute on start ("+req.getRequestId()+"): " + e.getMessage()); } } } requests.setCurrent(req); return req.getRequestId(); }</code><technical_language>concept of session completely withdrawn (the SessionService interface deleted) change method signature</technical_language>

Target:
private String startRequest(Request req) { List<RequestInterceptor> interceptors = getInterceptors(false); for (RequestInterceptor requestInterceptor : interceptors) { if (requestInterceptor != null) { try { requestInterceptor.onStart(req.getRequestId()); } catch (RequestInterruptionException e) { String message = "Request stopped from starting by exception from the interceptor ("+requestInterceptor+"): " + e.getMessage(); log.warn(message); throw new RequestInterruptionException(message, e); } catch (Exception e) { log.warn("Request interceptor ("+requestInterceptor+") failed to execute on start ("+req.getRequestId()+"): " + e.getMessage()); } } } requests.setCurrent(req); return req.getRequestId(); }
Source:
<code>public void execute(FrontendPluginFactory factory) throws InstallationException { ProxyConfig proxyConfig = MojoUtils.getProxyConfig(session, decrypter); String nodeDownloadRoot = getNodeDownloadRoot(); String npmDownloadRoot = getNpmDownloadRoot(); <START> if(serverId != null && !"".equals(serverId)) { <END> Server server = MojoUtils.decryptServer(serverId, session, decrypter); factory.getNodeAndNPMInstaller(proxyConfig).install(nodeVersion, npmVersion, nodeDownloadRoot, npmDownloadRoot, server.getUsername(), server.getPassword()); } else { factory.getNodeAndNPMInstaller(proxyConfig).install(nodeVersion, npmVersion, nodeDownloadRoot, npmDownloadRoot, null, null); } }</code><technical_language>mentioned below, StringUtils.isNotEmpty</technical_language>

Target:
public void execute(FrontendPluginFactory factory) throws InstallationException { ProxyConfig proxyConfig = MojoUtils.getProxyConfig(session, decrypter); String nodeDownloadRoot = getNodeDownloadRoot(); String npmDownloadRoot = getNpmDownloadRoot(); Server server = MojoUtils.decryptServer(serverId, session, decrypter); if (null != server) { factory.getNodeAndNPMInstaller(proxyConfig) .setNodeVersion(nodeVersion) .setNodeDownloadRoot(nodeDownloadRoot) .setNpmVersion(npmVersion) .setNpmDownloadRoot(npmDownloadRoot) .setUserName(server.getUsername()) .setPassword(server.getPassword()) .install(); } else { factory.getNodeAndNPMInstaller(proxyConfig) .setNodeVersion(nodeVersion) .setNodeDownloadRoot(nodeDownloadRoot) .setNpmVersion(npmVersion) .setNpmDownloadRoot(npmDownloadRoot) .install(); } }
Source:
<code>public boolean equals(CohortMembership otherCohortMembership) { if(this == otherCohortMembership) return true; <START> return otherCohortMembership != null && this.endDate.equals(otherCohortMembership.getEndDate()) && this.startDate.equals(otherCohortMembership.getStartDate()) <END> && this.patientId.equals(otherCohortMembership.getPatientId()); }</code><technical_language>if of properties is null</technical_language>

Target:
public boolean equals(CohortMembership otherCohortMembership) { if(this == otherCohortMembership) return true; return otherCohortMembership != null && ((endDate != null ) ? endDate.equals(otherCohortMembership.getEndDate()) : otherCohortMembership.getEndDate() == null) && ((startDate !=null) ? startDate.equals(otherCohortMembership.getStartDate()) : otherCohortMembership.getStartDate() == null) && ((patientId != null) ? patientId.equals(otherCohortMembership.getPatientId()) : otherCohortMembership.getPatientId() == null); }
Source:
<code>public void testFindPostCommitHook() throws Exception { assumeSupportedPlatform(); assertNull("no hook should be installed", FS.DETECTED.findHook(db, PostCommitHook.NAME)); File hookFile = writeHookFile(PostCommitHook.NAME, "#!/bin/bash\necho \"test $1 $2\""); assertEquals("expected to find <START> pre-commit hook", <END> hookFile, FS.DETECTED.findHook(db, PostCommitHook.NAME)); }</code><technical_language>post-commit</technical_language>

Target:
public void testFindPostCommitHook() throws Exception { assumeSupportedPlatform(); assertNull("no hook should be installed", FS.DETECTED.findHook(db, PostCommitHook.NAME)); File hookFile = writeHookFile(PostCommitHook.NAME, "#!/bin/bash\necho \"test $1 $2\""); assertEquals("expected to find post-commit hook", hookFile, FS.DETECTED.findHook(db, PostCommitHook.NAME)); }
Source:
<code>public static List<IStorageModel> getDataStorageModels() { ArrayList<IStorageModel> models = new ArrayList<IStorageModel>(); NfsStorageModel nfsDataModel = new NfsStorageModel(); nfsDataModel.setRole(StorageDomainType.Data); models.add(nfsDataModel); IscsiStorageModel iscsiDataModel = new IscsiStorageModel(); iscsiDataModel.setRole(StorageDomainType.Data); iscsiDataModel.setIsGrouppedByTarget(true); models.add(iscsiDataModel); FcpStorageModel fcpDataModel = new FcpStorageModel(); fcpDataModel.setRole(StorageDomainType.Data); models.add(fcpDataModel); PosixStorageModel posixDataModel = new PosixStorageModel(); posixDataModel.setRole(StorageDomainType.Data); models.add(posixDataModel); GlusterStorageModel GlusterDataModel = new GlusterStorageModel(); GlusterDataModel.setRole(StorageDomainType.Data); models.add(GlusterDataModel); LocalStorageModel localDataModel = new LocalStorageModel(); localDataModel.setRole(StorageDomainType.Data); models.add(localDataModel); <START> <END> return models; }</code><technical_language>nitpicking: order file based domains grouped block domains grouped</technical_language>

Target:
public static List<IStorageModel> getDataStorageModels() { ArrayList<IStorageModel> models = new ArrayList<IStorageModel>(); NfsStorageModel nfsDataModel = new NfsStorageModel(); models.add(nfsDataModel); PosixStorageModel posixDataModel = new PosixStorageModel(); models.add(posixDataModel); GlusterStorageModel GlusterDataModel = new GlusterStorageModel(); models.add(GlusterDataModel); IscsiStorageModel iscsiDataModel = new IscsiStorageModel(); iscsiDataModel.setIsGrouppedByTarget(true); models.add(iscsiDataModel); FcpStorageModel fcpDataModel = new FcpStorageModel(); models.add(fcpDataModel); LocalStorageModel localDataModel = new LocalStorageModel(); models.add(localDataModel); for (IStorageModel model : models) { model.setRole(StorageDomainType.Data); } return models; }
Source:
<code>public void collectLogs(DockerCompose dockerCompose) throws IOException, InterruptedException { dockerCompose.ps().stream() .map(ContainerName::semanticName) .forEachOrdered(container -> executor.execute(() -> { File outputFile = new File(logDirectory, container + ".log"); log.info("Writing logs for container '{}' to '{}'", container, outputFile.getAbsolutePath()); try (FileOutputStream outputStream = new FileOutputStream(outputFile)) { dockerCompose.writeLogs(container, outputStream); } catch (IOException e) { <START> throw new SafeRuntimeException("Error reading log", e); <END> } })); }</code><technical_language>nit: Error writing log</technical_language>

Target:
public void collectLogs(DockerCompose dockerCompose) throws IOException, InterruptedException { dockerCompose.ps().stream() .map(ContainerName::semanticName) .forEachOrdered(container -> executor.execute(() -> { File outputFile = new File(logDirectory, container + ".log"); log.info("Writing logs for container '{}' to '{}'", container, outputFile.getAbsolutePath()); try (FileOutputStream outputStream = new FileOutputStream(outputFile)) { dockerCompose.writeLogs(container, outputStream); } catch (IOException e) { throw new SafeRuntimeException("Error writing log", e); } })); }
Source:
<code>ForControlFlow(CommandContext ctx, String varName, String iterable) throws CommandLineException { if (varName == null) { throw new IllegalArgumentException("Variable is null"); } if (iterable == null) { throw new IllegalArgumentException("Iterable is null"); } if (ctx.getVariable(varName) != null) { throw new CommandFormatException("Variable " + varName + " already exists."); } final ModelControllerClient client = ctx.getModelControllerClient(); if (client == null) { throw new CommandLineException("The connection to the controller has not been established."); } this.varName = varName; ModelNode forRequest = ctx.buildRequest(iterable); ModelNode targetValue; try { targetValue = ctx.execute(forRequest, "for iterable"); } catch (IOException e) { throw new CommandLineException("iterable request failed", e); } if (!targetValue.hasDefined(Util.RESULT)) { throw new CommandLineException("iterable request failed, no result"); } ModelNode mn = targetValue.get(Util.RESULT); try { result = mn.asList(); } catch (Exception ex) { <START> throw new CommandLineException("for cannot be used with operations producing non iterable result"); <END> } ctx.setVariable(varName, "null"); ctx.set(Scope.CONTEXT, CTX_KEY, this); }</code><technical_language>s/producing iterable/that produce a non-iterable/g</technical_language>

Target:
ForControlFlow(CommandContext ctx, String varName, String iterable) throws CommandLineException { if (varName == null) { throw new IllegalArgumentException("Variable is null"); } if (iterable == null) { throw new IllegalArgumentException("Iterable is null"); } if (ctx.getVariable(varName) != null) { throw new CommandFormatException("Variable " + varName + " already exists."); } final ModelControllerClient client = ctx.getModelControllerClient(); if (client == null) { throw new CommandLineException("The connection to the controller has not been established."); } this.varName = varName; ModelNode forRequest = ctx.buildRequest(iterable); ModelNode targetValue; try { targetValue = ctx.execute(forRequest, "for iterable"); } catch (IOException e) { throw new CommandLineException("iterable request failed", e); } if (!targetValue.hasDefined(Util.RESULT)) { throw new CommandLineException("iterable request failed, no result"); } ModelNode mn = targetValue.get(Util.RESULT); try { result = mn.asList(); } catch (Exception ex) { throw new CommandLineException("for cannot be used with operations that produce a non-iterable result"); } ctx.setVariable(varName, "null"); ctx.set(Scope.CONTEXT, CTX_KEY, this); }
Source:
<code>private ZapMenuItem getMenuImportLocalWSDL() { if (menuImportLocalWSDL == null) { menuImportLocalWSDL = new ZapMenuItem( "soap.topmenu.import.importWSDL", getView() .getMenuShortcutKeyStroke( KeyEvent.VK_I, KeyEvent.SHIFT_DOWN_MASK, false)); menuImportLocalWSDL.setToolTipText( Constant.messages.getString("soap.topmenu.import.importWSDL.tooltip")); menuImportLocalWSDL.addActionListener( <START> (java.awt.event.ActionEvent e) -> { <END> final JFileChooser chooser = new JFileChooser( Model.getSingleton().getOptionsParam().getUserDirectory()); FileNameExtensionFilter filter = new FileNameExtensionFilter( Constant.messages.getString( "soap.topmenu.import.importWSDL.filter.description"), "wsdl"); chooser.setFileFilter(filter); int rc = chooser.showOpenDialog(View.getSingleton().getMainFrame()); if (rc == JFileChooser.APPROVE_OPTION) { fileUrlWSDLImport(chooser.getSelectedFile()); } }); } return menuImportLocalWSDL; }</code><technical_language>type removed (same in other lambdas)</technical_language>

Target:
private ZapMenuItem getMenuImportLocalWSDL() { if (menuImportLocalWSDL == null) { menuImportLocalWSDL = new ZapMenuItem( "soap.topmenu.import.importWSDL", getView() .getMenuShortcutKeyStroke( KeyEvent.VK_I, KeyEvent.SHIFT_DOWN_MASK, false)); menuImportLocalWSDL.setToolTipText( Constant.messages.getString("soap.topmenu.import.importWSDL.tooltip")); menuImportLocalWSDL.addActionListener( e -> { final JFileChooser chooser = new JFileChooser( Model.getSingleton().getOptionsParam().getUserDirectory()); FileNameExtensionFilter filter = new FileNameExtensionFilter( Constant.messages.getString( "soap.topmenu.import.importWSDL.filter.description"), "wsdl"); chooser.setFileFilter(filter); int rc = chooser.showOpenDialog(View.getSingleton().getMainFrame()); if (rc == JFileChooser.APPROVE_OPTION) { fileUrlWSDLImport(chooser.getSelectedFile()); } }); } return menuImportLocalWSDL; }
Source:
<code>private void removeCloudReplica(String partitionName) throws ReplicationException { if (!localPartitionNameToPartition.containsKey(partitionName)) { <START> logger.error("Got partition standby notification for partition that is not present on the node", <END> partitionName); return; } PartitionId partitionId = localPartitionNameToPartition.get(partitionName); PartitionInfo partitionInfo = partitionToPartitionInfo.remove(partitionId); if (partitionInfo == null) { logger.error("Partition not exist when remove from {}. ", partitionId, dataNodeId); throw new ReplicationException("Partition not found"); } removeRemoteReplicaInfoFromReplicaThread(partitionInfo.getRemoteReplicaInfos()); if (replicationConfig.replicationPersistTokenOnShutdownOrReplicaRemove) { try { persistor.write(partitionInfo.getLocalReplicaId().getMountPath(), false); } catch (IOException | ReplicationException e) { logger.error("Exception on token write when remove Partition from {}: ", partitionId, dataNodeId, e); throw new ReplicationException("Exception on token write."); } } logger.info("Cloud Partition removed from {}", partitionId, dataNodeId); }</code><technical_language>curious log throw exception in other places. a warn instead</technical_language>

Target:
private void removeCloudReplica(String partitionName) { if (!localPartitionNameToPartition.containsKey(partitionName)) { logger.warn("Got partition standby notification for partition that is not present on the node", partitionName); return; } PartitionId partitionId = localPartitionNameToPartition.get(partitionName); stopPartitionReplication(partitionId); logger.info("Cloud Partition removed from {}", partitionId, dataNodeId); }
Source:
<code>private LookupExtractionFn ensureDelegate() { LookupExtractionFn delegate = delegateRef.get(); <START> if (null == delegate) { <END> synchronized (delegateRef) { delegate = delegateRef.get(); if (null == delegate) { delegate = new LookupExtractionFn( Preconditions.checkNotNull(manager.get(getLookup()), "Lookup [%s] not found", getLookup()).get(), isRetainMissingValue(), getReplaceMissingValueWith(), isInjective(), isOptimize() ); delegateRef.set(delegate); } } } return delegate; }</code><technical_language>is set of null check required</technical_language>

Target:
private LookupExtractionFn ensureDelegate() { if (null == delegate) { synchronized (delegateLock) { if (null == delegate) { delegate = new LookupExtractionFn( Preconditions.checkNotNull(manager.get(getLookup()), "Lookup [%s] not found", getLookup()).get(), isRetainMissingValue(), getReplaceMissingValueWith(), isInjective(), isOptimize() ); } } } return delegate; }
Source:
<code>public void testCollect_oneDevice() { HashMap<String, Metric> metrics = new HashMap<>(); mCollector.testStarted(mTest); mCollector.testEnded(mTest, metrics); verify(mMockReceiver).start(); verify(mMockReceiver).stop(); assertEquals(2, metrics.size()); assertTrue(metrics.containsKey("metric1")); Metric metric1 = metrics.get("metric1"); assertEquals(1, (long) metric1.getMeasurements().getDoubleValues().getDoubleValue(0)); assertTrue(metrics.containsKey("metric2")); Metric metric2 = metrics.get("metric2"); List<Double> values = metric2.getMeasurements().getDoubleValues().getDoubleValueList(); <START> assertEquals(2, values.size()); assertEquals(1, values.get(0).longValue()); assertEquals(2, values.get(1).longValue()); <END> }</code><technical_language>truth simply like: assertThat(values).containsAll(1, 2).inOrder();</technical_language>

Target:
public void testCollect_oneDevice() { HashMap<String, Metric> metrics = new HashMap<>(); mCollector.testRunStarted(RUN_NAME, 1); mCollector.testStarted(mTest); mCollector.testEnded(mTest, metrics); mCollector.testRunEnded(0, metrics); verify(mMockReceiver).start(); verify(mMockReceiver).stop(); verify(mMockReceiver).clear(); assertEquals(2, metrics.size()); assertTrue(metrics.containsKey("metric1")); Metric metric1 = metrics.get("metric1"); assertEquals(1, (long) metric1.getMeasurements().getDoubleValues().getDoubleValue(0)); assertTrue(metrics.containsKey("metric2")); Metric metric2 = metrics.get("metric2"); List<Double> values = metric2.getMeasurements().getDoubleValues().getDoubleValueList(); assertEquals(2, values.size()); assertEquals(1, values.get(0).longValue()); assertEquals(2, values.get(1).longValue()); }
Source:
<code>public static ArrayList<String> runNative(String cmdToRun) { Process p = null; try { p = Runtime.getRuntime().exec(cmdToRun); } catch (IOException e) { return null; } BufferedReader reader = new BufferedReader(new InputStreamReader( p.getInputStream())); String line = ""; ArrayList<String> sa = new ArrayList<String>(); try { while ((line = reader.readLine()) != null) { sa.add(line); } } catch (IOException e) { return null; } <START> p.destroy(); <END> return sa; }</code><technical_language>explain this</technical_language>

Target:
public static ArrayList<String> runNative(String cmdToRun) { Process p = null; try { p = Runtime.getRuntime().exec(cmdToRun); p.waitFor(); } catch (IOException e) { return null; } catch (InterruptedException e) { return null; } BufferedReader reader = new BufferedReader(new InputStreamReader( p.getInputStream())); String line = ""; ArrayList<String> sa = new ArrayList<String>(); try { while ((line = reader.readLine()) != null) { sa.add(line); } } catch (IOException e) { return null; } return sa; }
Source:
<code>public void saveFieldmapProperties(final List<FieldMapInfo> infos) throws MiddlewareQueryException { for (final FieldMapInfo info : infos) { for (final FieldMapDatasetInfo dataset : info.getDatasets()) { for (final FieldMapTrialInstanceInfo trial : dataset.getTrialInstances()) { int locationId = trial.getInstanceId(); if (trial.getInstanceId() != null && trial.getInstanceId().intValue() == 1) { locationId = this.getExperimentModelSaver().moveStudyToNewGeolocation(info.getFieldbookId()); <START> this.saveOrUpdate(locationId, TermId.LOCATION_ID.getId(), trial.getLocationId().toString()); <END> } if (trial.getBlockId() != null) { this.saveOrUpdate(locationId, TermId.BLOCK_ID.getId(), trial.getBlockId().toString()); } } } } }</code><technical_language>remove null checking for trial getLocationId</technical_language>

Target:
public void saveFieldmapProperties(final List<FieldMapInfo> infos) throws MiddlewareQueryException { for (final FieldMapInfo info : infos) { for (final FieldMapDatasetInfo dataset : info.getDatasets()) { for (final FieldMapTrialInstanceInfo trial : dataset.getTrialInstances()) { int locationId = trial.getInstanceId(); if (trial.getInstanceId() != null && trial.getInstanceId().intValue() == 1) { locationId = this.getExperimentModelSaver().moveStudyToNewGeolocation(info.getFieldbookId()); if (trial.getLocationId() != null) { this.saveOrUpdate(locationId, TermId.LOCATION_ID.getId(), trial.getLocationId().toString()); } } if (trial.getBlockId() != null) { this.saveOrUpdate(locationId, TermId.BLOCK_ID.getId(), trial.getBlockId().toString()); } } } } }
Source:
<code>public SimplePromise<Patient> registerPatient(final Patient patient, @Nullable final DefaultResponseCallbackListener callbackListener) { patientDao.savePatient(patient).subscribe(); if (callbackListener != null) { <START> return syncPatient(patient, callbackListener); <END> } else { return syncPatient(patient); } }</code><technical_language>wait this patient is saved</technical_language>

Target:
public void registerPatient(final Patient patient, @Nullable final DefaultResponseCallbackListener callbackListener) { patientDao.savePatient(patient) .observeOn(AndroidSchedulers.mainThread()) .subscribe(id -> { if (callbackListener != null) { syncPatient(patient, callbackListener); } else { syncPatient(patient); } }); }
Source:
<code><START> public Builder autoPersist(boolean autoPersist) { <END> this.autoPersist = autoPersist; return this; }</code><technical_language>generics is missing</technical_language>

Target:
public Builder<T> autoPersist(boolean autoPersist) { this.autoPersist = autoPersist; return this; }
Source:
<code>private int getUnionSchema(Object instanceValue, Schema unionSchema) { int unionSchemaPos = 0; for (Schema currentSchema : unionSchema.getTypes()) { Schema.Type schemaType = currentSchema.getType(); if (instanceValue instanceof CharSequence && schemaType.equals(Schema.Type.STRING)) return unionSchemaPos; <START> else if (instanceValue instanceof ByteBuffer && schemaType.equals(Schema.Type.BYTES)) <END> return unionSchemaPos; else if (instanceValue instanceof byte[] && schemaType.equals(Schema.Type.BYTES)) return unionSchemaPos; else if (instanceValue instanceof Integer && schemaType.equals(Schema.Type.INT)) return unionSchemaPos; else if (instanceValue instanceof Long && schemaType.equals(Schema.Type.LONG)) return unionSchemaPos; else if (instanceValue instanceof Double && schemaType.equals(Schema.Type.DOUBLE)) return unionSchemaPos; else if (instanceValue instanceof Float && schemaType.equals(Schema.Type.FLOAT)) return unionSchemaPos; else if (instanceValue instanceof Boolean && schemaType.equals(Schema.Type.BOOLEAN)) return unionSchemaPos; else if (instanceValue instanceof Map && schemaType.equals(Schema.Type.MAP)) return unionSchemaPos; else if (instanceValue instanceof List && schemaType.equals(Schema.Type.ARRAY)) return unionSchemaPos; else if (instanceValue instanceof Persistent && schemaType.equals(Schema.Type.RECORD)) return unionSchemaPos; unionSchemaPos++; } return 0; }</code><technical_language>else a return statement</technical_language>

Target:
private int getUnionSchema(Object instanceValue, Schema unionSchema) { int unionSchemaPos = 0; for (Schema currentSchema : unionSchema.getTypes()) { Schema.Type schemaType = currentSchema.getType(); if (instanceValue instanceof CharSequence && schemaType.equals(Schema.Type.STRING)) { return unionSchemaPos; } if (instanceValue instanceof ByteBuffer && schemaType.equals(Schema.Type.BYTES)) { return unionSchemaPos; } if (instanceValue instanceof byte[] && schemaType.equals(Schema.Type.BYTES)) { return unionSchemaPos; } if (instanceValue instanceof Integer && schemaType.equals(Schema.Type.INT)) { return unionSchemaPos; } if (instanceValue instanceof Long && schemaType.equals(Schema.Type.LONG)) { return unionSchemaPos; } if (instanceValue instanceof Double && schemaType.equals(Schema.Type.DOUBLE)) { return unionSchemaPos; } if (instanceValue instanceof Float && schemaType.equals(Schema.Type.FLOAT)) { return unionSchemaPos; } if (instanceValue instanceof Boolean && schemaType.equals(Schema.Type.BOOLEAN)) { return unionSchemaPos; } if (instanceValue instanceof Map && schemaType.equals(Schema.Type.MAP)) { return unionSchemaPos; } if (instanceValue instanceof List && schemaType.equals(Schema.Type.ARRAY)) { return unionSchemaPos; } if (instanceValue instanceof Persistent && schemaType.equals(Schema.Type.RECORD)) { return unionSchemaPos; } unionSchemaPos++; } return 0; }
Source:
<code>public void testBadHost() throws InterruptedException { CachingConnectionFactory cf = new CachingConnectionFactory("this.host.does.not.exist"); <START> ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); <END> executor.setThreadNamePrefix("client-"); executor.afterPropertiesSet(); cf.setExecutor(executor); DirectMessageListenerContainer container = new DirectMessageListenerContainer(cf); container.setQueueNames("dummy"); container.setConsumersPerQueue(2); container.setMessageListener(in -> { }); container.setBeanName("simple"); container.setConsumerTagStrategy(new Tag()); CountDownLatch latch = new CountDownLatch(1); container.setApplicationEventPublisher(ev -> { if (ev instanceof ListenerContainerConsumerFailedEvent) { latch.countDown(); } }); container.setRecoveryInterval(100); container.afterPropertiesSet(); container.start(); assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); container.stop(); }</code><technical_language>destroy executor in other tests, in this new one</technical_language>

Target:
public void testBadHost() throws InterruptedException { CachingConnectionFactory cf = new CachingConnectionFactory("this.host.does.not.exist"); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setThreadNamePrefix("client-"); executor.afterPropertiesSet(); cf.setExecutor(executor); DirectMessageListenerContainer container = new DirectMessageListenerContainer(cf); container.setQueueNames("dummy"); container.setConsumersPerQueue(2); container.setMessageListener(in -> { }); container.setBeanName("badHost"); container.setConsumerTagStrategy(new Tag()); CountDownLatch latch = new CountDownLatch(1); container.setApplicationEventPublisher(ev -> { if (ev instanceof ListenerContainerConsumerFailedEvent) { latch.countDown(); } }); container.setRecoveryInterval(100); container.afterPropertiesSet(); container.start(); assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); container.stop(); cf.destroy(); executor.destroy(); }
Source:
<code>public static void schedule(String thingUID, AstroThingHandler astroHandler, Job job, Calendar eventAt) { try { Calendar today = Calendar.getInstance(); if (isSameDay(eventAt, today) && isTimeGreaterEquals(eventAt, today)) { ExpressionThreadPoolExecutor executor = astroHandler.getScheduler(); if (executor != null) { Expression cron = new CronExpression(createCronFromCalendar(eventAt)); executor.schedule(job, cron); <START> astroHandler.addJobToQueue(job); <END> String formattedDate = ISO_DATETIME_FORMAT.format(eventAt); logger.debug("Scheduled Astro Job for thing at {}", thingUID, formattedDate); } } } catch (Exception ex) { logger.error("{}", ex.getMessage(), ex); } }</code><technical_language>Again: If this job is added queue, do schedule in scheduler</technical_language>

Target:
public static void schedule(String thingUID, AstroThingHandler astroHandler, Job job, Calendar eventAt) { try { Calendar today = Calendar.getInstance(); if (isSameDay(eventAt, today) && isTimeGreaterEquals(eventAt, today)) { ExpressionThreadPoolExecutor executor = astroHandler.getScheduler(); if (executor != null) { Expression cron = new CronExpression(createCronFromCalendar(eventAt)); if (astroHandler.addJobToQueue(job)) { executor.schedule(job, cron); } String formattedDate = ISO_DATETIME_FORMAT.format(eventAt); logger.debug("Scheduled Astro Job for thing at {}", thingUID, formattedDate); } } } catch (Exception ex) { logger.error("{}", ex.getMessage(), ex); } }