auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void performCleanUp(SessionFactory sf) { log( "starting clean up phase" ); try ( Session s = sf.openSession() ) { final SessionImplementor session = (SessionImplementor) s; <START> FullTextSession fulltextSession = Search.getFullTextSession( sf.openSession() ); <END> beginTransaction( session ); s.createNativeQuery( "delete from book_author where book_id < :id" ).setParameter( "id", initialOffset ).executeUpdate(); s.createNativeQuery( "delete from book where id < :id" ).setParameter( "id", initialOffset ).executeUpdate(); s.createNativeQuery( "delete from author where id < :id" ).setParameter( "id", initialOffset ).executeUpdate(); fulltextSession.purgeAll( Book.class ); fulltextSession.flushToIndexes(); commitTransaction( session ); } }</code><technical_language>Is intentional open a session here</technical_language>

Target:
protected void performCleanUp(SessionFactory sf) { log( "starting clean up phase" ); try ( Session s = sf.openSession() ) { final SessionImplementor session = (SessionImplementor) s; FullTextSession fulltextSession = Search.getFullTextSession( s ); beginTransaction( session ); s.createNativeQuery( "delete from book_author where book_id < :id" ).setParameter( "id", initialOffset ).executeUpdate(); s.createNativeQuery( "delete from book where id < :id" ).setParameter( "id", initialOffset ).executeUpdate(); s.createNativeQuery( "delete from author where id < :id" ).setParameter( "id", initialOffset ).executeUpdate(); fulltextSession.purgeAll( Book.class ); fulltextSession.flushToIndexes(); commitTransaction( session ); } }
Source:
<code>public double priceFromCurves(ResolvedBill bill, LegalEntityDiscountingProvider provider, LocalDate settlementDate) { ArgChecker.isTrue(settlementDate.isBefore(bill.getNotional().getDate()), "settlement date must be before maturity date"); ArgChecker.isTrue(!settlementDate.isBefore(provider.getValuationDate()), "settlement date must be on or after valuation date"); IssuerCurveDiscountFactors discountFactors = provider.issuerCurveDiscountFactors( bill.getLegalEntityId(), bill.getCurrency()); double dfMaturity = discountFactors.discountFactor(bill.getNotional().getDate()); RepoCurveDiscountFactors discountFactorsRepo = provider.repoCurveDiscountFactors(bill.getSecurityId(), bill.getLegalEntityId(), bill.getCurrency()); double dfRepoSettle = discountFactorsRepo.discountFactor(settlementDate); double price = dfMaturity / dfRepoSettle; <START> return price; <END> }</code><technical_language>return calculation - need for price local variable</technical_language>

Target:
public double priceFromCurves(ResolvedBill bill, LegalEntityDiscountingProvider provider, LocalDate settlementDate) { ArgChecker.inOrderNotEqual(settlementDate, bill.getNotional().getDate(), "settlementDate", "endDate"); ArgChecker.inOrderOrEqual(provider.getValuationDate(), settlementDate, "valuationDate", "settlementDate"); IssuerCurveDiscountFactors discountFactors = provider.issuerCurveDiscountFactors( bill.getLegalEntityId(), bill.getCurrency()); double dfMaturity = discountFactors.discountFactor(bill.getNotional().getDate()); RepoCurveDiscountFactors discountFactorsRepo = provider.repoCurveDiscountFactors(bill.getSecurityId(), bill.getLegalEntityId(), bill.getCurrency()); double dfRepoSettle = discountFactorsRepo.discountFactor(settlementDate); return dfMaturity / dfRepoSettle; }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { boolean doFilter = true; try { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); InitialContext ctx = null; if (engineSession != null) { ctx = new InitialContext(); try { <START> VdcQueryParametersBase parameters = new VdcQueryParametersBase(engineSession); <END> VdcQueryReturnValue returnValue = FiltersHelper.getBackend(ctx) .runPublicQuery(VdcQueryType.ValidateSession, parameters); if (!returnValue.getSucceeded()) { httpSession.removeAttribute(FiltersHelper.Constants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); } else { request.setAttribute(FiltersHelper.Constants.REQUEST_USER_KEY, returnValue.getReturnValue()); } } finally { ctx.close(); } } } } catch (Exception ex) { doFilter = false; String msg = String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage()); log.error(msg); if (log.isDebugEnabled()) { log.debug("", ex); } ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (doFilter) { chain.doFilter(request, response); } }</code><technical_language>drop this temp variable</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { boolean doFilter = false; try { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); InitialContext ctx = null; if (engineSession != null) { ctx = new InitialContext(); try { VdcQueryReturnValue returnValue = FiltersHelper.getBackend(ctx) .runPublicQuery(VdcQueryType.ValidateSession, new VdcQueryParametersBase(engineSession)); if (!returnValue.getSucceeded()) { httpSession.invalidate(); } } finally { ctx.close(); } } } doFilter = true; } catch (Exception ex) { doFilter = false; String msg = String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage()); log.error(msg); if (log.isDebugEnabled()) { log.debug("", ex); } ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (doFilter) { chain.doFilter(request, response); } }
Source:
<code>public void createDirectory(final Path dir, <START> final FileAttribute<?>... attrs) { <END> checkNotNull("dir", dir); final Path realDir = dir.toAbsolutePath(); checkFileExistsThenThrow(realDir); realDir.toFile().mkdirs(); }</code><technical_language>this is removed</technical_language>

Target:
public void createDirectory(final Path dir, final FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("dir", dir); final Path realDir = dir.toAbsolutePath(); checkFileExistsThenThrow(realDir); realDir.toFile().mkdirs(); }
Source:
<code>private List<Change> submitWholeTopic(RevisionResource rsrc, IdentifiedUser caller, boolean force, String topic) throws ResourceConflictException, OrmException, IOException { Preconditions.checkNotNull(topic); final Timestamp timestamp = TimeUtil.nowTs(); ReviewDb db = dbProvider.get(); ChangeData cd = changeDataFactory.create(db, rsrc.getControl()); List<ChangeData> changesByTopic = queryProvider.get().byTopicOpen(topic); String problems = problemsForSubmittingChanges(changesByTopic, caller); if (problems != null) { throw new ResourceConflictException(problems); } Change change = rsrc.getChange(); ChangeUpdate update = updateFactory.create(rsrc.getControl(), timestamp); List<SubmitRecord> submitRecords = checkSubmitRule(cd, rsrc.getPatchSet(), force); update.submit(submitRecords); db.changes().beginTransaction(change.getId()); try { BatchMetaDataUpdate batch = approve(rsrc, update, caller, timestamp); batch.write(update, new CommitBuilder()); for (ChangeData c : changesByTopic) { submitToDatabase(db, c.getId(), timestamp); } db.commit(); <START> } catch (ResourceConflictException e) { <END> throw e; } finally { db.rollback(); } List<Change.Id> ids = new ArrayList<>(changesByTopic.size()); List<Change> ret = new ArrayList<>(changesByTopic.size()); for (ChangeData c : changesByTopic) { ids.add(c.getId()); ret.add(c.change()); } indexer.indexAsync(ids).checkedGet(); return ret; }</code><technical_language>effect</technical_language>

