auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void deleteTest() { String user0 = "user0"; String user1 = "user1"; String user2 = "user2"; insertRow(user0); insertRow(user1); insertRow(user2); orientDBClient.delete(CLASS, user1); OPartitionedDatabasePool pool = orientDBClient.getDatabasePool(); <START> ODatabaseDocumentTx db = pool.acquire(); <END> try { ODictionary<ORecord> dictionary = db.getDictionary(); assertNotNull("Assert user0 still exists", dictionary.get(user0)); assertNull("Assert user1 does not exist", dictionary.get(user1)); assertNotNull("Assert user2 still exists", dictionary.get(user2)); } finally { db.close(); } }</code><technical_language>This a try w/ resources. other pool.acquire() calls</technical_language>

Target:
public void deleteTest() { String user0 = "user0"; String user1 = "user1"; String user2 = "user2"; insertRow(user0); insertRow(user1); insertRow(user2); orientDBClient.delete(CLASS, user1); OPartitionedDatabasePool pool = orientDBClient.getDatabasePool(); try(ODatabaseDocumentTx db = pool.acquire()) { ODictionary<ORecord> dictionary = db.getDictionary(); assertNotNull("Assert user0 still exists", dictionary.get(user0)); assertNull("Assert user1 does not exist", dictionary.get(user1)); assertNotNull("Assert user2 still exists", dictionary.get(user2)); } }
Source:
<code>public final Response getOneSidedRelationships( @QueryParam("contentTypeId") final String contentTypeId, @QueryParam(PaginationUtil.PAGE) final int page, @QueryParam(PaginationUtil.PER_PAGE) @DefaultValue("-1") final int perPage, @Context final HttpServletRequest request) throws Throwable { Logger.debug(this, <START> "Getting the possible relationships and content types"); <END> final InitDataObject initData = this.webResource.init(null, true, request, true, null); final User user = initData.getUser(); final ContentTypeAPI contentTypeAPI = APILocator.getContentTypeAPI(user); ContentType contentType; if (UtilMethods.isSet(contentTypeId)) { try { contentType = contentTypeAPI.find(contentTypeId); } catch (DotSecurityException | DotDataException e) { return ExceptionMapperUtil .createResponse(map("message", "Invalid Content Type"), "Invalid Content Type", Status.BAD_REQUEST); } } else { return ExceptionMapperUtil .createResponse(map("message", "Content Type ID is required"), "Content Type ID is required", Status.BAD_REQUEST); } final PaginationUtil paginationUtil = new PaginationUtil(new RelationshipPaginator(user)); try { final Map<String, Object> params = map(RelationshipPaginator.CONTENT_TYPE_PARAM, contentType); return paginationUtil.getPage(request, user, null, page, perPage, params); } catch (PaginationException e) { throw e.getCause(); } catch (JsonProcessingRuntimeException e) { Logger.error(this, e.getMessage(), e); return ExceptionMapperUtil.createResponse(e, Status.INTERNAL_SERVER_ERROR); } }</code><technical_language>I include contentTpeId in log</technical_language>

