auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Void bootstrapAllSchedules(HttpServletResponse resp, @RequestParam("source") String src, @RequestParam("from") String from, @RequestParam("to") String to) throws IOException { final Maybe<Publisher> source = Publisher.fromKey(src); if (!source.hasValue()) { return failure(resp, BAD_REQUEST, "Unknown source " + src); } final Iterable<Channel> channels = channelResvoler.all(); final LocalDate dateFrom; final LocalDate dateTo; try { dateFrom = dateParser.parseLocalDate(from); } catch (IllegalArgumentException iae) { return failure(resp, BAD_REQUEST, "Failed to parse "+ from +", expected yyyy-MM-dd"); } try { dateTo = dateParser.parseLocalDate(to); } catch (IllegalArgumentException iae) { return failure(resp, BAD_REQUEST, "Failed to parse "+ to +", expected yyyy-MM-dd"); } final Interval interval = interval(dateFrom, dateTo); executor.submit(new Runnable() { @Override public void run() { boolean bootstrapping = scheduleBootstrapper.bootstrapSchedules( channels, interval, source.requireValue() ); if (!bootstrapping) { log.warn("Bootstrapping failed because apparently busy bootstrapping something else."); } } }); <START> return null; <END> }</code><technical_language>Do need this</technical_language>

Target:
public void bootstrapAllSchedules(HttpServletResponse resp, @RequestParam("source") String src, @RequestParam("from") String from, @RequestParam("to") String to) throws IOException { final Maybe<Publisher> source = Publisher.fromKey(src); if (!source.hasValue()) { failure(resp, BAD_REQUEST, "Unknown source " + src); return; } final Iterable<Channel> channels = channelResvoler.all(); final LocalDate dateFrom; final LocalDate dateTo; try { dateFrom = dateParser.parseLocalDate(from); } catch (IllegalArgumentException iae) { failure(resp, BAD_REQUEST, "Failed to parse "+ from +", expected yyyy-MM-dd"); return; } try { dateTo = dateParser.parseLocalDate(to); } catch (IllegalArgumentException iae) { failure(resp, BAD_REQUEST, "Failed to parse "+ to +", expected yyyy-MM-dd"); return; } final Interval interval = interval(dateFrom, dateTo); executor.submit(new Runnable() { @Override public void run() { boolean bootstrapping = scheduleBootstrapper.bootstrapSchedules( channels, interval, source.requireValue() ); if (!bootstrapping) { log.warn("Bootstrapping failed because apparently busy bootstrapping something else."); } } }); }
Source:
<code>public Map<ManagementLink.Category, List<ManagementLink>> getCategorizedManagementLinks() { Map<ManagementLink.Category, List<ManagementLink>> byCategory = new TreeMap<>(); for (ManagementLink link : ManagementLink.all()) { if (link.getIconFileName() == null) { continue; } if (!Jenkins.get().hasPermission(link.getRequiredPermission())) { continue; } String categoryName = link.getCategory(); ManagementLink.Category category; try { category = ManagementLink.Category.valueOf(categoryName); <START> } catch (IllegalArgumentException ex) { <END> category = ManagementLink.Category.UNCATEGORIZED; } byCategory.computeIfAbsent(category, c -> new ArrayList<>()).add(link); } return byCategory; }</code><technical_language>need catch nullPointerException switch proposed (as annotations for plugins upgrading core heaven forbid return null compiler warnng)</technical_language>

Target:
public Map<ManagementLink.Category, List<ManagementLink>> getCategorizedManagementLinks() { Map<ManagementLink.Category, List<ManagementLink>> byCategory = new TreeMap<>(); for (ManagementLink link : ManagementLink.all()) { if (link.getIconFileName() == null) { continue; } if (!Jenkins.get().hasPermission(link.getRequiredPermission())) { continue; } byCategory.computeIfAbsent(link.getCategory(), c -> new ArrayList<>()).add(link); } return byCategory; }
Source:
<code>private CompletableFuture<DetectorTask> handleSequencer(Layout layout) { log.trace("Handling sequencer failures"); if (localMonitoringService.getMetrics().join().getSequencerStatus() == SequencerStatus.READY) { log.trace("Primary sequencer is ready. Nothing to do"); return DETECTOR_TASK_SKIPPED; } if (sequencerNotReadyCounter.getEpoch() != layout.getEpoch()) { log.trace("Current epoch is different to layout epoch. Update current epoch to: {}", layout.getEpoch()); sequencerNotReadyCounter = new SequencerNotReadyCounter(layout.getEpoch(), 1); return DETECTOR_TASK_SKIPPED; } sequencerNotReadyCounter.increment(); if (sequencerNotReadyCounter.getCounter() < SEQUENCER_NOT_READY_THRESHOLD) { return DETECTOR_TASK_SKIPPED; } ClusterState clusterState = clusterContext.getClusterView(); <START> if (clusterState.isPrimarySequencerReady()) { <END> log.trace("Primary sequencer is already bootstrapped: {}", clusterState); return DETECTOR_TASK_SKIPPED; } log.info("Attempting to bootstrap the primary sequencer. ClusterState {}", clusterState); return getCorfuRuntime() .getLayoutManagementView() .asyncSequencerBootstrap(serverContext.copyManagementLayout(), failureDetectorWorker) .thenApply(DetectorTask::fromBool); }</code><technical_language>bring L544 avoid other extra checks well</technical_language>

