auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static void doPrompt(boolean newStatement, LocalizedOutput out, String tag) { final SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); String clock = showPromptClock ? " " + sdf.format(new Timestamp(System.currentTimeMillis())) : ""; if (newStatement) { out.print("splice" + clock + "> "); } else { out.print(clock + "> "); } out.flush(); }

Target:
static void doPrompt(boolean newStatement, LocalizedOutput out, String tag) { final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZZZZ"); String clock = showPromptClock ? " " + sdf.format(new Timestamp(System.currentTimeMillis())) : ""; if (newStatement) { out.print("splice" + clock + "> "); } else { out.print(clock + "> "); } out.flush(); }
Source:
public void testInterleaveNoDuplicateCells() throws IOException { String rowKeyPrefix = dataHelper.randomString("interleave-no-dups-"); byte[] qualA = dataHelper.randomData("interleave-no-dups-qual"); Table table = addDataForTesting(rowKeyPrefix, qualA); ColumnPrefixFilter prefixFilter = new ColumnPrefixFilter(Bytes.toBytes("interleave-no-dups-qual")); FilterList filterList = new FilterList( Operator.MUST_PASS_ONE, new QualifierFilter(CompareOp.EQUAL, new BinaryComparator(qualA)), prefixFilter); Scan scan = new Scan(Bytes.toBytes(rowKeyPrefix)); scan.setFilter(filterList); try (ResultScanner scanner = table.getScanner(scan)) { Iterator<Result> iterator = scanner.iterator(); while (iterator.hasNext()) { Assert.assertEquals(1, iterator.next().getColumnCells(COLUMN_FAMILY, qualA).size()); } } }

Target:
public void testInterleaveNoDuplicateCells() throws IOException { String rowKeyPrefix = dataHelper.randomString("interleave-no-dups-"); byte[] qualA = dataHelper.randomData("interleave-no-dups-qual"); Table table = addDataForTesting(rowKeyPrefix, qualA); ColumnPrefixFilter prefixFilter = new ColumnPrefixFilter(Bytes.toBytes("interleave-no-dups-qual")); FilterList filterList = new FilterList( Operator.MUST_PASS_ONE, new QualifierFilter(CompareOp.EQUAL, new BinaryComparator(qualA)), prefixFilter); Scan scan = new Scan(Bytes.toBytes(rowKeyPrefix)); scan.setFilter(filterList); try (ResultScanner scanner = table.getScanner(scan)) { for (Result result: scanner) { Assert.assertEquals(1, result.getColumnCells(COLUMN_FAMILY, qualA).size()); } } }
Source:
private Event parseEvent(String eventName) throws TypeImportException, XMLStreamException { Event e = LibraryElementFactory.eINSTANCE.createEvent(); e.setType(EventTypeLibrary.getInstance().getType(null)); readNameCommentAttributes(e); List<String> withVars = new ArrayList<>(); processChildren(eventName, name -> { if (name.equals(LibraryElementTags.WITH_ELEMENT)) { String val = getAttributeValue(LibraryElementTags.VAR_ATTRIBUTE); if (null != val) { withVars.add(val); } proceedToEndElementNamed(LibraryElementTags.WITH_ELEMENT); return true; } return false; }); if (!withVars.isEmpty()) { withList.put(e, withVars); } return e; }

Target:
private Event parseEvent(String eventName) throws TypeImportException, XMLStreamException { Event e = LibraryElementFactory.eINSTANCE.createEvent(); e.setType(EventTypeLibrary.getInstance().getType(null)); readNameCommentAttributes(e); List<String> withVars = new ArrayList<>(); processChildren(eventName, name -> { if (LibraryElementTags.WITH_ELEMENT.equals(name)) { String val = getAttributeValue(LibraryElementTags.VAR_ATTRIBUTE); if (null != val) { withVars.add(val); } proceedToEndElementNamed(LibraryElementTags.WITH_ELEMENT); return true; } return false; }); if (!withVars.isEmpty()) { withList.put(e, withVars); } return e; }
Source:
public String serialize(Object object, SerializerEncoding encoding) throws IOException { final String contents = jacksonAdapter.serialize(object, encoding); final Class<?> clazz = object.getClass(); if (!CreateQueueBody.class.equals(clazz) && !CreateRuleBody.class.equals(clazz) && !CreateSubscriptionBody.class.equals(clazz)) { return contents; } final Matcher namespaceMatcher = NAMESPACE_PATTERN.matcher(contents); if (!namespaceMatcher.find()) { logger.info("Could not find in {}", NAMESPACE_PATTERN.pattern(), contents); return contents; } final String namespace = namespaceMatcher.group("namespace"); final String replaced = contents .replaceAll(namespace + ":", "") .replace("xmlns:" + namespace + "=", "xmlns="); if (!CreateRuleBody.class.equals(clazz)) { return replaced; } final Matcher filterType = FILTER_ACTION_PATTERN.matcher(replaced); if (filterType.find()) { return filterType.replaceAll("<$1 xmlns:ns0=\"<LINK_0>\" ns0:type="); } else { logger.info("Could not find filter name pattern '{}' in {}.", FILTER_ACTION_PATTERN.pattern(), contents); return replaced; } }

Target:
public String serialize(Object object, SerializerEncoding encoding) throws IOException { final String contents = jacksonAdapter.serialize(object, encoding); final Class<?> clazz = object.getClass(); if (!CreateQueueBody.class.equals(clazz) && !CreateRuleBody.class.equals(clazz) && !CreateSubscriptionBody.class.equals(clazz)) { return contents; } final Matcher namespaceMatcher = NAMESPACE_PATTERN.matcher(contents); if (!namespaceMatcher.find()) { logger.warning("Could not find in {}", NAMESPACE_PATTERN.pattern(), contents); return contents; } final String namespace = namespaceMatcher.group("namespace"); final String replaced = contents .replaceAll(namespace + ":", "") .replace("xmlns:" + namespace + "=", "xmlns="); if (!CreateRuleBody.class.equals(clazz)) { return replaced; } final Matcher filterType = FILTER_ACTION_PATTERN.matcher(replaced); if (filterType.find()) { return filterType.replaceAll("<$1 xmlns:ns0=\"<LINK_0>\" ns0:type="); } else { logger.warning("Could not find filter name pattern '{}' in {}.", FILTER_ACTION_PATTERN.pattern(), contents); return replaced; } }
Source:
public void updateVisibility(IEclipseContext context) { ExpressionContext exprContext = new ExpressionContext(context); updateIsVisible(exprContext); HashSet<ToolBarContributionRecord> recentlyUpdated = new HashSet<>(); recentlyUpdated.add(this); boolean changed = false; for (MToolBarElement item : generatedElements) { boolean currentVisibility = computeVisibility(recentlyUpdated, item, exprContext); if (item.isVisible() != currentVisibility) { item.setVisible(currentVisibility); changed = true; } } for (MToolBarElement item : sharedElements) { boolean currentVisibility = computeVisibility(recentlyUpdated, item, exprContext); if (item.isVisible() != currentVisibility) { item.setVisible(currentVisibility); changed = true; } } if (changed) { ToolBarManager managerForModel = getManagerForModel(); managerForModel.markDirty(); if (isVisible) { Stream.of(managerForModel.getItems()).filter(org.eclipse.jface.action.IContributionItem::isVisible).findFirst().ifPresent(i -> { MWindow window = getWindow(); if (window != null) { Object widget = window.getWidget(); if (widget instanceof Shell) { ((Shell) widget).requestLayout(); } } }); } } }

Target:
public void updateVisibility(IEclipseContext context) { ExpressionContext exprContext = new ExpressionContext(context); updateIsVisible(exprContext); HashSet<ToolBarContributionRecord> recentlyUpdated = new HashSet<>(); recentlyUpdated.add(this); boolean changed = false; for (MToolBarElement item : generatedElements) { boolean currentVisibility = computeVisibility(recentlyUpdated, item, exprContext); if (item.isVisible() != currentVisibility) { item.setVisible(currentVisibility); changed = true; } } for (MToolBarElement item : sharedElements) { boolean currentVisibility = computeVisibility(recentlyUpdated, item, exprContext); if (item.isVisible() != currentVisibility) { item.setVisible(currentVisibility); changed = true; } } if (!changed) { return; } ToolBarManager managerForModel = getManagerForModel(); managerForModel.markDirty(); if (!isVisible) { return; } boolean anyMatch = Stream.of(managerForModel.getItems()).anyMatch(IContributionItem::isVisible); if (anyMatch) { MWindow window = getWindow(); if (window != null) { Object widget = window.getWidget(); if (widget instanceof Shell) { ((Shell) widget).requestLayout(); } } } }
Source:
private static String getUnsupportedType(String component, String[] supportedTypes, Map<String, String> typeMapping) { String componentType = typeMapping.get(component); if (component == null || componentType == null) { return null; } for (String okayType: supportedTypes) { if (okayType.equalsIgnoreCase(componentType)) { return null; } } return componentType; }

Target:
private static String getUnsupportedType(String component, String[] supportedTypes, Map<String, String> typeMapping) { if (component == null) { return null; } String componentType = typeMapping.get(component); if (componentType == null) { return null; } for (String okayType: supportedTypes) { if (okayType.equalsIgnoreCase(componentType)) { return null; } } return componentType; }
Source:
public void stopGracefully() { log.info("Stopping gracefully."); publishOnStop = true; stopping = true; if (paused) { try { resume(); } catch (InterruptedException e) { log.error(e, "Thread interrupted while trying to stop gracefully"); } } }

Target:
public void stopGracefully() { log.info("Stopping gracefully."); stopRequested = true; if (runThread.isAlive()) { log.info("Interrupting run thread (status: [%s])", status); runThread.interrupt(); } }
Source:
public void receive(String combinedEndpointId, String message) { checkNotNull(combinedEndpointId, "Endpoint ID must not be null"); checkArgument(!combinedEndpointId.isEmpty(), "Endpoint ID name must not be empty"); checkNotNull(message, "Message must not be null"); checkArgument(!message.isEmpty(), "Message must not be empty"); LOGGER.debug("Receiving message: " + message + ", from endpoint: " + combinedEndpointId); if (!jsonRpcQualifier.isValidJson(message)) { String error = "An error occurred on the server while parsing the JSON text"; errorTransmitter.transmit(combinedEndpointId, new JsonRpcException(-32700, error)); } List<String> messages = jsonRpcUnmarshaller.unmarshalArray(message); for (String innerMessage : messages) { if (jsonRpcQualifier.isJsonRpcRequest(innerMessage)) { String endpointId = combinedEndpointId.split("<-:->")[1]; ProcessRequestTask task = new ProcessRequestTask(combinedEndpointId, innerMessage); requestProcessor.process(endpointId, task); } else if (jsonRpcQualifier.isJsonRpcResponse(innerMessage)) { processResponse(combinedEndpointId, innerMessage); } else { processError(); } } }

Target:
public void receive(String combinedEndpointId, String message) { checkNotNull(combinedEndpointId, "Endpoint ID must not be null"); checkArgument(!combinedEndpointId.isEmpty(), "Endpoint ID name must not be empty"); checkNotNull(message, "Message must not be null"); checkArgument(!message.isEmpty(), "Message must not be empty"); LOGGER.debug("Receiving message: " + message + ", from endpoint: " + combinedEndpointId); if (!jsonRpcQualifier.isValidJson(message)) { String error = "An error occurred on the server while parsing the JSON text"; errorTransmitter.transmit(combinedEndpointId, new JsonRpcException(-32700, error)); } List<String> messages = jsonRpcUnmarshaller.unmarshalArray(message); for (String innerMessage : messages) { if (jsonRpcQualifier.isJsonRpcRequest(innerMessage)) { String endpointId = combinedEndpointId.split(SEPARATOR)[1]; ProcessRequestTask task = new ProcessRequestTask(combinedEndpointId, innerMessage); requestProcessor.process(endpointId, task); } else if (jsonRpcQualifier.isJsonRpcResponse(innerMessage)) { processResponse(combinedEndpointId, innerMessage); } else { processError(); } } }
Source:
private static Map<Integer, KeyCodeCombination> populateJumpToNthIssueMap() { Map<Integer, KeyCodeCombination> result = Collections.unmodifiableMap(new HashMap<>()); result.put(1, new KeyCodeCombination(KeyCode.DIGIT1, KeyCombination.CONTROL_DOWN)); result.put(2, new KeyCodeCombination(KeyCode.DIGIT2, KeyCombination.CONTROL_DOWN)); result.put(3, new KeyCodeCombination(KeyCode.DIGIT3, KeyCombination.CONTROL_DOWN)); result.put(4, new KeyCodeCombination(KeyCode.DIGIT4, KeyCombination.CONTROL_DOWN)); result.put(5, new KeyCodeCombination(KeyCode.DIGIT5, KeyCombination.CONTROL_DOWN)); result.put(6, new KeyCodeCombination(KeyCode.DIGIT6, KeyCombination.CONTROL_DOWN)); result.put(7, new KeyCodeCombination(KeyCode.DIGIT7, KeyCombination.CONTROL_DOWN)); result.put(8, new KeyCodeCombination(KeyCode.DIGIT8, KeyCombination.CONTROL_DOWN)); result.put(9, new KeyCodeCombination(KeyCode.DIGIT9, KeyCombination.CONTROL_DOWN)); return result; }

Target:
private static Map<Integer, KeyCodeCombination> populateJumpToNthIssueMap() { Map<Integer, KeyCodeCombination> result = new HashMap<>(); result.put(1, new KeyCodeCombination(KeyCode.DIGIT1, KeyCombination.CONTROL_DOWN)); result.put(2, new KeyCodeCombination(KeyCode.DIGIT2, KeyCombination.CONTROL_DOWN)); result.put(3, new KeyCodeCombination(KeyCode.DIGIT3, KeyCombination.CONTROL_DOWN)); result.put(4, new KeyCodeCombination(KeyCode.DIGIT4, KeyCombination.CONTROL_DOWN)); result.put(5, new KeyCodeCombination(KeyCode.DIGIT5, KeyCombination.CONTROL_DOWN)); result.put(6, new KeyCodeCombination(KeyCode.DIGIT6, KeyCombination.CONTROL_DOWN)); result.put(7, new KeyCodeCombination(KeyCode.DIGIT7, KeyCombination.CONTROL_DOWN)); result.put(8, new KeyCodeCombination(KeyCode.DIGIT8, KeyCombination.CONTROL_DOWN)); result.put(9, new KeyCodeCombination(KeyCode.DIGIT9, KeyCombination.CONTROL_DOWN)); return Collections.unmodifiableMap(result); }
Source:
private long copyHeadAndBody(String filePath) { long linesInBody = 0; try { headFile = File.createTempFile("headFile", ".gz"); bodyFile = File.createTempFile("headFile", ".gz"); } catch (IOException e) { throw new RuntimeException("Error creating file", e); } try (Writer head = getOutputStreamWriter(headFile); Writer body = getOutputStreamWriter(bodyFile); Scanner scanner = new Scanner(new GZIPInputStream(new FileInputStream(filePath)))) { while (scanner.hasNextLine() && linesInBody < MAX_NUMBER_OF_LINES) { String line = scanner.nextLine(); if (line.startsWith(HEADER_PREFIX)) { head.write(line); head.write("\n"); } else { linesInBody++; body.write(line); body.write("\n"); } } } catch (IOException e) { throw new RuntimeException("Error writing to file", e); } return linesInBody; }

Target:
private long copyHeadAndBody(String filePath) { long linesInBody = 0; try { headFile = File.createTempFile("headFile", ".gz"); bodyFile = File.createTempFile("bodyFile", ".gz"); } catch (IOException e) { throw new RuntimeException("Error creating file", e); } try (Writer head = getOutputStreamWriter(headFile); Writer body = getOutputStreamWriter(bodyFile); Scanner scanner = new Scanner(new GZIPInputStream(new FileInputStream(filePath)))) { while (scanner.hasNextLine() && linesInBody < MAX_NUMBER_OF_LINES) { String line = scanner.nextLine(); if (line.startsWith(HEADER_PREFIX)) { head.write(line); head.write("\n"); } else { linesInBody++; body.write(line); body.write("\n"); } } } catch (IOException e) { throw new RuntimeException("Error writing to file", e); } return linesInBody; }
Source:
Map<String, List<PartitionInfo>> getTopicMetadata(Set<String> topics) { final Map<String, List<PartitionInfo>> listPartitionsInfo = new HashMap(); List<PartitionInfo> l; for (String topic : topics) { l = metadataConsumer.partitionsFor(topic); listPartitionsInfo.put(topic, l); } return listPartitionsInfo; }

Target:
Map<String, List<PartitionInfo>> getTopicMetadata(Set<String> topics) { Map<String, List<PartitionInfo>> streamToPartitionsInfo = new HashMap(); List<PartitionInfo> partitionInfoList; for (String topic : topics) { partitionInfoList = metadataConsumer.partitionsFor(topic); streamToPartitionsInfo.put(topic, partitionInfoList); } return streamToPartitionsInfo; }
Source:
private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, FileStatus[] mountPointStatuses) { ArrayList<FileStatus> result = new ArrayList<>(); Set<String> pathSet = new HashSet<>(); int i = 0; for (FileStatus status : mountPointStatuses) { result.add(status); pathSet.add(status.getPath().getName()); } for (FileStatus status : fallbackStatuses) { if (!pathSet.contains(status.getPath().getName())) { result.add(status); } } return result.toArray(new FileStatus[0]); }