Target:
public final Response getOneSidedRelationships( @QueryParam("contentTypeId") final String contentTypeId, @QueryParam(PaginationUtil.PAGE) final int page, @QueryParam(PaginationUtil.PER_PAGE) @DefaultValue("-1") final int perPage, @Context final HttpServletRequest request) throws Throwable { Logger.debug(this, "Getting the possible relationships for content type " + contentTypeId); final InitDataObject initData = this.webResource.init(null, true, request, true, null); final User user = initData.getUser(); final ContentTypeAPI contentTypeAPI = APILocator.getContentTypeAPI(user); ContentType contentType; if (UtilMethods.isSet(contentTypeId)) { try { contentType = contentTypeAPI.find(contentTypeId); } catch (DotSecurityException | DotDataException e) { Logger.error(this, e.getMessage(), e); return ExceptionMapperUtil .createResponse(map("message", "Invalid Content Type"), "Invalid Content Type", Status.BAD_REQUEST); } } else { return ExceptionMapperUtil .createResponse(map("message", "Content Type ID is required"), "Content Type ID is required", Status.BAD_REQUEST); } final PaginationUtil paginationUtil = new PaginationUtil(new RelationshipPaginator(user)); try { final Map<String, Object> params = map(RelationshipPaginator.CONTENT_TYPE_PARAM, contentType); return paginationUtil.getPage(request, user, null, page, perPage, params); } catch (JsonProcessingRuntimeException e) { Logger.error(this, e.getMessage(), e); return ResponseUtil.mapExceptionResponse(e); } }
Source:
<code>public void onConnectivityEvent(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus) { RCLogger.i(TAG, "onConnectivityEvent(): id: " + jobId + ", connectivityStatus: " + connectivityStatus); cachedConnectivityStatus = connectivityStatus; storageManagerPreferences = new StorageManagerPreferences(this); boolean pushEnabled = storageManagerPreferences.getBoolean(ParameterKeys.PUSH_NOTIFICATIONS_ENABLE_PUSH_FOR_ACCOUNT, false); String binding = storageManagerPreferences.getString(FcmConfigurationHandler.FCM_BINDING, null); boolean registeredForPush = binding!=null; if (state == DeviceState.OFFLINE && connectivityStatus != RCDeviceListener.RCConnectivityStatus.RCConnectivityStatusNone){ <START> if (pushEnabled && registeredForPush) { <END> state = DeviceState.READY; } } if (state != DeviceState.OFFLINE && connectivityStatus == RCDeviceListener.RCConnectivityStatus.RCConnectivityStatusNone) { state = DeviceState.OFFLINE; } if (isAttached()) { this.listener.onConnectivityUpdate(this, connectivityStatus); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onConnectivityUpdate(): " + connectivityStatus); } }</code><technical_language>If pushEnabled is false set state READY</technical_language>

Target:
public void onConnectivityEvent(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus) { RCLogger.i(TAG, "onConnectivityEvent(): id: " + jobId + ", connectivityStatus: " + connectivityStatus); cachedConnectivityStatus = connectivityStatus; storageManagerPreferences = new StorageManagerPreferences(this); boolean pushEnabled = storageManagerPreferences.getBoolean(ParameterKeys.PUSH_NOTIFICATIONS_ENABLE_PUSH_FOR_ACCOUNT, false); String binding = storageManagerPreferences.getString(FcmConfigurationHandler.FCM_BINDING, null); boolean registeredForPush = binding!=null; if (state == DeviceState.OFFLINE && connectivityStatus != RCDeviceListener.RCConnectivityStatus.RCConnectivityStatusNone){ if (pushEnabled && registeredForPush) { state = DeviceState.READY; } else if (!pushEnabled) { state = DeviceState.READY; } } if (state != DeviceState.OFFLINE && connectivityStatus == RCDeviceListener.RCConnectivityStatus.RCConnectivityStatusNone) { state = DeviceState.OFFLINE; } if (isAttached()) { this.listener.onConnectivityUpdate(this, connectivityStatus); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onConnectivityUpdate(): " + connectivityStatus); } }
Source:
<code>public <T> void onPostExecute(Callable<T> task) { try { BeanManager bm = CDIHelper.getBeanManager(); if (bm == null) return; postInject(bm, task); if(task instanceof DefaultExecutorService.RunnableAdapter) <START> { <END> postInject(bm, ((DefaultExecutorService.RunnableAdapter) task).getTask()); } } finally { ContextInputCache.clean(); } }</code><technical_language>please proper [formatter](<LINK_0></technical_language>

Target:
public <T> void onPostExecute(Callable<T> task) { try { BeanManager bm = CDIHelper.getBeanManager(); if (bm == null) return; postInject(bm, task); if (task instanceof RunnableAdapter) { postInject(bm, ((RunnableAdapter) task).getTask()); } } finally { ContextInputCache.clean(); } }
Source:
<code>public static String removeAndRestoreDataBundle(DataBundle dataBundle) { removeDataBundle(dataBundle); ResponseBodyAndCode putRequestOutput = executePostRequest(Const.ResourceURIs.DATABUNDLE, null, JsonUtils.toJson(dataBundle)); if (putRequestOutput.responseCode == HttpStatus.SC_OK) { <START> return putRequestOutput.responseBody; <END> } return Const.StatusCodes.BACKDOOR_STATUS_FAILURE; }</code><technical_language>function return (json response BACKDOOR_STATUS_FAILURE ) meanings result in hack in <LINK_0>. I is throw exception for failing situation</technical_language>

Target:
public static String removeAndRestoreDataBundle(DataBundle dataBundle) throws HttpRequestFailedException { removeDataBundle(dataBundle); ResponseBodyAndCode putRequestOutput = executePostRequest(Const.ResourceURIs.DATABUNDLE, null, JsonUtils.toJson(dataBundle)); if (putRequestOutput.responseCode == HttpStatus.SC_OK) { return putRequestOutput.responseBody; } throw new HttpRequestFailedException("Request failed with status code: " + putRequestOutput.responseCode); }
Source:
<code>public void testSaveAndScroll() throws Exception { NXAuditEventsService audit = (NXAuditEventsService) Framework.getRuntime() .getComponent(NXAuditEventsService.NAME); Assert.assertNotNull(audit); ESAuditBackend esBackend = (ESAuditBackend) audit.getBackend(); List<String> jsonEntries = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); for (int i = 0; i < 42; i++) { ObjectNode logEntryJson = mapper.createObjectNode(); logEntryJson.put("eventId", "idForAuditStorage"); jsonEntries.add(mapper.writeValueAsString(logEntryJson)); } esBackend.append(jsonEntries); LogEntryGen.flushAndSync(); AuditQueryBuilder builder = new AuditQueryBuilder().predicates(Predicates.eq("eventId", "idForAuditStorage")); List<LogEntry> logs = esBackend.queryLogs(builder); assertEquals(42, logs.size()); ScrollResult scrollResult = esBackend.scroll(builder, 5, 10); <START> assertEquals(5, scrollResult.getResultIds().size()); <END> int total = 0; while (scrollResult.hasResults()) { List<String> ids = scrollResult.getResultIds(); ids.forEach(id -> assertFalse(id.isEmpty())); total += ids.size(); scrollResult = esBackend.scroll(scrollResult.getScrollId()); } assertEquals(42, total); }</code><technical_language>while no</technical_language>

Target:
public void testSaveAndScroll() throws Exception { NXAuditEventsService audit = (NXAuditEventsService) Framework.getRuntime() .getComponent(NXAuditEventsService.NAME); Assert.assertNotNull(audit); ESAuditBackend esBackend = (ESAuditBackend) audit.getBackend(); List<String> jsonEntries = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); for (int i = 0; i < 42; i++) { ObjectNode logEntryJson = mapper.createObjectNode(); logEntryJson.put("eventId", "idForAuditStorage"); jsonEntries.add(mapper.writeValueAsString(logEntryJson)); } esBackend.append(jsonEntries); LogEntryGen.flushAndSync(); AuditQueryBuilder builder = new AuditQueryBuilder().predicates(Predicates.eq("eventId", "idForAuditStorage")); List<LogEntry> logs = esBackend.queryLogs(builder); Assert.assertEquals(42, logs.size()); ScrollResult scrollResult = esBackend.scroll(builder, 5, 10); int total = 0; while (scrollResult.hasResults()) { Assert.assertTrue(scrollResult.getResultIds().size() <= 5); List<String> ids = scrollResult.getResultIds(); ids.forEach(id -> Assert.assertFalse(id.isEmpty())); total += ids.size(); scrollResult = esBackend.scroll(scrollResult.getScrollId()); } Assert.assertEquals(42, total); }
Source:
<code>public void checkBuild(String uri, ExprList args) { if ( args.isEmpty() ) <START> throw new ExprBuildException("fn:apply: no function to call (minimum number of args is one)"); <END> }</code><technical_language>I misunderstanding semantics of apply, useful some kind of check parameter names a registered function (or op)</technical_language>

Target:
public void checkBuild(String uri, ExprList args) { if ( args.isEmpty() ) throw new ExprException("fn:apply: no function to call (minimum number of args is one)"); }
Source:
<code>public static IndexCoordinates of(String... indexNames) { <START> Assert.notNull(indexNames,"indexNames must not be null"); <END> return new IndexCoordinates(indexNames); }</code><technical_language>ensure indexNames contains element get rid of nullability in getIndexName()</technical_language>

Target:
public static IndexCoordinates of(String... indexNames) { Assert.notNull(indexNames, "indexNames must not be null"); return new IndexCoordinates(indexNames, null); }
Source:
<code>private TranslationFormat readTranslationFormat() { String formatStr = manifest.getString("format"); TranslationFormat format = TranslationFormat.get(formatStr); <START> if(null == format) { <END> if ((Resource.Type.UNLOCKED_DYNAMIC_BIBLE == resourceType) || (Resource.Type.UNLOCKED_LITERAL_BIBLE == resourceType)) { return TranslationFormat.USX; } else { return TranslationFormat.USFM; } } return format; }</code><technical_language>If format is null need check for translation type first. a text translation type a format of markdown. If type is text if project id is obs format is markdown, format is usfm. completely depend resource type a REGULAR type obs a non-gateway language translation of a Bible project. > NOTE: In android app support translating a ulb udb resource type. However, desktop app _does_ support this. android provides enough support import a translation desktop app breaking</technical_language>

Target:
private TranslationFormat readTranslationFormat() { TranslationFormat format = fetchTranslationFormat(manifest); if(null == format) { TranslationType translationType = fetchTranslationType(manifest); if(translationType != TranslationType.TEXT) { return TranslationFormat.MARKDOWN; } else { String projectIdStr = fetchProjectID(manifest); if("obs".equalsIgnoreCase(projectIdStr)) { return TranslationFormat.MARKDOWN; } return TranslationFormat.USFM; } } return format; }
Source:
<code>protected ISourceContainer[] createSourceContainers() throws CoreException { List<ISourceContainer> result = new LinkedList<ISourceContainer>(); ILaunchConfiguration config = getLaunchConfiguration(); Set<String> projectsAdded = new HashSet<>(); try { Project project = LaunchUtils.getBndProject(config); if (project != null) { Collection<Container> runbundles = project.getRunbundles(); for (Container runbundle : runbundles) { if (runbundle.getType() == TYPE.PROJECT) { String targetProjName = runbundle.getProject().getName(); if (projectsAdded.contains(targetProjName)) continue; <START> projectsAdded.add(targetProjName); <END> IProject targetProj = ResourcesPlugin.getWorkspace().getRoot().getProject(targetProjName); if (targetProj != null) { IJavaProject targetJavaProj = JavaCore.create(targetProj); result.add(new JavaProjectSourceContainer(targetJavaProj)); } } else if (runbundle.getType() == TYPE.REPO) { IPath bundlePath = Central.toPath(runbundle.getFile()); if (bundlePath != null) { IFile bundleFile = ResourcesPlugin.getWorkspace().getRoot().getFile(bundlePath); if (bundleFile != null) { ArchiveSourceContainer tempArchiveCont = new ArchiveSourceContainer(bundleFile, false); result.add(tempArchiveCont); } } } } } } catch (Exception e) { logger.logError("Error querying bnd dependency source containers.", e); } return result.toArray(new ISourceContainer[0]); }</code><technical_language>This as: java if (projectsAdded.add(targetProjName)) { IProject targetProj = ... } is, boolean return add decide add JavaProjectSourceContainer instead of a separate contains check</technical_language>

Target:
protected ISourceContainer[] createSourceContainers() throws CoreException { List<ISourceContainer> result = new LinkedList<ISourceContainer>(); ILaunchConfiguration config = getLaunchConfiguration(); Set<String> projectsAdded = new HashSet<>(); try { Project project = LaunchUtils.getBndProject(config); if (project != null) { Collection<Container> runbundles = project.getRunbundles(); for (Container runbundle : runbundles) { if (runbundle.getType() == TYPE.PROJECT) { String targetProjName = runbundle.getProject().getName(); if (projectsAdded.add(targetProjName)) { IProject targetProj = ResourcesPlugin.getWorkspace().getRoot().getProject(targetProjName); if (targetProj != null) { IJavaProject targetJavaProj = JavaCore.create(targetProj); result.add(new JavaProjectSourceContainer(targetJavaProj)); } } } else if (runbundle.getType() == TYPE.REPO) { IPath bundlePath = Central.toPath(runbundle.getFile()); if (bundlePath != null) { IFile bundleFile = ResourcesPlugin.getWorkspace().getRoot().getFile(bundlePath); if (bundleFile != null) { ArchiveSourceContainer tempArchiveCont = new ArchiveSourceContainer(bundleFile, false); result.add(tempArchiveCont); } } } } } } catch (Exception e) { logger.logError("Error querying bnd dependency source containers.", e); } return result.toArray(new ISourceContainer[0]); }
Source:
<code>public String localize(final String errorMsg, final Locale requestLocale) { String localizedErrorMsg = errorMsg; <START> ResourceBundle resourceBundle = getResourceBundle(requestLocale == null ? Locale.getDefault() : requestLocale); <END> if (resourceBundle != null && resourceBundle.containsKey(errorMsg)) { localizedErrorMsg = resourceBundle.getString(errorMsg); } return localizedErrorMsg; }</code><technical_language>save locale choose default in constructor (Locale.getDefault() en_US) ..</technical_language>

Target:
public String localize(final String errorMsg, final Locale requestLocale) { String localizedErrorMsg = errorMsg; ResourceBundle resourceBundle = getResourceBundle(requestLocale == null ? defaultLocale : requestLocale); if (resourceBundle != null && resourceBundle.containsKey(errorMsg)) { localizedErrorMsg = resourceBundle.getString(errorMsg); } return localizedErrorMsg; }
Source:
<code>private void showSearchResults() { if (mSearchResults.isEmpty()) { mRecyclerView.setAdapter(null); <START> updateEmptyView(EmptyViewMessageType.NO_CONTENT); <END> return; } PostsListAdapter adapter = new PostsListAdapter(getActivity(), mSite, mIsPage); adapter.setOnLoadMoreListener(this); adapter.setOnPostSelectedListener(this); adapter.setPosts(mSearchResults); adapter.setOnPostButtonClickListener(this); mRecyclerView.setAdapter(adapter); hideEmptyView(); }</code><technical_language>this show empty view due isPostAdapterEmpty is setup: private boolean isPostAdapterEmpty() { return (mPostsListAdapter != null && mPostsListAdapter.getItemCount() == 0); } I below, show up: private boolean isPostAdapterEmpty() { return (mRecyclerView.getAdapter() == null || mRecyclerView.getAdapter().getItemCount() == 0); } change name isPostAdapterEmpty isRecyclerViewAdapterEmpty, clearer</technical_language>

Target:
private void showSearchResults() { if (mSearchResults.isEmpty()) { mRecyclerView.setAdapter(null); updateEmptyView(EmptyViewMessageType.NO_CONTENT); return; } mSearchListAdapter = new PostsListAdapter(getActivity(), mSite, mIsPage); mSearchListAdapter.setOnLoadMoreListener(this); mSearchListAdapter.setOnPostSelectedListener(this); mSearchListAdapter.setPosts(mSearchResults); mSearchListAdapter.setOnPostButtonClickListener(this); mRecyclerView.setAdapter(mSearchListAdapter); hideEmptyView(); }
Source:
<code>public void traceStop() { Log.v(TAG, "Stopping perfetto trace."); if (!isTracingOn()) { Log.w(TAG, "No trace appears to be in progress. Stopping perfetto trace may not work."); } String cmd = "perfetto --stop --attach=" + PERFETTO_TAG; try { Process process = TraceUtils.exec(cmd); <START> new Logger("traceStop:stderr", process.getErrorStream()); new Logger("traceStop:stdout", process.getInputStream()); <END> if (process.waitFor() != 0) { Log.e(TAG, "perfetto traceStop failed with: " + process.exitValue()); } } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>feeling refactor this TraceUtils.exec. of time creating threads for exec call sense, in if this in place in other places.. if feel places do this (like isTracingOn?) add a toggle</technical_language>

Target:
public void traceStop() { Log.v(TAG, "Stopping perfetto trace."); if (!isTracingOn()) { Log.w(TAG, "No trace appears to be in progress. Stopping perfetto trace may not work."); } String cmd = "perfetto --stop --attach=" + PERFETTO_TAG; try { Process process = TraceUtils.exec(cmd); if (process.waitFor() != 0) { Log.e(TAG, "perfetto traceStop failed with: " + process.exitValue()); } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>void transferChromeOptionPreferencesFromSystemPropsToDriverNoAssignmentStatement() { System.setProperty(CHROME_OPTIONS_PREFS, "key1=1,key2"); ChromeOptions chromeOptions = new ChromeDriverFactory().createChromeOptions(config, proxy); Map<String, Object> prefsMap = getBrowserLaunchPrefs(ChromeOptions.CAPABILITY, chromeOptions); <START> assertThat(prefsMap).hasSize(3); <END> assertThat(prefsMap).containsEntry("key1", 1); assertThat(prefsMap).containsEntry("credentials_enable_service", false); assertThat(prefsMap).containsEntry("download.default_directory", new File("/blah/downloads").getAbsolutePath()); }</code><technical_language>I lines 67,69,70 "tests bound implementation", avoided in general</technical_language>

Target:
void transferChromeOptionPreferencesFromSystemPropsToDriverNoAssignmentStatement() { System.setProperty(CHROME_OPTIONS_PREFS, "key1=1,key2"); ChromeOptions chromeOptions = new ChromeDriverFactory().createChromeOptions(config, proxy); Map<String, Object> prefsMap = getBrowserLaunchPrefs(ChromeOptions.CAPABILITY, chromeOptions); assertThat(prefsMap).containsEntry("key1", 1); assertThat(prefsMap).doesNotContainKey("key2"); }
Source:
<code>protected boolean canDoAction() { boolean returnValue = true; synchronized (_lockObject) { if (Guid.Empty.equals(getVmToAttach(getParameters().getVmPoolId()))) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } } if (returnValue) { List<VM> vmsForUser = DbFacade.getInstance().getVmDao().getAllForUser(getAdUserId()); int vmCount = 0; for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { vmCount++; } } <START> int limit = DbFacade.getInstance().getVmPoolDao().get(getVmPoolId()).getMaxAssignedVmsPerUser(); <END> if (vmCount >= limit) { addCanDoActionMessage(VdcBllMessages.VM_POOL_CANNOT_ATTACH_TO_MORE_VMS_FROM_POOL); returnValue = false; } } if (!returnValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ALLOCATE_AND_RUN); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_FROM_VM_POOL); } return returnValue; }</code><technical_language>please getVmPool() instead of db call</technical_language>

Target:
protected boolean canDoAction() { boolean returnValue = true; synchronized (_lockObject) { if (Guid.Empty.equals(getVmToAttach(getParameters().getVmPoolId()))) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } } if (returnValue) { List<VM> vmsForUser = getVmDAO().getAllForUser(getAdUserId()); int vmCount = 0; for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { vmCount++; } } int limit = getVmPool().getMaxAssignedVmsPerUser(); if (vmCount >= limit) { addCanDoActionMessage(VdcBllMessages.VM_POOL_CANNOT_ATTACH_TO_MORE_VMS_FROM_POOL); returnValue = false; } } if (!returnValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ALLOCATE_AND_RUN); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_FROM_VM_POOL); } return returnValue; }
Source:
<code><START> public static CompressionCodec getCompressionCodec(TextInputFormat inputFormat, Path file) <END> throws NoSuchFieldException, IllegalAccessException { if (inputFormat == null || file == null) { return null; } Field field = inputFormat.getClass().getDeclaredField("compressionCodecs"); if (field == null) { return null; } field.setAccessible(true); CompressionCodecFactory compressionCodecs = (CompressionCodecFactory) field.get(inputFormat); return compressionCodecs.getCodec(file); }</code><technical_language>method calls this method is HiveS3Optimizer::isCompressionCodecSupported method is unused, removed</technical_language>

