auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean canRestoreVmConfigurationFromSnapshot(VM vm, Snapshot snapshot, VmInterfaceManager vmInterfaceManager) { boolean canReallocateMacs = false; <START> if (snapshot.getVmConfiguration() != null) { <END> 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; }</code><technical_language>'fail' fast. negate condition: if (... == null) { return false; } easier for a reader -> this condition is invalid, out of this method. I need read rest of method if met, fiddles canReallocateMacs variable(which can!). if this condition is met, I sure, method</technical_language>

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:
<code>public FunctionMetadata getFunctionMetadata(FunctionHandle functionHandle) { <START> checkArgument(functionHandle.getCatalogSchemaName().equals(STATIC_FUNCTION_NAMESPACE_CATALOG_SCHEMA_NAME), "Expect static function namespace"); <END> return staticFunctionNamespace.getFunctionMetadata((StaticFunctionHandle) functionHandle); }</code><technical_language>a static helper function isStaticFunctionNamespace(functionHandle); also, functionHandle instanceof StaticFunctionHandle</technical_language>

Target:
public FunctionMetadata getFunctionMetadata(FunctionHandle functionHandle) { return staticFunctionNamespace.getFunctionMetadata(functionHandle); }
Source:
<code>public TestUtils() { File testDir = getCustomTestDirectory(); if (testDir == null) { testDir = FS.DETECTED.userHome(); testDir = new File(testDir, "egit.test.tmpdir"); } <START> rootDir = new File(testDir, "egitTest" + System.currentTimeMillis() <END> + "-" + Integer.toHexString(System.identityHashCode(this))); }</code><technical_language>start java.rmi.server.UID instead</technical_language>

Target:
public TestUtils() { baseTempDir = new File(rootDir, UUID.randomUUID().toString() .replace("-", "")); System.out.println(baseTempDir.getAbsolutePath()); }
Source:
<code><START> private static String propertiesAsString(Properties properties) { <END> 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(); }</code><technical_language>encoding/decoding more robust (using | entry separator, > key/value separator: 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; } private static Properties stringAsProperties(String properties) { Properties p = new Properties(); String[] entries = properties.split("\\|"); Stream.of(entries).forEach(e -> convert(e, p)); return p; } private static void convert(String e, Properties p) { String[] kv = e.split(">"); String key; String = null; if (kv.length == 0) { key = e; } else { key = kv[0]; } if (kv.length > 1) { = kv[1]; } p.put(urlDecode(key), urlDecode(value)); } private static String encodeEntry(Entry<Object, Object> e) { String key = e.getKey().toString(); String = e.getValue() == null?"":e.getValue().toString(); return urlEncode(key)+">"+urlEncode(value); } private static String urlEncode(String string) { if (string == null) { return ""; } try { return URLEncoder.encode(string, "UTF-8"); } catch (UnsupportedEncodingException notGonnaHappen) { } return string; } private static String urlDecode(String string) { if (string == null) { return ""; } try { return URLDecoder.decode(string, "UTF-8"); } catch (UnsupportedEncodingException notGonnaHappen) { } return string; }</technical_language>

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:
<code><START> default Option<T> onEmpty(Runnable action) { <END> if (isEmpty()) { action.run(); } return this; }</code><technical_language>Please add a null-check, do convention for readability of stack traces: java Objects.requireNonNull(action, "action is null");</technical_language>

Target:
default Option<T> onEmpty(Runnable action) { Objects.requireNonNull(action, "action is null"); if (isEmpty()) { action.run(); } return this; }
Source:
<code>public void trackOnce(@NonNull Extra extra) { <START> String firedKey = "downloaded:" + mName + ":" + mVersion; <END> synchronized (TRACK_ONCE_LOCK) { if (!mPreferences.getBoolean(firedKey, false)) { mPreferences.edit().putBoolean(firedKey, true).apply(); trackNewAppDownload(extra); } } }</code><technical_language>idea is getVersion() out code instead of mVersion, loads a manually set version pulls context</technical_language>

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:
<code>public static List<String> simplifyPorts(int[] ports){ if ((ports == null) || (ports.length == 0)) { <START> return null; <END> } 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; }</code><technical_language>This happen this point, is validated before. Consider a precondition of this method throw IllegalArgumentException. add a check in caller verify returned is null, avoid NPEs</technical_language>

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:
<code>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 { <START> view.setMessage(""); <END> 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); }); }</code><technical_language>I guess necessary</technical_language>

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:
<code>public SELF isNotEqualTo(ZonedDateTime expected) { <START> Objects.instance().assertNotNull(info, actual); <END> assertDateTimeParameterIsNotNull(expected); return super.isNotEqualTo(sameInstantInActualTimeZone(expected)); }</code><technical_language>This consistent AbstractAssert.isNotEqualTo, if actual is null expected is not, assertion succeed vice versa</technical_language>

