auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void addIngestionEventForContainer(ContentContainerObject obj, Resource parentResc) throws IOException { NodeIterator childIt = getChildIterator(parentResc); int numChildren = 0; PID childPid = null; while (childIt.hasNext()) { Resource resc = (Resource) childIt.next(); if (numChildren < 1) { childPid = PIDs.get(resc.getURI()); } numChildren++; } if (numChildren > 0) { PremisLogger premisLogger = getPremisLogger(obj.getPid()); <START> PremisEventBuilder builder = premisLogger.buildEvent(Premis.Ingestion); <END> if (numChildren == 1 && childPid != null) { builder.addEventDetail("added child object {0} to this container", childPid.toString()).write(); } else { builder.addEventDetail("added {0} child objects to this container", numChildren).write(); } } }</code><technical_language>add more thing, I reminded events need record agents responsible for event. This a copypasta job IngestDepositRecordJob lines 84 85: .addSoftwareAgent(SoftwareAgent.depositService.getFullname()) .addAuthorizingAgent(DepositField.depositorName.name()) is needed in addIngestionEventForChild</technical_language>

Target:
private void addIngestionEventForContainer(ContentContainerObject obj, Resource parentResc) throws IOException { NodeIterator childIt = getChildIterator(parentResc); int numChildren = 0; PID childPid = null; while (childIt.hasNext()) { Resource resc = (Resource) childIt.next(); if (numChildren < 1) { childPid = PIDs.get(resc.getURI()); } numChildren++; } if (numChildren > 0) { PremisLogger premisLogger = getPremisLogger(obj.getPid()); PremisEventBuilder builder = premisLogger.buildEvent(Premis.Ingestion); if (numChildren == 1 && childPid != null) { builder.addEventDetail("added child object {0} to this container", childPid.toString()); } else { builder.addEventDetail("added {0} child objects to this container", numChildren); } builder.addSoftwareAgent(SoftwareAgent.depositService.getFullname()) .addAuthorizingAgent(DepositField.depositorName.name()) .write(); } }
Source:
<code>public void testFindByStudyId() { List<String> studyIds = new ArrayList<>(); <START> studyIds.add("secondStudyId"); <END> Pageable pageable = new PageRequest(0, 1); List<VariantSourceEntity> variantSourceEntityList = repository.findByStudyIdIn(studyIds, pageable); assertEquals(1, variantSourceEntityList.size()); pageable = new PageRequest(0, 2); variantSourceEntityList = repository.findByStudyIdIn(studyIds, pageable); assertEquals(2, variantSourceEntityList.size()); studyIds.add("firstStudyId"); pageable = new PageRequest(1, 2); variantSourceEntityList = repository.findByStudyIdIn(studyIds, pageable); assertEquals(1, variantSourceEntityList.size()); pageable = new PageRequest(2, 2); variantSourceEntityList = repository.findByStudyIdIn(studyIds, pageable); assertEquals(0, variantSourceEntityList.size()); }</code><technical_language>extract a constant, "secondStudyId", "firstStudyId", "firstFileId"</technical_language>

Target:
public void testFindByStudyId() { List<String> studyIds = new ArrayList<>(); studyIds.add(SECOND_STUDY_ID); Pageable pageable = new PageRequest(0, 1); List<VariantSourceEntity> variantSourceEntityList = repository.findByStudyIdIn(studyIds, pageable); assertEquals(1, variantSourceEntityList.size()); pageable = new PageRequest(0, 2); variantSourceEntityList = repository.findByStudyIdIn(studyIds, pageable); assertEquals(2, variantSourceEntityList.size()); studyIds.add(FIRST_STUDY_ID); pageable = new PageRequest(1, 2); variantSourceEntityList = repository.findByStudyIdIn(studyIds, pageable); assertEquals(1, variantSourceEntityList.size()); pageable = new PageRequest(2, 2); variantSourceEntityList = repository.findByStudyIdIn(studyIds, pageable); assertEquals(0, variantSourceEntityList.size()); }
Source:
<code>protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); <START> Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); <END> button.setEnabled(false); }</code><technical_language>buttons marked defaultButton, mind ;) Actually, setting a default button button execute press ENTER. this prevents 'root path' text in RemoteResourceBrowserWidget execute selection listener, a user manually type in a path tree update typed-in root path. false</technical_language>

Target:
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); button.setEnabled(false); }
Source:
<code>private static boolean checkEqual(String cond1, String cond2) { RexNode rexNode1 = toRex(cond1); RexNode rexNode2 = toRex(cond2); Context z3Context = new Context(); List<SymbolicColumn> inputSymbolicColumns = new ArrayList<>(); <START> for (int i = 0; i < 8; i++) { RelDataType intType = typeFactory.createJavaType(int.class); SymbolicColumn inputColumn = SymbolicColumn.mkNewSymbolicColumn(z3Context, intType); inputSymbolicColumns.add(inputColumn); <END> } List<BoolExpr> env = new ArrayList<>(); SymbolicColumn symbolicCond1 = RexToSymbolicColumn.rexToColumn(rexNode1, inputSymbolicColumns, z3Context, env); SymbolicColumn symbolicCond2 = RexToSymbolicColumn.rexToColumn(rexNode2, inputSymbolicColumns, z3Context, env); return SymbolicColumn.checkCondEq(symbolicCond1, symbolicCond2, env, z3Context); }</code><technical_language>Please RexProgramTestBase reuse helpers for types, etc, etc</technical_language>

Target:
private boolean checkEqual(String cond1, String cond2) { RexNode rexNode1 = toRex(cond1); RexNode rexNode2 = toRex(cond2); return RexVerifier.logicallyEquivalent(rexNode1, rexNode2); }
Source:
<code>protected Permit addParents(Permit permit) { if (permit == null) { <START> System.out.println("permit is null"); <END> } if (parent == null) { System.out.println("parent is null"); } return parent.addParents(permit); }</code><technical_language>wrong patch, fix</technical_language>

