auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Map<String, Fingerprint> loadFingerprints(final Path fingerprintFile, final String specificSample) { SequenceUtil.assertSequenceDictionariesEqual(this.haplotypes.getHeader().getSequenceDictionary(), VCFFileReader.getSequenceDictionary(fingerprintFile)); final VCFFileReader reader = new VCFFileReader(fingerprintFile, false); <START> Map<String, Fingerprint> fingerprints; <END> if (reader.isQueryable()) { fingerprints = loadFingerprintsFromQueriableReader(reader, specificSample, fingerprintFile); } else { log.warn("Couldn't find index for file " + fingerprintFile + " going to read through it all."); fingerprints = loadFingerprintsFromVariantContexts(reader, specificSample, fingerprintFile); } for (final String sample : reader.getFileHeader().getGenotypeSamples()) { fingerprints.computeIfAbsent(sample, s -> new Fingerprint(s, fingerprintFile, null)); } return fingerprints; }</code><technical_language>final</technical_language>

Target:
public Map<String, Fingerprint> loadFingerprints(final Path fingerprintFile, final String specificSample) { SequenceUtil.assertSequenceDictionariesEqual(this.haplotypes.getHeader().getSequenceDictionary(), VCFFileReader.getSequenceDictionary(fingerprintFile)); final VCFFileReader reader = new VCFFileReader(fingerprintFile, false); final Map<String, Fingerprint> fingerprints; if (reader.isQueryable()) { fingerprints = loadFingerprintsFromQueriableReader(reader, specificSample, fingerprintFile); } else { log.warn("Couldn't find index for file " + fingerprintFile + " going to read through it all."); fingerprints = loadFingerprintsFromVariantContexts(reader, specificSample, fingerprintFile); } for (final String sample : reader.getFileHeader().getGenotypeSamples()) { fingerprints.computeIfAbsent(sample, s -> new Fingerprint(s, fingerprintFile, null)); } return fingerprints; }
Source:
<code>public void extractedManaged(OperationContext context, ModelNode operation) { <START> String name = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue(); <END> ModelNode deployment = context.readResourceFromRoot(PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT, name))).getModel(); if (deployment.hasDefined(CONTENT_RESOURCE_ALL.getName())) { ModelNode content = deployment.get(CONTENT_RESOURCE_ALL.getName()).asList().get(0); context.getResult().set(!isUnmanagedContent(content)); } }</code><technical_language>context.getCurrentAddressValue() instead</technical_language>

Target:
public void extractedManaged(OperationContext context, ModelNode operation) { String name = context.getCurrentAddressValue(); ModelNode deployment = context.readResourceFromRoot(PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT, name))).getModel(); if (deployment.hasDefined(CONTENT_RESOURCE_ALL.getName())) { ModelNode content = deployment.get(CONTENT_RESOURCE_ALL.getName()).asList().get(0); context.getResult().set(!isUnmanagedContent(content)); } }
Source:
<code>public void setUrlResourceReaderRootDirs(String... rootResourceDirs) throws IOException { Configuration configuration = configAdmin.getConfiguration(PID, null); Dictionary<String, Object> properties = new DictionaryMap<>(); Set<String> rootResourceDirectories = ImmutableSet.<String>builder().add(rootResourceDirs).build(); properties.put("rootResourceDirectories", rootResourceDirectories); <START> configuration.update(properties); <END> for (int i = 0; i < 5; i++) { Configuration updatedConfig = configAdmin.getConfiguration(PID, null); if (updatedConfig .getProperties() .get("rootResourceDirectories") .equals(rootResourceDirectories)) { break; } else { try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException e) { } } } LOGGER.info("URLResourceReader props after update: {}", configuration.getProperties()); }</code><technical_language>5</technical_language>

Target:
public void setUrlResourceReaderRootDirs(String... rootResourceDirs) throws IOException { Configuration configuration = configAdmin.getConfiguration(PID, null); Dictionary<String, Object> properties = new DictionaryMap<>(); Set<String> rootResourceDirectories = ImmutableSet.<String>builder().add(rootResourceDirs).build(); properties.put("rootResourceDirectories", rootResourceDirectories); configuration.update(properties); for (int i = 0; i < 5; i++) { Configuration updatedConfig = configAdmin.getConfiguration(PID, null); if (updatedConfig .getProperties() .get("rootResourceDirectories") .equals(rootResourceDirectories)) { break; } boolean interrupted = false; try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException e) { interrupted = true; } finally { if (interrupted) { Thread.currentThread().interrupt(); } } } LOGGER.info("URLResourceReader props after update: {}", configuration.getProperties()); }
Source:
<code>private static ByteString binaryOperator( ByteString b0, long b1, BinaryOperator<Byte> bitOp) { <START> byte[] bytes0 = b0.getBytes(); <END> final byte[] result = new byte[bytes0.length]; for (int i = 0; i < bytes0.length; i++) { result[i] = bitOp.apply((byte) (b1 >> 8 * (bytes0.length - i - 1)), bytes0[i]); } return new ByteString(result); }</code><technical_language>final</technical_language>

Target:
private static ByteString binaryOperator( ByteString b0, long b1, BinaryOperator<Byte> bitOp) { final byte[] bytes0 = b0.getBytes(); for (int i = 0; i < bytes0.length; i++) { bytes0[i] = bitOp.apply((byte) (b1 >> 8 * (bytes0.length - i - 1)), bytes0[i]); } return new ByteString(bytes0); }
Source:
<code>private synchronized ListenableFuture<?> updateSystemMemory(long delta) <START> { <END> long userMemory = memoryPool.getQueryUserMemoryReservation(queryId); if (delta >= 0) { if (queryMemoryContext.getSystemMemory() + userMemory + delta > maxTotalMemory) { throw exceededLocalTotalMemoryLimit(succinctBytes(maxTotalMemory)); } return systemMemoryPool.reserve(queryId, delta); } systemMemoryPool.free(queryId, -delta); return NOT_BLOCKED; }</code><technical_language>I write this way: // call memoryPool.getQueryUserMemoryReservation(queryId) instead of queryMemoryContext.getUserMemory(). // // Calling result in dead lock: // * A thread user allocation acquire locks in this order: // 1. monitor of queryMemoryContext.userAggregateMemoryContext // 2. monitor of this (QueryContext) // * this thread acquire locks in this order: // 1. monitor of this (QueryContext) // 2. monitor of queryMemoryContext.userAggregateMemoryContext</technical_language>

