auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String getTextBlockContent() { if (!isTextBlock()) { throw new IllegalArgumentException("This is not a text block"); } <START> int start = determineContentStart(getImage()); <END> String content = getImage().substring(start, getImage().length() - TEXTBLOCK_DELIMITER.length()); content = content.replaceAll("\r\n|\r", "\n"); int prefixLength = Integer.MAX_VALUE; List<String> lines = Arrays.asList(content.split("\\n")); for (int i = 0; i < lines.size(); i++) { String line = lines.get(i); if (!StringUtils.isAllBlank(line) || i == lines.size() - 1) { prefixLength = Math.min(prefixLength, countLeadingWhitespace(line)); } } if (prefixLength == Integer.MAX_VALUE) { prefixLength = 0; } StringBuilder sb = new StringBuilder(content.length()); for (int i = 0; i < lines.size(); i++) { String line = lines.get(i); if (!StringUtils.isAllBlank(line) && line.length() >= prefixLength) { line = line.substring(prefixLength); } line = removeTrailingWhitespace(line); sb.append(line); boolean isLastLine = i == lines.size() - 1; boolean isFirstLine = i == 0; if (!isLastLine || !isFirstLine && !StringUtils.isAllBlank(line)) { sb.append('\n'); } } String result = sb.toString(); result = result .replaceAll("\\\\\n", "") .replaceAll("\\\\n", "\n") .replaceAll("\\\\t", "\t") .replaceAll("\\\\b", "\b") .replaceAll("\\\\r", "\r") .replaceAll("\\\\f", "\f") .replaceAll("\\\\s", " ") .replaceAll("\\\\\"", "\"") .replaceAll("\\\\'", "'"); return result; }</code><technical_language>I nice extract rest of this routine a static method. test strings instead of parse a text block</technical_language>

Target:
public String getTextBlockContent() { if (!isTextBlock()) { return getImage(); } return determineTextBlockContent(getImage()); }
Source:
<code>public void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); bundle.putSerializable(BUNDLE_BASE_SHAPE, baseShape); bundle.putSerializable(BUNDLE_SHAPE_DRAW_TYPE, shapeDrawType); <START> bundle.putSerializable(BUNDLE_OUTLINE_WIDTH, shapeOutlineWidth); <END> }</code><technical_language>[Bundle.putInt(String, int)](<LINK_0>,%20int)) instead, need serialize a base type</technical_language>

Target:
public void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); bundle.putSerializable(BUNDLE_BASE_SHAPE, baseShape); bundle.putSerializable(BUNDLE_SHAPE_DRAW_TYPE, shapeDrawType); bundle.putInt(BUNDLE_OUTLINE_WIDTH, shapeOutlineWidth); }
Source:
<code>public boolean clearValue(String name) { <START> boolean result = getMapHelper().getValue(getCurrentValues(), name) != null; <END> getMapHelper().removeFrom(name, getCurrentValues()); return result; }</code><technical_language>this check is result value. A map a key a null value, in case containsKey() return true new code false. I important, is compatible. chance update implementation fully compatible (maybe removeFrom() return a boolean key present</technical_language>

Target:
public boolean clearValue(String name) { return getMapHelper().removeFrom(name, getCurrentValues()); }
Source:
<code>public void testTouchCorrectionWithInvalidDelayBetweenMovements() { <START> long invalidActionUpTimestamp = secondMovementTimestamp + 15; <END> triggerTouchDownEvent(initalPositionX, initalPositionY); triggerMovementEvent(firstMovementTimestamp, firstMovementPositionX, firstMovementPositionY); triggerMovementEvent(secondMovementTimestamp, secondMovementPositionX, firstMovementPositionY); triggerTouchUpEvent(invalidActionUpTimestamp); verify(imageView, times(2)).setX(anyFloat()); }</code><technical_language>suggestion long tooLateTimestamp = secondMovementTimestamp + 15;</technical_language>

Target:
public void testTouchCorrectionWithInvalidDelayBetweenMovements() { long tooLateTimestamp = secondMovementTimestamp + 15; triggerTouchDownEvent(initalPositionX, initalPositionY); triggerMovementEvent(firstMovementTimestamp, firstMovementPositionX, firstMovementPositionY); verify(imageView, times(1)).setX(firstMovementPositionX); triggerMovementEvent(secondMovementTimestamp, secondMovementPositionX, secondMovementPositionY); verify(imageView, times(1)).setX(secondMovementPositionX); triggerTouchUpEvent(tooLateTimestamp); verify(imageView, times(1)).setX(actionUpMovementPositionX); verify(imageView, times(3)).setX(anyFloat()); }
Source:
<code>private void createPageContent() { setTitle(windowTitle); <START> if (isThisProjectWizzard()) { <END> dynamicComposite = UIUtils.createGridedComposite(topComposite, 1); dynamicComposite.setLayoutData(UIUtils.createFullGridUsageData()); createProjectRegistrationSummary(); return; } else { UserRegistrationWizard wizard = (UserRegistrationWizard) getWizard(); UserRegistrationPage userRegistrationPage = wizard.userRegistrationPage; dynamicComposite = UIUtils.createGridedComposite(topComposite, 1); dynamicComposite.setLayoutData(UIUtils.createFullGridUsageData()); if (wizard.userWelcomePage.getRegisterNewId()) { userRegistrationPage .createUserRegistrationSummary(dynamicComposite); } createProjectRegistrationSummary(); return; } }</code><technical_language>page wizard-agnostic providing subclasses added correct wizards</technical_language>

Target:
private void createPageContent() { setTitle(windowTitle); if (isThisProjectWizard()) { dynamicComposite = UIUtils.createGridedComposite(topComposite, 1); dynamicComposite.setLayoutData(UIUtils.createFullGridUsageData()); createProjectRegistrationSummary(); return; } else { UserProjectRegistrationWizard wizard = (UserProjectRegistrationWizard) getWizard(); UserRegistrationPage userRegistrationPage = wizard.userRegistrationPage; dynamicComposite = UIUtils.createGridedComposite(topComposite, 1); dynamicComposite.setLayoutData(UIUtils.createFullGridUsageData()); if (wizard.userWelcomePage.getRegisterNewId()) { userRegistrationPage .createUserRegistrationSummary(dynamicComposite); } createProjectRegistrationSummary(); return; } }
Source:
<code>public RemoteCommand(CommandConfiguration _commandConfig, ConnectionConfiguration connectConfig, ConnectionConfiguration extraConnection) { commandConfig = _commandConfig; connectionConfig = connectConfig; ConnectionManager manager = ConnectionManagerFactory.getConnectionManager(); try { connection = manager.openConnection(connectConfig); commandConfig.setHostname(connectConfig.getHostname()); if (extraConnection != null) { secondConnection = manager.openConnection(extraConnection); commandConfig.setHostname(extraConnection.getHostname()); } } catch (JSchException e) { status = CommandStatus.INFOERROR; <START> e.printStackTrace(); <END> return; } status = CommandStatus.PROCESSING; }</code><technical_language>Remove log</technical_language>

Target:
public RemoteCommand(CommandConfiguration _commandConfig, ConnectionConfiguration connectConfig, ConnectionConfiguration extraConnection) { commandConfig = _commandConfig; connectionConfig = connectConfig; ConnectionManager manager = ConnectionManagerFactory.getConnectionManager(); try { if (manager.getConnection(connectConfig.getName()) == null) { connection.set(manager.openConnection(connectConfig)); } else { connection.set(manager.getConnection(connectConfig.getName())); if (connection.get().getExecChannel() != null) connection.get().getExecChannel().disconnect(); if (connection.get().getSftpChannel() != null) connection.get().getSftpChannel().disconnect(); } commandConfig.setHostname(connectConfig.getAuthorization().getHostname()); if (extraConnection != null) { secondConnection = manager.openConnection(extraConnection); commandConfig.setHostname(extraConnection.getAuthorization().getHostname()); } } catch (JSchException e) { status = CommandStatus.INFOERROR; logger.error("There was a connection failure in the construction of Remote Command!"); logger.error("Returning info error", e); return; } status = CommandStatus.PROCESSING; }
Source:
<code>protected boolean canDoAction() { <START> if (getVm().getstatus() != VMStatus.MigratingFrom) { <END> addCanDoActionMessage(VdcBllMessages.VM_CANNOT_CANCEL_MIGRATION_WHEN_VM_IS_NOT_MIGRATING); return false; } return true; }</code><technical_language>missing check vm exists.. (getVm() != null)</technical_language>

Target:
protected boolean canDoAction() { if (getVm() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); return false; } if (getVm().getstatus() != VMStatus.MigratingFrom) { addCanDoActionMessage(VdcBllMessages.VM_CANNOT_CANCEL_MIGRATION_WHEN_VM_IS_NOT_MIGRATING); return false; } return true; }
Source:
<code>private List<IRecord> set(BrowserAction action) { ElementRecord element = getElement(action.getID()); if (element == null) <START> return new LinkedList<IRecord>(); <END> return setAttributes(element, action.getAttributes()); }</code><technical_language><LINK_0></technical_language>