Target:
private CompletableFuture<DetectorTask> handleSequencer(Layout layout) { log.trace("Handling sequencer failures"); ClusterState clusterState = clusterContext.getClusterView(); Optional<NodeState> primarySequencer = clusterState.getNode(layout.getPrimarySequencer()); if (primarySequencer.isPresent() && primarySequencer.get().getSequencerMetrics() == SequencerMetrics.READY) { log.trace("Primary sequencer is already ready at: in {}", primarySequencer.get(), clusterState); return DETECTOR_TASK_SKIPPED; } if (sequencerNotReadyCounter.getEpoch() != layout.getEpoch()) { log.trace("Current epoch is different to layout epoch. Update current epoch to: {}", layout.getEpoch()); sequencerNotReadyCounter = new SequencerNotReadyCounter(layout.getEpoch(), 1); return DETECTOR_TASK_SKIPPED; } sequencerNotReadyCounter.increment(); if (sequencerNotReadyCounter.getCounter() < SEQUENCER_NOT_READY_THRESHOLD) { return DETECTOR_TASK_SKIPPED; } log.info("Attempting to bootstrap the primary sequencer. ClusterState {}", clusterState); return getCorfuRuntime() .getLayoutManagementView() .asyncSequencerBootstrap(serverContext.copyManagementLayout(), failureDetectorWorker) .thenApply(DetectorTask::fromBool); }
Source:
<code>public void start() { for (ClusterDescriptor remoteCluster : topologyDescriptor.getStandbyClusters().values()) { try { startLogReplicationRuntime(remoteCluster); <START> } catch (Exception e) { log.error("Failed to start log replication runtime for remote cluster {}", remoteCluster.getClusterId()); topologyDescriptor.getStandbyClusters().remove(remoteCluster.getClusterId()); } <END> } }</code><technical_language>this catch block is in a dead code path. startLogReplicationRuntime catch exceptions input event FSM. Remove elements in iteration values dangerous. > If map is modified while iteration collection is in progress (except iterator's remove operation), results of iteration undefined</technical_language>

Target:
public void start() { for (ClusterDescriptor remoteCluster : topology.getStandbyClusters().values()) { try { startLogReplicationRuntime(remoteCluster); } catch (Exception e) { log.error("Failed to start log replication runtime for remote cluster {}", remoteCluster.getClusterId()); } } }
Source:
<code>private List<Channel> getSourceChannels(Map<String, ChannelComponent> channelComponentMap, Source source, Collection<String> channelNames) { List<Channel> sourceChannels = new ArrayList<Channel>(); for (String chName : channelNames) { ChannelComponent channelComponent = channelComponentMap.get(chName); if (channelComponent != null) { try { checkSourceChannelCompatibility(source, channelComponent.channel); sourceChannels.add(channelComponent.channel); <START> } catch (InstantiationException e) { <END> LOGGER.error("Source - channel compatibility problem", e); } } } return sourceChannels; }</code><technical_language>If is a problem of channels this silently remove one. I exception out Source removed config</technical_language>

Target:
private List<Channel> getSourceChannels(Map<String, ChannelComponent> channelComponentMap, Source source, Collection<String> channelNames) throws InstantiationException { List<Channel> sourceChannels = new ArrayList<Channel>(); for (String chName : channelNames) { ChannelComponent channelComponent = channelComponentMap.get(chName); if (channelComponent != null) { checkSourceChannelCompatibility(source, channelComponent.channel); sourceChannels.add(channelComponent.channel); } } return sourceChannels; }
Source:
<code>protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { <START> getReturnValue().getInternalVdsmTaskIdList().add(taskId); List<Guid> vdsmTaskIds = new ArrayList<>(); vdsmTaskIds.add(taskId); getParameters().setVdsmTaskIds(vdsmTaskIds); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); <END> } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }</code><technical_language>I this block of code is written intended :)</technical_language>

Target:
protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getReturnValue().getVdsmTaskIdList().add(taskId); getReturnValue().getInternalVdsmTaskIdList().add(taskId); getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }
Source:
<code>public void testResetPassword_shouldReturnResponseEntityWithCreatedStatus(){ String username = "superuser"; PasswordResetBackingForm form = aPasswordResetBackingForm().withUsername(username).build(); passwordResetController.resetPassword(form); verify(passwordResetControllerService).resetPassword(form); <START> Assert.assertEquals("Response status should be CREATED", HttpStatus.CREATED, passwordResetController.resetPassword(form).getStatusCode()); <END> }</code><technical_language>@tumijacob calling method here. a variable store return value</technical_language>

Target:
public void testResetPassword_shouldReturnResponseEntityWithCreatedStatus() { String username = "superuser"; PasswordResetBackingForm form = aPasswordResetBackingForm().withUsername(username).build(); HttpStatus statusCode = passwordResetController.resetPassword(form).getStatusCode(); Assert.assertEquals("Response status should be CREATED", HttpStatus.CREATED, statusCode); }
Source:
<code>public IPath computeFixedPath(IStorage storage) { final IPath fixedPath; <START> final GitBlobStorage gitStorage = (GitBlobStorage)storage; <END> if (storage instanceof WorkspaceGitBlobStorage) { fixedPath = ((WorkspaceGitBlobStorage)gitStorage).getWorkspacePath(); } else { final IPath absolutePath = gitStorage.getAbsolutePath(); final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IFile fileForLocation = root.getFileForLocation(absolutePath); if (fileForLocation != null) { fixedPath = fileForLocation.getFullPath(); } else { fixedPath = null; } } return fixedPath; }</code><technical_language>safe is cast checking type before? I generally unchecked casts..</technical_language>

Target:
public IPath computeFixedPath(IStorage storage) { final IPath fixedPath; if (storage instanceof WorkspaceGitBlobStorage) { fixedPath = ((WorkspaceGitBlobStorage)storage).getWorkspacePath(); } else if (storage instanceof GitBlobStorage) { final IPath absolutePath = ((GitBlobStorage)storage).getAbsolutePath(); final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IFile fileForLocation = root.getFileForLocation(absolutePath); if (fileForLocation != null) { fixedPath = fileForLocation.getFullPath(); } else { fixedPath = null; } } else { fixedPath = null; } return fixedPath; }
Source:
<code><START> private static ServiceMethodAdpaterInfo parseServiceMethodAdapterInfo(Method method) { <END> Type[] genericParameterTypes = method.getGenericParameterTypes(); if (genericParameterTypes.length != 0) { Type lastParameterType = genericParameterTypes[genericParameterTypes.length - 1]; if (lastParameterType instanceof ParameterizedType) { ParameterizedType parameterizedLastParameterType = (ParameterizedType) lastParameterType; try { if (parameterizedLastParameterType.getRawType() == Continuation.class) { Type resultType = parameterizedLastParameterType.getActualTypeArguments()[0]; if (resultType instanceof WildcardType) { resultType = ((WildcardType) resultType).getLowerBounds()[0]; } if (resultType instanceof ParameterizedType) { ParameterizedType parameterizedResultType = (ParameterizedType) resultType; if (parameterizedResultType.getRawType() == Response.class) { Type bodyType = parameterizedResultType.getActualTypeArguments()[0]; Type callType = new CallParameterizedTypeImpl(bodyType); return new ServiceMethodAdpaterInfo(true, true, callType); } } Type callType = new CallParameterizedTypeImpl(resultType); return new ServiceMethodAdpaterInfo(true, false, callType); } } catch (NoClassDefFoundError ignored) { } } } return new ServiceMethodAdpaterInfo(false, false, method.getGenericReturnType()); }</code><technical_language>Yeah. _that_ API complicated</technical_language>

