auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Member createSponsoredAccount(PerunSession sess, Map<String, String> params, String namespace, ExtSource extSource, String extSourcePostfix, Vo vo, int loa) throws InternalErrorException, PrivilegeException, UserNotExistsException, ExtSourceNotExistsException, UserExtSourceNotExistsException, WrongReferenceAttributeValueException, LoginNotExistsException, PasswordCreationFailedException, ExtendMembershipException, AlreadyMemberException, GroupOperationsException, PasswordStrengthFailedException, PasswordOperationTimeoutException, WrongAttributeValueException { Utils.checkPerunSession(sess); Utils.notNull(extSource, "extSource"); Utils.notNull(namespace, "namespace"); Utils.notNull(vo, "vo"); Utils.notNull(extSourcePostfix, "extSourcePostfix"); <START> if (!AuthzResolver.isAuthorized(sess, Role.REGISTRAR, vo)) { <END> throw new PrivilegeException(sess, "createSponsoredAccount"); } if(params.containsKey("sponsor")) { String sponsorLogin = params.get("sponsor"); User owner = getPerunBl().getUsersManager().getUserByExtSourceNameAndExtLogin(sess, extSource.getName(), sponsorLogin + extSourcePostfix); return getPerunBl().getMembersManagerBl().createSponsoredAccount(sess, params, namespace, extSource, extSourcePostfix, owner, vo, loa); } else { throw new InternalErrorException("sponsor cannot be null"); } }</code><technical_language>Registrar role is VO (as I know). Generally REGISTRAR do user registration password reservation/change. I prefer VOADMIN role, if I remember, @licehammer wanted REGISTRAR. please remove vo param call isAuthorized</technical_language>

