auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void courseExercisesAreDividedIntoThemesCorrectly() { exercises = new ArrayList<>(); exercises.add(new Exercise("viikko1-testi")); exercises.add(new Exercise("viikko2-testi")); exercises.add(new Exercise("viikko3-testi")); course.setExercises(exercises); course.generateThemes(); assertEquals(3,course.getExercises().size()); }

Target:
public void courseExercisesAreDividedIntoThemesCorrectly() { exercises = new ArrayList<>(); exercises.add(new Exercise("viikko1-testi")); exercises.add(new Exercise("viikko2-testi")); exercises.add(new Exercise("viikko3-testi")); course.setExercises(exercises); course.generateThemes(); assertEquals(3,course.getThemes().size()); }
Source:
public UsbHandler(Looper looper) { super(looper); try { mCurrentFunctions = SystemProperties.get(USB_CONFIG_PROPERTY, UsbManager.USB_FUNCTION_NONE); mCurrentFunctionsApplied = mCurrentFunctions.equals( SystemProperties.get(USB_STATE_PROPERTY)); mAdbEnabled = UsbManager.containsFunction(getDefaultFunctions(), UsbManager.USB_FUNCTION_ADB); String buildType = SystemProperties.get(BUILD_TYPE_PROPERTY); if (buildType.equals(BUILD_TYPE_USERDEBUG) || buildType.equals(BUILD_TYPE_ENG)) { setAdbEnabled(true); } setEnabledFunctions(null, false, false); String state = FileUtils.readTextFile(new File(STATE_PATH), 0, null).trim(); updateState(state); mContentResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.ADB_ENABLED), false, new AdbSettingsObserver()); mUEventObserver.startObserving(USB_STATE_MATCH); mUEventObserver.startObserving(ACCESSORY_START_MATCH); } catch (Exception e) { Slog.e(TAG, "Error initializing UsbHandler", e); } }

Target:
public UsbHandler(Looper looper) { super(looper); try { mCurrentFunctions = SystemProperties.get(USB_CONFIG_PROPERTY, UsbManager.USB_FUNCTION_NONE); mCurrentFunctionsApplied = mCurrentFunctions.equals( SystemProperties.get(USB_STATE_PROPERTY)); mAdbEnabled = UsbManager.containsFunction(getDefaultFunctions(), UsbManager.USB_FUNCTION_ADB); String buildType = android.os.Build.TYPE; if (buildType.equals(BUILD_TYPE_USERDEBUG) || buildType.equals(BUILD_TYPE_ENG)) { setAdbEnabled(true); } setEnabledFunctions(null, false, false); String state = FileUtils.readTextFile(new File(STATE_PATH), 0, null).trim(); updateState(state); mContentResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.ADB_ENABLED), false, new AdbSettingsObserver()); mUEventObserver.startObserving(USB_STATE_MATCH); mUEventObserver.startObserving(ACCESSORY_START_MATCH); } catch (Exception e) { Slog.e(TAG, "Error initializing UsbHandler", e); } }
Source:
protected Comparator getComparator() { return new Comparator() { public int compare(Object arg0, Object arg1) { String label0 = arg0 == null ? "" : arg0.toString(); String label1 = arg1 == null ? "" : arg1.toString(); String pattern = "\\d+,\\d+ -> \\d+,\\d+.*"; if (Pattern.matches(pattern, label0) && Pattern.matches(pattern, label1)) { int oldStart0 = Integer.parseInt(label0.split(",")[0]); int oldStart1 = Integer.parseInt(label1.split(",")[0]); return oldStart0 - oldStart1; } return Policy.getComparator().compare(label0, label1); } }; }

Target:
protected Comparator getComparator() { return new Comparator() { public int compare(Object arg0, Object arg1) { String label0 = arg0 == null ? "" : arg0.toString(); String label1 = arg1 == null ? "" : arg1.toString(); String pattern = "\\d+,\\d+ -> \\d+,\\d+.*"; if (Pattern.matches(pattern, label0) && Pattern.matches(pattern, label1)) { int oldStart0 = Integer.parseInt(label0.split(",")[0]); int oldStart1 = Integer.parseInt(label1.split(",")[0]); return oldStart0 - oldStart1; } return Policy.getComparator().compare(arg0, arg1); } }; }
Source:
public void handleMessageInternal(final Message<?> message) throws MessageHandlingException { if (this.serverConnectionFactory != null) { Object connectionId = message.getHeaders().get(IpHeaders.CONNECTION_ID); TcpConnection connection = null; if (connectionId != null) { connection = connections.get(connectionId); } if (connection != null) { try { connection.send(message); } catch (Exception e) { logger.error("Error sending message", e); connection.close(); if (e instanceof MessageHandlingException) { throw (MessageHandlingException) e; } else { throw new MessageHandlingException(message, "Error sending message", e); } } } else { logger.error("Unable to find outbound socket for " + message); MessageHandlingException messageHandlingException = new MessageHandlingException(message, "Unable to find outbound socket"); publishNoConnectionEvent(message, (String) connectionId); throw messageHandlingException; } return; } else { try { doWrite(message); } catch (MessageHandlingException e) { if (e.getCause() instanceof IOException) { if (logger.isDebugEnabled()) { logger.debug("Fail on first write attempt", e); } doWrite(message); } else { throw e; } } } }

Target:
public void handleMessageInternal(final Message<?> message) throws MessageHandlingException { if (this.serverConnectionFactory != null) { Object connectionId = message.getHeaders().get(IpHeaders.CONNECTION_ID); TcpConnection connection = null; if (connectionId != null) { connection = connections.get(connectionId); } if (connection != null) { try { connection.send(message); } catch (Exception e) { logger.error("Error sending message", e); connection.close(); if (e instanceof MessageHandlingException) { throw (MessageHandlingException) e; } else { throw new MessageHandlingException(message, "Error sending message", e); } } } else { logger.error("Unable to find outbound socket for " + message); MessageHandlingException messageHandlingException = new MessageHandlingException(message, "Unable to find outbound socket"); publishNoConnectionEvent(messageHandlingException, (String) connectionId); throw messageHandlingException; } return; } else { try { doWrite(message); } catch (MessageHandlingException e) { if (e.getCause() instanceof IOException) { if (logger.isDebugEnabled()) { logger.debug("Fail on first write attempt", e); } doWrite(message); } else { throw e; } } } }
Source:
public boolean canRestoreVmConfigurationFromSnapshot(VM vm, Snapshot snapshot, VmInterfaceManager vmInterfaceManager) { boolean canReallocateMacs = false; if (snapshot.getVmConfiguration() != null) { VM tempVM = new VM(); if (vm.getDynamicData() != null) { tempVM.setDynamicData(vm.getDynamicData()); } ArrayList<VmNetworkInterface> interfaces = new ArrayList<>(); try { ovfManager.importVm(snapshot.getVmConfiguration(), tempVM, new ArrayList<>(), interfaces); } catch (OvfReaderException e) { log.error("Failed to import VM from the configuration '{}': {}", snapshot.getVmConfiguration(), e.getMessage()); log.debug("Exception", e); return false; } boolean macsInSnapshotAreExpectedToBeAlreadyAllocated = SnapshotType.STATELESS.equals(snapshot.getType()); canReallocateMacs = canSynchronizeNics(vm, vmInterfaceManager, interfaces, macsInSnapshotAreExpectedToBeAlreadyAllocated); } return canReallocateMacs; }