Target:
private static ServiceMethodAdapterInfo parseServiceMethodAdapterInfo(Method method) { Type[] genericParameterTypes = method.getGenericParameterTypes(); if (genericParameterTypes.length != 0) { Type lastParameterType = genericParameterTypes[genericParameterTypes.length - 1]; if (lastParameterType instanceof ParameterizedType) { ParameterizedType parameterizedLastParameterType = (ParameterizedType) lastParameterType; try { if (parameterizedLastParameterType.getRawType() == Continuation.class) { Type resultType = parameterizedLastParameterType.getActualTypeArguments()[0]; if (resultType instanceof WildcardType) { resultType = ((WildcardType) resultType).getLowerBounds()[0]; } if (resultType instanceof ParameterizedType) { ParameterizedType parameterizedResultType = (ParameterizedType) resultType; if (parameterizedResultType.getRawType() == Response.class) { Type bodyType = parameterizedResultType.getActualTypeArguments()[0]; Type callType = new CallParameterizedTypeImpl(bodyType); return new ServiceMethodAdapterInfo(true, true, callType); } } Type callType = new CallParameterizedTypeImpl(resultType); return new ServiceMethodAdapterInfo(true, false, callType); } } catch (NoClassDefFoundError ignored) { } } } return new ServiceMethodAdapterInfo(false, false, method.getGenericReturnType()); }
Source:
<code><START> public static JSONObject getOrganisationUnitsByCode(String code) <END> throws PullConversionException { String serverVersion = getServerVersion(PreferencesState.getInstance().getDhisURL()); if (serverVersion == null) { return null; } try { String urlOrgUnitData = getOrganisationUnitsCredentialsUrl(code); Response response = executeCall(null, urlOrgUnitData, "GET"); if (!response.isSuccessful()) { Log.e(TAG, "getOrgUnitData (" + response.code() + "): " + response.body().string()); throw new IOException(response.message()); } JSONObject jsonResponse = parseResponse(response.body().string()); JSONArray orgUnitsArray = (JSONArray) jsonResponse.get(TAG_ORGANISATIONUNITS); if (orgUnitsArray.length() == 0 || orgUnitsArray.length() > 1) { Log.e(TAG, String.format("getOrgUnitData(%s) -> Found %d matches", code, orgUnitsArray.length())); return null; } return (JSONObject) orgUnitsArray.get(0); } catch (Exception ex) { Log.e(TAG, String.format("getOrgUnitData(%s): %s", code, ex.toString())); ex.printStackTrace(); throw new PullConversionException(); } }</code><technical_language>this method returns domain OrgUnit a jsonObject</technical_language>

Target:
public static OrganisationUnit getOrganisationUnitsByCode( String code) throws PullConversionException, NetworkException, IOException, JSONException { String serverVersion = getServerVersion(PreferencesState.getInstance().getDhisURL()); if (serverVersion == null) { return null; } try { String urlOrgUnitData = getOrganisationUnitsCredentialsUrl(code); if (!isNetworkAvailable()) { throw new NetworkException(); } Response response = executeCall(null, urlOrgUnitData, "GET"); if (!response.isSuccessful()) { Log.e(TAG, "getOrgUnitData (" + response.code() + "): " + response.body().string()); throw new IOException(response.message()); } JSONObject jsonResponse = parseResponse(response.body().string()); JSONArray orgUnitsArray = (JSONArray) jsonResponse.get(TAG_ORGANISATIONUNITS); if (orgUnitsArray.length() == 0 || orgUnitsArray.length() > 1) { Log.e(TAG, String.format("getOrgUnitData(%s) -> Found %d matches", code, orgUnitsArray.length())); return null; } JSONObject orgUnitJO = (JSONObject) orgUnitsArray.get(0); return parseOrgUnit(orgUnitJO); } catch (NetworkException e) { throw e; } catch (Exception ex) { Log.e(TAG, String.format("getOrgUnitData(%s): %s", code, ex.toString())); ex.printStackTrace(); throw new PullConversionException(); } }
Source:
<code>public void testStartScanner() { final ContainerSpecKey containerSpecKey = new ContainerSpecKey("id", "name", new ServerTemplateKey("serverTemplateId", "stname")); KieServerControllerDescriptorCommand command = new KieServerControllerDescriptorCommand(RuleCapabilitiesService.class.getName(), "startScanner", null, null, containerSpecKey, new Long(1)); final String content = WebSocketUtils.marshal(command); <START> LOGGER.info("JSON content\n{}", content); <END> KieServerControllerServiceResponse response = service.executeCommand(WebSocketUtils.unmarshal(content, KieServerControllerDescriptorCommand.class)); assertNotNull(response); assertEquals(FAILURE, response.getType()); assertEquals("No server template found for id serverTemplateId", response.getMsg()); assertNull(response.getResult()); }</code><technical_language>change debug reduce log size..</technical_language>