Target:
public Member createSponsoredAccount(PerunSession sess, Map<String, String> params, String namespace, ExtSource extSource, String extSourcePostfix, Vo vo, int loa) throws InternalErrorException, PrivilegeException, UserNotExistsException, ExtSourceNotExistsException, UserExtSourceNotExistsException, WrongReferenceAttributeValueException, LoginNotExistsException, PasswordCreationFailedException, ExtendMembershipException, AlreadyMemberException, GroupOperationsException, PasswordStrengthFailedException, PasswordOperationTimeoutException, WrongAttributeValueException { Utils.checkPerunSession(sess); Utils.notNull(extSource, "extSource"); Utils.notNull(namespace, "namespace"); Utils.notNull(vo, "vo"); Utils.notNull(extSourcePostfix, "extSourcePostfix"); if (!AuthzResolver.isAuthorized(sess, Role.REGISTRAR)) { throw new PrivilegeException(sess, "createSponsoredAccount"); } if(params.containsKey("sponsor")) { String sponsorLogin = params.get("sponsor"); User owner = getPerunBl().getUsersManager().getUserByExtSourceNameAndExtLogin(sess, extSource.getName(), sponsorLogin + extSourcePostfix); return getPerunBl().getMembersManagerBl().createSponsoredAccount(sess, params, namespace, extSource, extSourcePostfix, owner, vo, loa); } else { throw new InternalErrorException("sponsor cannot be null"); } }
Source:
<code>private void loadPathConfiguration(Configuration config) { File depFH = new VoltFile(config.m_voltdbRoot, VoltDB.INITIALIZED_PATHS); try (FileInputStream is = new FileInputStream(depFH)) { consoleLog.info("Loading Path configuration from " + depFH.getAbsolutePath()); m_pathList.load(is); <START> is.close(); <END> } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to read configuration path destination", false, e); } }</code><technical_language>flush close done automagically get out try resource block</technical_language>

Target:
private void loadPathConfiguration(Configuration config) { File depFH = new VoltFile(config.m_voltdbRoot, VoltDB.INITIALIZED_PATHS); try (FileInputStream is = new FileInputStream(depFH)) { consoleLog.info("Loading Path configuration from " + depFH.getAbsolutePath()); m_pathList.load(is); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to read configuration path destination", false, e); } }
Source:
<code><START> public SslContext getSslContext() { <END> return sslContext; }</code><technical_language>This is a breaking change</technical_language>

Target:
public SSLContext getSslContext() { return sslContext; }
Source:
<code><START> public void listen(EntriesRemovedEvent entriesRemovedEvent) { <END> citationStyleCache.invalidateAll(entriesRemovedEvent.getBibEntries()); }</code><technical_language>way, if opportunity replace com.google.common.eventbus handler JavaFX observable listeners, please migrate them</technical_language>

Target:
public void listen(EntriesRemovedEvent entriesRemovedEvent) { for (BibEntry entry : entriesRemovedEvent.getBibEntries()) { citationStyleCache.invalidate(entry); } }
Source:
<code>public static Number numeric(byte bytes, int pos, int numBytes) { if (numBytes < 8) { throw new IllegalArgumentException("number of bytes should be at-least 8"); } short len = ByteConverter.int2(bytes, pos); short weight = ByteConverter.int2(bytes, pos + 2); short sign = ByteConverter.int2(bytes, pos + 4); short scale = ByteConverter.int2(bytes, pos + 6); <START> if (numBytes != (len * Short.BYTES) + 8) { <END> throw new IllegalArgumentException("invalid length of bytes \"numeric\" value"); } if (!(sign == NUMERIC_POS || sign == NUMERIC_NEG || sign == NUMERIC_NAN)) { throw new IllegalArgumentException("invalid sign in \"numeric\" value"); } if (sign == NUMERIC_NAN) { return Double.NaN; } if ((scale & NUMERIC_DSCALE_MASK) != scale) { throw new IllegalArgumentException("invalid scale in \"numeric\" value"); } short[] digits = new short[len]; int idx = pos + 8; for (int i = 0; i < len; i++) { short d = ByteConverter.int2(bytes, idx); idx += 2; if (d < 0 || d >= NBASE) { throw new IllegalArgumentException("invalid digit in \"numeric\" value"); } digits[i] = d; } String numString = numberBytesToString(digits, scale, weight, sign); return new BigDecimal(numString); }</code><technical_language>Short.BYTES is Short.SIZE/Byte.SIZE is in java 1.8</technical_language>

Target:
public static Number numeric(byte bytes, int pos, int numBytes) { if (numBytes < 8) { throw new IllegalArgumentException("number of bytes should be at-least 8"); } short len = ByteConverter.int2(bytes, pos); short weight = ByteConverter.int2(bytes, pos + 2); short sign = ByteConverter.int2(bytes, pos + 4); short scale = ByteConverter.int2(bytes, pos + 6); if (numBytes != (len * SHORT_BYTES + 8)) { throw new IllegalArgumentException("invalid length of bytes \"numeric\" value"); } if (!(sign == NUMERIC_POS || sign == NUMERIC_NEG || sign == NUMERIC_NAN)) { throw new IllegalArgumentException("invalid sign in \"numeric\" value"); } if (sign == NUMERIC_NAN) { return Double.NaN; } if ((scale & NUMERIC_DSCALE_MASK) != scale) { throw new IllegalArgumentException("invalid scale in \"numeric\" value"); } short[] digits = new short[len]; int idx = pos + 8; for (int i = 0; i < len; i++) { short d = ByteConverter.int2(bytes, idx); idx += 2; if (d < 0 || d >= NBASE) { throw new IllegalArgumentException("invalid digit in \"numeric\" value"); } digits[i] = d; } String numString = numberBytesToString(digits, scale, weight, sign); return new BigDecimal(numString); }
Source:
<code>public void setState(boolean bold, boolean italic, boolean underlined, String text, int textSize, String font) { boldToggleButton.setChecked(bold); italicToggleButton.setChecked(italic); underlinedToggleButton.setChecked(underlined); textEditText.setText(text); fontSpinner.setSelection(fonts.indexOf(font)); <START> textSizeSpinner.setSelection(sizes.indexOf(localeNumberFormat.format(textSize))); <END> }</code><technical_language>this work? add sizes</technical_language>

Target:
public void setState(boolean bold, boolean italic, boolean underlined, String text, int textSize, String font) { boldToggleButton.setChecked(bold); italicToggleButton.setChecked(italic); underlinedToggleButton.setChecked(underlined); textEditText.setText(text); fontSpinner.setSelection(fonts.indexOf(font)); }
Source:
<code>public void coreLoggerBridge() { TestHelper.TestLogger testLogger = new TestHelper.TestLogger(); RealmLog.setLevel(LogLevel.INFO); RealmLog.add(testLogger); long ptr = RealmLog.nativeCreateCoreLoggerBridge("TEST"); RealmLog.nativeLogToCoreLoggerBridge(ptr, LogLevel.INFO, "42"); assertTrue(testLogger.message.equals("42")); RealmLog.setLevel(LogLevel.FATAL); RealmLog.nativeLogToCoreLoggerBridge(ptr, LogLevel.INFO, "44"); <START> assertFalse(testLogger.message.equals("44")); <END> RealmLog.nativeLogToCoreLoggerBridge(ptr, LogLevel.FATAL, "45"); assertTrue(testLogger.message.equals("45")); RealmLog.nativeCloseCoreLoggerBridge(ptr); }</code><technical_language>assert is 42</technical_language>

Target:
public void coreLoggerBridge() { TestHelper.TestLogger testLogger = new TestHelper.TestLogger(); RealmLog.setLevel(LogLevel.INFO); RealmLog.add(testLogger); long ptr = RealmLog.nativeCreateCoreLoggerBridge("TEST"); RealmLog.nativeLogToCoreLoggerBridge(ptr, LogLevel.INFO, "42"); assertTrue(testLogger.message.equals("42")); RealmLog.setLevel(LogLevel.FATAL); RealmLog.nativeLogToCoreLoggerBridge(ptr, LogLevel.INFO, "44"); assertTrue(testLogger.message.equals("42")); assertFalse(testLogger.message.equals("44")); RealmLog.nativeLogToCoreLoggerBridge(ptr, LogLevel.FATAL, "45"); assertTrue(testLogger.message.equals("45")); RealmLog.nativeCloseCoreLoggerBridge(ptr); }
Source:
<code>private void registerPostModelsForMedia(List<MediaModel> mediaList, boolean isRetry) { if (mediaList != null && !mediaList.isEmpty()) { <START> Set<PostModel> postsToRefresh = PostUtils.getPostsThatIncludeThisMedia(mPostStore, mediaList); <END> for (PostModel post : postsToRefresh) { mUploadStore.registerPostModel(post, mediaList); if (isThisPostTotallyNewOrFailed(post)) { mPostUploadNotifier.addPostInfoToForegroundNotification(post, null); } } if (isRetry) { AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_UPLOAD_MEDIA_ERROR_RETRY); EventBus.getDefault().post(new UploadService.UploadMediaRetryEvent(mediaList)); } } }</code><technical_language>PostUtils.getPostsThatIncludeThisMedia(mPostStore, mediaList) - rename this function? name of function a single media in input, instead a list of media. Checking code of it, adds posts media in list</technical_language>

Target:
private void registerPostModelsForMedia(List<MediaModel> mediaList, boolean isRetry) { if (mediaList != null && !mediaList.isEmpty()) { Set<PostModel> postsToRefresh = PostUtils.getPostsThatIncludeAnyOfTheseMedia(mPostStore, mediaList); for (PostModel post : postsToRefresh) { if (!mUploadStore.isRegisteredPostModel(post)) { mUploadStore.registerPostModel(post, mediaList); } } if (isRetry) { AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_UPLOAD_MEDIA_ERROR_RETRY); EventBus.getDefault().post(new UploadService.UploadMediaRetryEvent(mediaList)); } } }
Source:
<code>public Span createSpan() { final Tracer.SpanBuilder spanBuilder; final Span activeSpan = tracer.scopeManager().activeSpan(); if (activeSpan != null) { spanBuilder = tracer.buildSpan(operationName) .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT); } else { spanBuilder = tracer.buildSpan(operationName) .withTag(Tags.SAMPLING_PRIORITY.getKey(), 0) .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT); } if (trackMetricsPerOperationName()) { spanBuilder.withTag(MetricsSpanEventListener.ENABLE_TRACKING_METRICS_TAG, true); } spanBuilder.withTag(SpanUtils.OPERATION_TYPE, getType()); <START> Span span = spanBuilder.start(); <END> return span; }</code><technical_language>suggestion return spanBuilder.start(); immediately return</technical_language>

