auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
@Test void testMergeJoinDeriveRight2() { final String sql = "select * from sales.bonus s join\n" + "(select ename, job, mgr, max(sal) from sales.emp group by ename, job, mgr) r\n" + "on r.job=s.job and r.ename=s.ename"; Query.create(sql) .removeRules(NON_DETERMINISTIC_JOIN_ORDER_RULES) .removeRules(NON_MERGE_JOIN_RULES) .removeRule(EnumerableRules.ENUMERABLE_AGGREGATE_RULE) .addRule(EnumerableRules.ENUMERABLE_SORTED_AGGREGATE_RULE) .check(); }

Target:
@Test void testMergeJoinDeriveRight2() { final String sql = "select * from sales.bonus s join\n" + "(select ename, job, mgr, max(sal) from sales.emp group by ename, job, mgr) r\n" + "on r.job=s.job and r.ename=s.ename"; Query.create(sql) .removeRule(EnumerableRules.ENUMERABLE_JOIN_RULE) .check(); }
Source:
public IndexSettings build() { boolean empty = true; IndexSettings settings = new IndexSettings(); if ( !analyzers.isEmpty() ) { empty = false; getAnalysis( settings ).setAnalyzers( analyzers ); } if ( !tokenizers.isEmpty() ) { empty = false; getAnalysis( settings ).setTokenizers( tokenizers ); } if ( !tokenFilters.isEmpty() ) { empty = false; getAnalysis( settings ).setTokenFilters( tokenFilters ); } if ( !charFilters.isEmpty() ) { empty = false; getAnalysis( settings ).setCharFilters( charFilters ); } if ( empty ) { return null; } else { return settings; } }

Target:
public IndexSettings build() { IndexSettings settings = new IndexSettings(); if ( !analyzers.isEmpty() ) { getAnalysis( settings ).setAnalyzers( analyzers ); } if ( !tokenizers.isEmpty() ) { getAnalysis( settings ).setTokenizers( tokenizers ); } if ( !tokenFilters.isEmpty() ) { getAnalysis( settings ).setTokenFilters( tokenFilters ); } if ( !charFilters.isEmpty() ) { getAnalysis( settings ).setCharFilters( charFilters ); } return settings; }
Source:
private void writeWebContextVar( PrintWriter writer, String variable, String value, boolean deprecated, boolean escapeValue ) { if ( escapeValue ) { value = escapeEnvironmentVar( value ); } if ( deprecated ) { writer.write( "\n " ); } writer.write( "\nvar " + variable + " = " + value + ";\n" ); if ( variable.equals( "SESSION_LOCALE" ) ) { writer.write( "\nif (pen != null && pen.define) {" ); writer.write( "\n pen.define('Locale', { locale: " + value + " });" ); writer.write( "\n}\n" ); } }

Target:
private void writeWebContextVar( PrintWriter writer, String variable, String value, boolean deprecated, boolean escapeValue ) { if ( escapeValue ) { value = escapeEnvironmentVar( value ); } if ( deprecated ) { writer.write( "\n " ); } writer.write( "\nvar " + variable + " = " + value + ";\n" ); }
Source:
CookiePage(byte[] page) throws IOException { if (page == null || page.length == 0) { throw new IllegalArgumentException("Invalid value for page passes to CookiePage constructor"); } pageBuffer = ByteBuffer.wrap(page); if (pageBuffer.getInt() != PAGE_HEADER_VALUE) { pageBuffer = null; throw new IOException("Invalid file format, bad page head value found"); } pageBuffer.order(ByteOrder.LITTLE_ENDIAN); int count = pageBuffer.getInt(); cookieOffSets = new int[count]; for (int cnt = 0; cnt < count; cnt++) { cookieOffSets[cnt] = pageBuffer.getInt(); } pageBuffer.getInt(); }

Target:
CookiePage(byte[] page) throws IOException { if (page == null || page.length == 0) { throw new IllegalArgumentException("Invalid value for page passed to CookiePage constructor"); } pageBuffer = ByteBuffer.wrap(page); if (pageBuffer.getInt() != PAGE_HEADER_VALUE) { pageBuffer = null; throw new IOException("Invalid file format, bad page head value found"); } pageBuffer.order(ByteOrder.LITTLE_ENDIAN); int count = pageBuffer.getInt(); cookieOffSets = new int[count]; for (int cnt = 0; cnt < count; cnt++) { cookieOffSets[cnt] = pageBuffer.getInt(); } pageBuffer.getInt(); }
Source:
public void allWithOneTask() throws Exception{ final Repo repo = new MkRepo(); final Region region = DyTasksTest.region(repo.name(),10L); DyTasks tasks = new DyTasks(region, repo); Iterator<Task> iteTask = tasks.all().iterator(); MatcherAssert.assertThat(iteTask.hasNext(),Matchers.equalTo(true)); iteTask.next(); MatcherAssert.assertThat(iteTask.hasNext(),Matchers.equalTo(false)); }

Target:
public void allWithOneTask() throws Exception { final Repo repo = new MkRepo(); final DyTasks tasks = new DyTasks( DyTasksTest.region(repo.name(), 10L), repo ); MatcherAssert.assertThat( tasks.all(), Matchers.<Task>iterableWithSize(1) ); }
Source:
public AutoRegisterModules(String pluginName, PluginGuiceEnvironment env, JarFile jarFile, ClassLoader classLoader) { this.pluginName = pluginName; this.env = env; this.jarFile = jarFile; this.classLoader = classLoader; this.sshGen = env.hasSshModule() ? env.newSshModuleGenerator() : null; this.httpGen = env.hasHttpModule() ? env.newHttpModuleGenerator() : null; }