Target:
protected Permit addParents(Permit permit) { return parent.addParents(permit); }
Source:
<code>private static long getMillis(Config cfg, String name, String key, long defaultValue) { String valStr = cfg.getString(CONFIG_KEY_REMOTE, name, key); if (valStr == null) { return defaultValue; } valStr = valStr.trim(); if (valStr.isEmpty()) { return defaultValue; } Matcher m = <START> matcher("^([1-9][0-9]*(?:\\.[0-9]*)?)\\s*(.*)$", valStr); <END> if (!m.matches()) { return defaultValue; } String digits = m.group(1); String unitName = m.group(2).trim(); TimeUnit unit = UnitMap.UNITS.get(unitName); if (unit == null) { return defaultValue; } try { if (digits.indexOf('.') == -1) { return unit.toMillis(Long.parseLong(digits)); } double val = Double.parseDouble(digits); return (long) (val * unit.toMillis(1)); } catch (NumberFormatException nfe) { return defaultValue; } }</code><technical_language>nit: Pattern.compile(<this string>) a private member of this class, call matcher(valStr) that, rid of matcher method below</technical_language>

Target:
private static long getMillis(Config cfg, String name, String key, long defaultValue) { String valStr = cfg.getString(CONFIG_KEY_REMOTE, name, key); if (valStr == null) { return defaultValue; } valStr = valStr.trim(); if (valStr.isEmpty()) { return defaultValue; } Matcher m = UnitMap.PATTERN.matcher(valStr); if (!m.matches()) { return defaultValue; } String digits = m.group(1); String unitName = m.group(2).trim(); TimeUnit unit = UnitMap.UNITS.get(unitName); if (unit == null) { return defaultValue; } try { if (digits.indexOf('.') == -1) { return unit.toMillis(Long.parseLong(digits)); } double val = Double.parseDouble(digits); return (long) (val * unit.toMillis(1)); } catch (NumberFormatException nfe) { return defaultValue; } }
Source:
<code>public void test_when_contentInodeIsNotNull_and_throwDotSecurityException() throws DotSecurityException, DotDataException { final HttpServletRequest request = mock(HttpServletRequest.class); final WebResource webResource = mock(WebResource.class); final LanguageAPI languageAPI = mock(LanguageAPI.class); final InitDataObject initDataObject = mock(InitDataObject.class); final User user = new User(); final DotSecurityException exception = mock(DotSecurityException.class); when(initDataObject.getUser()).thenReturn(user); when(webResource.init(null, true, request, true, null)).thenReturn(initDataObject); when(languageAPI.getAvailableContentLanguages("2", user)).thenThrow(exception); final LanguagesResource languagesResource = new LanguagesResource(languageAPI, webResource); try { languagesResource.list(request, "2"); assertTrue(false); <START> } catch(DotSecurityException e) { <END> assertTrue(true); } }</code><technical_language>I this try-catch is needed anymore</technical_language>

Target:
public void test_when_contentInodeIsNotNull_and_throwDotSecurityException() throws DotSecurityException, DotDataException { final HttpServletRequest request = mock(HttpServletRequest.class); final WebResource webResource = mock(WebResource.class); final LanguageAPI languageAPI = mock(LanguageAPI.class); final InitDataObject initDataObject = mock(InitDataObject.class); final User user = new User(); final DotSecurityException exception = mock(DotSecurityException.class); when(initDataObject.getUser()).thenReturn(user); when(webResource.init(null, true, request, true, null)).thenReturn(initDataObject); when(languageAPI.getAvailableContentLanguages("2", user)).thenThrow(exception); final LanguagesResource languagesResource = new LanguagesResource(languageAPI, webResource); languagesResource.list(request, "2"); }
Source:
<code>private Future<PathsPromoteResult> submitRollbackPathsPromote( PathsPromoteResult result ) throws IndyWorkflowException { return detectOverload( () -> asyncPromotionService.submit( () -> { if ( result.getCompletedPaths().isEmpty() ) { return result; } PathsPromoteRequest request = result.getRequest(); <START> PathsPromoteRequest newRequest = new PathsPromoteRequest( request.getTarget(), request.getSource(), <END> result.getCompletedPaths() ); newRequest.setPurgeSource( true ); PathsPromoteResult ret; try { ret = doPathsPromotion( newRequest, true, null ); } catch ( Exception ex ) { String msg = "Rollback path promotion failed. Target: " + request.getTarget() + ", Source: " + request.getSource() + ", Reason: " + getStackTrace( ex ); logger.warn( msg ); ret = new PathsPromoteResult( request, msg ); } if ( ret.succeeded() ) { result.setPendingPaths( result.getCompletedPaths() ); result.setCompletedPaths( null ); } else { result.setError( ret.getError() ); } result.withPromotionId( result.getPromotionId() ); if ( result.getRequest().getCallback() != null ) { return callbackHelper.callback( result.getRequest().getCallback(), result ); } return result; } ) ); }</code><technical_language>case is promotion source is purged for original promotion, this problems</technical_language>

Target:
private Future<PathsPromoteResult> submitRollbackPathsPromote( PathsPromoteResult result ) throws IndyWorkflowException { return detectOverload( () -> asyncPromotionService.submit( () -> { if ( result.getCompletedPaths().isEmpty() ) { return result; } PathsPromoteRequest request = result.getRequest(); PathsPromoteRequest newRequest = new PathsPromoteRequest( request.getTarget(), request.getSource(), result.getCompletedPaths() ); newRequest.setPurgeSource( true ); newRequest.setFailWhenExists( false ); PathsPromoteResult ret; try { ret = doPathsPromotion( newRequest, true, null ); } catch ( Exception ex ) { String msg = "Rollback path promotion failed. Target: " + request.getTarget() + ", Source: " + request.getSource() + ", Reason: " + getStackTrace( ex ); logger.warn( msg ); ret = new PathsPromoteResult( request, msg ); } if ( ret.succeeded() ) { result.setPendingPaths( result.getCompletedPaths() ); result.setCompletedPaths( null ); } else { result.setError( ret.getError() ); } if ( result.getRequest().getCallback() != null ) { return callbackHelper.callback( result.getRequest().getCallback(), result ); } return result; } ) ); }
Source:
<code><START> public IncomingTextMessage(SmsMessage message, int subscriptionId) { <END> this.message = message.getDisplayMessageBody(); this.sender = message.getDisplayOriginatingAddress(); this.senderDeviceId = 1; this.protocol = message.getProtocolIdentifier(); this.serviceCenterAddress = message.getServiceCenterAddress(); this.replyPathPresent = message.isReplyPathPresent(); this.pseudoSubject = message.getPseudoSubject(); this.sentTimestampMillis = message.getTimestampMillis(); this.subscriptionId = subscriptionId; this.groupId = null; this.push = false; this.receivedWhenLocked = false; }</code><technical_language>this be: this(message, subscriptionId, false) other constructor exists</technical_language>

