auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void recoverSegment(long segmentIndex, long segmentId, PbdSegmentName segmentName) throws IOException { PBDSegment<M> segment; if (segmentName.m_quarantined) { segment = new PbdQuarantinedSegment<>(segmentName.m_file, segmentIndex, segmentId); } else { segment = m_pbdSegmentFactory.create(segmentIndex, segmentId, segmentName.m_file, m_usageSpecificLog, m_extraHeaderSerializer); try { if (segment.getNumEntries() == 0 && m_segments.isEmpty()) { m_usageSpecificLog.info("Found Empty Segment with entries: " + segment.getNumEntries() + " For: " + segment.file().getName()); m_usageSpecificLog.info("Segment " + segment.file() + " (final: " + segment.isFinal() <START> + "), will be closed and deleted during init"); <END> segment.closeAndDelete(); return; } if (!segment.isFinal()) { m_usageSpecificLog.warn("Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered but is not in a final state"); } else if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug( "Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered"); } } catch (IOException e) { m_usageSpecificLog.warn( "Failed to retrieve entry count from segment " + segment.file() + ". Quarantining segment", e); quarantineSegment(segment); return; } finally { segment.close(); } } m_segments.put(segment.segmentIndex(), segment); }</code><technical_language>I this logging change you. This is done PBD initialziation. assert discard of container returned a poll. empty segment deleted initialization hit assert. If issue is empty segments in middle want log segment.getNumEntries() == 0 && !m_sgements.isEmpty()</technical_language>

Target:
private void recoverSegment(long segmentIndex, long segmentId, PbdSegmentName segmentName) throws IOException { PBDSegment<M> segment; if (segmentName.m_quarantined) { segment = new PbdQuarantinedSegment<>(segmentName.m_file, segmentIndex, segmentId); } else { segment = m_pbdSegmentFactory.create(segmentIndex, segmentId, segmentName.m_file, m_usageSpecificLog, m_extraHeaderSerializer); try { if (segment.getNumEntries() == 0 && m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Found Empty Segment with entries: " + segment.getNumEntries() + " For: " + segment.file().getName()); m_usageSpecificLog.debug("Segment " + segment.file() + " (final: " + segment.isFinal() + "), will be closed and deleted during init"); } segment.closeAndDelete(); return; } if (!segment.isFinal()) { m_usageSpecificLog.warn("Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered but is not in a final state"); } else if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug( "Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered"); } } catch (IOException e) { m_usageSpecificLog.warn( "Failed to retrieve entry count from segment " + segment.file() + ". Quarantining segment", e); quarantineSegment(segment); return; } finally { segment.close(); } } m_segments.put(segment.segmentIndex(), segment); }
Source:
<code>private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); extensionsManager.getGlobalContext().put( Base.GlobalContextKeys.APPLICATION_NAME, Base.ApplicationNames.OVIRT_ENGINE_EXTENSIONS_TOOL ); moduleService.getContext().put(ModuleService.EXTENSION_MANAGER, extensionsManager); List<File> files = (List<File>)argMap.get("extension-file"); if(files == null) { files = listFiles( ((String) argMap.get("extensions-dir")), "properties" ); } List<String> loadedExtensions = new LinkedList<>(); for(File f : files) { log.debug("Loading extension file '{}'", f.getName()); try { loadedExtensions.add(extensionsManager.load(f)); } catch (Exception ex) { log.error("Can't load extension '{}', ignoring.", f.getName()); log.debug("Exception:", ex); } } for(String extension : loadedExtensions) { try { extensionsManager.initialize(extension); log.debug("Extension '{}' initialized", extension); } catch (Exception ex) { <START> log.error("Can't initialize extension '{}', ignoring.", extension); <END> log.debug("Exception:", ex); } } extensionsManager.dump(); }</code><technical_language>while bellow, please update messages to: Extension '{}' load failed (ignored): Extension '{}' initialization failed (ignored): {}</technical_language>

Target:
private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); extensionsManager.getGlobalContext().put( Base.GlobalContextKeys.APPLICATION_NAME, Base.ApplicationNames.OVIRT_ENGINE_EXTENSIONS_TOOL ); moduleService.getContext().put(ModuleService.EXTENSION_MANAGER, extensionsManager); List<File> files = (List<File>)argMap.get("extension-file"); if(files == null) { files = listFiles( ((String) argMap.get("extensions-dir")), "properties" ); } List<String> loadedExtensions = new LinkedList<>(); for(File f : files) { log.debug("Loading extension file '{}'", f.getName()); try { loadedExtensions.add(extensionsManager.load(f)); } catch (Exception ex) { log.error("Extension '{}' load failed (ignored): {}", f.getName(), ex.getMessage()); log.debug("Exception:", ex); } } for(String extension : loadedExtensions) { try { extensionsManager.initialize(extension); log.debug("Extension '{}' initialized", extension); } catch (Exception ex) { log.error("Extension '{}' initialization failed (ignored): {}", extension, ex.getMessage()); log.debug("Exception:", ex); } } extensionsManager.dump(); }
Source:
<code><START> public static LeadershipId random() { <END> return ImmutableLeadershipId.builder() .id(UUID.randomUUID()) .build(); }</code><technical_language>want a static method takes a UUID creator, annotate @JsonCreator</technical_language>

Target:
public static LeadershipId random() { return create(UUID.randomUUID()); }
Source:
<code>protected PerunClient setupPerunClient(HttpServletRequest req) throws InternalErrorException, RpcException { if (req.getHeader("OIDC_CLAIM_audience") != null && !req.getHeader("OIDC_CLAIM_audience").isEmpty()) { String clientId = req.getHeader("OIDC_CLAIM_audience"); List<PerunClient.Scope> scopes = new ArrayList<>(); for (String scope : req.getHeader("OIDC_CLAIM_scopes").split(",")) { <START> scopes.add(PerunClient.Scope.valueOf(scope.trim().toUpperCase())); <END> } return new PerunClient(clientId, scopes); } return new PerunClient(); }</code><technical_language>throw IllegalArgumentException</technical_language>

