auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void epollInReady() { assert eventLoop().inEventLoop(); DatagramChannelConfig config = config(); if (shouldBreakEpollInReady(config)) { clearEpollIn0(); return; } final EpollRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.edgeTriggered(isFlagSet(Native.EPOLLET)); final ChannelPipeline pipeline = pipeline(); final ByteBufAllocator allocator = config.getAllocator(); allocHandle.reset(config); epollInBefore(); Throwable exception = null; try { try { boolean connected = isConnected(); do { ByteBuf byteBuf = allocHandle.allocate(allocator); final boolean read; if (connected) { read = connectedRead(allocHandle, byteBuf); } else { int writerIndex = byteBuf.writerIndex(); int size = byteBuf.capacity() - writerIndex; int datagramSize = config().getMaxDatagramPacketSize(); int numDatagram = datagramSize == 0 ? 1 : size / datagramSize; if (numDatagram <= 1) { read = read(allocHandle, byteBuf); } else { read = scatteringRead(allocHandle, byteBuf, datagramSize, numDatagram); } } if (read) { readPending = false; } else { break; } } while (allocHandle.continueReading()); } catch (Throwable t) { exception = t; } allocHandle.readComplete(); pipeline.fireChannelReadComplete(); if (exception != null) { pipeline.fireExceptionCaught(exception); } } finally { epollInFinally(config); } }

Target:
void epollInReady() { assert eventLoop().inEventLoop(); DatagramChannelConfig config = config(); if (shouldBreakEpollInReady(config)) { clearEpollIn0(); return; } final EpollRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.edgeTriggered(isFlagSet(Native.EPOLLET)); final ChannelPipeline pipeline = pipeline(); final ByteBufAllocator allocator = config.getAllocator(); allocHandle.reset(config); epollInBefore(); Throwable exception = null; try { try { boolean connected = isConnected(); do { ByteBuf byteBuf = allocHandle.allocate(allocator); final boolean read; if (connected) { read = connectedRead(allocHandle, byteBuf); } else { int datagramSize = config().getMaxDatagramPayloadSize(); int numDatagram = datagramSize == 0 ? 1 : byteBuf.writableBytes() / datagramSize; if (numDatagram <= 1) { read = read(allocHandle, byteBuf, datagramSize); } else { read = scatteringRead(allocHandle, byteBuf, datagramSize, numDatagram); } } if (read) { readPending = false; } else { break; } } while (allocHandle.continueReading()); } catch (Throwable t) { exception = t; } allocHandle.readComplete(); pipeline.fireChannelReadComplete(); if (exception != null) { pipeline.fireExceptionCaught(exception); } } finally { epollInFinally(config); } }
Source:
protected void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.cdma_call_privacy); SubscriptionInfoHelper subInfoHelper = new SubscriptionInfoHelper(this, getIntent()); subInfoHelper.setActionBarTitle( getActionBar(), getResources(), R.string.labelCdmaMore_with_label); mButtonVoicePrivacy = (SwitchPreference) findPreference(BUTTON_VP_KEY); PersistableBundle carrierConfig; if (subInfoHelper.hasSubId()) { carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId( subInfoHelper.getSubId()); } else { carrierConfig = PhoneGlobals.getInstance().getCarrierConfig(); } if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA || carrierConfig.getBoolean(CarrierConfigManager.KEY_VOICE_PRIVACY_DISABLE_UI_BOOL)) { mButtonVoicePrivacy.setEnabled(false); } Preference callForwardingPref = getPreferenceScreen().findPreference(CALL_FORWARDING_KEY); callForwardingPref.setIntent(subInfoHelper.getIntent(CdmaCallForwardOptions.class)); CdmaCallWaitingPreference callWaitingPref = (CdmaCallWaitingPreference)getPreferenceScreen() .findPreference(CALL_WAITING_KEY); callWaitingPref.setEnabled(true); callWaitingPref.init(this, subInfoHelper.getPhone()); }

Target:
protected void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.cdma_call_privacy); SubscriptionInfoHelper subInfoHelper = new SubscriptionInfoHelper(this, getIntent()); subInfoHelper.setActionBarTitle( getActionBar(), getResources(), R.string.labelCdmaMore_with_label); mButtonVoicePrivacy = (SwitchPreference) findPreference(BUTTON_VP_KEY); PersistableBundle carrierConfig; if (subInfoHelper.hasSubId()) { carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId( subInfoHelper.getSubId()); } else { carrierConfig = PhoneGlobals.getInstance().getCarrierConfig(); } if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA || carrierConfig.getBoolean(CarrierConfigManager.KEY_VOICE_PRIVACY_DISABLE_UI_BOOL)) { mButtonVoicePrivacy.setEnabled(false); } Preference callForwardingPref = getPreferenceScreen().findPreference(CALL_FORWARDING_KEY); callForwardingPref.setIntent(subInfoHelper.getIntent(CdmaCallForwardOptions.class)); CdmaCallWaitingPreference callWaitingPref = (CdmaCallWaitingPreference)getPreferenceScreen() .findPreference(CALL_WAITING_KEY); callWaitingPref.init(this, subInfoHelper.getPhone()); }
Source:
public static int getNumberOfCounters() { if (!isKernelModuleLoaded() && OprofileProject.getProfilingBinary().equals(OprofileProject.OPCONTROL_BINARY)){ return 0; } try { Process p = RuntimeProcessFactory.getFactory().exec( new String {"operf", "--version"}, OprofileProject.getProject()); if (p == null) { return 0; } } catch (IOException e) { return 0; } if (info== null) { initializeOprofileCore(); } return info.getNrCounters(); }

Target:
public static int getNumberOfCounters() { if (!isKernelModuleLoaded() && OprofileProject.getProfilingBinary().equals(OprofileProject.OPCONTROL_BINARY)){ return 0; } try { Process p = RuntimeProcessFactory.getFactory().exec( new String {"operf", "--version"}, OprofileProject.getProject()); if (p == null) { return 0; } } catch (IOException e) { return 0; } return info.getNrCounters(); }
Source:
public Builder setMaxReconnectAttempts(int maxReconnectAttempts) throws IllegalArgumentException { checkNotNullParam("reconnectAttempts", maxReconnectAttempts); if (maxReconnectAttempts < -1) { throw audit.badReconnectAttemptsNumber(maxReconnectAttempts); } this.maxReconnectAttempts = maxReconnectAttempts; return this; }