Target:
public IncomingTextMessage(SmsMessage message, int subscriptionId) { this(message, subscriptionId, false); }
Source:
<code>public Option<BoundaryCheck> checkBoundaries(final Coordinates coords, final ObsContext ctx) { return ctx.getBaseCoordinates().map(baseCoordinates -> { final Angle positionAngle = ctx.getPositionAngleJava(); final Set<Offset> sciencePositions = ctx.getSciencePositions(); return getCorrectedPatrolField(ctx).map(pf -> { final BoundaryPosition bp = pf.checkBoundaries(coords, baseCoordinates, positionAngle, sciencePositions); if ((bp != BoundaryPosition.inside) && (bp != BoundaryPosition.innerBoundary)) { <START> return BoundaryCheck.nearBoundary; <END> } final double minLimit = getVignettingClearance(ctx).toArcsecs().getMagnitude(); final Ellipse2D e = new Ellipse2D.Double(-minLimit, -minLimit, minLimit * 2.0, minLimit * 2.0); final PatrolField p = getCorrectedPatrolField(new PatrolField(e, e, e), ctx); if (p.anyInside(coords, baseCoordinates, positionAngle, sciencePositions)) { return BoundaryCheck.vignetting; } return BoundaryCheck.inRange; }).getOrElse(BoundaryCheck.outOfRange); }); }</code><technical_language>This continue outside, I believe. If of positions, outside. If need distinguish innerBoundary switch bp I guess. I remember syntax like: java switch (bp) { case BoundaryPosition.outside: case BoundaryPosition.outerBoundary: return outOfRange; case BoundaryPosition.innerBoundary: return nearBoundary; case BoundaryPosition.inner: // check vignetting decide inRange vignetting .... }</technical_language>

Target:
public Option<PwfsProbeRangeArea> checkBoundaries(final Coordinates coords, final ObsContext ctx) { return ctx.getBaseCoordinates().map(baseCoordinates -> { final Angle positionAngle = ctx.getPositionAngleJava(); final Set<Offset> sciencePositions = ctx.getSciencePositions(); return getCorrectedPatrolField(ctx).map(pf -> { final BoundaryPosition bp = pf.checkBoundaries(coords, baseCoordinates, positionAngle, sciencePositions); final PwfsProbeRangeArea result; switch (bp) { case inside: result = PwfsProbeRangeArea.inRange; break; case innerBoundary: final double minLimit = getVignettingClearance(ctx).toArcsecs().getMagnitude(); final Ellipse2D e = new Ellipse2D.Double(-minLimit, -minLimit, minLimit * 2.0, minLimit * 2.0); final PatrolField p = getCorrectedPatrolField(new PatrolField(e, e, e), ctx); if (p.anyInside(coords, baseCoordinates, positionAngle, sciencePositions)) { result = PwfsProbeRangeArea.vignetting; } else { result = PwfsProbeRangeArea.inRange; } break; default: result = PwfsProbeRangeArea.outOfRange; break; } return result; }).getOrElse(PwfsProbeRangeArea.outOfRange); }); }
Source:
<code><START> public Optional<String> findPid() throws IOException { <END> try { return ProcessHandle.allProcesses() .filter(ph -> commandPattern.matcher(ph.info().commandLine().orElse("")).matches()) .map(ProcessHandle::pid) .map(String::valueOf) .findFirst(); } catch (UnsupportedOperationException e) { throw new IOException("Your system doesn't support looking up of process", e); } }</code><technical_language>return OptionalLong instead? avoid map / valueOf stages</technical_language>

Target:
public Optional<Long> findPid() throws IOException { try { return ProcessHandle.allProcesses() .filter(ph -> processPattern.matcher(ph.info().commandLine().orElse("")).matches()) .map(ProcessHandle::pid) .findFirst(); } catch (UnsupportedOperationException e) { throw new IOException("Your system doesn't support looking up of process", e); } }
Source:
<code>private boolean filter(int i, int j, boolean hori) throws ContradictionException { boolean hasFiltered = false; int offSet = hori ? 0 : n; int s_i = vars[i + offSet].getUB(); int e_i = vars[i + offSet].getLB() + vars[i + 2 * n + offSet].getLB(); int s_j = vars[j + offSet].getUB(); int e_j = vars[j + offSet].getLB() + vars[j + 2 * n + offSet].getLB(); if (s_i < e_i || s_j < e_j) { if (e_j > s_i) { if(vars[j + offSet].updateLowerBound(e_i, this)) { if(!pruneList.contains(j)) { pruneList.add(j); } hasFiltered = true; } if(vars[i + offSet].updateUpperBound(s_j - vars[i + 2 * n + offSet].getLB(), this) <START> || vars[i + offSet + 2 * n].updateUpperBound(s_j - vars[i + offSet].getLB(), this)) { <END> if(!pruneList.contains(i)) { pruneList.add(i); } hasFiltered = true; } } if (s_j < e_i) { if(vars[i + offSet].updateLowerBound(e_j, this)) { if(!pruneList.contains(i)) { pruneList.add(i); } hasFiltered = true; } if(vars[j + offSet].updateUpperBound(s_i - vars[j + 2 * n + offSet].getLB(), this) || vars[j + offSet + 2 * n].updateUpperBound(s_i - vars[j + offSet].getLB(), this)) { if(!pruneList.contains(j)) { pruneList.add(j); } hasFiltered = true; } } } return hasFiltered; }</code><technical_language>beware, if bound update returns true, applied, resulting in filtering</technical_language>

Target:
private boolean filter(int i, int j, boolean hori) throws ContradictionException { boolean hasFiltered = false; int offSet = hori ? 0 : n; int s_i = vars[i + offSet].getUB(); int e_i = vars[i + offSet].getLB() + vars[i + 2 * n + offSet].getLB(); int s_j = vars[j + offSet].getUB(); int e_j = vars[j + offSet].getLB() + vars[j + 2 * n + offSet].getLB(); if (s_i < e_i || s_j < e_j) { if (e_j > s_i) { if(vars[j + offSet].updateLowerBound(e_i, this)) { if(!pruneList.contains(j)) { pruneList.add(j); } hasFiltered = true; } boolean filtPrun1 = vars[i + offSet].updateUpperBound(s_j - vars[i + 2 * n + offSet].getLB(), this); boolean filtPrun2 = vars[i + offSet + 2 * n].updateUpperBound(s_j - vars[i + offSet].getLB(), this); if(filtPrun1 || filtPrun2) { if(!pruneList.contains(i)) { pruneList.add(i); } hasFiltered = true; } } if (s_j < e_i) { if(vars[i + offSet].updateLowerBound(e_j, this)) { if(!pruneList.contains(i)) { pruneList.add(i); } hasFiltered = true; } boolean filtPrun1 = vars[j + offSet].updateUpperBound(s_i - vars[j + 2 * n + offSet].getLB(), this); boolean filtPrun2 = vars[j + offSet + 2 * n].updateUpperBound(s_i - vars[j + offSet].getLB(), this); if(filtPrun1 || filtPrun2) { if(!pruneList.contains(j)) { pruneList.add(j); } hasFiltered = true; } } } return hasFiltered; }
Source:
<code>public VCFSampleHeaderLine(String line, VCFHeaderVersion version) { <START> super(VCFConstants.SAMPLE_HEADER_KEY, new VCF4Parser().parseLine(line, null)); <END> }</code><technical_language>VCF4Parser is stateless a static instance of instead of creating new place</technical_language>

Target:
public VCFSampleHeaderLine(String line, VCFHeaderVersion version) { super(VCFConstants.SAMPLE_HEADER_KEY, VCFHeaderLineTranslator.parseLine(version, line, null)); }
Source:
<code>public void testSingleChildOfSpan() { TestTraceReporter reporter = new TestTraceReporter(); APMTracer tracer = new APMTracer(reporter); Span parentSpan = tracer.buildSpan("ParentSpan") .start(); Span childSpan = tracer.buildSpan("ChildSpan") <START> .asChildOf(parentSpan) <END> .start(); childSpan.finish(); parentSpan.finish(); assertEquals(1, reporter.getTraces().size()); Trace trace = reporter.getTraces().get(0); assertEquals(1, trace.getNodes().size()); assertEquals(Component.class, trace.getNodes().get(0).getClass()); Component parentComponent = (Component) trace.getNodes().get(0); assertTrue(parentComponent.getCorrelationIds().isEmpty()); assertEquals(1, parentComponent.getNodes().size()); assertEquals(Component.class, parentComponent.getNodes().get(0).getClass()); Component childComponent = (Component) parentComponent.getNodes().get(0); assertTrue(childComponent.getCorrelationIds().isEmpty()); assertEquals(0, childComponent.getNodes().size()); }</code><technical_language>please write this test parentSpan.context()</technical_language>

Target:
public void testSingleChildOfSpan() { TestTraceReporter reporter = new TestTraceReporter(); Tracer tracer = new APMTracer(reporter); Span parentSpan = tracer.buildSpan("ParentSpan") .start(); Span childSpan = tracer.buildSpan("ChildSpan") .asChildOf(parentSpan) .start(); childSpan.finish(); parentSpan.finish(); assertEquals(1, reporter.getTraces().size()); Trace trace = reporter.getTraces().get(0); assertEquals(1, trace.getNodes().size()); assertEquals(Component.class, trace.getNodes().get(0).getClass()); Component parentComponent = (Component) trace.getNodes().get(0); assertTrue(parentComponent.getCorrelationIds().isEmpty()); assertEquals(1, parentComponent.getNodes().size()); assertEquals(Component.class, parentComponent.getNodes().get(0).getClass()); Component childComponent = (Component) parentComponent.getNodes().get(0); assertTrue(childComponent.getCorrelationIds().isEmpty()); assertEquals(0, childComponent.getNodes().size()); }
Source:
<code>private void atomicWriteToFile(String content, File file) throws IOException { File tempFile = Files.createTempFile(file.getName(), null).toFile(); FileOutputStream out = new FileOutputStream(tempFile); try { IOUtils.write(content, out); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } out.close(); FileSystem defaultFileSystem = FileSystems.getDefault(); Path destinationFilePath = defaultFileSystem.getPath(file.getCanonicalPath()); try { file.getParentFile().mkdirs(); Path tempDestinationFile = defaultFileSystem.getPath(file.getCanonicalPath() + ".tmp"); <START> Files.move(tempFile.toPath(), tempDestinationFile); <END> Files.move(tempDestinationFile, destinationFilePath, StandardCopyOption.ATOMIC_MOVE); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } }</code><technical_language>this extra file operation costly in some storage system? if operation fails need clean extra file? L131 for example</technical_language>

Target:
static void atomicWriteToFile(String content, File file) throws IOException { FileSystem defaultFileSystem = FileSystems.getDefault(); Path destinationFilePath = defaultFileSystem.getPath(file.getCanonicalPath()); File tempFile = Files.createTempFile(destinationFilePath.getParent(), file.getName(), null).toFile(); try (FileOutputStream out = new FileOutputStream(tempFile)) { IOUtils.write(content, out); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } try { file.getParentFile().mkdirs(); Files.move(tempFile.toPath(), destinationFilePath, StandardCopyOption.ATOMIC_MOVE); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } }
Source:
<code>public void testAlwaysMeteredVpnWithNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } <START> Network wifi = <END> ensureWifiConnected(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = null; String allowedApps = mPackageName; boolean isAlwaysMetered = true; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, isAlwaysMetered); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertTrue(isNetworkMetered(mNetwork)); assertTrue(mCM.isActiveNetworkMetered()); }</code><technical_language>Nit: define final</technical_language>

