auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testPhiroPlayToneBrick() { List<Integer> spinnerValuesResourceIds = Arrays.asList( R.string.phiro_tone_do, R.string.phiro_tone_re, <START> R.string.phiro_tone_mi, <END> R.string.phiro_tone_fa, R.string.phiro_tone_so, R.string.phiro_tone_la); checkIfBrickAtPositionShowsString(0, R.string.brick_when_started); checkIfBrickAtPositionShowsString(brickPosition, R.string.phiro_play_tone); checkIfValuesAvailableInSpinnerOnBrick(spinnerValuesResourceIds, R.id.brick_phiro_select_tone_spinner, brickPosition); enterValueInFormulaTextFieldOnBrickAtPosition(TONE_DURATION, R.id.brick_phiro_play_tone_duration_edit_text, brickPosition); }</code><technical_language>please move list initialization is used</technical_language>

Target:
public void testPhiroPlayToneBrick() { checkIfBrickAtPositionShowsString(0, R.string.brick_when_started); checkIfBrickAtPositionShowsString(brickPosition, R.string.phiro_play_tone); List<Integer> spinnerValuesResourceIds = Arrays.asList( R.string.phiro_tone_do, R.string.phiro_tone_re, R.string.phiro_tone_mi, R.string.phiro_tone_fa, R.string.phiro_tone_so, R.string.phiro_tone_la); checkIfValuesAvailableInSpinnerOnBrick(spinnerValuesResourceIds, R.id.brick_phiro_select_tone_spinner, brickPosition); enterValueInFormulaTextFieldOnBrickAtPosition(TONE_DURATION, R.id.brick_phiro_play_tone_duration_edit_text, brickPosition); }
Source:
<code>private static List<ITestNGMethod> retrieve(Set<String> tracker, Map<String, List<ITestNGMethod>> map, String group) { if (tracker.contains(group)) { <START> return new ArrayList<>(); <END> } tracker.add(group); return map.get(group); }</code><technical_language>emptyList? I list modified outside</technical_language>

Target:
private static List<ITestNGMethod> retrieve(Set<String> tracker, Map<String, List<ITestNGMethod>> map, String group) { if (tracker.contains(group)) { return Collections.EMPTY_LIST; } tracker.add(group); return map.get(group); }
Source:
<code>private int getExtendedFlags() { <START> if (!isExtended()) { <END> return 0; } return NB.decodeUInt16(info, infoOffset + P_FLAGS2) << 16; }</code><technical_language>I prefer: if (isExtended()) return NB.decodeUInt16(info, infoOffset + P_FLAGS2) << 16; else return 0;</technical_language>

Target:
private int getExtendedFlags() { if (isExtended()) return NB.decodeUInt16(info, infoOffset + P_FLAGS2) << 16; else return 0; }
Source:
<code>public void testHeaderWithInvalidRegexp() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); <START> checkConfig.addAttribute("headerFile", getPath("InputRegexp.invalid.header")); <END> final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; try { verify(checkConfig, getPath("InputRegexpHeaderMulti52.java"), expected); fail("IllegalArgumentException is expected"); } catch (IllegalArgumentException ex) { assertEquals("line 1 in header specification is not a regular expression", ex.getMessage()); } }</code><technical_language>Missed full file name. InputRegexp.invalid.header => InputRegexpHeader.invalid.header</technical_language>

Target:
public void testHeaderWithInvalidRegexp() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputRegexpHeader.invalid.header")); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; try { verify(checkConfig, getPath("InputRegexpHeaderMulti52.java"), expected); fail("IllegalArgumentException is expected"); } catch (IllegalArgumentException ex) { assertEquals("line 1 in header specification is not a regular expression", ex.getMessage()); } }
Source:
<code>public <T> T getObjectFromPropertyDefinition(PropertyDefinition propertyDefinition) throws ServiceLocalException { ServiceLocalException serviceException = null; OutParam<ServiceLocalException> serviceExceptionOut = new OutParam<ServiceLocalException>(); Object propertyValue = this.getPropertyValueOrException( propertyDefinition, serviceExceptionOut); serviceException = serviceExceptionOut.getParam(); if (serviceException == null) { <START> return (T) propertyValue; <END> } else { throw serviceException; } }</code><technical_language>cast is necessary propertyValue assigned Object? fix this aswell? I spotted other occurrences of object in this class</technical_language>

Target:
public <T> T getObjectFromPropertyDefinition(PropertyDefinition propertyDefinition) throws ServiceLocalException { OutParam<ServiceLocalException> serviceExceptionOut = new OutParam<ServiceLocalException>(); T propertyValue = getPropertyValueOrException(propertyDefinition, serviceExceptionOut); ServiceLocalException serviceException = serviceExceptionOut.getParam(); if (serviceException != null) { throw serviceException; } return propertyValue; }
Source:
<code>protected void removeInlineDeployments() { runtime.getComponentManager().reset(); <START> runtime.getComponentManager().start(); <END> }</code><technical_language>here, I reset stop component. is difference lines runtime.getComponentManager().restart(true);</technical_language>