Target:
private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, FileStatus[] mountPointStatuses) { ArrayList<FileStatus> result = new ArrayList<>(); Set<String> pathSet = new HashSet<>(); for (FileStatus status : mountPointStatuses) { result.add(status); pathSet.add(status.getPath().getName()); } for (FileStatus status : fallbackStatuses) { if (!pathSet.contains(status.getPath().getName())) { result.add(status); } } return result.toArray(new FileStatus[0]); }
Source:
private static DataType<byte[]> byteaDataType() { return DataType.dataType( "bytea", VARBINARY, bytes -> format("bytea E'\\\\x%s'", base16().encode(requireNonNull(bytes, "bytes is null"))), Function.identity()); }

Target:
private static DataType<byte[]> byteaDataType() { return DataType.dataType( "bytea", VARBINARY, bytes -> format("bytea E'\\\\x%s'", base16().encode(bytes)), Function.identity()); }
Source:
public List<Order> getOrderHistoryByOrderNumber(String orderNumber) { Order initial = getOrderByOrderNumber(orderNumber); String workNumber = initial.getPreviousOrderNumber(); List<Order> previousOrders = new ArrayList<Order>(); while (workNumber != null) { Order previous = getOrderByOrderNumber(workNumber); previousOrders.add(0, previous); workNumber = previous.getPreviousOrderNumber(); } Order nextOrder = null; workNumber = orderNumber; List<Order> nextOrders = new ArrayList<Order>(); do { Criteria searchCriteria = sessionFactory.getCurrentSession().createCriteria(Order.class, "order"); searchCriteria.add(Restrictions.eq("order.previousOrderNumber", workNumber)); nextOrder = (Order) searchCriteria.uniqueResult(); if (nextOrder != null) { nextOrders.add(nextOrder); workNumber = nextOrder.getOrderNumber(); } } while (nextOrder != null); List<Order> result = new ArrayList<Order>(previousOrders); result.add(initial); result.addAll(nextOrders); return result; }