Target:
protected PerunClient setupPerunClient(HttpServletRequest req) throws InternalErrorException, RpcException { if (req.getHeader("OIDC_CLAIM_audience") != null && !req.getHeader("OIDC_CLAIM_audience").isEmpty()) { String clientId = req.getHeader("OIDC_CLAIM_audience"); List<PerunClient.Scope> scopes = new ArrayList<>(); for (String scope : req.getHeader("OIDC_CLAIM_scopes").split(",")) { try { scopes.add(PerunClient.Scope.valueOf(scope.trim().toUpperCase())); } catch (IllegalArgumentException e) { throw new InternalErrorException("Scope "+scope.trim().toUpperCase()+" is unknown.", e); } } return new PerunClient(clientId, scopes); } return new PerunClient(); }
Source:
<code>public TipManager setAsRead(Tip tip) { <START> fReadList.remove(new Integer(tip.hashCode())); <END> fReadList.add(new Integer(tip.hashCode())); return this; }</code><technical_language>Integer.valueOf(...) instead</technical_language>

Target:
public TipManager setAsRead(Tip tip) { fReadList.remove(Integer.valueOf(tip.hashCode())); fReadList.add(Integer.valueOf(tip.hashCode())); return this; }
Source:
<code>public void shouldRemoveCommentsFromXml() { String templateWithComments = "<ClinicalDocument>\n" + "<!-- This is comment line -->\n" + "</ClinicalDocument>"; byte[] bytes = templateWithComments.getBytes(); Byte[] byteObjects = new Byte[bytes.length]; int i = 0; for (byte b : bytes) { <START> byteObjects[i++] = new Byte(b); <END> } String templateWithoutComments = "<ClinicalDocument>\n" + "\n" + "</ClinicalDocument>"; Map<String, String> properties = new HashMap<>(); CdaTemplate cdaTemplate = new CdaTemplate(); cdaTemplate.setTemplateData(byteObjects); bytes = new byte[cdaTemplate.getTemplateData().length]; i = 0; for (Byte b : cdaTemplate.getTemplateData()) { bytes[i++] = b.byteValue(); } assertEquals(templateWithoutComments, new String(bytes)); }</code><technical_language>autoboxing</technical_language>

Target:
public void shouldRemoveCommentsFromXml() { String templateWithComments = "<ClinicalDocument>\n" + "<!-- This is comment line -->\n" + "</ClinicalDocument>"; byte[] bytes = templateWithComments.getBytes(); Byte[] byteObjects = new Byte[bytes.length]; int i = 0; for (byte b : bytes) { byteObjects[i++] = b; } String templateWithoutComments = "<ClinicalDocument>\n" + "\n" + "</ClinicalDocument>"; CdaTemplate cdaTemplate = new CdaTemplate(); cdaTemplate.setTemplateData(byteObjects); bytes = new byte[cdaTemplate.getTemplateData().length]; i = 0; for (Byte b : cdaTemplate.getTemplateData()) { bytes[i++] = b; } assertEquals(templateWithoutComments, new String(bytes)); }
Source:
<code>public void handlesWhitespaceAfterLinks() throws Exception { MatcherAssert.assertThat( new MarkdownTxtmark().html( "Hi [google](<LINK_0> how are you?" ), Matchers.equalTo( MarkdownTxtmarkTest.replaceNewLine( <START> "<p>Hi \n<a href=\"<LINK_1>\">google</a> how are you?</p>\n" <END> ) ) ); }</code><technical_language>@dmzaytsev I get new line symbol here? I mean, in this line? question for other places</technical_language>

Target:
public void handlesWhitespaceAfterLinks() throws Exception { MatcherAssert.assertThat( new MarkdownTxtmark().html( "Hi [google](<LINK_0> how are you?" ), Matchers.equalTo( MarkdownTxtmarkTest.join( "MarkdownTxtmarkTest.START_PARAGRAPHHi ", "<a href=\"<LINK_1>\">google</a> how are you?</p>", "" ) ) ); }
Source:
<code>public void notifyChanged(Notification notification) { super.notifyChanged(notification); if (NotationPackage.eINSTANCE.getDrawerStyle_Collapsed() == notification.getFeature()) { <START> ((AbstractDiagramElementContainerEditPart) getHost()).notifyChanged(notification); <END> } }</code><technical_language>in a case of AbstractDiagramElementContainerEditPart host here</technical_language>

Target:
public void notifyChanged(Notification notification) { super.notifyChanged(notification); if (NotationPackage.eINSTANCE.getDrawerStyle_Collapsed() == notification.getFeature()) { regionPart.notifyChanged(notification); } }
Source:
<code><START> public String getHostname() { <END> return HOSTNAME; }</code><technical_language>this now, preventing lightblue core classes client side. If happens, Response hostname of client, server. Insead of this: a mutable hostname string getter/setters. Parse/tostring a regular field. Initialize if HOSTNAME in ctor</technical_language>

Target:
public String getHostname() { return hostname; }
Source:
<code>public static List<IdentityProvider> createProviders(Environment env, Collection<IdentityProviderConfig> providerConfigurations) { <START> final ImmutableList.Builder<IdentityProvider> providers = ImmutableList.builder(); <END> Iterator<IdentityProviderFactory> it = FACTORIES.iterator(); while (it.hasNext()) { IdentityProviderFactory factory = it.next(); Optional<IdentityProviderConfig> providerConfig = providerConfigurations.stream().filter(conf -> conf.getClass() == factory.getConfigType()).findFirst(); if (providerConfig.isPresent()) { try { providers.add(factory.create(env, providerConfig.get())); } catch (Exception e) { throw new SnowowlRuntimeException(String.format("Couldn't initialize '{}''s identity provider", factory), e); } } } return providers.build(); }</code><technical_language>sense build a Map keyed configuration class for factory implementations &ndash; expect of them..</technical_language>

