auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static ValueStringFixed get(String s, int precision, Mode mode) { if (mode != null && mode.padFixedStrings && precision < Integer.MAX_VALUE) { s = rightPadWithSpaces(s, precision); } else if (precision != PRECISION_DO_NOT_TRIM) { s = trimRight(s); } if (s.length() == 0) { return EMPTY; } ValueStringFixed obj = new ValueStringFixed(StringUtils.cache(s)); if (s.length() > SysProperties.OBJECT_CACHE_MAX_PER_ELEMENT_SIZE) { return obj; } return (ValueStringFixed) Value.cache(obj); }

Target:
public static ValueStringFixed get(String s, int precision, Mode mode) { if (mode != null && mode.padFixedLengthStrings) { if (precision == Integer.MAX_VALUE) { precision = 1; } if (s.length() < precision) { s = rightPadWithSpaces(s, precision); } else { s = trimRight(s, precision); } } else if (precision != PRECISION_DO_NOT_TRIM) { s = trimRight(s); } if (s.length() == 0) { return EMPTY; } ValueStringFixed obj = new ValueStringFixed(StringUtils.cache(s)); if (s.length() > SysProperties.OBJECT_CACHE_MAX_PER_ELEMENT_SIZE) { return obj; } return (ValueStringFixed) Value.cache(obj); }
Source:
public Builder keyMarker(String keyMarker) { operations.add(args -> args.keyMarker = keyMarker); return this; }

Target:
public Builder keyMarker(String keyMarker) { validateNullOrNotEmptyString(keyMarker, "keyMarker"); operations.add(args -> args.keyMarker = keyMarker); return this; }
Source:
public void shouldThrowExceptionWhenPassingMoreArgsThanMethodSupports() throws Throwable { String a = "test"; int b = 3; String c = "anotherTest"; try { invoke(handler.get(new DefaultBeanClass(TestController.class)), "anotherMethod", a, b, c); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), startsWith("wrong number of arguments")); } }

Target:
public void shouldThrowExceptionWhenPassingMoreArgsThanMethodSupports() throws Throwable { String a = "test"; int b = 3; String c = "anotherTest"; try { invoke(handler.get(new DefaultBeanClass(TestController.class)), "anotherMethod", a, b, c); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage().toLowerCase(), startsWith("wrong number of arguments")); } }
Source:
BlockOutputStreamEntry allocateBlockIfNeeded() throws IOException { int succeededAllocates = 0; BlockOutputStreamEntry streamEntry = getCurrentStreamEntry(); if (streamEntry != null && streamEntry.isClosed()) { if (streamEntry.getCurrentPosition() == 0) { streamEntries.remove(currentStreamIndex); } else { currentStreamIndex++; } } if (streamEntries.size() <= currentStreamIndex) { Preconditions.checkNotNull(omClient); try { allocateNewBlock(); succeededAllocates += 1; } catch (IOException ioe) { LOG.error("Try to allocate more blocks for write failed, already " + "allocated " + succeededAllocates + " blocks for this write."); throw ioe; } } Preconditions.checkArgument(currentStreamIndex < streamEntries.size()); BlockOutputStreamEntry current = streamEntries.get(currentStreamIndex); return current; }

Target:
BlockOutputStreamEntry allocateBlockIfNeeded() throws IOException { BlockOutputStreamEntry streamEntry = getCurrentStreamEntry(); if (streamEntry != null && streamEntry.isClosed()) { currentStreamIndex++; } if (streamEntries.size() <= currentStreamIndex) { Preconditions.checkNotNull(omClient); int succeededAllocates = 0; try { allocateNewBlock(); succeededAllocates += 1; } catch (IOException ioe) { LOG.error("Try to allocate more blocks for write failed, already " + "allocated " + succeededAllocates + " blocks for this write."); throw ioe; } } Preconditions.checkArgument(currentStreamIndex < streamEntries.size()); BlockOutputStreamEntry current = streamEntries.get(currentStreamIndex); return current; }
Source:
protected void populateComboBox() { String projName = null; try { ILaunchConfiguration launchConfiguration = LaunchHelper.findHibernateLaunchConfig(this.consoleConfigName); projName = launchConfiguration.getAttribute(IConsoleConfigurationLaunchConstants.PROJECT_NAME, ""); } catch (CoreException e) { HibernateSearchConsolePlugin.getDefault().log(e); } IJavaProject project = ProjectUtils.findJavaProject(projName); final IType analyzersType = ProjectUtils.findType(project, "org.apache.lucene.analysis.Analyzer"); comboControl.getDisplay().syncExec(new Runnable() { public void run() { try { IType[] types = analyzersType.newTypeHierarchy(new NullProgressMonitor()).getAllSubtypes(analyzersType); List<String> typesList = new LinkedList<String>(); for (IType type : types) { try { if (type.getMethod(type.getElementName(), new String[0]).isConstructor()) { typesList.add(type.getFullyQualifiedName()); continue; } } catch (JavaModelException e) { } try { if (type.getMethod(type.getElementName(), new String[] {"Lorg.apache.lucene.util.Version;"}).isConstructor()) { typesList.add(type.getFullyQualifiedName()); continue; } } catch (JavaModelException e) { } } comboControl.setItems(typesList.toArray(new String[0])); comboControl.setText(DEFAULT_ANALYZER); } catch (JavaModelException e) { HibernateConsolePlugin.getDefault().log(e); } } }); }