Target:
private List<Change> submitWholeTopic(RevisionResource rsrc, IdentifiedUser caller, boolean force, String topic) throws ResourceConflictException, OrmException, IOException { Preconditions.checkNotNull(topic); final Timestamp timestamp = TimeUtil.nowTs(); ReviewDb db = dbProvider.get(); ChangeData cd = changeDataFactory.create(db, rsrc.getControl()); List<ChangeData> changesByTopic = queryProvider.get().byTopicOpen(topic); String problems = problemsForSubmittingChanges(changesByTopic, caller); if (problems != null) { throw new ResourceConflictException(problems); } Change change = rsrc.getChange(); ChangeUpdate update = updateFactory.create(rsrc.getControl(), timestamp); List<SubmitRecord> submitRecords = checkSubmitRule(cd, rsrc.getPatchSet(), force); update.submit(submitRecords); db.changes().beginTransaction(change.getId()); try { BatchMetaDataUpdate batch = approve(rsrc, update, caller, timestamp); batch.write(update, new CommitBuilder()); for (ChangeData c : changesByTopic) { submitToDatabase(db, c.getId(), timestamp); } db.commit(); } finally { db.rollback(); } List<Change.Id> ids = new ArrayList<>(changesByTopic.size()); List<Change> ret = new ArrayList<>(changesByTopic.size()); for (ChangeData c : changesByTopic) { ids.add(c.getId()); ret.add(c.change()); } indexer.indexAsync(ids).checkedGet(); return ret; }
Source:
<code>public boolean removeAcl(OzoneObj obj, OzoneAcl acl) throws IOException { validateOzoneObj(obj); String prefixPath = obj.getPath(); metadataManager.getLock().acquirePrefixLock(prefixPath); try { OmPrefixInfo prefixInfo = metadataManager.getPrefixTable().get(prefixPath); List<OzoneAcl> list = null; if (prefixInfo != null) { list = prefixInfo.getAcls(); } if (list == null || !list.contains(acl)) { <START> LOG.debug("acl does not exist for prefixpath {}", acl, prefixPath); <END> return true; } list.remove(acl); OmPrefixInfo.Builder upiBuilder = OmPrefixInfo.newBuilder(); upiBuilder.setName(prefixPath).setAcls(list); if (prefixInfo != null && prefixInfo.getMetadata() != null) { upiBuilder.addAllMetadata(prefixInfo.getMetadata()); } prefixInfo = upiBuilder.build(); metadataManager.getPrefixTable().put(prefixPath, prefixInfo); prefixTree.insert(prefixPath, prefixInfo); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Remove prefix acl operation failed for prefix path:{}" + " acl:{}", prefixPath, acl, ex); } throw ex; } finally { metadataManager.getLock().releasePrefixLock(prefixPath); } return true; }</code><technical_language>list.contains(acl) return false acl type acl name is acl right bits different. In this case need manually set acl bit 0</technical_language>

Target:
public boolean removeAcl(OzoneObj obj, OzoneAcl acl) throws IOException { validateOzoneObj(obj); String prefixPath = obj.getPath(); metadataManager.getLock().acquirePrefixLock(prefixPath); try { OmPrefixInfo prefixInfo = metadataManager.getPrefixTable().get(prefixPath); List<OzoneAcl> list = null; if (prefixInfo != null) { list = prefixInfo.getAcls(); } if (list == null) { LOG.debug("acl does not exist for prefix path {}", acl, prefixPath); return false; } boolean found = false; for (OzoneAcl a: list) { if (a.getName().equals(acl.getName()) && a.getType() == acl.getType()) { found = true; a.getAclBitSet().andNot(acl.getAclBitSet()); if (a.getAclBitSet().isEmpty()) { list.remove(a); } break; } } if (!found) { LOG.debug("acl does not exist for prefix path {}", acl, prefixPath); return false; } if (!list.isEmpty()) { OmPrefixInfo.Builder upiBuilder = OmPrefixInfo.newBuilder(); upiBuilder.setName(prefixPath).setAcls(list); if (prefixInfo != null && prefixInfo.getMetadata() != null) { upiBuilder.addAllMetadata(prefixInfo.getMetadata()); } prefixInfo = upiBuilder.build(); metadataManager.getPrefixTable().put(prefixPath, prefixInfo); prefixTree.insert(prefixPath, prefixInfo); } else { metadataManager.getPrefixTable().delete(prefixPath); prefixTree.removePrefixPath(prefixPath); } } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Remove prefix acl operation failed for prefix path:{}" + " acl:{}", prefixPath, acl, ex); } throw ex; } finally { metadataManager.getLock().releasePrefixLock(prefixPath); } return true; }
Source:
<code>public static TruthState getHom(final int alleleIdx) { if (alleleIdx == 0) return HOM_REF; if (alleleIdx == 1) return HOM_VAR1; <START> ValidationUtils.validateArg(false,"Shouldn't be here."); <END> return null; }</code><technical_language>In this case, throw new PicardException("Invalid allele index: " + alleleIdx);? This a proper of validateArg()</technical_language>

Target:
public static TruthState getHom(final int alleleIdx) { if (alleleIdx == 0) return HOM_REF; if (alleleIdx == 1) return HOM_VAR1; throw new IllegalStateException("Shouldn't be here."); }
Source:
<code>public Mono<UpdateNumberCapabilitiesResponse> updateCapabilities( Map<PhoneNumber, NumberUpdateCapabilities> phoneNumberCapabilitiesUpdate) { Map<String, NumberUpdateCapabilities> capabilitiesMap = new HashMap<>(); <START> for (Map.Entry<PhoneNumber, NumberUpdateCapabilities> entry : phoneNumberCapabilitiesUpdate.entrySet()) { <END> capabilitiesMap.put(entry.getKey().getValue(), entry.getValue()); } UpdateNumberCapabilitiesRequest updateNumberCapabilitiesRequest = new UpdateNumberCapabilitiesRequest(); updateNumberCapabilitiesRequest.setPhoneNumberCapabilitiesUpdate(capabilitiesMap); return phoneNumberAdminClient.getPhoneNumberAdministrations() .updateCapabilitiesAsync(updateNumberCapabilitiesRequest); }</code><technical_language>Add null checks user-input (phoneNumberCapabilitiesUpdate) provide helpful error message. Do for other methods too. Objects.requireNonNull(phoneNumberCapabilitiesUpdate, "'phoneNumberCapabilitiesUpdate' null");</technical_language>

Target:
public Mono<UpdateNumberCapabilitiesResponse> updateCapabilities( Map<PhoneNumber, NumberUpdateCapabilities> phoneNumberCapabilitiesUpdate) { Map<String, NumberUpdateCapabilities> capabilitiesMap = new HashMap<>(); for (Map.Entry<PhoneNumber, NumberUpdateCapabilities> entry : phoneNumberCapabilitiesUpdate.entrySet()) { capabilitiesMap.put(entry.getKey().getValue(), entry.getValue()); } UpdateNumberCapabilitiesRequest updateNumberCapabilitiesRequest = new UpdateNumberCapabilitiesRequest(); updateNumberCapabilitiesRequest.setPhoneNumberCapabilitiesUpdate(capabilitiesMap); return phoneNumberAdministrations.updateCapabilitiesAsync(updateNumberCapabilitiesRequest); }
Source:
<code>public Instant getDeletedAt() { if (this.deletedAt == null) { return null; } else { <START> return TimeHelper.convertDateToInstant(this.deletedAt); <END> } }</code><technical_language>Early return</technical_language>

Target:
public Instant getDeletedAt() { return TimeHelper.convertDateToInstant(deletedAt); }
Source:
<code>public ImageResource getValue(T item) { <START> String osTypeName = AsyncDataProvider.getOsName(extractor.extractOsType(item)); <END> ResourcePrototype resource = getApplicationResourcesWithLookup().getResource(osTypeName + "SmallImage"); if (resource == null || !(resource instanceof ImageResource)) { resource = getApplicationResourcesWithLookup().UnassignedSmallImage(); } return (ImageResource) resource; }</code><technical_language>in patchset6 - path image is correct here</technical_language>

Target:
public ImageResource getValue(T item) { String osTypeName = AsyncDataProvider.getOsUniqueOsNames().get(extractor.extractOsType(item)); ResourcePrototype resource = getApplicationResourcesWithLookup().getResource(osTypeName + "SmallImage"); if (resource == null || !(resource instanceof ImageResource)) { resource = getApplicationResourcesWithLookup().UnassignedSmallImage(); } return (ImageResource) resource; }
Source:
<code>public Map<String, Object> getVariableValues(GraphQLSchema schema, List<VariableDefinition> variableDefinitions, Map<String, Object> inputs) { Map<String, Object> result = new LinkedHashMap<String, Object>(); for (VariableDefinition variableDefinition : variableDefinitions) { Object variableValue = getVariableValue(schema, variableDefinition, inputs.get(variableDefinition.getName())); if (variableValue != null) { result.put(variableDefinition.getName(), variableValue); <START> } <END> } return result; }</code><technical_language>I wondering compatibility implications here. I imagine any, I imagine :). Related question: want this this works? I mean, this method returns resulting Map, client get()s Map. PR, get null for missing keys. Right</technical_language>

Target:
public Map<String, Object> getVariableValues(GraphQLSchema schema, List<VariableDefinition> variableDefinitions, Map<String, Object> inputs) { final Map<String, Object> result = new LinkedHashMap<String, Object>(); for (VariableDefinition variableDefinition : variableDefinitions) { final String name = variableDefinition.getName(); if (inputs.containsKey(name)) { Object variableValue = getVariableValue(schema, variableDefinition, inputs.get(variableDefinition.getName())); result.put(name, variableValue); } } return result; }
Source:
<code>public boolean isActive(FeatureState featureState, FeatureUser user) { HttpServletRequest request = HttpServletRequestHolder.get(); if (request != null) { List<String> parts = Strings.splitAndTrim(featureState.getParameter(PARAM_IPS), "[\\s,]+"); List<InetAddress> ips = new ArrayList<>(); List<CIDRUtils> cidrUtils = new ArrayList<>(); for (String part : parts) { try { if (part.contains("/")) { cidrUtils.add(new CIDRUtils(part)); } else { ips.add(InetAddress.getByName(part)); } } catch (Exception e) { <START> log.warn("Ignoring illegal IP address or CIDR range " + part); <END> } } try { if (ips.contains(InetAddress.getByName(request.getRemoteAddr()))) { return true; } for (CIDRUtils cidrUtil : cidrUtils) { if (cidrUtil.isInRange(request.getRemoteAddr())) { return true; } } } catch (UnknownHostException e) { log.error("Illegal address " + request.getRemoteAddr()); } } return false; }</code><technical_language>catch UnknownHostException instead of Exception here. ParameterBuilder create a validation rule for parameter values. builder supports this regular expressions. provider Parameter implementation provides custom validation code. ScriptEngineActivationStrategy for example. This catch invalid strategy parameters saved</technical_language>

Target:
public boolean isActive(FeatureState featureState, FeatureUser user) { HttpServletRequest request = HttpServletRequestHolder.get(); if (request != null) { List<String> parts = Strings.splitAndTrim(featureState.getParameter(PARAM_IPS), "[\\s,]+"); try { String remoteAddr = request.getRemoteAddr(); InetAddress remoteInetAddress = InetAddress.getByName(remoteAddr); for (String part : parts) { if (part.equals(remoteAddr)) { return true; } if (part.contains("/")) { CIDRUtils cidrUtil = new CIDRUtils(part); if (cidrUtil.isInRange(remoteInetAddress)) { return true; } } else if (remoteInetAddress.equals(InetAddress.getByName(part))) { return true; } } } catch (UnknownHostException | IllegalArgumentException e) { log.warn("Ignoring illegal IP address or CIDR range "); } } return false; }
Source:
<code>public TeamInviteToken inviteMember(Long teamId, String username) { User user = userService.getUserByUsername(username).orElseThrow(() -> new UsernameNotFoundException(username)); Team team = getTeamById(teamId); if (team.getMembers().contains(user)) { throw new IllegalArgumentException("User is already a member of this team"); } <START> boolean userAlreadyInvited = teamInviteTokenRepository.findByUserUsername(username).stream() <END> .filter(token -> token.getTeam().equals(team)) .noneMatch(TeamInviteToken::isValid); if (userAlreadyInvited) { String token = UUID.randomUUID().toString(); TeamInviteToken inviteToken = new TeamInviteToken(token, user, team); teamInviteTokenRepository.save(inviteToken); try { mailService.sendTeamInviteMail(user, team.getTeamName(), team.getCaptain()); } catch (MessagingException e) { e.printStackTrace(); } return inviteToken; } else { throw new IllegalArgumentException("User already invited"); } }</code><technical_language>I extract this logic (as some other logic in this method) in seperate methods. This entire method is 30 lines long. In opinion long. This provide code readability code reusability</technical_language>

Target:
public TeamInviteToken inviteMember(Long teamId, String username) { User user = userService.getUserByUsername(username).orElseThrow(() -> new UsernameNotFoundException(username)); Team team = getTeamById(teamId); if (team.getMembers().contains(user)) { throw new IllegalArgumentException("User is already a member of this team"); } if (isUserAlreadyInvited(username, team)) { TeamInviteToken inviteToken = new TeamInviteToken(user, team); teamInviteTokenRepository.save(inviteToken); try { mailService.sendTeamInviteMail(user, team.getTeamName(), team.getCaptain()); } catch (MessagingException e) { e.printStackTrace(); } return inviteToken; } else { throw new IllegalArgumentException("User already invited"); } }
Source:
<code>public void inputChanged(@Nullable Viewer viewer, @Nullable Object oldInput, @Nullable Object newInput) { fTableViewer = (TableViewer) viewer; if (newInput instanceof ISegmentStore<?>) { ISegmentStore<?> segmentStore = (ISegmentStore<?>) newInput; <START> fSegmentArray = Iterables.toArray(segmentStore, ISegment.class); <END> if (fComparator != null){ Arrays.sort(fSegmentArray, fComparator); } } }</code><technical_language>Note this array bound Integer.MAX_VALUE. crash, sure</technical_language>

Target:
public void inputChanged(@Nullable Viewer viewer, @Nullable Object oldInput, @Nullable Object newInput) { fTableViewer = (TableViewer) viewer; if (newInput instanceof ISegmentStore<?>) { ISegmentStore<?> segmentStore = (ISegmentStore<?>) newInput; fSegmentArray = Iterables.toArray(segmentStore, ISegment.class); if (fComparator != null) { Arrays.sort(fSegmentArray, fComparator); } } else { fSegmentArray = null; } }
Source:
<code>private Map<String, MessageAttributeValue> translateAttributes(Map<String, Object> headers, Exchange exchange) { HashMap result = new HashMap(); HeaderFilterStrategy headerFilterStrategy = this.getEndpoint().getHeaderFilterStrategy(); <START> Iterator var5 = headers.entrySet().iterator(); <END> while (var5.hasNext()) { Entry entry = (Entry) var5.next(); if (!headerFilterStrategy.applyFilterToCamelHeaders((String) entry.getKey(), entry.getValue(), exchange)) { Object value = entry.getValue(); MessageAttributeValue mav; if (value instanceof String) { mav = new MessageAttributeValue(); mav.setDataType("String"); mav.withStringValue((String) value); result.put(entry.getKey(), mav); } else if (value instanceof ByteBuffer) { mav = new MessageAttributeValue(); mav.setDataType("Binary"); mav.withBinaryValue((ByteBuffer) value); result.put(entry.getKey(), mav); } else { LOG.warn("Cannot put the message header key={}, value={} into Sqs MessageAttribute", entry.getKey(), entry.getValue()); } } } return result; }</code><technical_language>rename var5 name</technical_language>

Target:
private Map<String, MessageAttributeValue> translateAttributes(Map<String, Object> headers, Exchange exchange) { Map<String, MessageAttributeValue> result = new HashMap<String, MessageAttributeValue>(); HeaderFilterStrategy headerFilterStrategy = getEndpoint().getHeaderFilterStrategy(); for (Entry<String, Object> entry : headers.entrySet()) { if (!headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), exchange)) { Object value = entry.getValue(); if (value instanceof String) { MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("String"); mav.withStringValue((String)value); result.put(entry.getKey(), mav); } else if (value instanceof ByteBuffer) { MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("Binary"); mav.withBinaryValue((ByteBuffer)value); result.put(entry.getKey(), mav); } else { LOG.warn("Cannot put the message header key={}, value={} into Sns MessageAttribute", entry.getKey(), entry.getValue()); } } } return result; }
Source:
<code>public void compute(LocalDate date, U entity) throws Exception { LocalDate lowerLimit = date.minusDays(observationPeriodDays); eventRecorder.getDatabase() .createQuery("SELECT COUNT(DISTINCT eventDate) AS numberOfDays" + " FROM useractivityevent" + " WHERE userData_userId = ${userId}" + " AND eventDate > ${lowerLimit}" + " AND eventDate <= ${upperLimit}") .set("userId", entity.getUniqueName()) .set("lowerLimit", lowerLimit) .set("upperLimit", date) .first() <START> .ifPresent(row -> { <END> int numberOfActiveDays = row.getValue("numberOfDays").asInt(0); int activityRateInPercent = numberOfActiveDays * 100 / observationPeriodDays; metrics.updateMonthlyMetric(entity, METRIC_USER_ACTIVITY, date, activityRateInPercent); if (date.getMonthValue() == LocalDate.now().getMonthValue()) { entity.getPerformanceData() .modify() .set(getActiveUserFlag(), numberOfActiveDays >= minDaysForActiveUsers) .set(getFrequentUserFlag(), numberOfActiveDays >= minDaysForFrequentUsers) .commit(); } }); }</code><technical_language>flatMap(row -> row.getValue("numberOfDays")).asOptionalInt()).orElse(0);</technical_language>