Target:
private synchronized ListenableFuture<?> updateSystemMemory(long delta) { long totalMemory = memoryPool.getQueryMemoryReservation(queryId); if (delta >= 0) { if (totalMemory + delta > maxTotalMemory) { throw exceededLocalTotalMemoryLimit(succinctBytes(maxTotalMemory)); } return memoryPool.reserve(queryId, delta); } memoryPool.free(queryId, -delta); return NOT_BLOCKED; }
Source:
<code>public List<EntityDto> listEntitiesByBundle(String bundleSymbolicName) { if (StringUtils.isBlank(bundleSymbolicName)) { throw new MdsException("Bundle symbolic name cannot be empty or null"); } List<EntityDto> entityDtos = new ArrayList<>(); <START> for (Entity entity : allEntities.retrieveAll("bundleSymbolicName", bundleSymbolicName)) { <END> if (entity.isActualEntity()) { entityDtos.add(entity.toDto()); } } return entityDtos; }</code><technical_language>create a method retrieveBySymbolicName() in allEntities retrieval filtering</technical_language>

Target:
public List<EntityDto> listEntitiesByBundle(String bundleSymbolicName) { if (StringUtils.isBlank(bundleSymbolicName)) { throw new MdsException("Bundle symbolic name cannot be empty or null"); } List<EntityDto> entityDtos = new ArrayList<>(); for (Entity entity : allEntities.retrieveBySymbolicName(bundleSymbolicName)) { entityDtos.add(entity.toDto()); } return entityDtos; }
Source:
<code>public static Map<String, List<User>> getPlayerLists(final IEssentials ess, final User sender, final boolean showHidden) { <START> Server server = ess.getServer(); <END> final Map<String, List<User>> playerList = new HashMap<>(); for (User onlineUser : ess.getOnlineUsers()) { if ((sender == null && !showHidden && onlineUser.isHidden()) || (sender != null && !showHidden && !sender.getBase().canSee(onlineUser.getBase()))) { continue; } final String group = FormatUtil.stripFormat(FormatUtil.stripEssentialsFormat(onlineUser.getGroup().toLowerCase())); List<User> list = playerList.computeIfAbsent(group, k -> new ArrayList<>()); list.add(onlineUser); } return playerList; }</code><technical_language>is this used</technical_language>

Target:
public static Map<String, List<User>> getPlayerLists(final IEssentials ess, final User sender, final boolean showHidden) { final Map<String, List<User>> playerList = new HashMap<>(); for (User onlineUser : ess.getOnlineUsers()) { if ((sender == null && !showHidden && onlineUser.isHidden()) || (sender != null && !showHidden && !sender.getBase().canSee(onlineUser.getBase()))) { continue; } final String group = FormatUtil.stripFormat(FormatUtil.stripEssentialsFormat(onlineUser.getGroup().toLowerCase())); List<User> list = playerList.computeIfAbsent(group, k -> new ArrayList<>()); list.add(onlineUser); } return playerList; }
Source:
<code>public void endElement(String uri, String name, String qName) { if (qName.equals("ETag")) { this.currentETag = currentOrNull(currentText); } else if (qName.equals("LastModified")) { try { this.currentLastModified = dateParser .iso8601DateParse(currentOrNull(currentText)); } catch (IllegalArgumentException orig) { try { this.currentLastModified = dateParser <START> .iso8601SecondsDateParse(currentOrNull(currentText)); <END> } catch (IllegalArgumentException ie) { throw orig; } } } else if (qName.equals("CopyObjectResult")) { metadata = new CopyObjectResult(currentLastModified, currentETag); } currentText = new StringBuilder(); }</code><technical_language>encapsulate this duplicated logic in a helper method, e.g., iso8601DateParseWithOptionalSeconds</technical_language>

Target:
public void endElement(String uri, String name, String qName) { if (qName.equals("ETag")) { this.currentETag = currentOrNull(currentText); } else if (qName.equals("LastModified")) { this.currentLastModified = dateParser .iso8601DateParseWithOptionalTZ(currentOrNull(currentText)); } else if (qName.equals("CopyObjectResult")) { metadata = new CopyObjectResult(currentLastModified, currentETag); } currentText = new StringBuilder(); }
Source:
<code>public void updateServiceSync() throws Exception { testingPostgres.runUpdateStatement("update enduser set isadmin = 't' where username = 'DockstoreTestUser2';"); CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient("DockstoreTestUser2", testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); String serviceRepo = "DockstoreTestUser2/test-service"; String installationId = "1179416"; List<io.swagger.client.model.Workflow> services = client.handleGitHubRelease(serviceRepo, "DockstoreTestUser2", "refs/tags/1.0", installationId); assertEquals("Should only have one service", 1, services.size()); io.swagger.client.model.Workflow service = services.get(0); service = client.refresh(service.getId()); assertNotNull(service); <START> assertEquals("Should have two new versions master and 1.0", 2, service.getWorkflowVersions().size()); <END> client.updateWorkflowDefaultVersion(service.getId(), "1.0"); }</code><technical_language>die if DockstoreTestUser2 releases a new version starts working a PR</technical_language>