Target:
protected void populateComboBox() { String projName = null; try { ILaunchConfiguration launchConfiguration = LaunchHelper.findHibernateLaunchConfig(this.consoleConfigName); projName = launchConfiguration.getAttribute(IConsoleConfigurationLaunchConstants.PROJECT_NAME, ""); } catch (CoreException e) { HibernateSearchConsolePlugin.getDefault().logError(e); } IJavaProject project = ProjectUtils.findJavaProject(projName); final IType analyzersType = ProjectUtils.findType(project, "org.apache.lucene.analysis.Analyzer"); comboControl.getDisplay().syncExec(new Runnable() { public void run() { try { IType[] types = analyzersType.newTypeHierarchy(new NullProgressMonitor()).getAllSubtypes(analyzersType); List<String> typesList = new LinkedList<String>(); for (IType type : types) { try { if (type.getMethod(type.getElementName(), new String[0]).isConstructor()) { typesList.add(type.getFullyQualifiedName()); continue; } } catch (JavaModelException e) { HibernateSearchConsolePlugin.getDefault().logInfo( "Analuzer " + type.getFullyQualifiedName() + " doesn't have constrcutor with no parameters", e); } try { if (type.getMethod(type.getElementName(), new String[] {"Lorg.apache.lucene.util.Version;"}).isConstructor()) { typesList.add(type.getFullyQualifiedName()); continue; } } catch (JavaModelException e) { HibernateSearchConsolePlugin.getDefault().logWarning( "Analuzer " + type.getFullyQualifiedName() + " doesn't have constrcutor with Version as a parameter", e); } } comboControl.setItems(typesList.toArray(new String[0])); comboControl.setText(DEFAULT_ANALYZER); } catch (JavaModelException e) { HibernateConsolePlugin.getDefault().log(e); } } }); }
Source:
public final synchronized void removeMediaSourceRange( int fromIndex, int toIndex, @Nullable Runnable actionOnCompletion) { if (fromIndex < 0 || fromIndex >= mediaSourcesPublic.size()) { throw new IndexOutOfBoundsException(String.format("Cannot remove source range: initial index (%d) out of bounds", fromIndex)); } if (toIndex < 0 || toIndex > mediaSourcesPublic.size()) { throw new IndexOutOfBoundsException(String.format("Cannot remove source range: final index (%d) out of bounds", toIndex)); } if (fromIndex > toIndex) { throw new IndexOutOfBoundsException(String.format("Cannot remove source range: range malformed (%d, %d)", fromIndex, toIndex)); } if (fromIndex == toIndex) { if (actionOnCompletion != null) { actionOnCompletion.run(); } return; } mediaSourcesPublic.subList(fromIndex, toIndex).clear(); if (player != null) { player .createMessage(this) .setType(MSG_REMOVE_RANGE) .setPayload(new MessageData<>(fromIndex, toIndex, actionOnCompletion)) .send(); } else if (actionOnCompletion != null) { actionOnCompletion.run(); } }

Target:
public final synchronized void removeMediaSourceRange( int fromIndex, int toIndex, @Nullable Runnable actionOnCompletion) { Util.removeRange(mediaSourcesPublic, fromIndex, toIndex); if (fromIndex == toIndex) { if (actionOnCompletion != null) { actionOnCompletion.run(); } return; } if (player != null) { player .createMessage(this) .setType(MSG_REMOVE_RANGE) .setPayload(new MessageData<>(fromIndex, toIndex, actionOnCompletion)) .send(); } else if (actionOnCompletion != null) { actionOnCompletion.run(); } }
Source:
public void setUp() throws Exception { super.setUp(); try (Git git = new Git(db)) { JGitTestUtil.writeTrashFile(db, "hello", "world"); git.add().addFilepattern("hello").call(); git.commit().setMessage("Initial commit").call(); JGitTestUtil.writeTrashFile(db, "hello2", "hello"); git.add().addFilepattern("hello2").call(); git.commit().setMessage("hello2").call(); JGitTestUtil.writeTrashFile(db, "staged", "x"); git.add().addFilepattern("staged").call(); JGitTestUtil.writeTrashFile(db, "untracked", "untracked"); } }

Target:
public void setUp() throws Exception { super.setUp(); try (Git git = new Git(db)) { JGitTestUtil.writeTrashFile(db, "hello", "hello"); JGitTestUtil.writeTrashFile(db, "dir", "world", "world"); git.add().addFilepattern("dir").call(); git.commit().setMessage("Initial commit").call(); JGitTestUtil.writeTrashFile(db, "hello2", "hello"); git.add().addFilepattern("hello2").call(); FileUtils.createSymLink(new File(db.getWorkTree(), "link"), "target"); FileUtils.mkdir(new File(db.getWorkTree(), "target")); writeTrashFile("target/file", "someData"); git.add().addFilepattern("target").addFilepattern("link").call(); git.commit().setMessage("hello2").call(); JGitTestUtil.writeTrashFile(db, "staged", "x"); JGitTestUtil.deleteTrashFile(db, "hello2"); git.add().addFilepattern("staged").call(); JGitTestUtil.writeTrashFile(db, "untracked", "untracked"); } }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(kind.shortString()).append("("); for (int i = 0; i < fields.length; i++) { if (i != 0) { sb.append(","); } sb.append(StringUtils.arrayAwareToString(fields[i])); } sb.append(")"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(kind.shortString()).append("("); for (int i = 0; i < fields.length; i++) { if (i != 0) { sb.append(","); } sb.append(EncodingUtils.objectToString(fields[i])); } sb.append(")"); return sb.toString(); }
Source:
@Override public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure) { final int operandCount = callBinding.getOperandCount(); assert operandCount >= 2; if (!OperandTypes.ANY.checkSingleOperandType( callBinding, callBinding.operand(0), 0, throwOnFailure)) { return false; } for (int i = 1; i < operandCount; i++) { if (!OperandTypes.CHARACTER.checkSingleOperandType( callBinding, callBinding.operand(i), 0, throwOnFailure)) { return false; } } return true; }

Target:
@Override public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure) { final int operandCount = callBinding.getOperandCount(); if (!OperandTypes.ANY.checkSingleOperandType( callBinding, callBinding.operand(0), 0, throwOnFailure)) { return false; } for (int i = 1; i < operandCount; i++) { if (!OperandTypes.CHARACTER.checkSingleOperandType( callBinding, callBinding.operand(i), 0, throwOnFailure)) { return false; } } return true; }
Source:
public List<Rule> getRules(String dataSource) { List<Rule> retVal = Lists.newArrayList(); retVal.addAll((rules.get(dataSource) == null) ? Lists.<Rule>newArrayList() : rules.get(dataSource)); retVal.addAll(defaultRules); return retVal; }