Target:
public Builder setMaxReconnectAttempts(int maxReconnectAttempts) throws IllegalArgumentException { if (maxReconnectAttempts < -1) { throw audit.badReconnectAttemptsNumber(maxReconnectAttempts); } this.maxReconnectAttempts = maxReconnectAttempts; return this; }
Source:
public void endElement(String uri, String localName, String qName) throws SAXException { if ("sitemap".equals(currentElement())) { maybeAddSiteMap(); } else if ("sitemapindex".equals(currentElement())) { sitemap.setProcessed(true); } else if ("loc".equals(currentElement())) { locFound = true; } }

Target:
public void endElement(String uri, String localName, String qName) throws SAXException { if ("sitemap".equals(currentElement())) { maybeAddSiteMap(); } else if ("sitemapindex".equals(currentElement())) { sitemap.setProcessed(true); } else if ("loc".equals(currentElement())) { locClosed = true; } }
Source:
private boolean isActiveVds() { VDS vds = vdsDao.get(getParameters().getId()); if (vds == null || vds.getStatus() != VDSStatus.Up) { getQueryReturnValue().setExceptionString(String.format( "Cannot fetch storage devices, host %s is not UP.", vds.getHostName())); getQueryReturnValue().setSucceeded(false); return false; } return true; }

Target:
private boolean isActiveVds() { VDS vds = vdsDao.get(getParameters().getId()); if (vds == null) { getQueryReturnValue().setExceptionString( "Cannot fetch storage devices, host doesn't exist anymore."); } else if (vds.getStatus() != VDSStatus.Up) { getQueryReturnValue().setExceptionString(String.format( "Cannot fetch storage devices, host %s is not UP.", vds.getHostName())); } else { return true; } getQueryReturnValue().setSucceeded(false); return false; }
Source:
private Set<String> validateTools(Devfile devfile) throws DevfileFormatException { Set<String> existingNames = new HashSet<>(); Tool editorTool = null; for (Tool tool : devfile.getTools()) { if (!existingNames.add(tool.getName())) { throw new DevfileFormatException(format("Duplicate tool name found:'%s'", tool.getName())); } switch (tool.getType()) { case EDITOR_TOOL_TYPE: if (editorTool != null) { throw new DevfileFormatException( format( "Multiple editor tools found: '%s', '%s'", editorTool.getName(), tool.getName())); } editorTool = tool; break; case PLUGIN_TOOL_TYPE: break; case KUBERNETES_TOOL_TYPE: case OPENSHIFT_TOOL_TYPE: case DOCKERIMAGE_TOOL_TYPE: break; default: throw new DevfileFormatException( format("Unsupported tool '%s' type provided:'%s'", tool.getName(), tool.getType())); } } return existingNames; }

Target:
private Set<String> validateTools(Devfile devfile) throws DevfileFormatException { Set<String> existingNames = new HashSet<>(); Tool editorTool = null; for (Tool tool : devfile.getTools()) { if (!existingNames.add(tool.getName())) { throw new DevfileFormatException(format("Duplicate tool name found:'%s'", tool.getName())); } switch (tool.getType()) { case EDITOR_TOOL_TYPE: if (editorTool != null) { throw new DevfileFormatException( format( "Multiple editor tools found: '%s', '%s'", editorTool.getName(), tool.getName())); } editorTool = tool; break; case PLUGIN_TOOL_TYPE: case KUBERNETES_TOOL_TYPE: case OPENSHIFT_TOOL_TYPE: case DOCKERIMAGE_TOOL_TYPE: break; default: throw new DevfileFormatException( format("Unsupported tool '%s' type provided:'%s'", tool.getName(), tool.getType())); } } return existingNames; }
Source:
protected String[] getSlimFlags() { String slimFlags = getVariable("slim.flags"); if (slimFlags == null) { slimFlags = getVariable(SLIM_FLAGS); } return slimFlags == null ? new String[] : slimFlags.trim().split("\\s"); }

Target:
protected String[] getSlimFlags() { String slimFlags = getVariable("slim.flags"); if (slimFlags == null) { slimFlags = getVariable(SLIM_FLAGS); } return slimFlags == null ? new String[] : parseCommandLine(slimFlags); }
Source:
public GhprbRootAction() { triggerThreads = Collections.newSetFromMap(new WeakHashMap<StartTrigger, Boolean>()); this.pool = Executors.newFixedThreadPool(10); }

Target:
public GhprbRootAction() { triggerThreads = Collections.newSetFromMap(new WeakHashMap<StartTrigger, Boolean>()); this.pool = Executors.newCachedThreadPool(); }
Source:
protected String toSqlType(Type type) { if (VARBINARY.equals(type)) { return "bytea"; } return super.toSqlType(type); }

Target:
protected String toSqlType(Type type) { if (REAL.equals(type)) { return "double"; } if (TIMESTAMP.equals(type) || TIME_WITH_TIME_ZONE.equals(type) || TIMESTAMP_WITH_TIME_ZONE.equals(type)) { return "datetime"; } if (VARBINARY.equals(type)) { throw new PrestoException(NOT_SUPPORTED, "Unsupported column type: " + type.getDisplayName()); } if (isVarcharType(type)) { return "string"; } return super.toSqlType(type); }
Source:
protected void enhanceConfiguration(ConfigurationBuilder builder) { builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).shared(true).async().enable(); }

Target:
protected void enhanceConfiguration(ConfigurationBuilder builder) { builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).shared(true).storeName(getTestName()).async().enable(); }
Source:
private void queueMessageForDisplay(@NonNull OSInAppMessage message) { synchronized (messageDisplayQueue) { messageDisplayQueue.add(message); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "queueMessageForDisplay: " + messageDisplayQueue); if (messageDisplayQueue.size() > 0 && !isInAppMessageShowing()) displayMessage(messageDisplayQueue.get(0)); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "In app message is currently showing, next message will not display yet!"); } }