Target:
public Span createSpan() { final Tracer.SpanBuilder spanBuilder; final Span activeSpan = tracer.scopeManager().activeSpan(); if (activeSpan != null) { spanBuilder = tracer.buildSpan(operationName) .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT); } else { spanBuilder = tracer.buildSpan(operationName) .withTag(Tags.SAMPLING_PRIORITY.getKey(), 0) .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT); } if (trackMetricsPerOperationName()) { spanBuilder.withTag(MetricsSpanEventListener.ENABLE_TRACKING_METRICS_TAG, true); } spanBuilder.withTag(SpanUtils.OPERATION_TYPE, getType()); return spanBuilder.start(); }
Source:
<code>synchronized Map<Long, CacheContinuousQueryEntry> flushCurrentEntries( BiFunction<Long, Long, CacheContinuousQueryEntry> filteredFactory ) { <START> Map<Long, CacheContinuousQueryEntry> res = new HashMap<>(); <END> if (entries == null || filteredFactory == null) return res; long filtered = this.filtered; long cntr = startCntr; for (int i = 0; i < entries.length; i++) { CacheContinuousQueryEntry e = entries[i]; CacheContinuousQueryEntry flushEntry = null; if (e == null) { if (filtered != 0) { flushEntry = filteredFactory.apply(cntr - 1, filtered - 1); filtered = 0; } } else { if (e.isFiltered()) filtered++; else { flushEntry = new CacheContinuousQueryEntry(e.cacheId(), e.eventType(), e.key(), e.value(), e.oldValue(), e.isKeepBinary(), e.partition(), e.updateCounter(), e.topologyVersion(), e.flags()); flushEntry.filteredCount(filtered); filtered = 0; } } if (flushEntry != null) res.put(flushEntry.updateCounter(), flushEntry); cntr++; } if (filtered != 0L) { CacheContinuousQueryEntry flushEntry = filteredFactory.apply(cntr - 1, filtered - 1); res.put(flushEntry.updateCounter(), flushEntry); } return res; }</code><technical_language>Empty map returned if entries == null || filteredFactory == null</technical_language>

Target:
synchronized Map<Long, CacheContinuousQueryEntry> flushCurrentEntries( BiFunction<Long, Long, CacheContinuousQueryEntry> filteredFactory ) { if (entries == null || filteredFactory == null) return Collections.emptyMap(); Map<Long, CacheContinuousQueryEntry> res = new HashMap<>(); long filtered = this.filtered; long cntr = startCntr; for (int i = 0; i < entries.length; i++) { CacheContinuousQueryEntry e = entries[i]; CacheContinuousQueryEntry flushEntry = null; if (e == null) { if (filtered != 0) { flushEntry = filteredFactory.apply(cntr - 1, filtered - 1); filtered = 0; } } else { if (e.isFiltered()) filtered++; else { flushEntry = new CacheContinuousQueryEntry(e.cacheId(), e.eventType(), e.key(), e.value(), e.oldValue(), e.isKeepBinary(), e.partition(), e.updateCounter(), e.topologyVersion(), e.flags()); flushEntry.filteredCount(filtered); filtered = 0; } } if (flushEntry != null) res.put(flushEntry.updateCounter(), flushEntry); cntr++; } if (filtered != 0L) { CacheContinuousQueryEntry flushEntry = filteredFactory.apply(cntr - 1, filtered - 1); res.put(flushEntry.updateCounter(), flushEntry); } return res; }
Source:
<code>public static ServerResponseWrapper invoke(HttpMethod method) throws Exception { HashMap<String, String> headers = new HashMap<String, String>(); HttpClient httpClient = new HttpClient(); httpClient.setConnectionTimeout(HTTP_TIMEOUT_IN_MILLISECONDS); final String proxyHost = System.getProperty("http.proxyHost"); final String proxyPort = System.getProperty("http.proxyPort"); <START> final String nonProxyHosts = System.getProperty("http.nonProxyHosts"); <END> httpClient.getHostConfiguration().setProxyHost( ProxyConfigurator.create(method, proxyHost, proxyPort, nonProxyHosts)); try { final int status = httpClient.executeMethod(method); if (status == HttpStatus.SC_NOT_FOUND) { StringWriter sw = new StringWriter(); PrintWriter out = new PrintWriter(sw); out.println("Return Code: " + status); out.println("Few Possible Causes: "); out.println("1. Your Go Server is down or not accessible."); out.println("2. This agent might be incompatible with your Go Server.Please fix the version mismatch between Go Server and Go Agent."); out.close(); throw new Exception(sw.toString()); } if (status != HttpStatus.SC_OK) { throw new Exception("Got status " + status + " " + method.getStatusText() + " from server"); } for (Header header : method.getResponseHeaders()) { headers.put(header.getName(), header.getValue()); } return new ServerResponseWrapper(headers, method.getResponseBodyAsStream()); } catch (Exception e) { String message = "Couldn't access Go Server with base url: " + method.getURI() + ": " + e.toString(); LOG.error(message); throw new Exception(message, e); } finally { method.releaseConnection(); } }</code><technical_language>consider adding support for https.proxyHost https.proxyPort well</technical_language>

Target:
public static ServerResponseWrapper invoke(HttpMethod method) throws Exception { HashMap<String, String> headers = new HashMap<String, String>(); HttpClient httpClient = new HttpClient(); httpClient.setConnectionTimeout(HTTP_TIMEOUT_IN_MILLISECONDS); httpClient.getHostConfiguration().setProxyHost( ProxyConfigurator.create(method, System.getProperties())); try { final int status = httpClient.executeMethod(method); if (status == HttpStatus.SC_NOT_FOUND) { StringWriter sw = new StringWriter(); PrintWriter out = new PrintWriter(sw); out.println("Return Code: " + status); out.println("Few Possible Causes: "); out.println("1. Your Go Server is down or not accessible."); out.println("2. This agent might be incompatible with your Go Server.Please fix the version mismatch between Go Server and Go Agent."); out.close(); throw new Exception(sw.toString()); } if (status != HttpStatus.SC_OK) { throw new Exception("Got status " + status + " " + method.getStatusText() + " from server"); } for (Header header : method.getResponseHeaders()) { headers.put(header.getName(), header.getValue()); } return new ServerResponseWrapper(headers, method.getResponseBodyAsStream()); } catch (Exception e) { String message = "Couldn't access Go Server with base url: " + method.getURI() + ": " + e.toString(); LOG.error(message); throw new Exception(message, e); } finally { method.releaseConnection(); } }
Source:
<code>public int getDispenseSlot() { Inventory inv = getInventory(); boolean allAir = true; <START> if (inv.getItem(0).getType() != Material.AIR) allAir = false; <END> if (inv.getItem(1).getType() != Material.AIR) allAir = false; if (inv.getItem(2).getType() != Material.AIR) allAir = false; if (inv.getItem(3).getType() != Material.AIR) allAir = false; if (inv.getItem(4).getType() != Material.AIR) allAir = false; if (inv.getItem(5).getType() != Material.AIR) allAir = false; if (inv.getItem(6).getType() != Material.AIR) allAir = false; if (inv.getItem(7).getType() != Material.AIR) allAir = false; if (inv.getItem(8).getType() != Material.AIR) allAir = false; if (allAir) { return 0; } else { int slot = 0; int tries = 0; while (true) { slot = random.nextInt(9); if (inv.getItem(slot).getType() != Material.AIR) break; tries += 1; if (tries == 20) { int i = 0; while (i < 9) { if (inv.getItem(i).getType() != Material.AIR) { slot = i; break; } } break; } } return slot; } }</code><technical_language>I a for-loop here... isEmpty() in this case</technical_language>