Target:
public boolean canRestoreVmConfigurationFromSnapshot(VM vm, Snapshot snapshot, VmInterfaceManager vmInterfaceManager) { if (snapshot.getVmConfiguration() == null) { return false; } VM tempVM = new VM(); if (vm.getDynamicData() != null) { tempVM.setDynamicData(vm.getDynamicData()); } List<VmNetworkInterface> interfaces = new ArrayList<>(); try { ovfManager.importVm(snapshot.getVmConfiguration(), tempVM, new ArrayList<>(), Collections.EMPTY_LIST, interfaces); } catch (OvfReaderException e) { log.error("Failed to import VM from the configuration '{}': {}", snapshot.getVmConfiguration(), e.getMessage()); log.debug("Exception", e); return false; } boolean macsInSnapshotAreExpectedToBeAlreadyAllocated = SnapshotType.STATELESS.equals(snapshot.getType()); return canSynchronizeNics(vm, vmInterfaceManager, interfaces, macsInSnapshotAreExpectedToBeAlreadyAllocated); }
Source:
public FunctionMetadata getFunctionMetadata(FunctionHandle functionHandle) { checkArgument(functionHandle.getCatalogSchemaName().equals(STATIC_FUNCTION_NAMESPACE_CATALOG_SCHEMA_NAME), "Expect static function namespace"); return staticFunctionNamespace.getFunctionMetadata((StaticFunctionHandle) functionHandle); }

Target:
public FunctionMetadata getFunctionMetadata(FunctionHandle functionHandle) { return staticFunctionNamespace.getFunctionMetadata(functionHandle); }
Source:
public TestUtils() { File testDir = getCustomTestDirectory(); if (testDir == null) { testDir = FS.DETECTED.userHome(); testDir = new File(testDir, "egit.test.tmpdir"); } rootDir = new File(testDir, "egitTest" + System.currentTimeMillis() + "-" + Integer.toHexString(System.identityHashCode(this))); }

Target:
public TestUtils() { baseTempDir = new File(rootDir, UUID.randomUUID().toString() .replace("-", "")); System.out.println(baseTempDir.getAbsolutePath()); }
Source:
private static String propertiesAsString(Properties properties) { StringBuilder props = new StringBuilder(); boolean separate = false; for(Object obj : properties.keySet()) { String value = properties.get(obj).toString(); String key = obj.toString(); value = value.replaceAll(";", "$0$0"); if(separate) { props.append(";"); } props.append(key + ">" + value); separate = true; } return props.toString(); }

Target:
private static String propertiesAsString(Properties properties) { Stream<Entry<Object, Object>> stream = properties.entrySet().stream(); String propAsString = stream.map(e -> encodeEntry(e)).collect(Collectors.joining("|")); return propAsString; }
Source:
default Option<T> onEmpty(Runnable action) { if (isEmpty()) { action.run(); } return this; }

Target:
default Option<T> onEmpty(Runnable action) { Objects.requireNonNull(action, "action is null"); if (isEmpty()) { action.run(); } return this; }
Source:
public void trackOnce(@NonNull Extra extra) { String firedKey = "downloaded:" + mName + ":" + mVersion; synchronized (TRACK_ONCE_LOCK) { if (!mPreferences.getBoolean(firedKey, false)) { mPreferences.edit().putBoolean(firedKey, true).apply(); trackNewAppDownload(extra); } } }

Target:
public void trackOnce(@NonNull Extra extra) { String firedKey = "downloaded:" + mPackageName + ":" + getVersion(); synchronized (TRACK_ONCE_LOCK) { if (!mPreferences.getBoolean(firedKey, false)) { mPreferences.edit().putBoolean(firedKey, true).apply(); trackNewAppDownload(extra); } } }
Source:
public static List<String> simplifyPorts(int[] ports){ if ((ports == null) || (ports.length == 0)) { return null; } ArrayList<String> output = new ArrayList<String>(); Arrays.sort(ports); int range_start = ports[0]; int range_end = ports[0]; for (int i = 1; i < ports.length; i++) { if ((ports[i - 1] == ports[i] - 1) || (ports[i - 1] == ports[i])){ range_end = ports[i]; } else { output.add(formatRange(range_start, range_end)); range_start = ports[i]; range_end = ports[i]; } } output.add(formatRange(range_start, range_end)); return output; }

Target:
public static List<String> simplifyPorts(int[] ports) { Preconditions.checkArgument(ports != null && ports.length != 0); ArrayList<String> output = new ArrayList<String>(); Arrays.sort(ports); int range_start = ports[0]; int range_end = ports[0]; for (int i = 1; i < ports.length; i++) { if ((ports[i - 1] == ports[i] - 1) || (ports[i - 1] == ports[i])){ range_end = ports[i]; } else { output.add(formatRange(range_start, range_end)); range_start = ports[i]; range_end = ports[i]; } } output.add(formatRange(range_start, range_end)); return output; }
Source:
public void showDialog(Project project) { this.project = project; view.setValueToAmendCheckBox(false); view.setValueToPushAfterCommitCheckBox(false); view.setEnableAmendCheckBox(true); view.setEnablePushAfterCommitCheckBox(true); view.setEnableRemoteBranchesDropDownLis(false); service .diff(project.getLocation(), null, NAME_STATUS, true, 0, "HEAD", false) .then( diff -> { service .log(project.getLocation(), null, -1, 1, false) .then( log -> { final Revision revision = getFirst(log.getCommits(), null); if (revision != null) { latestCommitMessage = revision.getMessage(); } if (diff.isEmpty()) { showAskForAmendDialog(); } else { show(diff); } }) .catchError( error -> { if (getErrorCode(error.getCause()) == ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED) { service .getStatus(project.getLocation(), emptyList()) .then( status -> { view.setEnableAmendCheckBox(false); view.setEnablePushAfterCommitCheckBox(false); List<String> newFiles = new ArrayList<>(); newFiles.addAll(status.getAdded()); newFiles.addAll(status.getUntracked()); show(newFiles.stream().collect(joining("\nA\t", "A\t", ""))); }); } else { view.setMessage(""); notificationManager.notify(constant.logFailed(), FAIL, NOT_EMERGE_MODE); } }); }) .catchError( arg -> { notificationManager.notify(constant.diffFailed(), FAIL, FLOAT_MODE); }); service .branchList(project.getLocation(), LIST_REMOTE) .then(view::setRemoteBranchesList) .catchError( error -> { notificationManager.notify(constant.branchesListFailed(), FAIL, FLOAT_MODE); }); }