Target:
public void testStartScanner() { final ContainerSpecKey containerSpecKey = new ContainerSpecKey("id", "name", new ServerTemplateKey("serverTemplateId", "stname")); KieServerControllerDescriptorCommand command = new KieServerControllerDescriptorCommand(RuleCapabilitiesService.class.getName(), "startScanner", null, null, containerSpecKey, new Long(1)); final String content = WebSocketUtils.marshal(command); LOGGER.debug("JSON content\n{}", content); KieServerControllerServiceResponse response = service.executeCommand(WebSocketUtils.unmarshal(content, KieServerControllerDescriptorCommand.class)); assertNotNull(response); assertEquals(FAILURE, response.getType()); assertEquals("No server template found for id serverTemplateId", response.getMsg()); assertNull(response.getResult()); }
Source:
<code>void stateFlagsAdd(int flags) { final long tagCBoxPtr = OS.GetWindowLongPtr(handle, 0); <START> if (tagCBoxPtr != 0) { <END> final long stateFlagsPtr = tagCBoxPtr + stateFlagsOffset; int stateFlags[] = new int[1]; OS.MoveMemory(stateFlags, stateFlagsPtr, 4); stateFlags[0] |= flags; OS.MoveMemory(stateFlagsPtr, stateFlags, 4); } }</code><technical_language>I advise workaround here. needed. stateFlagsTest() is intended verify safe. error permanent, if tested good, fail later</technical_language>

Target:
void stateFlagsAdd(int flags) { final long tagCBoxPtr = OS.GetWindowLongPtr(handle, 0); if (tagCBoxPtr == 0) return; final long stateFlagsPtr = tagCBoxPtr + stateFlagsOffset; int stateFlags[] = new int[1]; OS.MoveMemory(stateFlags, stateFlagsPtr, 4); stateFlags[0] |= flags; OS.MoveMemory(stateFlagsPtr, stateFlags, 4); }
Source:
<code>private void setUpLook() { <START> ImageIcon childIcon = new ImageIcon(this.getClass().getClassLoader().getResource(ICON_BACTERIA)); <END> DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); renderer.setLeafIcon(childIcon); jTree.setCellRenderer(renderer); }</code><technical_language>Lets put this in a method, file load util</technical_language>

Target:
private void setUpLook() { ImageIcon childIcon = new ImageIcon(Resources.getResource(ICON_BACTERIA)); DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); renderer.setLeafIcon(childIcon); jTree.setCellRenderer(renderer); }
Source:
<code>private boolean passesFilteringByParameter(final Run<?, ?> build, final String parameterName, final String parameterValue) { if (parameterName == null) { return true; } Map<String, String> variables; if (build instanceof AbstractBuild) { variables = ((AbstractBuild<?, ?>) build).getBuildVariables(); } else { <START> variables = null; <END> } if (variables == null) { return false; } return Objects.equal(variables.get(parameterName), parameterValue); }</code><technical_language>sense return true? workflow jobs included in graph if a parameter name is set</technical_language>

Target:
private boolean passesFilteringByParameter(final Run<?, ?> build, final String parameterName, final String parameterValue) { if (parameterName == null) { return true; } Map<String, String> variables; if (build instanceof AbstractBuild) { variables = ((AbstractBuild<?, ?>) build).getBuildVariables(); } else { return true; } if (variables == null) { return false; } return Objects.equal(variables.get(parameterName), parameterValue); }
Source:
<code>private static boolean isBasicType(Class<?> type) { <START> return PrimitiveTypes.forType(type) != null || Number.class.isAssignableFrom(type); <END> }</code><technical_language>reduce return type.isPrimitive() || Number.class.isAssignableFrom(type) || Boolean.class.isAssignableFrom(type) || Char.class.isAssignableFrom(type)); (PrimitiveTypes is needed in this case)</technical_language>

Target:
private static boolean isBasicType(Class<?> type) { return type.isPrimitive() || Number.class.isAssignableFrom(type) || Boolean.class.isAssignableFrom(type) || Character.class.isAssignableFrom(type); }
Source:
<code>public Mono<CosmosAsyncContainerResponse> delete(CosmosContainerRequestOptions options) { if (options == null) { options = new CosmosContainerRequestOptions(); } if (!database.getClient().getTracerProvider().isEnabled()) { return deleteInternal(options); } final CosmosContainerRequestOptions requestOptions = options; <START> return withContext(context -> deleteInternal(requestOptions, context)).subscriberContext(TracerProvider.callDepthAttributeFunc); <END> }</code><technical_language>ditto, in other places</technical_language>

Target:
public Mono<CosmosContainerResponse> delete(CosmosContainerRequestOptions options) { if (options == null) { options = new CosmosContainerRequestOptions(); } if (!database.getClient().getTracerProvider().isEnabled()) { return deleteInternal(options); } final CosmosContainerRequestOptions requestOptions = options; return withContext(context -> deleteInternal(requestOptions, context)); }
Source:
<code>private void stopRemoveBricks() { if (getSelectedItems() == null || getSelectedItems().isEmpty()) { return; } if (getConfirmWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksTitle()); model.setMessage(ConstantsManager.getInstance().getConstants().stopRemoveBricksMessage()); <START> model.setHashName("volume_remove_bricks_stop"); END> GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getEntity(); ArrayList<String> list = new ArrayList<String>(); for (GlusterBrickEntity brick : volumeEntity.getBricks()) { if (brick.getAsyncTask() != null && brick.getAsyncTask().getStatus() == JobExecutionStatus.STARTED) { list.add(brick.getQualifiedName()); } } model.setItems(list); UICommand okCommand = new UICommand("OnStopRemoveBricks", this); okCommand.setTitle(ConstantsManager.getInstance().getConstants().ok()); okCommand.setIsDefault(true); model.getCommands().add(okCommand); UICommand cancelCommand = new UICommand("CancelConfirmation", this); cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close()); cancelCommand.setIsCancel(true); model.getCommands().add(cancelCommand); }</code><technical_language>underscores..</technical_language>