Target:
private List<IRecord> set(BrowserAction action) { ElementRecord element = getElement(action.getID()); if (element == null) return Collections.emptyList(); return setAttributes(element, action.getAttributes()); }
Source:
<code>public static Interceptor tokenAuth(String accessToken) { requireNonNull(accessToken, "accessToken is null"); return chain -> chain.proceed(chain.request().newBuilder() <START> .addHeader("Authorization", "Bearer " + accessToken) <END> .build()); }</code><technical_language>constant AUTHORIZATION method</technical_language>

Target:
public static Interceptor tokenAuth(String accessToken) { requireNonNull(accessToken, "accessToken is null"); checkArgument(CharMatcher.inRange((char) 33, (char) 126).matchesAllOf(accessToken)); return chain -> chain.proceed(chain.request().newBuilder() .addHeader(AUTHORIZATION, "Bearer " + accessToken) .build()); }
Source:
<code>private DeliveryState determineDeliveryState(final Source source, final boolean useModified, final Exception e) { Outcome defaultOutcome = getEffectiveDefaultOutcome(source); if (e instanceof ActiveMQAddressFullException && useModified && (outcomeSupported(source, Modified.DESCRIPTOR_SYMBOL) || defaultOutcome instanceof Modified)) { Modified modified = new Modified(); modified.setDeliveryFailed(true); modified.setUndeliverableHere(false); return modified; } else { if (outcomeSupported(source, Rejected.DESCRIPTOR_SYMBOL) || defaultOutcome instanceof Rejected) { ErrorCondition condition = new ErrorCondition(); if (e instanceof ActiveMQSecurityException) { condition.setCondition(AmqpError.UNAUTHORIZED_ACCESS); } else { condition.setCondition(Symbol.valueOf("failed")); } condition.setDescription(e.getMessage()); Rejected rejected = new Rejected(); rejected.setError(condition); return rejected; } else if (source.getDefaultOutcome() instanceof DeliveryState) { return ((DeliveryState) source.getDefaultOutcome()); } else { <START> return Accepted.getInstance(); <END> } } }</code><technical_language>I introducing this bit a new default behaviour turn out painful, gated opt-in instead. feels fact this change introduces a toggle avoid changing existing default questionable behaviour. realise this PR other clients/servers setting outcomes all, expecting full range of outcomes, this change effect of changing default behaviour broker rejecting, broker accepting message dropping floor. I realise this is implementing [strange] behaviour AMQP 1.0 spec outlines for outcomes / default-outcome field handling, this time I a bad idea introduce default knowing existing peers fall foul of it</technical_language>

Target:
private DeliveryState determineDeliveryState(final Source source, final boolean useModified, final Exception e) { Outcome defaultOutcome = getEffectiveDefaultOutcome(source); if (isAddressFull(e) && useModified && (outcomeSupported(source, Modified.DESCRIPTOR_SYMBOL) || defaultOutcome instanceof Modified)) { Modified modified = new Modified(); modified.setDeliveryFailed(true); return modified; } else { if (outcomeSupported(source, Rejected.DESCRIPTOR_SYMBOL) || defaultOutcome instanceof Rejected) { return createRejected(e); } else if (source.getDefaultOutcome() instanceof DeliveryState) { return ((DeliveryState) source.getDefaultOutcome()); } else { return createRejected(e); } } }
Source:
<code>public void parseFile() throws CTFReaderException { Reader metadataTextInput = null; try (FileInputStream fis = new FileInputStream(getMetadataPath()); FileChannel metadataFileChannel = fis.getChannel();) { if (isPacketBased(metadataFileChannel)) { metadataTextInput = readBinaryMetaData(metadataFileChannel); } else { <START> metadataTextInput = new FileReader(getMetadataPath()); <END> } readMetaDataText(metadataTextInput); } catch (FileNotFoundException e) { throw new CTFReaderException("Cannot find metadata file!"); } catch (IOException | ParseException e) { throw new CTFReaderException(e); } catch (RecognitionException | RewriteCardinalityException e) { throw new CtfAntlrException(e); } }</code><technical_language>this FileReader need closed</technical_language>