Target:
public void compute(LocalDate date, U entity) throws Exception { LocalDate lowerLimit = date.minusDays(observationPeriodDays); int numberOfActiveDays = eventRecorder.getDatabase() .createQuery("SELECT COUNT(DISTINCT eventDate) AS numberOfDays" + " FROM useractivityevent" + " WHERE userData_userId = ${userId}" + " AND eventDate > ${lowerLimit}" + " AND eventDate <= ${upperLimit}") .set("userId", entity.getUniqueName()) .set("lowerLimit", lowerLimit) .set("upperLimit", date) .first() .flatMap(row -> row.getValue("numberOfDays").asOptionalInt()) .orElse(0); int activityRateInPercent = numberOfActiveDays * 100 / observationPeriodDays; metrics.updateMonthlyMetric(entity, METRIC_USER_ACTIVITY, date, activityRateInPercent); if (date.getMonthValue() == LocalDate.now().getMonthValue()) { entity.getPerformanceData() .modify() .set(getActiveUserFlag(), numberOfActiveDays >= minDaysForActiveUsers) .set(getFrequentUserFlag(), numberOfActiveDays >= minDaysForFrequentUsers) .commit(); } }
Source:
<code>public void setUp() throws IOException { Configuration config = Configuration.getInstance(); config.init(); config.setProperty(CoreConfig.ZOOKEEPER_CLUSTER, "NONE"); config.setProperty(CoreConfig.INGEST_MODE, "false"); config.setProperty(CoreConfig.ROLLUP_MODE, "false"); config.setProperty(CoreConfig.QUERY_MODE, "false"); <START> BluefloodServiceStarter.SkipInstantiateRestartGauge = true; <END> }</code><technical_language>is this work if multiple test classes this run in parallel</technical_language>