Target:
private void stopRemoveBricks() { if (getSelectedItems() == null || getSelectedItems().isEmpty()) { return; } if (getConfirmWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksTitle()); model.setMessage(ConstantsManager.getInstance().getConstants().stopRemoveBricksMessage()); model.setHashName("volume_remove_bricks_stop"); GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getEntity(); GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask(); ArrayList<String> list = new ArrayList<String>(); for (GlusterBrickEntity brick : volumeEntity.getBricks()) { if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null && volumeTask != null && volumeTask.getStatus() == JobExecutionStatus.STARTED) { list.add(brick.getQualifiedName()); } } model.setItems(list); UICommand okCommand = new UICommand("OnStopRemoveBricks", this); okCommand.setTitle(ConstantsManager.getInstance().getConstants().ok()); okCommand.setIsDefault(true); model.getCommands().add(okCommand); UICommand cancelCommand = new UICommand("CancelConfirmation", this); cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close()); cancelCommand.setIsCancel(true); model.getCommands().add(cancelCommand); }
Source:
<code>private void failIfZipEntryPathContainsDirectoryTraversalCharacters(String filepath) { <START> if (filepath.contains("/../") || filepath.startsWith("../") || filepath.endsWith("/..")) { <END> throw new IllegalPathException(String.format("File %s is outside extraction target directory", filepath)); } }</code><technical_language>a windows equivalent path \..\ \\..\\ depending escaped, not? FileNameUtils#separatorsToUnix(filepath).split('/').contains("..") is want</technical_language>

Target:
private void failIfZipEntryPathContainsDirectoryTraversalCharacters(String filepath) { if (filepath.contains("/../") || filepath.startsWith("../") || filepath.endsWith("/..") || filepath.contains("\\..\\") || filepath.startsWith("..\\") || filepath.endsWith("\\..")) { throw new IllegalPathException(String.format("File %s is outside extraction target directory", filepath)); } }
Source:
<code>private void proxyWmsRequest(HttpServletRequest request, HttpServletResponse response, String layerParameter) throws ServletException, IOException { LayerDescriptor layerDescriptor = new LayerDescriptor(request.getParameter(layerParameter)); String time = request.getParameter("TIME"); String wmsUrlStr = getWmsUrl(layerDescriptor, time); try { <START> Map<String, String[]> wmsParameters = new HashMap(request.getParameterMap()); <END> wmsParameters.remove("TIME"); wmsParameters.put("VERSION", new String[] { wmsVersion }); wmsParameters.put(layerParameter, new String[] { layerDescriptor.variable }); if (wmsParameters.containsKey("QUERY_LAYERS")) { wmsParameters.put("QUERY_LAYERS", new String[] { layerDescriptor.variable }); } String queryString = encodeMapForRequest(wmsParameters); URL wmsUrl = new URL(wmsUrlStr + "?" + queryString); IOUtils.copy(wmsUrl.openConnection().getInputStream(), response.getOutputStream()); } catch (Exception e) { LOGGER.log(Level.SEVERE, String.format("Problem proxying url '%s'", wmsUrlStr)); e.printStackTrace(); } }</code><technical_language>generics type signature match LHS RHS</technical_language>

Target:
private void proxyWmsRequest(HttpServletRequest request, HttpServletResponse response, String layerParameter) throws ServletException, IOException { LayerDescriptor layerDescriptor = new LayerDescriptor(request.getParameter(layerParameter)); String time = request.getParameter("TIME"); String wmsUrlStr = getWmsUrl(layerDescriptor, time); try { @SuppressWarnings("unchecked") Map<String, String[]> wmsParameters = new HashMap<String, String[]>(request.getParameterMap()); wmsParameters.remove("TIME"); wmsParameters.put("VERSION", new String[] { wmsVersion }); wmsParameters.put(layerParameter, new String[] { layerDescriptor.variable }); if (wmsParameters.containsKey("QUERY_LAYERS")) { wmsParameters.put("QUERY_LAYERS", new String[] { layerDescriptor.variable }); } String queryString = encodeMapForRequest(wmsParameters); URL wmsUrl = new URL(wmsUrlStr + "?" + queryString); IOUtils.copy(wmsUrl.openConnection().getInputStream(), response.getOutputStream()); } catch (Exception e) { LOGGER.log(Level.SEVERE, String.format("Problem proxying url '%s'", wmsUrlStr)); e.printStackTrace(); } }
Source:
<code><START> static String ensureQueueExists(AmazonSQS amazonSQS, <END> ARN queueARN, ARN topicARN, int sqsMessageRetentionPeriodSeconds) { String queueUrl = amazonSQS.createQueue(queueARN.getName()).getQueueUrl(); log.debug("Created queue " + queueUrl); HashMap<String, String> attributes = new HashMap<>(); attributes.put("Policy", buildSQSPolicy(queueARN, topicARN).toJson()); attributes.put("MessageRetentionPeriod", Integer.toString(sqsMessageRetentionPeriodSeconds)); amazonSQS.setQueueAttributes( queueUrl, attributes ); return queueUrl; }</code><technical_language>public</technical_language>

Target:
public static String ensureQueueExists(AmazonSQS amazonSQS, ARN queueARN, ARN topicARN, int sqsMessageRetentionPeriodSeconds) { String queueUrl = amazonSQS.createQueue(queueARN.getName()).getQueueUrl(); log.debug("Created queue " + queueUrl); HashMap<String, String> attributes = new HashMap<>(); attributes.put("Policy", buildSQSPolicy(queueARN, topicARN).toJson()); attributes.put("MessageRetentionPeriod", Integer.toString(sqsMessageRetentionPeriodSeconds)); amazonSQS.setQueueAttributes( queueUrl, attributes ); return queueUrl; }
Source:
<code>public void leaveCluster() { if (isInCluster()) { ScriptHelper leaveClusterScript = newScript("leaveCluster") <START> .body.append(format("%s cluster leave")) <END> .body.append(format("%s cluster plan", getRiakAdminCmd())) .body.append(format("%s cluster commit", getRiakAdminCmd())) .failOnNonZeroResultCode(); if (!isRiakOnPath) { Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath); log.warn("riak command not found on PATH. Altering future commands' environment variables from to {}", getShellEnvironment(), newPathVariable); leaveClusterScript.environmentVariablesReset(newPathVariable); } leaveClusterScript.execute(); entity.setAttribute(RiakNode.RIAK_NODE_IN_CLUSTER, Boolean.FALSE); } else { log.warn("entity {}: is not in the riak Cluster", entity.getId()); } }</code><technical_language>argument for %s here, getRiakAdminCmd()</technical_language>