Target:
AutoRegisterModules(String pluginName, PluginGuiceEnvironment env, JarFile jarFile, ClassLoader classLoader) { this.pluginName = pluginName; this.env = env; this.jarFile = jarFile; this.classLoader = classLoader; this.sshGen = env.hasSshModule() ? env.newSshModuleGenerator() : null; this.httpGen = env.hasHttpModule() ? env.newHttpModuleGenerator() : null; }
Source:
private Session performOpenSession(IProgressMonitor monitor) { Session session = null; try { SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.OpenRepresentationsFileJob_loadRepresentationsTask, 16); if (SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(representationsFileURI.fileExtension())) { subMonitor.worked(1); subMonitor.subTask(MessageFormat.format(Messages.OpenRepresentationsFileJob_loadReferencedModelsTask, representationsFileURI.lastSegment())); session = SessionUIManager.INSTANCE.openSession(representationsFileURI, subMonitor.newChild(14)); if (session != null) { IEditingSession editingSession = SessionUIManager.INSTANCE.getOrCreateUISession(session); if (!editingSession.isOpen()) { editingSession.open(); } } subMonitor.worked(1); } } finally { monitor.done(); } return session; }

Target:
private Session performOpenSession(IProgressMonitor monitor) { Session session = null; try { SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.OpenRepresentationsFileJob_loadRepresentationsTask, 16); if (SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(representationsFileURI.fileExtension())) { subMonitor.worked(1); subMonitor.subTask(MessageFormat.format(Messages.OpenRepresentationsFileJob_loadReferencedModelsTask, representationsFileURI.lastSegment())); session = SessionManager.INSTANCE.openSession(representationsFileURI, subMonitor.newChild(14), SiriusEditPlugin.getPlugin().getUiCallback()); if (session != null) { IEditingSession editingSession = SessionUIManager.INSTANCE.getOrCreateUISession(session); if (!editingSession.isOpen()) { editingSession.open(); } } subMonitor.worked(1); } } finally { monitor.done(); } return session; }
Source:
private String formatError(String errorMessage) { String result = errorMessage; if (errorMessage != null && !errorMessage.isEmpty()) { if (errorMessage.startsWith( "<" )) { result = errorMessage.replaceAll( "\\\\n", "<br/>" ); } else { StringBuilder sb = new StringBuilder(); int id = ++labelCnt; String[] s = errorMessage.split( "\\n" ); sb.append( "<input class=\"collapse\" id=\"_"+ id +"\" type=\"checkbox\"><label for=\"_" + id + "\">" ); sb.append( s[0] ); sb.append( "</label><div>" ); for ( int i = 1; i < s.length; i++) { if ( i > 1 ) { sb.append( "<br/>" ); } sb.append( s[i] ); } sb.append( "</div>" ); result = sb.toString(); } } return result; }

Target:
private String formatError(String errorMessage) { String result = errorMessage; if (errorMessage != null && !errorMessage.isEmpty()) { if (errorMessage.startsWith( "<" )) { result = errorMessage.replaceAll( "\\\\n", "<br/>" ); } else { int id = ++labelCount; String[] headLineAndTrace = StringUtils.split( errorMessage , "\n", 2 ); result = String.format( "<input class=\"collapse\" id=\"_%d\" type=\"checkbox\"><label for=\"_%d\">%s</label><div>%s</div>", id, id, headLineAndTrace[0], headLineAndTrace[1].replaceAll( "\n", "<br/>" ) ); } } return result; }
Source:
protected boolean canDoAction() { if (!checkRemoveEditValidations()) { return false; } if (SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()).size() > 0) { StringBuffer attachedClustersStringBf = new StringBuffer(""); List<VDSGroup> attachedClustersList = SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()); boolean isFirstCluster = true; for (VDSGroup vdsGroup : attachedClustersList) { if (isFirstCluster == false) attachedClustersStringBf.append(','); attachedClustersStringBf.append('\'').append(vdsGroup.getName()).append('\''); isFirstCluster = false; } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_POLICY_INUSE, String.format("$clusters %1$s", attachedClustersStringBf.toString())); } return true; }

Target:
protected boolean canDoAction() { if (!checkRemoveEditValidations()) { return false; } if (SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()).size() > 0) { StringBuilder attachedClustersStringBf = new StringBuilder(""); List<VDSGroup> attachedClustersList = SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()); boolean isFirstCluster = true; for (VDSGroup vdsGroup : attachedClustersList) { if (isFirstCluster == false) attachedClustersStringBf.append(','); attachedClustersStringBf.append('\'').append(vdsGroup.getName()).append('\''); isFirstCluster = false; } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_POLICY_INUSE, String.format("$clusters %1$s", attachedClustersStringBf.toString())); } return true; }
Source:
public void setVirtSpecifier(ICPPASTClassVirtSpecifier virtSpecifier) { assertNotFrozen(); if (virtSpecifier != null) { this.virtSpecifier = virtSpecifier; virtSpecifier.setParent(this); virtSpecifier.setPropertyInParent(CLASS_VIRT_SPECIFIER); } }

Target:
public void setVirtSpecifier(ICPPASTClassVirtSpecifier virtSpecifier) { assertNotFrozen(); this.virtSpecifier = virtSpecifier; if (virtSpecifier != null) { virtSpecifier.setParent(this); virtSpecifier.setPropertyInParent(CLASS_VIRT_SPECIFIER); } }
Source:
static void checkArrayRange(boolean[] array, int offset, int length) { if (array == null) { return; } if (offset < 0 || length < 0 || offset + length > array.length) { throw new IndexOutOfBoundsException(format("Invalid offset %s and length %s in array with %s elements", offset, length, array.length)); } }

Target:
static void checkArrayRange(boolean[] array, int offset, int length) { requireNonNull(array, "array is null"); if (offset < 0 || length < 0 || offset + length > array.length) { throw new IndexOutOfBoundsException(format("Invalid offset %s and length %s in array with %s elements", offset, length, array.length)); } }
Source:
public Hooks list() { VdcQueryReturnValue result = runQuery(VdcQueryType.GetVdsHooksById2, new GetVdsHooksByIdParameters(asGuid(hostId))); HashMap<String, HashMap<String, HashMap<String, String>>> dictionary = (HashMap<String, HashMap<String, HashMap<String, String>>>) result.getReturnValue(); Hooks hooks = new Hooks(); for (Map.Entry<String, HashMap<String, HashMap<String, String>>> keyValuePair : dictionary.entrySet()) { for (Map.Entry<String, HashMap<String, String>> keyValuePair1 : keyValuePair.getValue() .entrySet()) { Hook hook = createHook(keyValuePair, keyValuePair1); hooks.getHooks().add(hook); } } return hooks; }