Target:
public List<Order> getOrderHistoryByOrderNumber(String orderNumber) { Order initial = getOrderByOrderNumber(orderNumber); String workNumber = initial.getPreviousOrderNumber(); LinkedList<Order> previousOrders = new LinkedList<Order>(); while (workNumber != null) { Order previous = getOrderByOrderNumber(workNumber); previousOrders.addFirst(previous); workNumber = previous.getPreviousOrderNumber(); } Order nextOrder = null; workNumber = orderNumber; List<Order> nextOrders = new ArrayList<Order>(); do { Criteria searchCriteria = sessionFactory.getCurrentSession().createCriteria(Order.class, "order"); searchCriteria.add(Restrictions.eq("order.previousOrderNumber", workNumber)); nextOrder = (Order) searchCriteria.uniqueResult(); if (nextOrder != null) { nextOrders.add(nextOrder); workNumber = nextOrder.getOrderNumber(); } } while (nextOrder != null); List<Order> result = previousOrders; result.add(initial); result.addAll(nextOrders); return result; }
Source:
public Map<String, DbParameterAccessor> getAllColumns(String tableOrViewName) throws SQLException { String objectDatabaseName = ""; String[] objnameParts = tableOrViewName.split("\\."); if (objnameParts.length == 3) { objectDatabaseName = objnameParts[0] + "."; } String qry = " select c.[name], TYPE_NAME(c.system_type_id) as [Type], c.max_length, " + " 0 As is_output, 0 As is_cursor_ref " + " from " + objectDatabaseName + "sys.columns c " + " where c.object_id = OBJECT_ID(?) " + " order by column_id"; return readIntoParams(tableOrViewName, qry); }