Target:
public void updateServiceSync() throws Exception { testingPostgres.runUpdateStatement("update enduser set isadmin = 't' where username = 'DockstoreTestUser2';"); CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient("DockstoreTestUser2", testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); String serviceRepo = "DockstoreTestUser2/test-service"; String installationId = "1179416"; List<io.swagger.client.model.Workflow> services = client.handleGitHubRelease(serviceRepo, "DockstoreTestUser2", "refs/tags/1.0", installationId); assertEquals("Should only have one service", 1, services.size()); io.swagger.client.model.Workflow service = services.get(0); service = client.refresh(service.getId()); assertNotNull(service); assertTrue("Should have at least the versions master and 1.0", service.getWorkflowVersions().size() >= 2); assertTrue("Should have a master version.", service.getWorkflowVersions().stream().anyMatch((WorkflowVersion version) -> Objects.equals(version.getName(), "master"))); assertTrue("Should have a 1.0 version.", service.getWorkflowVersions().stream().anyMatch((WorkflowVersion version) -> Objects.equals(version.getName(), "1.0"))); client.updateWorkflowDefaultVersion(service.getId(), "1.0"); }
Source:
<code>private void initContent() { setLayout(new FillLayout()); fGlobalPC = null; fTimeRangePC = null; fMouseMoveListener = new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { PieChart pc = (PieChart) event.widget; switch (event.type) { case SWT.MouseMove: int sliceIndex = pc.getSliceIndexFromPosition(0, event.x, event.y); if (sliceIndex < 0) { pc.setToolTipText(null); break; } float percOfSlice = (float) pc.getSlicePercent(0, sliceIndex); String percent = String.format("%.1f", percOfSlice); Long nbEvents = Long.valueOf((long) pc.getSeriesSet().getSeries()[sliceIndex].getXSeries()[0]); String text = Messages.TmfStatisticsView_PieChartToolTipTextName + " = " + pc.getSeriesSet().getSeries()[sliceIndex].getId() + "\n"; text += Messages.TmfStatisticsView_PieChartToolTipTextEventCount + " = " + nbEvents.toString() + " (" + percent + "%)"; pc.setToolTipText(text); return; default: } } }; fMouseClickListener = new MouseListener() { @Override public void mouseUp(MouseEvent e) { } @Override public void mouseDown(MouseEvent e) { PieChart pc = <START> (PieChart)e.widget; <END> int slicenb = pc.getSliceIndexFromPosition(0, e.x, e.y); if (slicenb < 0) { return; } Event selectionEvent = new Event(); selectionEvent.text = pc.getSeriesSet().getSeries()[slicenb].getId(); notifyEventTypeSelectionListener(selectionEvent); } @Override public void mouseDoubleClick(MouseEvent e) { } }; setCurrentState(new PieChartViewerStateNoContentSelected(this)); }</code><technical_language>format</technical_language>

Target:
private void initContent() { setLayout(new FillLayout()); fGlobalPC = null; fTimeRangePC = null; fMouseMoveListener = new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { PieChart pc = (PieChart) event.widget; switch (event.type) { case SWT.MouseMove: int sliceIndex = pc.getSliceIndexFromPosition(0, event.x, event.y); if (sliceIndex < 0) { pc.setToolTipText(null); break; } float percOfSlice = (float) pc.getSlicePercent(0, sliceIndex); String percent = String.format("%.1f", percOfSlice); Long nbEvents = Long.valueOf((long) pc.getSeriesSet().getSeries()[sliceIndex].getXSeries()[0]); String text = Messages.TmfStatisticsView_PieChartToolTipTextName + " = " + pc.getSeriesSet().getSeries()[sliceIndex].getId() + "\n"; text += Messages.TmfStatisticsView_PieChartToolTipTextEventCount + " = " + nbEvents.toString() + " (" + percent + "%)"; pc.setToolTipText(text); return; default: } } }; fMouseClickListener = new MouseListener() { @Override public void mouseUp(MouseEvent e) { } @Override public void mouseDown(MouseEvent e) { PieChart pc = (PieChart) e.widget; int slicenb = pc.getSliceIndexFromPosition(0, e.x, e.y); if (slicenb < 0 || slicenb >= pc.getSeriesSet().getSeries().length) { return; } Event selectionEvent = new Event(); selectionEvent.text = pc.getSeriesSet().getSeries()[slicenb].getId(); notifyEventTypeSelectionListener(selectionEvent); } @Override public void mouseDoubleClick(MouseEvent e) { } }; setCurrentState(new PieChartViewerStateNoContentSelected(this)); }
Source:
<code>public List<TrackInfo> getTracks() { return isConnected() ? getImpl().getTracks() : <START> null; <END> }</code><technical_language>I need return empty list @NonNull</technical_language>