Target:
public Hooks list() { VdcQueryReturnValue result = runQuery(VdcQueryType.GetVdsHooksById2, new GetVdsHooksByIdParameters(asGuid(hostId))); HashMap<String, HashMap<String, HashMap<String, String>>> hooksMap = (HashMap<String, HashMap<String, HashMap<String, String>>>) result.getReturnValue(); Hooks hooks = mappingLocator.getMapper(HashMap.class, Hooks.class).map(hooksMap, null); return hooks; }
Source:
public static void main(String[] args) throws EdisonException, AnnotatorException { gazetteersInstance.ignoreGazetteer("Weapons.gz"); gazetteersInstance.ignoreGazetteer("Weapons.Missile.gz"); List<String[]> sentences = Arrays.asList("I live in Chicago , Illinois .".split("\\s+"), "I met George Bush .".split("\\s+")); TextAnnotation ta = BasicTextAnnotationBuilder.createTextAnnotationFromTokens(sentences); ta.addView(gazetteersInstance); logger.info(ta.toString()); logger.info(ta.getView(gazetteersInstance.getViewName()).toString()); }

Target:
public static void main(String[] args) throws EdisonException, AnnotatorException { gazetteersInstance.ignoreGazetteer("Weapons.gz"); gazetteersInstance.ignoreGazetteer("Weapons.Missile.gz"); List<String[]> sentences = Arrays.asList("I live in Chicago , Illinois .".split("\\s+"), "I met George Bush .".split("\\s+")); TextAnnotation ta = BasicTextAnnotationBuilder.createTextAnnotationFromTokens(sentences); ta.addView(gazetteersInstance); System.out.println(ta.toString()); System.out.println(ta.getView(gazetteersInstance.getViewName()).toString()); }
Source:
public Mutation toMutation(K key) { return new Mutations.ReadWriteWithValue<>(value, f); }

Target:
public Mutation toMutation(K key) { V valueFromStorage = (V) cacheEncoders.valueFromStorage(value); return new Mutations.ReadWriteWithValue<>(valueFromStorage, f); }
Source:
void closeAllWithoutFlushing() throws IOException { try { fileInfos.forEach((key, fileInfo) -> { try { fileInfo.close(false); } catch (IOException e) { throw new UncheckedExecutionException(e); } }); } catch (UncheckedExecutionException uee) { if (uee.getCause() instanceof IOException) { throw (IOException) uee.getCause(); } else { throw new IOException("Unknown exception is thrown on closing all file infos", uee.getCause()); } } }

Target:
void closeAllWithoutFlushing() throws IOException { try { fileInfos.forEach((key, fileInfo) -> { try { fileInfo.close(false); } catch (IOException e) { throw new UncheckedIOException(e); } }); } catch (UncheckedIOException uioe) { throw uioe.getCause(); } }
Source:
public void apply(EntityLocal entity) { super.apply(entity); Maybe<T> v = Tasks.resolving(value).as((Class<T>)sensor.getType()).timeout(Duration.millis(200)).getMaybe(); if (v.isPresent()) { log.debug(this+" setting sensor "+sensor+" to "+v.get()); entity.setAttribute(sensor, v.get()); } else { log.debug(this+" not setting sensor "+sensor+"; cannot resolve "+value); } }

Target:
public void apply(EntityLocal entity) { super.apply(entity); Maybe<T> v = Tasks.resolving(value).as((Class<T>)sensor.getType()).timeout(ValueResolver.PRETTY_QUICK_WAIT).getMaybe(); if (v.isPresent()) { log.debug(this+" setting sensor "+sensor+" to "+v.get()); entity.setAttribute(sensor, v.get()); } else { log.debug(this+" not setting sensor "+sensor+"; cannot resolve "+value); } }
Source:
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { if (env.getIteratorScope() == IteratorScope.scan) { throw new IllegalArgumentException(); } this.source = source; isFullMajc = env.getIteratorScope() == IteratorScope.majc && env.isFullMajorCompaction(); String oats = options.get(OLDEST_ACTIVE_TS_OPT); if (oats != null) { oldestActiveTs = Long.valueOf(oats); } else { String zookeepers = options.get(ZOOKEEPER_CONNECT_OPT); if (zookeepers == null) { throw new IllegalArgumentException("A configuration item for GC iterator was not set"); } oldestActiveTs = ZookeeperUtil.getGcTimestamp(zookeepers); } }

Target:
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { if (env.getIteratorScope() == IteratorScope.scan) { throw new IllegalArgumentException(); } this.source = source; isFullMajc = env.getIteratorScope() == IteratorScope.majc && env.isFullMajorCompaction(); String oats = options.get(GC_TIMESTAMP_OPT); if (oats != null) { gcTimestamp = Long.valueOf(oats); } else { String zookeepers = options.get(ZOOKEEPER_CONNECT_OPT); if (zookeepers == null) { throw new IllegalArgumentException("A configuration item for GC iterator was not set"); } gcTimestamp = ZookeeperUtil.getGcTimestamp(zookeepers); } }
Source:
public static synchronized SparkSession getSessionUnsafe() { SparkSession sessionToUse = sessions.get(); boolean isOlapWorker = Thread.currentThread().getName().startsWith("olap-worker-"); boolean needsReinitialization = !isOlapWorker && (sessionToUse == null || sessionToUse.sparkContext().isStopped()) && (session != null && !session.sparkContext().isStopped()); if (!initialized) { sessionToUse = session = initializeSparkSession(); ctx = new JavaSparkContext(session.sparkContext()); initialized = true; } else if (!needsReinitialization && session.sparkContext().isStopped()) { LOG.warn("SparkContext is stopped, reinitializing..."); try { if (UserGroupInformation.isSecurityEnabled() && UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.getLoginUser().checkTGTAndReloginFromKeytab(); } } catch (IOException e) { throw new RuntimeException(e); } if (isOlapWorker) System.exit(0); sessionToUse = session = initializeSparkSession(); ctx = new JavaSparkContext(session.sparkContext()); } else { if (sessionToUse == null || needsReinitialization) { String allowMultipleContextsString = null; try { allowMultipleContextsString = session.conf().get("spark.driver.allowMultipleContexts"); } catch (NoSuchElementException e) { } boolean allowMultipleContexts = allowMultipleContextsString != null && allowMultipleContextsString.equals("true"); if (session != null && !allowMultipleContexts) sessionToUse = session.newSession(); else sessionToUse = initializeSparkSession(); } } sessions.set(sessionToUse); return sessionToUse; }