Target:
public Map<String, DbParameterAccessor> getAllColumns(String tableOrViewName) throws SQLException { String qry = " select c.[name], TYPE_NAME(c.system_type_id) as [Type], c.max_length, " + " 0 As is_output, 0 As is_cursor_ref " + " from " + objectDatabasePrefix(tableOrViewName) + "sys.columns c " + " where c.object_id = OBJECT_ID(?) " + " order by column_id"; return readIntoParams(tableOrViewName, qry); }
Source:
public Observable<List<Comment>> getComments(final News news) { return Observable.from(news.getCommentIds()) .flatMap(new Func1<Integer, Observable<Comment>>() { @Override public Observable<Comment> call(Integer commentId) { return RestClient.service().getComment(commentId) .onErrorReturn(new Func1<Throwable, Comment>() { @Override public Comment call(Throwable throwable) { return null; } }); } }) .flatMap(new Func1<Comment, Observable<Comment>>() { @Override public Observable<Comment> call(Comment comment) { return getInnerComments(comment); } }) .timeout(10, TimeUnit.SECONDS) .filter(new Func1<Comment, Boolean>() { @Override public Boolean call(Comment comment) { return (comment != null) && !comment.isDeleted() && !comment.isDead(); } }) .toList() .map(new Func1<List<Comment>, List<Comment>>() { @Override public List<Comment> call(List<Comment> comments) { Dictionary<Integer, Comment> commentDict = new Hashtable<>(); List<Comment> retval = new ArrayList<>(); for (Comment comment : comments) { commentDict.put(comment.getId(), comment); } for (Integer commentId : news.getCommentIds()) { Comment comment = commentDict.get(commentId); if (comment != null) { retval.add(getCommentWithChild(0, comment, commentDict)); } } return flattenComments(retval); } }) .map(new Func1<List<Comment>, List<Comment>>() { @Override public List<Comment> call(List<Comment> comments) { for (Comment comment : comments) { comment.setAllChildCount(getAllChildCount(comment)); } return comments; } }); }

Target:
public Observable<List<Comment>> getComments(final News news) { return Observable.from(news.getCommentIds()) .flatMap(new Func1<Integer, Observable<Comment>>() { @Override public Observable<Comment> call(Integer commentId) { return RestClient.service().getComment(commentId) .onErrorReturn(new Func1<Throwable, Comment>() { @Override public Comment call(Throwable throwable) { return null; } }); } }) .flatMap(new Func1<Comment, Observable<Comment>>() { @Override public Observable<Comment> call(Comment comment) { return getInnerComments(comment); } }) .timeout(Constants.CONN_TIMEOUT_SEC, TimeUnit.SECONDS) .filter(new Func1<Comment, Boolean>() { @Override public Boolean call(Comment comment) { return (comment != null) && !comment.isDeleted() && !comment.isDead(); } }) .toList() .map(new Func1<List<Comment>, List<Comment>>() { @Override public List<Comment> call(List<Comment> comments) { Dictionary<Integer, Comment> commentDict = new Hashtable<>(); List<Comment> retval = new ArrayList<>(); for (Comment comment : comments) { commentDict.put(comment.getId(), comment); } for (Integer commentId : news.getCommentIds()) { Comment comment = commentDict.get(commentId); if (comment != null) { retval.add(getCommentWithChild(0, comment, commentDict)); } } return flattenComments(retval); } }) .map(new Func1<List<Comment>, List<Comment>>() { @Override public List<Comment> call(List<Comment> comments) { for (Comment comment : comments) { comment.setAllChildCount(getAllChildCount(comment)); } return comments; } }); }
Source:
private void setUpClusterArtifacts(Topology topology, TopologyActions topologyActions) throws IOException { Namespace namespace = getNamespace(topology.getNamespaceId()); if (namespace == null) { throw new RuntimeException("Corresponding namespace not found: " + topology.getNamespaceId()); } ObjectMapper objectMapper = new ObjectMapper(); Path artifactsDir = topologyActions.getArtifactsLocation(getTopologyLayout(topology)); makeEmptyDir(artifactsDir); Collection<NamespaceServiceClusterMapping> serviceClusterMappings = listServiceClusterMapping(namespace.getId()); serviceClusterMappings.stream() .map(x -> getServiceByName(x.getClusterId(), x.getServiceName())) .filter(Objects::nonNull) .flatMap((Service x) -> Optional.ofNullable(listServiceConfigurations(x.getId())) .orElse(Collections.emptyList()).stream()) .forEach(x -> { try { writeConfigurationFile(objectMapper, artifactsDir, x); } catch (IOException e) { throw new RuntimeException(e); } }); }