Target:
private void queueMessageForDisplay(@NonNull OSInAppMessage message) { synchronized (messageDisplayQueue) { if (!isInAppMessageQueued(message)) { messageDisplayQueue.add(message); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "In app message with id, " + message.messageId + ", added to the queue"); } OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "queueMessageForDisplay: " + messageDisplayQueue); if (messageDisplayQueue.size() > 0 && !isInAppMessageShowing()) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "No IAM showing currently, showing first item in the queue!"); displayMessage(messageDisplayQueue.get(0)); return; } OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "In app message is currently showing or there are no IAMs left in the queue!"); } }
Source:
private static String createDefaultMessage( BuildTarget target, ImmutableSet<Flavor> invalidFlavors, ImmutableSet<Flavor> validFlavors) { ImmutableSet<String> invalidFlavorsStr = invalidFlavors.stream().map(Flavor::toString).collect(MoreCollectors.toImmutableSet()); String invalidFlavorsDisplayStr = String.join(", ", invalidFlavorsStr); return String.format( "The following flavor(s) are not supported on target %s:\n%s. Available flavors are: %s", target, invalidFlavorsDisplayStr, validFlavors.stream().map(Flavor::getName).collect( Collectors.joining(", "))); }

Target:
private static String createDefaultMessage( BuildTarget target, ImmutableSet<Flavor> invalidFlavors, ImmutableSet<Flavor> validFlavors) { String invalidFlavorsStr = invalidFlavors .stream() .map(Flavor::toString) .collect(Collectors.joining(System.lineSeparator())); String validFlavorsStr = validFlavors .stream() .map(Flavor::getName) .collect(Collectors.joining(System.lineSeparator())); String invalidFlavorsDisplayStr = String.join(", ", invalidFlavorsStr); return String.format( "The following flavor(s) are not supported on target %s:\n%s\n\nAvailable flavors are:\n%s\n", target, invalidFlavorsDisplayStr, validFlavorsStr); }
Source:
public static long getDelayFromXml() { long delay = (long) minimum; if (appConfigDelay != null) { try { if (randomDelay == true){ if (appConfigDelay_asInit > 0) { delay = Long.parseLong(getRandomInRange(minimum, appConfigDelay_asInit)); } else { appConfigDelay_asInit = Integer.parseInt(String.valueOf(appConfigDelay)); delay = Long.parseLong(getRandomInRange(minimum, appConfigDelay_asInit)); } } else { delay = appConfigDelay; } return delay; }catch (Exception e) { } } else { AppConfig config = AppConfig.getInstance(); if (config.getDelayMinimum() > minimum){ minimum = (int) config.getDelayMinimum(); } if (config.getConstantDelay() > 0) { appConfigDelay = config.getConstantDelay(); } else if (config.getRandomDelay() > 0){ appConfigDelay = config.getRandomDelay(); randomDelay = true; }else{ delay = (long) minimum; } } return delay; }

Target:
public static long getDelayFromXml() { long delay = (long) minimum; if (appConfigDelay != null) { try { if (randomDelay == true){ if (appConfigDelay_asInit <= 0) { appConfigDelay_asInit = Integer.parseInt(String.valueOf(appConfigDelay)); } delay = Long.parseLong(getRandomInRange(minimum, appConfigDelay_asInit)); } else { delay = appConfigDelay; } return delay; }catch (Exception e) { log.error("get to get delay from xml, {}", e); } } else { AppConfig config = AppConfig.getInstance(); if (config.getDelayMinimum() > minimum){ minimum = (int) config.getDelayMinimum(); } if (config.getConstantDelay() > 0) { appConfigDelay = config.getConstantDelay(); } else if (config.getRandomDelay() > 0){ appConfigDelay = config.getRandomDelay(); randomDelay = true; }else{ delay = (long) minimum; } } return delay; }
Source:
public void handle(String error) { eventService.publish( new RuntimeAbnormalStoppingEvent( getContext().getIdentity(), "Machine is abnormal stopped.")); try { internalStop(emptyMap()); } catch (InfrastructureException e) { LOG.error(e.getLocalizedMessage(), e); } finally { eventService.publish( new RuntimeAbnormalStoppedEvent( getContext().getIdentity(), "Machine is abnormal stopped.")); } }

Target:
public void handle(String error) { eventService.publish(new RuntimeAbnormalStoppingEvent(getContext().getIdentity(), error)); try { internalStop(emptyMap()); } catch (InfrastructureException e) { LOG.error(e.getLocalizedMessage(), e); } finally { eventService.publish(new RuntimeAbnormalStoppedEvent(getContext().getIdentity(), error)); } }
Source:
public static Entity fromString(EntityType type, String str) { try { Unmarshaller unmarshaler = type.getUnmarshaller(); XMLInputFactory xif = XMLInputFactory.newFactory(); xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); xif.setProperty(XMLInputFactory.SUPPORT_DTD, false); XMLStreamReader xsr = xif.createXMLStreamReader(new StringReader(str)); return (Entity) unmarshaler.unmarshal(xsr); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public static Entity fromString(EntityType type, String str) { try { Unmarshaller unmarshaler = type.getUnmarshaller(); XMLInputFactory xif = SchemaHelper.createXmlInputFactory(); XMLStreamReader xsr = xif.createXMLStreamReader(new StringReader(str)); return (Entity) unmarshaler.unmarshal(xsr); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
protected IStatus run(IProgressMonitor monitor) { fStatsMod.waitForInitialization(); ITmfStatistics stats = fStatsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } ITmfStateSystem ss = fStatsMod.getStateSystem(TmfStatisticsEventTypesModule.ID); if (ss == null) { throw new IllegalStateException(); } TmfTimeRange localtimeRange = fIsGlobal ? fTimeRange : fTimeRangePartial; long start = localtimeRange.getStartTime().normalize(0, TIME_SCALE).getValue(); long end = localtimeRange.getEndTime().normalize(0, TIME_SCALE).getValue(); while (!ss.waitUntilBuilt(LIVE_UPDATE_DELAY)) { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } localtimeRange = fIsGlobal ? fTimeRange : fTimeRangePartial; start = localtimeRange.getStartTime().normalize(0, TIME_SCALE).getValue(); end = localtimeRange.getEndTime().normalize(0, TIME_SCALE).getValue(); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); } Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { fStatsMod.waitForInitialization(); ITmfStatistics stats = fStatsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } ITmfStateSystem ss = fStatsMod.getStateSystem(TmfStatisticsEventTypesModule.ID); if (ss == null) { throw new IllegalStateException(); } long start = 0; long end = 0; do { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } TmfTimeRange localtimeRange = fIsGlobal ? fTimeRange : fTimeRangePartial; start = localtimeRange.getStartTime().normalize(0, TIME_SCALE).getValue(); end = localtimeRange.getEndTime().normalize(0, TIME_SCALE).getValue(); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); } while (!ss.waitUntilBuilt(LIVE_UPDATE_DELAY)); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); return Status.OK_STATUS; }
Source:
FSTreeIterator(TreePath p) { AclStatus acls = null; Path remotePath = p.getFileStatus().getPath(); try { acls = getAclStatus(fs, remotePath); } catch (IOException e) { LOG.warn( "Got exception when trying to get remote acls for path : {}", remotePath, e.getMessage()); } getPendingQueue().addFirst( new TreePath(p.getFileStatus(), p.getParentId(), this, fs, acls)); }