Target:
public List<TrackInfo> getTracks() { return isConnected() ? getImpl().getTracks() : new ArrayList<>(); }
Source:
<code>public void testExecuteAndPostProcess() { ______TS("success: delete entire account"); InstructorAttributes instructor1OfCourse1 = dataBundle.instructors.get("instructor1OfCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.INSTRUCTOR_ID, instructor1OfCourse1.googleId, "account", "true" }; final String adminUserId = "admin.user"; gaeSimulation.loginAsAdmin(adminUserId); AdminAccountDeleteAction deleteAction = getAction(submissionParams); RedirectResult result = getRedirectResult(deleteAction); assertNull(AccountsLogic.inst().getAccount(instructor1OfCourse1.googleId)); assertEquals(Const.StatusMessages.INSTRUCTOR_ACCOUNT_DELETED, result.getStatusMessage()); <START> assertEquals(getPageResultDestination("/admin/adminAccountManagementPage", false, "admin.user"), <END> result.getDestinationWithParams()); }</code><technical_language>Consider passing in adminUserId variable instead of "admin.user", Const.ActionURIs.ADMIN_ACCOUNT_MANAGEMENT_PAGE instead of /admin/adminAccountManagementPage</technical_language>

Target:
public void testExecuteAndPostProcess() { ______TS("success: delete entire account"); InstructorAttributes instructor1OfCourse1 = dataBundle.instructors.get("instructor1OfCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.INSTRUCTOR_ID, instructor1OfCourse1.googleId, "account", "true" }; final String adminUserId = "admin.user"; gaeSimulation.loginAsAdmin(adminUserId); AdminAccountDeleteAction deleteAction = getAction(submissionParams); RedirectResult result = getRedirectResult(deleteAction); assertNull(AccountsLogic.inst().getAccount(instructor1OfCourse1.googleId)); assertEquals(Const.StatusMessages.INSTRUCTOR_ACCOUNT_DELETED, result.getStatusMessage()); assertEquals( getPageResultDestination(Const.ActionURIs.ADMIN_ACCOUNT_MANAGEMENT_PAGE, false, adminUserId), result.getDestinationWithParams()); }
Source:
<code>public synchronized void handleMessageLayoutPrepare( @NonNull CorfuPayloadMsg<LayoutPrepareRequest> msg, ChannelHandlerContext ctx, @NonNull IServerRouter r) { if (!isBootstrapped(msg, ctx, r)) { return; } if (!isSameEpoch(msg.getPayload().getEpoch(), msg, ctx, r)) { return; } final Rank messageRank = new Rank(msg.getPayload().getRank(), msg.getClientID()); final Rank highestProposedRank = getProposeRank(); final Layout acceptedLayout = getAcceptedLayout(); final Rank highestAcceptedRank = Optional.ofNullable(getAcceptedRank()) <START> .orElseGet(() -> new Rank(-1L, msg.getClientID())); <END> if (highestProposedRank == null || messageRank.greaterThan(highestProposedRank)) { setProposeRank(messageRank); log.debug("Phase I: New proposedRank = {}", getProposeRank()); r.sendResponse(ctx, msg, CorfuMsgType.LAYOUT_PREPARE_ACK.payloadMsg(new LayoutPrepareResponse(highestAcceptedRank.getRank(), acceptedLayout))); } else { log.debug("Phase I: Rejected prepare: messageRank = {}, proposedRank = {}", messageRank, highestProposedRank); r.sendResponse(ctx, msg, CorfuMsgType.LAYOUT_PREPARE_REJECT.payloadMsg(new LayoutPrepareResponse(highestProposedRank.getRank(), acceptedLayout))); } }</code><technical_language>please -1 a constant give a name</technical_language>

Target:
public synchronized void handleMessageLayoutPrepare( @NonNull CorfuPayloadMsg<LayoutPrepareRequest> msg, ChannelHandlerContext ctx, @NonNull IServerRouter r) { if (!isBootstrapped(msg, ctx, r)) { return; } final long payloadEpoch = msg.getPayload().getEpoch(); final Rank payloadRank = new Rank(msg.getPayload().getRank(), msg.getClientID()); final Rank highestProposedRank = getProposedRank(payloadEpoch); final Layout acceptedLayout = getAcceptedLayout(payloadEpoch); final Rank highestAcceptedRank = Optional.ofNullable(getAcceptedRank(payloadEpoch)) .orElse(new Rank(UNINITIALIZED_RANK, msg.getClientID())); if (!isSameEpoch(payloadEpoch, msg, ctx, r)) { return; } if (highestProposedRank == null || payloadRank.greaterThan(highestProposedRank)) { setProposeRank(payloadRank, payloadEpoch); log.debug("Phase I: New proposedRank = {}", getProposedRank(payloadEpoch)); r.sendResponse(ctx, msg, CorfuMsgType.LAYOUT_PREPARE_ACK.payloadMsg(new LayoutPrepareResponse(highestAcceptedRank.getRank(), acceptedLayout))); } else { log.debug("Phase I: Rejected prepare: payloadRank = {}, proposedRank = {}", payloadRank, highestProposedRank); r.sendResponse(ctx, msg, CorfuMsgType.LAYOUT_PREPARE_REJECT.payloadMsg(new LayoutPrepareResponse(highestProposedRank.getRank(), acceptedLayout))); } }
Source:
<code>public EventProducer(TransportProvider transportProvider, CheckpointProvider checkpointProvider, Properties config, boolean customCheckpointing, Consumer<EventProducer> onUnrecoverableError, int generation) { Validate.notNull(transportProvider, "null transport provider"); Validate.notNull(checkpointProvider, "null checkpoint provider"); Validate.notNull(config, "null config"); _checkpointRWLock = new ReentrantReadWriteLock( true); _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = customCheckpointing ? CheckpointPolicy.CUSTOM : CheckpointPolicy.DATASTREAM; _safeCheckpoints = new ConcurrentHashMap<>(); _onUnrecoverableError = onUnrecoverableError; _generation = generation; _producerId = PRODUCER_ID_SEED.getAndIncrement(); _logger = LoggerFactory.getLogger(String.format("%s:%s:%d", MODULE, _producerId, _generation)); <START> if (!customCheckpointing) { <END> _checkpointHandler = new CheckpointHandler(config); } else { _logger.info("Disabling periodic flush/checkpoint handler for customCheckpoint."); _checkpointHandler = null; } _availabilityThresholdSlaMs = Integer.parseInt(config.getProperty(AVAILABILITY_THRESHOLD_SLA_MS, DEFAULT_AVAILABILITY_THRESHOLD_SLA_MS)); _logger.info( String.format("Created event producer with customCheckpointing=%s, sendCallback=%s", customCheckpointing, onUnrecoverableError != null)); _dynamicMetricsManager = DynamicMetricsManager.getInstance(); }</code><technical_language>I hope event producers shared connectors</technical_language>

Target:
public EventProducer(TransportProvider transportProvider, CheckpointProvider checkpointProvider, Properties config, boolean customCheckpointing, Consumer<EventProducer> onUnrecoverableError, int generation) { Validate.notNull(transportProvider, "null transport provider"); Validate.notNull(checkpointProvider, "null checkpoint provider"); Validate.notNull(config, "null config"); _checkpointRWLock = new ReentrantReadWriteLock( true); _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = customCheckpointing ? CheckpointPolicy.CUSTOM : CheckpointPolicy.DATASTREAM; _safeCheckpoints = new ConcurrentHashMap<>(); _onUnrecoverableError = onUnrecoverableError; _generation = generation; _producerId = PRODUCER_ID_SEED.getAndIncrement(); _logger = LoggerFactory.getLogger(String.format("%s:%s:%d", MODULE, _producerId, _generation)); if (!customCheckpointing) { _checkpointHandler = Optional.of(new CheckpointHandler(config)); } else { _logger.info("Disabling periodic flush/checkpoint handler for customCheckpoint."); _checkpointHandler = Optional.empty(); } _availabilityThresholdSlaMs = Integer.parseInt(config.getProperty(AVAILABILITY_THRESHOLD_SLA_MS, DEFAULT_AVAILABILITY_THRESHOLD_SLA_MS)); _logger.info( String.format("Created event producer with customCheckpointing=%s, sendCallback=%s", customCheckpointing, onUnrecoverableError != null)); _dynamicMetricsManager = DynamicMetricsManager.getInstance(); }
Source:
<code>public ExecutorService getProcessingExecutorService(DruidProcessingConfig config) { if (config.getNumThreadsConfigured() != ExecutorServiceConfig.DEFAULT_NUM_THREADS) { <START> log.error("numThreads[%d] configured, that is ingnored on Router", config.getNumThreadsConfigured()); <END> } return Execs.dummy(); }</code><technical_language>"ignored" (spelling). Also, below, warn is more appropriate</technical_language>

Target:
public ExecutorService getProcessingExecutorService(DruidProcessingConfig config) { if (config.getNumThreadsConfigured() != ExecutorServiceConfig.DEFAULT_NUM_THREADS) { log.error("numThreads[%d] configured, that is ignored on Router", config.getNumThreadsConfigured()); } return Execs.dummy(); }
Source:
<code>public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { if (readonly) throw new IOException("Buffer is read only."); if (readLength > 0) clearReadBuffer(); long lastPosition = position(); int bytesWrite; long remaining = count; try { if (position != lastPosition) seek(position); if (writeWrap == null) writeWrap = ByteBuffer.wrap(writeBuffer); while (remaining > 0) { writeWrap.limit((int) Math.min((long) (writeBuffer.length), writeOffset + remaining)).position(writeOffset); while (writeWrap.hasRemaining()) { bytesWrite = src.read(writeWrap); if (bytesWrite == -1) break; writeOffset += bytesWrite; remaining -= bytesWrite; if (writeOffset == writeBuffer.length) <START> flushForced(); <END> else writePending = true; } } } finally { seek(lastPosition); } return count - remaining; }</code><technical_language>Curious flushForced() instead of flushOptimized()</technical_language>

Target:
public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { if (readonly) throw new IOException("Buffer is read only."); if (readLength > 0) clearReadBuffer(); long lastPosition = position(); int bytesWrite; long remaining = count; try { if (position != lastPosition) seek(position); if (writeWrap == null) writeWrap = ByteBuffer.wrap(writeBuffer); while (remaining > 0) { writeWrap.limit((int) Math.min((long) (writeBuffer.length), writeOffset + remaining)).position(writeOffset); while (writeWrap.hasRemaining()) { bytesWrite = src.read(writeWrap); if (bytesWrite == -1) break; writeOffset += bytesWrite; remaining -= bytesWrite; if (writeOffset == writeBuffer.length) flushOptimized(); else writePending = true; } } } finally { seek(lastPosition); } return count - remaining; }
Source:
<code><START> private static void showPopup(final String title, final String message, final Logger log) { <END> final JPanel pan = new JPanel(new BorderLayout(0, 5)) {{ setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); }}; final String wrapper = "<html><style type=\"text/css\">body { font:12pt dialog,sans-serif; }</style><body>%s</body></html>"; final JEditorPane ed = new JEditorPane("text/html", String.format(wrapper, message)) {{ setBackground(pan.getBackground()); setHighlighter(null); setEditable(false); addHyperlinkListener(new Link(log)); }}; final JButton ok = new JButton("Ok"); pan.add(ed, BorderLayout.CENTER); pan.add(new JPanel() {{ add(ok); }}, BorderLayout.SOUTH); final Dimension size = new Dimension(500, 200); final JDialog dialog = new JDialog((Frame)null, title, true) {{ setMinimumSize(size); setPreferredSize(size); setContentPane(pan); ok.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); }}; dialog.pack(); final Point p = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); dialog.setLocation(new Point(p.x - dialog.getWidth() / 2, p.y - dialog.getHeight() / 2)); dialog.setVisible(true); }</code><technical_language>a JOptionPane instead of layouting a custom dialog</technical_language>

Target:
private static void showPopup(final String title, final String message, final Logger log) { final String wrapper = "<html><style type=\"text/css\">body { font:12pt dialog,sans-serif; }</style><body>%s</body></html>"; final JEditorPane ed = new JEditorPane("text/html", String.format(wrapper, message)) {{ setBackground(UIManager.getDefaults().getColor("Panel.background")); setHighlighter(null); setEditable(false); addHyperlinkListener(new Link(log)); }}; final JScrollPane sp = new JScrollPane(ed) {{ setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); setPreferredSize(new Dimension(500, 100)); }}; JOptionPane.showMessageDialog(null, sp, title, JOptionPane.ERROR_MESSAGE); }
Source:
<code>private ConjunctionNode(List<QueryTree> children) { this.children.addAll(children); <START> this.children.sort(Comparator.comparingDouble(QueryTree::weight).reversed()); <END> }</code><technical_language>This Comparator is in places- considered Comparator making a static final constant referenced constructor advancePhase</technical_language>