Target:
private void setUpClusterArtifacts(Topology topology, TopologyActions topologyActions) throws IOException { Namespace namespace = getNamespace(topology.getNamespaceId()); if (namespace == null) { throw new RuntimeException("Corresponding namespace not found: " + topology.getNamespaceId()); } ObjectMapper objectMapper = new ObjectMapper(); Path artifactsDir = topologyActions.getArtifactsLocation(getTopologyLayout(topology)); makeEmptyDir(artifactsDir); Collection<NamespaceServiceClusterMapping> serviceClusterMappings = listServiceClusterMapping(namespace.getId()); for (NamespaceServiceClusterMapping serviceClusterMapping : serviceClusterMappings) { Service service = getServiceByName(serviceClusterMapping.getClusterId(), serviceClusterMapping.getServiceName()); if (service != null) { Collection<ServiceConfiguration> serviceConfigurations = listServiceConfigurations(service.getId()); if (serviceConfigurations != null) { for (ServiceConfiguration serviceConfiguration : serviceConfigurations) { writeConfigurationFile(objectMapper, artifactsDir, serviceConfiguration); } } } } }
Source:
public Optional<ZombieType> getById(String id) { return Optional.ofNullable(types.get(id)); }

Target:
public Optional<ZombieType> getById(String id) { if (!id.contains(":")) { id = "minecraft:" + id; } return Optional.ofNullable(types.get(id)); }
Source:
private ActionListener createJdbcActionListener(final String databaseName) { return new ActionListener() { @Override public void actionPerformed(ActionEvent event) { Injector injectorWithDatastore = _dcModule.createInjectorBuilder().with(JdbcDatastore.class, null) .createInjector(); JdbcDatastoreDialog dialog = injectorWithDatastore.getInstance(JdbcDatastoreDialog.class); dialog.setSelectedDatabase(databaseName); dialog.setVisible(true); } }; }

Target:
private ActionListener createJdbcActionListener(final String databaseName) { return new ActionListener() { @Override public void actionPerformed(ActionEvent event) { final Injector injectorWithDatastore = _dcModule.createInjectorBuilder().with(JdbcDatastore.class, null) .createInjector(); final JdbcDatastoreDialog dialog = injectorWithDatastore.getInstance(JdbcDatastoreDialog.class); dialog.setSelectedDatabase(databaseName); dialog.setVisible(true); } }; }
Source:
public PayloadIterator(InputStream input, ContentMetadata meta) { this.input = checkNotNull(input, "input"); this.metaData = checkNotNull(meta, "meta"); this.readLen = this.metaData.getContentLength().intValue(); this.nextPayload = getNextPayload(); }

Target:
public PayloadIterator(InputStream input, ContentMetadata meta) { this.input = checkNotNull(input, "input"); this.metaData = checkNotNull(meta, "meta"); this.readLen = checkNotNull(this.metaData.getContentLength(), "content-length").intValue(); this.nextPayload = getNextPayload(); }
Source:
public <T> List<T> getNextPages() { return (List<T>) nextPages; }

Target:
public List<IPage> getNextPages() { return nextPages; }
Source:
public Visitable visit(AnnotationMemberDeclaration _n, Object _arg) { NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg); Type<?> type_ = cloneNode(_n.getType(), _arg); Expression defaultValue = cloneNode(_n.getDefaultValue().orElse(null), _arg); Comment comment = cloneNode(_n.getComment(), _arg); AnnotationMemberDeclaration r = new AnnotationMemberDeclaration( _n.getRange(), _n.getModifiers(), annotations, type_, _n.getName(), defaultValue ); r.setComment(comment); return r; }

Target:
public Visitable visit(AnnotationMemberDeclaration _n, Object _arg) { NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg); Type<?> type_ = cloneNode(_n.getType(), _arg); Expression defaultValue = cloneNode(_n.getDefaultValue(), _arg); Comment comment = cloneNode(_n.getComment(), _arg); AnnotationMemberDeclaration r = new AnnotationMemberDeclaration( _n.getRange(), _n.getModifiers(), annotations, type_, _n.getName(), defaultValue ); r.setComment(comment); return r; }
Source:
public void testMany() { final UnweightedDoubleReservoirSample reservoir = new UnweightedDoubleReservoirSample(200); long streamLength = 1000000; for (int i = 0; i < streamLength; ++i) { double value = i * 10 + i % 2; reservoir.add(value); } double[] quantized = new double[4]; reservoir.stream().forEach(s -> { int index = (int) (4.0 * s / (10.0 * streamLength + 1)); ++quantized[index]; }); for (int i = 0; i < 4; ++i) { assertTrue(quantized[i] > 35); } }

Target:
public void testMany() { UnweightedDoubleReservoirSample reservoir = new UnweightedDoubleReservoirSample(200); long streamLength = 1_000_000; for (int i = 0; i < streamLength; ++i) { double value = i * 10 + i % 2; reservoir.add(value); } double[] quantized = new double[4]; for (double sample : reservoir.getSamples()) { int index = (int) (4.0 * sample / (10.0 * streamLength + 1)); ++quantized[index]; } for (int i = 0; i < 4; ++i) { assertTrue(quantized[i] > 35, format("Expected quantized[i] > got: i=%s, quantized=%s, got=%s", i, quantized[i], 35)); } }
Source:
public void testDelete() throws IOException, OmiseException { String scheduleId = "schd_test_57s33hm9fg1pzcqihxs"; Request<Schedule> request = new Schedule.DeleteRequestBuilder(scheduleId).build(); Schedule schedule = requester.sendRequest(request); assertRequested("DELETE", "/schedules/" + scheduleId, 200); assertEquals(scheduleId, schedule.getId()); assertEquals(ScheduleStatus.Deleted, schedule.getStatus()); }

Target:
public void testDelete() throws IOException, OmiseException { Request<Schedule> request = new Schedule.DeleteRequestBuilder(SCHEDULE_ID).build(); Schedule schedule = requester.sendRequest(request); assertRequested("DELETE", "/schedules/" + SCHEDULE_ID, 200); assertEquals(SCHEDULE_ID, schedule.getId()); assertEquals(ScheduleStatus.Deleted, schedule.getStatus()); }
Source:
private Long countByComplexFiltersHelper(Criteria existingCriteria, List<VariantEntityRepositoryFilter> filters) { List<Criteria> criteriaList = getFiltersCriteria(filters); criteriaList.add(existingCriteria); Criteria criteria = new Criteria().andOperator(criteriaList.toArray(new Criteria[criteriaList.size()])); Aggregation aggregation = Aggregation.newAggregation( Aggregation.match(criteria), Aggregation.group().count().as("count") ); AggregationResults<VariantAggregationCount> aggregationResults = mongoTemplate.aggregate(aggregation, VariantEntity.class, VariantAggregationCount.class); return aggregationResults.getMappedResults().size() > 0 ? aggregationResults.getMappedResults().get(0).getCount() : 0; }