Target:
public int getDispenseSlot() { return InventoryUtil.getRandomSlot(random, getInventory(), true); }
Source:
<code>public String getProgress() { if (getHealth() == HealthType.Running) { if (numCycles != null && callCycle != null) { <START> if (numCycles != 0) { <END> return String.format("%d/%d", callCycle, numCycles); } } return "Running"; } return ""; }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Merge this if statement enclosing one. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public String getProgress() { if (getHealth() == HealthType.Running) { if (numCycles != null && callCycle != null) { if (numCycles != 0) { return String.format("Cycle %d of %d", callCycle, numCycles); } } return "Running"; } return ""; }
Source:
<code>public Response add(ImageTransfer imageTransfer) { TransferDiskImageParameters params = new TransferDiskImageParameters(); if <START> (imageTransfer.getDirection() != null && <END> imageTransfer.getDirection().equals(ImageTransferDirection.DOWNLOAD)) { params.setIsDownloading(true); } params.setImageId(GuidUtils.asGuid(imageTransfer.getImage().getId())); params.setKeepaliveInterval(ConfigurationValues.UploadImageUiInactivityTimeoutInSeconds.getValue()); return performCreate(VdcActionType.TransferDiskImage, params, new QueryIdResolver<Guid>(VdcQueryType.GetImageTransferById, IdQueryParameters.class)); }</code><technical_language>Consider "isSetDirection"</technical_language>

Target:
public Response add(ImageTransfer imageTransfer) { TransferDiskImageParameters params = new TransferDiskImageParameters(); if (imageTransfer.isSetDirection() && imageTransfer.getDirection().equals(ImageTransferDirection.DOWNLOAD)) { params.setTransferType(TransferType.Download); } params.setImageId(GuidUtils.asGuid(imageTransfer.getImage().getId())); params.setKeepaliveInterval(ConfigurationValues.UploadImageUiInactivityTimeoutInSeconds.getValue()); return performCreate(VdcActionType.TransferDiskImage, params, new QueryIdResolver<Guid>(VdcQueryType.GetImageTransferById, IdQueryParameters.class)); }
Source:
<code>private static String encodeEntry(Entry<Object, Object> e) { String key = e.getKey().toString(); String value = e.getValue() == null ? "" : e.getValue().toString(); <START> return urlEncode(key) + ">" + urlEncode(value); <END> }</code><technical_language>constant for key/value separator</technical_language>

Target:
private static String encodeEntry(Entry<Object, Object> e) { String key = e.getKey().toString(); String value = e.getValue() == null ? "" : e.getValue().toString(); return urlEncode(key) + PROPERTIES_KV_SEPARATOR + urlEncode(value); }
Source:
<code>public Boolean getMakeredundant() { <START> if (makeredundant != null) { <END> return makeredundant; } return false; }</code><technical_language>Is is a default value, a primitive a default of false? Then, do need logics in a POJO get method</technical_language>

Target:
public Boolean getMakeredundant() { return makeredundant; }
Source:
<code>private void checkForCharactersBeforeProlog(FileSystem fileSystem) { try { int lineNb = 1; Pattern firstTagPattern = Pattern.compile("<[a-zA-Z?]+"); for (String line : Files.readLines(inputFile.file(), fileSystem.encoding())) { <START> if (lineNb == 1 && line.length() > 0 && line.charAt(0) == '\ufeff') { <END> characterDeltaForHighlight = -1; } Matcher m = firstTagPattern.matcher(line); if (m.find()) { int groupIndex = line.indexOf(m.group()); if (XML_PROLOG_START_TAG.equals(m.group()) && (groupIndex > 0 || lineNb > 1)) { hasCharsBeforeProlog = true; } break; } lineNb++; } if (hasCharsBeforeProlog) { processCharBeforePrologInFile(fileSystem, lineNb); } } catch (IOException e) { LOG.warn("Unable to analyse file {}", inputFile.absolutePath(), e); } }</code><technical_language>@vilchik-elena minor: this slightly simplified lineNb == 1 && line.startsWith("\ufeff")</technical_language>

Target:
private void checkForCharactersBeforeProlog(FileSystem fileSystem) { try { int lineNb = 1; Pattern firstTagPattern = Pattern.compile("<[a-zA-Z?]+"); for (String line : Files.readLines(inputFile.file(), fileSystem.encoding())) { if (lineNb == 1) { checkBOM(line); } Matcher m = firstTagPattern.matcher(line); if (m.find()) { int groupIndex = line.indexOf(m.group()); if (XML_PROLOG_START_TAG.equals(m.group()) && (groupIndex > 0 || lineNb > 1)) { hasCharsBeforeProlog = true; } break; } lineNb++; } if (hasCharsBeforeProlog) { processCharBeforePrologInFile(fileSystem, lineNb); } } catch (IOException e) { LOG.warn("Unable to analyse file {}", inputFile.absolutePath(), e); } }
Source:
<code>private static byte[] getRandomSeed(SecureRandom random, int bits) { <START> byte[] seed = new byte[bits / 8]; <END> random.nextBytes(seed); return seed; }</code><technical_language>assert bits absurdly high</technical_language>

Target:
private static byte[] getRandomSeed(SecureRandom random, int bits) { Preconditions.checkArgument(bits >= DEFAULT_SEED_BITS, "requested seed size too small"); Preconditions.checkArgument(bits <= MAX_SEED_BITS, "requested seed size too large"); Preconditions.checkArgument(bits % 8 == 0, "requested seed size not an even number of bytes"); byte[] seed = new byte[bits / 8]; random.nextBytes(seed); return seed; }
Source:
<code>public String verifiedSources(@ApiParam(value = "Tool id", required = true) @PathParam("containerId") Long containerId) { Tool tool = toolDAO.findById(containerId); Helper.checkEntry(tool); Set<String> verifiedSourcesArray = new HashSet<>(); for (Tag tag : tool.getTags()) { if (tag.isVerified()) { verifiedSourcesArray.add(tag.getVerifiedSource()); } } JSONArray jsonArray = new JSONArray(); try { jsonArray = new JSONArray(verifiedSourcesArray.toArray()); } catch (JSONException ex) { <START> ex.printStackTrace(); <END> } return jsonArray.toString(); }</code><technical_language>throw exception, this a CustomWebApplicationException, internal server error</technical_language>

