auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testPutAll() throws Exception { final Map<String, String> originalStoreContent = getEntryMap(KEY_SET_A, KEY_SET_B); final FakeStore fakeStore = new FakeStore(originalStoreContent); this.store = spy(fakeStore); final Ehcache<String, String> ehcache = this.getEhcache(); final Map<String, String> contentUpdates = getAltEntryMap("new_", fanIn(KEY_SET_A, KEY_SET_C, KEY_SET_D)); ehcache.putAll(contentUpdates); <START> verify(cacheEventListener, times(18)).onEvent(argThat(isCreatedOrUpdated)); <END> try { ehcache.getRuntimeConfiguration().deregisterCacheEventListener(cacheEventListener); fail(); } catch (UnsupportedOperationException e) { } }</code><technical_language>clearer KEY_SET_A.size() + KEY_SET_C.size() + KEY_SET_D.size() instead of 18</technical_language>

Target:
public void testPutAll() throws Exception { buildStore(getEntryMap(KEY_SET_A, KEY_SET_B)); final Ehcache<String, String> ehcache = getEhcache(); final Map<String, String> contentUpdates = getAltEntryMap("new_", fanIn(KEY_SET_A, KEY_SET_C, KEY_SET_D)); ehcache.putAll(contentUpdates); int invocations = KEY_SET_A.size() + KEY_SET_C.size() + KEY_SET_D.size(); verify(cacheEventListener, times(invocations)).onEvent(argThat(isCreatedOrUpdated)); }
Source:
<code>public void setupTest() { assumeTrue(CtfTmfTestTrace.KERNEL.exists()); fTrace = CtfTmfTestTrace.KERNEL.getTrace(); Document doc = null; try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder; dBuilder = dbFactory.newDocumentBuilder(); doc = dBuilder.parse(TmfXmlTestFiles.VALID_FILE.getFile()); doc.getDocumentElement().normalize(); } catch (ParserConfigurationException e) { fail("Xml document parse exception"); } catch (SAXException e) { fail("Exception parsing xml file"); } catch (IOException e) { fail("File io exception"); } assertNotNull(doc); NodeList stateproviderNodes = doc <START> .getElementsByTagName(TmfXmlStrings.STATE_PROVIDER); <END> Element node = (Element) stateproviderNodes.item(0); fModule = new XmlStateSystemModule(); String moduleId = node.getAttribute(TmfXmlStrings.ANALYSIS_ID); fModule.setId(moduleId); fModule.setXmlFile(new Path(TmfXmlTestFiles.VALID_FILE.getFile().getAbsolutePath())); NodeList head = node.getElementsByTagName(TmfXmlStrings.HEAD); XmlHeadInfo headInfo = null; if (head.getLength() == 1) { headInfo = new XmlHeadInfo(head.item(0)); } fModule.setHeadInfo(headInfo); try { fModule.setTrace(fTrace); fModule.schedule(); } catch (TmfAnalysisException e) { fail("Cannot set trace " + e.getMessage()); } }</code><technical_language>wrap</technical_language>

Target:
public void setupTest() { assumeTrue(CtfTmfTestTrace.KERNEL.exists()); fTrace = CtfTmfTestTrace.KERNEL.getTrace(); Document doc = null; try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); doc = dBuilder.parse(TmfXmlTestFiles.VALID_FILE.getFile()); doc.getDocumentElement().normalize(); } catch (ParserConfigurationException e) { fail("Xml document parse exception"); } catch (SAXException e) { fail("Exception parsing xml file"); } catch (IOException e) { fail("File io exception"); } assertNotNull(doc); NodeList stateproviderNodes = doc.getElementsByTagName(TmfXmlStrings.STATE_PROVIDER); Element node = (Element) stateproviderNodes.item(0); fModule = new XmlStateSystemModule(); String moduleId = node.getAttribute(TmfXmlStrings.ANALYSIS_ID); fModule.setId(moduleId); fModule.setXmlFile(new Path(TmfXmlTestFiles.VALID_FILE.getFile().getAbsolutePath())); NodeList head = node.getElementsByTagName(TmfXmlStrings.HEAD); XmlHeadInfo headInfo = null; if (head.getLength() == 1) { headInfo = new XmlHeadInfo(head.item(0)); } fModule.setHeadInfo(headInfo); try { fModule.setTrace(fTrace); fModule.schedule(); } catch (TmfAnalysisException e) { fail("Cannot set trace " + e.getMessage()); } }
Source:
<code>protected void onBeforeClusterItemRendered(TiClusterMarker clusterItem, MarkerOptions markerOptions) { AnnotationProxy anno = clusterItem.getProxy(); if (anno.hasProperty(TiC.PROPERTY_IMAGE)) { <START> TiDrawableReference imageref = TiDrawableReference.fromUrl(anno, (String) anno.getProperty(TiC.PROPERTY_IMAGE)); <END> Bitmap bitmap = imageref.getBitmap(true, false); if (bitmap != null) { try { markerOptions.icon(BitmapDescriptorFactory.fromBitmap(bitmap)); setIconImageDimensions(bitmap.getWidth(), bitmap.getHeight()); } catch (Exception e){} } } if (anno.hasProperty(MapModule.PROPERTY_CENTER_OFFSET)) { HashMap centerOffsetProperty = (HashMap) anno.getProperty(MapModule.PROPERTY_CENTER_OFFSET); TiPoint centerOffset = new TiPoint(centerOffsetProperty, 0.0, 0.0); float offsetX = 0.5f - ((float) centerOffset.getX().getValue() / (float) iconImageWidth); float offsetY = 0.5f - ((float) centerOffset.getY().getValue() / (float) iconImageHeight); markerOptions.anchor(offsetX, offsetY); } }</code><technical_language>image handling in AnnotationProxy.handleImage() support multiple sources</technical_language>

Target:
protected void onBeforeClusterItemRendered(TiClusterMarker clusterItem, MarkerOptions markerOptions) { AnnotationProxy anno = clusterItem.getProxy(); if (anno.hasProperty(TiC.PROPERTY_IMAGE)) { handleImage(anno, markerOptions, anno.getProperty(TiC.PROPERTY_IMAGE)); } if (anno.hasProperty(MapModule.PROPERTY_CENTER_OFFSET)) { HashMap centerOffsetProperty = (HashMap) anno.getProperty(MapModule.PROPERTY_CENTER_OFFSET); TiPoint centerOffset = new TiPoint(centerOffsetProperty, 0.0, 0.0); float offsetX = 0.5f - ((float) centerOffset.getX().getValue() / (float) iconImageWidth); float offsetY = 0.5f - ((float) centerOffset.getY().getValue() / (float) iconImageHeight); markerOptions.anchor(offsetX, offsetY); } }
Source:
<code>public static long getSnapSizeInBytes() { long size = Long.getLong("zookeeper.snapSizeLimitInKb", 4194304L); <START> return size > 0 ? size * 1024 : size; END> }</code><technical_language>I need this check. return size * 1024</technical_language>