Target:
public void leaveCluster() { if (isInCluster()) { ScriptHelper leaveClusterScript = newScript("leaveCluster") .body.append(format("%s cluster leave", getRiakAdminCmd())) .body.append(format("%s cluster plan", getRiakAdminCmd())) .body.append(format("%s cluster commit", getRiakAdminCmd())); if (!isRiakOnPath) { Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath); log.warn("riak command not found on PATH. Altering future commands' environment variables from to {}", getShellEnvironment(), newPathVariable); leaveClusterScript.environmentVariablesReset(newPathVariable); } leaveClusterScript.execute(); entity.setAttribute(RiakNode.RIAK_NODE_IN_CLUSTER, Boolean.FALSE); } else { log.warn("entity {}: is not in the riak cluster", entity.getId()); } }
Source:
<code>public boolean isExternal() { <START> boolean state = false; <END> String cacheDirPath = null; File extStoragePath = Environment.getExternalStorageDirectory(); if(extStoragePath != null) { cacheDirPath = extStoragePath.toString(); try { String appCacheDirPath = mRootDirectory.getCanonicalPath(); if (appCacheDirPath.contains(cacheDirPath)) state = true; } catch (IOException e) { e.printStackTrace(); } }else{ state = false;} return state; }</code><technical_language>compute this in constructor right setting mRootDirectory. mRootDirectory = rootDirectory; mIsExternal = isExternal(rootDirectory); private static boolean isExternal(File directory) { ... }</technical_language>

Target:
public boolean isExternal() { return mIsExternal; }
Source:
<code>public byte[] getData() { if (!isDataFlushedToDisk()) { <START> byte[] buf = new byte[cacheStream.size()]; <END> System.arraycopy(cacheStream.getBuffer(), 0, buf, 0, cacheStream.size()); return buf; } return null; }</code><technical_language>Nit: if this matters. avoid this copy wrapping in a ByteBuffer (another copy is happening serializing protobuf)</technical_language>

Target:
public ByteBuffer getData() { if (!isDataFlushedToDisk()) { return ByteBuffer.wrap(cacheStream.getBuffer(), 0, cacheStream.size()); } return null; }
Source:
<code>public ICVSResource[] members(int flags) throws CVSException { final List<ICVSResource> result = new ArrayList<>(); ICVSRemoteResource[] resources = getChildren(); if (children == null) { return new ICVSResource[0]; } if ((flags & EXISTING_MEMBERS) == 0 && (flags & PHANTOM_MEMBERS) == PHANTOM_MEMBERS) { return new ICVSResource[0]; } boolean includeFiles = (((flags & FILE_MEMBERS) != 0) || ((flags & (FILE_MEMBERS | FOLDER_MEMBERS)) == 0)); boolean includeFolders = (((flags & FOLDER_MEMBERS) != 0) || ((flags & (FILE_MEMBERS | FOLDER_MEMBERS)) == 0)); boolean includeManaged = (((flags & MANAGED_MEMBERS) != 0) || ((flags & (MANAGED_MEMBERS | UNMANAGED_MEMBERS | IGNORED_MEMBERS)) == 0)); boolean includeUnmanaged = (((flags & UNMANAGED_MEMBERS) != 0) || ((flags & (MANAGED_MEMBERS | UNMANAGED_MEMBERS | IGNORED_MEMBERS)) == 0)); boolean includeIgnored = ((flags & IGNORED_MEMBERS) != 0); for (ICVSRemoteResource resource : resources) { <START> ICVSResource cvsResource = resource; <END> if ((includeFiles && ( ! cvsResource.isFolder())) || (includeFolders && (cvsResource.isFolder()))) { boolean isManaged = cvsResource.isManaged(); boolean isIgnored = cvsResource.isIgnored(); if ((isManaged && includeManaged)|| (isIgnored && includeIgnored) || ( ! isManaged && ! isIgnored && includeUnmanaged)) { result.add(cvsResource); } } } return result.toArray(new ICVSResource[result.size()]); }</code><technical_language>moved in loop</technical_language>

Target:
public ICVSResource[] members(int flags) throws CVSException { final List<ICVSResource> result = new ArrayList<>(); ICVSRemoteResource[] resources = getChildren(); if (children == null) { return new ICVSResource[0]; } if ((flags & EXISTING_MEMBERS) == 0 && (flags & PHANTOM_MEMBERS) == PHANTOM_MEMBERS) { return new ICVSResource[0]; } boolean includeFiles = (((flags & FILE_MEMBERS) != 0) || ((flags & (FILE_MEMBERS | FOLDER_MEMBERS)) == 0)); boolean includeFolders = (((flags & FOLDER_MEMBERS) != 0) || ((flags & (FILE_MEMBERS | FOLDER_MEMBERS)) == 0)); boolean includeManaged = (((flags & MANAGED_MEMBERS) != 0) || ((flags & (MANAGED_MEMBERS | UNMANAGED_MEMBERS | IGNORED_MEMBERS)) == 0)); boolean includeUnmanaged = (((flags & UNMANAGED_MEMBERS) != 0) || ((flags & (MANAGED_MEMBERS | UNMANAGED_MEMBERS | IGNORED_MEMBERS)) == 0)); boolean includeIgnored = ((flags & IGNORED_MEMBERS) != 0); for (ICVSRemoteResource cvsResource : resources) { if ((includeFiles && ( ! cvsResource.isFolder())) || (includeFolders && (cvsResource.isFolder()))) { boolean isManaged = cvsResource.isManaged(); boolean isIgnored = cvsResource.isIgnored(); if ((isManaged && includeManaged)|| (isIgnored && includeIgnored) || ( ! isManaged && ! isIgnored && includeUnmanaged)) { result.add(cvsResource); } } } return result.toArray(new ICVSResource[result.size()]); }
Source:
<code>private void removeGlusterVolumesFromDb() { <START> List<GlusterVolumeEntity> volumes = getGlusterVolumeDao().getByClusterId(getVdsGroupId()); <END> if (volumes.size() > 0) { getGlusterVolumeDao().removeByClusterId(getVdsGroupId()); } }</code><technical_language>check for volumes count add value. execute query time, volumes. invoking removeByClusterId() query in cases. volumes, delete anything, succeed. work</technical_language>