Target:
public void parseFile() throws CTFReaderException { try (FileInputStream fis = new FileInputStream(getMetadataPath()); FileChannel metadataFileChannel = fis.getChannel(); Reader metadataTextInput = (isPacketBased(metadataFileChannel) ? readBinaryMetaData(metadataFileChannel) : new FileReader(getMetadataPath()));) { readMetaDataText(metadataTextInput); } catch (FileNotFoundException e) { throw new CTFReaderException("Cannot find metadata file!"); } catch (IOException | ParseException e) { throw new CTFReaderException(e); } catch (RecognitionException | RewriteCardinalityException e) { throw new CtfAntlrException(e); } }
Source:
<code>public double calcEdgeWeight(EdgeIteratorState edgeState, boolean reverse) { double distance = edgeState.getDistance(); double seconds = calcSeconds(distance, edgeState, reverse); if (Double.isInfinite(seconds)) return Double.POSITIVE_INFINITY; double distanceInfluence = distance * this.distanceInfluence; if (Double.isInfinite(distanceInfluence)) return Double.POSITIVE_INFINITY; <START> return seconds / priorityConfig.calcPriority(edgeState, reverse) + distanceInfluence; <END> }</code><technical_language>I problematich divide time priority while distanceInfluence is affected priority. I formula read: weight = distance/speed + distance/priority + distance * distance_influence achieve 'preferring' roads (here motorway) *decrease* priority of *all other* roads, able realize a match-all key specifies priority for enum keys explicitly listed in custom model, like: priority: { road_class: {motorway: 100, "*": 50}}. Note this formula 'priority' needs interpreted 'virtual speed' somehow, i.e. range of order speeds. If this is hard for a user understand user enter some 'scaling' values 0.8 convert values internally</technical_language>

Target:
public double calcEdgeWeight(EdgeIteratorState edgeState, boolean reverse) { final double distance = edgeState.getDistance(); double seconds = calcSeconds(distance, edgeState, reverse); if (Double.isInfinite(seconds)) return Double.POSITIVE_INFINITY; double distanceCosts = distance * distanceInfluence; if (Double.isInfinite(distanceCosts)) return Double.POSITIVE_INFINITY; return seconds / priorityCalculator.calcPriority(edgeState, reverse) + distanceCosts; }
Source:
<code>public MantaClient(final ConfigContext config, final MantaConnectionFactoryConfigurator connectionFactoryConfigurator) { dumpConfig(config); ConfigContext.validate(config); this.url = config.getMantaURL(); this.config = config; this.home = ConfigContext.deriveHomeDirectoryFromUser(config.getMantaUser()); final KeyPair keyPair = new KeyPairFactory(config).createKeyPair(); final Signer.Builder builder = new Signer.Builder(keyPair); if (ObjectUtils.firstNonNull( config.disableNativeSignatures(), DefaultsConfigContext.DEFAULT_DISABLE_NATIVE_SIGNATURES)) { builder.providerCode("stdlib"); } <START> final ThreadLocalSigner signer = new ThreadLocalSigner(builder); <END> this.signerRef = new WeakReference<>(signer); final MantaConnectionFactory connectionFactory = new MantaConnectionFactory( config, keyPair, signer, connectionFactoryConfigurator); final MantaApacheHttpClientContext connectionContext = new MantaApacheHttpClientContext(connectionFactory); if (BooleanUtils.isTrue(config.isClientEncryptionEnabled())) { this.httpHelper = new EncryptionHttpHelper(connectionContext, config); } else { this.httpHelper = new StandardHttpHelper(connectionContext, config); } this.uriSigner = new UriSigner(this.config, keyPair, signer); this.beanSupervisor = new MantaMBeanSupervisor(); }</code><technical_language>This block in other constructor. DRYed out? I wrote this block,but I admit I trouble recalling DefaultsConfigContext needs explicitly referenced? allow config contexts start defaults</technical_language>

Target:
public MantaClient(final ConfigContext config, final MantaConnectionFactoryConfigurator connectionFactoryConfigurator) { dumpConfig(config); ConfigContext.validate(config); this.url = config.getMantaURL(); this.config = config; this.home = ConfigContext.deriveHomeDirectoryFromUser(config.getMantaUser()); this.beanSupervisor = new MantaMBeanSupervisor(); final KeyPair keyPair = new KeyPairFactory(config).createKeyPair(); final Signer.Builder builder = new Signer.Builder(keyPair); if (BooleanUtils.isTrue(config.disableNativeSignatures())) { builder.providerCode("stdlib"); } final ThreadLocalSigner signer = new ThreadLocalSigner(builder); this.signerRef = new WeakReference<>(signer); final MantaConnectionFactory connectionFactory = new MantaConnectionFactory( config, keyPair, signer, connectionFactoryConfigurator); final MantaApacheHttpClientContext connectionContext = new MantaApacheHttpClientContext(connectionFactory); if (BooleanUtils.isTrue(config.isClientEncryptionEnabled())) { this.httpHelper = new EncryptionHttpHelper(connectionContext, config); } else { this.httpHelper = new StandardHttpHelper(connectionContext, config); } this.uriSigner = new UriSigner(this.config, keyPair, signer); beanSupervisor.expose(this.config); beanSupervisor.expose(connectionFactory); }
Source:
<code>private boolean isLastValueChangeHandler() { int count = detailCache.getHandlerCount(); int last = count - 1; <START> for (int i = 0; i < count; i++) { <END> if (this == detailCache.getHandler(i)) { return i == last; } } return false; }</code><technical_language>is a loop than: int count = detailCache.getHandlerCount(); return count > 0 && detailCache.getHandler(count - 1) == this;</technical_language>