Target:
public List<Rule> getRules(String dataSource) { List<Rule> retVal = Lists.newArrayList(); if (dataSource != null) { retVal.addAll(rules.get(dataSource)); } if (defaultRules != null) { retVal.addAll(defaultRules); } return retVal; }
Source:
public double priority(IResource r) { if (r!=null && r.isAccessible()) { if (ignoreDerived && r.isDerived()) { return PRIORITY_IGNORE; } if (isLinkedProject(r)) { return PRIORITY_IGNORE; } String name = r.getName(); for (String ext : ignoredExtensions) { if (name.regionMatches(true, name.length() - ext.length(), ext, 0, ext.length())) { return PRIORITY_IGNORE; } } for (String pre : ignoredPrefixes) { if (name.startsWith(pre)) { return PRIORITY_IGNORE; } } for (String n : ignoredNames) { if (name.equals(n)) { return PRIORITY_IGNORE; } } return PRIORITY_DEFAULT; } return PRIORITY_IGNORE; }

Target:
public double priority(IResource r) { if (r!=null && r.isAccessible()) { if (ignoreDerived && r.isDerived()) { return PRIORITY_IGNORE; } if (isIgnoredLinkedContainer(r)) { return PRIORITY_IGNORE; } String name = r.getName(); for (String ext : ignoredExtensions) { if (name.regionMatches(true, name.length() - ext.length(), ext, 0, ext.length())) { return PRIORITY_IGNORE; } } for (String pre : ignoredPrefixes) { if (name.startsWith(pre)) { return PRIORITY_IGNORE; } } for (String n : ignoredNames) { if (name.equals(n)) { return PRIORITY_IGNORE; } } return PRIORITY_DEFAULT; } return PRIORITY_IGNORE; }
Source:
public void before() { SWTBotUtils.openView(KernelMemoryUsageView.ID); fViewBotKernelMemory = fBot.viewById(KernelMemoryUsageView.ID); fViewBotKernelMemory.show(); Matcher<Chart> widgetOfType = WidgetOfType.widgetOfType(Chart.class); fChart = fViewBotKernelMemory.bot().widget(widgetOfType); try { SWTBotUtils.openTrace(TRACE_PROJECT_NAME, Paths.get(FileLocator.toFileURL(CtfTestTrace.KERNEL_VM.getTraceURL()).toURI()).toString(), KERNEL_TRACE_TYPE); } catch (IOException | URISyntaxException e) { fail(e.getMessage()); } SWTBotUtils.activateEditor(fBot, "kernel_vm"); }

Target:
public void before() { super.before(); File file = new File(CtfTmfTestTraceUtils.getTrace(CtfTestTrace.KERNEL_VM).getPath()); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, file.getAbsolutePath(), KERNEL_TRACE_TYPE); SWTBotUtils.activateEditor(fBot, "kernel_vm"); }
Source:
protected void startCompaction(CorfuRuntime rt, LogUnitServer logUnitServer) { rt.getGarbageInformer().stop(); rt.getGarbageInformer().waitUntilAllTasksFinish(); while (rt.getGarbageInformer().getGarbageReceivingQueue().size() > 0) { rt.getGarbageInformer().gcUnsafe(); } logUnitServer.runCompaction(); rt.getAddressSpaceView().resetCaches(); rt.getAddressSpaceView().invalidateServerCaches(); }