Target:
public static List<IdentityProvider> createProviders(Environment env, Collection<IdentityProviderConfig> providerConfigurations) { final ImmutableList.Builder<IdentityProvider> providers = ImmutableList.builder(); Iterator<IdentityProviderFactory> it = FACTORIES.iterator(); while (it.hasNext()) { IdentityProviderFactory<IdentityProviderConfig> factory = it.next(); Optional<IdentityProviderConfig> providerConfig = providerConfigurations.stream().filter(conf -> conf.getClass() == factory.getConfigType()).findFirst(); if (providerConfig.isPresent()) { try { providers.add(factory.create(env, providerConfig.get())); } catch (Exception e) { throw new SnowowlRuntimeException(String.format("Couldn't initialize '{}''s identity provider", factory), e); } } } return providers.build(); }
Source:
<code>public String render(Boolean valueToRender) { if(valueToRender == null) return ""; <START> <END> if (trueText == null || falseText == null) { return valueToRender.toString(); } return valueToRender.booleanValue() ? trueText : falseText; }</code><technical_language>rebase, please wrap 'return' statement curly braces format lines (i.e. a white-space is missing 'if')</technical_language>

Target:
public String render(Boolean valueToRender) { if (valueToRender == null){ return ""; } if (trueText == null || falseText == null) { return valueToRender.toString(); } return valueToRender.booleanValue() ? trueText : falseText; }
Source:
<code>public void removeAlert(String authId, String journalKey, String subjectName) throws IOException { String nedId = getUserIdFromAuthId(authId); <START> if (nedId == null) { <END> throw new RuntimeException("failed to get NED ID"); } JsonArray alerts = userApi.requestObject(String.format("individuals/%s/alerts", nedId), JsonArray.class); JsonObject alert = findMatchingAlert(alerts, journalKey); if (alert == null) { throw new RuntimeException("no subject alert found"); } RemoveResult result = removeSubjectFromAlert(alert, subjectName); if (result == RemoveResult.NOT_FOUND) { throw new RuntimeException("matching subject alert not found"); } String alertId = String.valueOf(alert.getAsJsonPrimitive("id").getAsLong()); if (result == RemoveResult.EMPTY_AFTER_REMOVE) { userApi.deleteObject(String.format("individuals/%s/alerts/%s", nedId, alertId)); } else { userApi.putObject(String.format("individuals/%s/alerts/%s", nedId, alertId), alert); } }</code><technical_language>getUserIdFromAuthId returns null</technical_language>

Target:
public void removeAlert(String authId, String journalKey, String subjectName) throws IOException { String userId = userApi.getUserIdFromAuthId(authId); List<Alert> alerts = fetchAlerts(userId); Alert alert = findMatchingAlert(alerts, journalKey) .orElseThrow(() -> new SubjectAlertException("no subject alert found")); RemoveResult result = removeSubjectFromAlert(alert, subjectName); if (result == RemoveResult.NOT_FOUND) { throw new SubjectAlertException("matching subject alert not found"); } String alertId = alert.getId().toString(); if (result == RemoveResult.EMPTY_AFTER_REMOVE) { userApi.deleteObject(String.format("individuals/%s/alerts/%s", userId, alertId)); } else { userApi.putObject(String.format("individuals/%s/alerts/%s", userId, alertId), alert); } }
Source:
<code>protected ILogData getNextEntry(QueuedStreamContext context, long maxGlobal) { boolean useBackpointers = this.runtime.getParameters().isFollowBackpointersEnabled(); if (context.readQueue.isEmpty() && context.readCpQueue.isEmpty() && !fillReadQueue(maxGlobal, context)) { return null; } if (maxGlobal < context.checkpointSuccessStartAddr) { throw new TrimmedException(); } NavigableSet<Long> getFrom; if (context.readCpQueue.size() > 0) { getFrom = context.readCpQueue; context.setGlobalPointer(context.checkpointSuccessStartAddr); } else { getFrom = context.readQueue; } if (context.readCpQueue.isEmpty() && context.readQueue.first() > maxGlobal) { return null; } if (useBackpointers) { if (getFrom.size() > 0) { final long thisRead = getFrom.pollFirst(); ILogData ld = read(thisRead); if (getFrom == context.readQueue) { addToResolvedQueue(context, thisRead, ld); } return ld; } } else { <START> boolean getNext; <END> do { if (getFrom.size() > 0) { final long thisRead = getFrom.pollFirst(); int counter = 1; List<Long> batchRead = new ArrayList<>(); batchRead.add(thisRead); Iterator<Long> it = getFrom.iterator(); while (it.hasNext() && counter < batchSize) { batchRead.add(it.next()); counter++; } log.trace("getNextEntry[{}]: reading {}, if not present read batch of addresses: {}", this, thisRead, batchRead); ILogData ld = readRange(thisRead, batchRead); if (getFrom == context.readQueue) { if (ld.containsStream(this.id)) { addToResolvedQueue(context, thisRead, ld); return ld; } else { log.trace("getNextEntry[{}]: the data for address does not belong to this stream. Skip.", this, thisRead); getNext = true; } } else { return ld; } } else { getNext = false; } } while (getNext); } return null; }</code><technical_language>put else block a separate function. is long</technical_language>