Target:
private long countByComplexFiltersHelper(Criteria existingCriteria, List<VariantEntityRepositoryFilter> filters) { List<Criteria> criteriaList = getFiltersCriteria(filters); criteriaList.add(existingCriteria); Criteria criteria = new Criteria().andOperator(criteriaList.toArray(new Criteria[criteriaList.size()])); Aggregation aggregation = Aggregation.newAggregation( Aggregation.match(criteria), Aggregation.group().count().as("count") ); AggregationResults<VariantAggregationCount> aggregationResults = mongoTemplate.aggregate(aggregation, VariantEntity.class, VariantAggregationCount.class); return aggregationResults.getMappedResults().size() > 0 ? aggregationResults.getMappedResults().get(0).getCount() : 0; }
Source:
public void createTable(HTableDescriptor desc, byte[][] splitKeys) throws IOException { CreateTableRequest.Builder builder = CreateTableRequest.newBuilder(); clusterMetadataSetter.setMetadata(builder); builder.setTableId(desc.getTableName().getQualifierAsString()); builder.setTable(tableAdapter.adapt(desc)); if (splitKeys != null) { for (int i = 0; i < splitKeys.length; i++) { builder.addInitialSplitKeys(new String(splitKeys[i])); } } try { bigtableTableAdminClient.createTable(builder.build()); } catch (Throwable throwable) { throw new IOException( String.format( "Failed to create table '%s'", desc.getTableName().getNameAsString()), throwable); } }

Target:
public void createTable(HTableDescriptor desc, byte[][] splitKeys) throws IOException { CreateTableRequest.Builder builder = CreateTableRequest.newBuilder(); clusterMetadataSetter.setMetadata(builder); builder.setTableId(desc.getTableName().getQualifierAsString()); builder.setTable(tableAdapter.adapt(desc)); if (splitKeys != null) { for (byte[] splitKey : splitKeys) { builder.addInitialSplitKeys(Bytes.toString(splitKey)); } } try { bigtableTableAdminClient.createTable(builder.build()); } catch (Throwable throwable) { throw new IOException( String.format( "Failed to create table '%s'", desc.getTableName().getNameAsString()), throwable); } }
Source:
public SubnetSelectionResult selectForPrivateEndpoint(Collection<CloudSubnet> subnetMetas, boolean existingNetwork) { List<CloudSubnet> suitableCloudSubnet; if (existingNetwork) { suitableCloudSubnet = subnetMetas.stream() .filter(sn -> azureCloudSubnetParametersService.isPrivateEndpointNetworkPoliciesDisabled(sn)) .collect(Collectors.toList()); } else { suitableCloudSubnet = new ArrayList<>(subnetMetas); } return suitableCloudSubnet.isEmpty() ? new SubnetSelectionResult("No suitable subnets found for placing a private endpoint") : new SubnetSelectionResult(suitableCloudSubnet); }

Target:
public SubnetSelectionResult selectForPrivateEndpoint(Collection<CloudSubnet> subnetMetas, boolean existingNetwork) { List<CloudSubnet> suitableCloudSubnet; if (existingNetwork) { LOGGER.debug("Selecting subnets for private endpoint, existing network"); suitableCloudSubnet = subnetMetas.stream() .filter(sn -> azureCloudSubnetParametersService.isPrivateEndpointNetworkPoliciesDisabled(sn)) .collect(Collectors.toList()); } else { LOGGER.debug("Selecting subnets for private endpoint, new network - all subnets are suitable"); suitableCloudSubnet = new ArrayList<>(subnetMetas); } return suitableCloudSubnet.isEmpty() ? new SubnetSelectionResult("No suitable subnets found for placing a private endpoint") : new SubnetSelectionResult(suitableCloudSubnet); }
Source:
public WebpackDevServerPortView() { Span unique = new Span(String.valueOf(uuid)); unique.setId(UUID_ID); add(unique); DevModeHandler handler = DevModeHandler.getDevModeHandler(); Span portSpan = new Span(String.valueOf(handler.getPort())); portSpan.setId(WEBPACK_PORT_ID); add(portSpan); final NativeButton triggerButton = new NativeButton("Trigger reload", e -> { try { touch(new File( System.getProperty("jetty.scantrigger"))); } catch (IOException ioException) { throw new UncheckedIOException(ioException); } }); triggerButton.setId(TRIGGER_RELOAD_ID); add(triggerButton); }

Target:
public WebpackDevServerPortView() { Span unique = new Span(String.valueOf(uuid)); unique.setId(UUID_ID); add(unique); DevModeHandler handler = DevModeHandler.getDevModeHandler(); Span portSpan = new Span(String.valueOf(handler.getPort())); portSpan.setId(WEBPACK_PORT_ID); add(portSpan); final NativeButton triggerButton = new NativeButton("Trigger reload", event -> { try { touch(new File( System.getProperty("jetty.scantrigger"))); } catch (IOException ioException) { throw new UncheckedIOException(ioException); } }); triggerButton.setId(TRIGGER_RELOAD_ID); add(triggerButton); }
Source:
public synchronized void loadImage(Entity entity, int secondaryPos) { Image base = mechTileset.imageFor(entity, boardview, secondaryPos); Image wreck = wreckTileset.imageFor(entity, boardview, secondaryPos); IPlayer player = entity.getOwner(); int tint = PlayerColors.getColorRGB(player.getColorIndex()); Image camo = CamoManager.getPlayerCamoImage(player); if (entity.getCamoCategory() != null && !entity.getCamoCategory().equals(IPlayer.NO_CAMO)) { camo = CamoManager.getEntityCamoImage(entity); } EntityImage entityImage = null; for (Iterator<EntityImage> j = mechImageList.iterator(); j.hasNext();) { EntityImage onList = j.next(); if ((onList.getBase() != null) && onList.getBase().equals(base) && (onList.tint == tint) && (onList.getCamo() != null) && onList.getCamo().equals(camo) && onList.getDmgLvl() == entity.getDamageLevel(false)) { entityImage = onList; break; } } if (entityImage == null) { entityImage = new EntityImage(base, wreck, tint, camo, boardview, entity, secondaryPos); mechImageList.add(entityImage); entityImage.loadFacings(); for (int j = 0; j < 6; j++) { tracker.addImage(entityImage.getFacing(j), 1); } } ArrayList<Integer> temp = new ArrayList<Integer>(); temp.add(entity.getId()); temp.add(secondaryPos); mechImages.put(temp, entityImage); }