Target:
public static synchronized SparkSession getSessionUnsafe() { SparkSession sessionToUse = sessions.get(); boolean isOlapWorker = Thread.currentThread().getName().startsWith("olap-worker-"); boolean needsReinitialization = !isOlapWorker && (sessionToUse == null || sessionToUse.sparkContext().isStopped()) && (session != null && !session.sparkContext().isStopped()); if (!initialized) { sessionToUse = session = initializeSparkSession(); ctx = new JavaSparkContext(session.sparkContext()); initialized = true; } else if (!needsReinitialization && session.sparkContext().isStopped()) { LOG.warn("SparkContext is stopped, reinitializing..."); try { if (UserGroupInformation.isSecurityEnabled() && UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.getLoginUser().checkTGTAndReloginFromKeytab(); } } catch (IOException e) { throw new RuntimeException(e); } if (isOlapWorker) { LOG.error("Olap server's connected to Spark is stopped, shutting down OLAP worker task."); System.exit(0); } sessionToUse = session = initializeSparkSession(); ctx = new JavaSparkContext(session.sparkContext()); } else { if (sessionToUse == null || needsReinitialization) { if (session != null) sessionToUse = session.newSession(); else sessionToUse = initializeSparkSession(); } } sessions.set(sessionToUse); return sessionToUse; }
Source:
public void forceDispatchBlocking() { Thread dispatchThread = null; synchronized (mThreadControl) { mForcedBlocking = true; if (mRunning) { dispatchThread = mDispatchThread; mRetryCounter = 0; mSleepToken.release(); } } if (dispatchThread != null) { try { dispatchThread.join(); } catch (InterruptedException e) { Timber.tag(TAG).i("Interrupted while waiting for dispatch thread to complete"); } } if (!mEventCache.isEmpty()) { synchronized (mThreadControl) { mRunning = true; mSleepToken.release(); } mLoop.run(); } synchronized (mThreadControl) { mForcedBlocking = false; } }

Target:
public void forceDispatchBlocking() { synchronized (mThreadControl) { mForcedBlocking = true; } if (forceDispatch()) { mSleepToken.release(); } Thread dispatchThread = mDispatchThread; if (dispatchThread != null) { try { dispatchThread.join(); } catch (InterruptedException e) { Timber.tag(TAG).d("Interrupted while waiting for dispatch thread to complete"); } } synchronized (mThreadControl) { mForcedBlocking = false; } }
Source:
public CompletableFuture<byte[]> checkpointCoordinator(long checkpointId) throws Exception { ensureStarted(); return CompletableFuture.supplyAsync(() -> { try { LOG.debug("Taking a state snapshot for checkpoint {}", checkpointId); return toBytes(checkpointId); } catch (Exception e) { throw new FlinkRuntimeException("Failed to checkpoint coordinator due to ", e); } }, coordinatorExecutor); }

Target:
public CompletableFuture<byte[]> checkpointCoordinator(long checkpointId) throws Exception { ensureStarted(); return CompletableFuture.supplyAsync(() -> { try { LOG.debug("Taking a state snapshot on operator for checkpoint {}", operatorName, checkpointId); return toBytes(checkpointId); } catch (Exception e) { throw new CompletionException( String.format("Failed to checkpoint coordinator for source %s due to ", operatorName), e); } }, coordinatorExecutor); }
Source:
private GatewaySenderException getInitializeConnectionExceptionToThrow( ServerConnectivityException e) { GatewaySenderException gse = null; if (e.getCause() instanceof GemFireSecurityException) { gse = new GatewaySenderException(e.getCause()); } else { List<ServerLocation> servers = this.sender.getProxy().getCurrentServers(); String ioMsg; if (servers.size() == 0) { ioMsg = "There are no active servers."; } else { final StringBuilder buffer = new StringBuilder(); for (ServerLocation server : servers) { String endpointName = String.valueOf(server); if (buffer.length() > 0) { buffer.append(", "); } buffer.append(endpointName); } ioMsg = String.format( "No available connection was found, but the following active servers exist: %s", buffer.toString()); } if (this.sender.getEnforceThreadsConnectSameReceiver()) { if (Pattern.compile("Cannot get connection to .* after .* attempts.") .matcher(e.getMessage()).find()) { ioMsg += " " + e.getMessage(); } } IOException ex = new IOException(ioMsg); gse = new GatewaySenderException( String.format("%s : Could not connect due to: %s", new Object[] {this.processor.getSender().getId(), ex.getMessage()}), ex); } return gse; }

Target:
private GatewaySenderException getInitializeConnectionExceptionToThrow( ServerConnectivityException e) { GatewaySenderException gse = null; if (e.getCause() instanceof GemFireSecurityException) { gse = new GatewaySenderException(e.getCause()); } else { List<ServerLocationAndMemberId> servers = this.sender.getProxy().getCurrentServers(); String ioMsg; if (servers.size() == 0) { ioMsg = "There are no active servers."; } else { final StringBuilder buffer = new StringBuilder(); for (ServerLocationAndMemberId server : servers) { String endpointName = String.valueOf(server); if (buffer.length() > 0) { buffer.append(", "); } buffer.append(endpointName); } ioMsg = String.format( "No available connection was found, but the following active servers exist: %s", buffer.toString()); } if (this.sender.getEnforceThreadsConnectSameReceiver() && e.getMessage() != null) { if (Pattern.compile(maxAttemptsReachedConnectingServerIdExceptionMessage + ".*") .matcher(e.getMessage()).find()) { ioMsg += " " + e.getMessage(); } } IOException ex = new IOException(ioMsg); gse = new GatewaySenderException( String.format("%s : Could not connect due to: %s", new Object[] {this.processor.getSender().getId(), ex.getMessage()}), ex); } return gse; }
Source:
public TmfTrace() { super(); TmfSignalManager.deregister(this); TmfSignalManager.registerVIP(this); }

Target:
public TmfTrace() { super(); registerAsVip(); }
Source:
public final String handleOnNextValueRendering(Object item) { try { return render(item); } catch (Throwable t) { return item.getClass().getName() + ERROR_IN_RENDERING_SUFFIX; } }