Target:
protected ILogData getNextEntry(QueuedStreamContext context, long maxGlobal) { if (context.readQueue.isEmpty() && context.readCpQueue.isEmpty() && !fillReadQueue(maxGlobal, context)) { return null; } if (maxGlobal < context.checkpointSuccessStartAddr) { throw new TrimmedException(); } NavigableSet<Long> getFrom; if (context.readCpQueue.size() > 0) { getFrom = context.readCpQueue; context.setGlobalPointer(context.checkpointSuccessStartAddr); } else { getFrom = context.readQueue; } if (context.readCpQueue.isEmpty() && context.readQueue.first() > maxGlobal) { return null; } return removeFromQueue(getFrom); }
Source:
<code><START> private static synchronized byte[] format(File file, Checksum original, Checksum formatted) throws IOException { <END> try (InputStream in = new CheckedInputStream(new BufferedInputStream(new FileInputStream(file)), original)) { ByteArrayOutputStream buffer = FORMATTING_BUFFER != null ? FORMATTING_BUFFER.get() : null; if (buffer == null) { buffer = new ByteArrayOutputStream(); FORMATTING_BUFFER = new WeakReference<>(buffer); } else { buffer.reset(); } XMLSerializer serializer = new XMLSerializer(new CheckedOutputStream(buffer, formatted), FORMAT); XMLReader reader = XMLReaderFactory.createXMLReader(); reader.setContentHandler(serializer); reader.setDTDHandler(serializer); reader.parse(new InputSource(in)); return buffer.toByteArray(); } catch (SAXException ex) { throw new IOException(ex); } }</code><technical_language>synchronized</technical_language>

Target:
private byte[] format(File file, Checksum original, Checksum formatted) throws IOException { try (InputStream in = new CheckedInputStream(new BufferedInputStream(new FileInputStream(file)), original)) { ByteArrayOutputStream buffer = formattingBuffer != null ? formattingBuffer.get() : null; if (buffer == null) { buffer = new ByteArrayOutputStream(); formattingBuffer = new WeakReference<>(buffer); } else { buffer.reset(); } XMLSerializer serializer = new XMLSerializer(new CheckedOutputStream(buffer, formatted), format); XMLReader reader = XMLReaderFactory.createXMLReader(); reader.setContentHandler(serializer); reader.setDTDHandler(serializer); reader.parse(new InputSource(in)); return buffer.toByteArray(); } catch (SAXException ex) { throw new IOException(ex); } }
Source:
<code><START> static GlyphPair <END> gp(String original, String mirror) { return new GlyphPair(original, mirror); }</code><technical_language>nit: public. this of package, is reason restrict it, visibility constructor, is a shortcut for ctor</technical_language>

Target:
public static GlyphPair gp(String original, String mirror) { return new GlyphPair(original, mirror); }
Source:
<code><START> private Class selectSocketChannel() { <END> if (useNativeTransport && OsUtils.isOSLinux()) { return EpollServerSocketChannel.class; } return NioServerSocketChannel.class; }</code><technical_language>Returns Class<? extends ServerSocketChannel> instead</technical_language>

Target:
private Class<? extends ServerSocketChannel> selectSocketChannel() { if (useNativeTransport && OsUtils.isOSLinux()) { return EpollServerSocketChannel.class; } return NioServerSocketChannel.class; }
Source:
<code>public void testNewQuestionFrame() { ______TS("MCQ: new question (frame) link"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MCQ"); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); if (!feedbackEditPage.isElementSelected("generateMcqOptionsCheckbox--1")) { feedbackEditPage.clickGenerateMcqOptionsCheckbox(-1); } assertFalse(feedbackEditPage.isElementVisible("mcqChoiceTable--1")); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); <START> <END> ______TS("MCQ: verify UI after cancelling"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MCQ"); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); assertFalse(feedbackEditPage.isElementVisible("mcqChoiceTable--1")); }</code><technical_language>I running test locally; new question button clicked discard changes confirmation dialog is open</technical_language>

Target:
public void testNewQuestionFrame() { ______TS("MCQ: new question (frame) link"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MCQ"); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); if (!feedbackEditPage.isElementSelected("generateMcqOptionsCheckbox--1")) { feedbackEditPage.clickGenerateMcqOptionsCheckbox(-1); } assertFalse(feedbackEditPage.isElementVisible("mcqChoiceTable--1")); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); feedbackEditPage.waitForConfirmationModalAndClickOk(); ______TS("MCQ: verify UI after cancelling"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MCQ"); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); assertFalse(feedbackEditPage.isElementVisible("mcqChoiceTable--1")); }
Source:
<code>public static boolean interactWithFluidHandler(@Nonnull EntityPlayer player, @Nonnull EnumHand hand, @Nonnull World world, @Nonnull BlockPos pos, @Nullable EnumFacing side) { Preconditions.checkNotNull(player); Preconditions.checkNotNull(hand); Preconditions.checkNotNull(world); Preconditions.checkNotNull(pos); ItemStack heldItem = player.getHeldItem(hand); if (!heldItem.isEmpty()) { IFluidHandler blockFluidHandler = getFluidHandler(world, pos, side); if (blockFluidHandler != null) { <START> IItemHandler playerInventory = new InvWrapper(player.inventory); <END> FluidActionResult fluidActionResult = tryFillContainerAndStow(heldItem, blockFluidHandler, playerInventory, Integer.MAX_VALUE, player); if (!fluidActionResult.isSuccess()) { fluidActionResult = tryEmptyContainerAndStow(heldItem, blockFluidHandler, playerInventory, Integer.MAX_VALUE, player); } if (fluidActionResult.isSuccess()) { player.setHeldItem(hand, fluidActionResult.getResult()); return true; } } } return false; }</code><technical_language>player.getCapability(ITEM_HANDLER_CAPABILITY, null)</technical_language>