Target:
public void showDialog(Project project) { this.project = project; view.setValueToAmendCheckBox(false); view.setValueToPushAfterCommitCheckBox(false); view.setEnableAmendCheckBox(true); view.setEnablePushAfterCommitCheckBox(true); view.setEnableRemoteBranchesDropDownLis(false); service .diff(project.getLocation(), null, NAME_STATUS, true, 0, "HEAD", false) .then( diff -> { service .log(project.getLocation(), null, -1, 1, false) .then( log -> { final Revision revision = getFirst(log.getCommits(), null); if (revision != null) { latestCommitMessage = revision.getMessage(); } if (diff.isEmpty()) { showAskForAmendDialog(); } else { show(diff); } }) .catchError( error -> { if (getErrorCode(error.getCause()) == ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED) { service .getStatus(project.getLocation(), emptyList()) .then( status -> { view.setEnableAmendCheckBox(false); view.setEnablePushAfterCommitCheckBox(false); List<String> newFiles = new ArrayList<>(); newFiles.addAll(status.getAdded()); newFiles.addAll(status.getUntracked()); show(newFiles.stream().collect(joining("\nA\t", "A\t", ""))); }); } else { notificationManager.notify(locale.logFailed(), FAIL, NOT_EMERGE_MODE); } }); }) .catchError( arg -> { notificationManager.notify(locale.diffFailed(), FAIL, FLOAT_MODE); }); service .branchList(project.getLocation(), LIST_REMOTE) .then(view::setRemoteBranchesList) .catchError( error -> { notificationManager.notify(locale.branchesListFailed(), FAIL, FLOAT_MODE); }); }
Source:
public SELF isNotEqualTo(ZonedDateTime expected) { Objects.instance().assertNotNull(info, actual); assertDateTimeParameterIsNotNull(expected); return super.isNotEqualTo(sameInstantInActualTimeZone(expected)); }

Target:
public SELF isNotEqualTo(ZonedDateTime expected) { return super.isNotEqualTo(sameInstantInActualTimeZone(expected)); }
Source:
protected void ExecuteVdsBrokerCommand() { GlusterVolumeAdvancedDetails volumeAdvancedDetails = new GlusterVolumeAdvancedDetails(); if (!getParameters().detailsRequired()) { executeVolumeStatusInfo(""); volumeAdvancedDetails = result.getVolumeAdvancedDetails(); } else { executeVolumeStatusInfo(""); if (getSucceeded()) { volumeAdvancedDetails = result.getVolumeAdvancedDetails(); executeVolumeStatusInfo(GlusterVolumeStatusOption.detail.name()); if (getSucceeded()) { volumeAdvancedDetails.copyDetailsFrom(result.getVolumeAdvancedDetails()); executeVolumeStatusInfo(GlusterVolumeStatusOption.clients.name()); if (getSucceeded()) { volumeAdvancedDetails.copyClientsFrom(result.getVolumeAdvancedDetails()); executeVolumeStatusInfo(GlusterVolumeStatusOption.mem.name()); if (getSucceeded()) { volumeAdvancedDetails.copyMemoryFrom(result.getVolumeAdvancedDetails()); } } } } } setReturnValue(volumeAdvancedDetails); }

Target:
protected void ExecuteVdsBrokerCommand() { GlusterVolumeAdvancedDetails volumeAdvancedDetails = new GlusterVolumeAdvancedDetails(); executeVolumeStatusInfo(""); volumeAdvancedDetails = result.getVolumeAdvancedDetails(); if (getParameters().detailsRequired()) { if (getSucceeded()) { executeVolumeStatusInfo(GlusterVolumeStatusOption.DETAIL.name().toLowerCase()); if (getSucceeded()) { volumeAdvancedDetails.copyDetailsFrom(result.getVolumeAdvancedDetails()); executeVolumeStatusInfo(GlusterVolumeStatusOption.CLIENTS.name().toLowerCase()); if (getSucceeded()) { volumeAdvancedDetails.copyClientsFrom(result.getVolumeAdvancedDetails()); executeVolumeStatusInfo(GlusterVolumeStatusOption.MEM.name().toLowerCase()); if (getSucceeded()) { volumeAdvancedDetails.copyMemoryFrom(result.getVolumeAdvancedDetails()); } } } } } setReturnValue(volumeAdvancedDetails); }
Source:
public IResource[] getActualResourcesToReorg() { Set<IJavaElement> javaElementSet= new HashSet<>(Arrays.asList(fJavaElements)); List<IResource> result= new ArrayList<>(); for (IResource fResource : fResources) { if (fResource == null) { continue; } IJavaElement element= JavaCore.create(fResource); if (element == null || !element.exists() || !javaElementSet.contains(element)) { if (!result.contains(fResource)) { result.add(fResource); } } } return result.toArray(new IResource[result.size()]); }

Target:
public IResource[] getActualResourcesToReorg() { Set<IJavaElement> javaElementSet= new HashSet<>(Arrays.asList(fJavaElements)); List<IResource> result= new ArrayList<>(); for (IResource resource : fResources) { if (resource == null) { continue; } IJavaElement element= JavaCore.create(resource); if (element == null || !element.exists() || !javaElementSet.contains(element)) { if (!result.contains(resource)) { result.add(resource); } } } return result.toArray(new IResource[result.size()]); }
Source:
public synchronized void run() { if (VOICE == "" || !isAvailableVoice(VOICE)) { LOG.log(Level.INFO, "Voice ''{0}'' not found. Using default voice ", VOICE); voice = defaultVoice; } else { voice = Voice.getVoice(VOICE); LOG.log(Level.INFO, "Voice set to ''{0}''", voice.getName()); } try { marytts.setVoice(voice.getName()); audio = marytts.generateAudio(message); AudioPlayer player = new AudioPlayer(audio); player.start(); player.join(); } catch (SynthesisException ex) { LOG.log(Level.SEVERE, "Error during audio generating for ''{0}''", ex.getLocalizedMessage()); } catch (InterruptedException ex) { LOG.log(Level.SEVERE, "Error during speaking for ''{0}''", ex.getLocalizedMessage()); } finally { try { audio.close(); } catch (IOException ex) { LOG.log(Level.SEVERE, "Error during audio closing for ''{0}''", ex.getLocalizedMessage()); } } }