Target:
public static Optional<CompressionCodec> getCompressionCodec(TextInputFormat inputFormat, Path file) throws NoSuchFieldException, IllegalAccessException { if (inputFormat == null || file == null) { return Optional.empty(); } Field field = inputFormat.getClass().getDeclaredField("compressionCodecs"); if (field == null) { return Optional.empty(); } field.setAccessible(true); CompressionCodecFactory compressionCodecs = (CompressionCodecFactory) field.get(inputFormat); return Optional.of(compressionCodecs.getCodec(file)); }
Source:
<code>public PortfolioItemSummary summarize() { StringBuilder buf = new StringBuilder(64); CurrencyAmount base = product.getBaseCurrencyAmount(); CurrencyAmount counter = product.getCounterCurrencyAmount(); buf.append(SummarizerUtils.fx(base, counter)); buf.append(" : "); buf.append(SummarizerUtils.date(product.getPaymentDate())); <START> CurrencyPair currencyPair = product.getCurrencyPair(); <END> return SummarizerUtils.summary( this, ProductType.FX_SINGLE, buf.toString(), currencyPair.getBase(), currencyPair.getCounter()); }</code><technical_language>currencies amounts, pulling pair</technical_language>

Target:
public PortfolioItemSummary summarize() { StringBuilder buf = new StringBuilder(64); CurrencyAmount base = product.getBaseCurrencyAmount(); CurrencyAmount counter = product.getCounterCurrencyAmount(); buf.append(SummarizerUtils.fx(base, counter)); buf.append(" : "); buf.append(SummarizerUtils.date(product.getPaymentDate())); return SummarizerUtils.summary( this, ProductType.FX_SINGLE, buf.toString(), base.getCurrency(), counter.getCurrency()); }
Source:
<code><START> public void onRootGrowth(DelayedActionTriggeredEvent event, EntityRef rootEntity, LogComponent logComponent, RootComponent rootComponent) { <END> if(!rootComponent.alive || rootComponent.growthStage+1 == rootComponent.growthStages.size()) { return; } rootComponent.growthStage++; if(canGenerateTree(rootEntity)) { rootEntity.addOrSaveComponent(rootComponent); destroyTree(rootEntity, logComponent.location); generateTree(rootEntity); if(rootComponent.growthStage+1 < rootComponent.growthStages.size()) { TreeGrowthStage nextStage = rootComponent.growthStages.get(rootComponent.growthStage+1); resetDelay(rootEntity, nextStage.minTime, nextStage.maxTime); } } }</code><technical_language>**When DelayedActionTriggeredEvents enough filter component. need set check ID for event.**</technical_language>