Target:
private boolean isLastValueChangeHandler() { int count = detailCache.getHandlerCount(); return count > 0 && detailCache.getHandler(count - 1) == this; }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { if(actionEnabled && position == actionPosition) { TextImageAudioView tiav =(TextImageAudioView)convertView; if(tiav == null) { tiav = new TextImageAudioView(context); } tiav.setDisplay(detail.getCustomAction().getDisplay()); tiav.setBackgroundResource(R.drawable.list_bottom_tab); int padding = (int) context.getResources().getDimension(R.dimen.entity_padding); tiav.setPadding(padding, padding, padding, padding); return tiav; } Entity<TreeReference> entity = current.get(position); if(usesGridView){ AdvancedEntityView emv =(AdvancedEntityView)convertView; if(emv == null) { emv = new AdvancedEntityView(context, detail, entity, currentSearchTerms, mImageLoader, controller); } else{ emv.setViews(context, detail, entity); } return emv; } else{ EntityView emv =(EntityView)convertView; if (emv == null) { emv = new EntityView(context, detail, entity, tts, currentSearchTerms, controller, position, mFuzzySearchEnabled); } else { emv.setSearchTerms(currentSearchTerms); <START> emv.refreshViewsForNewEntity(entity, entity.getElement().equals(selected), position); <END> } return emv; } }</code><technical_language>thank for renaming single-letter vars</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { if(actionEnabled && position == actionPosition) { TextImageAudioView tiav =(TextImageAudioView)convertView; if(tiav == null) { tiav = new TextImageAudioView(context); } tiav.setDisplay(detail.getCustomAction().getDisplay()); tiav.setBackgroundResource(R.drawable.list_bottom_tab); int padding = (int) context.getResources().getDimension(R.dimen.entity_padding); tiav.setPadding(padding, padding, padding, padding); return tiav; } Entity<TreeReference> entity = current.get(position); if(usesGridView){ GridEntityView emv =(GridEntityView)convertView; if(emv == null) { emv = new GridEntityView(context, detail, entity, currentSearchTerms, mImageLoader, controller); } else{ emv.setViews(context, detail, entity); } return emv; } else{ EntityView emv =(EntityView)convertView; if (emv == null) { emv = new EntityView(context, detail, entity, tts, currentSearchTerms, controller, position, mFuzzySearchEnabled); } else { emv.setSearchTerms(currentSearchTerms); emv.refreshViewsForNewEntity(entity, entity.getElement().equals(selected), position); } return emv; } }
Source:
<code>private int getSeparator(String qualified) { return qualified.lastIndexOf("@") != -1 ? qualified.lastIndexOf("@") <START> : qualified.indexOf("\\"); <END> }</code><technical_language>please add init parameter enable enable this, do want drag this webadmin/userportal. please find index of these, do @</technical_language>

Target:
private int getSeparator(String qualified) { int result = -1; if (userNameFormat == UserNameFormat.UPN && qualified.indexOf("\\") == -1) { result = qualified.lastIndexOf("@"); } else if (userNameFormat == UserNameFormat.DOWN_LEVEL_LOGON_NAME && qualified.indexOf("@") == -1) { result = qualified.lastIndexOf("\\"); } return result; }
Source:
<code>public Set<CollectionEntry> getCollectionEntries() { <START> return getEntries().stream().map(entry -> new CollectionEntry(entry)).collect(Collectors.toSet()); <END> }</code><technical_language>This reduce response size getEntries load entries (and versions) memory. Is a reason named query strategy in this case? <LINK_0></technical_language>

Target:
public List<CollectionEntry> getCollectionEntries() { return collectionEntries; }
Source:
<code>public Vector3d toVector3() { <START> return null; <END> }</code><technical_language>This return new SpongeVector3d(x, y, 0);</technical_language>

Target:
public Vector3d toVector3() { return new SpongeVector3d(x, y, 0); }
Source:
<code>public YearWeek plusWeeks(long weeksToAdd) { if (weeksToAdd == 0) { return this; } if (weeksToAdd < 0) { <START> return minusWeeks(-weeksToAdd); <END> } YearWeek yearWeek = this; while (weeksToAdd-- > 0) { int weeksInYear = yearWeek.is53WeekYear() ? 53 : 52; if (yearWeek.week < weeksInYear) { yearWeek = YearWeek.of(yearWeek.year, yearWeek.week + 1); } else { yearWeek = YearWeek.of(yearWeek.year + 1, 1); } } return yearWeek; }</code><technical_language>This fail if weeksToAdd is Long.MIN_VALUE. similar code in JDK subtracts 1, subtracts rest</technical_language>

Target:
public YearWeek plusWeeks(long weeksToAdd) { if (weeksToAdd == 0) { return this; } LocalDate mondayOfWeek = atDay(DayOfWeek.MONDAY).plusWeeks(weeksToAdd); return YearWeek.from(mondayOfWeek); }
Source:
<code>protected boolean apply(FieldValue a, FieldValue b) { <START> if(a instanceof EnumValue && b instanceof TextValue) { <END> String aStr = ((EnumValue) a).getValueId().asString(); String bStr = ((TextValue)b).asString(); return aStr.equals(bStr); } return a.equals(b); }</code><technical_language>== operator commutative. "t0000001" == GENDER"</technical_language>

Target:
protected boolean apply(FieldValue a, FieldValue b) { if(a instanceof EnumValue && b instanceof TextValue) { return relevancyCalculation(((EnumValue) a).getValueId().asString(),((TextValue) b).asString()); } else if (a instanceof TextValue && b instanceof EnumValue) { return relevancyCalculation(((TextValue) a).asString(),((EnumValue) b).getValueId().asString()); } return a.equals(b); }
Source:
<code>public Map<Capability, ServerConfig> getConfigs() { if (configs == null) { configs = new EnumMap<>(Capability.class); } Map<Capability, ServerConfig> resultMap = new EnumMap<>(Capability.class); resultMap.putAll(configs); <START> return resultMap; <END> }</code><technical_language>copy constructor for readability. result is same</technical_language>

Target:
public Map<Capability, ServerConfig> getConfigs() { if (configs == null) { configs = new EnumMap<>(Capability.class); } return new EnumMap<>(configs); }
Source:
<code><START> protected boolean canDoAction() { <END> if (!(validate(hostExists()) && validate(hostStatusValid()))){ return false; } return true; }</code><technical_language>simplify a single line replacing method's body with: return validate(hostExists()) && validate(hostStatusValid());</technical_language>