Target:
public synchronized void run() { if (!isAvailableVoice(VOICE)) { LOG.log(Level.INFO, "Voice ''{0}'' not found. Using default voice ", VOICE); voice = defaultVoice; } else { voice = Voice.getVoice(VOICE); LOG.log(Level.INFO, "Voice set to ''{0}''", voice.getName()); } try { marytts.setVoice(voice.getName()); audio = marytts.generateAudio(message); AudioPlayer player = new AudioPlayer(audio); player.start(); player.join(); } catch (SynthesisException ex) { LOG.log(Level.SEVERE, "Error during audio generating for ''{0}''", ex); } catch (InterruptedException ex) { LOG.log(Level.SEVERE, "Error during speaking for ''{0}''", ex); } finally { try { audio.close(); } catch (IOException ex) { LOG.log(Level.SEVERE, "Error during audio closing for ''{0}''", ex); } } }
Source:
private StringBuilder getPrePostTag() { Preferences prefs = DocCommentOwnerManager.getInstance().getPreferences(getProject()); StringBuilder result = new StringBuilder(); if (prefs.getBoolean(DocCommentOwnerManager.DOXYGEN_USE_PRE_POST_TAGS, false)) { result.append(getPrefix()).append(PRE).append(getLineDelimiter()).append(getPrefix()).append(POST) .append(getLineDelimiter()); } return result; }

Target:
private StringBuilder getPrePostTag() { StringBuilder result = new StringBuilder(); if (usePrePostTag) { result.append(getPrefix()).append(PRE).append(getLineDelimiter()).append(getPrefix()).append(POST) .append(getLineDelimiter()); } return result; }
Source:
public static void main(String[] args) throws Exception { final List<String> unknown = new ArrayList<>(); final Namespace namespace = parseArgs(args, unknown); final Namespace extraArgs = parseUnknown(unknown); extraArgs.getAttrs().forEach((key, value) -> System.setProperty(key, value.toString())); Atomix atomix = buildAtomix(namespace); atomix.start().join(); LOGGER.info("Atomix listening at {}", atomix.getMembershipService().getLocalMember().address()); final ManagedRestService rest = buildRestService(atomix, namespace); rest.start().join(); LOGGER.warn("The Atomix HTTP API is BETA and is intended for development and debugging purposes only!"); LOGGER.info("HTTP server listening at {}", rest.address()); new AtomixBenchmark(buildAtomix(namespace)).start(); synchronized (Atomix.class) { while (atomix.isRunning()) { Atomix.class.wait(); } } }

Target:
public static void main(String[] args) throws Exception { final List<String> unknown = new ArrayList<>(); final Namespace namespace = parseArgs(args, unknown); final Namespace extraArgs = parseUnknown(unknown); extraArgs.getAttrs().forEach((key, value) -> System.setProperty(key, value.toString())); Atomix atomix = buildAtomix(namespace); atomix.start().join(); LOGGER.info("Atomix listening at {}", atomix.getMembershipService().getLocalMember().address()); final ManagedRestService rest = buildRestService(atomix, namespace); rest.start().join(); LOGGER.warn("The Atomix HTTP API is BETA and is intended for development and debugging purposes only!"); LOGGER.info("HTTP server listening at {}", rest.address()); new AtomixBenchmark(atomix).start(); synchronized (Atomix.class) { while (atomix.isRunning()) { Atomix.class.wait(); } } }
Source:
public RqWithoutHeader(final Request req, final CharSequence name) { super( new Request() { @Override public Iterable<String> head() throws IOException { final String prefix = String.format( "%s:", new EnglishLowerCase(name.toString()).string() ); return new Filtered<String>( (header) -> { return !new EnglishLowerCase(header).string() .startsWith(prefix); }, req.head() ); } @Override public InputStream body() throws IOException { return req.body(); } } ); }

Target:
public RqWithoutHeader(final Request req, final CharSequence name) { super( new Request() { @Override public Iterable<String> head() throws IOException { final String prefix = String.format( "%s:", new EnglishLowerCase(name.toString()).string() ); return new Filtered<String>( (header) -> !new EnglishLowerCase(header).string() .startsWith(prefix), req.head() ); } @Override public InputStream body() throws IOException { return req.body(); } } ); }
Source:
public synchronized void start() { if (!isRunning()) { running.set(true); worker = new Thread(this); worker.start(); } }

Target:
public synchronized void start() { if (!isRunning()) { running.set(true); task = scheduler.scheduleAtFixedRate(this, 0, CHECK_INTERVAL, TimeUnit.MILLISECONDS); } }
Source:
public void shouldRemoveExistingElements() { final Seq<Integer> seq = of(1, 2, 3); assertThat(seq.reject(i -> i == 1)).isEqualTo(of(2, 3)); assertThat(seq.reject(i -> i == 2)).isEqualTo(of(1, 3)); assertThat(seq.reject(i -> i == 3)).isEqualTo(of(1, 2)); assertThat(seq.reject(ignore -> true)).isEmpty(); assertThat(seq.reject(ignore -> false)).isEqualTo(of(1, 2, 3)).isNotSameAs(of(1, 2, 3)); }