Target:
public void testAlwaysMeteredVpnWithNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } Network wifi = getWifiNetwork(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = null; String allowedApps = mPackageName; boolean isAlwaysMetered = true; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, isAlwaysMetered); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertTrue(isNetworkMetered(mNetwork)); assertTrue(mCM.isActiveNetworkMetered()); }
Source:
<code>protected void setNetworkParameters(HWNetworkStore netstore, NetworkInterface netint) throws SocketException { Enumeration<InetAddress> addresses; StringBuilder sb; byte[] mac; mac = netint.getHardwareAddress(); netstore.setName(netint.getDisplayName()); sb = new StringBuilder(); for (int i = 0; i < mac.length; i++) { <START> sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? ":" : "")); <END> } netstore.setMacaddr(sb.toString()); addresses = netint.getInetAddresses(); for (InetAddress address : Collections.list(addresses)) { if (address.getHostAddress().contains(":")) { netstore.setIpv6addr( (address.getHostAddress().split("%")[0] == null) ? "Unknown" : address.getHostAddress().split("%")[0]); } else { netstore.setIpaddr( (address.getHostAddress() == null) ? "Unknown" : address.getHostAddress()); } } }</code><technical_language>Stuff this want upgrade Java 8. :-)</technical_language>

Target:
protected void setNetworkParameters(HWNetworkStore netstore, NetworkInterface netint) throws SocketException { Enumeration<InetAddress> addresses; StringBuilder sb; byte[] mac; mac = netint.getHardwareAddress(); netstore.setName(netint.getName()); netstore.setDisplayName(netint.getDisplayName()); sb = new StringBuilder(); for (int i = 0; i < mac.length; i++) { sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? ":" : "")); } netstore.setMacaddr(sb.toString()); netstore.setIpaddr("Unknown"); netstore.setIpv6addr("unknown"); addresses = netint.getInetAddresses(); for (InetAddress address : Collections.list(addresses)) { if (address.getHostAddress().contains(":")) { netstore.setIpv6addr(address.getHostAddress().split("%")[0]); } else { netstore.setIpaddr(address.getHostAddress()); } } }
Source:
<code>protected TabbedPanel2 getHttpsInfoTabsPanel() { if (httpsInfoTabsPanel == null) { httpsInfoTabsPanel = new TabbedPanel2() { private static final long serialVersionUID = -1422894398829082869L; @Override public void setVisible(Component component, boolean visible) { if (!visible) { <START> super.remove(component); <END> } } }; } return httpsInfoTabsPanel; }</code><technical_language>Needs call removeTab((AbstractPanel) component); component is removed internal tab list (it's a core bug, open a PR address shortly)</technical_language>

Target:
protected TabbedPanel2 getHttpsInfoTabsPanel() { if (httpsInfoTabsPanel == null) { httpsInfoTabsPanel = new TabbedPanel2() { private static final long serialVersionUID = -1422894398829082869L; @Override public void setVisible(Component component, boolean visible) { if (!visible) { removeTab((AbstractPanel) component); } } }; } return httpsInfoTabsPanel; }
Source:
<code>private Object getValue(Monitor<?> monitor) { try { if (limiter != null) { final MonitorValueCallable c = new MonitorValueCallable(monitor); return limiter.callWithTimeout(c, 1, TimeUnit.SECONDS); } else { return monitor.getValue(); } } catch (TimeLimiter.UncheckedTimeoutException e) { LOGGER.warn("timeout trying to get value for {}", monitor.getConfig()); TIMEOUT_ERRORS.increment(); } catch (Exception e) { <START> LOGGER.warn("failed to get value for " + monitor.getConfig(), e); <END> } return null; }</code><technical_language>Do is worthwhile track number other failures well</technical_language>

Target:
private Object getValue(Monitor<?> monitor) { try { if (limiter != null) { final MonitorValueCallable c = new MonitorValueCallable(monitor); return limiter.callWithTimeout(c, 1, TimeUnit.SECONDS); } else { return monitor.getValue(); } } catch (TimeLimiter.UncheckedTimeoutException e) { LOGGER.warn("timeout trying to get value for {}", monitor.getConfig()); TIMEOUT_ERROR.increment(); } catch (Exception e) { LOGGER.warn("failed to get value for " + monitor.getConfig(), e); DynamicCounter.increment(GET_VALUE_ERROR, "id", e.getClass().getSimpleName()); } return null; }
Source:
<code>private void setUpShareActionProvider(Menu menu) { <START> getMenuInflater().inflate(R.menu.menu_share, menu); <END> MenuItem item = menu.findItem(R.id.menu_item_share); mShareActionProvider = (ShareActionProvider)item.getActionProvider(); setShareIntent(); }</code><technical_language>assuming icon for this is set automatically, I in code anywhere. override it? icon is fine, a grayish-black color nicer if white rest of menu icons text</technical_language>

Target:
private void setUpShareActionProvider(Menu menu) { getMenuInflater().inflate(R.menu.menu_share, menu); MenuItem item = menu.findItem(R.id.menu_item_share); mShareActionProvider = (CommCareShareActionProvider)item.getActionProvider(); setShareIntent(); }
Source:
<code>static public void println(PrintStream stream, String message, boolean onlyifverbose, boolean verbosemode ) { <START> if (onlyifverbose) { <END> log.debug(message); } else { log.error(message); } }</code><technical_language>if (onlyverbose && !verbosemode)</technical_language>

Target:
static public void println(PrintStream stream, String message, boolean onlyifverbose, boolean verbosemode ) { if (onlyifverbose && verbosemode) log.warn(message); else log.info(message); }
Source:
<code>public void delete() { visit(url("delete")); <START> elasticSleep(1000); <END> clickButton("Yes"); }</code><technical_language>a waitFor</technical_language>

Target:
public void delete() { visit(url("delete")); waitFor(by.button("Yes")); clickButton("Yes"); }
Source:
<code>public VarDeclNode getVarDeclNode(String name) throws VariableNotDeclaredException { for (Scope scope : list) { if (scope.containsKey(name)) { return scope.get(name); } } <START> throw new VariableNotDeclaredException(); <END> }</code><technical_language>This duplicated Scope.getVarDeclNode</technical_language>

Target:
public VarDeclNode getVarDeclNode(String name) throws VariableNotDeclaredException { return bottomScope.getVarDeclNode(name); }
Source:
<code>public boolean isReadComplete() { <START> return !(buffer == null || sizeRead < sizeToRead); <END> }</code><technical_language>clearer NOT</technical_language>

Target:
public boolean isReadComplete() { return buffer != null && sizeRead >= sizeToRead; }
Source:
<code>public Node apply(@Nonnull Node node) { if (!matches(node)) { return ErrorNodeFactory.createInvalidType(node, NodeType.Object); } else { final List<Node> children = node.getChildren(); final List<KeyValueRule> allFieldRules = getAllFieldRules(node); final List<KeyValueRule> nonMatchingRules = new ArrayList<>(allFieldRules); for (Node child : children) { final Rule matchingRule = findMatchingRule(allFieldRules, child); if (matchingRule != null) { nonMatchingRules.remove(matchingRule); final Node newChild = matchingRule.apply(child); child.replaceWith(newChild); } else { if (!allowsAdditionalProperties) { final Collection<String> options = Collections2.transform(allFieldRules, new Function<KeyValueRule, String>() { @Override public String apply(KeyValueRule rule) { return rule.getKeyRule().getDescription(); } }); child.replaceWith(ErrorNodeFactory.createUnexpectedKey(((KeyValueNode) child).getKey(), new TreeSet<>(options))); } } } for (KeyValueRule rule : nonMatchingRules) { if (rule.isRequired(node)) { node.addChild(ErrorNodeFactory.createRequiredValueNotFound(node, rule.getKeyRule())); } else { rule.applyDefault(node); } } validateKeysUnique(node); <START> validateExclusiveRules(node); <END> return getResult(node); } }</code><technical_language>rename validateExclusiveKeys</technical_language>

Target:
public Node apply(@Nonnull Node node) { if (!matches(node)) { return ErrorNodeFactory.createInvalidType(node, NodeType.Object); } else { final List<Node> children = node.getChildren(); final List<KeyValueRule> allFieldRules = getAllFieldRules(node); final List<KeyValueRule> nonMatchingRules = new ArrayList<>(allFieldRules); for (Node child : children) { final Rule matchingRule = findMatchingRule(allFieldRules, child); if (matchingRule != null) { nonMatchingRules.remove(matchingRule); final Node newChild = matchingRule.apply(child); child.replaceWith(newChild); } else { if (!allowsAdditionalProperties) { final Collection<String> options = Collections2.transform(allFieldRules, new Function<KeyValueRule, String>() { @Override public String apply(KeyValueRule rule) { return rule.getKeyRule().getDescription(); } }); child.replaceWith(ErrorNodeFactory.createUnexpectedKey(((KeyValueNode) child).getKey(), new TreeSet<>(options))); } } } for (KeyValueRule rule : nonMatchingRules) { if (rule.isRequired(node)) { node.addChild(ErrorNodeFactory.createRequiredValueNotFound(node, rule.getKeyRule())); } else { rule.applyDefault(node); } } validateKeysUnique(node); validateExclusiveKeys(node); return getResult(node); } }
Source:
<code>public ListResponse<? extends BaseResponse> listApis(User user, String name) { ListResponse<ApiDiscoveryResponse> response = new ListResponse<ApiDiscoveryResponse>(); List<ApiDiscoveryResponse> responseList = new ArrayList<ApiDiscoveryResponse>(); if (user == null) return null; if (name != null) { if (!s_apiNameDiscoveryResponseMap.containsKey(name)) return null; for (APIChecker apiChecker : _apiAccessCheckers) { try { if (!"ApiRateLimitServiceImpl".equals(apiChecker.getName())) { apiChecker.checkAccess(user, name); } } catch (Exception ex) { s_logger.debug("API discovery access check failed for " + name + " with " + ex.getMessage()); return null; } } responseList.add(s_apiNameDiscoveryResponseMap.get(name)); } else { for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) { boolean isAllowed = true; for (APIChecker apiChecker : _apiAccessCheckers) { try { <START> if (!"ApiRateLimitServiceImpl".equals(apiChecker.getName())) { <END> apiChecker.checkAccess(user, apiName); } } catch (Exception ex) { isAllowed = false; } } if (isAllowed) responseList.add(s_apiNameDiscoveryResponseMap.get(apiName)); } } response.setResponses(responseList); return response; }</code><technical_language>this.class.getName() <class>.getName()... instead of hard coded string comparison</technical_language>