Target:
private ConjunctionNode(List<QueryTree> children) { this.children.addAll(children); this.children.sort(COMPARATOR); }
Source:
<code>public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractCounterAspect other = (AbstractCounterAspect) obj; <START> return Objects.equals(fFieldName, other.fFieldName); <END> }</code><technical_language>consider label well</technical_language>

Target:
public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractCounterAspect other = (AbstractCounterAspect) obj; return Objects.equals(fFieldName, other.fFieldName) && Objects.equals(fLabel, other.fLabel); }
Source:
<code>private void writeValue(Type type, FieldSchema pigType, Tuple t, int i) { try { if (type.isPrimitive()) { switch (type.asPrimitiveType().getPrimitiveTypeName()) { case BINARY: byte[] bytes; if (pigType.type == DataType.BYTEARRAY) { bytes = ((DataByteArray)t.get(i)).get(); } else if (pigType.type == DataType.CHARARRAY) { bytes = ((String)t.get(i)).getBytes("UTF-8"); } else { throw new UnsupportedOperationException("can not convert from " + DataType.findTypeName(pigType.type) + " to BINARY "); } <START> recordConsumer.addBinary(Binary.fromConstantByteArray(bytes)); <END> break; case BOOLEAN: recordConsumer.addBoolean((Boolean)t.get(i)); break; case INT32: recordConsumer.addInteger(((Number)t.get(i)).intValue()); break; case INT64: recordConsumer.addLong(((Number)t.get(i)).longValue()); break; case DOUBLE: recordConsumer.addDouble(((Number)t.get(i)).doubleValue()); break; case FLOAT: recordConsumer.addFloat(((Number)t.get(i)).floatValue()); break; default: throw new UnsupportedOperationException(type.asPrimitiveType().getPrimitiveTypeName().name()); } } else { assert pigType.type == DataType.TUPLE; recordConsumer.startGroup(); writeTuple(type.asGroupType(), pigType.schema, (Tuple)t.get(i)); recordConsumer.endGroup(); } } catch (Exception e) { throw new ParquetEncodingException("can not write value at " + i + " in tuple " + t + " from type '" + pigType + "' to type '" + type +"'", e); } }</code><technical_language>I this is correct for String case, do DataByteArray case a reused object? change bytes a Binary wrap byte array if blocks</technical_language>