Target:
public final String handleOnNextValueRendering(Object item) { try { return render(item); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { Exceptions.throwIfFatal(t); } return item.getClass().getName() + ERROR_IN_RENDERING_SUFFIX; }
Source:
public final int run(IoExecutionContext context) { int handled = 0; try { int strategy = selectStrategy.calculateStrategy(selectNowSupplier, context.isTaskReady()); switch (strategy) { case SelectStrategy.CONTINUE: return 0 ; case SelectStrategy.BUSY_WAIT: strategy = epollBusyWait(); break; case SelectStrategy.SELECT: strategy = epollWait(context, WAKEN_UP_UPDATER.getAndSet(this, 0) == 1); if (wakenUp == 1) { Native.eventFdWrite(eventFd.intValue(), 1L); } default: } if (strategy > 0) { handled = strategy; processReady(events, strategy); } if (allowGrowing && strategy == events.length()) { events.increase(); } } catch (Throwable t) { handleLoopException(t); } try { if (context.isShuttingDown()) { closeAll(); } } catch (Throwable t) { handleLoopException(t); } return handled; }

Target:
public final int run(IoExecutionContext context) { int handled = 0; try { int strategy = selectStrategy.calculateStrategy(selectNowSupplier, !context.canBlock()); switch (strategy) { case SelectStrategy.CONTINUE: return 0 ; case SelectStrategy.BUSY_WAIT: strategy = epollBusyWait(); break; case SelectStrategy.SELECT: strategy = epollWait(context, WAKEN_UP_UPDATER.getAndSet(this, 0) == 1); if (wakenUp == 1) { Native.eventFdWrite(eventFd.intValue(), 1L); } default: } if (strategy > 0) { handled = strategy; processReady(events, strategy); } if (allowGrowing && strategy == events.length()) { events.increase(); } } catch (Throwable t) { handleLoopException(t); } return handled; }
Source:
static Lookup noLookup() { return node -> { verify(!(node instanceof GroupReference), "Unexpected GroupReference"); return ImmutableList.of(node).stream(); }; }

Target:
static Lookup noLookup() { return node -> { verify(!(node instanceof GroupReference), "Unexpected GroupReference"); return Stream.of(node); }; }
Source:
public TableMetaDataView getTableMetaDataView(RegionMapping regionMapping) { DataSource dataSource = getDataSource(regionMapping.getDataSourceName()); if (dataSource == null) { throw new JdbcConnectorException("No datasource \"" + regionMapping.getDataSourceName() + "\" found when getting table meta data \"" + regionMapping.getRegionName() + "\""); } return getTableMetaDataView(regionMapping, dataSource); }

Target:
public TableMetaDataView getTableMetaDataView(RegionMapping regionMapping) { DataSource dataSource = getDataSource(regionMapping.getDataSourceName()); if (dataSource == null) { throw new JdbcConnectorException("No datasource \"" + regionMapping.getDataSourceName() + "\" found when getting table meta data \"" + regionMapping.getTableName() + "\""); } return getTableMetaDataView(regionMapping, dataSource); }
Source:
protected boolean canModify(ItemStack tool, ItemStack[] input) { NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); if (tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key)) return false; if (Arrays.asList(((ToolCore) tool.getItem()).getTraits()).contains("ammo")) return false; return true; }

Target:
protected boolean canModify(ItemStack tool, ItemStack[] input) { NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); if (tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key)) { return false; } if (Arrays.asList(((ToolCore) tool.getItem()).getTraits()).contains("ammo")) { return false; } return true; }
Source:
public void disconnect(KieServerInfo serverInfo) { if (this.client.isActive()) { this.client.close(); } else { KieServerState currentState = context.getStateRepository().load(KieServerEnvironment.getServerId()); Set<String> controllers = currentState.getControllers(); KieServerConfig config = currentState.getConfiguration(); if (controllers != null && !controllers.isEmpty()) { for (String controllerUrl : controllers) { if (controllerUrl != null && !controllerUrl.isEmpty() && !controllerUrl.toLowerCase().startsWith("ws") || !controllerUrl.toLowerCase().startsWith("wss")) { logger.info("Kie Server points to non websocket controller '{}', using default REST mechanism", controllerUrl); boolean disconnected = restController.disconnectFromSingleController(serverInfo, config, controllerUrl); if (disconnected) { break; } } } } } }

Target:
public void disconnect(KieServerInfo serverInfo) { if (this.client.isActive()) { this.client.close(); } else { KieServerState currentState = context.getStateRepository().load(KieServerEnvironment.getServerId()); Set<String> controllers = currentState.getControllers(); KieServerConfig config = currentState.getConfiguration(); if (controllers != null && !controllers.isEmpty()) { for (String controllerUrl : controllers) { if (controllerUrl != null && !controllerUrl.isEmpty() && !controllerUrl.toLowerCase().startsWith("ws")) { logger.info("Kie Server points to non websocket controller '{}', using default REST mechanism", controllerUrl); boolean disconnected = restController.disconnectFromSingleController(serverInfo, config, controllerUrl); if (disconnected) { break; } } } } } }
Source:
public final void draw(GC gc, ITimeGraphPresentationProvider provider) { Rectangle bounds = getBounds(); if (bounds.width <= 0) { return; } RGBA rgba = getBackgroundColor(); if (rgba != null) { int prevAlpha = gc.getAlpha(); Color prevBgColor = gc.getBackground(); Color prevFgColor = gc.getForeground(); int prevLineWidth = gc.getLineWidth(); gc.setAlpha(rgba.alpha); Color bgColor = TimeGraphControl.getColor(RGBAUtil.fromRGBA(rgba)); gc.setBackground(bgColor); RGBA foregroundColor = getForegroundColor(); if (foregroundColor != null) { Color fgColor = TimeGraphControl.getColor(RGBAUtil.fromRGBA(foregroundColor)); gc.setForeground(fgColor); } if (fLineWidth >= 0) { gc.setLineWidth(fLineWidth); } innerDraw(gc); if (foregroundColor != null) { drawBorder(gc); } gc.setBackground(prevBgColor); gc.setAlpha(prevAlpha); postDraw(provider, gc); gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); } }