Target:
FSTreeIterator(TreePath p) { this(p.getFileStatus(), p.getParentId()); }
Source:
private List<Availability> getNitroAvailabilities(Clip clip) throws GlycerinException { AvailabilityQuery query = AvailabilityQuery.builder() .withDescendantsOf(clip.getPid()) .withPageSize(pageSize) .build(); GlycerinResponse<Availability> availabilities = glycerin.execute(query); return availabilities.getResults(); }

Target:
private ImmutableList<Availability> getNitroAvailabilities(Clip clip) throws GlycerinException { List<ListenableFuture<ImmutableList<Availability>>> futures = Lists.newArrayList(); AvailabilityQuery query = AvailabilityQuery.builder() .withDescendantsOf(clip.getPid()) .withPageSize(pageSize) .build(); futures.add(executor.submit(exhaustingAvailabilityCallable(query))); ListenableFuture<List<ImmutableList<Availability>>> all = Futures.allAsList(futures); try { return ImmutableList.copyOf(Iterables.concat(all.get())); } catch (InterruptedException | ExecutionException e) { if (e.getCause() instanceof GlycerinException) { throw (GlycerinException) e.getCause(); } throw Throwables.propagate(e); } }
Source:
private void handleCredentials(HttpServletRequest request, String user, String password) { UserProfile userProfile = translateUser(user); AuthenticationProfile profile = AuthenticationProfileRepository.getInstance().getProfile(userProfile.profile); if (profile == null) { String msg = String.format("Error in obtaining profile %1$s", userProfile.profile); log.error(msg); } else { ExtMap outputMap = profile.getAuthn().invoke(new ExtMap().mput( Base.InvokeKeys.COMMAND, Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS ).mput( Authn.InvokeKeys.USER, userProfile.userName ).mput( Authn.InvokeKeys.CREDENTIALS, password ) ); if (outputMap.<Integer> get(Base.InvokeKeys.RESULT) == Base.InvokeResult.SUCCESS && outputMap.<Integer> get(Authn.InvokeKeys.RESULT) == Authn.AuthResult.SUCCESS) { request.getSession(true); request.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY, outputMap.<ExtMap> get(Authn.InvokeKeys.AUTH_RECORD)); request.setAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY, userProfile.profile); } else { log.error( String.format( "Failure in authentication to profile %1$s. Invocation Result code is %2$s. Authn result code is %3$s", userProfile.profile, outputMap.<Integer> get(Base.InvokeKeys.RESULT), outputMap.<Integer> get(Authn.InvokeKeys.RESULT) ) ); } } }

Target:
private void handleCredentials(HttpServletRequest request, String user, String password) { UserProfile userProfile = translateUser(user); AuthenticationProfile profile = AuthenticationProfileRepository.getInstance().getProfile(userProfile.profile); if (profile == null) { log.error(String.format("Error in obtaining profile %1$s", userProfile.profile)); } else { ExtMap outputMap = profile.getAuthn().invoke(new ExtMap().mput( Base.InvokeKeys.COMMAND, Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS ).mput( Authn.InvokeKeys.USER, userProfile.userName ).mput( Authn.InvokeKeys.CREDENTIALS, password ) ); if (outputMap.<Integer> get(Base.InvokeKeys.RESULT) == Base.InvokeResult.SUCCESS && outputMap.<Integer> get(Authn.InvokeKeys.RESULT) == Authn.AuthResult.SUCCESS) { request.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY, outputMap.<ExtMap> get(Authn.InvokeKeys.AUTH_RECORD)); request.setAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY, userProfile.profile); } else { log.error( String.format( "Failure in authentication to profile %1$s. Invocation Result code is %2$s. Authn result code is %3$s", userProfile.profile, outputMap.<Integer> get(Base.InvokeKeys.RESULT), outputMap.<Integer> get(Authn.InvokeKeys.RESULT) ) ); } } }
Source:
public UserSqlSandbox(String username) { caseStorage = new SqlIndexedStorageUtility<>(Case.class, username, "CCCase"); ledgerStorage = new SqlIndexedStorageUtility<>(Ledger.class, username, "Ledger"); userStorage = new SqlIndexedStorageUtility<>(User.class, username, "User"); userFixtureStorage = new SqlIndexedStorageUtility<>(FormInstance.class, username, "UserFixture"); appFixtureStorage = new SqlIndexedStorageUtility<>(FormInstance.class, username, "AppFixture"); }

Target:
public UserSqlSandbox(String username) { caseStorage = new SqliteIndexedStorageUtility<>(Case.class, username, "CCCase"); ledgerStorage = new SqliteIndexedStorageUtility<>(Ledger.class, username, Ledger.STORAGE_KEY); userStorage = new SqliteIndexedStorageUtility<>(User.class, username, User.STORAGE_KEY); userFixtureStorage = new SqliteIndexedStorageUtility<>(FormInstance.class, username, "UserFixture"); appFixtureStorage = new SqliteIndexedStorageUtility<>(FormInstance.class, username, "AppFixture"); }
Source:
protected static void addAction(List<PDAction> actions, org.apache.pdfbox.pdmodel.interactive.action.PDAction buffer) { if (buffer != null) { actions.add(buffer instanceof PDActionNamed ? new PBoxPDNamedAction( (PDActionNamed) buffer) : new PBoxPDAction(buffer)); } }