Target:
public ListResponse<? extends BaseResponse> listApis(User user, String name) { ListResponse<ApiDiscoveryResponse> response = new ListResponse<ApiDiscoveryResponse>(); List<ApiDiscoveryResponse> responseList = new ArrayList<ApiDiscoveryResponse>(); if (user == null) return null; if (name != null) { if (!s_apiNameDiscoveryResponseMap.containsKey(name)) return null; for (APIChecker apiChecker : _apiAccessCheckers) { try { apiChecker.checkAccess(user, name); } catch (Exception ex) { s_logger.debug("API discovery access check failed for " + name + " with " + ex.getMessage()); return null; } } responseList.add(s_apiNameDiscoveryResponseMap.get(name)); } else { for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) { boolean isAllowed = true; for (APIChecker apiChecker : _apiAccessCheckers) { try { apiChecker.checkAccess(user, apiName); } catch (Exception ex) { isAllowed = false; } } if (isAllowed) responseList.add(s_apiNameDiscoveryResponseMap.get(apiName)); } } response.setResponses(responseList); return response; }
Source:
<code>public void visitFunctionDeclaration(FunctionDeclarationTree tree) { NameIdentifierTree name = tree.name(); if (name.text().equalsIgnoreCase(ASSERT_FUNCTION)) { <START> context().newIssue(this, name, "Use instead the standard \"assert\" function."); <END> } super.visitFunctionDeclaration(tree); }</code><technical_language>"Use standard \"assert\" function instead of declaring a new assert function."</technical_language>