Target:
protected void removeInlineDeployments() throws Exception { runtime.getComponentManager().reset(); runtime.getComponentManager().start(); postSetUp(); }
Source:
<code>private void decorateText(IDecoration decoration, IDecoratableResource resource) { String format = ""; switch (resource.getType()) { case IResource.FILE: format = store .getString(UIPreferences.DECORATOR_FILETEXT_DECORATION); break; case IResource.FOLDER: case DecoratableResourceMapping.RESOURCE_MAPPING: if (resource.isWorkingTreeRoot()) { format = store.getString( UIPreferences.DECORATOR_PROJECTTEXT_DECORATION); } else { format = store .getString(UIPreferences.DECORATOR_FOLDERTEXT_DECORATION); <START> } <END> break; case DecoratableResourceMapping.WORKING_SET: if (resource.getRepositoryName() != null && resource.getBranch() != null) format = store .getString(UIPreferences.DECORATOR_PROJECTTEXT_DECORATION); else format = store .getString(UIPreferences.DECORATOR_FOLDERTEXT_DECORATION); break; case IResource.PROJECT: format = store .getString(UIPreferences.DECORATOR_PROJECTTEXT_DECORATION); break; } Map<String, String> bindings = new HashMap<String, String>(); bindings.put(BINDING_RESOURCE_NAME, resource.getName()); bindings.put(BINDING_REPOSITORY_NAME, resource.getRepositoryName()); bindings.put(BINDING_BRANCH_NAME, resource.getBranch()); bindings.put(BINDING_BRANCH_STATUS, resource.getBranchStatus()); bindings.put(BINDING_DIRTY_FLAG, resource.isDirty() ? ">" : null); bindings.put(BINDING_STAGED_FLAG, resource.isStaged() ? "*" : null); decorate(decoration, format, bindings); }</code><technical_language>Heh :-) I this a unpublished change, too</technical_language>

Target:
private void decorateText(IDecoration decoration, IDecoratableResource resource) { String format = ""; switch (resource.getType()) { case IResource.FILE: format = store .getString(UIPreferences.DECORATOR_FILETEXT_DECORATION); break; case IResource.FOLDER: case DecoratableResourceMapping.RESOURCE_MAPPING: if (resource.isWorkingTreeRoot()) { format = store.getString( UIPreferences.DECORATOR_SUBMODULETEXT_DECORATION); } else { format = store.getString( UIPreferences.DECORATOR_FOLDERTEXT_DECORATION); } break; case DecoratableResourceMapping.WORKING_SET: if (resource.getRepositoryName() != null && resource.getBranch() != null) format = store .getString(UIPreferences.DECORATOR_PROJECTTEXT_DECORATION); else format = store .getString(UIPreferences.DECORATOR_FOLDERTEXT_DECORATION); break; case IResource.PROJECT: format = store .getString(UIPreferences.DECORATOR_PROJECTTEXT_DECORATION); break; } Map<String, String> bindings = new HashMap<String, String>(); bindings.put(BINDING_RESOURCE_NAME, resource.getName()); bindings.put(BINDING_REPOSITORY_NAME, resource.getRepositoryName()); bindings.put(BINDING_BRANCH_NAME, resource.getBranch()); bindings.put(BINDING_BRANCH_STATUS, resource.getBranchStatus()); bindings.put(BINDING_DIRTY_FLAG, resource.isDirty() ? ">" : null); bindings.put(BINDING_STAGED_FLAG, resource.isStaged() ? "*" : null); bindings.put(BINDING_SHORT_MESSAGE, resource.getCommitMessage()); decorate(decoration, format, bindings); }
Source:
<code>public void testForceRefreshWithoutAutoRefresh() throws Exception { changeSiriusPreference(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false); assertTrue("Diagram should be empty", firstDiag.getOwnedDiagramElements().isEmpty()); assertTrue("Diagram should be empty", secondDiag.getOwnedDiagramElements().isEmpty()); applyNodeCreationTool("createPackageWithRefresh", secondDiag, secondDiag); <START> assertEquals("Force <END> refresh diagram has not been refreshed.", 1, secondDiag.getOwnedDiagramElements().size()); assertTrue("The non 'force refresh' diagram has been refreshed whereas 'automatic refresh' is false.", firstDiag.getOwnedDiagramElements().isEmpty()); }</code><technical_language>user assertTrue a message of kind "Force refresh diagram refreshed. Bad diagram elements number in diagram x" assertEquals, junit automatically format message: <message> expected: xx current: yy</technical_language>

Target:
public void testForceRefreshWithoutAutoRefresh() throws Exception { changeSiriusPreference(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false); assertTrue("Diagram should be empty", firstDiag.getOwnedDiagramElements().isEmpty()); assertTrue("Diagram should be empty", secondDiag.getOwnedDiagramElements().isEmpty()); applyNodeCreationTool("createPackageWithRefresh", secondDiag, secondDiag); assertEquals("Force refresh diagram has not been refreshed. Bad diagram elements number in diagram " + secondDiag.getName(), 1, secondDiag.getOwnedDiagramElements().size()); assertTrue("The non 'force refresh' diagram has been refreshed whereas 'automatic refresh' is false.", firstDiag.getOwnedDiagramElements().isEmpty()); }
Source:
<code>private void getContainerStorageManagers() { Clock clock = SystemClock.instance(); StreamMetadataCache streamMetadataCache = new StreamMetadataCache(systemAdmins, 5000, clock); Map<String, SystemFactory> systemFactories = new JavaSystemConfig(jobConfig).getSystemFactories(); for (ContainerModel containerModel : containers.values()) { ContainerContext containerContext = new ContainerContextImpl(containerModel, new MetricsRegistryMap()); ContainerStorageManager containerStorageManager = new ContainerStorageManager(containerModel, streamMetadataCache, systemAdmins, changeLogSystemStreams, storageEngineFactories, systemFactories, this.getSerdes(), jobConfig, new HashMap<>(), new SamzaContainerMetrics(containerModel.getId(), new MetricsRegistryMap()), JobContextImpl.fromConfigWithDefaults(jobConfig), containerContext, new HashMap<>(), Optional.of(storeBaseDir), Optional.of(storeBaseDir), maxPartitionNumber, new SystemClock()); <START> this.containerStorageManagers.put(containerModel.getId(), containerStorageManager); <END> } }</code><technical_language>Do need this per-container</technical_language>