Target:
protected void addAction(List<PDAction> actions, org.apache.pdfbox.pdmodel.interactive.action.PDAction buffer) { if (buffer != null) { actions.add(buffer instanceof PDActionNamed ? new PBoxPDNamedAction( (PDActionNamed) buffer) : new PBoxPDAction(buffer)); } }
Source:
private String createPrivateKeyString(KeyPair sshKeyPair) { String privateKeyStr = PkiUtil.convert(sshKeyPair.getPrivate()); if (privateKeyStr.endsWith("\n")) { privateKeyStr = privateKeyStr.substring(0, privateKeyStr.length() - 1); } return privateKeyStr; }

Target:
private String createPrivateKeyString(KeyPair sshKeyPair) { return StringUtils.removeEnd(PkiUtil.convert(sshKeyPair.getPrivate()), "\n"); }
Source:
protected String decorateMessageSubject(String subject) { if ("".equals(subject)) { return ""; } StringBuilder bldr = new StringBuilder("*"); bldr.append(subject).append("*").append("\n"); return bldr.toString(); }

Target:
protected String decorateMessageSubject(String subject) { if ("".equals(subject)) { return ""; } StringBuilder bldr = new StringBuilder("**"); bldr.append(subject).append("**").append("\n"); return bldr.toString(); }
Source:
public void displayHighlighted( StringNormalizer.Result normalized, String text, FuzzyScore fuzzyScore, TextView view, Context context ) { displayHighlighted(normalized, text, fuzzyScore, view, false, context); }

Target:
public boolean displayHighlighted(StringNormalizer.Result normalized, String text, FuzzyScore fuzzyScore, TextView view, Context context) { FuzzyScore.MatchInfo matchInfo = fuzzyScore.match(normalized.codePoints); if (!matchInfo.match) { view.setText(text); return false; } SpannableString enriched = new SpannableString(text); int primaryColor = UIColors.getPrimaryColor(context); for (Pair<Integer, Integer> position : matchInfo.getMatchedSequences()) { enriched.setSpan( new ForegroundColorSpan(primaryColor), normalized.mapPosition(position.first), normalized.mapPosition(position.second), Spannable.SPAN_INCLUSIVE_INCLUSIVE ); } view.setText(enriched); return true; }
Source:
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { for (Uri uri : files) { File sourceFile = new File(getRealPathFromURI(uri)); String path = mAdapter.getItem(i).path; File destFile = new File(path, sourceFile.getName()); try { copy(sourceFile, destFile); } catch (IOException e) { Log.e(TAG, "Failed copying file", e); } } getActivity().finish(); }

Target:
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if (!copying) { copying = true; RestApi.Folder destFolder = getItemFolder(i); CopyFilesTaskParams copyFilesTaskParams = new CopyFilesTaskParams(mFiles, destFolder); new CopyFilesTask().execute(copyFilesTaskParams); } }
Source:
public static void beforeClass() { SWTBotUtils.initialize(); Thread.currentThread().setName("SWTBotTest"); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); SWTWorkbenchBot bot = new SWTWorkbenchBot(); final List<SWTBotView> openViews = bot.views(); for (SWTBotView view : openViews) { if (view.getTitle().equals("Welcome")) { view.close(); bot.waitUntil(ConditionHelpers.ViewIsClosed(view)); } } switchTracingPerspective(); SWTBotUtils.waitForJobs(); }

Target:
public static void beforeClass() { SWTBotUtils.initialize(); Thread.currentThread().setName("SWTBotTest"); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); SWTWorkbenchBot bot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", bot); SWTBotUtils.switchToTracingPerspective(); SWTBotUtils.waitForJobs(); }
Source:
public String toString() { StringBuilder sb = new StringBuilder("DefaultKfsAccountForAwsResultWrapper {"); defaultKfsAccountsForAws.stream().forEach(acct -> sb.append("[").append(acct.toString()).append("]")); sb.append("}"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder("DefaultKfsAccountForAwsResultWrapper {"); String joinedStringOutput = defaultKfsAccountsForAws.stream() .map(acct -> acct.toString()) .collect(Collectors.joining("] [", "[", "]")); sb.append(joinedStringOutput).append("}"); return sb.toString(); }
Source:
public RomanColumnFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) { super(definition, blockBuilder); BLOCKS = new TByteObjectHashMap<Block>(); blockUri = new BlockUri(definition.getUrn()); BLOCKS.put((byte) 0, makeABlock(definition, blockBuilder, "lone_block", blockUri, (byte) 0)); BLOCKS.put(SideBitFlag.getSide(Side.TOP), makeABlock(definition, blockBuilder, "on_bottom", blockUri, SideBitFlag.getSide(Side.TOP))); BLOCKS.put(SideBitFlag.getSide(Side.BOTTOM), makeABlock(definition, blockBuilder, "on_top", blockUri, SideBitFlag.getSide(Side.BOTTOM))); BLOCKS.put(SideBitFlag.getSides(Side.BOTTOM, Side.TOP), makeABlock(definition, blockBuilder, "in_a_line", blockUri, SideBitFlag.getSides(Side.TOP, Side.BOTTOM))); this.setBlockUri(blockUri); this.setCategory(definition.getCategories()); }

Target:
public RomanColumnFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) { super(definition, blockBuilder); blocks = new TByteObjectHashMap<Block>(); blockUri = new BlockUri(definition.getUrn()); addConnection((byte) 0, "lone_block", definition, blockBuilder); addConnection(SideBitFlag.getSide(Side.TOP), "on_bottom", definition, blockBuilder); addConnection(SideBitFlag.getSide(Side.BOTTOM), "on_top", definition, blockBuilder); addConnection(SideBitFlag.getSides(Side.TOP, Side.BOTTOM), "in_a_line", definition, blockBuilder); this.setBlockUri(blockUri); this.setCategory(definition.getCategories()); this.setCategory(categories); }
Source:
public void testDeactivateDoesNotRestoreForNoOpenTasks() { taskActivityManager.activateTask(task1); taskActivityManager.deactivateTask(task1); assertNoTaskOrTextEditorsOpen(); taskActivityManager.activateTask(task1); assertEquals(Collections.emptyList(), getOpenEditorsByType(TaskEditor.class)); }

Target:
public void testDeactivateDoesNotRestoreForNoOpenTasks() { taskActivityManager.activateTask(task1); taskActivityManager.deactivateTask(task1); assertNoTaskOrTextEditorsOpen(); taskActivityManager.activateTask(task1); assertNoTaskOrTextEditorsOpen(); }
Source:
public static void assertSchedulable(String entityType){ if (entityType.equalsIgnoreCase(EntityType.PROCESS.toString()) || entityType.equalsIgnoreCase(EntityType.FEED.toString())){ return; } else { throw new IllegalArgumentException("EntityType "+ entityType + " is not valid,Feed and Process are the valid input type."); } }