Target:
protected boolean canDoAction() { return validate(hostExists()) && validate(hostStatusValid()); }
Source:
<code>public void testFacetWithSchema() throws Exception { <START> var schemaByFacetName = Map.of(HAS_RELATED_TEXT, "relatedtext", COLD_STORAGE, "coldstorage"); for (Map.Entry<String, String> entry : schemaByFacetName.entrySet()) { CompositeType type = schemaManager.getFacet(entry.getKey()); JsonAssert json = jsonAssert(type); json.properties(3); json.has("entity-type").isEquals("facet"); json.has("name").isEquals(entry.getKey()); json = json.has("schemas").length(1).has(0); json.has("entity-type").isEquals("schema"); json.has("name").isEquals(entry.getValue()); } <END> }</code><technical_language>this test, I tests write a facet a specific one. in favor of reverting change this test more complex</technical_language>

Target:
public void testFacetWithSchema() throws Exception { CompositeType type = schemaManager.getFacet("HasRelatedText"); JsonAssert json = jsonAssert(type); json.properties(3); json.has("entity-type").isEquals("facet"); json.has("name").isEquals("HasRelatedText"); json = json.has("schemas").length(1).has(0); json.has("entity-type").isEquals("schema"); json.has("name").isEquals("relatedtext"); }
Source:
<code>public WMTSTileCacheInfo(final MapBounds bounds, final Rectangle paintArea, final double dpi) { super(bounds, paintArea, dpi, WMTSLayer.this.param); double diff = Double.POSITIVE_INFINITY; final double targetResolution = bounds.getScaleDenominator(paintArea, dpi).toResolution(bounds.getProjection(), dpi); for (Matrix m : WMTSLayer.this.param.matrices) { double delta = Math.abs(m.getResolution(this.bounds.getProjection()) - targetResolution); if (delta < diff) { diff = delta; this.matrix = m; } } if (this.matrix == null) { <START> throw new IllegalArgumentException("Unable to find a matrix that at the resolution: " + targetResolution); <END> } }</code><technical_language>"Unable find a matrix resolution: ", I guess</technical_language>

Target:
public WMTSTileCacheInfo(final MapBounds bounds, final Rectangle paintArea, final double dpi) { super(bounds, paintArea, dpi, WMTSLayer.this.param); double diff = Double.POSITIVE_INFINITY; final double targetResolution = bounds.getScaleDenominator(paintArea, dpi).toResolution(bounds.getProjection(), dpi); for (Matrix m : WMTSLayer.this.param.matrices) { double delta = Math.abs(m.getResolution(this.bounds.getProjection()) - targetResolution); if (delta < diff) { diff = delta; this.matrix = m; } } if (this.matrix == null) { throw new IllegalArgumentException("Unable to find a matrix for the resolution: " + targetResolution); } }
Source:
<code>public void testFactionBorderTrackerAllPlanets() throws InterruptedException { FactionBorderTracker tracker = buildTestTracker(); tracker.setDefaultBorderSize(1, 1, 1); List<Planet> border = tracker.getBorderPlanets(factionUs, factionThem); assertEquals(tracker.getBorders(factionUs).getPlanets().size(), 1); assertEquals(tracker.getBorders(factionThem).getPlanets().size(), 12); assertEquals(border.size(), 2); for (Planet p : border) { assertEquals(Math.abs(p.getX()), 1, RegionPerimeter.EPSILON); <START> assertEquals(p.getY(), 0, 0.001); <END> } }</code><technical_language>0.001 RegionPerimeter.EPSILON too</technical_language>

Target:
public void testFactionBorderTrackerAllPlanets() throws InterruptedException { FactionBorderTracker tracker = buildTestTracker(); tracker.setDefaultBorderSize(1, 1, 1); List<Planet> border = tracker.getBorderPlanets(factionUs, factionThem); assertEquals(tracker.getBorders(factionUs).getPlanets().size(), 1); assertEquals(tracker.getBorders(factionThem).getPlanets().size(), 12); assertEquals(border.size(), 2); for (Planet p : border) { assertEquals(Math.abs(p.getX()), 1, RegionPerimeter.EPSILON); assertEquals(p.getY(), 0, RegionPerimeter.EPSILON); } }
Source:
<code>boolean updateNewAndRestoringTasks() { active.initializeNewTasks(); standby.initializeNewTasks(); final Collection<TopicPartition> restored = changelogReader.restore(active); if (!restored.isEmpty()) { active.updateRestored(restored); <START> final Set<TopicPartition> needsRestoring = new HashSet<>(restoreConsumer.assignment()); <END> needsRestoring.removeAll(restored); restoreConsumer.assign(needsRestoring); } if (active.allTasksRunning()) { final Set<TopicPartition> assignment = consumer.assignment(); log.trace("Resuming partitions {}", assignment); consumer.resume(assignment); assignStandbyPartitions(); return standby.allTasksRunning(); } return false; }</code><technical_language>pause instead of re-assign</technical_language>

Target:
boolean updateNewAndRestoringTasks() { active.initializeNewTasks(); standby.initializeNewTasks(); final Collection<TopicPartition> restored = changelogReader.restore(active); active.updateRestored(restored); removeChangelogsFromRestoreConsumer(restored, false); if (active.allTasksRunning()) { final Set<TopicPartition> assignment = consumer.assignment(); log.trace("Resuming partitions {}", assignment); consumer.resume(assignment); assignStandbyPartitions(); return standby.allTasksRunning(); } return false; }
Source:
<code>public void TestHmm() { final int offset = -3600*1000; Optional<SleepHmmWithInterpretation> hmm = sleepHmmDAO.getLatestModelForDate(0,0); assertTrue(hmm.isPresent()); AllSensorSampleList sensorSampleList = new AllSensorSampleList(); List<TrackerMotion> motionList = new ArrayList<TrackerMotion>(); for (int i = 0; i < 24; i++) { final long t = t0 + i*3600/3*1000; TrackerMotion m = new TrackerMotion(0,0,0L,t,500,offset,0L,1L,1L); motionList.add(m); } <START> List<Sample> light = new ArrayList<Sample>(); <END> for (int i = 1; i < 7*3600; i++) { Long t = t0 + i*60*1000; Sample s = new Sample(t,0.1f,offset); light.add(s); } sensorSampleList.add(Sensor.LIGHT,light); Optional<SleepHmmWithInterpretation.SleepHmmResult> res = hmm.get().getSleepEventsUsingHMM(sensorSampleList,motionList,t0,tf,tc1); Optional<SleepHmmWithInterpretation.SleepHmmResult> res2 = hmm.get().getSleepEventsUsingHMM(sensorSampleList,motionList,t0,tf,tc2); assertTrue(res.isPresent()); assertTrue(res2.isPresent()); assertTrue(res.get().fallAsleep.isPresent()); final int expectedLength1 = 6*60 / SleepHmmWithInterpretation.NUM_MINUTES_IN_WINDOW; final int expectedLength2 = 7*60 / SleepHmmWithInterpretation.NUM_MINUTES_IN_WINDOW; assertTrue(res.get().path.length == expectedLength1); assertTrue(res2.get().path.length == expectedLength2); }</code><technical_language>final, new ArrayList<~~Sample~~>();</technical_language>