Target:
public synchronized void loadImage(Entity entity, int secondaryPos) { Image base = mechTileset.imageFor(entity, boardview, secondaryPos); Image wreck = wreckTileset.imageFor(entity, boardview, secondaryPos); IPlayer player = entity.getOwner(); int tint = PlayerColors.getColorRGB(player.getColorIndex()); Image camo = CamoManager.getPlayerCamoImage(player); if ((entity.getCamoCategory() != null) && !entity.getCamoCategory().equals(IPlayer.NO_CAMO)) { camo = CamoManager.getEntityCamoImage(entity); } EntityImage entityImage = null; for (Iterator<EntityImage> j = mechImageList.iterator(); j.hasNext();) { EntityImage onList = j.next(); if ((onList.getBase() != null) && onList.getBase().equals(base) && (onList.tint == tint) && (onList.getCamo() != null) && onList.getCamo().equals(camo) && onList.getDmgLvl() == entity.getDamageLevel(false)) { entityImage = onList; break; } } if (entityImage == null) { entityImage = new EntityImage(base, wreck, tint, camo, boardview, entity, secondaryPos); mechImageList.add(entityImage); entityImage.loadFacings(); for (int j = 0; j < 6; j++) { tracker.addImage(entityImage.getFacing(j), 1); } } ArrayList<Integer> temp = new ArrayList<Integer>(); temp.add(entity.getId()); temp.add(secondaryPos); mechImages.put(temp, entityImage); }
Source:
public byte[] toBytes() { byte[] buf = new byte[size()]; ByteBuffer bufWrap = ByteBuffer.wrap(buf); bufWrap.putShort(getVersion()); bufWrap.putShort((short) getType().ordinal()); bufWrap.putLong(getBytesRead()); Utils.serializeNullableString(bufWrap, startContinuationToken); Utils.serializeNullableString(bufWrap, endContinuationToken); bufWrap.putInt(index); bufWrap.putInt(totalItems); Utils.serializeNullableString(bufWrap, cacheSessionId); return buf; }

Target:
public byte[] toBytes() { byte[] buf = new byte[size()]; ByteBuffer bufWrap = ByteBuffer.wrap(buf); bufWrap.putShort(version); bufWrap.putShort((short) type.ordinal()); bufWrap.putLong(bytesRead); serializeNullableString(bufWrap, startContinuationToken); serializeNullableString(bufWrap, endContinuationToken); bufWrap.putInt(index); bufWrap.putInt(totalItems); serializeNullableString(bufWrap, cacheSessionId); return buf; }
Source:
private void writeRewrittenHashes() throws RevisionSyntaxException, IOException { File currentCommitFile = rebaseState.getFile(CURRENT_COMMIT); if (!currentCommitFile.exists()) return; ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) { return; } String head = headId.getName(); String currentCommits = rebaseState.readFile(CURRENT_COMMIT); for (String current : currentCommits.split("\n")) RebaseState .createFile(rebaseState.getRewrittenDir(), current, head); FileUtils.delete(currentCommitFile); }

Target:
private void writeRewrittenHashes() throws RevisionSyntaxException, IOException, RefNotFoundException { File currentCommitFile = rebaseState.getFile(CURRENT_COMMIT); if (!currentCommitFile.exists()) return; ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) { headId = getHead().getObjectId(); } String head = headId.getName(); String currentCommits = rebaseState.readFile(CURRENT_COMMIT); for (String current : currentCommits.split("\n")) RebaseState .createFile(rebaseState.getRewrittenDir(), current, head); FileUtils.delete(currentCommitFile); }
Source:
public void testRun() throws Exception { runIndexTask(); final Builder builder = new Builder( DATA_SOURCE, getObjectMapper(), AuthTestUtils.TEST_AUTHORIZER_MAPPER, null, rowIngestionMetersFactory, coordinatorClient, segmentLoaderFactory, RETRY_POLICY_FACTORY, appenderatorsManager ); final CompactionTask compactionTask = builder .interval(Intervals.of("2014-01-01/2014-01-02")) .build(); final Pair<TaskStatus, List<DataSegment>> resultPair = runTask(compactionTask); Assert.assertTrue(resultPair.lhs.isSuccess()); final List<DataSegment> segments = resultPair.rhs; Assert.assertEquals(3, segments.size()); for (int i = 0; i < 3; i++) { Assert.assertEquals( Intervals.of("2014-01-01T0%d:00:00/2014-01-01T0%d:00:00", i, i + 1), segments.get(i).getInterval() ); Assert.assertEquals( new DynamicPartitionsSpec(5000000, Long.MAX_VALUE), segments.get(i).getCompactionPartitionsSpec() ); if (lockGranularity == LockGranularity.SEGMENT) { Assert.assertEquals( new NumberedOverwriteShardSpec(32768, 0, 2, (short) 1, (short) 1), segments.get(i).getShardSpec() ); } else { Assert.assertEquals(new NumberedShardSpec(0, 0), segments.get(i).getShardSpec()); } } }

Target:
public void testRun() throws Exception { runIndexTask(); final Builder builder = new Builder( DATA_SOURCE, getObjectMapper(), AuthTestUtils.TEST_AUTHORIZER_MAPPER, null, rowIngestionMetersFactory, coordinatorClient, segmentLoaderFactory, RETRY_POLICY_FACTORY, appenderatorsManager ); final CompactionTask compactionTask = builder .interval(Intervals.of("2014-01-01/2014-01-02")) .build(); final Pair<TaskStatus, List<DataSegment>> resultPair = runTask(compactionTask); Assert.assertTrue(resultPair.lhs.isSuccess()); final List<DataSegment> segments = resultPair.rhs; Assert.assertEquals(3, segments.size()); for (int i = 0; i < 3; i++) { Assert.assertEquals( Intervals.of("2014-01-01T0%d:00:00/2014-01-01T0%d:00:00", i, i + 1), segments.get(i).getInterval() ); Assert.assertEquals(DEFAULT_COMPACTION_STATE, segments.get(i).getLastCompactionState()); if (lockGranularity == LockGranularity.SEGMENT) { Assert.assertEquals( new NumberedOverwriteShardSpec(32768, 0, 2, (short) 1, (short) 1), segments.get(i).getShardSpec() ); } else { Assert.assertEquals(new NumberedShardSpec(0, 0), segments.get(i).getShardSpec()); } } }
Source:
public final void refreshItems() { final HashSet<Integer> issuesWithNewComments = updateIssueCommentCounts(Qualifier.hasUpdatedQualifier(getCurrentFilterExpression())); listView.setCellFactory(list -> new ListPanelCell(this, panelIndex, issuesWithNewComments)); listView.saveSelection(); listView.setItems(null); listView.setItems(getElementsList()); issueCount = getElementsList().size(); listView.restoreSelection(); this.setId(guiController.getDefaultRepo() + "_col" + panelIndex); totalLabel.setText(String.format("Total: %d ", issueCount)); }