Target:
public final void draw(GC gc, ITimeGraphPresentationProvider provider) { Rectangle bounds = getBounds(); if (bounds.width <= 0) { return; } RGBAColor backgroundRgba = getBackgroundColor(); if (backgroundRgba != null) { int prevAlpha = gc.getAlpha(); Color prevBgColor = gc.getBackground(); Color prevFgColor = gc.getForeground(); int prevLineWidth = gc.getLineWidth(); setContext(gc); innerDraw(gc); RGBAColor foregroundRgb = getForegroundColor(); if (foregroundRgb != null) { setContext(gc); drawBorder(gc); } gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); postDraw(provider, gc); gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); } }
Source:
@Override public Object merge( Object parent ) { if (parent == null) { return this; } if (parent instanceof MockHttpServletRequestBuilder) { this.mergeable = (Mergeable) parent; return this.mergeable; } else { throw new IllegalArgumentException("Cannot merge with [" + parent.getClass().getName() + "]"); } }

Target:
public Object merge(Object parent) { if (parent == null) { return this; } if (parent instanceof Mergeable) { this.parent = (Mergeable) parent; return this; } else { throw new IllegalArgumentException("Cannot merge with [" + parent.getClass().getName() + "]"); } }
Source:
public DatasourceInputSplit(@NotNull List<WindowedDataSegment> segments, String[] locations) { Preconditions.checkArgument(segments != null && segments.size() > 0, "no segments"); this.segments = segments; this.locations = locations == null ? new String[0] : locations; }

Target:
public DatasourceInputSplit(@NotNull List<WindowedDataSegment> segments, String[] locations) { Preconditions.checkArgument(segments != null && segments.size() > 0, "no segments"); this.segments = segments; this.locations = locations == null ? EMPTY_STR_ARRAY : locations; }
Source:
public void acquire(GrillSessionHandle sessionHandle) { LOG.info("Acquiring grill session:" + sessionHandle.getPublicId()); getSession(sessionHandle).acquire(); }

Target:
public void acquire(GrillSessionHandle sessionHandle) { LOG.debug("Acquiring grill session:" + sessionHandle.getPublicId()); getSession(sessionHandle).acquire(); }
Source:
public String convert(Object tuple) { try { return writer.writeValueAsString(tuple); } catch (JsonGenerationException | JsonMappingException e) { logger.error("Error while converting tuple ", tuple + " " + e.getMessage()); } catch (IOException e) { DTThrowable.rethrow(e); } return null; }

Target:
public String convert(Object tuple) { try { return writer.writeValueAsString(tuple); } catch (JsonGenerationException | JsonMappingException e) { logger.debug("Error while converting tuple {}",tuple,e.getMessage()); } catch (IOException e) { DTThrowable.rethrow(e); } return null; }
Source:
public void writeTuple(Object obj, String port) { if (windowIdRanges.isEmpty()) { throw new RuntimeException("Data tuples received from tuple recorder before any BEGIN_WINDOW"); } try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Slice f = streamCodec.toByteArray(obj); PortInfo pi = portMap.get(port); String str = "T:" + System.currentTimeMillis() + ":" + pi.id + ":" + f.length + ":"; bos.write(str.getBytes()); bos.write(f.buffer, f.offset, f.length); bos.write("\n".getBytes()); PortCount pc = portCountMap.get(port); pc.count++; portCountMap.put(port, pc); storage.writeDataItem(bos.toByteArray(), true); if (numSubscribers > 0) { publishTupleData(pi.id, obj); } ++totalTupleCount; } catch (Exception ex) { if (shouldLog()) { logger.warn("Error writing tuple {}", obj, ex); } } }

Target:
public void writeTuple(Object obj, String port) { ++totalTupleCount; if (windowIdRanges.isEmpty()) { throw new RuntimeException("Data tuples received from tuple recorder before any BEGIN_WINDOW"); } ByteArrayOutputStream bos = new ByteArrayOutputStream(); Slice f = null; try { f = streamCodec.toByteArray(obj); } catch (RuntimeException ex) { checkLogTuple(ex, "save", obj); return; } try { PortInfo pi = portMap.get(port); String str = "T:" + System.currentTimeMillis() + ":" + pi.id + ":" + f.length + ":"; bos.write(str.getBytes()); bos.write(f.buffer, f.offset, f.length); bos.write("\n".getBytes()); PortCount pc = portCountMap.get(port); pc.count++; portCountMap.put(port, pc); storage.writeDataItem(bos.toByteArray(), true); if (numSubscribers > 0) { publishTupleData(pi.id, obj); } } catch (Exception ex) { logger.warn("Error saving tuple", ex); } }
Source:
protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers("/*").authenticated() .and() .httpBasic(); }