Target:
private void writeValue(Type type, FieldSchema pigType, Tuple t, int i) { try { if (type.isPrimitive()) { switch (type.asPrimitiveType().getPrimitiveTypeName()) { case BINARY: byte[] bytes; if (pigType.type == DataType.BYTEARRAY) { bytes = ((DataByteArray)t.get(i)).get(); } else if (pigType.type == DataType.CHARARRAY) { bytes = ((String)t.get(i)).getBytes("UTF-8"); } else { throw new UnsupportedOperationException("can not convert from " + DataType.findTypeName(pigType.type) + " to BINARY "); } recordConsumer.addBinary(Binary.fromReusedByteArray(bytes)); break; case BOOLEAN: recordConsumer.addBoolean((Boolean)t.get(i)); break; case INT32: recordConsumer.addInteger(((Number)t.get(i)).intValue()); break; case INT64: recordConsumer.addLong(((Number)t.get(i)).longValue()); break; case DOUBLE: recordConsumer.addDouble(((Number)t.get(i)).doubleValue()); break; case FLOAT: recordConsumer.addFloat(((Number)t.get(i)).floatValue()); break; default: throw new UnsupportedOperationException(type.asPrimitiveType().getPrimitiveTypeName().name()); } } else { assert pigType.type == DataType.TUPLE; recordConsumer.startGroup(); writeTuple(type.asGroupType(), pigType.schema, (Tuple)t.get(i)); recordConsumer.endGroup(); } } catch (Exception e) { throw new ParquetEncodingException("can not write value at " + i + " in tuple " + t + " from type '" + pigType + "' to type '" + type +"'", e); } }
Source:
<code><START> public int getWidth() { <END> return width; }</code><technical_language>final in a 1st iteration do use-cases need override it</technical_language>

Target:
public final int getWidth() { return width; }
Source:
<code>public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); if (extensions == null) { <START> extensions = ServiceLoader.load(AutoValueExtension.class, getClass().getClassLoader()); <END> } errorReporter = new ErrorReporter(processingEnv); }</code><technical_language>I I do this in no-arg constructor, i.e. java this(ServiceLoader.load(AutoValueExtension.class, getClass().getClassLoader()));</technical_language>

Target:
public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); errorReporter = new ErrorReporter(processingEnv); }
Source:
<code>public StringBuffer generate(final I input) throws GeneratorException { final StringBuffer shapeRaw = super.generate(input); final StyleDefinition styleDefinition = input.getStyleDefinition(); if (null != styleDefinition) { if (null != styleDefinition.getFillColor()) { shapeRaw.append(formatString(FILL_COLOR, styleDefinition.getFillColor())); } if (null != styleDefinition.getFillAlpha()) { shapeRaw.append(formatDouble(FILL_ALPHA, styleDefinition.getFillAlpha())); } if (null != styleDefinition.getStrokeColor()) { shapeRaw.append(formatString(STROKE_COLOR, styleDefinition.getStrokeColor())); } if (null != styleDefinition.getStrokeAlpha()) { shapeRaw.append(formatDouble(STROKE_ALPHA, styleDefinition.getStrokeAlpha())); } if (null != styleDefinition.getStrokeWidth()) { shapeRaw.append(formatDouble(STROKE_WIDTH, styleDefinition.getStrokeWidth())); } if (null != styleDefinition.getStrokeDashArray()) { <START> int i = 0; <END> String dashArrayCmd = ""; while (i < styleDefinition.getStrokeDashArray().length) { if ((i > 0) && (i < styleDefinition.getStrokeDashArray().length)) { dashArrayCmd = dashArrayCmd + ", "; } dashArrayCmd = dashArrayCmd + formatDouble(styleDefinition.getStrokeDashArray()[i]); i++; } shapeRaw.append(formatString(STROKE_DASHARRAY, dashArrayCmd)); } return shapeRaw; } return new StringBuffer(); }</code><technical_language>Hey @alepintus , felt nice is fighting this kind of "old-styled" code external iterators hehe, show easy is functional interfaces streams, tested that: String commaSeparatedValues = Stream.of(strokeDashArray) .map(AbstractGenerator::formatDouble) .collect(Collectors.joining(",")); I vote for refactoring this, clear easy understand... it? Thanks</technical_language>