Target:
public static long getSnapSizeInBytes() { long size = Long.getLong("zookeeper.snapSizeLimitInKb", 4194304L); if (size <= 0) { LOG.info("zookeeper.snapSizeLimitInKb set to a non-positive value {}; disabling feature", size); } return size * 1024; }
Source:
<code><START> public int convert(int time) { <END> boolean timeRespectsSpeed = UserPreferences.timeRespectsSpeed(); if (time > 0 && timeRespectsSpeed) { float speed = Float.parseFloat(UserPreferences.getPlaybackSpeed()); return (int)(time / speed); } else { return time; } }</code><technical_language>this static</technical_language>

Target:
public static int convert(int time) { boolean timeRespectsSpeed = UserPreferences.timeRespectsSpeed(); if (time > 0 && timeRespectsSpeed) { float speed = Float.parseFloat(UserPreferences.getPlaybackSpeed()); return (int)(time / speed); } return time; }
Source:
<code>public void addClientLibraries(ClientLibraryType type, Collection<String> categories) { <START> Set<String> categoriesSet = clientLibraries.getOrDefault(type, new LinkedHashSet<>()); <END> for (String category : categories) { categoriesSet.add(category); } clientLibraries.put(type, categoriesSet); }</code><technical_language>this method simply call public void addClientLibraries(ClientLibraryType type, String... categories) converting collection array (or vice versa)? Codeclimate is gonna complain</technical_language>

Target:
public void addClientLibraries(ClientLibraryType type, Collection<String> categories) { Set<String> categoriesSet = clientLibraries.getOrDefault(type, new LinkedHashSet<>()); categoriesSet.addAll(categories); clientLibraries.put(type, categoriesSet); }
Source:
<code>public Iterable<ReleaseAsset> iterate() { return new RtPagination<ReleaseAsset>( this.request.uri().back() .method(Request.GET), new RtPagination.Mapping<ReleaseAsset, JsonObject>() { @Override public ReleaseAsset map(final JsonObject value) { return RtReleaseAssets.this.get( <START> value.getInt(ID) <END> ); } } ); }</code><technical_language>string literal</technical_language>

Target:
public Iterable<ReleaseAsset> iterate() { return new RtPagination<ReleaseAsset>( this.request.uri().back() .method(Request.GET), new RtPagination.Mapping<ReleaseAsset, JsonObject>() { @Override public ReleaseAsset map(final JsonObject value) { return RtReleaseAssets.this.get( value.getInt("id") ); } } ); }
Source:
<code>private void handleTitles(List<StructuredProperty> titleList, DataSetReference.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(titleList)) { <START> List<CharSequence> titles = new ArrayList<CharSequence>(); for (StructuredProperty titleProp : titleList) { if (fieldApprover.approve(titleProp.getDataInfo())) { titles.add(titleProp.getValue()); } } <END> metaBuilder.setTitles(titles); } }</code><technical_language>replaced streams java List<CharSequence> titles = titleList.stream() .filter(titleProp -> fieldApprover.approve(titleProp.getDataInfo())) .map(StructuredProperty::getValue) .collect(Collectors.toList());</technical_language>

Target:
private void handleTitles(List<StructuredProperty> titleList, DataSetReference.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(titleList)) { metaBuilder.setTitles(titleList.stream().filter(titleProp -> fieldApprover.approve(titleProp.getDataInfo())) .map(StructuredProperty::getValue).collect(Collectors.toList())); } }
Source:
<code>public void validate_contract_with_no_type_sub_children() throws Exception { final ProcessDefinitionBuilder builder = new ProcessDefinitionBuilder().createNewInstance("test", "1"); <START> builder.addContract().addInput("name", "desc").addChildren().addInput("name", "desc"); <END> expectedException.expect(InvalidProcessDefinitionException.class); expectedException.expectMessage("Type not set on the contract input <name> of contract of the process"); builder.done(); }</code><technical_language>name addChild()</technical_language>

Target:
public void validate_contract_with_no_type_sub_children() throws Exception { final ProcessDefinitionBuilder builder = new ProcessDefinitionBuilder().createNewInstance("test", "1"); builder.addContract().addInput("name", "desc").addChildren().addInput("name", "desc"); expectedException.expect(InvalidProcessDefinitionException.class); expectedException.expectMessage("Type not set on the contract input <name> on the process-level contract"); builder.done(); }
Source:
<code>private void initialCacheUpdate() { try { log.debug("Initial Cache update in progress.."); Collection<Condition> conditions = definitions.getAllConditions(); for (Condition c : conditions) { String triggerId = c.getTriggerId(); CacheKey cacheKey = new CacheKey(c.getTenantId(), c.getDataId()); initialPublish(cacheKey, triggerId); if (c instanceof CompareCondition) { String data2Id = ((CompareCondition) c).getData2Id(); CacheKey cacheKey2 = new CacheKey(c.getTenantId(), data2Id); initialPublish(cacheKey2, triggerId); } <START> } <END> log.debugf("Published after update=%s", publishCache.size()); if (log.isTraceEnabled()) { publishCache.entrySet().stream().forEach(e -> log.tracef("Published: %s", e.getValue())); } } catch (Exception e) { log.error("Failed to load conditions to create Id filters. All data being forwarded to alerting!", e); return; } }</code><technical_language>I guess big question is populate dataIdsCache in this initialCacheUpdate. need caches fully defined for mechanism work</technical_language>