Target:
public String verifiedSources(@ApiParam(value = "Tool id", required = true) @PathParam("containerId") Long containerId) { Tool tool = toolDAO.findById(containerId); Helper.checkEntry(tool); Set<String> verifiedSourcesArray = new HashSet<>(); tool.getTags() .stream() .filter((Tag u) -> u.isVerified()) .forEach((Tag v) -> verifiedSourcesArray.add(v.getVerifiedSource())); JSONArray jsonArray; try { jsonArray = new JSONArray(verifiedSourcesArray.toArray()); } catch (JSONException ex) { throw new CustomWebApplicationException("There was an error converting the array of verified sources to a JSON array.", HttpStatus.SC_INTERNAL_SERVER_ERROR); } return jsonArray.toString(); }
Source:
<code>public Map<String, String> getExternalMetadata() { <START> return externalMetadata; <END> }</code><technical_language>nice if return mutable copy of metadata</technical_language>

Target:
public Map<String, String> getExternalMetadata() { return ImmutableMap.copyOf(externalMetadata); }
Source:
<code>private static boolean attributeValuesAreNonNull(Attribute attribute) { <START> return !attribute.getValues().stream().allMatch(Objects::isNull); <END> }</code><technical_language>attribute.getValues().stream().noneMatch(Objects::isNull);</technical_language>

Target:
private static boolean attributeValuesAreNonNull(Attribute attribute) { return attribute.getValues().stream().noneMatch(Objects::isNull); }
Source:
<code>private boolean handlePositiveEnforcingAffinityGroup(Guid vdsId, List<VM> runningVms) { List<AffinityGroup> affinityGroups = affinityGroupDao.getPositiveEnforcingAffinityGroupsByRunningVmsOnVdsId(vdsId); if (!affinityGroups.isEmpty()) { List<Object> items = new ArrayList<>(); affinityGroups.stream() .filter(ag -> <START> (!ag.getVdsIds().isEmpty()) <END> || affinityGroupContainsRunningVMs(ag, runningVms) ) .forEach(affinityGroup -> { items.add(String.format("%1$s (%2$s)", affinityGroup.getName(), StringUtils.join(affinityGroup.getVmEntityNames(), " ,"))); }); if (!items.isEmpty()) { addValidationMessage(EngineMessage.VDS_CANNOT_MAINTENANCE_VDS_HAS_AFFINITY_VMS); getReturnValue().getValidationMessages() .addAll(ReplacementUtils.replaceWith("AFFINITY_GROUPS_VMS", items)); return false; } } return true; }</code><technical_language>Please remove unnecessary parenthesis: !ag.getVdsIds().isEmpty() || affinityGroupContainsRunningVMs(ag, runningVms)</technical_language>

Target:
private boolean handlePositiveEnforcingAffinityGroup(Guid vdsId, List<VM> runningVms) { List<AffinityGroup> affinityGroups = affinityGroupDao.getPositiveEnforcingAffinityGroupsByRunningVmsOnVdsId(vdsId); if (!affinityGroups.isEmpty()) { List<Object> items = new ArrayList<>(); affinityGroups.stream() .filter(ag -> !ag.getVdsIds().isEmpty() || affinityGroupContainsRunningVMs(ag, runningVms) ) .forEach(affinityGroup -> { items.add(String.format("%1$s (%2$s)", affinityGroup.getName(), StringUtils.join(affinityGroup.getVmEntityNames(), " ,"))); }); if (!items.isEmpty()) { addValidationMessage(EngineMessage.VDS_CANNOT_MAINTENANCE_VDS_HAS_AFFINITY_VMS); getReturnValue().getValidationMessages() .addAll(ReplacementUtils.replaceWith("AFFINITY_GROUPS_VMS", items)); return false; } } return true; }
Source:
<code>synchronized OptionalLong reheat() throws IOException { long pagesLoaded = 0; List<PagedFile> files = pageCache.listExistingMappings(); for ( PagedFile file : files ) { try { pagesLoaded += reheat( file ); <START> } <END> catch ( FileIsNotMappedException ignore ) { } } return stopped ? OptionalLong.empty() : OptionalLong.of( pagesLoaded ); }</code><technical_language>check stopped beginning of method instead</technical_language>

Target:
synchronized OptionalLong reheat() throws IOException { if ( stopOngoingWarming ) { return OptionalLong.empty(); } long pagesLoaded = 0; List<PagedFile> files = pageCache.listExistingMappings(); for ( PagedFile file : files ) { try { pagesLoaded += reheat( file ); } catch ( FileIsNotMappedException ignore ) { } } return OptionalLong.of( pagesLoaded ); }
Source:
<code>public boolean contains(int element) { <START> if (element < 0) <END> throw new UnsupportedOperationException("Negative values are not supported!"); return bitSet.get(element); }</code><technical_language>here, false</technical_language>

Target:
@Override public boolean contains(int element) { if (element < 0) return false; return bitSet.get(element); }
Source:
<code>private String toPattern(String tableName) throws MalformedObjectNameException { if (!tableName.contains("*")) { return new ObjectName(tableName).getCanonicalName(); } <START> String pattern = Pattern.compile("\\*").splitAsStream(tableName) <END> .map(Pattern::quote) .collect(Collectors.joining(".*")); if (tableName.startsWith("*")) { pattern = ".*" + pattern; } if (tableName.endsWith("*")) { pattern += ".*"; } return pattern; }</code><technical_language>I splitter.on('*') need do extra checks for beginning end of pattern below</technical_language>

Target:
private String toPattern(String tableName) throws MalformedObjectNameException { if (!tableName.contains("*")) { return Pattern.quote(new ObjectName(tableName).getCanonicalName()); } return Streams.stream(Splitter.on('*').split(tableName)) .map(Pattern::quote) .collect(Collectors.joining(".*")); }
Source:
<code>public void close() { isOpen = false; wrappedIterator.close(); for (final Map.Entry<String, UmiMetrics> metric : umiMetricsMap.entrySet()) { <START> metric.getValue().calculateDerivedFields(); <END> } }</code><technical_language>this replaced a loop map's values, key is unused. for (UmiMetrics metrics : umiMetricsMap.values()) { metrics.calculateDerivedFields(); }</technical_language>