Target:
private void getContainerStorageManagers() { Clock clock = SystemClock.instance(); StreamMetadataCache streamMetadataCache = new StreamMetadataCache(systemAdmins, 5000, clock); Map<String, SystemFactory> systemFactories = new JavaSystemConfig(jobConfig).getSystemFactories(); for (ContainerModel containerModel : containers.values()) { ContainerContext containerContext = new ContainerContextImpl(containerModel, new MetricsRegistryMap()); ContainerStorageManager containerStorageManager = new ContainerStorageManager(containerModel, streamMetadataCache, systemAdmins, changeLogSystemStreams, storageEngineFactories, systemFactories, this.getSerdes(), jobConfig, new HashMap<>(), new SamzaContainerMetrics(containerModel.getId(), new MetricsRegistryMap()), JobContextImpl.fromConfigWithDefaults(jobConfig), containerContext, new HashMap<>(), storeBaseDir, storeBaseDir, maxPartitionNumber, new SystemClock()); this.containerStorageManagers.put(containerModel.getId(), containerStorageManager); } }
Source:
<code>public void testFourthToSixthVerses() { <START> String expectedVersesFourToSix - "On the fourth day of Chrsitmas my true love gave to me, " + <END> "four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n\n" + "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, " + "three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n\n" + "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, " + "four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" assertEquals(expectedVersesFourToSix, twelveDays.verses(4, 6)); }</code><technical_language>This = -, build is failing</technical_language>

Target:
public void testFourthToSixthVerses() { String expectedVersesFourToSix = "On the fourth day of Christmas my true love gave to me, " + "four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n\n" + "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, " + "three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n\n" + "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, " + "four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n"; assertEquals(expectedVersesFourToSix, twelveDays.verses(4, 6)); }
Source:
<code>public void init() { get( "/forms/query", (req, res) -> MAPPER.toJson( util.getMetacardsByFilter(FormAttributes.Query.TAG) .entrySet() .stream() .map(Map.Entry::getValue) .map(Result::getMetacard) .map(this::toFormTemplate) <START> .filter(Objects::nonNull) <END> .collect(Collectors.toList()))); get( "/forms/result", (req, res) -> MAPPER.toJson( util.getMetacardsByFilter(FormAttributes.Result.TAG) .entrySet() .stream() .map(Map.Entry::getValue) .map(Result::getMetacard) .map(this::toFieldFilter) .filter(Objects::nonNull) .collect(Collectors.toList()))); }</code><technical_language>if want streaming wrapped mapper function put mapper function optional 3rd parameter for spark methods. java get( "/forms/query", (req, res) -> util.getMetacardsByFilter(FormAttributes.Query.TAG) .entrySet() .stream() .map(Map.Entry::getValue) .map(Result::getMetacard) .map(this::toFormTemplate) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson);</technical_language>

Target:
public void init() { get( "/forms/query", (req, res) -> util.getMetacardsByFilter(QUERY_TEMPLATE_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFormTemplate) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); get( "/forms/result", (req, res) -> util.getMetacardsByFilter(ATTRIBUTE_GROUP_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFieldFilter) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); }
Source:
<code>public void patchNetId() throws Exception { context.turnOffAuthorisationSystem(); <START> <END> EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/netid", "newNetId"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.netid", Matchers.is("newNetId"))); }</code><technical_language>above, check for changes</technical_language>

Target:
public void patchNetId() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .withNetId("testId") .build(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/netid", "newNetId"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.netid", Matchers.is("newNetId"))) .andExpect(jsonPath("$.email", Matchers.is("johndoe@fake-email.com"))) .andExpect(jsonPath("$.canLogIn", Matchers.is(false))); }
Source:
<code>public EventReceiverFirehoseFactory( @JsonProperty("serviceName") String serviceName, @JsonProperty("firehoseId") String firehoseId, @JsonProperty("bufferSize") Integer bufferSize, @JsonProperty("parser") MapInputRowParser parser, @JacksonInject ChatHandlerProvider chatHandlerProvider, @JacksonInject EventReceiverFirehoseFactoryConfig config ) { if (serviceName == null) { serviceName = String.format("%s:%s", config.getFirehoseIdPrefix(), Preconditions.checkNotNull(firehoseId, "firehoseId") ); } <START> this.serviceName = Preconditions.checkNotNull(serviceName, "serviceName"); <END> this.bufferSize = bufferSize == null || bufferSize <= 0 ? DEFAULT_BUFFER_SIZE : bufferSize; this.parser = Preconditions.checkNotNull(parser, "parser"); this.chatHandlerProvider = Optional.fromNullable(chatHandlerProvider); }</code><technical_language>this in else</technical_language>

Target:
public EventReceiverFirehoseFactory( @JsonProperty("serviceName") String serviceName, @JsonProperty("firehoseId") String firehoseId, @JsonProperty("bufferSize") Integer bufferSize, @JsonProperty("parser") MapInputRowParser parser, @JacksonInject ChatHandlerProvider chatHandlerProvider, @JacksonInject EventReceiverFirehoseFactoryConfig config ) { if (serviceName == null) { this.serviceName = String.format( "%s:%s", config.getFirehoseIdPrefix(), Preconditions.checkNotNull(firehoseId, "firehoseId") ); } else { this.serviceName = Preconditions.checkNotNull(serviceName, "serviceName"); } this.config = config; this.bufferSize = bufferSize == null || bufferSize <= 0 ? DEFAULT_BUFFER_SIZE : bufferSize; this.parser = Preconditions.checkNotNull(parser, "parser"); this.chatHandlerProvider = Optional.fromNullable(chatHandlerProvider); }
Source:
<code>public EntitleByProductsJobConfig() { this.setJobKey(JOB_KEY) .setJobName(JOB_NAME) <START> .addConstraint(JobConstraints.uniqueByArguments(OWNER_KEY)); <END> }</code><technical_language>original job extend UniqueByEntityJob, implement isSchedulable/scheduleJob methods, is need for constraints this job</technical_language>

Target:
public EntitleByProductsJobConfig() { this.setJobKey(JOB_KEY) .setJobName(JOB_NAME); }
Source:
<code>public DelegatingResourceDescription getCreatableProperties() { DelegatingResourceDescription description = new DelegatingResourceDescription(); <START> description.addProperty("allergyId"); <END> description.addProperty("allergen"); description.addProperty("severity"); description.addProperty("comment"); description.addProperty("reactions"); return description; }</code><technical_language>id is creatable</technical_language>