Target:
private void removeGlusterVolumesFromDb() { getGlusterVolumeDao().removeByClusterId(getVdsGroupId()); }
Source:
<code>public List<User> call(ApiCaller ac, Deserializer parms) throws PerunException { if (parms.contains("attributeName")) { if (parms.contains("attributeValue")) { String attributeName = parms.readString("attributeName"); Attribute attr = new Attribute(ac.getAttributesManager().getAttributeDefinition(ac.getSession(), attributeName)); if(attr.getType().equals(Integer.class.getName())) { attr.setValue(parms.readInt("attributeValue")); <START> } else if(attr.getType().equals(String.class.getName()) || attr.getType().equals("java.lang.LargeString")) { <END> attr.setValue(parms.readString("attributeValue")); } else if(attr.getType().equals(Boolean.class.getName())) { attr.setValue(parms.readBoolean("attributeValue")); } else if(attr.getType().equals(ArrayList.class.getName()) || attr.getType().equals("java.util.LargeArrayList")) { attr.setValue(parms.readList("attributeValue", String.class)); } else if(attr.getType().equals(LinkedHashMap.class.getName())) { attr.setValue(parms.read("attributeValue", LinkedHashMap.class)); } else { throw new RpcException(RpcException.Type.CANNOT_DESERIALIZE_VALUE, "attributeValue is not the same type like value of attribute with the attributeName."); } return ac.getUsersManager().getUsersByAttribute(ac.getSession(),attr); } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "attributeValue"); } } else if (parms.contains("attribute")) { return ac.getUsersManager().getUsersByAttribute(ac.getSession(), parms.read("attribute", Attribute.class)); } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "attribute or (attributeName and attributeValue)"); } }</code><technical_language>I prefer constant there</technical_language>