Target:
public void close() { isOpen = false; wrappedIterator.close(); for (final UmiMetrics metrics : umiMetricsMap.values()) { metrics.calculateDerivedFields(); } }
Source:
<code>private void copyDocument(ElementNodeBuilder enb, DictionaryBuilder db, NodeTreePointable ntp, <START> DocumentNodePointable dnp) throws IOException, SystemException { <END> SequencePointable seqp = ppool.takeOne(SequencePointable.class); AttributeNodePointable anp = ppool.takeOne(AttributeNodePointable.class); TaggedValuePointable tvp = ppool.takeOne(TaggedValuePointable.class); ElementNodePointable cenp = ppool.takeOne(ElementNodePointable.class); try { dnp.getContent(ntp, seqp); for (int i = 0; i < seqp.getEntryCount(); ++i) { seqp.getEntry(i, tvp); if (tvp.getTag() == ValueTag.ELEMENT_NODE_TAG) { tvp.getValue(cenp); copyElement(enb, db, ntp, cenp); break; } } } finally { ppool.giveBack(cenp); ppool.giveBack(tvp); ppool.giveBack(anp); ppool.giveBack(seqp); } }</code><technical_language>this a new SystemException</technical_language>

Target:
private void copyDocument(ElementNodeBuilder enb, DictionaryBuilder db, NodeTreePointable ntp, DocumentNodePointable dnp) throws IOException { SequencePointable seqp = ppool.takeOne(SequencePointable.class); AttributeNodePointable anp = ppool.takeOne(AttributeNodePointable.class); TaggedValuePointable tvp = ppool.takeOne(TaggedValuePointable.class); ElementNodePointable cenp = ppool.takeOne(ElementNodePointable.class); try { dnp.getContent(ntp, seqp); for (int i = 0; i < seqp.getEntryCount(); ++i) { seqp.getEntry(i, tvp); if (tvp.getTag() == ValueTag.ELEMENT_NODE_TAG) { tvp.getValue(cenp); copyElement(enb, db, ntp, cenp); break; } } } finally { ppool.giveBack(cenp); ppool.giveBack(tvp); ppool.giveBack(anp); ppool.giveBack(seqp); } }
Source:
<code>public Member validateMemberAsync(final PerunSession sess, final Member member) throws InternalErrorException { new Thread(new Runnable() { public void run() { try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } Status oldStatus = Status.getStatus(member.getStatus().getCode()); try { ((PerunSessionImpl) sess).getPerunBl().getMembersManagerBl().validateMember(sess, member); } catch(Exception ex) { log.info("validateMemberAsync failed. Cause: {}", ex); try { getPerunBl().getAuditer().log(sess, new MemberValidatedFailed(member, oldStatus)); log.info("Validation of failed. He stays in state.", member, oldStatus); <START> } catch(RuntimeException internalError) { <END> log.error("Store message to auditer failed. message: Validation of failed. He stays in state. cause: {}", new Object[] {member, oldStatus, internalError}); } } } }, "validateMemberAsync").start(); return member; }</code><technical_language>is reason for this change</technical_language>

Target:
public Member validateMemberAsync(final PerunSession sess, final Member member) throws InternalErrorException { new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } Status oldStatus = Status.getStatus(member.getStatus().getCode()); try { ((PerunSessionImpl) sess).getPerunBl().getMembersManagerBl().validateMember(sess, member); } catch(Exception ex) { log.info("validateMemberAsync failed. Cause: {}", ex); getPerunBl().getAuditer().log(sess, new MemberValidatedFailed(member, oldStatus)); log.info("Validation of failed. He stays in state.", member, oldStatus); } } }, "validateMemberAsync").start(); return member; }
Source:
<code>private static MessageBuffer newMessageBuffer(ByteBuffer bb) { checkNotNull(bb); <START> try { <END> return (MessageBuffer) mbBBConstructor.newInstance(bb); } catch (InstantiationException e) { throw new IllegalStateException(e); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } catch (InvocationTargetException e) { if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else if (e.getCause() instanceof Error) { throw (Error) e.getCause(); } throw new IllegalStateException(e.getCause()); } }</code><technical_language>Extract this try-catch block a method avoid code duplication</technical_language>

Target:
private static MessageBuffer newMessageBuffer(ByteBuffer bb) { checkNotNull(bb); return newInstance(mbBBConstructor, bb); }
Source:
<code>public String prettyString() { switch (subscriptionType) { case NONE: return "None"; case AUTO_TOPICS: return "Subscribe(" + String.join(",", subscription) + ")"; case AUTO_PATTERN: return "Subscribe(" + subscribedPattern + ")"; case USER_ASSIGNED: return "Assign(" + assignment.partitionStateValues() + " , id=" + assignmentId + ")"; default: <START> throw new IllegalStateException("Un-recognized subscription type: " + subscriptionType); <END> } }</code><technical_language>nit: need hyphenate unrecognized</technical_language>

Target:
public String prettyString() { switch (subscriptionType) { case NONE: return "None"; case AUTO_TOPICS: return "Subscribe(" + String.join(",", subscription) + ")"; case AUTO_PATTERN: return "Subscribe(" + subscribedPattern + ")"; case USER_ASSIGNED: return "Assign(" + assignedPartitions() + " , id=" + assignmentId + ")"; default: throw new IllegalStateException("Unrecognized subscription type: " + subscriptionType); } }
Source:
<code>private Object formatTooltip(Long value, Object threshold, String data) { <START> List<DataColumn> columns = dataSet.getColumns(); <END> int size = columns.size(); DataColumn targetColumn; if (size == 1) { targetColumn = columns.get(0); } else if(size > 1) { targetColumn = columns.get(1); } else { return value; } String pattern = displayerSettings.getColumnSettings(targetColumn).getValuePattern(); return getFormatter().formatNumber(pattern, value); }</code><technical_language>@jesuino this code is a twisted for mind. I do a (guard clause)[<LINK_0>] for size < 1. follow teh current logic</technical_language>