Target:
public static boolean interactWithFluidHandler(@Nonnull EntityPlayer player, @Nonnull EnumHand hand, @Nonnull World world, @Nonnull BlockPos pos, @Nullable EnumFacing side) { Preconditions.checkNotNull(player); Preconditions.checkNotNull(hand); Preconditions.checkNotNull(world); Preconditions.checkNotNull(pos); ItemStack heldItem = player.getHeldItem(hand); if (!heldItem.isEmpty()) { IFluidHandler blockFluidHandler = getFluidHandler(world, pos, side); if (blockFluidHandler != null) { IItemHandler playerInventory = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); if (playerInventory != null) { FluidActionResult fluidActionResult = tryFillContainerAndStow(heldItem, blockFluidHandler, playerInventory, Integer.MAX_VALUE, player); if (!fluidActionResult.isSuccess()) { fluidActionResult = tryEmptyContainerAndStow(heldItem, blockFluidHandler, playerInventory, Integer.MAX_VALUE, player); } if (fluidActionResult.isSuccess()) { player.setHeldItem(hand, fluidActionResult.getResult()); return true; } } } } return false; }
Source:
<code>public void truncateTables(final Set<TableReference> tablesToTruncate) { if (!tablesToTruncate.isEmpty()) { try { <START> clientPool.run(new FunctionCheckedException<Client, Void, Exception>() { <END> @Override public Void apply(Client client) throws Exception { for (TableReference tableRef : tablesToTruncate) { truncateInternal(client, tableRef); } return null; } @Override public String toString() { return "truncateTables(" + tablesToTruncate.size() + " tables)"; } }); } catch (UnavailableException e) { throw new PalantirRuntimeException("Truncating tables requires all Cassandra nodes" + " to be up and available."); } catch (Exception e) { throw Throwables.throwUncheckedException(e); } } }</code><technical_language>this change dedupe logic this deleteRange()</technical_language>

Target:
public void truncateTables(final Set<TableReference> tablesToTruncate) { if (!tablesToTruncate.isEmpty()) { try { runTruncateInternal(tablesToTruncate); } catch (UnavailableException e) { throw new PalantirRuntimeException("Truncating tables requires all Cassandra nodes" + " to be up and available."); } catch (TException e) { throw Throwables.throwUncheckedException(e); } } }
Source:
<code>public synchronized EmbeddedCacheManager startNewNode() { EmbeddedCacheManager cacheManager; try { cacheManager = TestCacheManagerFactory.fromXml(configurationResourceName); } catch (IOException e) { throw new RuntimeException(e); } cacheManagers.add(cacheManager); Cache<K, V> cache = cacheManager.getCache(); caches.add(cache); <START> waitForReashToComplete(cache, caches); <END> TestingUtil.waitForRehashToComplete(caches); return cacheManager; }</code><technical_language>misspelled? :)</technical_language>

Target:
public synchronized EmbeddedCacheManager startNewNode() { EmbeddedCacheManager cacheManager; try { cacheManager = TestCacheManagerFactory.fromXml(configurationResourceName); } catch (IOException e) { throw new RuntimeException(e); } cacheManagers.add(cacheManager); Cache<K, V> cache = cacheManager.getCache(); caches.add(cache); waitForRehashToComplete(cache, caches); return cacheManager; }
Source:
<code>public synchronized Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { String jsonString = json.getAsString(); try { return localFormat.parse(jsonString); } catch (final ParseException ignored) { } try { return local24HourFormat.parse(jsonString); } catch (final ParseException ignored) { } try { return enUsFormat.parse(jsonString); } catch (final ParseException ignored) { } try { return enUs24HourFormat.parse(jsonString); } catch (final ParseException ignored) { } <START> try { <END> return iso8601Format.parse(jsonString); } catch (ParseException e) { Logger.e(TAG, "Could not parse date: " + e.getMessage(), "", ADALError.DATE_PARSING_FAILURE, e); } throw new JsonParseException("Could not parse date: " + jsonString); }</code><technical_language>please change order start iso8601Format, popular</technical_language>

Target:
public synchronized Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { String jsonString = json.getAsString(); try { return iso8601Format.parse(jsonString); } catch (final ParseException ignored) { } try { return localFormat.parse(jsonString); } catch (final ParseException ignored) { } try { return local24HourFormat.parse(jsonString); } catch (final ParseException ignored) { } try { return enUsFormat.parse(jsonString); } catch (final ParseException ignored) { } try { return enUs24HourFormat.parse(jsonString); } catch (final ParseException e) { Logger.e(TAG, "Could not parse date: " + e.getMessage(), "", ADALError.DATE_PARSING_FAILURE, e); } throw new JsonParseException("Could not parse date: " + jsonString); }
Source:
<code>private void processOptions(RepositoryState state) throws JGitInternalException { if (tagger == null) tagger = new PersonIdent(repo); if (name == null || !Repository.isValidRefName(Constants.R_TAGS + name)) <START> throw new JGitInternalException(MessageFormat.format( <END> JGitText.get().tagNameInvalid, name == null ? "<null>" : name)); if (signed) throw new UnsupportedOperationException( JGitText.get().signingNotSupportedOnTag); }</code><technical_language>Is this internal exception? If caller gave a tag name accept a reference name is encountering a form of repository corruption recover easily. caller needs correct input. thinking EGit UI case here. If UI passes tag name entered user, runs call(), need throw tells UI backup user correct input. if a valid tag name crash wrong deep of ObjectInserter, a totally kind of error for EGit UI present human</technical_language>