Target:
public void TestHmm() { final int offset = -3600*1000; final Optional<SleepHmmWithInterpretation> hmm = sleepHmmDAO.getLatestModelForDate(0,0); assertTrue(hmm.isPresent()); final AllSensorSampleList sensorSampleList = new AllSensorSampleList(); final List<TrackerMotion> motionList = new ArrayList<TrackerMotion>(); for (int i = 0; i < 24; i++) { final long t = t0 + i*3600/3*1000; final TrackerMotion m = new TrackerMotion(0,0,0L,t,500,offset,0L,1L,1L); motionList.add(m); } List<Sample> light = new ArrayList<Sample>(); for (int i = 1; i < 7*3600; i++) { final Long t = t0 + i*60*1000; final Sample s = new Sample(t,0.1f,offset); light.add(s); } sensorSampleList.add(Sensor.LIGHT,light); Optional<SleepHmmWithInterpretation.SleepHmmResult> res = hmm.get().getSleepEventsUsingHMM(sensorSampleList,motionList,t0,tf,tc1); Optional<SleepHmmWithInterpretation.SleepHmmResult> res2 = hmm.get().getSleepEventsUsingHMM(sensorSampleList,motionList,t0,tf,tc2); assertTrue(res.isPresent()); assertTrue(res2.isPresent()); assertTrue(res.get().fallAsleep.isPresent()); final int expectedLength1 = 6*60 / SleepHmmWithInterpretation.NUM_MINUTES_IN_WINDOW; final int expectedLength2 = 7*60 / SleepHmmWithInterpretation.NUM_MINUTES_IN_WINDOW; assertTrue(res.get().path.size() == expectedLength1); assertTrue(res2.get().path.size() == expectedLength2); }
Source:
<code>public void write( String destination, int requiredAlignment, byte[] data ) throws IOException { File fileName = new File( storeDir, destination ); fs.mkdirs( fileName.getParentFile() ); fileCopyMonitor.copyFile( fileName ); boolean isDefaultFileSystem = pageCache.getCachedFileSystem() instanceof DefaultFileSystemAbstraction; <START> if ( !isDefaultFileSystem && StoreType.shouldBeManagedByPageCache( destination ) ) <END> { WritableByteChannel channel = channels.get( destination ); if ( channel == null ) { int filePageSize = pageCache.pageSize() - pageCache.pageSize() % requiredAlignment; PagedFile pagedFile = pageCache.map( fileName, filePageSize, StandardOpenOption.CREATE ); channel = pagedFile.openWritableByteChannel(); pagedFiles.put( destination, pagedFile ); channels.put( destination, channel ); } ByteBuffer buffer = ByteBuffer.wrap( data ); while ( buffer.hasRemaining() ) { channel.write( buffer ); } } else { try ( OutputStream outputStream = fs.openAsOutputStream( fileName, true ) ) { outputStream.write( data ); } } }</code><technical_language>reversing condition</technical_language>

Target:
public void write( String destination, int requiredAlignment, byte[] data ) throws IOException { File fileName = new File( storeDir, destination ); fs.mkdirs( fileName.getParentFile() ); fileCopyMonitor.copyFile( fileName ); if ( !pageCache.fileSystemSupportsFileOperations() && StoreType.canBeManagedByPageCache( destination ) ) { WritableByteChannel channel = channels.get( destination ); if ( channel == null ) { int filePageSize = pageCache.pageSize() - pageCache.pageSize() % requiredAlignment; PagedFile pagedFile = pageCache.map( fileName, filePageSize, StandardOpenOption.CREATE ); channel = pagedFile.openWritableByteChannel(); pagedFiles.put( destination, pagedFile ); channels.put( destination, channel ); } ByteBuffer buffer = ByteBuffer.wrap( data ); while ( buffer.hasRemaining() ) { channel.write( buffer ); } } else { try ( OutputStream outputStream = fs.openAsOutputStream( fileName, true ) ) { outputStream.write( data ); } } }
Source:
<code>public void connect() throws Exception { super.connect(); if (_vds != null) { String actual = getHostFingerprint(); String expected = _vds.getSSHKeyFingerprint(); if (expected == null || expected.isEmpty()) { _vds.setSSHKeyFingerprint(getHostFingerprint()); <START> DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); <END> } else if (!actual.equals(expected)) { throw new GeneralSecurityException( String.format( "Invalid fingerprint %s, expected %s", actual, expected ) ); } } }</code><technical_language>this fail? if so, need raise security exception wrap original exception</technical_language>

Target:
public void connect() throws Exception { super.connect(); if (_vds != null) { String actual = getHostFingerprint(); String expected = _vds.getSSHKeyFingerprint(); if (expected == null || expected.isEmpty()) { _vds.setSSHKeyFingerprint(getHostFingerprint()); try { DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); } catch (Exception e) { throw new SecurityException( String.format( "Couldn't store fingerprint to db for host %s: %s", _vds.getHostName(), e ) ); } } else if (!actual.equals(expected)) { throw new GeneralSecurityException( String.format( "Invalid fingerprint %s, expected %s", actual, expected ) ); } } }
Source:
<code>public void createDraft() throws GitAPIException, IOException { PushOneCommit.Result r = createChange(); String changeId = r.getChangeId(); String revId = r.getCommit().getName(); ReviewInput.CommentInput comment = newCommentInfo( "file1", Comment.Side.REVISION, 1, "comment 1"); addDraft(changeId, revId, comment); Map<String, List<CommentInfo>> result = getDraftComments(changeId, revId); <START> assertTrue(result.size() == 1); <END> CommentInfo actual = Iterables.getOnlyElement(result.get(comment.path)); assertCommentInfo(comment, actual); }</code><technical_language>assertEquals</technical_language>