Target:
public static void assertSchedulable(String entityType){ EntityType type = EntityType.getEnum(entityType); if (type.isSchedulable()){ return; } else { throw new IllegalArgumentException("EntityType "+ entityType + " is not valid,Feed and Process are the valid input type."); } }
Source:
private Mono<TransactionCoordinator> createTransactionCoordinator() { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "Cannot create coordinator send link '%s' from a closed session.", TRANSACTION_LINK_NAME)))); } if (transactionCoordinator != null) { logger.verbose("Coordinator[{}]: Returning existing transaction coordinator.", TRANSACTION_LINK_NAME); return Mono.just(transactionCoordinator); } synchronized (coordinatorLock) { return createCoordinatorSendLink(TRANSACTION_LINK_NAME, openTimeout, retryPolicy) .handle((amqpLink, sink) -> { logger.info("Coordinator[{}]: Creating transaction coordinator.", TRANSACTION_LINK_NAME); final TransactionCoordinator transactionCoordinator = new TransactionCoordinator(amqpLink, messageSerializer); sink.next(transactionCoordinator); }); } }

Target:
private Mono<TransactionCoordinator> createTransactionCoordinator() { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "Cannot create coordinator send link '%s' from a closed session.", TRANSACTION_LINK_NAME)))); } TransactionCoordinator existing = transactionCoordinator.get(); if (existing != null) { logger.verbose("Coordinator[{}]: Returning existing transaction coordinator.", TRANSACTION_LINK_NAME); return Mono.just(existing); } return createCoordinatorSendLink(openTimeout, retryPolicy) .map(sendLink -> { TransactionCoordinator newCoordinator = new TransactionCoordinator(sendLink, messageSerializer); if (transactionCoordinator.compareAndSet(null, newCoordinator)) { logger.info("Coordinator[{}]: Created transaction coordinator.", TRANSACTION_LINK_NAME); } else { logger.info("linkName[{}]: Another transaction coordinator exists.", TRANSACTION_LINK_NAME); } return transactionCoordinator.get(); }); }
Source:
public void setAttribute(PatientProgramAttribute attribute) { if (this.getAttributes() == null) { this.addAttribute(attribute); } else { if (this.getActiveAttributes(attribute.getAttributeType()).size() == 1) { PatientProgramAttribute i$ = this.getActiveAttributes(attribute.getAttributeType()).get(0); if (!i$.getValue().equals(attribute.getValue())) { if (i$.getId() != null) { i$.setVoided(Boolean.TRUE); } else { this.getAttributes().remove(i$); } this.getAttributes().add(attribute); attribute.setOwner(this); } } else { for (PatientProgramAttribute existing : this.getActiveAttributes(attribute.getAttributeType())) { if (existing.getAttributeType().equals(attribute.getAttributeType())) { if (existing.getId() != null) { existing.setVoided(Boolean.TRUE); } else { this.getAttributes().remove(existing); } } } this.getAttributes().add(attribute); attribute.setOwner(this); } } }

Target:
public void setAttribute(PatientProgramAttribute attribute) { if (this.getAttributes() == null) { this.addAttribute(attribute); } else { if (this.getActiveAttributes(attribute.getAttributeType()).size() == 1) { PatientProgramAttribute patientProgramAttribute = this.getActiveAttributes(attribute.getAttributeType()).get(0); if (!patientProgramAttribute.getValue().equals(attribute.getValue())) { if (patientProgramAttribute.getId() != null) { patientProgramAttribute.setVoided(Boolean.TRUE); } else { this.getAttributes().remove(patientProgramAttribute); } this.getAttributes().add(attribute); attribute.setOwner(this); } } else { for (PatientProgramAttribute existing : this.getActiveAttributes(attribute.getAttributeType())) { if (existing.getAttributeType().equals(attribute.getAttributeType())) { if (existing.getId() != null) { existing.setVoided(Boolean.TRUE); } else { this.getAttributes().remove(existing); } } } this.getAttributes().add(attribute); attribute.setOwner(this); } } }
Source:
public void onDeleted(Item item) { if (!(item instanceof TopLevelItem)) { return; } TopLevelItem tli = (TopLevelItem) item; Jenkins jenkins = Jenkins.get(); Computer.threadPoolForRemoting.submit(new CleanupTask(tli, jenkins)); if(System.getenv("BRANCH_API_THREAD_LIMIT") == null){ jenkins.getNodes().forEach((node) -> { Computer.threadPoolForRemoting.submit(new CleanupTask(tli, node)); }); }else{ new CleanupTaskProvisioner(tli, jenkins.getNodes()).run(); } }

Target:
public void onDeleted(Item item) { if (!(item instanceof TopLevelItem)) { return; } TopLevelItem tli = (TopLevelItem) item; Jenkins jenkins = Jenkins.get(); Computer.threadPoolForRemoting.submit(new CleanupTask(tli, jenkins)); new CleanupTaskProvisioner(tli, jenkins.getNodes()).run(); }
Source:
public void describeMismatchSafely(final Response item, final Description description) { description.appendText("header was: ") .appendDescriptionOf(this.headerm) .appendText(VALUES_STR) .appendValue(this.failedvals); }

Target:
public void describeMismatchSafely(final Response item, final Description description) { description.appendText("header was: ") .appendDescriptionOf(this.header) .appendText(HmRsHeader.VALUES_STR) .appendValue(this.failed); }
Source:
private NextAction processWithListeners(ListenerContext listenerContext, WorkflowInstance instance, AbstractWorkflowDefinition<? extends WorkflowState> definition, StateExecutionImpl execution, WorkflowState state) { List<WorkflowExecutorListener> chain = new LinkedList<>(asList(this.executorListeners)); ProcessingExecutorListener processingListener = new ProcessingExecutorListener(instance, definition, execution, state); chain.add(processingListener); NextAction nextAction = new ExecutorListenerChain(chain).next(listenerContext); if (execution.isStateProcessInvoked()) { return nextAction; } return new SkippedStateHandler(nextAction, instance, definition, execution, state).processState(); }