Target:
private void initialCacheUpdate() { try { log.debug("Initial Cache update in progress.."); publishCache.startBatch(); publishDataIdsCache.startBatch(); Collection<Condition> conditions = definitions.getAllConditions(); for (Condition c : conditions) { String triggerId = c.getTriggerId(); TriggerKey triggerKey = new TriggerKey(c.getTenantId(), triggerId); Set<String> dataIds = new HashSet<>(); dataIds.add(c.getDataId()); if (c instanceof CompareCondition) { String data2Id = ((CompareCondition) c).getData2Id(); dataIds.add(data2Id); } Set<String> prevDataIds = publishDataIdsCache.get(triggerKey); if (prevDataIds == null) { prevDataIds = new HashSet<>(); } prevDataIds.addAll(dataIds); publishDataIdsCache.put(triggerKey, prevDataIds); addPublishCache(c.getTenantId(), triggerId, dataIds); } log.debugf("Published after update=%s", publishCache.size()); if (log.isTraceEnabled()) { publishCache.entrySet().stream().forEach(e -> log.tracef("Published: %s", e.getValue())); } publishDataIdsCache.endBatch(true); publishCache.endBatch(true); } catch (Exception e) { log.error("Failed to load conditions to create Id filters. All data being forwarded to alerting!", e); publishDataIdsCache.endBatch(false); publishCache.endBatch(false); return; } }
Source:
<code>private Guid getVdsToRunOn(Iterable<VDS> vdss, boolean isMigrate) { StringBuilder sb = new StringBuilder(); final List<VDS> readyToRun = new ArrayList<VDS>(); for (VDS curVds : vdss) { if (validateHostIsReadyToRun(curVds, sb, isMigrate) == ValidationResult.VALID&&validateHostIsTrusted(curVds)){ readyToRun.add(curVds); <START> } <END> } if (readyToRun.isEmpty()) { log.info(sb.toString()); return Guid.Empty; } else { if (log.isDebugEnabled()) { log.debug(sb.toString()); } return getBestVdsToRun(readyToRun); } }</code><technical_language>please project formatter format code</technical_language>

Target:
private Guid getVdsToRunOn(Iterable<VDS> vdss, boolean isMigrate) { StringBuilder sb = new StringBuilder(); final List<VDS> readyToRun = new ArrayList<VDS>(); for (VDS curVds : vdss) { if (validateHostIsReadyToRun(curVds, sb, isMigrate) == ValidationResult.VALID){ readyToRun.add(curVds); } } if (readyToRun.isEmpty()) { log.info(sb.toString()); return Guid.Empty; } else { if (log.isDebugEnabled()) { log.debug(sb.toString()); } return getBestVdsToRun(readyToRun); } }
Source:
<code>public void delta(Delta delta, PersistenceExceptionHandler exceptionHandler) { checkWritesAllowed(); while (!queuedDeltas.isEmpty()) { Delta extraDelta = queuedDeltas.remove(0); <START> doDelta(extraDelta, exceptionHandler, false); <END> } doDelta(delta, exceptionHandler, false); }</code><technical_language>this pass false for previouslyQueued</technical_language>

Target:
public void delta(Delta delta, PersistenceExceptionHandler exceptionHandler) { checkWritesAllowed(); while (!queuedDeltas.isEmpty()) { Delta extraDelta = queuedDeltas.remove(0); doDelta(extraDelta, exceptionHandler, true); } doDelta(delta, exceptionHandler, false); }
Source:
<code>public LiveStreamSettingsModule() { logger.debug("Creating a new instance of Modules.CuePointsManager"); <START> mapLiveEntryToBaseSystemTime = new HashMap<>(); <END> }</code><technical_language>thread-safe version of this</technical_language>

Target:
public LiveStreamSettingsModule() { logger.debug("Creating a new instance of Modules.CuePointsManager"); mapLiveEntryToBaseSystemTime = new ConcurrentHashMap<String, long[]>(); }
Source:
<code>public String getDescription() { <START> return "Taking a screenshot."; <END> }</code><technical_language>name get a description</technical_language>

Target:
public String getDescription() { return name; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_feedback); setTitle(getResources().getString(R.string.feedback_label)); Intent intent = this.getIntent(); CheckBox sendLogs = (CheckBox) findViewById(R.id.feedback_send_logs); if (intent != null) { <START> mAction = intent.getExtras().getString("CallingAction"); <END> if (mAction.equals("no")) { Log.d(TAG, "Thumbs down tapped"); dislikeButton = findViewById(R.id.ImageBtn_Dislike); dislikeButton.setSelected(true); } else if (mAction.equals("yes")) { Log.d(TAG, "Thumbs up tapped"); likeButton = findViewById(R.id.ImageBtn_like); likeButton.setSelected(true); } } if (Application.getPrefs() .getBoolean(getString(R.string.preferences_key_user_share_logs), true)) { sendLogs.setChecked(true); } else { sendLogs.setChecked(false); } }</code><technical_language>"CallingAction", "no" "yes" (and other intent extras actions) need defined public static final variables - put in FeedbackActivity reference here. (Note - "yes" "no" values user facing in UI need in strings.xml translated, case here)</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_feedback); setTitle(getResources().getString(R.string.feedback_label)); Intent intent = this.getIntent(); CheckBox sendLogs = (CheckBox) findViewById(R.id.feedback_send_logs); if (intent != null) { int response = intent.getIntExtra(RESPONSE, 0); mLogFile = intent.getExtras().getString(LOG_FILE); Log.d(TAG, "Intent LOG_FILE :" + mLogFile); if(response == FEEDBACK_YES) { mUserResponse = "yes"; } else { mUserResponse = "no"; } if (mUserResponse.equals("no")) { Log.d(TAG, "Thumbs down tapped"); dislikeButton = findViewById(R.id.ImageBtn_Dislike); dislikeButton.setSelected(true); } else if (mUserResponse.equals("yes")) { Log.d(TAG, "Thumbs up tapped"); likeButton = findViewById(R.id.ImageBtn_like); likeButton.setSelected(true); } } if (Application.getPrefs() .getBoolean(getString(R.string.preferences_key_user_share_logs), true)) { sendLogs.setChecked(true); } else { sendLogs.setChecked(false); } }
Source:
<code><START> public boolean isAccumulatorAnnotation(AnnotationMirror anm) { <END> return AnnotationUtils.areSameByClass(anm, ACC); }</code><technical_language>is this related TOP BOTTOM? Is true of TOP, possibly true? Is false of BOTTOM</technical_language>

Target:
public boolean isAccumulatorAnnotation(AnnotationMirror anm) { return AnnotationUtils.areSameByClass(anm, accumulator); }
Source:
<code>private static Graphic createGraphic(Map<String, Object> attributes) { int wkid = Integer.parseInt((String) attributes.get("_wkid")); SpatialReference sr = SpatialReference.create(wkid); PointCollection points = new PointCollection(sr); String[] coordinates = ((String) attributes.get("_control_points")).split(";"); <START> Stream.of(coordinates) <END> .map(cs -> cs.split(",")) .map(c -> new Point(Double.valueOf(c[0]), Double.valueOf(c[1]), sr)) .collect(Collectors.toCollection(() -> points)); return new Graphic(new Multipoint(points), attributes); }</code><technical_language>streams phones API 24</technical_language>