Target:
private void processOptions(RepositoryState state) throws InvalidTagNameException { if (tagger == null) tagger = new PersonIdent(repo); if (name == null || !Repository.isValidRefName(Constants.R_TAGS + name)) throw new InvalidTagNameException(MessageFormat.format(JGitText .get().tagNameInvalid, name == null ? "<null>" : name)); if (signed) throw new UnsupportedOperationException( JGitText.get().signingNotSupportedOnTag); }
Source:
<code>public static Graph createResultTrendGraph(AbstractBuild<?, ?> owner, Boolean isCompleted, List<AWSDeviceFarmTestResult> results) { List<String> rows = new ArrayList<String>(); List<Number> vals = new ArrayList<Number>(); List<NumberOnlyBuildLabel> cols = new ArrayList<NumberOnlyBuildLabel>(); for (AWSDeviceFarmTestResult result : results) { <START> hudson.model.Run<?, ?> build = result.getOwner(); <END> NumberOnlyBuildLabel label = new NumberOnlyBuildLabel(build); rows.add("Pass"); cols.add(label); vals.add(result.getPassCount()); rows.add("Warn"); cols.add(label); vals.add(result.getWarnCount()); rows.add("Fail"); cols.add(label); vals.add(result.getFailCount()); } CategoryDataset dataset = createDataset(vals, rows, cols); Color[] colors = new Color[]{AWSDeviceFarmGraph.PassColor, AWSDeviceFarmGraph.WarnColor, AWSDeviceFarmGraph.FailColor}; return new AWSDeviceFarmGraph(owner, isCompleted, getGraphSize(), dataset, "Build #", "# of tests", colors); }</code><technical_language>I a reason import this top reference Run. a namespace clash</technical_language>

Target:
public static Graph createResultTrendGraph(AbstractBuild<?, ?> owner, Boolean isCompleted, List<AWSDeviceFarmTestResult> results) { List<String> rows = new ArrayList<String>(); List<Number> vals = new ArrayList<Number>(); List<NumberOnlyBuildLabel> cols = new ArrayList<NumberOnlyBuildLabel>(); for (AWSDeviceFarmTestResult result : results) { Run<?, ?> build = result.getOwner(); NumberOnlyBuildLabel label = new NumberOnlyBuildLabel(build); rows.add("Pass"); cols.add(label); vals.add(result.getPassCount()); rows.add("Warn"); cols.add(label); vals.add(result.getWarnCount()); rows.add("Fail"); cols.add(label); vals.add(result.getFailCount()); } CategoryDataset dataset = createDataset(vals, rows, cols); Color[] colors = new Color[]{AWSDeviceFarmGraph.PassColor, AWSDeviceFarmGraph.WarnColor, AWSDeviceFarmGraph.FailColor}; return new AWSDeviceFarmGraph(owner, isCompleted, getGraphSize(), dataset, "Build #", "# of tests", colors); }
Source:
<code>public void close() { fetches.clear(); <START> buffer.clear(); <END> pendingCalls.clear(); }</code><technical_language>Other places in this module handle buffer == null</technical_language>

Target:
public void close() { fetches.clear(); pendingCalls.clear(); if (buffer != null) { buffer.clear(); } }
Source:
<code>protected void executeCommand() { Map<Boolean, List<VM>> vms = vmDao.getForDisk(getParameters().getImageGroupId(), true); <START> boolean attachedToVms = vms.computeIfAbsent(Boolean.TRUE, b -> new ArrayList<>()) .stream() .anyMatch(VM::isDown); <END> if (!vms.isEmpty() && attachedToVms && storageDomainDao.get(getParameters().getStorageDomainId()).getStorageType().isBlockDomain()) { if (!executeWithHost(getParameters().getVdsRunningOn(), host -> imagesHandler.prepareImage(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), host).getSucceeded())) { log.error("Failed to prepare image '{}/{}'", getParameters().getImageGroupId(), getParameters().getImageId()); return; } getParameters().setShouldTeardown(true); } long volumeSize = (long) vdsCommandsHelper.runVdsCommandWithFailover( VDSCommandType.MeasureVolume, new MeasureVolumeVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), getParameters().getDstVolFormat()), getParameters().getStoragePoolId(), null) .getReturnValue(); persistCommandIfNeeded(); setActionReturnValue(volumeSize); setSucceeded(true); }</code><technical_language>a stupid question, how, - if of VMs is means attachedToVms? maps next check, is as: "// want prepare if SD is block disk is plugged" allMatch</technical_language>

Target:
protected void executeCommand() { Map<Boolean, List<VM>> vms = vmDao.getForDisk(getParameters().getImageGroupId(), true); if (!vms.isEmpty() && !isAttachedToRunningVMs(vms) && storageDomainDao.get(getParameters().getStorageDomainId()).getStorageType().isBlockDomain()) { if (!executeWithHost(getParameters().getVdsRunningOn(), host -> imagesHandler.prepareImage(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), host).getSucceeded())) { log.error("Failed to prepare image '{}/{}'", getParameters().getImageGroupId(), getParameters().getImageId()); return; } getParameters().setShouldTeardown(true); } long volumeSize = (long) vdsCommandsHelper.runVdsCommandWithFailover( VDSCommandType.MeasureVolume, new MeasureVolumeVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), getParameters().getDstVolFormat()), getParameters().getStoragePoolId(), null) .getReturnValue(); persistCommandIfNeeded(); setActionReturnValue(volumeSize); setSucceeded(true); }
Source:
<code>public void test() { connect(); <START> sleep(600); <END> Assert.assertTrue(jq(".z-tab").eq(16).hasClass("z-tab-selected")); Assert.assertEquals("true", getZKLog()); }</code><technical_language>waitResponse()</technical_language>

Target:
public void test() { connect(); waitResponse(); Assert.assertTrue(jq(".z-tab").eq(16).hasClass("z-tab-selected")); Assert.assertEquals("true", getZKLog()); }
Source:
<code>private void executeFirstChunkedQuery() throws SQLException { boolean checkpointsSaved = _chunkingKeys.values().iterator().next() != null; if (checkpointsSaved) { <START> prepareChunkedQuery(_queryStmt, new ArrayList<>(_chunkingKeys.values())); <END> executeChunkedQuery(_queryStmt); } else { executeChunkedQuery(_firstStmt); } }</code><technical_language>I guess 2 lines replaced call executeNextChunkedQuery()</technical_language>