Target:
private NextAction processWithListeners(ListenerContext listenerContext, WorkflowInstance instance, AbstractWorkflowDefinition<? extends WorkflowState> definition, StateExecutionImpl execution, WorkflowState state) { ProcessingExecutorListener processingListener = new ProcessingExecutorListener(instance, definition, execution, state); List<WorkflowExecutorListener> chain = new ArrayList<>(executorListeners.size() + 1); for (WorkflowExecutorListener listener : executorListeners) { if (listener.appliesTo(listenerContext)) { chain.add(listener); } } chain.add(processingListener); NextAction nextAction = new ExecutorListenerChain(chain).next(listenerContext); if (execution.isStateProcessInvoked()) { return nextAction; } return new SkippedStateHandler(nextAction, instance, definition, execution, state).processState(); }
Source:
CosmosAsyncClient(CosmosClientBuilder builder) { this.configs = builder.configs(); this.serviceEndpoint = builder.getEndpoint(); this.keyOrResourceToken = builder.getKey(); this.connectionPolicy = builder.getConnectionPolicy(); this.desiredConsistencyLevel = builder.getConsistencyLevel(); this.permissions = builder.getPermissions(); this.cosmosAuthorizationTokenResolver = builder.getAuthorizationTokenResolver(); this.credential = builder.getCredential(); this.sessionCapturingOverride = builder.isSessionCapturingOverrideEnabled(); this.enableTransportClientSharing = builder.isConnectionSharingAcrossClientsEnabled(); this.contentResponseOnWriteEnabled = builder.isContentResponseOnWriteEnabled(); this.tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); this.asyncDocumentClient = new AsyncDocumentClient.Builder() .withServiceEndpoint(this.serviceEndpoint) .withMasterKeyOrResourceToken(this.keyOrResourceToken) .withConnectionPolicy(this.connectionPolicy) .withConsistencyLevel(this.desiredConsistencyLevel) .withSessionCapturingOverride(this.sessionCapturingOverride) .withConfigs(this.configs) .withTokenResolver(this.cosmosAuthorizationTokenResolver) .withCredential(this.credential) .withTransportClientSharing(this.enableTransportClientSharing) .withContentResponseOnWriteEnabled(this.contentResponseOnWriteEnabled) .build(); }

Target:
CosmosAsyncClient(CosmosClientBuilder builder) { this.configs = builder.configs(); this.serviceEndpoint = builder.getEndpoint(); this.keyOrResourceToken = builder.getKey(); this.connectionPolicy = builder.getConnectionPolicy(); this.desiredConsistencyLevel = builder.getConsistencyLevel(); this.permissions = builder.getPermissions(); this.cosmosAuthorizationTokenResolver = builder.getAuthorizationTokenResolver(); this.credential = builder.getCredential(); this.sessionCapturingOverride = builder.isSessionCapturingOverrideEnabled(); this.dataEncryptionKeyProvider = builder.getDataEncryptionKeyProvider(); this.enableTransportClientSharing = builder.isConnectionSharingAcrossClientsEnabled(); this.contentResponseOnWriteEnabled = builder.isContentResponseOnWriteEnabled(); this.tracerProvider = new TracerProvider(TRACER); this.asyncDocumentClient = new AsyncDocumentClient.Builder() .withServiceEndpoint(this.serviceEndpoint) .withMasterKeyOrResourceToken(this.keyOrResourceToken) .withConnectionPolicy(this.connectionPolicy) .withConsistencyLevel(this.desiredConsistencyLevel) .withSessionCapturingOverride(this.sessionCapturingOverride) .withConfigs(this.configs) .withTokenResolver(this.cosmosAuthorizationTokenResolver) .withCredential(this.credential) .withTransportClientSharing(this.enableTransportClientSharing) .withDataEncryptionKeyProvider(this.dataEncryptionKeyProvider) .withContentResponseOnWriteEnabled(this.contentResponseOnWriteEnabled) .build(); }
Source:
private boolean hasAnySanitizedField(StudentProfileAttributes profile) { return isSanitizedHtml(profile.shortName) || isSanitizedHtml(profile.email) || isSanitizedHtml(profile.institute) || isSanitizedHtml(profile.nationality) || isSanitizedHtml(String.valueOf(profile.gender)) || isSanitizedHtml(profile.moreInfo); }

Target:
private boolean hasAnySanitizedField(StudentProfileAttributes profile) { return isSanitizedHtml(profile.shortName) || isSanitizedHtml(profile.email) || isSanitizedHtml(profile.institute) || isSanitizedHtml(profile.nationality) || isSanitizedHtml(profile.moreInfo); }
Source:
public ContainerAttributes containerAttributes() { final ContainerAttributes containerAttributes = new ContainerAttributes(); setConfiguredContainerAttributes(containerAttributes); final String containerIp = environment.getProperty("xd.container.ip"); final String containerHostname = environment.getProperty("xd.container.hostname"); if (StringUtils.hasText(containerIp)) { containerAttributes.setIp(containerIp); } else { containerAttributes.setIp(RuntimeUtils.getIpAddress()); } if (StringUtils.hasText(containerHostname)) { containerAttributes.setHost(containerHostname); } else { containerAttributes.setHost(RuntimeUtils.getHost()); } containerAttributes.setPid(RuntimeUtils.getPid()); return containerAttributes; }

Target:
public ContainerAttributes containerAttributes() { final ContainerAttributes containerAttributes = new ContainerAttributes(); setConfiguredContainerAttributes(containerAttributes); final String containerIp = environment.getProperty("xd.container.ip"); final String containerHostname = environment.getProperty("xd.container.hostname"); containerAttributes.setIp(StringUtils.hasText(containerIp) ? containerIp : RuntimeUtils.getIpAddress()); containerAttributes.setHost(StringUtils.hasText(containerHostname) ? containerHostname : RuntimeUtils.getHost()); containerAttributes.setPid(RuntimeUtils.getPid()); return containerAttributes; }
Source:
public static String readDigestFromStream( final InputStream inputStream ) throws IOException { try { String raw = StringUtils.chomp( IOUtil.toString( inputStream, "UTF-8" ) ).trim(); if ( raw != null && StringUtils.isEmpty( raw ) ) { return ""; } String digest; if ( raw.contains( "=" ) || raw.contains( ":" ) ) { digest = raw.split( "[=:]", 2 )[1].trim(); } else { digest = raw.split( " ", 2 )[0]; } if ( !isDigest( digest ) ) { digest = compress( digest ); } if ( !isDigest( digest ) ) { digest = compress( raw ); } if ( !isDigest( digest ) ) { digest = compress( raw.substring( 0, raw.lastIndexOf( " " ) ).trim() ); } if ( !isDigest( digest ) ) { digest = raw.split( " ", 2 )[0]; } return digest; } finally { IOUtil.close( inputStream ); } }