Target:
public void onRootGrowth(DelayedActionTriggeredEvent event, EntityRef rootEntity, LogComponent logComponent, RootComponent rootComponent) { if(!rootComponent.alive || rootComponent.growthStage+1 == rootComponent.growthStages.size() || !event.getActionId().equals("SimpleFarming:" + rootEntity.getId() + ":Growth")) { return; } rootComponent.growthStage++; if(canGenerateTree(rootEntity)) { rootEntity.addOrSaveComponent(rootComponent); destroyTree(rootEntity, logComponent.location); generateTree(rootEntity); if(rootComponent.growthStage+1 < rootComponent.growthStages.size()) { TreeGrowthStage nextStage = rootComponent.growthStages.get(rootComponent.growthStage+1); resetDelay(rootEntity, nextStage.minTime, nextStage.maxTime); } } }
Source:
<code>protected String addToAuditLogErrorMessage(String connection, String errorCode, List<storage_server_connections> connections, LUNs lun) { AuditLogableBase logable = new AuditLogableBase(); String connectionField = getConnectionDescription(connections, connection) + (lun == null ? "" : " (LUN " + lun.getLUN_id() + ")"); logable.AddCustomValue("Connection", connectionField); String translatedError = getTranslatedStorageError(errorCode); <START> logable.AddCustomValue("ErrorCode", translatedError); <END> AuditLogDirector.log(logable, AuditLogType.STORAGE_DOMAIN_ERROR); return connectionField; }</code><technical_language>ErrorCode a key name, misleading. If fixing message, changing key name ErrorMessage/ TranslatedError clearer</technical_language>