Target:
protected void startCompaction(CorfuRuntime rt, LogUnitServer logUnitServer) { rt.getGarbageInformer().stop(); rt.getGarbageInformer().waitUntilAllTasksFinish(); logUnitServer.runCompaction(); rt.getAddressSpaceView().resetCaches(); rt.getAddressSpaceView().invalidateServerCaches(); }
Source:
private static void setSessionVisibleSettings(FeedbackSessionAttributes feedbackSession, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings) { boolean hasSessionVisibleDate = !TimeHelper.isSpecialTime(feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisibleAtOpenChecked = Const.TIME_REPRESENTS_FOLLOW_OPENING.equals( feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisiblePrivateChecked = Const.TIME_REPRESENTS_NEVER.equals( feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisibleDateButtonChecked = hasSessionVisibleDate; additionalSettings.sessionVisibleDateValue = hasSessionVisibleDate ? TimeHelper.formatDateForSessionsForm( feedbackSession.getSessionVisibleFromTime()) : ""; additionalSettings.isSessionVisibleDateDisabled = !hasSessionVisibleDate; additionalSettings.sessionVisibleTimeOptions = PageData.getTimeOptionsAsElementTags( hasSessionVisibleDate ? feedbackSession.getSessionVisibleFromTime() : null); }

Target:
private static void setSessionVisibleSettings(FeedbackSessionAttributes feedbackSession, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings) { boolean hasSessionVisibleDate = !TimeHelper.isSpecialTime(feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisibleAtOpenChecked = Const.TIME_REPRESENTS_FOLLOW_OPENING.equals( feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisiblePrivateChecked = Const.TIME_REPRESENTS_NEVER.equals( feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisibleDateButtonChecked = hasSessionVisibleDate; additionalSettings.sessionVisibleDateValue = hasSessionVisibleDate ? TimeHelper.formatDateForSessionsForm( feedbackSession.getSessionVisibleFromTimeLocal()) : ""; additionalSettings.isSessionVisibleDateDisabled = !hasSessionVisibleDate; additionalSettings.sessionVisibleTimeOptions = PageData.getTimeOptionsAsElementTags( hasSessionVisibleDate ? feedbackSession.getSessionVisibleFromTimeLocal() : null); }
Source:
private boolean inheritsFromBaseException(@Nullable Symbol symbol) { if (symbol == null) { return true; } if (BuiltinSymbols.builtinExceptions().contains(symbol.name()) || BuiltinSymbols.builtinExceptionsPython2().contains(symbol.name())) { return true; } for (Usage usage : symbol.usages()) { if (usage.isBindingUsage()) { if (usage.kind().equals(Usage.Kind.IMPORT)) { return true; } Tree tree = usage.tree(); Tree parent = tree.parent(); if (parent.is(Tree.Kind.CLASSDEF)) { return classInheritsFromBaseException((ClassDef) parent); } } } return !isABuiltinNonExceptionType(symbol.name()); }

Target:
private boolean inheritsFromBaseException(@Nullable Symbol symbol) { if (symbol == null) { return true; } if (BuiltinSymbols.EXCEPTIONS.contains(symbol.name()) || BuiltinSymbols.EXCEPTIONS_PYTHON2.contains(symbol.name())) { return true; } List<Usage> bindingUsages = symbol.usages().stream().filter(Usage::isBindingUsage).collect(Collectors.toList()); if (bindingUsages.size() > 1) { return true; } if (bindingUsages.size() == 1) { Usage usage = bindingUsages.get(0); if (usage.kind().equals(Usage.Kind.IMPORT)) { return true; } if (usage.kind().equals(Usage.Kind.CLASS_DECLARATION)) { return classInheritsFromBaseException((ClassDef) usage.tree().parent()); } } return !BuiltinSymbols.all().contains(symbol.name()); }
Source:
public void testMultiMdRef() throws Exception { String[] csv = {"id,relationship.type,relation.isAuthorOfPublication,collection,dc.identifier.other", "+,Person,," + col1.getHandle() + ",0", "+,Person,," + col1.getHandle() + ",1", "+,Publication,dc.identifier.other:0||dc.identifier.other:1," + col1.getHandle() + ",2"}; Item[] items = runImport(csv); assertRelationship(items[2], items[0], 1); assertRelationship(items[2], items[1], 1); }

Target:
public void testMultiMdRef() throws Exception { String[] csv = {"id,relationship.type,relation.isAuthorOfPublication,collection,dc.identifier.other", "+,Person,," + col1.getHandle() + ",0", "+,Person,," + col1.getHandle() + ",1", "+,Publication,dc.identifier.other:0||dc.identifier.other:1," + col1.getHandle() + ",2"}; Item[] items = runImport(csv); assertRelationship(items[2], items[0], 1, "left", 0); assertRelationship(items[2], items[1], 1, "left", 1); }
Source:
private static void appendTime(StringBuilder sb, int hours, int minutes, int seconds, int nanos) { sb.append(NUMBERS[hours]); sb.append(':'); sb.append(NUMBERS[minutes]); sb.append(':'); sb.append(NUMBERS[seconds]); if (nanos == 0) { return; } sb.append('.'); int len = sb.length(); int micros = nanos / 1000; int microsDigits = 0; for (int i = 0; i < 6; i++) { if (micros % POWERS10[i + 1] != 0) { sb.append(micros / POWERS10[i]); microsDigits = i + (sb.length() - len); break; } } int needZeros = 6 - microsDigits; if (needZeros > 0) { sb.insert(len, ZEROS, 0, needZeros); } }

Target:
private static void appendTime(StringBuilder sb, int hours, int minutes, int seconds, int nanos) { sb.append(NUMBERS[hours]); sb.append(':'); sb.append(NUMBERS[minutes]); sb.append(':'); sb.append(NUMBERS[seconds]); if (nanos == 0) { return; } sb.append('.'); int len = sb.length(); sb.append(nanos / 1000); int needZeros = 6 - (sb.length() - len); if (needZeros > 0) { sb.insert(len, ZEROS, 0, needZeros); } int end = sb.length() - 1; while (sb.charAt(end) == '0') { sb.deleteCharAt(end); end--; } }
Source:
protected void createFields(final Composite parent) { final Label listenFeatureLabel = new Label(parent, SWT.NONE); listenFeatureLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.FeatureFillingConfigurationDialog_listenFeature); listenFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); listenFeatureText = new CLabel(parent, SWT.BORDER); listenFeatureText.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); browseValuesButton = new Button(parent, SWT.PUSH); browseValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.BROWSE_ICON_PATH)); browseValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_EditValue); browseValuesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { browseAction(modifiedFeatureFillingConf.getListenFeature()); } }); deleteValuesButton = new Button(parent, SWT.PUSH); deleteValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH)); deleteValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_UnsetValue); deleteValuesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { setListenFeature(null); } }); setListenFeature(modifiedFeatureFillingConf.getListenFeature()); }

Target:
protected void createFields(final Composite parent) { final Label listenFeatureLabel = new Label(parent, SWT.NONE); listenFeatureLabel.setText(Messages.FeatureFillingConfigurationDialog_listenFeature); listenFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); listenFeatureText = new CLabel(parent, SWT.BORDER); listenFeatureText.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); browseValuesButton = new Button(parent, SWT.PUSH); browseValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.BROWSE_ICON_PATH)); browseValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_EditValue); browseValuesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { browseAction(modifiedFeatureFillingConf.getListenFeature()); } }); deleteValuesButton = new Button(parent, SWT.PUSH); deleteValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH)); deleteValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_UnsetValue); deleteValuesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { setListenFeature(null); } }); setListenFeature(modifiedFeatureFillingConf.getListenFeature()); }
Source:
public ScheduledExecutorService build() { final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(this.poolSize, this.threadFactory, this.handler); if (this.removeOnCancel != null) { executor.setRemoveOnCancelPolicy(this.removeOnCancel.booleanValue()); } this.environment.manage(new ExecutorServiceManager(executor, this.shutdownTime, this.nameFormat)); return executor; }

Target:
public ScheduledExecutorService build() { final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(this.poolSize, this.threadFactory, this.handler); executor.setRemoveOnCancelPolicy(this.removeOnCancel); this.environment.manage(new ExecutorServiceManager(executor, this.shutdownTime, this.nameFormat)); return executor; }
Source:
public Emitter getEmitter(GraphiteEmitterConfig graphiteEmitterConfig, ObjectMapper mapper, final Injector injector) { List<Emitter> emitters = Lists.transform( graphiteEmitterConfig.getAlertEmitters(), new Function<String, Emitter>() { @Override public Emitter apply(String s) { return injector.getInstance(Key.get(Emitter.class, Names.named(s))); } } ); List<Emitter> requestLogEmitters = Lists.transform( graphiteEmitterConfig.getRequestLogEmitters(), new Function<String, Emitter>() { @Override public Emitter apply(String s) { return injector.getInstance(Key.get(Emitter.class, Names.named(s))); } } ); return new GraphiteEmitter(graphiteEmitterConfig, emitters, requestLogEmitters); }