Target:
public static String readDigestFromStream( final InputStream inputStream ) throws IOException { try { String raw = StringUtils.chomp( IOUtil.toString( inputStream, "UTF-8" ) ).trim(); if ( StringUtils.isEmpty( raw ) ) { return ""; } String digest; if ( raw.contains( "=" ) || raw.contains( ":" ) ) { digest = raw.split( "[=:]", 2 )[1].trim(); } else { digest = raw.split( " ", 2 )[0]; } if ( !isDigest( digest ) ) { digest = compress( digest ); } if ( !isDigest( digest ) ) { digest = compress( raw ); } if ( !isDigest( digest ) ) { digest = compress( raw.substring( 0, raw.lastIndexOf( " " ) ).trim() ); } if ( !isDigest( digest ) ) { digest = raw.split( " ", 2 )[0]; } return digest; } finally { IOUtil.close( inputStream ); } }
Source:
protected void handleMessageInRunContext(final Message jmsMessage) throws JMSException { final JmsMessageReader<DTO> messageReader = JmsMessageReader.newInstance(jmsMessage, m_marshaller); final IMessage<DTO> message = messageReader.readMessage(); final String correlationId = messageReader.readCorrelationId(); createRunContext() .withCorrelationId(correlationId) .withThreadLocal(IMessage.CURRENT, message) .run(new IRunnable() { @Override public void run() throws Exception { try { m_listener.onMessage(message); } catch (Exception e) { throw BEANS.get(PlatformExceptionTranslator.class).translate(e) .withContextInfo("JMSCorrelationID", correlationId); } } }); }

Target:
protected void handleMessageInRunContext(final Message jmsMessage) throws JMSException { final JmsMessageReader<DTO> messageReader = JmsMessageReader.newInstance(jmsMessage, m_marshaller); final IMessage<DTO> message = messageReader.readMessage(); final String correlationId = messageReader.readCorrelationId(); createRunContext() .withCorrelationId(correlationId) .withThreadLocal(IMessage.CURRENT, message) .run(new IRunnable() { @Override public void run() throws Exception { try { m_listener.onMessage(message); } catch (Exception e) { throw BEANS.get(PlatformExceptionTranslator.class).translate(e) .withContextInfo("correlationId", correlationId); } } }); }
Source:
public Result apply(LimitNode parent, Captures captures, Context context) { JoinNode joinNode = captures.get(CHILD); PlanNode left = joinNode.getLeft(); PlanNode right = joinNode.getRight(); if (isLeftOuter(joinNode.getType()) && !isLimited(left, context.getLookup(), parent.getCount())) { left = new LimitNode(context.getIdAllocator().getNextId(), left, parent.getCount(), true); } if (isRightOuter(joinNode.getType()) && !isLimited(right, context.getLookup(), parent.getCount())) { right = new LimitNode(context.getIdAllocator().getNextId(), right, parent.getCount(), true); } if (joinNode.getLeft() != left || joinNode.getRight() != right) { return Result.ofPlanNode( parent.replaceChildren(ImmutableList.of( joinNode.replaceChildren(ImmutableList.of(left, right))))); } return Result.empty(); }

Target:
public Result apply(LimitNode parent, Captures captures, Context context) { if (!isPushLimitThroughOuterJoin(context.getSession())) { return Result.empty(); } JoinNode joinNode = captures.get(CHILD); PlanNode left = joinNode.getLeft(); PlanNode right = joinNode.getRight(); if (joinNode.getType() == LEFT && !isLimited(left, context.getLookup(), parent.getCount())) { left = new LimitNode(context.getIdAllocator().getNextId(), left, parent.getCount(), true); } if (joinNode.getType() == RIGHT && !isLimited(right, context.getLookup(), parent.getCount())) { right = new LimitNode(context.getIdAllocator().getNextId(), right, parent.getCount(), true); } if (joinNode.getLeft() != left || joinNode.getRight() != right) { return Result.ofPlanNode( parent.replaceChildren(ImmutableList.of( joinNode.replaceChildren(ImmutableList.of(left, right))))); } return Result.empty(); }
Source:
String translate(String sentence) { List<String> translatedWords = Arrays.stream(sentence.split(" ")) .map(this::translateWord) .collect(Collectors.toList()); return String.join(" ", translatedWords); }

Target:
String translate(String sentence) { return Arrays.stream(sentence.split(" ")) .map(this::translateWord) .collect(Collectors.joining(" ")); }
Source:
public Object visitComputeCommand(InvocationContext ctx, ComputeCommand command) throws Throwable { return invokeNextThenAccept(ctx, command, (rCtx, rCommand, rv) -> { ComputeCommand computeCommand = (ComputeCommand) rCommand; if (!isStoreEnabled(computeCommand) || rCtx.isInTxScope() || !computeCommand.isSuccessful()) return; if (!isProperWriter(rCtx, computeCommand, computeCommand.getKey())) return; Object key = computeCommand.getKey(); storeEntry(rCtx, key, computeCommand); if (getStatisticsEnabled()) cacheStores.incrementAndGet(); }); }

Target:
public Object visitComputeCommand(InvocationContext ctx, ComputeCommand command) throws Throwable { return invokeNextThenAccept(ctx, command, (rCtx, rCommand, rv) -> { ComputeCommand computeCommand = (ComputeCommand) rCommand; if (!isStoreEnabled(computeCommand) || rCtx.isInTxScope() || !computeCommand.isSuccessful()) return; if (!isProperWriter(rCtx, computeCommand, computeCommand.getKey())) return; Object key = computeCommand.getKey(); if(rv == null) { boolean resp = persistenceManager.deleteFromAllStores(key, BOTH); if (trace) getLog().tracef("Removed entry under key %s and got response %s from CacheStore", key, resp); } else { storeEntry(rCtx, key, computeCommand); if (getStatisticsEnabled()) cacheStores.incrementAndGet(); } }); }