Target:
protected String addToAuditLogErrorMessage(String connection, String errorCode, List<storage_server_connections> connections, LUNs lun) { AuditLogableBase logable = new AuditLogableBase(); String connectionField = getConnectionDescription(connections, connection) + (lun == null ? "" : " (LUN " + lun.getLUN_id() + ")"); logable.AddCustomValue("Connection", connectionField); String translatedError = getTranslatedStorageError(errorCode); logable.AddCustomValue("ErrorMessage", translatedError); AuditLogDirector.log(logable, AuditLogType.STORAGE_DOMAIN_ERROR); return connectionField; }
Source:
<code>private void testNotifyVisibilityChange(boolean isStandalone) { final WorkbenchMegaMenuPresenter presenter = getMegaMenuPresenter(isStandalone); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent("perspectiveId", false)); <START> verify(presenter, times(1)).onPerspectiveVisibilityChange(any()); <END> }</code><technical_language>more times(1)</technical_language>

Target:
private void testNotifyVisibilityChange(boolean isStandalone) { final WorkbenchMegaMenuPresenter presenter = getMegaMenuPresenter(isStandalone); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent("perspectiveId", false)); verify(presenter).onPerspectiveVisibilityChange(any()); }
Source:
<code>private PDU createPDU(SnmpTrapInfo snmpTrapInfo) { PDU trap = new PDU(); trap.setType(PDU.TRAP); int alertType = snmpTrapInfo.getAlertType() + 1; if (alertType > 0) { <START> trap.add(new VariableBinding(SnmpConstants.sysUpTime, new OctetString(new Date().toString()))); <END> trap.add(new VariableBinding(SnmpConstants.snmpTrapOID, getOID(CsSnmpConstants.TRAPS_PREFIX + alertType))); if (snmpTrapInfo.getDataCenterId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.DATA_CENTER_ID), new UnsignedInteger32(snmpTrapInfo.getDataCenterId()))); } if (snmpTrapInfo.getPodId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.POD_ID), new UnsignedInteger32(snmpTrapInfo.getPodId()))); } if (snmpTrapInfo.getClusterId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.CLUSTER_ID), new UnsignedInteger32(snmpTrapInfo.getClusterId()))); } if (snmpTrapInfo.getMessage() != null) { trap.add(new VariableBinding(getOID(CsSnmpConstants.MESSAGE), new OctetString(snmpTrapInfo.getMessage()))); } else { throw new CloudRuntimeException(" What is the use of alert without message "); } if (snmpTrapInfo.getGenerationTime() != null) { trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME), new OctetString(snmpTrapInfo.getGenerationTime().toString()))); } else { trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME))); } } else { throw new CloudRuntimeException(" Invalid alert Type "); } return trap; }</code><technical_language>Agree @DaanHoogland here. sysuptime now(), for long system up</technical_language>