Target:
public User call(ApiCaller ac, Deserializer parms) throws PerunException { return ac.getUsersManager().getUserByUserExtSource(ac.getSession(), parms.read("userExtSource", UserExtSource.class)); }
Source:
<code>public int read() throws IOException { <START> if (buf.position() < buf.limit()) <END> return buf.get(); else return -1; }</code><technical_language>Enclose blocks if ... { ... } else {</technical_language>

Target:
public int read() throws IOException { if (buf.position() < buf.limit()) { return buf.get(); } else { return -1; } }
Source:
<code><START> public void updateNotification() throws Exception { <END> for (int i = 1; i <= NO_OF_DEVICES; i++) { DeviceIdentifier testDeviceIdentifier = new DeviceIdentifier(DEVICE_ID_PREFIX + i, DEVICE_TYPE); Notification notification = TestDataHolder.getNotification(i, Notification.Status.CHECKED.toString(), testDeviceIdentifier.toString(), TEST_NOTIFICATION_DESCRIPTION, DEVICE_ID_PREFIX + i, NOTIFICATION_OPERATION_ID, DEVICE_TYPE); Assert.assertTrue(notificationManagementService.updateNotification(notification)); } }</code><technical_language>throwing generic exception? specific exception ? Please correct in other places</technical_language>

Target:
public void updateNotification() throws NotificationManagementException { for (int i = 1; i <= NO_OF_DEVICES; i++) { DeviceIdentifier testDeviceIdentifier = new DeviceIdentifier(DEVICE_ID_PREFIX + i, DEVICE_TYPE); Notification notification = TestDataHolder.getNotification(i, Notification.Status.CHECKED.toString(), testDeviceIdentifier.toString(), TEST_NOTIFICATION_DESCRIPTION, DEVICE_ID_PREFIX + i, NOTIFICATION_OPERATION_ID, DEVICE_TYPE); Assert.assertTrue(notificationManagementService.updateNotification(notification)); } }
Source:
<code>public static void fireRTCPFeedbackMessageReceived( Object source, byte[] buffer, int offset, int length, List<RTCPFeedbackMessageListener> listeners) { if ((length >= 12) && !listeners.isEmpty()) { <START> int pt = buffer[offset + 1] & 0xFFFF; <END> if ((pt == RTCPFeedbackMessageEvent.PT_PS) || (pt == RTCPFeedbackMessageEvent.PT_TL)) { int fmt = buffer[offset] & 0x1F; RTCPFeedbackMessageEvent ev = new RTCPFeedbackMessageEvent(source, fmt, pt); for (RTCPFeedbackMessageListener l : listeners) l.rtcpFeedbackMessageReceived(ev); } } }</code><technical_language>This & 0xFF</technical_language>

Target:
public static void fireRTCPFeedbackMessageReceived( Object source, byte[] buffer, int offset, int length, List<RTCPFeedbackMessageListener> listeners) { if ((length >= 12) && !listeners.isEmpty()) { int pt = buffer[offset + 1] & 0xFF; if ((pt == RTCPFeedbackMessageEvent.PT_PS) || (pt == RTCPFeedbackMessageEvent.PT_TL)) { int fmt = buffer[offset] & 0x1F; RTCPFeedbackMessageEvent ev = new RTCPFeedbackMessageEvent(source, fmt, pt); for (RTCPFeedbackMessageListener l : listeners) l.rtcpFeedbackMessageReceived(ev); } } }
Source:
<code>public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { OpenShiftServerBehaviour beh = OpenShiftServerUtils.getOpenShiftServerBehaviour(configuration); String currentMode = beh.getServer().getMode(); beh.setServerStarting(); launchServerProcess(beh, configuration, launch, monitor); try { if (waitForDeploymentConfigReady(beh.getServer(), monitor)) { DebugContext context = createDebugContext(beh, monitor); toggleDebugging(mode, beh, context, monitor); if (!isDebugMode(mode)) { enableDevMode(beh, context); } OpenShiftDebugMode.sendChanges(context, monitor); } } catch (Exception e) { mode = currentMode; <START> throw new CoreException(StatusFactory.errorStatus(OpenShiftNodejsActivator.PLUGIN_ID, <END> NLS.bind("Could not launch server {0}", beh.getServer().getName()), e)); } finally { setServerState(beh, mode, monitor); } }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Introduce a new variable instead of reusing parameter "mode". [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { OpenShiftServerBehaviour beh = OpenShiftServerUtils.getOpenShiftServerBehaviour(configuration); String currentMode = beh.getServer().getMode(); beh.setServerStarting(); launchServerProcess(beh, launch, monitor); try { if (waitForDeploymentConfigReady(beh.getServer(), monitor)) { DebugContext context = createDebugContext(beh, monitor); toggleDebugging(mode, beh, context, monitor); if (!isDebugMode(mode)) { enableDevMode(context); } OpenShiftDebugMode.sendChanges(context, monitor); } } catch (Exception e) { mode = currentMode; throw new CoreException(StatusFactory.errorStatus(OpenShiftNodejsActivator.PLUGIN_ID, NLS.bind("Could not launch server {0}", beh.getServer().getName()), e)); } finally { setServerState(beh, mode, monitor); } }
Source:
<code>private Set<SourceDescriptor> getFederatedSourceDescriptors( Collection<FederatedSource> sources, boolean addCatalogProviderDescriptor) { SourceDescriptorImpl sourceDescriptor; Set<SourceDescriptor> sourceDescriptors = new TreeSet<>(new SourceDescriptorComparator()); if (sources != null) { for (Source source : sources) { if (source != null) { String sourceId = source.getId(); LOGGER.debug("adding sourceId: {}", sourceId); <START> final Set<ContentType> cachedContentTypes; <END> final Optional<Set<ContentType>> contentTypesOptional = contentTypesCache.getCachedValueForSource(source); if (contentTypesOptional.isPresent()) { cachedContentTypes = contentTypesOptional.get(); } else { LOGGER.debug("Unknown ContentTypes for source id={}", sourceId); cachedContentTypes = Collections.emptySet(); } sourceDescriptor = new SourceDescriptorImpl( sourceId, cachedContentTypes, sourceActionRegistry.list(source)); sourceDescriptor.setVersion(source.getVersion()); sourceDescriptor.setAvailable(isSourceAvailable(source)); sourceDescriptors.add(sourceDescriptor); } } } if (addCatalogProviderDescriptor) { addCatalogSourceDescriptor(sourceDescriptors); } return sourceDescriptors; }</code><technical_language>this work instead? suggestion final Set<ContentType> cachedContentTypes = contentTypesCache.getCachedValueForSource(source) .orElseGet(() -> { LOGGER.debug("Unknown ContentTypes for source id={}", sourceId); return Collections.emptySet(); });</technical_language>

Target:
private Set<SourceDescriptor> getFederatedSourceDescriptors( Collection<FederatedSource> sources, boolean addCatalogProviderDescriptor) { SourceDescriptorImpl sourceDescriptor; Set<SourceDescriptor> sourceDescriptors = new TreeSet<>(new SourceDescriptorComparator()); if (sources != null) { for (Source source : sources) { if (source != null) { String sourceId = source.getId(); LOGGER.debug("adding sourceId: {}", sourceId); sourceDescriptor = new SourceDescriptorImpl( sourceId, contentTypesCache .getCachedValueForSource(source) .orElseGet( () -> { LOGGER.debug("Unknown content types for source id={}", source.getId()); return Collections.emptySet(); }), sourceActionRegistry.list(source)); sourceDescriptor.setVersion(source.getVersion()); sourceDescriptor.setAvailable(isSourceAvailable(source)); sourceDescriptors.add(sourceDescriptor); } } } if (addCatalogProviderDescriptor) { addCatalogSourceDescriptor(sourceDescriptors); } return sourceDescriptors; }
Source:
<code>public String toString() { <START> StringBuffer buffer = new StringBuffer(); <END> buffer.append("UniformChoice("); for (Object item : s) { buffer.append(item.toString() + ", "); } buffer.replace(buffer.length() - 2, buffer.length(), ""); buffer.append(")"); return buffer.toString(); }</code><technical_language>@chrisgioia64 Pls StringBuilder, is faster</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("UniformChoice("); for (Object item : s) { builder.append(item.toString() + ", "); } builder.replace(builder.length() - 2, builder.length(), ""); builder.append(")"); return builder.toString(); }
Source:
<code>private DataStore findDataStore(VirtualMachineProfile profile, DeployDestination dest) { DataStore dataStore = null; if (VirtualMachineManager.VmConfigDriveOnPrimaryPool.value()) { final List<VolumeVO> volumes = _volumeDao.findByInstanceAndType(profile.getVirtualMachine().getId(), Volume.Type.ROOT); <START> if (volumes != null && volumes.size() > 0) { <END> dataStore = _dataStoreMgr.getDataStore(volumes.get(0).getPoolId(), DataStoreRole.Primary); } } else { dataStore = _dataStoreMgr.getImageStore(dest.getDataCenter().getId()); } return dataStore; }</code><technical_language>(should?) CollectionUtils though</technical_language>

Target:
private DataStore findDataStore(VirtualMachineProfile profile, DeployDestination dest) { DataStore dataStore = null; if (VirtualMachineManager.VmConfigDriveOnPrimaryPool.value()) { if(MapUtils.isNotEmpty(dest.getStorageForDisks())) { dataStore = getPlannedDataStore(dest, dataStore); } if (dataStore == null) { dataStore = pickExistingRootVolumeFromDataStore(profile, dataStore); } } else { dataStore = _dataStoreMgr.getImageStore(dest.getDataCenter().getId()); } return dataStore; }
Source:
<code>private Map<String, CommentInfo[]> listDrafts(final PatchSet.Id id, IProgressMonitor monitor) throws GerritException { String uri = "/changes/" + id.getParentKey().get() + "/revisions/" + id.get() + "/drafts/"; TypeToken<Map<String, CommentInfo[]>> resultType = new TypeToken<Map<String, CommentInfo[]>>() { }; <START> return request(HttpMethod.GET, uri, null, resultType.getType(), null, monitor); <END> }</code><technical_language>This is readable 2 null parameters</technical_language>

Target:
private Map<String, CommentInfo[]> listDrafts(final PatchSet.Id id, IProgressMonitor monitor) throws GerritException { String uri = "/changes/" + id.getParentKey().get() + "/revisions/" + id.get() + "/drafts/"; TypeToken<Map<String, CommentInfo[]>> resultType = new TypeToken<Map<String, CommentInfo[]>>() { }; return request(client.new GetRequest<Map<String, CommentInfo[]>>(uri, resultType.getType(), null), monitor); }