Target:
public void visitFunctionDeclaration(FunctionDeclarationTree tree) { NameIdentifierTree name = tree.name(); if (name.text().equalsIgnoreCase(ASSERT_FUNCTION)) { context().newIssue(this, name, "Use the standard \"assert\" function instead of declaring a new assert function."); } super.visitFunctionDeclaration(tree); }
Source:
<code><START> public List<GerritQueryResult> executeQueryRest(IProgressMonitor monitor, final String queryString, <END> String optionString) throws GerritException { boolean isSomeOption = optionString != null && !optionString.equals(""); try { String uri = "/changes/?q=" + URLEncoder.encode(queryString, "UTF-8") + (isSomeOption ? "&o=" + URLEncoder.encode(optionString, "UTF-8") : ""); TypeToken<List<GerritQueryResult>> queryResultListType = new TypeToken<List<GerritQueryResult>>() { }; return executeGetRestRequest(uri, queryResultListType.getType(), monitor); } catch (UnsupportedEncodingException e) { throw new GerritException(e); } }</code><technical_language>This method private called GerritClient.executeQuery(IProgressMonitor, String, String) only</technical_language>

Target:
public List<GerritQueryResult> executeQueryRest(IProgressMonitor monitor, final String queryString, String optionString) throws GerritException { try { String uri = "/changes/?q=" + URLEncoder.encode(queryString, "UTF-8"); if (StringUtils.isNotBlank(optionString)) { uri += "&o=" + URLEncoder.encode(optionString, "UTF-8"); } TypeToken<List<GerritQueryResult>> queryResultListType = new TypeToken<List<GerritQueryResult>>() { }; return executeGetRestRequest(uri, queryResultListType.getType(), monitor); } catch (UnsupportedEncodingException e) { throw new GerritException(e); } }
Source:
<code>public static void toJSON(OutputWriter outputWriter, String pipelineName, Integer fromCounter, Integer toCounter, boolean isBisect, List<MaterialRevision> materialRevisions) { outputWriter.addLinks(addLinks()) <START> .addChild("_embedded", embeddedWriter -> embeddedWriter.add("pipeline_name", pipelineName) <END> .add("from_counter", fromCounter) .add("to_counter", toCounter) .add("is_bisect", isBisect) .addChildList("changes", revisionsWriter -> MaterialRevisionsRepresenter.toJSONArray(revisionsWriter, materialRevisions)) ); }</code><technical_language>I need _embedded</technical_language>