Target:
private PDU createPDU(SnmpTrapInfo snmpTrapInfo) { PDU trap = new PDU(); trap.setType(PDU.TRAP); int alertType = snmpTrapInfo.getAlertType() + 1; if (alertType > 0) { long sysUpTimeTicks = ManagementFactory.getRuntimeMXBean().getUptime() / 10; trap.add(new VariableBinding(SnmpConstants.sysUpTime, new TimeTicks(sysUpTimeTicks))); trap.add(new VariableBinding(SnmpConstants.snmpTrapOID, getOID(CsSnmpConstants.TRAPS_PREFIX + alertType))); if (snmpTrapInfo.getDataCenterId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.DATA_CENTER_ID), new UnsignedInteger32(snmpTrapInfo.getDataCenterId()))); } if (snmpTrapInfo.getPodId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.POD_ID), new UnsignedInteger32(snmpTrapInfo.getPodId()))); } if (snmpTrapInfo.getClusterId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.CLUSTER_ID), new UnsignedInteger32(snmpTrapInfo.getClusterId()))); } if (snmpTrapInfo.getMessage() != null) { trap.add(new VariableBinding(getOID(CsSnmpConstants.MESSAGE), new OctetString(snmpTrapInfo.getMessage()))); } else { throw new CloudRuntimeException(" What is the use of alert without message "); } if (snmpTrapInfo.getGenerationTime() != null) { trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME), new OctetString(snmpTrapInfo.getGenerationTime().toString()))); } else { trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME))); } } else { throw new CloudRuntimeException(" Invalid alert Type "); } return trap; }
Source:
<code>public void error_missingIndexBackend_emptyString() { String keyPrefix = "somePrefix."; resetAll(); EasyMock.expect( configurationSourceMock.get( "indexes.indexName.backend" ) ) .andReturn( (Optional) Optional.of( "" ) ); EasyMock.expect( configurationSourceMock.resolve( "indexes.indexName.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.indexName.backend" ) ); EasyMock.expect( configurationSourceMock.get( "indexes.default.backend" ) ) .andReturn( (Optional) Optional.of( "" ) ); EasyMock.expect( configurationSourceMock.resolve( "indexes.default.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.default.backend" ) ); replayAll(); thrown.expect( SearchException.class ); thrown.expectMessage( "Missing backend reference for index 'indexName'" ); thrown.expectMessage( "Set the property 'somePrefix.indexes.indexName.backend' to a supported value" ); <START> thrown.expectMessage( "or set 'somePrefix.indexes.default.backend' to set a default for all indexes" ); <END> holder.startBuilding( "indexName", false ); verifyAll(); }</code><technical_language>If change message, changed here</technical_language>

Target:
public void error_missingIndexBackend_emptyString() { String keyPrefix = "somePrefix."; resetAll(); EasyMock.expect( configurationSourceMock.get( "indexes.indexName.backend" ) ) .andReturn( (Optional) Optional.of( "" ) ); EasyMock.expect( configurationSourceMock.resolve( "indexes.indexName.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.indexName.backend" ) ); EasyMock.expect( configurationSourceMock.get( "indexes.default.backend" ) ) .andReturn( (Optional) Optional.of( "" ) ); EasyMock.expect( configurationSourceMock.resolve( "indexes.default.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.default.backend" ) ); replayAll(); thrown.expect( SearchException.class ); thrown.expectMessage( "Missing backend reference for index 'indexName'" ); thrown.expectMessage( "Set the property 'somePrefix.indexes.indexName.backend' to a supported value" ); thrown.expectMessage( "or set 'somePrefix.indexes.default.backend' to set a default value for all indexes" ); holder.startBuilding( "indexName", false ); verifyAll(); }
Source:
<code>private BasePanel addNewDatabase(ParserResult result, final Path file, boolean raisePanel) { BibDatabase database = result.getDatabase(); if (result.hasWarnings()) { JabRefExecutorService.INSTANCE <START> .execute(() -> ParserResultWarningDialog.showParserResultWarningDialog(result, frame)); <END> } if (Objects.nonNull(file)) { frame.getDialogService().notify(Localization.lang("Opened library") + " '" + file.toString() + "' " + Localization.lang("with") + " " + database.getEntryCount() + " " + Localization.lang("entries") + "."); } return DefaultTaskExecutor.runInJavaFXThread(() -> { BasePanel basePanel = new BasePanel(frame, BasePanelPreferences.from(Globals.prefs), result.getDatabaseContext(), ExternalFileTypes.getInstance()); frame.addTab(basePanel, raisePanel); return basePanel; }); }</code><technical_language>is this a new thread (which is JavaFX one)</technical_language>