Target:
public void shouldRemoveExistingElements() { final Seq<Integer> seq = of(1, 2, 3); assertThat(seq.removeAll(i -> i == 1)).isEqualTo(of(2, 3)); assertThat(seq.removeAll(i -> i == 2)).isEqualTo(of(1, 3)); assertThat(seq.removeAll(i -> i == 3)).isEqualTo(of(1, 2)); assertThat(seq.removeAll(ignore -> true)).isEmpty(); assertThat(seq.removeAll(ignore -> false)).isEqualTo(of(1, 2, 3)).isNotSameAs(of(1, 2, 3)); }
Source:
public PhraseTooLargeActionModule parse(QueryParseContext parseContext) throws IOException { PhraseTooLargeActionModule module = new PhraseTooLargeActionModule(); XContentParser parser = parseContext.parser(); String currentFieldName = null; XContentParser.Token token; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token.isValue()) { if ("max_terms_per_query".equals(currentFieldName) || "maxTermsPerQuery".equals(currentFieldName)) { module.maxTermsPerQuery(parser.intValue()); } else if ("max_terms_in_all_queries".equals(currentFieldName) || "maxTermsInAllQueries".equals(currentFieldName)) { module.maxTermsInAllQueries(parser.intValue()); } else if ("phrase_too_large_action".equals(currentFieldName) || "phraseTooLargeAction".equals(currentFieldName)) { module.phraseTooLargeAction(PhraseTooLargeAction.parse(parser.text())); } else { throw new QueryParsingException(parseContext.index(), "[safer][phrase] query does not support the field [" + currentFieldName + "]"); } } else { throw new QueryParsingException(parseContext.index(), "[safer][phrase] only supports values, not objects."); } } return module; }

Target:
public PhraseTooLargeActionModule parse(QueryParseContext parseContext) throws IOException { PhraseTooLargeActionModule module = new PhraseTooLargeActionModule(); XContentParser parser = parseContext.parser(); String currentFieldName = null; XContentParser.Token token; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token.isValue()) { switch (currentFieldName) { case "max_terms_per_query": case "maxTermsPerQuery": module.maxTermsPerQuery(parser.intValue()); break; case "max_terms_in_all_queries": case "maxTermsInAllQueries": module.maxTermsInAllQueries(parser.intValue()); break; case "phrase_too_large_action": case "phraseTooLargeAction": module.phraseTooLargeAction(PhraseTooLargeAction.parse(parser.text())); break; default: throw new QueryParsingException(parseContext.index(), "[safer][phrase] query does not support the field [" + currentFieldName + "]"); } } else { throw new QueryParsingException(parseContext.index(), "[safer][phrase] only supports values, not objects."); } } return module; }
Source:
public void setTradeOffers(final Career career, final int level, final List<TradeOfferGenerator> generators) throws IllegalArgumentException { checkNotNull(career, "career"); checkArgument(career instanceof SpongeCareer, "Unsupported Career: %s (%s)", career.getClass().getName()); final Profession profession = checkNotNull(career.getProfession(), "profession"); checkArgument(profession instanceof SpongeProfession, "Unsupported Profession: %s (%s)", profession.getName(), profession.getClass() .getName()); final SpongeCareer spongeCareer = (SpongeCareer) career; final SpongeProfession spongeProfession = (SpongeProfession) profession; final int careerType = spongeCareer.type; final int professionType = spongeProfession.type; checkArgument(careerType > 0, "CareerType cannot be zero or negative"); checkArgument(professionType > 0, "ProfessionType cannot be zero or negative"); checkArgument(level > 0, "Level cannot be zero or negative"); checkArgument(level <= 100, "Level cannot be bigger than 100"); checkNotNull(generators, "generators"); final ITradeList[][][][] defaultTrades = EntityVillager.DEFAULT_TRADE_LIST_MAP; if (defaultTrades == null || defaultTrades.length < professionType) { throw new IllegalStateException("Could not find valid entry in default trade offer generators"); } final ITradeList[][][] professionTrades = defaultTrades[professionType]; if (professionTrades == null || professionTrades.length < careerType) { throw new IllegalStateException("Could not find valid entry in profession trade offer generators " + profession.getName()); } final ITradeList[][] careerTrades = professionTrades[careerType - 1]; if (careerTrades == null) { throw new IllegalStateException("Could not find valid entry in trade offer generators"); } professionTrades[careerType - 1] = modify(careerTrades, level, generators, true); }

Target:
public void setTradeOffers(final Career career, final int level, final List<TradeOfferGenerator> generators) throws IllegalArgumentException { validateLevel(level); checkNotNull(generators, "generators"); final ITradeList[][][] professionTrades = getForProfession(career); final ITradeList[][] careerTrades = getFor(career, professionTrades); int careerType = ((SpongeCareer) career).type; professionTrades[careerType] = modify(careerTrades, level, generators, true); }
Source:
private boolean isPageType(Component component) { if (component == null) { return false; } else if (equalsAny(component.getResourceType(), pageTypes)) { return true; } else { return isPageType(component.getSuperComponent()); } }

Target:
private boolean isPageType(Component component) { if (component == null) { return false; } else if (ArrayUtils.contains(pageTypes, component.getResourceType())) { return true; } else { return isPageType(component.getSuperComponent()); } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DimFilterHavingSpec that = (DimFilterHavingSpec) o; return dimFilter != null ? dimFilter.equals(that.dimFilter) : that.dimFilter == null; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DimFilterHavingSpec that = (DimFilterHavingSpec) o; return dimFilter.equals(that.dimFilter); }
Source:
public List<Pipeline> getPipelines() { if(enablePaging) { int startIndex = ((this.getCurrentPage() - 1) * noOfPipelines); int retrieveSize = Math.min(pipelines.size() - ((this.getCurrentPage() - 1) * noOfPipelines), noOfPipelines); return pipelines.subList(startIndex, startIndex + retrieveSize); } return pipelines; }

Target:
public List<Pipeline> getPipelines() { if (pagingEnabled && !isFullScreenView()) { int startIndex = ((this.getCurrentPage() - 1) * noOfPipelines); int retrieveSize = Math.min(pipelines.size() - ((this.getCurrentPage() - 1) * noOfPipelines), noOfPipelines); return pipelines.subList(startIndex, startIndex + retrieveSize); } return pipelines; }
Source:
private void checkCancelled() throws IOException { if (pm.isCancelled()) { throw new IOException(JGitText.get().operationCanceled); } }