Target:
public static void toJSON(OutputWriter outputWriter, String pipelineName, Integer fromCounter, Integer toCounter, boolean isBisect, List<MaterialRevision> materialRevisions) { outputWriter.addLinks(addLinks()) .add("pipeline_name", pipelineName) .add("from_counter", fromCounter) .add("to_counter", toCounter) .add("is_bisect", isBisect) .addChildList("changes", revisionsWriter -> MaterialRevisionsRepresenter.toJSONArray(revisionsWriter, materialRevisions)); }
Source:
<code>protected void initialize(RProjectOptions options) { RProjectConfig config = options.getConfig(); restoreWorkspace_.setSelectedIndex(config.getRestoreWorkspace()); saveWorkspace_.setSelectedIndex(config.getSaveWorkspace()); alwaysSaveHistory_.setSelectedIndex(config.getAlwaysSaveHistory()); tutorialPath_ = config.getTutorialPath(); rVersion_ = config.getRVersion(); int quitChildProcessesOnExit = config.getQuitChildProcessesOnExit(); boolean quitChildProcessesChecked = sessionInfo_.quitChildProcessesOnExit(); switch (quitChildProcessesOnExit) { <START> case 1: <END> quitChildProcessesChecked = true; break; case 2: quitChildProcessesChecked = false; break; } quitChildProcessesOnExit_.setValue(quitChildProcessesChecked); }</code><technical_language>named constants for kinds of values (for readability), pretty clear you</technical_language>

Target:
protected void initialize(RProjectOptions options) { RProjectConfig config = options.getConfig(); restoreWorkspace_.setSelectedIndex(config.getRestoreWorkspace()); saveWorkspace_.setSelectedIndex(config.getSaveWorkspace()); alwaysSaveHistory_.setSelectedIndex(config.getAlwaysSaveHistory()); tutorialPath_ = config.getTutorialPath(); rVersion_ = config.getRVersion(); int quitChildProcessesOnExit = config.getQuitChildProcessesOnExit(); boolean quitChildProcessesChecked = sessionInfo_.quitChildProcessesOnExit(); switch (quitChildProcessesOnExit) { case YES_VALUE: quitChildProcessesChecked = true; break; case NO_VALUE: quitChildProcessesChecked = false; break; } quitChildProcessesOnExit_.setValue(quitChildProcessesChecked); }
Source:
<code>public void beforeBlockElement(ProgramState currentState, Tree element) { if (element.is(Kind.CALL_EXPRESSION)) { CallExpressionTree callExpression = (CallExpressionTree) element; SeparatedList<Tree> actualArguments = callExpression.arguments().parameters(); int nbActualArguments = actualArguments.size(); <START> SymbolicValue calleeValue = currentState.peekStack(actualArguments.size()); <END> if (nbActualArguments > 0 && calleeValue instanceof BuiltInFunctionSymbolicValue && mustProcess(callExpression)) { IntFunction<Constraint> signature = ((BuiltInFunctionSymbolicValue) calleeValue).signature(); int index = nbActualArguments - 1; while (index >= 0) { if (signature.apply(index) != null) { break; } index--; } int nbAllowedArguments = index + 1; if (nbActualArguments > nbAllowedArguments) { String message = getMessage(callExpression, nbAllowedArguments, nbActualArguments); addIssue(callExpression.arguments(), message); withIssue.add(callExpression); } } } }</code><technical_language>@ivandalbosco variable nbActualArguments</technical_language>

Target:
public void beforeBlockElement(ProgramState currentState, Tree element) { if (element.is(Kind.CALL_EXPRESSION)) { CallExpressionTree callExpression = (CallExpressionTree) element; SeparatedList<Tree> actualArguments = callExpression.arguments().parameters(); int nbActualArguments = actualArguments.size(); SymbolicValue calleeValue = currentState.peekStack(nbActualArguments); if (nbActualArguments > 0 && calleeValue instanceof BuiltInFunctionSymbolicValue && shouldCheck(callExpression) && hasTooManyArguments((BuiltInFunctionSymbolicValue) calleeValue, nbActualArguments)) { int nbExpectedArguments = getNbParameters((BuiltInFunctionSymbolicValue) calleeValue); String message = getMessage(callExpression, nbExpectedArguments, nbActualArguments); addIssue(callExpression.arguments(), message); withIssue.add(callExpression); } } }
Source:
<code>public Optional<AgentConnectionEntity> getAgentConnection(@NotBlank final String jobId) { <START> return this.agentConnectionRepository.findByJobId(jobId); <END> }</code><technical_language>in of services (except for specific JPA interfaces JpaTagPersistenceService) return DTOs expose underlying storage model service tier. reason Jpa specific interfaces existed allow interplay JPA services a transaction Entities in attached state EntityManager add collections. This means for tags create tag entity, return in a job link attached tag entities job in shot DTO quering DB attach entity JobPersistence service. I explain this in person if doesnt' sense. main point is bleed underlying data model details, in this case Entity, out consumers of this service</technical_language>