Target:
private static Graphic createGraphic(Map<String, Object> attributes) { int wkid = Integer.parseInt((String) attributes.get("_wkid")); SpatialReference spatialReference = SpatialReference.create(wkid); PointCollection points = new PointCollection(spatialReference); String[] coordinates = ((String) attributes.get("_control_points")).split(";"); if (coordinates.length > 0) { for (String ordinate : coordinates) { String[] pointCoordinate = ordinate.split(","); if (pointCoordinate.length > 0) { Point point = new Point(Double.valueOf(pointCoordinate[0]), Double.valueOf(pointCoordinate[1]), spatialReference); points.add(point); } } } return new Graphic(new Multipoint(points), attributes); }
Source:
<code>private static <T> T createFromUris(MetricsManager metricsManager, List<String> endpointUris, Class<T> type) { ServerListConfig serverListConfig = ImmutableServerListConfig.builder() .addAllServers(endpointUris) .sslConfiguration(SSL_CONFIGURATION) .build(); AuxiliaryRemotingParameters build = AuxiliaryRemotingParameters.builder() .shouldRetry(false) .shouldLimitPayload(false) .shouldSupportBlockingOperations(false) <START> .userAgent(UserAgent.of(UserAgent.Agent.of("atlasdb-jepsen", "1.2.3"))) <END> .build(); return AtlasDbHttpClients.createProxyWithQuickFailoverForTesting( metricsManager, serverListConfig, type, build); }</code><technical_language>UserAgent.Agent.DEFAULT_VERSION anymore</technical_language>

Target:
private static <T> T createFromUris(MetricsManager metricsManager, List<String> endpointUris, Class<T> type) { ServerListConfig serverListConfig = ImmutableServerListConfig.builder() .addAllServers(endpointUris) .sslConfiguration(SSL_CONFIGURATION) .build(); AuxiliaryRemotingParameters parameters = AuxiliaryRemotingParameters.builder() .shouldRetry(false) .shouldLimitPayload(false) .shouldSupportBlockingOperations(true) .userAgent(UserAgent.of(UserAgent.Agent.of("atlasdb-jepsen", UserAgent.Agent.DEFAULT_VERSION))) .build(); return AtlasDbHttpClients.createProxyWithQuickFailoverForTesting( metricsManager, serverListConfig, type, parameters); }
Source:
<code><START> public String getFileServiceUrl() { <END> return client.url(); }</code><technical_language>This return a URL</technical_language>

Target:
public URL getFileServiceUrl() { try { return new URL(azureFileStorageClient.url()); } catch (MalformedURLException e) { throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureFileStorageClient.url()), e); } }
Source:
<code>private HttpFuzzer createFuzzer( HttpMessage message, List<PayloadGeneratorMessageLocation<?>> fuzzLocations, HttpFuzzerOptions options, List<HttpFuzzerMessageProcessor> processors) { if (fuzzLocations.isEmpty()) { return null; } MessageLocationReplacer<HttpMessage> replacer = MessageLocationReplacers.getInstance() <START> .getMLR(HttpMessage.class, this.getMessageLocationClass()); <END> replacer.init(message); MultipleMessageLocationsReplacer<HttpMessage> multipleMessageLocationsReplacer; if (MessageLocationsReplacementStrategy.DEPTH_FIRST == options.getPayloadsReplacementStrategy()) { multipleMessageLocationsReplacer = new MultipleMessageLocationsDepthFirstReplacer<>(); } else { multipleMessageLocationsReplacer = new MultipleMessageLocationsBreadthFirstReplacer<>(); } SortedSet<MessageLocationReplacementGenerator<?, ?>> messageLocationReplacementGenerators = new TreeSet<>(); for (PayloadGeneratorMessageLocation<?> fuzzLocation : fuzzLocations) { messageLocationReplacementGenerators.add(fuzzLocation); } multipleMessageLocationsReplacer.init(replacer, messageLocationReplacementGenerators); return new HttpFuzzer( createFuzzerName(message), options, message, (List<MessageLocationReplacementGenerator<?, MessageLocationReplacement<?>>>) (ArrayList) fuzzLocations, multipleMessageLocationsReplacer, processors); }</code><technical_language>fuzzLocations.get(0).getMessageLocation().getClass()</technical_language>

Target:
private HttpFuzzer createFuzzer( HttpMessage message, List<PayloadGeneratorMessageLocation<?>> fuzzLocations, HttpFuzzerOptions options, List<HttpFuzzerMessageProcessor> processors) { if (fuzzLocations.isEmpty()) { return null; } MessageLocationReplacer<HttpMessage> replacer = MessageLocationReplacers.getInstance() .getMLR( HttpMessage.class, fuzzLocations.get(0).getMessageLocation().getClass()); replacer.init(message); MultipleMessageLocationsReplacer<HttpMessage> multipleMessageLocationsReplacer; if (MessageLocationsReplacementStrategy.DEPTH_FIRST == options.getPayloadsReplacementStrategy()) { multipleMessageLocationsReplacer = new MultipleMessageLocationsDepthFirstReplacer<>(); } else { multipleMessageLocationsReplacer = new MultipleMessageLocationsBreadthFirstReplacer<>(); } SortedSet<MessageLocationReplacementGenerator<?, ?>> messageLocationReplacementGenerators = new TreeSet<>(); for (PayloadGeneratorMessageLocation<?> fuzzLocation : fuzzLocations) { messageLocationReplacementGenerators.add(fuzzLocation); } multipleMessageLocationsReplacer.init(replacer, messageLocationReplacementGenerators); return new HttpFuzzer( createFuzzerName(message), options, message, (List<MessageLocationReplacementGenerator<?, MessageLocationReplacement<?>>>) (ArrayList) fuzzLocations, multipleMessageLocationsReplacer, processors); }
Source:
<code>public Comparable next() { if (!nextFetched) { value = peek(); nextFetched = true; } if (value == null) { throw new NoSuchElementException(); <START> } <END> nextFetched = false; index++; return value; }</code><technical_language>I 2 if statements replaced cleaner: if (!hasNext()) { throw new NoSuchElementException(); }</technical_language>

Target:
public Comparable next() { if (!hasNext()) { throw new NoSuchElementException(); } nextFetched = false; index++; return value; }
Source:
<code>public void testScopeWithDuplicateKey() throws Exception { swagger_file = new File(resourceLocation + File.separator + "swaggerFiles/APIScopeTest1.json"); String payload = readFromFile(swagger_file.getAbsolutePath()); HttpResponse updateResponse = apiPublisher.updateResourceOfAPI(SUPER_USER, apiName, apiVersion, payload); verifyResponse(updateResponse); HttpResponse httpResponse = apiPublisher.validateScope(ITEM_VIEW, AGENT_ROLE); verifyResponse(httpResponse); assertEquals(new JSONObject(httpResponse.getData()).get(SCOPE_EXISTANCE).toString(), "true", <START> "Error in scope creation with Invalid values. Scope : " + ITEM_VIEW); <END> }</code><technical_language>mention exact in assert message. In this case Error in scope creation duplicate key</technical_language>