Target:
private void checkCancelled() throws CancelledException { if (pm.isCancelled()) { throw new CancelledException(JGitText.get().operationCanceled); } }
Source:
private static Publisher<CoreEvent> internalApplyWithChildContext(Publisher<CoreEvent> eventChildCtxPub, ReactiveProcessor processor, boolean completeParentIfEmpty) { return Flux.from(eventChildCtxPub) .compose(eventPub -> subscriberContext() .flatMapMany(ctx -> { if (ctx.getOrDefault(WITHIN_PROCESS_WITH_CHILD_CONTEXT, false)) { return eventPub.flatMap(event -> internalProcessWithChildContext(event, processor, completeParentIfEmpty)); } else { FluxSinkRecorder<Either<MessagingException, CoreEvent>> errorSwitchSinkSinkRef = new FluxSinkRecorder<>(); Set<BaseEventContext> seenContexts = newSetFromMap(new WeakHashMap<BaseEventContext, Boolean>()); AtomicInteger inflightEvents = new AtomicInteger(0); AtomicBoolean deferredCompletion = new AtomicBoolean(false); return Flux.from(eventChildCtxPub) .doOnNext(eventChildCtx -> { childContextResponseHandler(eventChildCtx, new FluxSinkRecorderToReactorSinkAdapter<>(errorSwitchSinkSinkRef), completeParentIfEmpty); inflightEvents.incrementAndGet(); }) .transform(processor) .doOnNext(completeSuccessIfNeeded()) .map(event -> right(MessagingException.class, event)) .doOnComplete(() -> { if (inflightEvents.get() == 0) { errorSwitchSinkSinkRef.complete(); } else { deferredCompletion.set(true); } }) .mergeWith(errorSwitchSinkSinkRef.flux()) .map(childContextResponseMapper()) .distinct(event -> (BaseEventContext) event.getContext(), () -> seenContexts) .map(eventChildCtx -> { if (inflightEvents.decrementAndGet() == 0 && deferredCompletion.compareAndSet(true, false)) { errorSwitchSinkSinkRef.complete(); } return toParentContext(eventChildCtx); }); } })); }

Target:
private static Publisher<CoreEvent> internalApplyWithChildContext(Publisher<CoreEvent> eventChildCtxPub, ReactiveProcessor processor, boolean completeParentIfEmpty) { return Flux.from(eventChildCtxPub) .compose(eventPub -> subscriberContext() .flatMapMany(ctx -> { if (ctx.getOrDefault(WITHIN_PROCESS_WITH_CHILD_CONTEXT, false)) { return eventPub.flatMap(event -> internalProcessWithChildContext(event, processor, completeParentIfEmpty)); } else { FluxSinkRecorder<Either<MessagingException, CoreEvent>> errorSwitchSinkSinkRef = new FluxSinkRecorder<>(); Flux<CoreEvent> upstream = Flux.from(eventChildCtxPub) .doOnNext(eventChildCtx -> childContextResponseHandler(eventChildCtx, new FluxSinkRecorderToReactorSinkAdapter<>(errorSwitchSinkSinkRef), completeParentIfEmpty)); return Flux.from(applyWaitingInflightEvents(upstream, errorSwitchSinkSinkRef.flux(), processor, pub -> Flux.from(pub) .doOnNext(completeSuccessIfNeeded()) .map(event -> right(MessagingException.class, event)), errorSwitchSinkSinkRef::complete, pub -> Flux.from(pub).map(childContextResponseMapper()), event -> (BaseEventContext) event.getContext())) .map(MessageProcessors::toParentContext); } })); }
Source:
private Pair<String,String[]> parse() { Pattern pattern = Pattern.compile( ":" + or( identifier(), qoutedIdentifier() ) + "\\(" + or( identifier(), qoutedIdentifier() ) + "(?:\\,\\s" + or( identifier(), qoutedIdentifier() ) + ")*\\)" ); Matcher matcher = pattern.matcher( specification ); if ( !matcher.find() ) { throw new IllegalArgumentException( "Cannot parse index specification " + specification ); } int group = 0; String label = either( matcher.group( ++group ), matcher.group( ++group ) ); ArrayList<String> properties = new ArrayList<>(); while ( group + 2 <= matcher.groupCount() ) { String property = either( matcher.group( ++group ), matcher.group( ++group ) ); if ( property != null ) { properties.add( property ); } } return Pair.of( label, properties.toArray( new String[0] ) ); }

Target:
private Pair<String,String[]> parse() { Pattern pattern = Pattern.compile( ":\\s*" + or( identifier(true), qoutedIdentifier(true) ) + "\\((" + or( identifier(false), qoutedIdentifier(false) ) + "(?:\\,\\s*" + or( identifier(false), qoutedIdentifier(false) ) + ")*)\\)" ); Matcher matcher = pattern.matcher( specification ); if ( !matcher.find() ) { throw new IllegalArgumentException( "Cannot parse index specification " + specification ); } String label = either( matcher.group( 1 ), matcher.group( 2 ) ); String propertyString = matcher.group( 3 ); String[] properties = propertyString.split(",\\s*(?=(?:[^`]*`[^`]*`)*[^`]*$)"); for ( int i = 0; i < properties.length ; i++ ) { properties[i] = properties[i].replaceAll( "(^`)|(`$)", "" ); } return Pair.of( label, properties ); }
Source:
public static Set<String> getCategoryURLs() { if (categoryUrls == null) { categoryUrls = new HashSet<String>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = registry .getExtensionPoint(PROJECT_EXAMPLES_CATEGORIES_EXTENSION_ID); IExtension[] extensions = extensionPoint.getExtensions(); for (int i = 0; i < extensions.length; i++) { IExtension extension = extensions[i]; IConfigurationElement[] configurationElements = extension .getConfigurationElements(); for (int j = 0; j < configurationElements.length; j++) { IConfigurationElement configurationElement = configurationElements[j]; if (URL_EXT.equals(configurationElement.getName())) { String urlString = configurationElement.getValue(); URL url = getURL(urlString); if (url != null) { categoryUrls.add(url.toString()); } } } } } return categoryUrls; }

Target:
public static Set<URL> getCategoryURLs() { if (categoryUrls == null) { categoryUrls = new HashSet<URL>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = registry .getExtensionPoint(PROJECT_EXAMPLES_CATEGORIES_EXTENSION_ID); IExtension[] extensions = extensionPoint.getExtensions(); for (int i = 0; i < extensions.length; i++) { IExtension extension = extensions[i]; IConfigurationElement[] configurationElements = extension .getConfigurationElements(); for (int j = 0; j < configurationElements.length; j++) { IConfigurationElement configurationElement = configurationElements[j]; if (URL_EXT.equals(configurationElement.getName())) { String urlString = configurationElement.getValue(); URL url = getURL(urlString); if (url != null) { categoryUrls.add(url); } } } } } return categoryUrls; }
Source:
public static Module kerberosHiveMetastoreAuthenticationModule() { return new Module() { @Override public void configure(Binder binder) { binder.bind(HiveMetastoreAuthentication.class) .to(KerberosHiveMetastoreAuthentication.class) .in(SINGLETON); configBinder(binder).bindConfig(MetastoreKerberosConfig.class); } @Inject @Provides @Singleton @ForHiveMetastore HadoopAuthentication createHadoopAuthentication(MetastoreKerberosConfig config, HdfsConfigurationInitializer updater) { String principal = config.getHiveMetastoreClientPrincipal(); String keytabLocation = config.getHiveMetastoreClientKeytab(); return createCachingKerberosHadoopAuthentication(principal, keytabLocation, updater); } }; }