Target:
public void createDraft() throws GitAPIException, IOException { PushOneCommit.Result r = createChange(); String changeId = r.getChangeId(); String revId = r.getCommit().getName(); ReviewInput.CommentInput comment = newCommentInfo( "file1", Comment.Side.REVISION, 1, "comment 1"); addDraft(changeId, revId, comment); Map<String, List<CommentInfo>> result = getDraftComments(changeId, revId); assertEquals(1, result.size()); CommentInfo actual = Iterables.getOnlyElement(result.get(comment.path)); assertCommentInfo(comment, actual); }
Source:
<code><START> private long time(ITestResult o1) { <END> return o1.getEndMillis() - o1.getStartMillis(); }</code><technical_language>static for 3 methods</technical_language>

Target:
private static long time(ITestResult o1) { return o1.getEndMillis() - o1.getStartMillis(); }
Source:
<code>private boolean hasProjects() { for (IResource <START> fResource : <END> fResources) { if (ReorgUtils.isProject(fResource)) { return true; } } for (IJavaElement fJavaElement : fJavaElements) { if (ReorgUtils.isProject(fJavaElement)) { return true; } } return false; }</code><technical_language>rename resource</technical_language>

Target:
private boolean hasProjects() { for (IResource resource : fResources) { if (ReorgUtils.isProject(resource)) { return true; } } for (IJavaElement javaElement : fJavaElements) { if (ReorgUtils.isProject(javaElement)) { return true; } } return false; }
Source:
<code>public String[] getSupportedExtensions() { return new String[] { "oga", "ogg", <START> "oga", <END> "spx", "opus", }; }</code><technical_language>@Nadahar "**oga**"</technical_language>

Target:
public String[] getSupportedExtensions() { return new String[] { "oga", "ogg", "spx", "opus", }; }
Source:
<code>public void testIndividualProcTimeout() throws IOException, ProcCallException, InterruptedException { <START> m_username="adminUser"; <END> m_password="password"; if (isValgrind() || isDebug()) { return; } Client client; m_username = "adminUser"; m_password = "password"; client = getClient(); checkIndividualProcTimeout(client, true); m_username = "userWithAllProc"; m_password = "password"; client = getClient(); checkIndividualProcTimeout(client, false); }</code><technical_language>In this case, member variables set values immediately below... delete lines 440-441</technical_language>

Target:
public void testIndividualProcTimeout() throws IOException, ProcCallException, InterruptedException { m_username="adminUser"; m_password="password"; if (isValgrind() || isDebug()) { return; } Client client; client = getClient(); checkIndividualProcTimeout(client, true); m_username = "userWithAllProc"; m_password = "password"; client = getClient(); checkIndividualProcTimeout(client, false); }
Source:
<code>protected void doCheck(Object key, boolean isWrite, long flagBitSet) { if (trace) log.tracef("Checking availability for key=%s, status=%s", key, availabilityMode); if (availabilityMode == AvailabilityMode.AVAILABLE) return; LocalizedCacheTopology cacheTopology = distributionManager.getCacheTopology(); Collection<Address> owners = cacheTopology.getDistribution(key).writeOwners(); List<Address> actualMembers = cacheTopology.getActualMembers(); boolean operationAllowed = isOperationAllowed(isWrite, flagBitSet); if (!actualMembers.containsAll(owners) && !operationAllowed) { if (trace) log.tracef("Partition is in %s mode, PartitionHandling is set to to %s, access is not allowed for key %s", availabilityMode, partitionHandling, key); throw log.degradedModeKeyUnavailable(key); } else { if (trace) log.tracef("Key %s is available.", key); <START> System.err.println(String.format("Key %s is available.", key)); <END> } }</code><technical_language>Forgot remove this guy :)</technical_language>

Target:
protected void doCheck(Object key, boolean isWrite, long flagBitSet) { if (trace) log.tracef("Checking availability for key=%s, status=%s", key, availabilityMode); if (availabilityMode == AvailabilityMode.AVAILABLE) return; LocalizedCacheTopology cacheTopology = distributionManager.getCacheTopology(); Collection<Address> owners = cacheTopology.getDistribution(key).writeOwners(); List<Address> actualMembers = cacheTopology.getActualMembers(); boolean operationAllowed = isOperationAllowed(isWrite, flagBitSet); if (!actualMembers.containsAll(owners) && !operationAllowed) { if (trace) log.tracef("Partition is in %s mode, PartitionHandling is set to to %s, access is not allowed for key %s", availabilityMode, partitionHandling, key); throw log.degradedModeKeyUnavailable(key); } else { if (trace) log.tracef("Key %s is available.", key); } }
Source:
<code>protected void processParentChangedBlobs(Runnable counter) { <START> mango.select(MongoBlob.class).eq(MongoBlob.PARENT_CHANGED, true).limit(256).iterateAll(blob -> { <END> invokeParentChangedHandlers(blob); mongo.update() .set(MongoBlob.PARENT_CHANGED, false) .where(MongoBlob.ID, blob.getId()) .executeFor(MongoBlob.class); counter.run(); }); }</code><technical_language>want increase 256's s.th. larger - 1k oder 512? for blocks. step define a constant in a base class this centrally controlled(?)</technical_language>

Target:
protected void processParentChangedBlobs(Runnable counter) { mango.select(MongoBlob.class).eq(MongoBlob.PARENT_CHANGED, true).limit(CURSOR_LIMIT).iterateAll(blob -> { invokeParentChangedHandlers(blob); mongo.update() .set(MongoBlob.PARENT_CHANGED, false) .where(MongoBlob.ID, blob.getId()) .executeFor(MongoBlob.class); counter.run(); }); }
Source:
<code>private int getRowCount(UUID oldShardUuid) <START> { <END> try (OrcDataSource dataSource = orcStorageManager.openShard(fileSystem, oldShardUuid, defaultReaderAttributes)) { OrcReader reader = new OrcReader( dataSource, ORC, defaultReaderAttributes.getMaxMergeDistance(), defaultReaderAttributes.getTinyStripeThreshold(), HUGE_MAX_READ_BLOCK_SIZE, orcFileTailSource, new StorageStripeMetadataSource()); if (reader.getFooter().getNumberOfRows() >= Integer.MAX_VALUE) { throw new IOException("File has too many rows"); } return toIntExact(reader.getFooter().getNumberOfRows()); } catch (Exception e) { throw new PrestoException(RAPTOR_ERROR, "Failed to read file: " + oldShardUuid, e); } }</code><technical_language>This new OrcReader method often; a helper in a util</technical_language>