Target:
private BasePanel addNewDatabase(ParserResult result, final Path file, boolean raisePanel) { BibDatabase database = result.getDatabase(); if (result.hasWarnings()) { ParserResultWarningDialog.showParserResultWarningDialog(result, frame); } if (Objects.nonNull(file)) { dialogService.notify(Localization.lang("Opened library") + " '" + file.toString() + "' " + Localization.lang("with") + " " + database.getEntryCount() + " " + Localization.lang("entries") + "."); } BasePanel basePanel = new BasePanel(frame, BasePanelPreferences.from(Globals.prefs), result.getDatabaseContext(), ExternalFileTypes.getInstance()); frame.addTab(basePanel, raisePanel); return basePanel; }
Source:
<code>public Collection<Obj> getObjsByUris(Project project, Collection<String> uris) { notNull(project, "project"); notNull(project.getId(), "project.id"); notNull(uris, "uris"); try { final BulkGet result = restTemplate.postForObject(BulkGet.URI, new BulkGetUris(uris), BulkGet.class, project.getId()); if (result != null) { return result.getItems(); } else { <START> throw new GoodDataException("empty response from API call"); <END> } } catch (RestClientException e) { throw new GoodDataException("Unable to get objects. Some of the supplied URIs may be malformed."); } }</code><technical_language>consistent other error messages: capital letter, sentence structure</technical_language>

Target:
public Collection<Obj> getObjsByUris(Project project, Collection<String> uris) { notNull(project, "project"); notNull(project.getId(), "project.id"); notNull(uris, "uris"); try { final BulkGet result = restTemplate.postForObject(BulkGet.URI, new BulkGetUris(uris), BulkGet.class, project.getId()); if (result != null) { return result.getItems(); } else { throw new GoodDataException("Received empty response from API call."); } } catch (RestClientException e) { throw new GoodDataException("Unable to get objects. Some of the supplied URIs may be malformed.", e); } }
Source:
<code>private String createSpiceInvocationInfo() { <START> return createKeyValHtmlRows( <END> constants.auto(), constants.spiceInvokeAuto(), constants.nativeClient(), constants.consoleInvokeNative(), constants.browserPlugin(), constants.spiceInvokePlugin(), constants.spiceHtml5(), constants.spiceInvokeHtml5() ); }</code><technical_language>I prefer a bit more OO way, like: new KeyValue(key, value). append(new KeyValue(key2, val2)) ... .toString KeyValue class this: class KeyValue { private String html; public KeyValue(String key, String value) { html = "<b>" + key + "</b>" + value; } public KeyValue append(KeyValue other) { html += "<br />" + other.toString(); return this; } public String toString() { return html; } } BTW is real need worry StringBuilder "+" in GWT compiles JS is hard is faster (in some versions of some browser StringBuilder, in some "+" difference in this small amount of concats is significant...)</technical_language>