Target:
public static Module kerberosHiveMetastoreAuthenticationModule() { return new Module() { @Override public void configure(Binder binder) { binder.bind(HiveMetastoreAuthentication.class) .to(KerberosHiveMetastoreAuthentication.class) .in(SINGLETON); configBinder(binder).bindConfig(MetastoreKerberosConfig.class); } @Inject @Provides @Singleton @ForHiveMetastore HadoopAuthentication createHadoopAuthentication(MetastoreKerberosConfig config, HdfsConfigurationInitializer initializer) { String principal = config.getHiveMetastoreClientPrincipal(); String keytabLocation = config.getHiveMetastoreClientKeytab(); return createCachingKerberosHadoopAuthentication(principal, keytabLocation, initializer); } }; }
Source:
public void commitInvoice(final UUID invoiceId, final CallContext context) throws InvoiceApiException { final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(context); dao.changeInvoiceStatus(invoiceId, InvoiceStatus.COMMITTED, internalCallContext); final Invoice invoice = this.getInvoice(invoiceId, context); final Long accountRecordId = internalCallContextFactory.getRecordIdFromObject(invoice.getAccountId(), ObjectType.ACCOUNT, context); final DefaultInvoiceCreationEvent defaultInvoiceCreationEvent = new DefaultInvoiceCreationEvent(invoice.getId(), invoice.getAccountId(), invoice.getBalance(), invoice.getCurrency(), accountRecordId, internalCallContext.getTenantRecordId(), context.getUserToken()); postEvent(defaultInvoiceCreationEvent, invoice.getAccountId(), internalCallContext); }

Target:
public void commitInvoice(final UUID invoiceId, final CallContext context) throws InvoiceApiException { final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(invoiceId, ObjectType.INVOICE, context); dao.changeInvoiceStatus(invoiceId, InvoiceStatus.COMMITTED, internalCallContext); }
Source:
private void getKnownAddressesInRange(CorfuPayloadMsg<KnownAddressRequest> msg, ChannelHandlerContext ctx, IServerRouter r) { Lock lock = resetLock.readLock(); lock.lock(); try { KnownAddressRequest request = msg.getPayload(); try { Set<Long> knownAddresses = streamLog .getKnownAddressesInRange(request.getStartRange(), request.getEndRange()); r.sendResponse(ctx, msg, CorfuMsgType.KNOWN_ADDRESS_RESPONSE.payloadMsg(knownAddresses)); } catch (DataCorruptionException dc) { r.sendResponse(ctx, msg, CorfuMsgType.ERROR_DATA_CORRUPTION .payloadMsg(Address.NON_ADDRESS)); } catch (Exception e) { handleException(e, ctx, msg, r); } } finally { lock.unlock(); } }

Target:
private void getKnownAddressesInRange(CorfuPayloadMsg<KnownAddressRequest> msg, ChannelHandlerContext ctx, IServerRouter r) { KnownAddressRequest request = msg.getPayload(); try { Set<Long> knownAddresses = streamLog .getKnownAddressesInRange(request.getStartRange(), request.getEndRange()); r.sendResponse(ctx, msg, CorfuMsgType.KNOWN_ADDRESS_RESPONSE.payloadMsg(knownAddresses)); } catch (DataCorruptionException dc) { r.sendResponse(ctx, msg, CorfuMsgType.ERROR_DATA_CORRUPTION .payloadMsg(Address.NON_ADDRESS)); } catch (Exception e) { handleException(e, ctx, msg, r); } }
Source:
public static IHistoryView showHistoryFor(IWorkbenchPage page, Object input, IHistoryPageSource pageSource) { try { IHistoryView view = (IHistoryView) page.findView(IHistoryView.VIEW_ID); if (view == null) { page.showView(IHistoryView.VIEW_ID); view = (IHistoryView) TeamUIPlugin.getActivePage().findView(IHistoryView.VIEW_ID); if(view != null ) { return showInputInView(page, input, view, pageSource); } } else { view = ((GenericHistoryView)view).findAppropriateHistoryViewFor(input, pageSource); if (view == null) { view = (IHistoryView) page.showView(IHistoryView.VIEW_ID, IHistoryView.VIEW_ID + System.currentTimeMillis(), IWorkbenchPage.VIEW_CREATE); return showInputInView(page, input, view, pageSource); } else { return showInputInView(page, input, view, pageSource); } } } catch (PartInitException e) { } return null; }

Target:
public static IHistoryView showHistoryFor(IWorkbenchPage page, Object input, IHistoryPageSource pageSource) { try { IHistoryView view = (IHistoryView) page.findView(IHistoryView.VIEW_ID); if (view == null) { page.showView(IHistoryView.VIEW_ID); view = (IHistoryView) TeamUIPlugin.getActivePage().findView(IHistoryView.VIEW_ID); if(view != null) { return showInputInView(page, input, view, pageSource); } } view = ((GenericHistoryView)view).findAppropriateHistoryViewFor(input, pageSource); if (view == null) { view = (IHistoryView) page.showView(IHistoryView.VIEW_ID, IHistoryView.VIEW_ID + System.currentTimeMillis(), IWorkbenchPage.VIEW_CREATE); return showInputInView(page, input, view, pageSource); } else { return showInputInView(page, input, view, pageSource); } } catch (PartInitException e) { } return null; }
Source:
public void addListener(Channel channel) { if (channel instanceof PublisherCallbackChannel) { PublisherCallbackChannel publisherCallbackChannel = (PublisherCallbackChannel) channel; Channel key = channel instanceof ChannelProxy ? ((ChannelProxy) channel).getTargetChannel() : channel; if (this.publisherConfirmChannels.putIfAbsent(key, this) == null) { publisherCallbackChannel.addListener(this); if (logger.isDebugEnabled()) { logger.debug("Added confirmable channel: " + channel + " to map, size now " + this.publisherConfirmChannels.size()); } } } else { throw new IllegalStateException( "Channel does not support confirms or returns; " + "is the connection factory configured for confirms or returns?"); } }