Target:
public Emitter getEmitter(GraphiteEmitterConfig graphiteEmitterConfig, ObjectMapper mapper, final Injector injector) { List<Emitter> emitters = ImmutableList.copyOf( Lists.transform( graphiteEmitterConfig.getAlertEmitters(), alertEmitterName -> { return injector.getInstance(Key.get(Emitter.class, Names.named(alertEmitterName))); } ) ); List<Emitter> requestLogEmitters = ImmutableList.copyOf( Lists.transform( graphiteEmitterConfig.getRequestLogEmitters(), requestLogEmitterName -> { return injector.getInstance(Key.get(Emitter.class, Names.named(requestLogEmitterName))); } ) ); return new GraphiteEmitter(graphiteEmitterConfig, emitters, requestLogEmitters); }
Source:
public static Set<Symbol> extractWindowFunctionUnique(WindowNode.Function function) { ImmutableSet.Builder<Symbol> builder = ImmutableSet.builder(); for (RowExpression argument : function.getFunctionCall().getArguments()) { if (isExpression(argument)) { builder.addAll(SymbolsExtractor.extractAll(castToExpression(argument))); } else { builder.addAll(SymbolsExtractor.extractAll(argument).stream().map(variable -> new Symbol(variable.getName())).collect(toSet())); } } return builder.build(); }

Target:
public static Set<Symbol> extractWindowFunctionUnique(WindowNode.Function function) { ImmutableSet.Builder<Symbol> builder = ImmutableSet.builder(); for (RowExpression argument : function.getFunctionCall().getArguments()) { if (isExpression(argument)) { builder.addAll(SymbolsExtractor.extractAll(castToExpression(argument))); } else { builder.addAll(SymbolsExtractor.extractAll(argument).stream().map(variable -> new Symbol(variable.getName())).collect(toImmutableSet())); } } return builder.build(); }
Source:
public JSONObject getContainerStackTrace(@PathParam("containerId") String containerId) throws Exception { init(); if (containerId.equals(System.getenv(ApplicationConstants.Environment.CONTAINER_ID.toString()))) { return new JSONObject(StackTrace.getJsonFormat()); } StreamingContainerAgent sca = dagManager.getContainerAgent(containerId); if (sca == null) { throw new NotFoundException(); } if (!sca.getContainerInfo().state.equals("ACTIVE")) { throw new RuntimeException("Container is not active"); } int timeOut = 1000; for (int i = 0; i < 10; ++i) { String result = sca.getStackTrace(); if (result != null) { return new JSONObject(result); } Thread.sleep(timeOut); } throw new TimeoutException("Not able to get the stack trace"); }

Target:
public JSONObject getContainerStackTrace(@PathParam("containerId") String containerId) throws Exception { init(); if (containerId.equals(System.getenv(ApplicationConstants.Environment.CONTAINER_ID.toString()))) { return StramUtils.getStackTrace(); } StreamingContainerAgent sca = dagManager.getContainerAgent(containerId); if (sca == null) { throw new NotFoundException("Container not found."); } if (!sca.getContainerInfo().state.equals("ACTIVE")) { throw new NotFoundException("Container is not active."); } for (int i = 0; i < STACK_TRACE_ATTEMPTS; ++i) { String result = sca.getStackTrace(); if (result != null) { return new JSONObject(result); } Thread.sleep(STACK_TRACE_WAIT_TIME); } throw new TimeoutException("Not able to get the stack trace"); }
Source:
protected String findAutodiscoverHostFromSrv(String domain) throws XMLStreamException, IOException { String domainToMatch = AutoDiscoverSrvPrefix + domain; DnsSrvRecord dnsSrvRecord = this .findBestMatchingSrvRecord(domainToMatch); if ((dnsSrvRecord == null) || dnsSrvRecord.getNameTarget() == null || dnsSrvRecord.getNameTarget().isEmpty()) { this.service.traceMessage(TraceFlags.AutodiscoverConfiguration, "No appropriate SRV record was found."); return null; } else { String hostName = dnsSrvRecord.getNameTarget(); if (hostName.length() > 0 && hostName.charAt(hostName.length()-1)=='.') { hostName = hostName.substring(0, hostName.length()-1); } this.service.traceMessage(TraceFlags.AutodiscoverConfiguration, String.format("DNS query for SRV record for domain %s found %s", domain, hostName)); return hostName; } }

Target:
protected String findAutodiscoverHostFromSrv(String domain) throws XMLStreamException, IOException { String domainToMatch = AutoDiscoverSrvPrefix + domain; DnsSrvRecord dnsSrvRecord = this .findBestMatchingSrvRecord(domainToMatch); if (dnsSrvRecord != null) { String hostName = extractHostnameFromDnsSrv(dnsSrvRecord.getNameTarget()); if (hostName != null) { this.service.traceMessage(TraceFlags.AutodiscoverConfiguration, String .format("DNS query for SRV record for domain %s found %s", domain, hostName)); return hostName; } } this.service.traceMessage(TraceFlags.AutodiscoverConfiguration, "No appropriate SRV record was found."); return null; }
Source:
public void testLiveQueryDelay() throws CouchbaseLiteException, InterruptedException { final Query query = QueryBuilder .select(SelectResult.expression(Meta.id)) .from(DataSource.database(db)) .where(Expression.property("number1").greaterThanOrEqualTo(Expression.intValue(0))) .orderBy(Ordering.property("number1").ascending()); latch1 = new CountDownLatch(2); ListenerToken token = query.addChangeListener(executor, change -> { latch1.countDown(); }); createDocNumbered(12); createDocNumbered(13); createDocNumbered(14); createDocNumbered(15); createDocNumbered(16); latch1.await(5, TimeUnit.SECONDS); query.removeChangeListener(token); }

Target:
public void testLiveQueryDelay() throws CouchbaseLiteException, InterruptedException { final Query query = QueryBuilder .select(SelectResult.expression(Meta.id)) .from(DataSource.database(db)) .where(Expression.property("number1").greaterThanOrEqualTo(Expression.intValue(0))) .orderBy(Ordering.property("number1").ascending()); latch1 = new CountDownLatch(2); ListenerToken token = query.addChangeListener(executor, change -> { latch1.countDown(); }); createDocNumbered(12); createDocNumbered(13); createDocNumbered(14); createDocNumbered(15); createDocNumbered(16); assertTrue(latch1.await(5, TimeUnit.SECONDS)); query.removeChangeListener(token); }
Source:
public boolean canMine(Material type) { return type.name().endsWith("_ORE") || (canMineAncientDebris.getValue() && type == Material.ANCIENT_DEBRIS); }