Target:
public void setUp() throws IOException { Configuration config = Configuration.getInstance(); config.init(); config.setProperty(CoreConfig.ZOOKEEPER_CLUSTER, "NONE"); config.setProperty(CoreConfig.INGEST_MODE, "false"); config.setProperty(CoreConfig.ROLLUP_MODE, "false"); config.setProperty(CoreConfig.QUERY_MODE, "false"); BluefloodServiceStarter.shouldInstantiateRestartGauge = false; }
Source:
<code>public PlotFrame(final Composite comp, final int style) { super(comp, style, null, ChartComposite.DEFAULT_WIDTH, ChartComposite.DEFAULT_HEIGHT, 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE, ChartComposite.DEFAULT_BUFFER_USED, true, true, true, true, true); addSWTListener(new PlotKeyListener()); addMouseWheelListener(new PlotMouseWheelListener()); addSWTListener(new PlotMouseMoveListener()); setZoomInFactor(0.75); setZoomOutFactor(1.25); <START> toolTip = new DefaultToolTip(this, SWT.BALLOON, false); <END> toolTip.setBackgroundColor(new Color(comp.getDisplay(), 255, 255, 255)); toolTip.setForegroundColor(new Color(comp.getDisplay(), 128, 128, 128)); toolTip.setRespectDisplayBounds(true); toolTip.setShift(new Point(0, -50)); toolTip.setHideDelay(0); toolTip.setHideOnMouseDown(false); toolTip.setPopupDelay(0); }</code><technical_language>false -> true >manualActivation - true if activation is done manually show(Point)</technical_language>