Target:
public void addListener(Channel channel) { if (channel instanceof PublisherCallbackChannel) { PublisherCallbackChannel publisherCallbackChannel = (PublisherCallbackChannel) channel; Channel key = channel instanceof ChannelProxy ? ((ChannelProxy) channel).getTargetChannel() : channel; if (this.publisherConfirmChannels.putIfAbsent(key, this) == null) { publisherCallbackChannel.addListener(this); if (logger.isDebugEnabled()) { logger.debug("Added publisher confirm channel: " + channel + " to map, size now " + this.publisherConfirmChannels.size()); } } } else { throw new IllegalStateException( "Channel does not support confirms or returns; " + "is the connection factory configured for confirms or returns?"); } }
Source:
public EntityListSubscreen(Detail shortDetail, Vector<TreeReference> references, EvaluationContext context) throws CommCareSessionException { mHeader = createHeader(shortDetail, context); this.shortDetail = shortDetail; this.rootContext = context; rows = new String[references.size()]; reducingTraceReporter = new ReducingTraceReporter(); int i = 0; for (TreeReference entity : references) { rows[i] = createRow(entity); ++i; } ScreenUtils.printAndClearTraces(reducingTraceReporter, "Case Screen"); this.mChoices = new TreeReference[references.size()]; references.copyInto(mChoices); actions = shortDetail.getCustomActions(context); }

Target:
public EntityListSubscreen(Detail shortDetail, Vector<TreeReference> references, EvaluationContext context) throws CommCareSessionException { mHeader = createHeader(shortDetail, context); this.shortDetail = shortDetail; this.rootContext = context; rows = new String[references.size()]; int i = 0; for (TreeReference entity : references) { rows[i] = createRow(entity); ++i; } this.mChoices = new TreeReference[references.size()]; references.copyInto(mChoices); actions = shortDetail.getCustomActions(context); }
Source:
private Set<AccountGroup.Id> getIncludedGroups(Set<AccountGroup.Id> seedGroups) { Set<AccountGroup.Id> includedGroups = new HashSet<AccountGroup.Id> (seedGroups); Queue<AccountGroup.Id> groupQueue = new LinkedList<AccountGroup.Id> (seedGroups); while(groupQueue.size() > 0) { AccountGroup.Id id = groupQueue.remove(); try { for (final AccountGroupIncludedGroup i : dbProvider.get().accountGroupIncludedGroups().byIncludedGroup(id)) { AccountGroup.Id groupId = i.getGroupId(); if(!includedGroups.contains(groupId)) { includedGroups.add(groupId); groupQueue.add(groupId); } } } catch (OrmException e) { log.warn("Cannot query included groups", e); } } return includedGroups; }

Target:
private Set<AccountGroup.Id> getIncludedGroups(Set<AccountGroup.Id> seedGroups) { Set<AccountGroup.Id> includedGroups = new HashSet<AccountGroup.Id> (seedGroups); Queue<AccountGroup.Id> groupQueue = new LinkedList<AccountGroup.Id> (seedGroups); while (groupQueue.size() > 0) { AccountGroup.Id id = groupQueue.remove(); for (final AccountGroup.Id groupId : includedGroupCache.getByIncludedGroup(id)) { if (!includedGroups.contains(groupId)) { includedGroups.add(groupId); groupQueue.add(groupId); } } } return includedGroups; }
Source:
public Mono<Response<BlockBlobItem>> stageBlock(String base64BlockID, Flux<ByteBuf> data, long length, LeaseAccessConditions leaseAccessConditions) { return blockBlobAsyncRawClient .stageBlock(base64BlockID, data, length, leaseAccessConditions) .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders()))); }

Target:
public Mono<VoidResponse> stageBlock(String base64BlockID, Flux<ByteBuf> data, long length, LeaseAccessConditions leaseAccessConditions) { return blockBlobAsyncRawClient .stageBlock(base64BlockID, data, length, leaseAccessConditions) .map(VoidResponse::new); }
Source:
public SqlTaskExecution create(Session session, QueryContext queryContext, TaskStateMachine taskStateMachine, OutputBuffer outputBuffer, PlanFragment fragment, List<TaskSource> sources) { boolean verboseStats = getVerboseStats(session); TaskContext taskContext = queryContext.addTaskContext( taskStateMachine, session, verboseStats, cpuTimerEnabled); LocalExecutionPlan localExecutionPlan; try (SetThreadName ignored = new SetThreadName("Task-%s", taskStateMachine.getTaskId())) { try { localExecutionPlan = planner.plan( taskContext, fragment.getRoot(), fragment.getSymbols(), fragment.getPartitioningScheme(), fragment.getPartitionedSources(), outputBuffer); } catch (Throwable e) { taskStateMachine.failed(e); throw Throwables.propagate(e); } } return createSqlTaskExecution( taskStateMachine, taskContext, outputBuffer, sources, localExecutionPlan, taskExecutor, taskNotificationExecutor, queryMonitor); }

Target:
public SqlTaskExecution create(Session session, QueryContext queryContext, TaskStateMachine taskStateMachine, OutputBuffer outputBuffer, PlanFragment fragment, List<TaskSource> sources) { boolean verboseStats = getVerboseStats(session); TaskContext taskContext = queryContext.addTaskContext( taskStateMachine, session, verboseStats, cpuTimerEnabled); LocalExecutionPlan localExecutionPlan; try (SetThreadName ignored = new SetThreadName("Task-%s", taskStateMachine.getTaskId())) { try { localExecutionPlan = planner.plan( taskContext, fragment.getRoot(), fragment.getSymbols(), fragment.getPartitioningScheme(), fragment.getPipelineExecutionStrategy() == GROUPED_EXECUTION, fragment.getPartitionedSources(), outputBuffer); for (DriverFactory driverFactory : localExecutionPlan.getDriverFactories()) { Optional<PlanNodeId> sourceId = driverFactory.getSourceId(); if (sourceId.isPresent() && fragment.isPartitionedSources(sourceId.get())) { checkArgument(fragment.getPipelineExecutionStrategy() == driverFactory.getPipelineExecutionStrategy(), "Partitioned pipelines are expected to have the same execution strategy as the fragment"); } else { checkArgument(fragment.getPipelineExecutionStrategy() != UNGROUPED_EXECUTION || driverFactory.getPipelineExecutionStrategy() == UNGROUPED_EXECUTION, "When fragment execution strategy is ungrouped, all pipelines should have ungrouped execution strategy"); } } } catch (Throwable e) { taskStateMachine.failed(e); throwIfUnchecked(e); throw new RuntimeException(e); } } return createSqlTaskExecution( taskStateMachine, taskContext, outputBuffer, sources, localExecutionPlan, taskExecutor, taskNotificationExecutor, queryMonitor); }