Target:
public DelegatingResourceDescription getCreatableProperties() { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addRequiredProperty("allergen"); description.addProperty("severity"); description.addProperty("comment"); description.addProperty("reactions"); return description; }
Source:
<code>public void setMethodInfo(ICPPASTFunctionDefinition functionDefinition, ICPPMethod classMethod) { method = classMethod; returnNoConstRef = false; <START> IASTPointerOperator[] ptr = functionDefinition.getDeclarator().getPointerOperators(); <END> if (ptr.length > 0 && ptr[0] instanceof ICPPASTReferenceOperator) { returnNoConstRef = !functionDefinition.getDeclSpecifier().isConst(); } isOverloadedOperator = isOverloadedOperator(classMethod.getName()); if (method.isStatic()) { checkerMode = CheckerMode.MODE_STATIC; } else if (method.getType().isConst()) { checkerMode = CheckerMode.MODE_CONST; } else { checkerMode = CheckerMode.MODE_NON_CONST; } classMembersAreUsed = false; classMembersAreWritten = false; hasProblems = false; isVirtual = null; }</code><technical_language>Reasoning return type based syntax miss some cases. For example: // Reference const, const is // in decl-specifier. ConstInt = const int; ConstInt& foo(); // Reference non-const, pointer operator // is in function declarator. IntRef = int&; IntRef bar(); Instead, get semantic return type (method.getType().getReturnType()) perform checks that</technical_language>

Target:
public void setMethodInfo(ICPPASTFunctionDefinition functionDefinition, ICPPMethod classMethod) { method = classMethod; returnNoConstRef = false; IType retTyoe = SemanticUtil.getNestedType(method.getType().getReturnType(), SemanticUtil.TDEF); if (retTyoe instanceof ICPPReferenceType && !SemanticUtil.isConst(retTyoe)) { returnNoConstRef = true; } isOverloadedOperator = isOverloadedOperator(classMethod.getName()); if (method.isStatic()) { checkerMode = CheckerMode.MODE_STATIC; } else if (method.getType().isConst()) { checkerMode = CheckerMode.MODE_CONST; } else { checkerMode = CheckerMode.MODE_NON_CONST; } classMembersAreUsed = false; classMembersAreWritten = false; hasProblems = false; isVirtual = null; }
Source:
<code><START> protected ObjectId commit(final Merger m, final CommitBuilder mergeCommit) <END> throws IOException, UnsupportedEncodingException { ObjectInserter oi = m.getObjectInserter(); try { ObjectId id = oi.insert(mergeCommit); oi.flush(); return id; } finally { oi.release(); } }</code><technical_language>subclasses allowed override this method</technical_language>

Target:
protected final ObjectId commit(final Merger m, final CommitBuilder mergeCommit) throws IOException, UnsupportedEncodingException { ObjectInserter oi = m.getObjectInserter(); try { ObjectId id = oi.insert(mergeCommit); oi.flush(); return id; } finally { oi.release(); } }
Source:
<code>public static StarlarkInt subtract(StarlarkInt x, StarlarkInt y) { if (x instanceof Int32 && y instanceof Int32) { long xl = ((Int32) x).v; long yl = ((Int32) y).v; return StarlarkInt.of(xl - yl); } try { long xl = x.toLongFast(); long yl = y.toLongFast(); long r = xl - yl; <START> boolean overflow = ((xl >= 0) != (yl >= 0)) && ((yl >= 0) == (r >= 0)); <END> if (!overflow) { return StarlarkInt.of(r); } } catch (OverflowException ignore) { } BigInteger xbig = x.toBigInteger(); BigInteger ybig = y.toBigInteger(); BigInteger zbig = xbig.subtract(ybig); return StarlarkInt.of(zbig); }</code><technical_language>overflow = ((xl ^ yl) & (xl ^ zl)) < 0;</technical_language>

Target:
public static StarlarkInt subtract(StarlarkInt x, StarlarkInt y) { if (x instanceof Int32 && y instanceof Int32) { long xl = ((Int32) x).v; long yl = ((Int32) y).v; return StarlarkInt.of(xl - yl); } try { long xl = x.toLongFast(); long yl = y.toLongFast(); long zl = xl - yl; boolean overflow = ((xl ^ yl) & (xl ^ zl)) < 0; if (!overflow) { return StarlarkInt.of(zl); } } catch (Overflow unused) { } BigInteger xbig = x.toBigInteger(); BigInteger ybig = y.toBigInteger(); BigInteger zbig = xbig.subtract(ybig); return StarlarkInt.of(zbig); }
Source:
<code>public void includeResource(Resource resource) { if (resourcesToInclude != null) { for (Resource res : resourcesToInclude) { if (res.getProviderName().equals(resource.getProviderName()) && res.getResourcePath().equals(resource.getResourcePath())) { throw new UiFrameworkException("Resource '"+ resource.getResourcePath() +"' Already Included in PageContext"); } <START> } <END> resourcesToInclude.add(resource); } else { resourcesToInclude.add(resource); } }</code><technical_language>line result problems</technical_language>