Target:
public PlotFrame(final Composite comp, final int style) { super(comp, style, null, ChartComposite.DEFAULT_WIDTH, ChartComposite.DEFAULT_HEIGHT, 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE, ChartComposite.DEFAULT_BUFFER_USED, true, true, true, true, true); addSWTListener(new PlotKeyListener()); addMouseWheelListener(new PlotMouseWheelListener()); addSWTListener(new PlotMouseMoveListener()); setZoomInFactor(0.75); setZoomOutFactor(1.25); toolTip = new ExtendedToolTip(this, org.eclipse.swt.SWT.BALLOON, false); toolTip.setBackgroundColor(new Color(comp.getDisplay(), 255, 255, 255)); toolTip.setForegroundColor(new Color(comp.getDisplay(), 128, 128, 128)); toolTip.setRespectDisplayBounds(false); toolTip.setShift(new Point(0, -50)); toolTip.setHideDelay(0); toolTip.setHideOnMouseDown(false); toolTip.setPopupDelay(0); }
Source:
<code>private static Properties stringAsProperties(String stringProperties) { if(stringProperties == null) { return null; } Properties properties = new Properties(); <START> String[] property = stringProperties.split("'"); <END> for(String p : property) { String[] kv = p.split(">"); if(kv.length == 1) { properties.put(kv[0], ""); } else { properties.put(kv[0], kv[1]); } } return properties; }</code><technical_language>I need a stronger separator that. If contains a ' in trouble</technical_language>

Target:
private static Properties stringAsProperties(String stringProperties) { if(stringProperties == null) { return null; } Properties properties = new Properties(); String[] property = stringProperties.split("<'>"); for(String p : property) { String[] kv = p.split("<>"); if(kv.length == 1) { properties.put(kv[0], ""); } else { properties.put(kv[0], kv[1]); } } return properties; }
Source:
<code>public int compareTo(BlockLocation o) { <START> return (new Long(offset)).compareTo(o.getOffset()); <END> }</code><technical_language>creating a new Long here? I a cast suffice</technical_language>

Target:
public int compareTo(BlockLocation o) { return ((Long) (offset)).compareTo(o.getOffset()); }
Source:
<code>public void setupJob(JobContext context) throws IOException { if (algorithmVersion == 2) { Logger log = LoggerFactory.getLogger( "org.apache.hadoop.mapreduce.lib.output." + "FileOutputCommitter.Algorithm"); <START> log.warn("The v2 commit algorithm is deprecated;" + " please switch to the v1 algorithm"); <END> } if (hasOutputPath()) { Path jobAttemptPath = getJobAttemptPath(context); FileSystem fs = jobAttemptPath.getFileSystem( context.getConfiguration()); if (!fs.mkdirs(jobAttemptPath)) { LOG.error("Mkdirs failed to create " + jobAttemptPath); } } else { LOG.warn("Output Path is null in setupJob()"); } }</code><technical_language>I word deprecated. implies this algorithm removed in a future release</technical_language>

Target:
public void setupJob(JobContext context) throws IOException { if (algorithmVersion == 2) { Logger log = LoggerFactory.getLogger( "org.apache.hadoop.mapreduce.lib.output." + "FileOutputCommitter.Algorithm"); log.warn("The v2 commit algorithm assumes that the content of generated output files is" + " consistent across all task attempts" + " -if this is not true for this job, switch to the v1 commit algorithm." + " See MAPREDUCE-7282"); } if (hasOutputPath()) { Path jobAttemptPath = getJobAttemptPath(context); FileSystem fs = jobAttemptPath.getFileSystem( context.getConfiguration()); if (!fs.mkdirs(jobAttemptPath)) { LOG.error("Mkdirs failed to create " + jobAttemptPath); } } else { LOG.warn("Output Path is null in setupJob()"); } }
Source:
<code>public boolean isCellEditable(int column) { <START> return getColumnClass(column).equals(ParseTreeTableModel.class); <END> }</code><technical_language>dead weird code. do "return false", recheck GUI works fine</technical_language>