Target:
public boolean canMine(Material type) { return type.name().endsWith("_ORE") || (type == Material.ANCIENT_DEBRIS && canMineAncientDebris.getValue()); }
Source:
public Coordinate getLatestReleaseOf(final CoordinateBuilder coord) { List<Coordinate> availableVersions = depsResolver.resolveVersions(DependencyQueryBuilder.create(coord)); for(int i = availableVersions.size()-1; i >= 0; i--) { Coordinate availableCoord = availableVersions.get(i); String versionStr = availableCoord.getVersion() == null ? "" : availableCoord.getVersion(); if(!availableCoord.isSnapshot() && !versionStr.matches(".*CR[0-9]$")) return availableVersions.get(i); } return null; }

Target:
public Coordinate getLatestReleaseOf(final CoordinateBuilder coord) { List<Coordinate> availableVersions = depsResolver.resolveVersions(DependencyQueryBuilder.create(coord)); for(int i = availableVersions.size()-1; i >= 0; i--) { Coordinate availableCoord = availableVersions.get(i); String versionStr = availableCoord.getVersion(); if(versionStr != null && !availableCoord.isSnapshot() && !versionStr.matches(".*CR[0-9]$")) return availableCoord; } return null; }
Source:
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) { if (loader == null || shouldIgnore(className)) { return null; } final ClassReader reader = new ClassReader(classfileBuffer); final ClassWriter writer = new ClassWriter(0); reader.accept(new DefinalizingClassVisitor(writer), 0); return writer.toByteArray(); }

Target:
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) { if (loader == null || shouldIgnore(className)) { return null; } final ClassReader reader = new ClassReader(classfileBuffer); final ClassWriter writer = new ClassWriter(NO_FLAGS_OR_OPTIONS); reader.accept(new DefinalizingClassVisitor(writer), NO_FLAGS_OR_OPTIONS); return writer.toByteArray(); }
Source:
public boolean hasFileTypes() { return getComponentModel().fileTypes != null && getComponentModel().fileTypes.size() > 0; }

Target:
public boolean hasFileTypes() { FileWidgetModel fileWidgetModel = getComponentModel(); return fileWidgetModel.fileTypes != null && fileWidgetModel.fileTypes.size() > 0; }
Source:
public static String getDiscriminator(String propertyName, String propertyKey, String visibilityString, long timestamp) { String discriminatorWithoutTimestamp = getDiscriminatorWithoutTimestamp(propertyName, propertyKey, visibilityString); String timestampString = Long.toHexString(timestamp); int length = discriminatorWithoutTimestamp.length() + 1 + timestampString.length(); return new StringBuilder(length) .append(discriminatorWithoutTimestamp) .append(VALUE_SEPARATOR) .append(timestampString) .toString(); }

Target:
public static String getDiscriminator(String propertyName, String propertyKey, String visibilityString, long timestamp) { assertNoValueSeparator(propertyName); assertNoValueSeparator(propertyKey); assertNoValueSeparator(visibilityString); String timestampString = Long.toHexString(timestamp); int length = propertyName.length() + 1 + propertyKey.length() + 1 + visibilityString.length() + 1 + timestampString.length(); return new StringBuilder(length) .append(propertyName) .append(VALUE_SEPARATOR) .append(propertyKey) .append(VALUE_SEPARATOR) .append(visibilityString) .append(VALUE_SEPARATOR) .append(timestampString) .toString(); }
Source:
public int available() throws IOException { return (int) Math.min(this.origin.available(), this.more); }

Target:
public int available() throws IOException { return (int) Math.min((long) this.origin.available(), this.more); }
Source:
public void testJsonDocumentWithMaxLevelAndNumberOfNodes() throws IOException { JsonTestHelper.createTestDocument(); final var database = JsonTestHelper.getDatabase(PATHS.PATH1.getFile()); try (final var manager = database.openResourceManager(JsonTestHelper.RESOURCE)) { try (final Writer writer = new StringWriter()) { final var serializer = new JsonSerializer.Builder(manager, writer).maxLevel(2).numberOfNodes(3).build(); serializer.call(); final var expected = "{\"foo\":[]}"; assertEquals(expected, writer.toString()); } try (final Writer writer = new StringWriter()) { final var serializer = new JsonSerializer.Builder(manager, writer).maxLevel(2).numberOfNodes(4).build(); serializer.call(); final var expected = "{\"foo\":[]}"; assertEquals(expected, writer.toString()); } try (final Writer writer = new StringWriter()) { final var serializer = new JsonSerializer.Builder(manager, writer).maxLevel(2).numberOfNodes(5).build(); serializer.call(); final var expected = "{\"foo\":[],\"bar\":{}}"; assertEquals(expected, writer.toString()); } try (final Writer writer = new StringWriter()) { final var serializer = new JsonSerializer.Builder(manager, writer).maxLevel(2).numberOfNodes(6).build(); serializer.call(); final var expected = "{\"foo\":[],\"bar\":{}}"; assertEquals(expected, writer.toString()); } } }

Target:
public void testJsonDocumentWithMaxLevelAndNumberOfNodes() throws IOException { JsonTestHelper.createTestDocument(); final var database = JsonTestHelper.getDatabase(PATHS.PATH1.getFile()); try (final var manager = database.openResourceManager(JsonTestHelper.RESOURCE)) { var serializedString = getSerializedStringWithMaxLevelAndNumberOfNodes(manager, 2, 3); var expected = "{\"foo\":[]}"; assertEquals(expected, serializedString); serializedString = getSerializedStringWithMaxLevelAndNumberOfNodes(manager, 2, 4); assertEquals(expected, serializedString); serializedString = getSerializedStringWithMaxLevelAndNumberOfNodes(manager, 2, 5); expected = "{\"foo\":[],\"bar\":{}}"; assertEquals(expected, serializedString); serializedString = getSerializedStringWithMaxLevelAndNumberOfNodes(manager, 2, 6); assertEquals(expected, serializedString); } }
Source:
public void testRegisterCheckOutEvict() throws Exception { Service service = mock(Service.class); when(_factory.create(any(ServiceEndPoint.class))).thenReturn(service); MultiThreadedClientServiceCache<Service> cache = newCache(0); cache.register(_endPoint); assertSame(1, cache.getNumActiveInstances(_endPoint)); assertSame(1, cache.getNumIdleInstances(_endPoint)); ServiceHandle<Service> handle = cache.checkOut(_endPoint); assertSame(handle.getService(), service); assertSame(1, cache.getNumActiveInstances(_endPoint)); assertSame(1, cache.getNumIdleInstances(_endPoint)); cache.evict(_endPoint); verify(_factory, timeout(100).times(1)).destroy(_endPoint, handle.getService()); assertSame(0, cache.getNumActiveInstances(_endPoint)); assertSame(0, cache.getNumIdleInstances(_endPoint)); }