Target:
public StringBuffer generate(final I input) throws GeneratorException { final StringBuffer shapeRaw = super.generate(input); final StyleDefinition styleDefinition = input.getStyleDefinition(); if (null != styleDefinition) { if (null != styleDefinition.getFillColor()) { shapeRaw.append(formatString(FILL_COLOR, styleDefinition.getFillColor())); } if (null != styleDefinition.getFillAlpha()) { shapeRaw.append(formatDouble(FILL_ALPHA, styleDefinition.getFillAlpha())); } if (null != styleDefinition.getStrokeColor()) { shapeRaw.append(formatString(STROKE_COLOR, styleDefinition.getStrokeColor())); } if (null != styleDefinition.getStrokeAlpha()) { shapeRaw.append(formatDouble(STROKE_ALPHA, styleDefinition.getStrokeAlpha())); } if (null != styleDefinition.getStrokeWidth()) { shapeRaw.append(formatDouble(STROKE_WIDTH, styleDefinition.getStrokeWidth())); } if (null != styleDefinition.getStrokeDashArray()) { String commaSeparatedValues = Stream.of(styleDefinition.getStrokeDashArray()).map(AbstractGenerator::formatDouble).collect(Collectors.joining(",")); shapeRaw.append(formatString(STROKE_DASHARRAY, commaSeparatedValues)); } return shapeRaw; } return new StringBuffer(); }
Source:
<code>public void missedEventThrows() { setupInitialState(); <START> assertThatThrownBy(() -> eventCache.processStartTransactionsUpdate(TIMESTAMPS_2, <END> LockWatchStateUpdate.success(LEADER, 5L, ImmutableList.of(UNLOCK_EVENT)))) .isExactlyInstanceOf(SafeIllegalArgumentException.class) .hasMessageContaining("Events missing between last snapshot and this batch of events"); }</code><technical_language>This be: assertThatLoggableExceptionThrownBy(() -> eventCache.processStartTransactionsUpdate(TIMESTAMPS_2, LockWatchStateUpdate.success(LEADER, 5L, ImmutableList.of(UNLOCK_EVENT)))) .isExactlyInstanceOf(SafeIllegalArgumentException.class) .hasLogMessage("Events missing snapshot this batch of events");</technical_language>

Target:
public void missedEventThrows() { setupInitialState(); assertThatLoggableExceptionThrownBy(() -> eventCache.processStartTransactionsUpdate(TIMESTAMPS_2, LockWatchStateUpdate.success(LEADER, 5L, ImmutableList.of(UNLOCK_EVENT)))) .isExactlyInstanceOf(SafeIllegalArgumentException.class) .hasLogMessage("Events missing between last snapshot and this batch of events"); }
Source:
<code>public String addTenant(Tenant tenant) throws TenantMgtException { String tenantDomain = tenant.getDomain(); int tenantId; validateInputs(tenant); try { TenantMgtUtil.setTenantAdminCreationOperation(true); addAttributeValues(tenant); createTenant(tenant); addTenantAdminUser(tenant); tenantId = tenant.getId(); addClaimsToUserStore(tenant, tenantDomain, tenantId); TenantInfoBean tenantInfoBean = initializeTenantInfoBean(tenantId, tenant); notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); } catch (Exception e) { <START> if (e instanceof TenantManagementClientException) { <END> throw (TenantManagementClientException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } log.info("Added the tenant '" + tenantDomain + " [" + tenantId + "]' by '" + PrivilegedCarbonContext.getThreadLocalCarbonContext(). getUsername() + "'"); TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId(), tenant.getTenantUniqueID()); return tenant.getTenantUniqueID(); }</code><technical_language>check TenantManagementException instead of TenantManagementClientException</technical_language>

Target:
public String addTenant(Tenant tenant) throws TenantMgtException { String tenantDomain = tenant.getDomain(); int tenantId; validateInputs(tenant); try { TenantMgtUtil.setTenantAdminCreationOperation(true); addAttributeValues(tenant); createTenant(tenant); addTenantAdminUser(tenant); tenantId = tenant.getId(); addClaimsToUserStore(tenant); TenantInfoBean tenantInfoBean = initializeTenantInfoBean(tenantId, tenant); notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } log.info("Added the tenant '" + tenantDomain + " [" + tenantId + "]' by '" + PrivilegedCarbonContext.getThreadLocalCarbonContext(). getUsername() + "'"); TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId(), tenant.getTenantUniqueID()); return tenant.getTenantUniqueID(); }
Source:
<code>public void stop(BundleContext context) throws Exception { if (cluster != null) { cluster.close(); <START> Thread.sleep(10000); <END> } }</code><technical_language>sleep need 10 seconds? Is ThreadDeathWatcher check</technical_language>

Target:
public void stop(BundleContext context) throws Exception { if (cluster != null) { cluster.close(); Thread.sleep(1000); } }
Source:
<code>public Object call() throws Exception { Preconditions.checkNotNull(getMachine(), "machine"); ConfigBag config = ConfigBag.newInstance(); if (stdout!=null) config.put(SshTool.PROP_OUT_STREAM, stdout); if (stderr!=null) config.put(SshTool.PROP_ERR_STREAM, stderr); if (runAsRoot) config.put(SshTool.PROP_RUN_AS_ROOT, true); if (runAsScript) exitCode = getMachine().execScript(config.getAllConfigRaw(), getSummary(), commands, shellEnvironment); else exitCode = getMachine().execCommands(config.getAllConfigRaw(), getSummary(), commands, shellEnvironment); if (requireExitCodeZero && exitCode!=0) throw new IllegalStateException("Ssh job ended with exit code "+exitCode+" when 0 was required, in "+Tasks.current()+": "+getSummary()); <START> if (returnType==ScriptReturnType.STDOUT_STRING) return stdout.toString(); <END> if (returnType==ScriptReturnType.STDOUT_BYTES) return stdout.toByteArray(); if (returnType==ScriptReturnType.STDERR_STRING) return stderr.toString(); if (returnType==ScriptReturnType.STDERR_BYTES) return stderr.toByteArray(); if (returnType==ScriptReturnType.EXIT_CODE) return exitCode; throw new IllegalStateException("Unknown return type for ssh job "+getSummary()+": "+returnType); }</code><technical_language>I generally prefer switch statements for enums this (and default for throw)</technical_language>