Target:
protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers("/rest/*").authenticated() .and() .httpBasic(); }
Source:
public AsyncAdminBuilder getAdminBuilder() { return new AsyncAdminBuilder() { @Override public AsyncAdminBuilder setStartLogErrorsCnt(int arg0) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdminBuilder setRpcTimeout(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdminBuilder setRetryPause(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdminBuilder setOperationTimeout(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdminBuilder setMaxAttempts(int arg0) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdmin build() { try { return new BigtableAsyncAdmin(BigtableAsyncConnection.this); } catch (IOException e) { LOG.error("failed to build BigtableAsyncAdmin", e); throw new UncheckedIOException("failed to build BigtableAsyncAdmin", e); } } }; }

Target:
public AsyncAdminBuilder getAdminBuilder() { return new AsyncAdminBuilder() { @Override public AsyncAdminBuilder setStartLogErrorsCnt(int arg0) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdminBuilder setRpcTimeout(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setRpcTimeout"); } @Override public AsyncAdminBuilder setRetryPause(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setRetryPause"); } @Override public AsyncAdminBuilder setOperationTimeout(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setOperationTimeout"); } @Override public AsyncAdminBuilder setMaxAttempts(int arg0) { throw new UnsupportedOperationException("setMaxAttempts"); } @Override public AsyncAdmin build() { try { return new BigtableAsyncAdmin(BigtableAsyncConnection.this); } catch (IOException e) { LOG.error("failed to build BigtableAsyncAdmin", e); throw new UncheckedIOException("failed to build BigtableAsyncAdmin", e); } } }; }
Source:
private Set<Artifact> getAllArtifacts(Collection<Artifact> artifacts, Set<Artifact> allArtifacts) { allArtifacts.addAll(artifacts); for (Artifact art : artifacts) { getAllArtifacts(art.getChildren(), allArtifacts); } return allArtifacts; }

Target:
private Set<Artifact> getAllArtifacts(Collection<Artifact> artifacts, Set<Artifact> allArtifacts) { for (Artifact art : artifacts) { if (art.isOnBranch(AtsUtilCore.getAtsBranch())) { allArtifacts.addAll(art.getDescendants()); } } return allArtifacts; }
Source:
public void testTimestampInsert() throws Exception { TestEnv env = new TestEnv(m_catalogJar, m_pathToDeployment, 1, 1, 0); try { env.setUp(); try { String sql = "INSERT INTO TS_CONSTRAINT_EXCEPTION VALUES ('aaa','{}');"; env.m_client.callProcedure("@AdHoc", sql).getResults(); fail("Compilation should have failed."); } catch(ProcCallException e) { String expectedMsg = "Error compiling"; assertTrue(e.getMessage().contains("invalid format for a constant timestamp value")); } String sql = String.format("INSERT INTO TS_CONSTRAINT_EXCEPTION VALUES ('%s','{}');", new TimestampType().toString()); VoltTable modCount = env.m_client.callProcedure("@AdHoc", sql).getResults()[0]; assertEquals(1, modCount.getRowCount()); assertEquals(1, modCount.asScalarLong()); try { modCount = env.m_client.callProcedure("@AdHoc", sql).getResults()[0]; assertEquals(1, modCount.getRowCount()); assertEquals(1, modCount.asScalarLong()); } catch(ProcCallException e) { assertTrue(e.getMessage().contains("CONSTRAINT VIOLATION")); } } finally { env.tearDown(); } }

Target:
public void testTimestampInsert() throws Exception { TestEnv env = new TestEnv(m_catalogJar, m_pathToDeployment, 1, 1, 0); try { env.setUp(); try { String sql = "INSERT INTO TS_CONSTRAINT_EXCEPTION VALUES ('aaa','{}');"; env.m_client.callProcedure("@AdHoc", sql).getResults(); fail("Compilation should have failed."); } catch(ProcCallException e) { assertTrue(e.getMessage().contains("invalid format for a constant timestamp value")); } String sql = String.format("INSERT INTO TS_CONSTRAINT_EXCEPTION VALUES ('%s','{}');", new TimestampType().toString()); VoltTable modCount = env.m_client.callProcedure("@AdHoc", sql).getResults()[0]; assertEquals(1, modCount.getRowCount()); assertEquals(1, modCount.asScalarLong()); try { modCount = env.m_client.callProcedure("@AdHoc", sql).getResults()[0]; assertEquals(1, modCount.getRowCount()); assertEquals(1, modCount.asScalarLong()); } catch(ProcCallException e) { assertTrue(e.getMessage().contains("CONSTRAINT VIOLATION")); } } finally { env.tearDown(); } }
Source:
public Observable<Void> writeFileRegion(FileRegion region) { final ChannelFuture future = writeOnChannel(region); return Observable.create(new OnSubscribe<Void>() { @Override public void call(final Subscriber<? super Void> subscriber) { future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { subscriber.onCompleted(); } else { subscriber.onError(future.cause()); } } }); } }); }

Target:
public void writeFileRegion(FileRegion region) { writeOnChannel(region); }
Source:
private static ConnectorPartitioningMetadata createConnectorPartitioningMetadata(ConnectorId connectorId, PartitioningMetadata partitioningMetadata) { ConnectorId partitioningConnectorId = partitioningMetadata.getPartitioningHandle().getConnectorId() .orElseThrow(() -> new IllegalArgumentException("connectorId is expected to be present in the connector partitioning handle")); checkArgument(connectorId.equals(partitioningConnectorId), "Unexpected partitioning handle connector: %s", partitioningConnectorId); return new ConnectorPartitioningMetadata(partitioningMetadata.getPartitioningHandle().getConnectorHandle(), partitioningMetadata.getPartitionColumns()); }

Target:
private static ConnectorPartitioningMetadata createConnectorPartitioningMetadata(ConnectorId connectorId, PartitioningMetadata partitioningMetadata) { ConnectorId partitioningConnectorId = partitioningMetadata.getPartitioningHandle().getConnectorId() .orElseThrow(() -> new IllegalArgumentException("connectorId is expected to be present in the connector partitioning handle")); checkArgument( connectorId.equals(partitioningConnectorId), "Unexpected partitioning handle connector: %s. Expected: %s.", partitioningConnectorId, connectorId); return new ConnectorPartitioningMetadata(partitioningMetadata.getPartitioningHandle().getConnectorHandle(), partitioningMetadata.getPartitionColumns()); }
Source:
public void prePersistStatus() { status = QueryStatus.QUEUED; if (id == null || id.isEmpty() || id.equalsIgnoreCase("string")) { id = UUID.randomUUID().toString(); } }

Target:
public void prePersistStatus() { status = QueryStatus.QUEUED; if (id == null || id.isEmpty()) { id = UUID.randomUUID().toString(); } }
Source:
public void testCompanionAdVanish() throws Exception { Log.v(TAG, "Beginning testCompanionAdVanish"); super.playVideo(); Log.v(TAG, "Prerolls..."); toCompanionAdCheck(5000); assertFalse("Companion ad still present after preroll ad break.", toEndOfAdCheck()); Log.v(TAG, "Midrolls..."); toCompanionAdCheck(35000); assertFalse("Companion ad still present after midroll ad break.", toEndOfAdCheck()); Log.v(TAG, "Postrolls..."); toCompanionAdCheck(112000); assertFalse("Companion ad still present after postroll ad break.", toEndOfAdCheck()); Log.v(TAG, "Finished testCompanionAdVanish"); }

Target:
public void testCompanionAdVanish() throws Exception { Log.v(TAG, "Beginning testCompanionAdVanish"); super.playVideo(); Log.v(TAG, "Prerolls..."); waitForCompanionAdCheck(msecToPreroll, ADTYPE_PREROLL); assertFalse("Companion ad still present after preroll ad break.", waitForEndOfAdCheck(ADTYPE_PREROLL)); Log.v(TAG, "Midrolls..."); waitForCompanionAdCheck(msecToMidroll, ADTYPE_MIDROLL); assertFalse("Companion ad still present after midroll ad break.", waitForEndOfAdCheck(ADTYPE_MIDROLL)); Log.v(TAG, "Postrolls..."); waitForCompanionAdCheck(msecToPostroll, ADTYPE_POSTROLL); assertFalse("Companion ad still present after postroll ad break.", waitForEndOfAdCheck(ADTYPE_POSTROLL)); Log.v(TAG, "Finished testCompanionAdVanish"); }
Source:
public void registerSuite(Suite s) { installedSuites.add(s); }

Target:
public void registerSuite(Suite s) { installedSuites.addElement(s); }
Source:
public void replicatorBuilderAddsCookieInterceptorDefaultPort() throws Exception { ReplicatorBuilder.Pull p = ReplicatorBuilder.pull(). from(new URI("http://🍶:🍶@some-host/path%2Fsome-path-日本")). to(datastore); BasicReplicator r = (BasicReplicator)p.build(); Assert.assertEquals("http://some-host:80/path%2Fsome-path-日本", (((CouchClientWrapper)(((BasicPullStrategy)r.strategy).sourceDb)). getCouchClient(). getRootUri()). toString() ); Field reqIField = ReplicatorBuilder.class.getDeclaredField("requestInterceptors"); Field respIField = ReplicatorBuilder.class.getDeclaredField("responseInterceptors"); reqIField.setAccessible(true); respIField.setAccessible(true); List<HttpConnectionRequestInterceptor> reqIList = (List)reqIField.get(p); List<HttpConnectionRequestInterceptor> respIList = (List)respIField.get(p); Assert.assertEquals(1, reqIList.size()); Assert.assertEquals(CookieInterceptor.class, reqIList.get(0).getClass()); Assert.assertEquals(1, respIList.size()); Assert.assertEquals(CookieInterceptor.class, respIList.get(0).getClass()); CookieInterceptor ci = (CookieInterceptor)reqIList.get(0); Field srbField = CookieInterceptor.class.getDeclaredField("sessionRequestBody"); srbField.setAccessible(true); byte[] srb = (byte[])srbField.get(ci); String srbString = new String(srb); Assert.assertEquals("name=%F0%9F%8D%B6&password=%F0%9F%8D%B6", srbString); }

Target:
public void replicatorBuilderAddsCookieInterceptorDefaultPort() throws Exception { ReplicatorBuilder.Pull p = ReplicatorBuilder.pull(). from(new URI("http://🍶:🍶@some-host/path%2Fsome-path-日本")). to(datastore); BasicReplicator r = (BasicReplicator)p.build(); Assert.assertEquals("http://some-host:80/path%2Fsome-path-日本", (((CouchClientWrapper) (((BasicPullStrategy) r.strategy).sourceDb)). getCouchClient(). getRootUri()). toString() ); assertCookieInterceptorPresent(p, "name=%F0%9F%8D%B6&password=%F0%9F%8D%B6"); }
Source:
public static OpcUaRequestInfo extract(DriverRecord record) { final Map<String, Object> channelConfig = record.getChannelConfig(); int nodeNamespaceIndex; String nodeId; try { nodeId = channelConfig.get(NODE_ID).toString(); } catch (final Exception e) { fail(record, message.errorRetrievingNodeId()); return null; } try { nodeNamespaceIndex = Integer.parseInt(channelConfig.get(NODE_NAMESPACE_INDEX).toString()); } catch (final Exception e) { fail(record, message.errorRetrievingNodeNamespace()); return null; } final DataType dataType = (DataType) record.getChannelConfig().get(CHANNEL_VALUE_TYPE.value()); if (dataType == null) { fail(record, message.errorRetrievingValueType()); return null; } return new OpcUaRequestInfo(dataType, nodeNamespaceIndex, nodeId); }

Target:
public static Optional<OpcUaRequestInfo> extract(DriverRecord record) { final Map<String, Object> channelConfig = record.getChannelConfig(); int nodeNamespaceIndex; String nodeId; try { nodeId = channelConfig.get(NODE_ID).toString(); } catch (final Exception e) { fail(record, message.errorRetrievingNodeId()); return Optional.empty(); } try { nodeNamespaceIndex = Integer.parseInt(channelConfig.get(NODE_NAMESPACE_INDEX).toString()); } catch (final Exception e) { fail(record, message.errorRetrievingNodeNamespace()); return Optional.empty(); } final DataType dataType = (DataType) channelConfig.get(CHANNEL_VALUE_TYPE.value()); if (dataType == null) { fail(record, message.errorRetrievingValueType()); return Optional.empty(); } return Optional.of(new OpcUaRequestInfo(dataType, nodeNamespaceIndex, nodeId)); }
Source:
protected Object doTransform(Message<?> message) { MessageHeaders headers = message.getHeaders(); boolean removeHeaders = false; ResolvableType valueType = obtainResolvableTypeFromHeadersIfAny(headers); if (valueType != null) { removeHeaders = true; } else { valueType = this.targetType; } Object result; try { result = this.jsonObjectMapper.fromJson(message.getPayload(), valueType); } catch (IOException e) { throw new UncheckedIOException(e); } if (removeHeaders) { return getMessageBuilderFactory() .withPayload(result) .copyHeaders(headers) .removeHeaders(JsonHeaders.HEADERS.toArray(new String[3])) .build(); } else { return result; } }

Target:
protected Object doTransform(Message<?> message) { MessageHeaders headers = message.getHeaders(); boolean removeHeaders = false; ResolvableType valueType = obtainResolvableTypeFromHeadersIfAny(headers); if (valueType != null) { removeHeaders = true; } else { valueType = this.targetType; } Object result; try { result = this.jsonObjectMapper.fromJson(message.getPayload(), valueType); } catch (IOException e) { throw new UncheckedIOException(e); } if (removeHeaders) { return getMessageBuilderFactory() .withPayload(result) .copyHeaders(headers) .removeHeaders(JsonHeaders.HEADERS.toArray(new String[0])) .build(); } else { return result; } }