Target:
private int getRowCount(UUID oldShardUuid) { try (OrcDataSource dataSource = orcStorageManager.openShard(fileSystem, oldShardUuid, defaultReaderAttributes)) { OrcReader reader = new OrcReader(dataSource, ORC, defaultReaderAttributes.getMaxMergeDistance(), defaultReaderAttributes.getTinyStripeThreshold(), HUGE_MAX_READ_BLOCK_SIZE, orcFileTailSource); if (reader.getFooter().getNumberOfRows() >= Integer.MAX_VALUE) { throw new IOException("File has too many rows"); } return toIntExact(reader.getFooter().getNumberOfRows()); } catch (Exception e) { throw new PrestoException(RAPTOR_ERROR, "Failed to read file: " + oldShardUuid, e); } }
Source:
<code>private void updatePartitionDataFromKafka() { Map<String, List<PartitionInfo>> topics; try { synchronized (consumerLock) { topics = consumer.listTopics(); } if (!topics.containsKey(ioConfig.getTopic())) { <START> log.warn("No such topic [%s] found, list of discovered topics [%s]", ioConfig.getTopic(), topics.keySet()); <END> } } catch (Exception e) { log.warn( e, "Unable to get partition data from Kafka for brokers [%s], are the brokers up?", ioConfig.getConsumerProperties().get(KafkaSupervisorIOConfig.BOOTSTRAP_SERVERS_KEY) ); return; } List<PartitionInfo> partitions = topics.get(ioConfig.getTopic()); int numPartitions = (partitions != null ? partitions.size() : 0); log.debug("Found [%d] Kafka partitions for topic [%s]", numPartitions, ioConfig.getTopic()); for (int partition = 0; partition < numPartitions; partition++) { int taskGroupId = getTaskGroupIdForPartition(partition); partitionGroups.putIfAbsent(taskGroupId, new ConcurrentHashMap<Integer, Long>()); ConcurrentHashMap<Integer, Long> partitionMap = partitionGroups.get(taskGroupId); if (partitionMap.putIfAbsent(partition, NOT_SET) == null) { log.info( "New partition [%d] discovered for topic [%s], added to task group [%d]", partition, ioConfig.getTopic(), taskGroupId ); } } }</code><technical_language>moving this logging <LINK_0> check topics.containsKey() changed null check partitions</technical_language>

Target:
private void updatePartitionDataFromKafka() { Map<String, List<PartitionInfo>> topics; try { synchronized (consumerLock) { topics = consumer.listTopics(); } } catch (Exception e) { log.warn( e, "Unable to get partition data from Kafka for brokers [%s], are the brokers up?", ioConfig.getConsumerProperties().get(KafkaSupervisorIOConfig.BOOTSTRAP_SERVERS_KEY) ); return; } List<PartitionInfo> partitions = topics.get(ioConfig.getTopic()); if (partitions == null) { log.warn("No such topic [%s] found, list of discovered topics [%s]", ioConfig.getTopic(), topics.keySet()); } int numPartitions = (partitions != null ? partitions.size() : 0); log.debug("Found [%d] Kafka partitions for topic [%s]", numPartitions, ioConfig.getTopic()); for (int partition = 0; partition < numPartitions; partition++) { int taskGroupId = getTaskGroupIdForPartition(partition); partitionGroups.putIfAbsent(taskGroupId, new ConcurrentHashMap<Integer, Long>()); ConcurrentHashMap<Integer, Long> partitionMap = partitionGroups.get(taskGroupId); if (partitionMap.putIfAbsent(partition, NOT_SET) == null) { log.info( "New partition [%d] discovered for topic [%s], added to task group [%d]", partition, ioConfig.getTopic(), taskGroupId ); } } }
Source:
<code>public Response registerInstallation( @DefaultValue("") @HeaderParam("x-ag-old-token") final String oldToken, Installation entity, @Context HttpServletRequest request) { final Variant variant = loadVariantWhenAuthorized(request); if (variant == null) { return create401Response(request); } final String deviceToken = entity.getDeviceToken(); if (deviceToken == null || !DeviceTokenValidator.isValidDeviceTokenForVariant(deviceToken, variant.getType())) { logger.trace(String.format("Invalid device token was delivered: %s for variant type: %s", deviceToken, variant.getType())); return appendAllowOriginHeader(Response.status(Status.BAD_REQUEST), request); } logger.trace("Mobile Application on device was launched"); <START> if (!oldToken.isEmpty() && !oldToken.equals(entity.getDeviceToken())) { <END> clientInstallationService.removeInstallationForVariantByDeviceToken(variant.getVariantID(), oldToken); } clientInstallationService.addInstallation(variant, entity); return appendAllowOriginHeader(Response.ok(entity), request); }</code><technical_language>a device send current token</technical_language>

Target:
public Response registerInstallation( @DefaultValue("") @HeaderParam("x-ag-old-token") final String oldToken, Installation entity, @Context HttpServletRequest request) { final Variant variant = loadVariantWhenAuthorized(request); if (variant == null) { return create401Response(request); } final String deviceToken = entity.getDeviceToken(); if (deviceToken == null || !DeviceTokenValidator.isValidDeviceTokenForVariant(deviceToken, variant.getType())) { logger.trace(String.format("Invalid device token was delivered: %s for variant type: %s", deviceToken, variant.getType())); return appendAllowOriginHeader(Response.status(Status.BAD_REQUEST), request); } logger.trace("Mobile Application on device was launched"); if (!oldToken.isEmpty() && !oldToken.equals(entity.getDeviceToken())) { logger.info(String.format("Deleting old device token %s", oldToken)); clientInstallationService.removeInstallationForVariantByDeviceToken(variant.getVariantID(), oldToken); } clientInstallationService.addInstallation(variant, entity); return appendAllowOriginHeader(Response.ok(entity), request); }