Target:
public void testScopeWithDuplicateKey() throws Exception { swagger_file = new File(resourceLocation + File.separator + "swaggerFiles/APIScopeTest1.json"); String payload = readFromFile(swagger_file.getAbsolutePath()); HttpResponse updateResponse = apiPublisher.updateResourceOfAPI(SUPER_USER, apiName, apiVersion, payload); verifyResponse(updateResponse); HttpResponse httpResponse = apiPublisher.validateScope(ITEM_VIEW, AGENT_ROLE); verifyResponse(httpResponse); assertEquals(new JSONObject(httpResponse.getData()).get(SCOPE_EXISTANCE).toString(), "true", "Error in scope creation with duplicate key : " + ITEM_VIEW); }
Source:
<code>public String toString() { <START> StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append("{"); <END> sb.append("intArraysSize=").append(intArrays.size()).append(","); sb.append("borrowedIntArraysSize=").append(borrowedIntArrays.size()).append(","); sb.append("estimatedSizeInBytes=").append(estimatedSizeInBytes).append("}"); return sb.toString(); }</code><technical_language>@yingsu00 toStringHelper</technical_language>

Target:
public String toString() { return toStringHelper(this) .add("intArraysSize", intArrays.size()) .add("borrowedIntArraysSize", borrowedIntArrays.size()) .add("estimatedSizeInBytes", estimatedSizeInBytes) .toString(); }
Source:
<code>public boolean checkCancelEditQuestionButtonVisibility(int qnIndex) { WebElement cancelEditButton = browser.driver.findElement(By.xpath(" if (cancelEditButton.isDisplayed()) { return true; } else { <START> return false; <END> } }</code><technical_language>return cancelEditButton.isDisplayed()</technical_language>

Target:
public boolean checkCancelEditQuestionButtonVisibility(int qnIndex) { WebElement cancelEditButton = browser.driver.findElement(By.xpath(" return cancelEditButton.isDisplayed(); }
Source:
<code>public void equals_shouldReturnFalse_whenFieldsRefundReferenceIsDifferent() { <START> TransactionEvent event1 = new TransactionEvent(Type.REFUND, "charge", "success", extractState(EXTERNAL_SUBMITTED), 100L, ZonedDateTime.now(),null); <END> TransactionEvent event2 = new TransactionEvent(Type.REFUND, "charge", "submitted", extractState(EXTERNAL_SUBMITTED), 100L, ZonedDateTime.now(),null); assertThat(event1.equals(event2), is(false)); }</code><technical_language>Please actual user external IDs (and else in this file) reflect this null in practice</technical_language>

Target:
public void equals_shouldReturnFalse_whenFieldsRefundReferenceIsDifferent() { TransactionEvent event1 = new TransactionEvent(Type.REFUND, "charge", "success", extractState(EXTERNAL_SUBMITTED), 100L, ZonedDateTime.now(), USER_EXTERNAL_ID); TransactionEvent event2 = new TransactionEvent(Type.REFUND, "charge", "submitted", extractState(EXTERNAL_SUBMITTED), 100L, ZonedDateTime.now(),USER_EXTERNAL_ID); assertThat(event1.equals(event2), is(false)); }
Source:
<code><START> public List<T2<ClusterNode, Object>> recordedMessages(boolean stopRecord) { <END> synchronized (this) { List<T2<ClusterNode, Object>> msgs = recordedMsgs; recordedMsgs = new ArrayList<>(); if (stopRecord) recordClasses = null; return msgs; } }</code><technical_language>this change triggered a lot of dependant changes unrelated patch, making bigger real value. revert this change fix test avoid this method ? easily implement recording blockMessages a predicate returning false</technical_language>

Target:
public List<Object> recordedMessages(boolean stopRecord) { synchronized (this) { List<Object> msgs = recordedMsgs; recordedMsgs = new ArrayList<>(); if (stopRecord) recordClasses = null; return msgs; } }
Source:
<code>public Map<String, Map<String, Integer>> dumpHashTableStats() { <START> Map<String, Map<String, Integer>> ret = new HashMap<String, Map<String, Integer>>(); <END> if (leftHashTable != null) { ret.put(leftHashTable.name, leftHashTable.dumpStats()); } if (rightHashTable != null) { ret.put(rightHashTable.name, rightHashTable.dumpStats()); } return ret; }</code><technical_language>diamond operator here? Map<String, Map<String, Integer>> ret = new HashMap<>();</technical_language>

Target:
public Map<String, Map<String, Integer>> dumpHashTableStats() { Map<String, Map<String, Integer>> ret = new HashMap<>(); if (leftHashTable != null) { ret.put(leftHashTable.name, leftHashTable.dumpStats()); } if (rightHashTable != null) { ret.put(rightHashTable.name, rightHashTable.dumpStats()); } return ret; }
Source:
<code>public void run() { countDown--; if (countDown == 0) { <START> System.out.println("## interrupt"); <END> Thread.currentThread().interrupt(); } }</code><technical_language>I need this println</technical_language>

Target:
public void run() { countDown--; if (countDown == 0) { Thread.currentThread().interrupt(); } }
Source:
<code>private static void applyFrameBoundsHeuristics(FrameDesc a, FrameDesc b) { <START> int aEnd = a.getEnd(), bStart = b.getStart(); <END> if (aEnd != -1 && bStart != -1) { return; } long tsDiff = (b.getTimestamp() - a.getTimestamp()) & 0xFFFFFFFFL; if (tsDiff > (1L << 30) && tsDiff < (-(1L << 30) & 0xFFFFFFFFL)) { return; } else if (tsDiff >= (-(1L << 30) & 0xFFFFFFFFL)) { logger.warn("Frames that are out of order detected."); } else { int bMin = b.getMinSeen(), aMax = a.getMaxSeen(); int snDiff = (bMin - aMax) & 0xFFFF; if (bStart != -1 || aEnd != -1) { if (snDiff == 2) { if (aEnd == -1) { aEnd = (aMax + 1) & 0xFFFF; if (logger.isDebugEnabled()) { logger.debug("Guessed frame end=" + aEnd); } a.setEnd(aEnd); } else { bStart = (bMin - 1) & 0xFFFF; if (logger.isDebugEnabled()) { logger.debug("Guessed frame start=" + bStart); } b.setStart(bStart); } } else if (snDiff < 2 || snDiff > (-3 & 0xFFFF)) { logger.warn("Frame corruption or packets that are out of " + "order detected."); } } else { if (snDiff == 3) { bStart = (bMin - 1) & 0xFFFF; aEnd = (aMax + 1) & 0xFFFF; if (logger.isDebugEnabled()) { logger.debug( "Guessed frame start=" + bStart + ",end=" + aEnd); } a.setEnd(aEnd); b.setStart(bStart); } else if (snDiff < 3 || snDiff > (-4 & 0xFFFF)) { logger.warn("Frame corruption or packets that are out of" + " order detected."); } } } }</code><technical_language>gotcha...i this existing, unit in help? i.e. aEnd -> aLastSeqNum something. a thought</technical_language>

Target:
private static void applyFrameBoundsHeuristics(FrameDesc a, FrameDesc b) { int aLastSeqNum = a.getEnd(), bFirstSeqNum = b.getStart(); if (aLastSeqNum != -1 && bFirstSeqNum != -1) { return; } long tsDiff = (b.getTimestamp() - a.getTimestamp()) & 0xFFFFFFFFL; if (tsDiff > (1L << 30) && tsDiff < (-(1L << 30) & 0xFFFFFFFFL)) { return; } else if (tsDiff >= (-(1L << 30) & 0xFFFFFFFFL)) { logger.warn("Frames that are out of order detected."); } else { int bMinSeqNum = b.getMinSeen(), aMaxSeqNum = a.getMaxSeen(); int snDiff = (bMinSeqNum - aMaxSeqNum) & 0xFFFF; if (bFirstSeqNum != -1 || aLastSeqNum != -1) { if (snDiff == 2) { if (aLastSeqNum == -1) { aLastSeqNum = (aMaxSeqNum + 1) & 0xFFFF; if (logger.isDebugEnabled()) { logger.debug("Guessed frame end=" + aLastSeqNum); } a.setEnd(aLastSeqNum); } else { bFirstSeqNum = (bMinSeqNum - 1) & 0xFFFF; if (logger.isDebugEnabled()) { logger.debug("Guessed frame start=" + bFirstSeqNum); } b.setStart(bFirstSeqNum); } } else if (snDiff < 2 || snDiff > (-3 & 0xFFFF)) { logger.warn("Frame corruption or packets that are out of " + "order detected."); } } else { if (snDiff == 3) { bFirstSeqNum = (bMinSeqNum - 1) & 0xFFFF; aLastSeqNum = (aMaxSeqNum + 1) & 0xFFFF; if (logger.isDebugEnabled()) { logger.debug( "Guessed frame start=" + bFirstSeqNum + ",end=" + aLastSeqNum); } a.setEnd(aLastSeqNum); b.setStart(bFirstSeqNum); } else if (snDiff < 3 || snDiff > (-4 & 0xFFFF)) { logger.warn("Frame corruption or packets that are out of" + " order detected."); } } } }
Source:
<code>void resetLogic() { for (int i = 0; i < fieldSize; i++) <START> for (int j = 0; j < fieldSize; j++) fieldArray[i][j] = 0; <END> playerMark = CROSS_MARK; aIMark = ZERO_MARK; turn = 0; autoGameEnabled = false; }</code><technical_language>braces</technical_language>

Target:
void resetLogic() { for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) { fieldArray[i][j] = 0; } playerMark = CROSS_MARK; aIMark = ZERO_MARK; turn = 0; autoGameEnabled = false; }
Source:
<code><START> public void applyTo(Appendable appendable) throws IOException { <END> String date = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss").format(Calendar.getInstance().getTime()); appendable.append("<o:Title>"); appendable.append(title); appendable.append("</o:Title>"); appendable.append("<o:Author>"); appendable.append(author); appendable.append("</o:Author>"); appendable.append("<o:LastAuthor>"); appendable.append(author); appendable.append("</o:LastAuthor>"); appendable.append("<o:Revision>1</o:Revision><o:TotalTime>1332</o:TotalTime>"); appendable.append("<o:LastPrinted>"); appendable.append(date); appendable.append("</o:LastPrinted>"); appendable.append("<o:Created>"); appendable.append(date); appendable.append("</o:Created>"); appendable.append("<o:LastSaved>"); appendable.append(date); appendable.append("</o:LastSaved>"); appendable.append("<o:Pages>1</o:Pages><o:Words>0</o:Words><o:Characters>0</o:Characters>"); appendable.append("<o:Company>"); appendable.append("company"); appendable.append("</o:Company>"); appendable.append("<o:Lines>1</o:Lines><o:Paragraphs>1</o:Paragraphs><o:CharactersWithSpaces>0</o:CharactersWithSpaces><o:Version>1</o:Version>"); }</code><technical_language>Consider creating constants</technical_language>

Target:
public void applyTo(Appendable appendable) throws IOException { String date = new SimpleDateFormat(DATE).format(Calendar.getInstance().getTime()); appendable.append(O_TITLE); appendable.append(title); appendable.append(C_TITLE); appendable.append(O_AUTHOR); appendable.append(author); appendable.append(C_AUTHOR); appendable.append(O_LAST_AUTHOR); appendable.append(author); appendable.append(C_LAST_AUTHOR); appendable.append(REVISION_TIME); appendable.append(O_LAST_PRINTED); appendable.append(date); appendable.append(C_LAST_PRINTED); appendable.append(O_CREATED); appendable.append(date); appendable.append(C_CREATED); appendable.append(O_LAST_SAVED); appendable.append(date); appendable.append(C_LAST_SAVED); appendable.append(PAGES_WORDS_CHARACTERS); appendable.append(O_COMPANY); appendable.append("company"); appendable.append(C_COMPANY); appendable.append(LINES_PARAGRAPHS_CHARACTERS_WITH_SPACES__VERSION); }
Source:
<code>public static Map<String, List<QualifiedOafJsonRecord>> mapByColumnFamily(Iterable<InfoSpaceRecord> records) { Preconditions.checkNotNull(records); Map<String, List<QualifiedOafJsonRecord>> oafRecordsByFamilyMap = Maps.newHashMap(); for (InfoSpaceRecord record : records) { String columnFamily = record.getColumnFamily().toString(); List<QualifiedOafJsonRecord> storedRecords = oafRecordsByFamilyMap.get(columnFamily); if (storedRecords==null) { oafRecordsByFamilyMap.put(columnFamily, storedRecords = Lists.newArrayList()); <START> } <END> storedRecords.add(new QualifiedOafJsonRecord(record.getQualifier().toString(), record.getOafJson().toString())); } return oafRecordsByFamilyMap; }</code><technical_language>replace manual checking for missing mappings storedRecords = oafRecordsByFamilyMap.computeIfAbsent(columnFamily, -> newArrayList());</technical_language>

Target:
public static Map<String, List<QualifiedOafJsonRecord>> mapByColumnFamily(Iterable<InfoSpaceRecord> records) { Preconditions.checkNotNull(records); Map<String, List<QualifiedOafJsonRecord>> oafRecordsByFamilyMap = Maps.newHashMap(); for (InfoSpaceRecord record : records) { List<QualifiedOafJsonRecord> storedRecords = oafRecordsByFamilyMap.computeIfAbsent(record.getColumnFamily().toString(), k -> Lists.newArrayList()); storedRecords.add(new QualifiedOafJsonRecord(record.getQualifier().toString(), record.getOafJson().toString())); } return oafRecordsByFamilyMap; }
Source:
<code>protected void doExecute() { if (callback == null || session == null) { return; } try { int nbViewpointsInChange = (newSelectedViewpoints != null ? newSelectedViewpoints.size() + 1 : 0) + (newDeselectedViewpoints != null ? newDeselectedViewpoints.size() : 0); monitor.beginTask("Apply new viewpoints selection...", nbViewpointsInChange); if (newSelectedViewpoints != null) { List<Viewpoint> sorted = sortByDependencies(newSelectedViewpoints); <START> boolean securityExceptionOccured = false; <END> monitor.worked(1); for (final Viewpoint viewpoint : sorted) { monitor.subTask("Select viewpoint : " + new IdentifiedElementQuery(viewpoint).getLabel()); try { callback.selectViewpoint(viewpoint, session, createNewRepresentations, new SubProgressMonitor(monitor, 1)); } catch (SecurityException e) { securityExceptionOccured = true; } } if (securityExceptionOccured) { String viewpointsInErrorMessage = "Viewpoint"; if (newSelectedViewpoints.size() > 1) { viewpointsInErrorMessage += "s"; } for (Viewpoint nonSelectableViewpoint : newSelectedViewpoints) { viewpointsInErrorMessage += " '" + nonSelectableViewpoint.getName() + "', "; } viewpointsInErrorMessage = viewpointsInErrorMessage.substring(0, viewpointsInErrorMessage.lastIndexOf(", ")); String errorMessage = "Unable to activate " + viewpointsInErrorMessage + " because of insufficient rights. Please contact your administrator to modify your rights."; throw new SecurityException(errorMessage); } } if (newDeselectedViewpoints != null) { for (final Viewpoint viewpoint : newDeselectedViewpoints) { monitor.subTask("Deselect viewpoint : " + new IdentifiedElementQuery(viewpoint).getLabel()); callback.deselectViewpoint(viewpoint, session, new SubProgressMonitor(monitor, 1)); } } } finally { monitor.done(); } }</code><technical_language>keeping actual SecurityException instead of a boolean? new SecurityException create loses context/stack actual error</technical_language>

Target:
protected void doExecute() { if (callback == null || session == null) { return; } try { int nbViewpointsInChange = (newSelectedViewpoints != null ? newSelectedViewpoints.size() + 1 : 0) + (newDeselectedViewpoints != null ? newDeselectedViewpoints.size() : 0); monitor.beginTask("Apply new viewpoints selection...", nbViewpointsInChange); if (newSelectedViewpoints != null) { List<Viewpoint> sorted = sortByDependencies(newSelectedViewpoints); monitor.worked(1); for (final Viewpoint viewpoint : sorted) { monitor.subTask("Select viewpoint : " + new IdentifiedElementQuery(viewpoint).getLabel()); try { callback.selectViewpoint(viewpoint, session, createNewRepresentations, new SubProgressMonitor(monitor, 1)); } catch (SecurityException e) { String errorMessage = "Unable to activate viewpoint '" + viewpoint.getName() + "' because of insufficient rights."; throw new SecurityException(errorMessage, e); } } } if (newDeselectedViewpoints != null) { for (final Viewpoint viewpoint : newDeselectedViewpoints) { monitor.subTask("Deselect viewpoint : " + new IdentifiedElementQuery(viewpoint).getLabel()); callback.deselectViewpoint(viewpoint, session, new SubProgressMonitor(monitor, 1)); } } } finally { monitor.done(); } }
Source:
<code>public void toggleStars(final ToggleStarRequest req, final AsyncCallback<VoidResult> callback) { run(callback, new Action<VoidResult>() { public VoidResult run(final ReviewDb db) throws OrmException { final Account.Id me = getAccountId(); final Set<Change.Id> existing = currentUser.get().getStarredChanges(); List<StarredChange> add = new ArrayList<StarredChange>(); List<StarredChange.Key> remove = new ArrayList<StarredChange.Key>(); if (req.getAddSet() != null) { for (final Change.Id id : req.getAddSet()) { if (!existing.contains(id)) { <START> StarredChange.Key key = new StarredChange.Key(me, id); <END> add.add(new StarredChange(key)); } } } if (req.getRemoveSet() != null) { for (final Change.Id id : req.getRemoveSet()) { StarredChange.Key key = new StarredChange.Key(me, id); remove.add(key); } } db.starredChanges().insert(add); db.starredChanges().deleteKeys(remove); for (StarredChange sc : add) { starredChangesCache.evict(new StarredChange.Key(sc.getAccountId(), sc .getChangeId())); } for (StarredChange.Key key : remove) { starredChangesCache.evict(key); } return VoidResult.INSTANCE; } }); }</code><technical_language>this edit next in remove loop unnecessary</technical_language>

Target:
public void toggleStars(final ToggleStarRequest req, final AsyncCallback<VoidResult> callback) { run(callback, new Action<VoidResult>() { public VoidResult run(final ReviewDb db) throws OrmException { final Account.Id me = getAccountId(); final Set<Change.Id> existing = currentUser.get().getStarredChanges(); List<StarredChange> add = new ArrayList<StarredChange>(); List<StarredChange.Key> remove = new ArrayList<StarredChange.Key>(); if (req.getAddSet() != null) { for (final Change.Id id : req.getAddSet()) { if (!existing.contains(id)) { add.add(new StarredChange(new StarredChange.Key(me, id))); } } } if (req.getRemoveSet() != null) { for (final Change.Id id : req.getRemoveSet()) { remove.add(new StarredChange.Key(me, id)); } } db.starredChanges().insert(add); db.starredChanges().deleteKeys(remove); for (StarredChange sc : add) { starredChangesCache.evict(sc.getKey()); } for (StarredChange.Key key : remove) { starredChangesCache.evict(key); } return VoidResult.INSTANCE; } }); }
Source:
<code>public void testListStudentAddresses() throws NoSuchFieldException { Response response = given().headers(getAuthHeaders()) .get("/students/students/{ID}/addresses", TEST_STUDENT_ID); <START> if (roleIsAllowed(getRole(), studentPermissions, StudentPermissions.FEATURE_OWNED_GROUP_STUDENTS_RESTRICTION_TEST)) { <END> assertOk(response, studentPermissions, StudentPermissions.LIST_STUDENTADDRESSS, 403); } else { assertOk(response, studentPermissions, StudentPermissions.LIST_STUDENTADDRESSS); } }</code><technical_language>FEATURE_OWNED_GROUP_STUDENTS_RESTRICTION</technical_language>

Target:
public void testListStudentAddresses() throws NoSuchFieldException { Response response = given().headers(getAuthHeaders()) .get("/students/students/{ID}/addresses", TEST_STUDENT_ID); if (roleIsAllowed(getRole(), studentPermissions, StudentPermissions.FEATURE_OWNED_GROUP_STUDENTS_RESTRICTION)) { assertOk(response, studentPermissions, StudentPermissions.LIST_STUDENTADDRESSS, 403); } else { assertOk(response, studentPermissions, StudentPermissions.LIST_STUDENTADDRESSS); } }
Source:
<code>public static Config loadConfig(Config original) { JobConfig jobConfig = new JobConfig(original); Config fullConfig = original; if (jobConfig.getConfigLoaderFactory().isPresent()) { ConfigLoaderFactory factory = ReflectionUtil.getObj(jobConfig.getConfigLoaderFactory().get(), ConfigLoaderFactory.class); ConfigLoader loader = factory.getLoader(original.subset(ConfigLoaderFactory.CONFIG_LOADER_PROPERTIES_PREFIX)); fullConfig = override(ConfigUtil.rewriteConfig(loader.getConfig()), original); <START> } <END> return fullConfig; }</code><technical_language>Is exceptional case for ConfigLoaderFactory present here</technical_language>

Target:
public static Config loadConfig(Config original) { JobConfig jobConfig = new JobConfig(original); if (!jobConfig.getConfigLoaderFactory().isPresent()) { throw new ConfigException("Missing key " + JobConfig.CONFIG_LOADER_FACTORY + "."); } ConfigLoaderFactory factory = ReflectionUtil.getObj(jobConfig.getConfigLoaderFactory().get(), ConfigLoaderFactory.class); ConfigLoader loader = factory.getLoader(original.subset(ConfigLoaderFactory.CONFIG_LOADER_PROPERTIES_PREFIX)); return rewriteConfig(override(loader.getConfig(), original)); }
Source:
<code>public void testBlockwisePUTWithBegining413AndSmallerSZX() throws Exception { System.out.println("Blockwise PUT fails for excessive body size"); reqtPayload = generateRandomPayload(128 + 10); <START> respPayload = generateRandomPayload(30); <END> String path = "test"; Request request = createRequest(PUT, path, server); request.setPayload(reqtPayload); client.sendRequest(request); server.expectRequest(CON, PUT, path).storeBoth("A").block1(0, true, 128).size1(reqtPayload.length()).payload(reqtPayload, 0, 128).go(); server.sendResponse(ACK, REQUEST_ENTITY_TOO_LARGE).loadBoth("A").block1(0, false, 64).go(); server.expectRequest(CON, PUT, path).storeBoth("B").block1(0, true, 64).size1(reqtPayload.length()).payload(reqtPayload, 0, 64).go(); server.sendResponse(ACK, CONTINUE).loadBoth("B").block1(0, true, 64).go(); server.expectRequest(CON, PUT, path).storeBoth("C").block1(1, true, 64).payload(reqtPayload, 64, 128).go(); server.sendResponse(ACK, CONTINUE).loadBoth("C").block1(1, true, 64).go(); server.expectRequest(CON, PUT, path).storeBoth("D").block1(2, false, 64).payload(reqtPayload, 128, 138).go(); server.sendResponse(ACK, CHANGED).loadBoth("D").block1(2, false, 64).payload(respPayload).go(); Response response = request.waitForResponse(RESPONSE_TIMEOUT_IN_MS); assertResponseContainsExpectedPayload(response, CHANGED, respPayload); }</code><technical_language>big thing, I prefer payload in response for PUT</technical_language>

Target:
public void testBlockwisePUTWithBegining413AndSmallerSZX() throws Exception { System.out.println("Block1 with REQUEST_ENTITY_TOO_LARGE negotiation"); reqtPayload = generateRandomPayload(128 + 10); String path = "test"; Request request = createRequest(PUT, path, server); request.setPayload(reqtPayload); client.sendRequest(request); server.expectRequest(CON, PUT, path).storeBoth("A").block1(0, true, 128).size1(reqtPayload.length()).payload(reqtPayload, 0, 128).go(); server.sendResponse(ACK, REQUEST_ENTITY_TOO_LARGE).loadBoth("A").block1(0, false, 64).go(); server.expectRequest(CON, PUT, path).storeBoth("B").block1(0, true, 64).size1(reqtPayload.length()).payload(reqtPayload, 0, 64).go(); server.sendResponse(ACK, CONTINUE).loadBoth("B").block1(0, true, 64).go(); server.expectRequest(CON, PUT, path).storeBoth("C").block1(1, true, 64).payload(reqtPayload, 64, 128).go(); server.sendResponse(ACK, CONTINUE).loadBoth("C").block1(1, true, 64).go(); server.expectRequest(CON, PUT, path).storeBoth("D").block1(2, false, 64).payload(reqtPayload, 128, 138).go(); server.sendResponse(ACK, CHANGED).loadBoth("D").block1(2, false, 64).go(); Response response = request.waitForResponse(RESPONSE_TIMEOUT_IN_MS); assertThat(response, is(notNullValue())); assertThat(response.getPayloadSize(), is(0)); assertThat(response.getCode(), is(CHANGED)); assertThat(response.getToken(), is(request.getToken())); }
Source:
<code>public CommCareSession(CommCarePlatform platform) { this.platform = platform; collectedDatums = new OrderedHashtable(); this.frame = new SessionFrame(); <START> this.frameStack = new Stack<>(); <END> }</code><technical_language>this syntax work j2me :/</technical_language>

Target:
public CommCareSession(CommCarePlatform platform) { this.platform = platform; collectedDatums = new OrderedHashtable(); this.frame = new SessionFrame(); this.frameStack = new Stack<SessionFrame>(); }
Source:
<code>public static DirectConnectionConfig getDefaultConfig() { <START> return DirectConnectionConfig.defaultConfig; <END> }</code><technical_language>return a static singleton instance changing default for client affect other client defaults too. suggestion return new DirectConnectoinConfig()</technical_language>

Target:
public static DirectConnectionConfig getDefaultConfig() { return new DirectConnectionConfig(); }