Target:
public boolean isCellEditable(int column) { return false; }
Source:
<code>public void requireSystemDuringStart() throws Exception { r.jenkins.setSecurityRealm(r.createDummySecurityRealm()); r.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy()); String pluginShortName = "require-system-during-load"; dynamicLoad(pluginShortName + ".hpi"); <START> try (ACLContext context = ACL.as(User.getOrCreateByIdOrFullName("underprivileged").impersonate())) { <END> r.jenkins.pluginManager.start(Collections.singletonList(r.jenkins.pluginManager.getPlugin(pluginShortName))); } }</code><technical_language>suggestion try (ACLContext context = ACL.as(User.getById("underprivileged", true).impersonate())) {</technical_language>

Target:
public void requireSystemDuringStart() throws Exception { r.jenkins.setSecurityRealm(r.createDummySecurityRealm()); r.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy()); String pluginShortName = "require-system-during-load"; dynamicLoad(pluginShortName + ".hpi"); try (ACLContext context = ACL.as(User.getById("underprivileged", true).impersonate())) { r.jenkins.pluginManager.start(Collections.singletonList(r.jenkins.pluginManager.getPlugin(pluginShortName))); } }
Source:
<code>public EditorTab(Editor editor, SketchFile file, String contents) throws IOException { super(new BorderLayout()); if (contents == null) { contents = file.load(); modified = false; } else { modified = true; } this.editor = editor; this.file = file; RSyntaxDocument document = createDocument(contents); textarea = createTextArea(document); scrollPane = createScrollPane(textarea); file.setStorage(this); applyPreferences(); add(scrollPane, BorderLayout.CENTER); <START> textarea.setupAutoComplete(file.getSketch(), new FakeCompletionProvider()); <END> }</code><technical_language>inline this call remove setupAutoComplete SketchTextArea? useful a SketchCompletionProvider reference in SketchTextArea. editor.getSketch() instead of file.getSketch() remove getSketch() method FileSketch</technical_language>

Target:
public EditorTab(Editor editor, SketchFile file, String contents) throws IOException { super(new BorderLayout()); if (contents == null) { contents = file.load(); modified = false; } else { modified = true; } this.editor = editor; this.file = file; RSyntaxDocument document = createDocument(contents); textarea = createTextArea(document); scrollPane = createScrollPane(textarea); file.setStorage(this); applyPreferences(); add(scrollPane, BorderLayout.CENTER); }
Source:
<code>void executePopOps(boolean moveToState) { for (int opNum = mOps.size() - 1; opNum >= 0; opNum--) { final Op op = mOps.get(opNum); Fragment f = op.mFragment; if (f != null) { f.setNextTransition(FragmentManager.reverseTransit(mTransition)); } switch (op.mCmd) { case OP_ADD: f.setNextAnim(op.mPopExitAnim); <START> mManager.setExitAnimationOrder(f, true); <END> mManager.removeFragment(f); break; case OP_REMOVE: f.setNextAnim(op.mPopEnterAnim); mManager.addFragment(f); break; case OP_HIDE: f.setNextAnim(op.mPopEnterAnim); mManager.showFragment(f); break; case OP_SHOW: f.setNextAnim(op.mPopExitAnim); mManager.hideFragment(f); break; case OP_DETACH: f.setNextAnim(op.mPopEnterAnim); mManager.attachFragment(f); break; case OP_ATTACH: f.setNextAnim(op.mPopExitAnim); mManager.detachFragment(f); break; case OP_SET_PRIMARY_NAV: mManager.setPrimaryNavigationFragment(null); break; case OP_UNSET_PRIMARY_NAV: mManager.setPrimaryNavigationFragment(f); break; case OP_SET_MAX_LIFECYCLE: mManager.setMaxLifecycle(f, op.mOldMaxState); break; default: throw new IllegalArgumentException("Unknown cmd: " + op.mCmd); } if (!mReorderingAllowed && op.mCmd != OP_REMOVE && f != null) { mManager.moveFragmentToExpectedState(f); } } if (!mReorderingAllowed && moveToState) { mManager.moveToState(mManager.mCurState, true); } }</code><technical_language>done OP_REMOVE, OP_HIDE, OP_SHOW, etc</technical_language>