Target:
public SELF isNotEqualTo(ZonedDateTime expected) { return super.isNotEqualTo(sameInstantInActualTimeZone(expected)); }
Source:
<code>protected void ExecuteVdsBrokerCommand() { <START> GlusterVolumeAdvancedDetails volumeAdvancedDetails = new GlusterVolumeAdvancedDetails(); <END> 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); }</code><technical_language>executeVolumeStatusInfo(""); is executed for condition result, pulled of prior if-statement if-else blocks</technical_language>

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:
<code>public IResource[] getActualResourcesToReorg() { Set<IJavaElement> javaElementSet= new HashSet<>(Arrays.asList(fJavaElements)); List<IResource> result= new ArrayList<>(); for (IResource <START> fResource : <END> 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()]); }</code><technical_language>rename resource</technical_language>

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:
<code>public synchronized void run() { <START> if (VOICE == "" || !isAvailableVoice(VOICE)) { <END> 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()); } } }</code><technical_language>isEmpty() instead. remove check for empty add isVoiceAvailable() more sense. A voice is if unspecified</technical_language>

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:
<code>private StringBuilder getPrePostTag() { <START> Preferences prefs = DocCommentOwnerManager.getInstance().getPreferences(getProject()); <END> 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; }</code><technical_language>cached field is for some reason</technical_language>

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:
<code>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(); <START> LOGGER.warn("The Atomix HTTP API is BETA and is intended for development and debugging purposes only!"); <END> LOGGER.info("HTTP server listening at {}", rest.address()); new AtomixBenchmark(buildAtomix(namespace)).start(); synchronized (Atomix.class) { while (atomix.isRunning()) { Atomix.class.wait(); } } }</code><technical_language>in benchmark</technical_language>

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:
<code>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>( <START> (header) -> { <END> return !new EnglishLowerCase(header).string() .startsWith(prefix); }, req.head() ); } @Override public InputStream body() throws IOException { return req.body(); } } ); }</code><technical_language>@paulodamaso braces return needed</technical_language>

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:
<code>public synchronized void start() { if (!isRunning()) { running.set(true); <START> worker = new Thread(this); <END> worker.start(); } }</code><technical_language>is jenkins.util.Timer.get() for sorts of things, debating if handle a second... I think</technical_language>