Target:
private String createSpiceInvocationInfo() { return new KeyValueHtmlRowMaker(constants.auto(), constants.spiceInvokeAuto()) .append(constants.nativeClient(), constants.consoleInvokeNative()) .append(constants.browserPlugin(), constants.spiceInvokePlugin()) .append(constants.spiceHtml5(), constants.spiceInvokeHtml5()).toString(); }
Source:
<code>public void getCardByIdShouldReturnTheCardWithId() throws Exception { final AtomicReference<Card> bodyRefResponse = new AtomicReference<>(); final AtomicReference<Request> bodyRefRequest = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); User user = Fixtures.loadUser(); BitreserveRestAdapter mockRestDapter = new BitreserveRestAdapter("foobar"); mockRestDapter.setAdapter(new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { String responseString = "{ \"id\": \"FOOBAR\" }"; bodyRefRequest.set(request); <START> return new Response("some/url", 200, "reason", new ArrayList<retrofit.client.Header>() { { <END> add(new retrofit.client.Header("foo", "bar")); } }, new TypedByteArray("application/json", responseString.getBytes())); } }).build()); user.setBitreserveRestAdapter(mockRestDapter); user.getCardById("FOOBAR").then(new PromiseAction<Card>() { @Override public void call(Card card) { bodyRefResponse.set(card); latch.countDown(); } }).fail(new PromiseAction<Exception>() { @Override public void call(Exception e) { latch.countDown(); } }); latch.await(); Card cardResponse = bodyRefResponse.get(); Request request = bodyRefRequest.get(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); Assert.assertEquals(cardResponse.getId(), "FOOBAR"); }</code><technical_language>Remove whitespace { { characters</technical_language>

Target:
public void getCardByIdShouldReturnTheCardWithId() throws Exception { final AtomicReference<Card> bodyRefResponse = new AtomicReference<>(); final AtomicReference<Request> bodyRefRequest = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); User user = Fixtures.loadUser(); BitreserveRestAdapter mockRestAdapter = new BitreserveRestAdapter("foobar"); mockRestAdapter.setAdapter(new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { String responseString = "{ \"id\": \"FOOBAR\" }"; bodyRefRequest.set(request); return new Response("some/url", 200, "reason", new ArrayList<retrofit.client.Header>(), new TypedByteArray("application/json", responseString.getBytes())); } }).build()); user.setBitreserveRestAdapter(mockRestAdapter); user.getCardById("FOOBAR").then(new PromiseAction<Card>() { @Override public void call(Card card) { bodyRefResponse.set(card); latch.countDown(); } }).fail(new PromiseAction<Exception>() { @Override public void call(Exception e) { latch.countDown(); } }); latch.await(); Card card = bodyRefResponse.get(); Request request = bodyRefRequest.get(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); Assert.assertEquals(card.getId(), "FOOBAR"); }
Source:
<code>private void subscribeToNewNode() { NodeConnection cxn = null; synchronized (Distributer.this) { m_subscribedConnection = null; if (!m_connections.isEmpty()) { cxn = m_connections.get(new Random().nextInt(m_connections.size())); m_subscriptionRequestPending = true; m_subscribedConnection = cxn; } else { return; } } <START> if (m_shutdown.get()) { <END> return; } try { ProcedureInvocation spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@Subscribe", "TOPOLOGY"); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new SubscribeCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@Statistics", "TOPO", 0); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new TopoUpdateCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); if (!m_fetchedCatalog) { spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@SystemCatalog", "PROCEDURES"); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new ProcUpdateCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); } refreshPartitionKeys(true); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>move this block beginning of function</technical_language>

Target:
private void subscribeToNewNode() { if (m_shutdown.get()) { return; } NodeConnection cxn = null; synchronized (Distributer.this) { m_subscribedConnection = null; if (!m_connections.isEmpty()) { cxn = m_connections.get(new Random().nextInt(m_connections.size())); m_subscriptionRequestPending = true; m_subscribedConnection = cxn; } else { return; } } try { ProcedureInvocation spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@Subscribe", "TOPOLOGY"); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new SubscribeCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@Statistics", "TOPO", 0); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new TopoUpdateCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); if (!m_fetchedCatalog) { spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@SystemCatalog", "PROCEDURES"); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new ProcUpdateCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); } refreshPartitionKeys(true); } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>public QueryBatcherImpl onUrisReady(QueryBatchListener listener) { if ( listener == null ) throw new IllegalArgumentException("listener must not be null"); if(resultsSoFar.longValue()< getMaxUris()) { urisReadyListeners.add(listener); return this; } <START> return null; <END> }</code><technical_language>I expectation is listeners configured job starts. is, resultsSoFar zero. If so, beneficial check maximum in this method. Also, fluent method return null chained calls withBatchSize() in this example .onUrisReady(...) .withBatchSize(...) guaranteed produce a null pointer exception</technical_language>

Target:
public QueryBatcherImpl onUrisReady(QueryBatchListener listener) { if ( listener == null ) throw new IllegalArgumentException("listener must not be null"); urisReadyListeners.add(listener); return this; }
Source:
<code>protected GoExecutor createExecutor(@NotNull Project project, @Nullable Module module, @NotNull String title, @NotNull String filePath) { VirtualFile executable = getExecutable(project, module); assert executable != null; <START> File file = new File(filePath); <END> if(!file.isDirectory()) { file = file.getParentFile(); } String path = file.getPath(); return GoExecutor.in(project, module).withExePath(executable.getPath()).withParameters("-e", "-a", "-v", path ).showOutputOnError(); }</code><technical_language>is convertation virtualFile -> filePath -> File lame. Please extract another createExecutor method in base class VirtualFile parameter instead of filepath</technical_language>

Target:
protected GoExecutor createExecutor(@NotNull Project project, @Nullable Module module, @NotNull String title, @NotNull String filePath) { VirtualFile executable = getExecutable(project, module); assert executable != null; return GoExecutor.in(project, module).withExePath(executable.getPath()).withParameters("-e", "-a", "-v", filePath).showOutputOnError(); }
Source:
<code>public void runWhenReady(CallbackType type, final Runnable runnable) { final Runnable wrappringRunnable; switch (type) { case IN_UI_SYNC: wrappringRunnable = new Runnable() { public void run() { SWTUtil.safeSyncExec(runnable); } }; break; case IN_UI_ASYNC: wrappringRunnable = new Runnable() { public void run() { SWTUtil.safeAsyncExec(runnable); } }; break; default: wrappringRunnable = runnable; break; } <START> synchronized(isFetchingGroup) { <END> if (isFetchingGroup.get()) { addFetchingListener(new FetchingListener() { @Override public boolean doneFetching() { wrappringRunnable.run(); return true; } }); } else { wrappringRunnable.run(); } } }</code><technical_language>synchronizing Atomic* is a clue want do enough. Please review synchronization policy</technical_language>

Target:
public void runWhenReady(CallbackType type, final Runnable runnable) { synchronized(isFetchingGroup) { if (isFetchingGroup.get()) { callbacks.add(new CallbackHolder(runnable, type)); } else { run(runnable, type); } } }
Source:
<code>public boolean isValidBuildCause(PipelineConfig pipelineConfig, BuildCause buildCause) { for (MaterialRevision materialRevision : buildCause.getMaterialRevisions()) { if (materialRevision.isChanged()) { if (materialRevision.getMaterial() instanceof DependencyMaterial) { boolean skipSchedulingOnChange = ((DependencyMaterial) (materialRevision.getMaterial())).skipSchedulingOnChange(); <START> return !skipSchedulingOnChange; <END> } return true; } } return false; }</code><technical_language>a draft PR [this test below](<LINK_0> is supposed bring functionality</technical_language>

Target:
public boolean isValidBuildCause(PipelineConfig pipelineConfig, BuildCause buildCause) { for (MaterialRevision materialRevision : buildCause.getMaterialRevisions()) { if (materialRevision.isChanged() && !materialRevision.shouldIgnoreForScheduling()) { return true; } } return false; }
Source:
<code>public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof SimpleConfiguration) { SimpleConfiguration sc = (SimpleConfiguration) o; <START> return this.toString().equals(sc.toString()); <END> } return false; }</code><technical_language>I checking for equality comparing toString(). relies toString() method consistent. properties printed in a order? If so, comparing identical configuration objects return false. For this comparison, convert simple configuration map, verify maps number of entries, verify properties & values in sc matches other</technical_language>

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof SimpleConfiguration) { Map<String, String> th = this.toMap(); Map<String, String> sc = ((SimpleConfiguration) o).toMap(); if (th.size() == sc.size()) { return th.entrySet().equals(sc.entrySet()); } } return false; }