Target:
void executePopOps(boolean moveToState) { for (int opNum = mOps.size() - 1; opNum >= 0; opNum--) { final Op op = mOps.get(opNum); Fragment f = op.mFragment; if (f != null) { f.setNextTransition(FragmentManager.reverseTransit(mTransition)); } switch (op.mCmd) { case OP_ADD: f.setNextAnim(op.mPopExitAnim); mManager.setExitAnimationOrder(f, true); mManager.removeFragment(f); break; case OP_REMOVE: f.setNextAnim(op.mPopEnterAnim); mManager.addFragment(f); break; case OP_HIDE: f.setNextAnim(op.mPopEnterAnim); mManager.showFragment(f); break; case OP_SHOW: f.setNextAnim(op.mPopExitAnim); mManager.setExitAnimationOrder(f, true); mManager.hideFragment(f); break; case OP_DETACH: f.setNextAnim(op.mPopEnterAnim); mManager.attachFragment(f); break; case OP_ATTACH: f.setNextAnim(op.mPopExitAnim); mManager.setExitAnimationOrder(f, true); mManager.detachFragment(f); break; case OP_SET_PRIMARY_NAV: mManager.setPrimaryNavigationFragment(null); break; case OP_UNSET_PRIMARY_NAV: mManager.setPrimaryNavigationFragment(f); break; case OP_SET_MAX_LIFECYCLE: mManager.setMaxLifecycle(f, op.mOldMaxState); break; default: throw new IllegalArgumentException("Unknown cmd: " + op.mCmd); } if (!mReorderingAllowed && op.mCmd != OP_REMOVE && f != null) { mManager.moveFragmentToExpectedState(f); } } if (!mReorderingAllowed && moveToState) { mManager.moveToState(mManager.mCurState, true); } }
Source:
<code>public void testNodesWithFlows() { <START> this.m_driver.get(this.getBaseUrl() + "opennms/element/nodeList.htm?flows=true"); <END> assertThat(Iterables.transform(m_driver.findElements(By.xpath(" containsInAnyOrder("TestMachine loc1node2", "TestMachine loc2node2")); }</code><technical_language>usage of this m_ is weird, omit this here</technical_language>

Target:
public void testNodesWithFlows() { m_driver.get(this.getBaseUrl() + "opennms/element/nodeList.htm?flows=true"); assertThat(Iterables.transform(m_driver.findElements(By.xpath(" containsInAnyOrder("TestMachine loc1node2", "TestMachine loc2node2")); }
Source:
<code>public void updatePluginSettings(PluginSettings newPluginSettings, Username currentUser, LocalizedOperationResult result, String md5) { final String pluginId = newPluginSettings.getPluginId(); <START> if (hasPermission(currentUser, result) && checkPluginLoaded(pluginId, result) && checkPluginSupportsPluginSettings(pluginId, result)) { <END> final String keyToLockOn = keyToLockOn(pluginId); synchronized (keyToLockOn) { final Plugin plugin = pluginDao.findPlugin(pluginId); if (plugin instanceof NullPlugin) { result.notFound(LocalizedMessage.string("RESOURCE_NOT_FOUND", "Plugin Settings", pluginId), HealthStateType.notFound()); return; } final PluginSettings pluginSettingsFromDB = getPluginSettings(pluginId); if (!entityHashingService.md5ForEntity(pluginSettingsFromDB).equals(md5)) { result.stale(LocalizedMessage.string("STALE_RESOURCE_CONFIG", "Plugin Settings", pluginId)); return; } updatePluginSettingsAndNotifyPluginSettingsChangeListeners(result, newPluginSettings); if (result.isSuccessful()) { entityHashingService.removeFromCache(newPluginSettings, pluginId); } } } }</code><technical_language>need check for hasPermission(currentUser, result) && checkPluginLoaded(pluginId, result) && checkPluginSupportsPluginSettings(pluginId, result) checked in controller</technical_language>

Target:
public void updatePluginSettings(PluginSettings newPluginSettings, Username currentUser, LocalizedOperationResult result, String md5) { final String pluginId = newPluginSettings.getPluginId(); final String keyToLockOn = keyToLockOn(pluginId); synchronized (keyToLockOn) { if (hasPermission(currentUser, result)) { final PluginSettings pluginSettingsFromDB = getPluginSettings(pluginId); if (pluginSettingsFromDB == null) { result.notFound(LocalizedMessage.string("RESOURCE_NOT_FOUND", "Plugin Settings", pluginId), HealthStateType.notFound()); return; } if (!entityHashingService.md5ForEntity(pluginSettingsFromDB).equals(md5)) { result.stale(LocalizedMessage.string("STALE_RESOURCE_CONFIG", "Plugin Settings", pluginId)); return; } updatePluginSettingsAndNotifyPluginSettingsChangeListeners(result, newPluginSettings); if (result.isSuccessful()) { entityHashingService.removeFromCache(newPluginSettings, pluginId); } } } }
Source:
<code>protected void executeCommand() { VdcReturnValueBase result = runInternalAction(VdcActionType.PersistentSetupNetworks, new AddNetworksByLabelParametersBuilder(getContext()).buildParameters(getNic(), getLabel(), <START> getClusterNetworksByLabel()), getContext().clone().withoutCompensationContext().withoutExecutionContext()); <END> if (result.getSucceeded()) { getReturnValue().setActionReturnValue(getLabel()); } else { propagateFailure(result); } setSucceeded(result.getSucceeded()); }</code><technical_language>dupContext() instead of getContext().clone()</technical_language>

Target:
protected void executeCommand() { VdcReturnValueBase result = runInternalAction(VdcActionType.PersistentSetupNetworks, new AddNetworksByLabelParametersBuilder(getContext()).buildParameters(getNic(), getLabel(), getClusterNetworksByLabel()), cloneOnlyEngineContext()); if (result.getSucceeded()) { getReturnValue().setActionReturnValue(getLabel()); } else { propagateFailure(result); } setSucceeded(result.getSucceeded()); }
Source:
<code>public FirstSuccessfulRouter(Component owner, Publisher<CoreEvent> publisher, List<ProcessorRoute> routes) { this.owner = owner; innerRecorders = <START> IntStream.range(0, routes.size()).mapToObj(x -> new FluxSinkRecorder<CoreEvent>()).collect(Collectors.toList()); <END> upstreamFlux = Flux.from(publisher) .doOnNext(event -> { inflightEvents.getAndIncrement(); innerRecorders.get(0).next(startEvent(event)); }) .doOnComplete(() -> { if (inflightEvents.get() == 0) { completeRouter(); } else { completeDeferred.set(true); } }); for (int i = 0; i < routes.size(); i++) { FluxSinkRecorder<CoreEvent> nextRecorder = i < routes.size() - 1 ? innerRecorders.get(i + 1) : null; innerFluxes.add(createMidFlux(routes.get(i), innerRecorders.get(i), ofNullable(nextRecorder))); } downstreamFlux = Flux.create(downstreamRecorder) .doOnNext(event -> inflightEvents.decrementAndGet()) .map(getScopeResultMapper()); }</code><technical_language>IntStream instead of routes.stream()</technical_language>

Target:
public FirstSuccessfulRouter(Component owner, Publisher<CoreEvent> publisher, List<ProcessorRoute> routes) { this.owner = owner; innerRecorders = routes.stream().map(x -> new FluxSinkRecorder<CoreEvent>()).collect(Collectors.toList()); upstreamFlux = Flux.from(publisher) .doOnNext(event -> { inflightEvents.getAndIncrement(); innerRecorders.get(0).next(startEvent(event)); }) .doOnComplete(() -> { if (inflightEvents.get() == 0) { completeRouter(); } else { completeDeferred.set(true); } }); for (int i = 0; i < routes.size(); i++) { FluxSinkRecorder<CoreEvent> nextRecorder = i < routes.size() - 1 ? innerRecorders.get(i + 1) : null; innerFluxes.add(createMidFlux(routes.get(i), innerRecorders.get(i), ofNullable(nextRecorder))); } downstreamFlux = Flux.create(downstreamRecorder) .doOnNext(event -> inflightEvents.decrementAndGet()) .map(getScopeResultMapper()); }
Source:
<code>void checkRegistryIsAvailable() { if (TRUE.equals(snapshotUseRegistry) && !isNullOrEmpty(registryUrl)) { <START> String registryLink = "http://" + registryUrl; <END> LOG.info("Probing registry '{}'", registryLink); try { HttpJsonResponse response = requestFactory.fromUrl(registryLink).setTimeout(30 * 1000).request(); final int responseCode = response.getResponseCode(); LOG.info("Probe of registry '{}' succeed with HTTP response code '{}'", registryLink, responseCode); } catch (ApiException | IOException ex) { LOG.warn("Docker registry " + registryLink + " is not available, " + "which means that you won't be able to save snapshots of your workspaces." + "\nHow to configure registry?" + "\n\tLocal registry -> <LINK_0>" + "\n\tRemote registry -> set up 'docker.registry.auth.*' properties"); } } }</code><technical_language>strange http:// concatenated a variable named "URL" URL is expected provide protocol</technical_language>

Target:
private void checkRegistryIsAvailable() throws IOException { if (snapshotUseRegistry && !isNullOrEmpty(machineDockerRegistry)) { String registryUrl = "http://" + machineDockerRegistry; LOG.info("Probing registry '{}'", registryUrl); final HttpURLConnection conn = (HttpURLConnection) new URL(registryUrl).openConnection(); conn.setConnectTimeout(30 * 1000); try { final int responseCode = conn.getResponseCode(); LOG.info("Probe of registry '{}' succeed with HTTP response code '{}'", registryUrl, responseCode); } catch (IOException ioEx) { LOG.warn("Docker registry is not available, " + "which means that you won't be able to save snapshots of your workspaces." + "\nHow to configure registry?" + "\n\tLocal registry -> <LINK_0>" + "\n\tRemote registry -> set up 'docker.registry.auth.*' properties", registryUrl); } finally { conn.disconnect(); } } }
Source:
<code>public void testUpdateMultipleSettingsWithParameters() throws Exception { Map<Symbol, List<Symbol>> settings = new HashMap<>() {{ <START> <END> put(Literal.of("stats.operations_log_size"), ImmutableList.of(new ParameterSymbol(0, DataTypes.LONG))); put(Literal.of("stats.jobs_log_size"), ImmutableList.of(new ParameterSymbol(1, DataTypes.LONG))); }}; Settings expected = Settings.builder() .put("stats.operations_log_size", 10) .put("stats.jobs_log_size", 25) .build(); assertThat( buildSettingsFrom(settings, symbolEvaluator(new RowN(new Object[]{10, 25})), true), is(expected) ); }</code><technical_language>minor: empty line</technical_language>

Target:
public void testUpdateMultipleSettingsWithParameters() throws Exception { List<Assignment<Symbol>> settings = List.of( new Assignment<>(Literal.of("stats.operations_log_size"), List.of(new ParameterSymbol(0, DataTypes.LONG))), new Assignment<>(Literal.of("stats.jobs_log_size"), List.of(new ParameterSymbol(1, DataTypes.LONG))) ); Settings expected = Settings.builder() .put("stats.operations_log_size", 10) .put("stats.jobs_log_size", 25) .build(); assertThat( buildSettingsFrom(settings, symbolEvaluator(new RowN(new Object[]{10, 25}))), is(expected) ); }
Source:
<code>public void mouseScrolled(MouseEvent e) { if (fDragState != DRAG_NONE || e.count == 0) { return; } boolean horizontalZoom = false; boolean horizontalScroll = false; boolean verticalZoom = false; boolean verticalScroll = false; Point size = getSize(); Rectangle bounds = new Rectangle(0, 0, size.x, size.y); if <START> (bounds.contains(e.x, e.y)) { <END> if ((e.stateMask & SWT.MODIFIER_MASK) == (SWT.SHIFT | SWT.CTRL)) { verticalZoom = true; } else if (e.x < fTimeProvider.getNameSpace()) { verticalScroll = true; } else { if ((e.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) { horizontalZoom = true; } else if ((e.stateMask & SWT.MODIFIER_MASK) == SWT.SHIFT) { horizontalScroll = true; } else { verticalScroll = true; } } } if (verticalZoom) { fVerticalZoomAlignEntry = getVerticalZoomAlignCursor(e.y); verticalZoom(e.count > 0); if (fVerticalZoomAlignEntry != null) { setElementPosition(fVerticalZoomAlignEntry.getKey(), fVerticalZoomAlignEntry.getValue()); } } else if (horizontalZoom && fTimeProvider.getTime0() != fTimeProvider.getTime1()) { zoom(e.count > 0); } else if (horizontalScroll) { horizontalScroll(e.count > 0); } else if (verticalScroll){ setTopIndex(getTopIndex() - e.count); } }</code><technical_language>early return if false? a bit complexity here. straightforward code</technical_language>

Target:
public void mouseScrolled(MouseEvent e) { if (fDragState != DRAG_NONE || e.count == 0) { return; } Point size = getSize(); Rectangle bounds = new Rectangle(0, 0, size.x, size.y); if (!bounds.contains(e.x, e.y)) { return; } boolean horizontalZoom = false; boolean horizontalScroll = false; boolean verticalZoom = false; boolean verticalScroll = false; if ((e.stateMask & SWT.MODIFIER_MASK) == (SWT.SHIFT | SWT.CTRL)) { verticalZoom = true; } else if (e.x < fTimeProvider.getNameSpace()) { verticalScroll = true; } else { if ((e.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) { horizontalZoom = true; } else if ((e.stateMask & SWT.MODIFIER_MASK) == SWT.SHIFT) { horizontalScroll = true; } else { verticalScroll = true; } } if (verticalZoom) { fVerticalZoomAlignEntry = getVerticalZoomAlignCursor(e.y); verticalZoom(e.count > 0); if (fVerticalZoomAlignEntry != null) { setElementPosition(fVerticalZoomAlignEntry.getKey(), fVerticalZoomAlignEntry.getValue()); } } else if (horizontalZoom && fTimeProvider.getTime0() != fTimeProvider.getTime1()) { zoom(e.count > 0); } else if (horizontalScroll) { horizontalScroll(e.count > 0); } else if (verticalScroll){ setTopIndex(getTopIndex() - e.count); } }
Source:
<code>private void initGraphicsData() { ImportUtils.updateGraphicsDevices(getVm().getStaticData(), <START> getVdsGroup() != null ? getVdsGroup().getCompatibilityVersion() : null); <END> }</code><technical_language>need check getVdsGroup is null - done in ImportVmCommandBase#canDoAction</technical_language>

Target:
private void initGraphicsData() { ImportUtils.updateGraphicsDevices(getVm().getStaticData(), getVdsGroup().getCompatibilityVersion()); }