Target:
protected Object formatTooltip(Long value, Object threshold, String data) { List<DataColumn> columns = dataSet.getColumns(); int size = columns.size(); if (size == 1) { return formatValueForColumn(value, columns.get(0)); } if (size > 1) { return formatValueForColumn(value, columns.get(1)); } return value; }
Source:
<code>public float getFontScaleFactor(Project project, BitmapFont font, GlyphLayout tempAxisLabelLayout) { tempAxisLabelLayout.setText(font, String.valueOf(project.getXmlHeader().virtualScreenWidth / 2)); float shortDisplaySide; if (project.getXmlHeader().islandscapeMode()) { shortDisplaySide = project.getXmlHeader().virtualScreenHeight; } else { shortDisplaySide = project.getXmlHeader().virtualScreenWidth; } <START> return 0.025f * shortDisplaySide / tempAxisLabelLayout.height; <END> }</code><technical_language>please put "0.025f" in a final variable name properly</technical_language>

Target:
public float getFontScaleFactor(Project project, BitmapFont font, GlyphLayout tempAxisLabelLayout) { tempAxisLabelLayout.setText(font, String.valueOf(project.getXmlHeader().virtualScreenWidth / 2)); float shortDisplaySide; if (project.getXmlHeader().islandscapeMode()) { shortDisplaySide = project.getXmlHeader().virtualScreenHeight; } else { shortDisplaySide = project.getXmlHeader().virtualScreenWidth; } return AXIS_FONT_SIZE_SCALE_FACTOR * shortDisplaySide / tempAxisLabelLayout.height; }
Source:
<code>GenericCapability(ResolverBundle resolverBundle, GenericDescription base, boolean developmentMode) { super(base); this.resolverBundle = resolverBundle; String usesDirective = base.getDeclaredDirectives().get(Constants.USES_DIRECTIVE); uses = ManifestElement.getArrayFromList(usesDirective); String effectiveDirective = base.getDeclaredDirectives().get(Constants.EFFECTIVE_DIRECTIVE); <START> effective = effectiveDirective == null || Constants.EFFECTIVE_RESOLVE.equals(effectiveDirective) || developmentMode; <END> }</code><technical_language>a option return ResolveContext.isEffective() ResolveContext object passing org.osgi.service.resolver.Resolver service</technical_language>

Target:
GenericCapability(ResolverBundle resolverBundle, GenericDescription base, boolean developmentMode) { super(base); this.resolverBundle = resolverBundle; String usesDirective = base.getDeclaredDirectives().get(Constants.USES_DIRECTIVE); uses = ManifestElement.getArrayFromList(usesDirective); String effectiveDirective = base.getDeclaredDirectives().get(Constants.EFFECTIVE_DIRECTIVE); effective = effectiveDirective == null || Constants.EFFECTIVE_RESOLVE.equals(effectiveDirective) || (Constants.EFFECTIVE_ACTIVE.equals(effectiveDirective) && developmentMode); }
Source:
<code>public static synchronized void free(Vector3i v) { if (currentVector3isAvailable < POOL_SIZE) { VECTOR_3I_POOL[currentVector3isAvailable++] = v; <START> } <END> }</code><technical_language>handling underflow? :D (more specifically, DO a POOL_SIZE?)</technical_language>