Target:
public void includeResource(Resource resource) { Iterator<Resource> iterator = resourcesToInclude.iterator(); while (iterator.hasNext()) { Resource res = iterator.next(); if (res.getProviderName().equals(resource.getProviderName()) && res.getResourcePath().equals(resource.getResourcePath())) { if (res.getPriority() < resource.getPriority()) { iterator.remove(); resourcesToInclude.add(resource); } return; } } resourcesToInclude.add(resource); }
Source:
<code>public static Set<String> findCaches(Properties properties) { Set<String> caches = new HashSet<>(); caches.add(properties.getProperty(ENTITY_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); caches.add(properties.getProperty(COLLECTION_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); <START> caches.add(properties.getProperty(COLLECTION_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); <END> caches.add(properties.getProperty(NATURAL_ID_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); if (Boolean.parseBoolean(properties.getProperty(AvailableSettings.USE_QUERY_CACHE))) { caches.add(properties.getProperty(QUERY_CACHE_RESOURCE_PROP, DEF_QUERY_RESOURCE)); caches.add(properties.getProperty(TIMESTAMPS_CACHE_RESOURCE_PROP, DEF_QUERY_RESOURCE)); } int length = INFINISPAN_CONFIG_RESOURCE_PROP.length(); String customRegionPrefix = INFINISPAN_CONFIG_RESOURCE_PROP.substring(0, length - 3) + properties.getProperty(AvailableSettings.CACHE_REGION_PREFIX, ""); String customRegionSuffix = INFINISPAN_CONFIG_RESOURCE_PROP.substring(length - 4, length); for (String propertyName : properties.stringPropertyNames()) { if (propertyName.startsWith(customRegionPrefix) && propertyName.endsWith(customRegionSuffix)) { caches.add(properties.getProperty(propertyName)); } } return caches; }</code><technical_language>Please remove of duplicate calls caches.add(properties.getProperty(COLLECTION_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE))</technical_language>

Target:
public static Set<String> findCaches(Properties properties) { Set<String> caches = new HashSet<>(); caches.add(properties.getProperty(ENTITY_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); caches.add(properties.getProperty(COLLECTION_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); caches.add(properties.getProperty(NATURAL_ID_CACHE_RESOURCE_PROP, DEF_ENTITY_RESOURCE)); if (Boolean.parseBoolean(properties.getProperty(AvailableSettings.USE_QUERY_CACHE))) { caches.add(properties.getProperty(QUERY_CACHE_RESOURCE_PROP, DEF_QUERY_RESOURCE)); caches.add(properties.getProperty(TIMESTAMPS_CACHE_RESOURCE_PROP, DEF_QUERY_RESOURCE)); } int length = INFINISPAN_CONFIG_RESOURCE_PROP.length(); String customRegionPrefix = INFINISPAN_CONFIG_RESOURCE_PROP.substring(0, length - 3) + properties.getProperty(AvailableSettings.CACHE_REGION_PREFIX, ""); String customRegionSuffix = INFINISPAN_CONFIG_RESOURCE_PROP.substring(length - 4, length); for (String propertyName : properties.stringPropertyNames()) { if (propertyName.startsWith(customRegionPrefix) && propertyName.endsWith(customRegionSuffix)) { caches.add(properties.getProperty(propertyName)); } } return caches; }
Source:
<code>public void stop() { masterGroup.shutdownGracefully(); <START> workerGroup.shutdownGracefully(); <END> port = Optional.empty(); ip = Optional.empty(); }</code><technical_language>wait for futures here</technical_language>

Target:
public void stop() { CompletableFuture<?> masterGroupShutdown = wrapShutdownFuture(masterGroup.shutdownGracefully()); CompletableFuture<?> workerGroupShutdown = wrapShutdownFuture(workerGroup.shutdownGracefully()); try { CompletableFuture.allOf(masterGroupShutdown, workerGroupShutdown).get(); } catch (Exception e) { logger.errorWhileShuttingDown(e); } port = Optional.empty(); ip = Optional.empty(); }
Source:
<code>public void testSimulatePackfileReplacement() throws Exception { File f1 = createFile("file"); File f2 = createFile("fool"); waitNextSec(f1); waitNextSec(f1); <START> FileTime timestamp = Files.getLastModifiedTime(f1.toPath()); <END> FileSnapshot save = FileSnapshot.save(f1); Files.move(f2.toPath(), f1.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); Files.setLastModifiedTime(f1.toPath(), timestamp); assertTrue(save.isModified(f1)); }</code><technical_language>Ah, I waitNextSec() calls there. this do intended. A side-effect of waitNextSec is updates last-modified time of file. do waitNextSec(f2); waitNextSec(f2); (since interested in last-modified time of f2 anyway), FileTime timestamp = Files.getLastModifiedTime(f1.toPath()); Thread.sleep(FS.getFsTimerResolution(f1.getParentFile().toPath()).multipliedBy(2).toMillis() + 1); FileSnapshot save = FileSnapshot.save(f1); more complicated is easier understand</technical_language>

Target:
public void testSimulatePackfileReplacement() throws Exception { File f1 = createFile("file"); File f2 = createFile("fool"); waitNextSec(f2); waitNextSec(f2); FileTime timestamp = Files.getLastModifiedTime(f1.toPath()); FileSnapshot save = FileSnapshot.save(f1); Files.move(f2.toPath(), f1.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); Files.setLastModifiedTime(f1.toPath(), timestamp); assertTrue(save.isModified(f1)); }
Source:
<code>public boolean incrementToken() throws IOException { if (input.incrementToken()) { <START> final int <END> newlen = STEMMER.stem(termAtt.buffer(), termAtt.length()); termAtt.setLength(newlen); return true; } else { return false; } }</code><technical_language>nitpick: real need mark this final, scope of this var is short</technical_language>

Target:
public boolean incrementToken() throws IOException { if (input.incrementToken()) { int newlen = STEMMER.stem(termAtt.buffer(), termAtt.length()); termAtt.setLength(newlen); return true; } return false; }
Source:
<code>public void update(Command command) throws IllegalArgumentException { if (command instanceof UpDownType) { <START> throw new IllegalStateException("Cannot call update() with UpDownType"); <END> } else if (command instanceof StopMoveType) { throw new IllegalStateException("Cannot call update() with StopMoveType"); } else if (command instanceof PercentType) { state = (PercentType) command; } else { throw new IllegalStateException("Cannot call update() with custom stop/move/up/down"); } }</code><technical_language>Why? UpDownType implements State, updates valid (and correspond 0 100)</technical_language>

Target:
public void update(Command command) throws IllegalArgumentException { if (command instanceof StopMoveType) { throw new IllegalStateException("Cannot call update() with StopMoveType"); } else if (command instanceof PercentType) { state = (PercentType) command; } else { throw new IllegalStateException("Cannot call update() with custom stop/move/up/down"); } }
Source:
<code>void method2(java.util.HashSet<String> set) { java.util.Map<String, String> map1 = new java.util.LinkedHashMap<String, String>() {{ put("Hello", "World"); put("first", "second"); put("polygene", "lubricants"); put("alpha", "betical");} }; java.util.Map<String, String> map2 = new java.util.LinkedHashMap<String, String>() {{ put("Hello", "World"); put("first", "second"); put("polygene", "lubricants"); put("alpha", "betical"); }}; <START> java.util.Map<String, String> map3 = new java.util.LinkedHashMap<String, String>() {{ <END> put("Hello", "World"); put("first", "second"); put("polygene", "lubricants"); }{}; }; }</code><technical_language>Please put this test case bottom of file line numbers in test changed</technical_language>

Target:
void method2(java.util.HashSet<String> set) { java.util.Map<String, String> map1 = new java.util.LinkedHashMap<String, String>() {{ put("Hello", "World"); put("first", "second"); put("polygene", "lubricants"); put("alpha", "betical");} }; java.util.Map<String, String> map2 = new java.util.LinkedHashMap<String, String>() {{ put("Hello", "World"); put("first", "second"); put("polygene", "lubricants"); put("alpha", "betical"); }}; }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getName()).append(" {"); Iterator<Entry<String, Object>> attributes = constructSerializationAttributes().entrySet().iterator(); <START> builder.append(attributes.next()); <END> while (attributes.hasNext()) { builder.append(", ").append(attributes.next()); } builder.append("}"); return builder.toString(); }</code><technical_language>I write here, this fail if attributes empty, if 'constructSerializationAttribues' overriden, override provide attributes</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getName()).append(" {"); Map<String, Object> attributes = constructSerializationAttributes(); if (attributes != null && !attributes.isEmpty()) { Iterator<Entry<String, Object>> i = attributes.entrySet().iterator(); builder.append(i.next()); while (i.hasNext()) { builder.append(", ").append(i.next()); } } builder.append("}"); return builder.toString(); }
Source:
<code>public void testConstructorPrice() { assertEquals(animals.getItemPrice(), 30); assertEquals(radioactive.getItemPrice(), 0); assertEquals(duckTales.getItemPrice(), 20); assertEquals(mario.getItemPrice(), 100); assertEquals(nyanCat.getItemPrice(), 90); <START> assertEquals(shakeItOff.getItemPrice(), 70); <END> }</code><technical_language>checkstyle is exploding "magic numbers" here. easily constants Items I think. if not, please numbers constant fields in test. <review,testing,logic</technical_language>

Target:
public void testConstructorPrice() { assertEquals(animals.getItemPrice(), ANIMALS_PRCICE); assertEquals(radioactive.getItemPrice(), RADIOACTIVE_PRICE); assertEquals(duckTales.getItemPrice(), DUCKTALES_PRICE); assertEquals(mario.getItemPrice(), MARIO_PRICE); assertEquals(nyanCat.getItemPrice(), NYANCAT_PRICE); assertEquals(shakeItOff.getItemPrice(), SHAKEITOFF_PRICE); }
Source:
<code>public static void main(String[] args) throws Exception { HashMap<String, ClientCommand> commands = new HashMap<String, ClientCommand>(); HelpCommand help = new HelpCommand(commands); commands.put("help", help); commands.put("launch", new LaunchCommand()); commands.put("stopNimbus", new StopNimbusCommand()); String commandName = null; String[] commandArgs = null; if (args.length < 1) { commandName = "help"; commandArgs = new String[0]; } else { commandName = args[0]; commandArgs = Arrays.copyOfRange(args, 1, args.length); } ClientCommand command = commands.get(commandName); if(command == null) { System.err.println("ERROR: " + commandName + " is not a supported command."); help.printHelpFor(null); System.exit(1); } Options opts = command.getOpts(); if(!opts.hasOption("h")) { opts.addOption("h", "help", false, "print out a help message"); } CommandLine cl = new GnuParser().parse(command.getOpts(), commandArgs); if(cl.hasOption("help")) { help.printHelpFor(Arrays.asList(commandName)); } else { @SuppressWarnings("rawtypes") List remaining_args = cl.getArgList(); String config_file = null; <START> if (!remaining_args.isEmpty()) <END> config_file = (String)remaining_args.get(0); Map storm_conf = Config.readStormConfig(config_file); command.process(cl, storm_conf); } }</code><technical_language>This do want do. If I run storm-yarn foo try load a yaml file called foo. This is for other commands. I a command line option framework adds in, a for command override/turn generic option. commands want argument config file load</technical_language>

Target:
public static void main(String[] args) throws Exception { HashMap<String, ClientCommand> commands = new HashMap<String, ClientCommand>(); HelpCommand help = new HelpCommand(commands); commands.put("help", help); commands.put("launch", new LaunchCommand()); commands.put("stopNimbus", new StopNimbusCommand()); String commandName = null; String[] commandArgs = null; if (args.length < 1) { commandName = "help"; commandArgs = new String[0]; } else { commandName = args[0]; commandArgs = Arrays.copyOfRange(args, 1, args.length); } ClientCommand command = commands.get(commandName); if(command == null) { System.err.println("ERROR: " + commandName + " is not a supported command."); help.printHelpFor(null); System.exit(1); } Options opts = command.getOpts(); if(!opts.hasOption("h")) { opts.addOption("h", "help", false, "print out a help message"); } CommandLine cl = new GnuParser().parse(command.getOpts(), commandArgs); if(cl.hasOption("help")) { help.printHelpFor(Arrays.asList(commandName)); } else { String config_file = null; if (commandName.equals("launch") || commandName.equals("stopNimbus")) { List remaining_args = cl.getArgList(); if (remaining_args!=null) config_file = (String)remaining_args.get(0); } Map storm_conf = Config.readStormConfig(config_file); command.process(cl, storm_conf); } }
Source:
<code>public void destroy() { Integer max = 0; String key = null; for(Map.Entry<String, Integer> elem : matchingWords.entrySet()) { if (elem.getValue() > max) { max = elem.getValue(); key = elem.getKey(); } } FileWriter writer = null; try { writer = new FileWriter(new File(MATCHING_WORDS_FILE_PATH)); writer.write(key); } catch(Exception ex) { <START> ex.printStackTrace(); <END> } finally { try { writer.close(); } catch (IOException e) { e.printStackTrace(); } } }</code><technical_language>For error reporting, please logging instead</technical_language>

Target:
public void destroy() { findAndStoreTheMostUsedWord(); }
Source:
<code>private Response resetOption(Action action, String optionName, String optionValue, boolean force) { return doAction(ActionType.ResetGlusterVolumeOptions, <START> new ResetGlusterVolumeOptionsParameters(guid, <END> new GlusterVolumeOptionEntity(guid, optionName, optionValue), force), action); }</code><technical_language>I approach pass null for GlusterVolumeOptionEntity resetAllOptions , i.e optionName is null</technical_language>

Target:
private Response resetOption(Action action, String optionName, String optionValue, boolean force) { return doAction(ActionType.ResetGlusterVolumeOptions, new ResetGlusterVolumeOptionsParameters(guid, optionName == null ? null : new GlusterVolumeOptionEntity(guid, optionName, optionValue), force), action); }
Source:
<code>public void shouldUpdatePatientIdentifiers() throws InterruptedException { Patient testPatient = patientAdapter.getPatientByMotechId(DEFAULT_CONFIG_NAME, patient.getMotechId()); <START> String newOldIdentificationNumber = "612"; <END> testPatient.getIdentifiers().get(0).setIdentifier(newOldIdentificationNumber); synchronized (lock) { patientAdapter.updatePatientIdentifiers(DEFAULT_CONFIG_NAME, testPatient); lock.wait(60000); } Patient updated = patientAdapter.getPatientByUuid(DEFAULT_CONFIG_NAME, testPatient.getUuid()); assertEquals("Old Identification Number", updated.getIdentifiers().get(0).getIdentifierType().getDisplay()); assertEquals(newOldIdentificationNumber, updated.getIdentifiers().get(0).getIdentifier()); }</code><technical_language>newOld</technical_language>

Target:
public void shouldUpdatePatientIdentifiers() throws InterruptedException { Patient testPatient = patientAdapter.getPatientByMotechId(DEFAULT_CONFIG_NAME, patient.getMotechId()); String newIdentifiactionNumber = "612"; testPatient.getIdentifiers().get(0).setIdentifier(newIdentifiactionNumber); synchronized (lock) { patientAdapter.updatePatientIdentifiers(DEFAULT_CONFIG_NAME, testPatient); lock.wait(60000); } Patient updated = patientAdapter.getPatientByUuid(DEFAULT_CONFIG_NAME, testPatient.getUuid()); assertEquals("Old Identification Number", updated.getIdentifiers().get(0).getIdentifierType().getName()); assertEquals(newIdentifiactionNumber, updated.getIdentifiers().get(0).getIdentifier()); }
Source:
<code>public void destroyTicketGrantingTicket(final WebContext context, final HttpTGTProfile profile) { HttpURLConnection connection = null; try { final URL endpointURL = new URL(getAuthenticator().getCasRestUrl()); final URL deleteURL = new URL(endpointURL, endpointURL.getPath() + "/" + profile.getTicketGrantingTicketId()); <START> connection = HttpUtils.openPostConnection(deleteURL); <END> final int responseCode = connection.getResponseCode(); if (responseCode != HttpStatus.SC_OK) { throw new TechnicalException("TGT delete request for `" + profile + "` failed: " + HttpUtils.buildHttpErrorMessage(connection)); } } catch (final IOException e) { throw new TechnicalException(e); } finally { HttpUtils.closeConnection(connection); } }</code><technical_language>openDeleteConnection, it</technical_language>

Target:
public void destroyTicketGrantingTicket(final WebContext context, final HttpTGTProfile profile) { HttpURLConnection connection = null; try { final URL endpointURL = new URL(getAuthenticator().getCasRestUrl()); final URL deleteURL = new URL(endpointURL, endpointURL.getPath() + "/" + profile.getTicketGrantingTicketId()); connection = HttpUtils.openDeleteConnection(deleteURL); final int responseCode = connection.getResponseCode(); if (responseCode != HttpStatus.SC_OK) { throw new TechnicalException("TGT delete request for `" + profile + "` failed: " + HttpUtils.buildHttpErrorMessage(connection)); } } catch (final IOException e) { throw new TechnicalException(e); } finally { HttpUtils.closeConnection(connection); } }
Source:
<code>private void createMissingActivityRecord(String runningWsId, long idleTimeout) throws ServerException { LOG.warn( "Found a running workspace without any activity record. This shouldn't really happen" + " but is being rectified by adding a new activity record for it.", runningWsId); try { Workspace workspace = workspaceManager.getWorkspace(runningWsId); long createdTime = Long.parseLong(workspace.getAttributes().get(Constants.CREATED_ATTRIBUTE_NAME)); WorkspaceActivity activity = new WorkspaceActivity(); activity.setWorkspaceId(runningWsId); activity.setCreated(createdTime); activity.setStatus(WorkspaceStatus.RUNNING); activity.setLastRunning(clock.millis()); if (idleTimeout > 0) { activity.setExpiration(clock.millis() + idleTimeout); } activityDao.createActivity(activity); } catch (NotFoundException e) { LOG.error( <START> "Detected a running workspace but could not find" + " its record.", runningWsId, e); <END> } catch (ConflictException e) { LOG.debug( "Activity record created while we were trying to rectify its absence for a running" + " workspace {}.", runningWsId); } }</code><technical_language>I contacting strings is necessary operation ... find" + " record."</technical_language>

Target:
private void createMissingActivityRecord(String runningWsId, long idleTimeout) throws ServerException { LOG.warn( "Found a running workspace '{}' without any activity record. This shouldn't really happen" + " but is being rectified by adding a new activity record for it.", runningWsId); try { Workspace workspace = workspaceManager.getWorkspace(runningWsId); long createdTime; try { createdTime = Long.parseLong(workspace.getAttributes().get(Constants.CREATED_ATTRIBUTE_NAME)); } catch (NumberFormatException e) { LOG.error( "Failed to read the created time of the workspace '{}' from its attributes. Using the" + " current time.", runningWsId, e); createdTime = clock.millis(); } WorkspaceActivity activity = new WorkspaceActivity(); activity.setWorkspaceId(runningWsId); activity.setCreated(createdTime); activity.setStatus(WorkspaceStatus.RUNNING); activity.setLastRunning(clock.millis()); if (idleTimeout > 0) { activity.setExpiration(clock.millis() + idleTimeout); } activityDao.createActivity(activity); } catch (NotFoundException e) { LOG.error("Detected a running workspace '{}' but could not find its record.", runningWsId, e); } catch (ConflictException e) { LOG.debug( "Activity record created while we were trying to rectify its absence for a running" + " workspace '{}'.", runningWsId); } }
Source:
<code>private XMLReader createReader() { try { JAXBContext context; <START> context = JAXBContext.newInstance("org.atlasapi.remotesite.pa.features.bindings"); <END> Unmarshaller unmarshaller = context.createUnmarshaller(); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); XMLReader reader = factory.newSAXParser().getXMLReader(); reader.setContentHandler(unmarshaller.getUnmarshallerHandler()); unmarshaller.setListener(featuresProcessingListener()); return reader; } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>minor thing... is this broken lines</technical_language>

Target:
private XMLReader createReader() { try { JAXBContext context = JAXBContext.newInstance("org.atlasapi.remotesite.pa.features.bindings"); Unmarshaller unmarshaller = context.createUnmarshaller(); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); XMLReader reader = factory.newSAXParser().getXMLReader(); reader.setContentHandler(unmarshaller.getUnmarshallerHandler()); unmarshaller.setListener(featuresProcessingListener()); return reader; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public void flushTo(Consumer<Page> consumer) { checkState(!pages.isEmpty(), "page buffer is empty"); long[] addresses = pageSorter.sort(types, pages, sortFields, sortOrders, rowCount); int[] pageIndex = new int[addresses.length]; int[] positionIndex = new int[addresses.length]; for (int i = 0; i < addresses.length; i++) { pageIndex[i] = pageSorter.decodePageIndex(addresses[i]); positionIndex[i] = pageSorter.decodePositionIndex(addresses[i]); <START> } <END> for (int i = 0; i < pageIndex.length; i++) { Page page = pages.get(pageIndex[i]); int position = positionIndex[i]; appendPositionTo(page, position, pageBuilder); if (pageBuilder.isFull()) { consumer.accept(pageBuilder.build()); pageBuilder.reset(); } } if (!pageBuilder.isEmpty()) { consumer.accept(pageBuilder.build()); pageBuilder.reset(); } pages.clear(); rowCount = 0; usedMemoryBytes = 0; }</code><technical_language>replace this assertion page builder is empty verify(pageBuilder.isEmpty);</technical_language>

Target:
public void flushTo(Consumer<Page> consumer) { checkState(!pages.isEmpty(), "page buffer is empty"); long[] addresses = pageSorter.sort(types, pages, sortFields, sortOrders, rowCount); int[] pageIndex = new int[addresses.length]; int[] positionIndex = new int[addresses.length]; for (int i = 0; i < addresses.length; i++) { pageIndex[i] = pageSorter.decodePageIndex(addresses[i]); positionIndex[i] = pageSorter.decodePositionIndex(addresses[i]); } verify(pageBuilder.isEmpty()); for (int i = 0; i < pageIndex.length; i++) { Page page = pages.get(pageIndex[i]); int position = positionIndex[i]; appendPositionTo(page, position, pageBuilder); if (pageBuilder.isFull()) { consumer.accept(pageBuilder.build()); pageBuilder.reset(); } } if (!pageBuilder.isEmpty()) { consumer.accept(pageBuilder.build()); pageBuilder.reset(); } pages.clear(); rowCount = 0; usedMemoryBytes = 0; }
Source:
<code><START> public byte[] serialize() { <END> final ElasticData elasticData = (ElasticData) getCore(); final int payloadSize = getElasticDataLength(); if (payload != null) { payload.setParent(this); } int headerLength = 14 + (vlanIDs.size() * 4) + 20 + 8; int length = headerLength + payloadSize; if (pad && length < 60) { length = 60; } byte[] data = new byte[length]; ByteBuffer bb = ByteBuffer.wrap(data); bb.put(cachedFlowStateEthernetHeader); if (elasticData.getLength() > 0) { putElasticData(bb, elasticData); } if (pad) { Arrays.fill(data, bb.position(), data.length, (byte) 0x0); } return data; }</code><technical_language>is necessary override this, classic Ethernet behavior for this version</technical_language>

Target:
public byte[] serialize() { final ElasticData elasticData = getCore(); final int payloadSize = getElasticDataLength(); if (payload != null) { payload.setParent(this); } int headerLength = 14 + (vlanIDs.size() * 4) + 20 + 8; int length = headerLength + payloadSize; if (pad && length < 60) { length = 60; } byte[] data = new byte[length]; ByteBuffer bb = ByteBuffer.wrap(data); bb.put(cachedFlowStateEthernetHeader); if (elasticData.getLength() > 0) { putElasticData(bb, 0, elasticData); } if (pad) { Arrays.fill(data, bb.position(), data.length, (byte) 0x0); } return data; }
Source:
<code>BinaryData(byte[] data) { <START> this.data = data; <END> }</code><technical_language>clone this? In other APIs a copy of byte[]</technical_language>

Target:
BinaryData(byte[] data) { Objects.requireNonNull(data, "'data' cannot be null."); this.data = Arrays.copyOf(data, data.length); }