Target:
private void executeFirstChunkedQuery() throws SQLException { boolean checkpointsSaved = _chunkingKeys.values().iterator().next() != null; if (checkpointsSaved) { executeNextChunkedQuery(); } else { executeChunkedQuery(_firstStmt); } }
Source:
<code>private void setFatalError(HL7InQueue hl7InQueue, String error, Throwable cause) { HL7InError hl7InError = new HL7InError(hl7InQueue); hl7InError.setError(error); if (cause == null) { hl7InError.setErrorDetails(""); } else { StringWriter sw = new StringWriter(); log.error(cause); sw.flush(); <START> hl7InError.setErrorDetails(OpenmrsUtil.shortenedStackTrace(sw.toString())); <END> } Context.getHL7Service().saveHL7InError(hl7InError); Context.getHL7Service().purgeHL7InQueue(hl7InQueue); log.info(error, cause); }</code><technical_language>Please hl7InError.setErrorDetails(ExceptionUtils.getStackTrace(case)); instead get rid of StringWriter entirely. fine log.error(cause)</technical_language>

Target:
private void setFatalError(HL7InQueue hl7InQueue, String error, Throwable cause) { HL7InError hl7InError = new HL7InError(hl7InQueue); hl7InError.setError(error); if (cause == null) { hl7InError.setErrorDetails(""); } else { log.error(cause); hl7InError.setErrorDetails(ExceptionUtils.getStackTrace(cause)); } Context.getHL7Service().saveHL7InError(hl7InError); Context.getHL7Service().purgeHL7InQueue(hl7InQueue); log.info(error, cause); }
Source:
<code>public String toString() { StringBuilder buf= new StringBuilder(); buf.append("Id: ").append(getErrorCode(fId)).append('\n'); buf.append('[').append(fOffset).append(", ").append(fLength).append(']').append('\n'); <START> for (String a : fArguments) { <END> buf.append(a); buf.append('\n'); } return buf.toString(); }</code><technical_language>change arg</technical_language>

Target:
public String toString() { StringBuilder buf= new StringBuilder(); buf.append("Id: ").append(getErrorCode(fId)).append('\n'); buf.append('[').append(fOffset).append(", ").append(fLength).append(']').append('\n'); for (String arg : fArguments) { buf.append(arg); buf.append('\n'); } return buf.toString(); }
Source:
<code>private void addSequencesFromCache( final List<Sequence<T>> listOfSequences, final List<Pair<Interval, byte[]>> cachedResults ) { if (strategy == null) { return; } final Function<Object, T> pullFromCacheFunction = strategy.pullFromCache(); final TypeReference<Object> cacheObjectClazz = strategy.getCacheObjectClazz(); for (Pair<Interval, byte[]> cachedResultPair : cachedResults) { final byte[] cachedResult = cachedResultPair.rhs; Sequence<Object> cachedSequence = new BaseSequence<>( new BaseSequence.IteratorMaker<Object, Iterator<Object>>() { @Override public Iterator<Object> make() { try { if (cachedResult.length == 0) { return Iterators.emptyIterator(); } <START> return ((List<Object>) objectMapper.readValue( <END> objectMapper.getFactory().createParser(cachedResult), cacheObjectClazz )).iterator(); } catch (IOException e) { throw new RuntimeException(e); } } @Override public void cleanup(Iterator<Object> iterFromMake) { } } ); listOfSequences.add(Sequences.map(cachedSequence, pullFromCacheFunction)); } }</code><technical_language>I readValues work here. docs "Sequence root-level 'unwrapped' sequence (without surrounding JSON array), a sequence contained in a JSON Array."</technical_language>

Target:
private void addSequencesFromCache( final List<Sequence<T>> listOfSequences, final List<Pair<Interval, byte[]>> cachedResults ) { if (strategy == null) { return; } final Function<Object, T> pullFromCacheFunction = strategy.pullFromCache(); final TypeReference<Object> cacheObjectClazz = strategy.getCacheObjectClazz(); for (Pair<Interval, byte[]> cachedResultPair : cachedResults) { final byte[] cachedResult = cachedResultPair.rhs; Sequence<Object> cachedSequence = new BaseSequence<>( new BaseSequence.IteratorMaker<Object, Iterator<Object>>() { @Override public Iterator<Object> make() { try { if (cachedResult.length == 0) { return Iterators.emptyIterator(); } return objectMapper.readValues( objectMapper.getFactory().createParser(cachedResult), cacheObjectClazz ); } catch (IOException e) { throw new RuntimeException(e); } } @Override public void cleanup(Iterator<Object> iterFromMake) { } } ); listOfSequences.add(Sequences.map(cachedSequence, pullFromCacheFunction)); } }
Source:
<code>private long createTags(OseeConnection connection, Collection<IndexedResource> sources) throws OseeCoreException { SearchTagCollector tagCollector = new SearchTagCollector(); Set<Long> processed = new HashSet<Long>(); Map<Long, Collection<Long>> toStore = new HashMap<Long, Collection<Long>>(); for (IndexedResource source : sources) { long startItemTime = System.currentTimeMillis(); Long gamma = source.getGammaId(); if (processed.add(gamma)) { Set<Long> tags = new HashSet<Long>(); toStore.put(gamma, tags); tagCollector.setCurrentTag(gamma, tags); try { long typeUuid = source.getTypeUuid(); String taggerId = getTaggerIdByTypeUuid(typeUuid); if (taggingEngine.hasTagger(taggerId)) { Tagger tagger = taggingEngine.getTagger(taggerId); tagger.tagIt(source, tagCollector); if (isStorageAllowed(toStore)) { getLogger().debug("Stored a - [%s] - connectionId[%s] - [%s]", getTagQueueQueryId(), connection, toStore); storeTags(connection, toStore); } } else { getLogger().error("Field has no tagger provider and cannot be tagged - [Gamma: %s]", gamma); <START> } <END> } catch (Exception ex) { getLogger().error(ex, "Unable to tag - [%s]", gamma); } finally { long endItemTime = System.currentTimeMillis() - startItemTime; notifyOnIndexItemComplete(gamma, tags.size(), endItemTime); } } } if (!toStore.isEmpty()) { getLogger().debug("Stored b - [%s] - connectionId[%s] - [%s]", getTagQueueQueryId(), connection, toStore); storeTags(connection, toStore); } return tagCollector.getTotalTags(); }</code><technical_language>want add taggerId a param logger incase taggerId is useful "No tagger for taggerId[%s] - unable tag - [Gamma: %s] ", gamma, taggerId</technical_language>