Target:
private Optional<AgentConnectionEntity> getAgentConnection(@NotBlank final String jobId) { return this.agentConnectionRepository.findByJobId(jobId); }
Source:
<code>private static List<Credential> getCredentialsFromFirebaseUser(@NonNull FirebaseUser user) { if (TextUtils.isEmpty(user.getEmail()) && TextUtils.isEmpty(user.getPhoneNumber())) { return Collections.emptyList(); } List<Credential> credentials = new ArrayList<>(); for (UserInfo userInfo : user.getProviderData()) { if (FirebaseAuthProvider.PROVIDER_ID.equals(userInfo.getProviderId())) { continue; } String type = ProviderUtils.providerIdToAccountType(userInfo.getProviderId()); <START> if (type == null) { <END> credentials.add(CredentialUtils.buildCredential(user, "pass", null)); } else { credentials.add(CredentialUtils.buildCredentialOrThrow(user, null, type)); } } return credentials; }</code><technical_language>Yeah explaining password matter (since creating a credential for deletion). null means email for account type, obvious reading this method (it is reading other method)</technical_language>

Target:
private static List<Credential> getCredentialsFromFirebaseUser(@NonNull FirebaseUser user) { if (TextUtils.isEmpty(user.getEmail()) && TextUtils.isEmpty(user.getPhoneNumber())) { return Collections.emptyList(); } List<Credential> credentials = new ArrayList<>(); for (UserInfo userInfo : user.getProviderData()) { if (FirebaseAuthProvider.PROVIDER_ID.equals(userInfo.getProviderId())) { continue; } String type = ProviderUtils.providerIdToAccountType(userInfo.getProviderId()); if (type == null) { credentials.add(CredentialUtils.buildCredentialOrThrow(user, "pass", null)); } else { credentials.add(CredentialUtils.buildCredentialOrThrow(user, null, type)); } } return credentials; }
Source:
<code>protected IModel<String> getDataModel() { return new IModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { Page enclosingPage = getPage(); long pageSize = WicketObjects.sizeof(enclosingPage); Bytes pageSizeInBytes = (pageSize > -1 ? Bytes.bytes(pageSize) : null); String pageSizeAsString = pageSizeInBytes != null ? pageSizeInBytes.toString() : "unknown"; <START> return "Page: " + pageSizeAsString; <END> } }; }</code><technical_language>Page size: ? render Page: unknown a confusing</technical_language>

Target:
protected IModel<String> getDataModel() { return new Model<>("Inspector"); }
Source:
<code>public void topicListeningTestCase() { try { jmsTopicTransportListener.start(topicListeningParameters); logger.info("JMS Transport Listener is starting to listen to the topic " + JMSTestConstants.TOPIC_NAME); jmsServer.publishMessagesToTopic(JMSTestConstants.TOPIC_NAME); Assert.assertEquals(topicTestMessageProcessor.getCount(), 10, "Expected message count is not received when " + "listening to topic " + JMSTestConstants.TOPIC_NAME); jmsTopicTransportListener.stop(); } catch (Exception e) { <START> Assert.fail("Error while listening to topic"); <END> } }</code><technical_language>Simply throwing error test case fail it. catch Assert fail</technical_language>

Target:
public void topicListeningTestCase() throws InterruptedException, JMSException, ServerConnectorException { jmsTopicTransportListener.start(topicListeningParameters); logger.info("JMS Transport Listener is starting to listen to the topic " + JMSTestConstants.TOPIC_NAME); jmsServer.publishMessagesToTopic(JMSTestConstants.TOPIC_NAME); Assert.assertEquals(topicTestMessageProcessor.getCount(), 10, "Expected message count is not received when " + "listening to topic " + JMSTestConstants.TOPIC_NAME); jmsTopicTransportListener.stop(); }
Source:
<code>private StreamGraphImpl createStreamGraphWithJoin() { StreamGraphImpl streamGraph = new StreamGraphImpl(runner, config); <START> streamGraph.setDefaultSerde(KVSerde.of(new NoOpSerde<>(), new NoOpSerde<>())); <END> MessageStream<KV<Object, Object>> m1 = streamGraph.<KV<Object, Object>>getInputStream("input1") .map(m -> m); MessageStream<KV<Object, Object>> m2 = streamGraph.<KV<Object, Object>>getInputStream("input2") .partitionBy(m -> m.key, m -> m.value) .filter(m -> true); MessageStream<KV<Object, Object>> m3 = streamGraph.<KV<Object, Object>>getInputStream("input3") .filter(m -> true) .partitionBy(m -> m.key, m -> m.value) .map(m -> m); OutputStream<KV<Object, Object>> output1 = streamGraph.getOutputStream("output1"); OutputStream<KV<Object, Object>> output2 = streamGraph.getOutputStream("output2"); m1.join(m2, mock(JoinFunction.class), Duration.ofHours(2)).sendTo(output1); m3.join(m2, mock(JoinFunction.class), Duration.ofHours(1)).sendTo(output2); return streamGraph; }</code><technical_language>Do need this explicitly set default value</technical_language>

Target:
private StreamGraphImpl createStreamGraphWithJoin() { StreamGraphImpl streamGraph = new StreamGraphImpl(runner, config); MessageStream<KV<Object, Object>> m1 = streamGraph.<KV<Object, Object>>getInputStream("input1") .map(m -> m); MessageStream<KV<Object, Object>> m2 = streamGraph.<KV<Object, Object>>getInputStream("input2") .partitionBy(m -> m.key, m -> m.value) .filter(m -> true); MessageStream<KV<Object, Object>> m3 = streamGraph.<KV<Object, Object>>getInputStream("input3") .filter(m -> true) .partitionBy(m -> m.key, m -> m.value) .map(m -> m); OutputStream<KV<Object, Object>> output1 = streamGraph.getOutputStream("output1"); OutputStream<KV<Object, Object>> output2 = streamGraph.getOutputStream("output2"); m1.join(m2, mock(JoinFunction.class), Duration.ofHours(2)).sendTo(output1); m3.join(m2, mock(JoinFunction.class), Duration.ofHours(1)).sendTo(output2); return streamGraph; }