Target:
public void testRegisterCheckOutEvict() throws Exception { Service service = mock(Service.class); when(_factory.create(any(ServiceEndPoint.class))).thenReturn(service); MultiThreadedClientServiceCache<Service> cache = newCache(0); cache.register(_endPoint); assertEquals(1, cache.getNumActiveInstances(_endPoint)); assertEquals(1, cache.getNumIdleInstances(_endPoint)); ServiceHandle<Service> handle = cache.checkOut(_endPoint); assertSame(service, handle.getService()); assertEquals(1, cache.getNumActiveInstances(_endPoint)); assertEquals(1, cache.getNumIdleInstances(_endPoint)); cache.evict(_endPoint); verify(_factory, timeout(100).times(1)).destroy(_endPoint, handle.getService()); assertEquals(0, cache.getNumActiveInstances(_endPoint)); assertEquals(0, cache.getNumIdleInstances(_endPoint)); }
Source:
private void addCommonCourtsToModel(JudgmentCriteriaForm judgmentCriteriaForm, ModelMap model) { if(judgmentCriteriaForm.getCourtType() != null && CourtType.COMMON.equals(judgmentCriteriaForm.getCourtType())) { model.addAttribute("commonCourts", ccListService.findCommonCourts()); if (judgmentCriteriaForm.getCommonCourtId() != null) { model.addAttribute("commonCourtDivisions", ccListService.findCcDivisions(judgmentCriteriaForm.getCommonCourtId())); } } }

Target:
private void addCommonCourtsToModel(JudgmentCriteriaForm judgmentCriteriaForm, ModelMap model) { if(CourtType.COMMON.equals(judgmentCriteriaForm.getCourtType())) { model.addAttribute("commonCourts", ccListService.findCommonCourts()); if (judgmentCriteriaForm.getCommonCourtId() != null) { model.addAttribute("commonCourtDivisions", ccListService.findCcDivisions(judgmentCriteriaForm.getCommonCourtId())); } } }
Source:
public void openMarketplace(final String origin) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); String email = prefs.getString("userEmail", "unknown@email.com"); if(!email.equals("unknown@email.com")) { email = "?email=" + email; } else { email = ""; } final String url = "<LINK_0>" + email; AlertDialog alertDialog = new AlertDialog.Builder(mContext).create(); alertDialog.setTitle(mContext.getString(R.string.opening_manager)); alertDialog.setMessage(mContext.getString(R.string.opening_manager_description)); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { JSONObject props = MixPanel.buildProp("origin", origin); mMixpanel.track("Open marketplace", props); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); mContext.startActivity(i); } }); alertDialog.show(); }

Target:
public void openMarketplace(final String origin) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); String email = prefs.getString("userEmail", ""); email = !email.isEmpty() ? "?email=" + email : ""; final String url = "<LINK_0>" + email; AlertDialog alertDialog = new AlertDialog.Builder(mContext).create(); alertDialog.setTitle(mContext.getString(R.string.opening_manager)); alertDialog.setMessage(mContext.getString(R.string.opening_manager_description)); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { JSONObject props = MixPanel.buildProp("origin", origin); mMixpanel.track("Open marketplace", props); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); mContext.startActivity(i); } }); alertDialog.show(); }
Source:
private boolean canUpdateEntity(World _this, int startBlockX, int oldStartBlockY, int startBlockZ, int endBlockX, int oldEndBlockY, int endBlockZ, boolean allowEmpty) { if (!this.isCubicWorld()) { return isAreaLoaded(startBlockX, oldStartBlockY, startBlockZ, endBlockX, oldEndBlockY, endBlockZ, allowEmpty); } return this.isRemote() || this.getCubeFromBlockCoords( new BlockPos(updateEntity_entityPosX, updateEntity_entityPosY, updateEntity_entityPosZ)) .getTickets().shouldTick(); }

Target:
private boolean canUpdateEntity(World _this, int startBlockX, int oldStartBlockY, int startBlockZ, int endBlockX, int oldEndBlockY, int endBlockZ, boolean allowEmpty) { if (!this.isCubicWorld()) { return isAreaLoaded(startBlockX, oldStartBlockY, startBlockZ, endBlockX, oldEndBlockY, endBlockZ, allowEmpty); } BlockPos entityPos = new BlockPos(updateEntity_entityPosX, updateEntity_entityPosY, updateEntity_entityPosZ); return this.isRemote() || !this.isValid(entityPos) || this.getCubeFromBlockCoords(entityPos).getTickets().shouldTick(); }
Source:
private void assertTransformationsGenerated(SimpleTransformApplication simpleTransformApplication) throws IOException { ObjectMapper mapper = new ObjectMapper(); POJOGenerator pojoGenerator = simpleTransformApplication.getPojoDataGenerator(); int maxLengthOfCustomerName = 1 + ( 2 * pojoGenerator.getMaxNameLength()); for (Object stringJsonObject : results) { CustomerInfo aTransformedCustomer = mapper.readValue(stringJsonObject.toString(),CustomerInfo.class); assertFalse(aTransformedCustomer.getAddress().matches("[A-Z]")); assertThat(aTransformedCustomer.getAge(), Matchers.lessThanOrEqualTo(POJOGenerator.MAX_YEAR_DIFF_RANGE)); assertThat(aTransformedCustomer.getName().length(), Matchers.lessThanOrEqualTo(maxLengthOfCustomerName)); } }