Target:
private long createTags(OseeConnection connection, Collection<IndexedResource> sources) throws OseeCoreException { SearchTagCollector tagCollector = new SearchTagCollector(); Set<Long> processed = new HashSet<Long>(); Map<Long, Collection<Long>> toStore = new HashMap<Long, Collection<Long>>(); for (IndexedResource source : sources) { long startItemTime = System.currentTimeMillis(); Long gamma = source.getGammaId(); if (processed.add(gamma)) { Set<Long> tags = new HashSet<Long>(); toStore.put(gamma, tags); tagCollector.setCurrentTag(gamma, tags); try { long typeUuid = source.getTypeUuid(); String taggerId = getTaggerIdByTypeUuid(typeUuid); if (taggingEngine.hasTagger(taggerId)) { Tagger tagger = taggingEngine.getTagger(taggerId); tagger.tagIt(source, tagCollector); if (isStorageAllowed(toStore)) { getLogger().debug("Stored a - [%s] - connectionId[%s] - [%s]", getTagQueueQueryId(), connection, toStore); storeTags(connection, toStore); } } else { getLogger().error("Field has invalid tagger[%s] provider and cannot be tagged - [Gamma: %s]", taggerId, gamma); } } catch (Exception ex) { getLogger().error(ex, "Unable to tag - [%s]", gamma); } finally { long endItemTime = System.currentTimeMillis() - startItemTime; notifyOnIndexItemComplete(gamma, tags.size(), endItemTime); } } } if (!toStore.isEmpty()) { getLogger().debug("Stored b - [%s] - connectionId[%s] - [%s]", getTagQueueQueryId(), connection, toStore); storeTags(connection, toStore); } return tagCollector.getTotalTags(); }
Source:
<code>public void resolve(List<Material> materials) { materials.stream() <START> .filter((material) -> material instanceof SecretParamAware && ((SecretParamAware) material).hasSecretParams()) <END> .forEach((material) -> { if (material instanceof ScmMaterial) { this.resolve((ScmMaterial) material); } else if (material instanceof PluggableSCMMaterial) { this.resolve((PluggableSCMMaterial) material); } }); }</code><technical_language>sense move hasSecretParams() check resolve method</technical_language>

Target:
public void resolve(List<Material> materials) { materials.stream() .filter((material) -> material instanceof SecretParamAware) .forEach(this::resolve); }
Source:
<code>public void terminationProperties() { contextRunner <START> .withPropertyValues("optaplanner.solver.termination.spent-limit=PT4H") <END> .run(context -> { TerminationConfig terminationConfig = context.getBean(SolverConfig.class).getTerminationConfig(); assertEquals(Duration.ofHours(4), terminationConfig.getSpentLimit()); assertNotNull(context.getBean(SolverFactory.class)); }); contextRunner .withPropertyValues("optaplanner.solver.termination.unimproved-spent-limit=PT5H") .run(context -> { TerminationConfig terminationConfig = context.getBean(SolverConfig.class).getTerminationConfig(); assertEquals(Duration.ofHours(5), terminationConfig.getUnimprovedSpentLimit()); assertNotNull(context.getBean(SolverFactory.class)); }); contextRunner .withPropertyValues("optaplanner.solver.termination.best-score-limit=6") .run(context -> { TerminationConfig terminationConfig = context.getBean(SolverConfig.class).getTerminationConfig(); assertEquals(SimpleScore.of(6).toString(), terminationConfig.getBestScoreLimit()); assertNotNull(context.getBean(SolverFactory.class)); }); }</code><technical_language>4h</technical_language>

Target:
public void terminationProperties() { contextRunner .withPropertyValues("optaplanner.solver.termination.spent-limit=4h") .run(context -> { TerminationConfig terminationConfig = context.getBean(SolverConfig.class).getTerminationConfig(); assertEquals(Duration.ofHours(4), terminationConfig.getSpentLimit()); assertNotNull(context.getBean(SolverFactory.class)); }); contextRunner .withPropertyValues("optaplanner.solver.termination.unimproved-spent-limit=5h") .run(context -> { TerminationConfig terminationConfig = context.getBean(SolverConfig.class).getTerminationConfig(); assertEquals(Duration.ofHours(5), terminationConfig.getUnimprovedSpentLimit()); assertNotNull(context.getBean(SolverFactory.class)); }); contextRunner .withPropertyValues("optaplanner.solver.termination.best-score-limit=6") .run(context -> { TerminationConfig terminationConfig = context.getBean(SolverConfig.class).getTerminationConfig(); assertEquals(SimpleScore.of(6).toString(), terminationConfig.getBestScoreLimit()); assertNotNull(context.getBean(SolverFactory.class)); }); }
Source:
<code>private void validateAndSetNewDesignation(final int desigColumn, final Row xlsRow, final MeasurementRow measurementRow) throws WorkbookParserException { final String newDesig = this.getDesignation(xlsRow, desigColumn); <START> setNewDesignation(measurementRow, newDesig); <END> }</code><technical_language>Please add this</technical_language>

Target:
private void validateAndSetNewDesignation(final int desigColumn, final Row xlsRow, final MeasurementRow measurementRow) throws WorkbookParserException { final String newDesig = this.getDesignation(xlsRow, desigColumn); this.setNewDesignation(measurementRow, newDesig); }