Target:
public static synchronized void free(Vector3i v) { freed3is++; if (currentVector3isAvailable < POOL_SIZE) { VECTOR_3I_POOL[currentVector3isAvailable++] = v; } }
Source:
<code>public void checkAttributeSyntax(PerunSessionImpl sess, Group group, Resource resource, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { <START> log.trace("checkAttributeSemantics(resource={},group={},attribute={})", resource, group, attribute); <END> List<String> emails = attribute.valueAsList(); if (emails == null) emails = new ArrayList<>(); for (String email : emails) { Matcher emailMatcher = emailPattern.matcher(email); if (!emailMatcher.matches()) throw new WrongAttributeValueException(attribute, resource, group, "Email " + email + " is not in correct form."); } if (hasDuplicate(emails)) { throw new WrongAttributeValueException(attribute, resource, group, "duplicate values"); } }</code><technical_language>This log is printing wrong method name</technical_language>

Target:
public void checkAttributeSyntax(PerunSessionImpl sess, Group group, Resource resource, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { log.trace("checkAttributeSyntax(resource={},group={},attribute={})", resource, group, attribute); List<String> emails = attribute.valueAsList(); if (emails == null) return; for (String email : emails) { Matcher emailMatcher = emailPattern.matcher(email); if (!emailMatcher.matches()) throw new WrongAttributeValueException(attribute, resource, group, "Email " + email + " is not in correct form."); } if (hasDuplicate(emails)) { throw new WrongAttributeValueException(attribute, resource, group, "duplicate values"); } }
Source:
<code>private User loadUser(Context context) { try { String userSessionJson = loadJsonString(context, USER_PATH); <START> return gson.fromJson(userSessionJson, User.class); <END> } catch(FileAccessException e) { return new User(); } }</code><technical_language>is this called usersession user</technical_language>

Target:
private User loadUser(Context context) { try { String user = loadJsonString(context, USER_PATH); return gson.fromJson(user, User.class); } catch(FileAccessException e) { return null; } }
Source:
<code>private void closeResources(final String fullPath, final int typeId, final int dataSetId, final int dataSpaceId) { <START> final Optional<Throwable> closureError = Stream.of( <END> closeType(typeId), closeDataSpace(dataSpaceId), closeDataset(dataSetId)) .filter(Objects::nonNull).findFirst(); if (closureError.isPresent()) { throw new GATKException( String.format("exception when closing string retrieval on data-set '%s' in file '%s'", fullPath, file), closureError.get()); } }</code><technical_language>comfortable this. Proceeding in face of Throwables thrown bad. I try close Throwables if thrown. Catching OutOfMemory ThreadDeath StackOverflow is a bad idea</technical_language>

Target:
private void closeResources(final String fullPath, final int typeId, final int dataSetId, final int dataSpaceId) { final Optional<Exception> closureError = Stream.of( closeResource(() -> H5.H5Tclose(typeId)), closeResource(() -> H5.H5Sclose(dataSpaceId)), closeResource(() -> H5.H5Dclose(dataSetId))) .filter(Objects::nonNull).findFirst(); if (closureError.isPresent()) { throw new GATKException( String.format("exception when closing string retrieval on data-set '%s' in file '%s'", fullPath, file), closureError.get()); } }
Source:
<code>public JdbcConnector( LifeCycleManager lifeCycleManager, JdbcMetadataFactory jdbcMetadataFactory, JdbcSplitManager jdbcSplitManager, JdbcRecordSetProvider jdbcRecordSetProvider, JdbcPageSinkProvider jdbcPageSinkProvider, Optional<ConnectorAccessControl> accessControl, Set<Procedure> procedures, FunctionMetadataManager functionManager, StandardFunctionResolution functionResolution, RowExpressionService rowExpressionService, JdbcClient jdbcClient) { this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null"); this.jdbcMetadataFactory = requireNonNull(jdbcMetadataFactory, "jdbcMetadataFactory is null"); this.jdbcSplitManager = requireNonNull(jdbcSplitManager, "jdbcSplitManager is null"); this.jdbcRecordSetProvider = requireNonNull(jdbcRecordSetProvider, "jdbcRecordSetProvider is null"); this.jdbcPageSinkProvider = requireNonNull(jdbcPageSinkProvider, "jdbcPageSinkProvider is null"); this.accessControl = requireNonNull(accessControl, "accessControl is null"); this.procedures = ImmutableSet.copyOf(requireNonNull(procedures, "procedures is null")); <START> this.functionManager = requireNonNull(functionManager); <END> this.functionResolution = requireNonNull(functionResolution); this.rowExpressionService = requireNonNull(rowExpressionService); this.jdbcClient = requireNonNull(jdbcClient); }</code><technical_language>put "XXX is null" error message for requireNonNull</technical_language>

Target:
public JdbcConnector( LifeCycleManager lifeCycleManager, JdbcMetadataFactory jdbcMetadataFactory, JdbcSplitManager jdbcSplitManager, JdbcRecordSetProvider jdbcRecordSetProvider, JdbcPageSinkProvider jdbcPageSinkProvider, Optional<ConnectorAccessControl> accessControl, Set<Procedure> procedures, FunctionMetadataManager functionManager, StandardFunctionResolution functionResolution, RowExpressionService rowExpressionService, JdbcClient jdbcClient) { this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null"); this.jdbcMetadataFactory = requireNonNull(jdbcMetadataFactory, "jdbcMetadataFactory is null"); this.jdbcSplitManager = requireNonNull(jdbcSplitManager, "jdbcSplitManager is null"); this.jdbcRecordSetProvider = requireNonNull(jdbcRecordSetProvider, "jdbcRecordSetProvider is null"); this.jdbcPageSinkProvider = requireNonNull(jdbcPageSinkProvider, "jdbcPageSinkProvider is null"); this.accessControl = requireNonNull(accessControl, "accessControl is null"); this.procedures = ImmutableSet.copyOf(requireNonNull(procedures, "procedures is null")); this.functionManager = requireNonNull(functionManager, "functionManager is null"); this.functionResolution = requireNonNull(functionResolution, "functionResolution is null"); this.rowExpressionService = requireNonNull(rowExpressionService, "rowExpressionService is null"); this.jdbcClient = requireNonNull(jdbcClient, "jdbcClient is null"); }
Source:
<code>public void allWithoutTask() throws Exception{ final Repo repo = new MkRepo(); final Region region = DyTasksTest.region(repo.name()); DyTasks tasks = new DyTasks(region, repo); <START> MatcherAssert.assertThat(tasks.all().iterator().hasNext(),Matchers.equalTo(false)); <END> }</code><technical_language>Matchers.emptyIterable()</technical_language>

Target:
public void allWithoutTask() throws Exception { final Repo repo = new MkRepo(); final DyTasks tasks = new DyTasks( DyTasksTest.region(repo.name()), repo ); MatcherAssert.assertThat(tasks.all(), Matchers.emptyIterable()); }
Source:
<code>public void should_successfully_use_the_card_if_player_bought_one_in_the_previous_move_and_one_in_the_current() { playPreparationStageAndBuyCardYearOfPlentyAndPassCycle() .nextRandomDevelopmentCards(asList(YEAR_OF_PLENTY)) <START> .BUY_CARD(1) <END> .startTrackResourcesQuantity() .USE_CARD_YEAR_OF_PLENTY(1, "SHEEP", "WOOD").successfully() .getGameDetails(1).gameUser(1).resourcesQuantityChangedBy(0, 1, 1, 0, 0); }</code><technical_language>test case works good is clear I resources for card. splitting a method playPreparationStageAndBuyCardYearOfPlentyAndPassCycle() parts? for example: playPreparationStage() .nextRandomDiceValues(asList(1, 1)) // P1, P2, P3: -- .THROW_DICE(1) .giveResourcesForDevCardToFirstPlayerAndBuyIt(YEAR_OF_PLENTY) .giveResourcesForDevCardToFirstPlayerAndBuyIt(YEAR_OF_PLENTY) create separate method passCycleAfterFirstPlayerTrewDice() needed</technical_language>

Target:
public void should_successfully_use_the_card_if_player_bought_one_in_the_previous_move_and_one_in_the_current() { playPreparationStageAndBuyCardYearOfPlentyAndPassCycle() .nextRandomDevelopmentCards(asList(YEAR_OF_PLENTY)) .BUY_CARD(1) .startTrackResourcesQuantity() .startTrackDevCardsQuantity() .USE_CARD_YEAR_OF_PLENTY(1, "SHEEP", "WOOD").successfully() .getGameDetails(1) .gameUser(1).resourcesQuantityChangedBy(0, 1, 1, 0, 0) .gameUser(1).devCardsQuantityChangedBy(0, 0, 0, 0, -1); }
Source:
<code><START> public int hashCode() { <END> final int prime = 31; int result = 1; result = prime * result + ((this.ssldRepository == null) ? 0 : this.ssldRepository.hashCode()); return result; }</code><technical_language>java.util.Objects</technical_language>

Target:
public int hashCode() { return super.hashCode() + Objects.hashCode(this.ssldRepository); }
Source:
<code>public static void assertNotNullEntries(Collection<?> collection, String name) { Objects.requireNonNull(collection, () -> "Collection '" + name + "' must be non null."); Supplier<String> entrySupplier = () -> "Collection '" + name + "' contains null entry."; <START> collection.forEach((k) -> Objects.requireNonNull(k, entrySupplier)); <END> }</code><technical_language>Nitpick here, parens required k</technical_language>

Target:
public static void assertNotNullEntries(Collection<?> collection, String name) { Objects.requireNonNull(collection, () -> "Collection '" + name + "' must be non null."); Supplier<String> entrySupplier = () -> "Collection '" + name + "' contains null entry."; collection.forEach(k -> Objects.requireNonNull(k, entrySupplier)); }