Target:
public final void refreshItems() { final HashSet<Integer> issuesWithNewComments = updateIssueCommentCounts(Qualifier.hasUpdatedQualifier(getCurrentFilterExpression())); listView.setCellFactory(list -> new ListPanelCell(this, panelIndex, issuesWithNewComments)); listView.saveSelection(); listView.setItems(null); listView.setItems(getElementsList()); issueCount = getElementsList().size(); listView.restoreSelection(); this.setId(guiController.getDefaultRepo() + "_col" + panelIndex); updateFooter(); }
Source:
protected synchronized void loadCatalog() { if (catalog!=null) return; BasicBrooklynCatalog catalog; try { String catalogUrl = getConfig().getConfig(BROOKLYN_CATALOG_URL); catalog = new BasicBrooklynCatalog(this, CatalogDtoUtils.newDtoFromUrl(catalogUrl)); if (log.isDebugEnabled()) log.debug("Loaded catalog from "+catalogUrl+": "+catalog); } catch (Exception e) { Object nonDefaultUrl = getConfig().getRawConfig(BROOKLYN_CATALOG_URL); if (nonDefaultUrl!=null && !"".equals(nonDefaultUrl)) log.warn("Could not read catalog.xml at "+nonDefaultUrl+"; using default (local classpath) catalog. Error was: "+e, e); catalog = new BasicBrooklynCatalog(this, CatalogDtoUtils.newDefaultLocalScanningDto(CatalogScanningModes.TYPES)); if (log.isDebugEnabled()) log.debug("Loaded default (local classpath) catalog: "+catalog); } catalog.getCatalog().load(this, null); this.catalog = catalog; }

Target:
protected synchronized void loadCatalog() { if (catalog!=null) return; BasicBrooklynCatalog catalog; try { String catalogUrl = getConfig().getConfig(BROOKLYN_CATALOG_URL); catalog = new BasicBrooklynCatalog(this, CatalogDtoUtils.newDtoFromUrl(catalogUrl)); if (log.isDebugEnabled()) log.debug("Loaded catalog from "+catalogUrl+": "+catalog); } catch (Exception e) { Object nonDefaultUrl = getConfig().getRawConfig(BROOKLYN_CATALOG_URL); if (nonDefaultUrl!=null && !"".equals(nonDefaultUrl)) { log.warn("Could not read catalog.xml at "+nonDefaultUrl+"; using default (local classpath) catalog. Error was: "+e, e); } else { if (log.isDebugEnabled()) log.debug("No default catalog file available; trying again using local classpath to populate catalog. Error was: "+e); } catalog = new BasicBrooklynCatalog(this, CatalogDtoUtils.newDefaultLocalScanningDto(CatalogScanningModes.TYPES)); if (log.isDebugEnabled()) log.debug("Loaded default (local classpath) catalog: "+catalog); } catalog.getCatalog().load(this, null); this.catalog = catalog; }
Source:
public static boolean isTypeOf(Class<?> type, Object instance) { return instance.getClass().isAssignableFrom(type); }

Target:
public static boolean isTypeOf(Class<?> type, Object instance) { return instance.getClass().getName().equals(type.getName()); }
Source:
PieChart getTimeRangePC() { return fTimeRangePC; }

Target:
synchronized PieChart getTimeRangePC() { return fTimeRangePC; }
Source:
private int getSpreadIndex(ZonedDateTime atTime) { int dstCorrection = determineDstCorrectionMinutes(atTime); return (int) ((Duration.between(getStartTime(), atTime).toMinutes() - dstCorrection) / 15); }

Target:
private int getSpreadIndex(ZonedDateTime atTime) { LocalDateTime atLocalTime = atTime.toLocalDateTime(); return (int) (Duration.between(getStartTime().toLocalDateTime(), atLocalTime).toMinutes() / 15); }
Source:
public void bind(RpcModule module) throws Exception { if (module != null) { final RpcModule<RpcRequest,RpcResponse> rpcModule = (RpcModule<RpcRequest,RpcResponse>)module; if (routeIdsByModule.containsKey(rpcModule)) { LOG.warn("RpcModule ({}) was already registered", rpcModule.getId(), rpcModule.hashCode()); } else { final DynamicRpcRouteBuilder routeBuilder = new DynamicRpcRouteBuilder(context, identity, rpcModule); context.addRoutes(routeBuilder); routeIdsByModule.put(rpcModule, routeBuilder.getRouteId()); LOG.info("Registered RpcModule ({}) on queue {}", rpcModule.getId(), rpcModule.hashCode(), routeBuilder.getQueueName()); new Exception().printStackTrace(); } } }

Target:
public void bind(RpcModule module) throws Exception { if (module != null) { final RpcModule<RpcRequest,RpcResponse> rpcModule = (RpcModule<RpcRequest,RpcResponse>)module; final String routeId = getRouteId(rpcModule); final Route existingRoute = context.getRoute(routeId); if (routeIdsByModule.containsKey(rpcModule)) { if (existingRoute == null) { LOG.error("RpcModule ({}) was marked as registered but its route cannot be found in the Camel context", rpcModule.getId(), Integer.toHexString(rpcModule.hashCode()), routeId ); } else { LOG.warn("RpcModule ({}) was already registered on route {}: {}", rpcModule.getId(), Integer.toHexString(rpcModule.hashCode()), routeId, existingRoute ); } } else { if (existingRoute == null) { final DynamicRpcRouteBuilder routeBuilder = new DynamicRpcRouteBuilder(context, identity, rpcModule); context.addRoutes(routeBuilder); routeIdsByModule.put(rpcModule, routeId); LOG.info("Registered RpcModule ({}) on route with queue {}", rpcModule.getId(), Integer.toHexString(rpcModule.hashCode()), routeId, routeBuilder.getQueueName() ); } else { LOG.warn("RpcModule ({}) cannot be registered, route is already present: {}", rpcModule.getId(), Integer.toHexString(rpcModule.hashCode()), routeId, existingRoute ); } } } }