Target:
private void assertTransformationsGenerated(SimpleTransformApplication simpleTransformApplication) throws IOException { int maxLengthOfCustomerName = 1 + ( 2 * simpleTransformApplication.pojoDataGenerator.getMaxNameLength()); for (Object customerInfoObject : results) { CustomerInfo aTransformedCustomer = (CustomerInfo)customerInfoObject; assertFalse(aTransformedCustomer.getAddress().matches("[A-Z]")); assertThat(aTransformedCustomer.getAge(), Matchers.lessThanOrEqualTo(POJOGenerator.MAX_YEAR_DIFF_RANGE)); assertThat(aTransformedCustomer.getName().length(), Matchers.lessThanOrEqualTo(maxLengthOfCustomerName)); } }
Source:
public byte[] getStitchesBytes(ArrayList<StitchPoint> stitchPoints) { int xChange; int yChange; StitchPoint currentPoint = stitchPoints.get(0); ByteArray stitchBytes = new ByteArray(); for (int i = 0; i < stitchPoints.size(); i++) { StitchPoint nextPoint = stitchPoints.get(i); xChange = (int) (nextPoint.point.x - currentPoint.point.x); yChange = (int) (nextPoint.point.y - currentPoint.point.y); int xValue = (xChange < 0 ? CONVERSIONTABLE[(xChange * (-1)) + 121] : CONVERSIONTABLE[xChange]); int yValue = (yChange < 0 ? CONVERSIONTABLE[(yChange * (-1)) + 121] : CONVERSIONTABLE[yChange]); stitchBytes.addAll(getBytesForStitchPoint(xValue, yValue, currentPoint.jump)); currentPoint = nextPoint; } return stitchBytes.toArray(); }

Target:
public byte[] getStitchesBytes(ArrayList<StitchPoint> stitchPoints) { int xChange; int yChange; StitchPoint currentPoint = stitchPoints.get(0); ByteArray stitchBytes = new ByteArray(); for (int i = 0; i < stitchPoints.size(); i++) { StitchPoint nextPoint = stitchPoints.get(i); xChange = (int) (nextPoint.point.x - currentPoint.point.x); yChange = (int) (nextPoint.point.y - currentPoint.point.y); int xValue = (xChange < 0 ? CONVERSION_TABLE[(xChange * (-1)) + 121] : CONVERSION_TABLE[xChange]); int yValue = (yChange < 0 ? CONVERSION_TABLE[(yChange * (-1)) + 121] : CONVERSION_TABLE[yChange]); stitchBytes.addAll(getBytesForStitchPoint(xValue, yValue, currentPoint.jump)); currentPoint = nextPoint; } return stitchBytes.toArray(); }
Source:
public FunctionImplementation getForTypes(List<DataType> dataTypes) throws IllegalArgumentException { assert dataTypes.size() == 2 : "Arithmetic operator must receive two arguments"; if (dataTypes.get(0).equals(dataTypes.get(1))) { DataType dataType = dataTypes.get(0); final BinaryScalar<?> scalar; switch (dataType.id()) { case DoubleType.ID: scalar = new BinaryScalar<>(doubleFunction, name, DataTypes.DOUBLE, features); break; case FloatType.ID: scalar = new BinaryScalar<>(floatFunction, name, DataTypes.FLOAT, features); break; case ByteType.ID: case ShortType.ID: case IntegerType.ID: scalar = new BinaryScalar<>(integerFunction, name, DataTypes.INTEGER, features); break; case LongType.ID: case TimestampType.ID_WITH_TZ: case TimestampType.ID_WITHOUT_TZ: scalar = new BinaryScalar<>(longFunction, name, DataTypes.LONG, features); break; default: throw new UnsupportedOperationException( operator + " is not supported on expressions of type " + dataType.getName()); } return Scalar.withOperator(scalar, operator); } DataType fst = dataTypes.get(0); DataType snd = dataTypes.get(1); if (snd.id() == IntervalType.ID) { switch (fst.id()) { case TimestampType.ID_WITH_TZ: case TimestampType.ID_WITHOUT_TZ: return new IntervalToTimestampScalar(operator); default: throw new UnsupportedOperationException("Invalid operator on intervals"); } } throw new UnsupportedOperationException("Invalid operation"); }

Target:
public FunctionImplementation getForTypes(List<DataType> dataTypes) throws IllegalArgumentException { assert dataTypes.size() == 2 : "Arithmetic operator must receive two arguments"; DataType fst = dataTypes.get(0); DataType snd = dataTypes.get(1); if (fst.equals(snd)) { final Scalar<?, ?> scalar; switch (fst.id()) { case DoubleType.ID: scalar = new BinaryScalar<>(doubleFunction, name, DataTypes.DOUBLE, features); break; case FloatType.ID: scalar = new BinaryScalar<>(floatFunction, name, DataTypes.FLOAT, features); break; case ByteType.ID: case ShortType.ID: case IntegerType.ID: scalar = new BinaryScalar<>(integerFunction, name, DataTypes.INTEGER, features); break; case IntervalType.ID: scalar = new IntervalArithmeticScalar(operator, name); break; case LongType.ID: case TimestampType.ID_WITH_TZ: case TimestampType.ID_WITHOUT_TZ: scalar = new BinaryScalar<>(longFunction, name, DataTypes.LONG, features); break; default: throw new UnsupportedOperationException( operator + " is not supported on expressions of type " + fst.getName()); } return Scalar.withOperator(scalar, operator); } if (isInterval(fst) && isTimestamp(snd)) { return new IntervalTimestampScalar(operator, name, fst, snd, snd); } if (isTimestamp(fst) && isInterval(snd)) { return new IntervalTimestampScalar(operator, name, fst, snd, fst); } throw new UnsupportedOperationException( String.format(Locale.ENGLISH, "Arithmetic operation are not supported for type %s %s", fst, snd)); }
Source:
public void testThrottlingRoutePolicyStartWithAlwaysOpenOn() throws Exception { log.debug("---- sending some messages"); for (int i = 0; i < size; i++) { template.sendBody(url, "Message " + i); Thread.sleep(3); } Thread.sleep(2000); result.expectedMessageCount(0); result.setResultWaitTime(1000); assertMockEndpointsSatisfied(); }

Target:
public void testThrottlingRoutePolicyStartWithAlwaysOpenOn() throws Exception { log.debug("---- sending some messages"); for (int i = 0; i < size; i++) { template.sendBody(url, "Message " + i); Thread.sleep(3); } Thread.sleep(500); result.expectedMessageCount(0); result.setResultWaitTime(1000); assertMockEndpointsSatisfied(); }