Target:
public synchronized void start() { if (!isRunning()) { running.set(true); task = scheduler.scheduleAtFixedRate(this, 0, CHECK_INTERVAL, TimeUnit.MILLISECONDS); } }
Source:
<code>public void shouldRemoveExistingElements() { final Seq<Integer> seq = of(1, 2, 3); <START> assertThat(seq.reject(i -> i == 1)).isEqualTo(of(2, 3)); <END> 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)); }</code><technical_language>If test call method reject test method include word reject include remove</technical_language>

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:
<code>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()) { <START> if ("max_terms_per_query".equals(currentFieldName) || "maxTermsPerQuery".equals(currentFieldName)) { <END> 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; }</code><technical_language>FYI, this if block replaced switch statement for Java 7</technical_language>

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:
<code>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; <START> checkArgument(careerType > 0, "CareerType cannot be zero or negative"); <END> 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); }</code><technical_language>in a method</technical_language>

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:
<code>private boolean isPageType(Component component) { if (component == null) { return false; <START> } else if (equalsAny(component.getResourceType(), pageTypes)) { <END> return true; } else { return isPageType(component.getSuperComponent()); } }</code><technical_language>ArrayUtils.contains(pageTypes, component.getResourceType())</technical_language>

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:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DimFilterHavingSpec that = (DimFilterHavingSpec) o; <START> return dimFilter != null ? dimFilter.equals(that.dimFilter) : that.dimFilter == null; <END> }</code><technical_language>dimFilter is non-null, simplified want stick "as IntelliJ generated" form</technical_language>

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:
<code>public List<Pipeline> getPipelines() { <START> if(enablePaging) { <END> 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; }</code><technical_language>Inconsistent formatting - missing a space if (. In multiple places</technical_language>

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:
<code>private void checkCancelled() throws IOException { if (pm.isCancelled()) { throw new <START> IOException(JGitText.get().operationCanceled); <END> } }</code><technical_language>related this change this spelled "Cancelled" consistent method "isCancelled" of ProgressMonitor</technical_language>

Target:
private void checkCancelled() throws CancelledException { if (pm.isCancelled()) { throw new CancelledException(JGitText.get().operationCanceled); } }
Source:
<code>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 -> { <START> if (inflightEvents.decrementAndGet() == 0 && deferredCompletion.compareAndSet(true, false)) { <END> errorSwitchSinkSinkRef.complete(); } return toParentContext(eventChildCtx); }); } })); }</code><technical_language>do this in a doOnNext in this map</technical_language>

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:
<code>private Pair<String,String[]> parse() { Pattern pattern = Pattern.compile( ":" + or( identifier(), qoutedIdentifier() ) + "\\(" + or( identifier(), qoutedIdentifier() ) + <START> "(?:\\,\\s" + or( identifier(), qoutedIdentifier() ) + ")*\\)" END> ); 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] ) ); }</code><technical_language>a want a * \\s for a more flexible syntax. legacy open Cypher specification, space is allowed : label identifier creating indexes, index lookups START clause</technical_language>

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:
<code><START> public static Set<String> getCategoryURLs() { <END> 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; }</code><technical_language>class compile anymore of change (see Line #561)</technical_language>

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:
<code>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 <START> HadoopAuthentication createHadoopAuthentication(MetastoreKerberosConfig config, HdfsConfigurationInitializer updater) <END> { String principal = config.getHiveMetastoreClientPrincipal(); String keytabLocation = config.getHiveMetastoreClientKeytab(); return createCachingKerberosHadoopAuthentication(principal, keytabLocation, updater); } }; }</code><technical_language>nit: variables renamed updater initializer</technical_language>

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:
<code>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()); <START> postEvent(defaultInvoiceCreationEvent, invoice.getAccountId(), internalCallContext); <END> }</code><technical_language>This needs happen in transaction (inside dao.changeInvoiceStatus)</technical_language>

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:
<code>private void getKnownAddressesInRange(CorfuPayloadMsg<KnownAddressRequest> msg, ChannelHandlerContext ctx, IServerRouter r) { Lock lock = resetLock.readLock(); lock.lock(); try { <START> KnownAddressRequest request = msg.getPayload(); try { <END> 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(); } }</code><technical_language>Epoch check lock.lock()</technical_language>

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:
<code>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 != <START> null <END> ) { 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; }</code><technical_language>space</technical_language>

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:
<code>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()) { <START> logger.debug("Added confirmable channel: " + channel + " to map, size now " <END> + this.publisherConfirmChannels.size()); } } } else { throw new IllegalStateException( "Channel does not support confirms or returns; " + "is the connection factory configured for confirms or returns?"); } }</code><technical_language>I this confirmable word :smile: publisher-confirm better? is PublisherCallbackChannelImpl.toString() represents it..</technical_language>

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:
<code>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; } <START> ScreenUtils.printAndClearTraces(reducingTraceReporter, "Case Screen"); <END> this.mChoices = new TreeReference[references.size()]; references.copyInto(mChoices); actions = shortDetail.getCustomActions(context); }</code><technical_language>This potentially a debug statement out</technical_language>

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:
<code>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); <START> while(groupQueue.size() > 0) { <END> 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; }</code><technical_language>Style-nit: Space while (</technical_language>

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:
<code><START> public Mono<Response<BlockBlobItem>> stageBlock(String base64BlockID, Flux<ByteBuf> data, long length, <END> LeaseAccessConditions leaseAccessConditions) { return blockBlobAsyncRawClient .stageBlock(base64BlockID, data, length, leaseAccessConditions) .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders()))); }</code><technical_language>This wrong class return. if this is a custom class wrote, contains response fields for append block for append blobs. actual response of put block for a block blob returns MD5, request ID, service version, Date, a boolean for success of optional server-side encryption. of generic/situational enough headers I warrant VoidResponse get specific headers if need be</technical_language>

Target:
public Mono<VoidResponse> stageBlock(String base64BlockID, Flux<ByteBuf> data, long length, LeaseAccessConditions leaseAccessConditions) { return blockBlobAsyncRawClient .stageBlock(base64BlockID, data, length, leaseAccessConditions) .map(VoidResponse::new); }