Target:
public Object call() throws Exception { Preconditions.checkNotNull(getMachine(), "machine"); ConfigBag config = ConfigBag.newInstance(); if (stdout!=null) config.put(SshTool.PROP_OUT_STREAM, stdout); if (stderr!=null) config.put(SshTool.PROP_ERR_STREAM, stderr); if (runAsRoot) config.put(SshTool.PROP_RUN_AS_ROOT, true); if (runAsScript) exitCode = getMachine().execScript(config.getAllConfigRaw(), getSummary(), commands, shellEnvironment); else exitCode = getMachine().execCommands(config.getAllConfigRaw(), getSummary(), commands, shellEnvironment); if (requireExitCodeZero && exitCode!=0) throw new IllegalStateException("Ssh job ended with exit code "+exitCode+" when 0 was required, in "+Tasks.current()+": "+getSummary()); switch (returnType) { case STDOUT_STRING: return stdout.toString(); case STDOUT_BYTES: return stdout.toByteArray(); case STDERR_STRING: return stderr.toString(); case STDERR_BYTES: return stderr.toByteArray(); case EXIT_CODE: return exitCode; } throw new IllegalStateException("Unknown return type for ssh job "+getSummary()+": "+returnType); }
Source:
<code>public List<MongoCredential> buildCredentials() { if ( getUsername() != null ) { <START> switch ( authenticationMechanism ) { <END> case MONGODB_CR: return Arrays.asList( MongoCredential.createMongoCRCredential( getUsername(), getDatabaseName(), password() ) ); case GSSAPI: return Arrays.asList( MongoCredential.createGSSAPICredential( getUsername() ) ); case X509: return Arrays.asList( MongoCredential.createMongoX509Credential( getUsername() ) ); case PLAIN: return Arrays.asList( MongoCredential.createPlainCredential( getUsername(), getDatabaseName(), password() ) ); default: throw log.authenticationMechanismNotRecognized( authenticationMechanism.getAuthenticationType() ); } } return null; }</code><technical_language>important, consider establish a method enum instead: return authenticationMechanism.getCredentials( getUsername(), getDatabaseName(), password() ); saves switch need error message below</technical_language>

Target:
public List<MongoCredential> buildCredentials() { if ( getUsername() != null ) { return Arrays.asList( authenticationMechanism.createCredential( getUsername(), getDatabaseName(), getPassword() ) ); } return null; }
Source:
<code>private void reconnectSessions(final RemotingConnection oldConnection, final int reconnectAttempts, final ActiveMQException cause) { HashSet<ClientSessionInternal> sessionsToFailover; synchronized (sessions) { sessionsToFailover = new HashSet<>(sessions); } for (ClientSessionInternal session : sessionsToFailover) { session.preHandleFailover(connection); } getConnectionWithRetry(reconnectAttempts, oldConnection); if (connection == null) { if (!clientProtocolManager.isAlive()) ActiveMQClientLogger.LOGGER.failedToConnectToServer(); return; } List<FailureListener> oldListeners = oldConnection.getFailureListeners(); List<FailureListener> newListeners = new ArrayList<>(connection.getFailureListeners()); for (FailureListener listener : oldListeners) { if (listener instanceof DelegatingFailureListener == false) { newListeners.add(listener); } } connection.setFailureListeners(newListeners); ((CoreRemotingConnection) connection).syncIDGeneratorSequence(((CoreRemotingConnection) oldConnection).getIDGeneratorSequence()); for (ClientSessionInternal session : sessionsToFailover) { if (session.handleFailover(connection, cause)) { <START> connection.destroy(); <END> this.connection = null; return; } } }</code><technical_language>Well.. .the is... I"m problem able is fix. a test help. If provide a test.. for rare happening in production, nice some more details.. logs.. stack traces.... i figure out issue synchrnoized implementation</technical_language>

Target:
private void reconnectSessions(final RemotingConnection oldConnection, final int reconnectAttempts, final ActiveMQException cause) { HashSet<ClientSessionInternal> sessionsToFailover; synchronized (sessions) { sessionsToFailover = new HashSet<>(sessions); } for (ClientSessionInternal session : sessionsToFailover) { session.preHandleFailover(connection); } getConnectionWithRetry(reconnectAttempts, oldConnection); if (connection == null) { if (!clientProtocolManager.isAlive()) ActiveMQClientLogger.LOGGER.failedToConnectToServer(); return; } List<FailureListener> oldListeners = oldConnection.getFailureListeners(); List<FailureListener> newListeners = new ArrayList<>(connection.getFailureListeners()); for (FailureListener listener : oldListeners) { if (listener instanceof DelegatingFailureListener == false) { newListeners.add(listener); } } connection.setFailureListeners(newListeners); ((CoreRemotingConnection) connection).syncIDGeneratorSequence(((CoreRemotingConnection) oldConnection).getIDGeneratorSequence()); for (ClientSessionInternal session : sessionsToFailover) { if (!session.handleFailover(connection, cause)) { connection.destroy(); this.connection = null; return; } } }
Source:
<code>private PagedFile mapWithCorrectPageSize( PageCache pageCache, File indexFile, PagedFile pagedFile ) throws IOException { if ( pageSize != pageCache.pageSize() ) { if ( pageSize > pageCache.pageSize() ) { throw new MetadataMismatchException( " was created with page size %d, but page cache used to open it this time " + "has a smaller page size %d so cannot be opened", <START> pageSize, pageCache.pageSize() ); <END> } pagedFile.close(); return pageCache.map( indexFile, pageSize ); } return pagedFile; }</code><technical_language>This message a sentence-start</technical_language>

Target:
private PagedFile mapWithCorrectPageSize( PageCache pageCache, File indexFile, PagedFile pagedFile ) throws IOException { if ( pageSize != pageCache.pageSize() ) { if ( pageSize > pageCache.pageSize() ) { throw new MetadataMismatchException( "Tried to create tree with page size %d, but page cache used to open it this time " + "has a smaller page size %d so cannot be opened", pageSize, pageCache.pageSize() ); } pagedFile.close(); return pageCache.map( indexFile, pageSize ); } return pagedFile; }
Source:
<code>public DownloadFailedException(Throwable cause) { super(ERROR_CODE, cause); <START> this.cause = cause; <END> }</code><technical_language>suggestion this.cause = requireNonNull(cause);</technical_language>

Target:
public DownloadFailedException(Throwable cause) { super(ERROR_CODE, cause); this.cause = requireNonNull(cause); }