auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected CourseComponent doInBackground(Object... params) { try { String courseId = (String) (params[0]); if(courseId!=null){ PrefManager.UserPrefManager prefManager = new PrefManager.UserPrefManager(MainApplication.instance()); long lastFetchTime = prefManager.getLastCourseStructureFetch(courseId); long curTime = new Date().getTime(); HttpRequestDelegate.REQUEST_CACHE_TYPE useCacheType = HttpRequestDelegate.REQUEST_CACHE_TYPE.PREFER_CACHE; if ( lastFetchTime + 3600 * 1000 < curTime ){ useCacheType = HttpRequestDelegate.REQUEST_CACHE_TYPE.IGNORE_CACHE;; prefManager.setLastCourseStructureFetch(courseId, curTime); } final CourseComponent model = ServiceManager.getInstance().getCourseStructure(courseId, useCacheType); if (model != null) { handler.post(new Runnable() { public void run() { onFinish(model); stopProgress(); } }); <START> } CookieSyncManager m ; <END> } } catch (Exception ex) { handle(ex); logger.error(ex, true); } return null; }</code><technical_language>I some extra text snuck in here</technical_language>

Target:
protected CourseComponent doInBackground(Object... params) { try { String courseId = (String) (params[0]); if(courseId!=null){ PrefManager.UserPrefManager prefManager = new PrefManager.UserPrefManager(MainApplication.instance()); long lastFetchTime = prefManager.getLastCourseStructureFetch(courseId); long curTime = new Date().getTime(); HttpRequestDelegate.REQUEST_CACHE_TYPE useCacheType = HttpRequestDelegate.REQUEST_CACHE_TYPE.PREFER_CACHE; if ( lastFetchTime + 3600 * 1000 < curTime ){ useCacheType = HttpRequestDelegate.REQUEST_CACHE_TYPE.IGNORE_CACHE;; prefManager.setLastCourseStructureFetch(courseId, curTime); } final CourseComponent model = ServiceManager.getInstance().getCourseStructure(courseId, useCacheType); if (model != null) { handler.post(new Runnable() { public void run() { onFinish(model); stopProgress(); } }); } } } catch (Exception ex) { handle(ex); logger.error(ex, true); } return null; }
Source:
<code>private void pollFromKafka() throws NakadiException { try { final ConsumerRecords<String, String> records = kafkaConsumer.poll(pollTimeout); eventQueue = StreamSupport .stream(records.spliterator(), false) .map(record -> new ConsumedEvent(record.value(), record.topic(), <START> Integer.toString(record.partition()), Long.toString(record.offset() + 1))) <END> .collect(Collectors.toCollection(Lists::newLinkedList)); } catch (InvalidOffsetException e) { throw new NakadiException("Wrong offset provided", e); } catch (KafkaException e) { throw new NakadiException("Error occurred when polling from kafka", e); } }</code><technical_language>get rid of Integer-Long-String conversions? I hard read error-prone. For is clear anymore some points if a number a string actually. (I write here, addresses class.)</technical_language>

Target:
private void pollFromKafka() throws NakadiException { try { final ConsumerRecords<String, String> records = kafkaConsumer.poll(pollTimeout); eventQueue = StreamSupport .stream(records.spliterator(), false) .map(record -> { final Cursor cursor = kafkaCursor(record.partition(), record.offset() + 1).asNakadiCursor(); return new ConsumedEvent(record.value(), record.topic(), cursor.getPartition(), cursor.getOffset()); }) .collect(Collectors.toCollection(Lists::newLinkedList)); } catch (KafkaException e) { throw new NakadiException("Error occurred when polling from kafka", e); } }
Source:
<code><START> private void createSmallDataset() throws RepositoryException{ <END> Random rGen = new Random(42); int[] labelCount = new int[NUM_LABELS]; int[] aclLabelCount = new int[NUM_LABELS]; int[] aclPar1LabelCount = new int[NUM_LABELS]; Node par = allow(getOrCreateByPath("/parent", "oak:Unstructured", session)); for (int i = 0; i < 4; i++) { Node subPar = par.addNode("par" + i); for (int j = 0; j < NUM_LEAF_NODES/10; j++) { Node child = subPar.addNode("c" + j); child.setProperty("cons", "val"); int labelNum = rGen.nextInt(NUM_LABELS); child.setProperty("foo", "l" + labelNum); labelCount[labelNum]++; if (i != 0) { aclLabelCount[labelNum]++; } if (i == 1) { aclPar1LabelCount[labelNum]++; } } if (i == 0) { deny(subPar); } } session.save(); for (int i = 0; i < labelCount.length; i++) { actualLabelCount.put("l" + i, labelCount[i]); actualAclLabelCount.put("l" + i, aclLabelCount[i]); actualAclPar1LabelCount.put("l" + i, aclPar1LabelCount[i]); } assertNotEquals("Acl-ed and actual counts mustn't be same", actualLabelCount, actualAclLabelCount); }</code><technical_language>I read test, please do a quick check of existing tests working "larger threshold" data set..</technical_language>

Target:
private void createSmallDataset() throws RepositoryException{ Random rGen = new Random(42); int[] labelCount = new int[NUM_LABELS]; int[] aclLabelCount = new int[NUM_LABELS]; int[] aclPar1LabelCount = new int[NUM_LABELS]; Node par = allow(getOrCreateByPath("/parent", "oak:Unstructured", session)); for (int i = 0; i < NUM_LABELS; i++) { Node subPar = par.addNode("par" + i); for (int j = 0; j < NUM_LEAF_NODES/(2 * NUM_LABELS); j++) { Node child = subPar.addNode("c" + j); child.setProperty("cons", "val"); int labelNum = rGen.nextInt(NUM_LABELS); child.setProperty("foo", "l" + labelNum); labelCount[labelNum]++; if (i != 0) { aclLabelCount[labelNum]++; } if (i == 1) { aclPar1LabelCount[labelNum]++; } } if (i == 0) { deny(subPar); } } session.save(); for (int i = 0; i < labelCount.length; i++) { actualLabelCount.put("l" + i, labelCount[i]); actualAclLabelCount.put("l" + i, aclLabelCount[i]); actualAclPar1LabelCount.put("l" + i, aclPar1LabelCount[i]); } assertNotEquals("Acl-ed and actual counts mustn't be same", actualLabelCount, actualAclLabelCount); }
Source:
<code>public <T> Exporter<T> export(final Invoker<T> invoker) throws RpcException { final String uri = serviceKey(invoker.getUrl()); Exporter<T> exporter = (Exporter<T>) exporterMap.get(uri); if (exporter != null) { if ("hessian".equals(invoker.getUrl().getProtocol())) { <START> if (exporter.getInvoker().getUrl().equals(invoker.getUrl())) { <END> return exporter; } } else { return exporter; } } final Runnable runnable = doExport(proxyFactory.getProxy(invoker, true), invoker.getInterface(), invoker.getUrl()); exporter = new AbstractExporter<T>(invoker) { @Override public void unexport() { super.unexport(); exporterMap.remove(uri); if (runnable != null) { try { runnable.run(); } catch (Throwable t) { logger.warn(t.getMessage(), t); } } } }; exporterMap.put(uri, exporter); return exporter; }</code><technical_language>getUrl return null here? If so, Objects.equals better</technical_language>

Target:
public <T> Exporter<T> export(final Invoker<T> invoker) throws RpcException { final String uri = serviceKey(invoker.getUrl()); Exporter<T> exporter = (Exporter<T>) exporterMap.get(uri); if (exporter != null) { if (Objects.equals(exporter.getInvoker().getUrl(), invoker.getUrl())) { return exporter; } } final Runnable runnable = doExport(proxyFactory.getProxy(invoker, true), invoker.getInterface(), invoker.getUrl()); exporter = new AbstractExporter<T>(invoker) { @Override public void unexport() { super.unexport(); exporterMap.remove(uri); if (runnable != null) { try { runnable.run(); } catch (Throwable t) { logger.warn(t.getMessage(), t); } } } }; exporterMap.put(uri, exporter); return exporter; }
Source:
<code>public V putIfAbsent(final K key, final V value) throws CacheLoaderException, CacheWriterException { statusTransitioner.checkAvailable(); checkNonNull(key, value); V inCache = null; final BiFunction<K, V, V> mappingFunction = memoize( new BiFunction<K, V, V>() { @Override public V apply(final K k, final V existingValue) { if(existingValue != null) { return existingValue; } V loaded = null; try { if (cacheLoader != null) { loaded = cacheLoader.load(k); } } catch (Exception e) { throw newCacheLoaderException(e); } if (loaded != null) { return loaded; } if (cacheWriter != null) { try { cacheWriter.write(k, null, value); } catch (Exception e) { throw newCacheWriterException(e); } } return value; } }); try { final Store.ValueHolder<V> holder = store.compute(key, mappingFunction); if (holder != null) { inCache = holder.value(); } } catch (CacheAccessException e) { try { inCache = mappingFunction.apply(key, null); if (cacheLoader != null && cacheWriter != null) { store.remove(key); } else { final Store.ValueHolder<V> holder = store.get(key); if (holder == null) { resilienceStrategy.possiblyInconsistent(key, e); } else { return holder.value(); } } } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } } <START> return inCache == value ? null : inCache; <END> }</code><technical_language>I this is dodgy. for case of inCache is loaded SOR (and possibly for stores serialization/copying for values, of presence of a loader), this reference equality check surely return false matter what. In fact, time reference comparison is guaranteed meaningful is function falls return value. want instead: value.equals(inCache) ? null : inCache;</technical_language>

Target:
public V putIfAbsent(final K key, final V value) throws CacheLoaderException, CacheWriterException { statusTransitioner.checkAvailable(); checkNonNull(key, value); V inCache = null; final AtomicBoolean installed = new AtomicBoolean(); final BiFunction<K, V, V> mappingFunction = memoize( new BiFunction<K, V, V>() { @Override public V apply(final K k, final V existingValue) { if(existingValue != null) { return existingValue; } V loaded = null; try { if (cacheLoader != null) { loaded = cacheLoader.load(k); } } catch (Exception e) { throw newCacheLoaderException(e); } if (loaded != null) { return loaded; } if (cacheWriter != null) { try { cacheWriter.write(k, null, value); } catch (Exception e) { throw newCacheWriterException(e); } } installed.set(true); return value; } }); try { final Store.ValueHolder<V> holder = store.compute(key, mappingFunction); if (holder != null) { inCache = holder.value(); } } catch (CacheAccessException e) { try { inCache = mappingFunction.apply(key, null); if (cacheLoader != null && cacheWriter != null) { store.remove(key); } else { final Store.ValueHolder<V> holder = store.get(key); if (holder == null) { resilienceStrategy.possiblyInconsistent(key, e); } else { return holder.value(); } } } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } } return installed.get() ? null : inCache; }
Source:
<code>public List<String> getDCFromExpression(String expression) { ArrayList<String> finalDCList = new ArrayList<>(); String dcList = _configuration.getValue(com.salesforce.dva.argus.system.SystemConfiguration.Property.DC_LIST).replaceAll(",","|"); String defaultDC = _configuration.getValue(SystemConfiguration.Property.DC_DEFAULT); ArrayList<String> patterns = new ArrayList<>(Arrays.asList( "\\.(?i)(" + dcList + ")\\.", ":argus\\.")); List<String> scopes = QueryUtils.getScopesFromExpression(expression); List<String> ArgusDC; if (expression == null || expression.isEmpty()) { _logger.error("Expression either null or empty. Cannot retrive DC from the expression. Returning default value " + defaultDC); finalDCList.add(defaultDC); } else if((ArgusDC = getMatchedDCAgainstRegex(scopes, patterns.get(1))) != null) { finalDCList = (ArrayList<String>) ArgusDC; } else { List<String> currentDCList = getMatchedDCAgainstRegex(scopes, patterns.get(0)); if (currentDCList != null) finalDCList = (ArrayList<String>) currentDCList; <START> else { END> List<MetricQuery> queries = getQueries(expression); ArrayList<String> scopeFromExpandedExpressions = new ArrayList<>(); for(MetricQuery currentQuery: queries) scopeFromExpandedExpressions.add(currentQuery.getScope()); finalDCList = (ArrayList<String>) getMatchedDCAgainstRegex(scopeFromExpandedExpressions, patterns.get(0)); } } if (finalDCList.size() == 0) { _logger.info("Unable to identify DC from expression: " + expression +" . Returning default value PRD " + defaultDC); finalDCList.add(defaultDC); } return new ArrayList<>(finalDCList); }</code><technical_language>case 2</technical_language>

Target:
public List<String> getDCFromExpression(String expression) { ArrayList<String> finalDCList = new ArrayList<>(); String dcList = _configuration.getValue(com.salesforce.dva.argus.system.SystemConfiguration.Property.DC_LIST).replaceAll(",","|"); String defaultDC = _configuration.getValue(SystemConfiguration.Property.DC_DEFAULT); ArrayList<String> patterns = new ArrayList<>(Arrays.asList( "\\.(?i)(" + dcList + ")\\.", ":argus\\.")); List<String> scopes = QueryUtils.getScopesFromExpression(expression); if (expression == null || expression.isEmpty()) { _logger.error("Expression either null or empty. Cannot retrive DC from the expression. Returning default value " + defaultDC); finalDCList.add(defaultDC); } else { List<String> currentDCList = getMatchedDCAgainstRegex(scopes, patterns.get(0)); if (currentDCList != null) finalDCList = (ArrayList<String>) currentDCList; else { List<MetricQuery> queries = getQueries(expression); ArrayList<String> scopeFromExpandedExpressions = new ArrayList<>(); for(MetricQuery currentQuery: queries) scopeFromExpandedExpressions.add(currentQuery.getScope()); finalDCList = (ArrayList<String>) getMatchedDCAgainstRegex(scopeFromExpandedExpressions, patterns.get(0)); } if(getMatchedDCAgainstRegex(scopes, patterns.get(1)).size() > 0) finalDCList.add(defaultDC); } if (finalDCList.size() == 0) { _logger.info("Unable to identify DC from expression: " + expression +" . Returning default value PRD " + defaultDC); finalDCList.add(defaultDC); } return new ArrayList<>(finalDCList); }
Source:
<code>static TableReader create(AlluxioURI uri) throws IOException { if (Format.isCsv(uri.getPath())) { return CsvReader.create(uri); <START> } else if (Format.isParquet(uri.getPath())) { <END> return ParquetReader.create(uri); } else { throw new IOException("Unsupported file format for " + uri); } }</code><technical_language>Parquet file end suffix? hive created files names 000000_0</technical_language>

Target:
static TableReader create(AlluxioURI uri) throws IOException { ReadWriterUtils.checkUri(uri); if (Format.isCsv(uri.getPath())) { return CsvReader.create(uri); } else if (Format.isParquet(uri.getPath())) { return ParquetReader.create(uri); } else { throw new IOException("Unsupported file format for " + uri); } }
Source:
<code>private void registerSnapshot () { try { Statement statement = connection.createStatement(); statement.execute("create schema " + tablePrefix); PreparedStatement insertStatement = connection.prepareStatement( "insert into feeds values (?, null, null, null, null, null, current_timestamp, ?)"); insertStatement.setString(1, tablePrefix); insertStatement.setString(2, feedIdToSnapshot); insertStatement.execute(); connection.commit(); LOG.info("Created new snapshot namespace: {}", insertStatement); } catch (Exception ex) { <START> LOG.error("Exception while creating unique prefix for new feed: {}", ex.getMessage()); <END> DbUtils.closeQuietly(connection); } }</code><technical_language>change error messages in method this is based on. longer "creating unique prefix" registering a feed feed snapshot in feeds table</technical_language>

Target:
private void registerSnapshot () { try { Statement statement = connection.createStatement(); statement.execute("create schema " + tablePrefix); PreparedStatement insertStatement = connection.prepareStatement( "insert into feeds values (?, null, null, null, null, null, current_timestamp, ?)"); insertStatement.setString(1, tablePrefix); insertStatement.setString(2, feedIdToSnapshot); insertStatement.execute(); connection.commit(); LOG.info("Created new snapshot namespace: {}", insertStatement); } catch (Exception ex) { LOG.error("Exception while registering snapshot namespace in feeds table: {}", ex.getMessage()); DbUtils.closeQuietly(connection); } }
Source:
<code>private void internalSendCommand(String command) { if (StringUtils.isBlank(command)) { logger.warn("Trying to send empty command"); return; } try { String url = cmdUrl + URLEncoder.encode(command, Charset.defaultCharset().displayName()); logger.trace("Calling url {}", url); client.prepareGet(url) .execute(new AsyncCompletionHandler<Response>() { @Override public Response onCompleted(Response response) throws Exception { if (response.getStatusCode() != 200) { logger.error("Error while sending command", response.getStatusText()); } return response; } @Override public void onThrowable(Throwable t) { logger.error("Error sending command", t); } }); } catch (UnsupportedEncodingException e) { <START> logger.error("Error preparing command", e); <END> } catch (IOException e) { logger.error("Error sending command", e); e.printStackTrace(); } }</code><technical_language>decrease severity WARN</technical_language>

Target:
private void internalSendCommand(String command) { if (StringUtils.isBlank(command)) { logger.warn("Trying to send empty command"); return; } try { String url = cmdUrl + URLEncoder.encode(command, Charset.defaultCharset().displayName()); logger.trace("Calling url {}", url); client.prepareGet(url) .execute(new AsyncCompletionHandler<Response>() { @Override public Response onCompleted(Response response) throws Exception { if (response.getStatusCode() != 200) { logger.warn("Error while sending command", response.getStatusText()); } return response; } @Override public void onThrowable(Throwable t) { logger.warn("Error sending command", t); } }); } catch (UnsupportedEncodingException e) { logger.warn("Error preparing command", e); } catch (IOException e) { logger.warn("Error sending command", e); } }
Source:
<code>public static List<Object> map(Attribute attr) { <START> List<Object> row = new ArrayList<>(); <END> for (Entry<String, String> entry : ATTRIBUTE_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_ATTRIBUTES_ID_ATTRIBUTE: row.add(getIdAttrValue(attr)); break; case EMX_ATTRIBUTES_TAGS: row.add(getTagsValue(attr)); break; case EMX_ATTRIBUTES_ENTITY: row.add(attr.getEntity() != null ? attr.getEntity().getId() : ""); break; case EMX_ATTRIBUTES_REF_ENTITY: row.add(attr.getRefEntity() != null ? attr.getRefEntity().getId() : ""); break; case EMX_ATTRIBUTES_LOOKUP_ATTRIBUTE: row.add(getLookupValue(attr)); break; case EMX_ATTRIBUTES_NILLABLE: row.add(getNullableValue(attr)); break; case EMX_ATTRIBUTES_VISIBLE: row.add(getVisibleValue(attr)); break; case EMX_ATTRIBUTES_PART_OF_ATTRIBUTE: row.add(getPartOfValue(attr)); break; case EMX_ATTRIBUTES_MAPPED_BY: row.add(getMappedByValue(attr)); break; case EMX_ATTRIBUTES_ENUM_OPTIONS: row.add(getEnumOptions(attr)); break; default: Object value = attr.get(entry.getValue()); row.add(value != null ? value.toString() : ""); } } return row; }</code><technical_language>suggestion List<Object> row = new ArrayList<>(ATTRIBUTE_ATTRS.size());</technical_language>

Target:
public static List<Object> map(Attribute attr) { List<Object> row = new ArrayList<>(ATTRIBUTE_ATTRS.size()); for (Entry<String, String> entry : ATTRIBUTE_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_ATTRIBUTES_ID_ATTRIBUTE: row.add(getIdAttrValue(attr)); break; case EMX_ATTRIBUTES_TAGS: row.add(getTagsValue(attr)); break; case EMX_ATTRIBUTES_ENTITY: row.add(attr.getEntity() != null ? attr.getEntity().getId() : null); break; case EMX_ATTRIBUTES_REF_ENTITY: row.add(attr.getRefEntity() != null ? attr.getRefEntity().getId() : null); break; case EMX_ATTRIBUTES_LOOKUP_ATTRIBUTE: row.add(getLookupValue(attr)); break; case EMX_ATTRIBUTES_NILLABLE: row.add(getNullableValue(attr)); break; case EMX_ATTRIBUTES_VISIBLE: row.add(getVisibleValue(attr)); break; case EMX_ATTRIBUTES_PART_OF_ATTRIBUTE: row.add(getPartOfValue(attr)); break; case EMX_ATTRIBUTES_MAPPED_BY: row.add(getMappedByValue(attr)); break; case EMX_ATTRIBUTES_ENUM_OPTIONS: row.add(getEnumOptions(attr)); break; default: Object value = attr.get(entry.getValue()); row.add(value != null ? value.toString() : null); } } return row; }
Source:
<code>public static void main(String[] args) { try { if (args.length < 1) { usage(); System.exit(-1); } int numBookies = 0; try { numBookies = Integer.parseInt(args[0]); } catch (NumberFormatException nfe) { <START> LOG.error("Unrecognized number-of-bookies: " + args[0]); <END> usage(); System.exit(-1); } ServerConfiguration conf = new ServerConfiguration(); conf.setAllowLoopback(true); if (args.length >= 2) { String confFile = args[1]; try { conf.loadConf(new File(confFile).toURI().toURL()); LOG.info("Using configuration file " + confFile); } catch (Exception e) { LOG.warn("Error loading configuration file " + confFile, e); } } String zkDataDir = null; if (args.length >= 3) { zkDataDir = args[2]; } String localBookiesConfigDirName = defaultLocalBookiesConfigDir; if (args.length >= 4) { localBookiesConfigDirName = args[3]; } startLocalBookiesInternal(conf, zooKeeperDefaultHost, zooKeeperDefaultPort, numBookies, true, bookieDefaultInitialPort, false, "test", zkDataDir, localBookiesConfigDirName); } catch (Exception e) { LOG.error("Exiting LocalBookKeeper because of exception in main method", e); e.printStackTrace(); System.exit(-1); } }</code><technical_language>nit: suggestion LOG.error("Unrecognized number-of-bookies: {}", args[0]);</technical_language>

Target:
public static void main(String[] args) { try { if (args.length < 1) { usage(); System.exit(-1); } int numBookies = 0; try { numBookies = Integer.parseInt(args[0]); } catch (NumberFormatException nfe) { LOG.error("Unrecognized number-of-bookies: {}", args[0]); usage(); System.exit(-1); } ServerConfiguration conf = new ServerConfiguration(); conf.setAllowLoopback(true); if (args.length >= 2) { String confFile = args[1]; try { conf.loadConf(new File(confFile).toURI().toURL()); LOG.info("Using configuration file " + confFile); } catch (Exception e) { LOG.warn("Error loading configuration file " + confFile, e); } } String zkDataDir = null; if (args.length >= 3) { zkDataDir = args[2]; } String localBookiesConfigDirName = defaultLocalBookiesConfigDir; if (args.length >= 4) { localBookiesConfigDirName = args[3]; } startLocalBookiesInternal(conf, zooKeeperDefaultHost, zooKeeperDefaultPort, numBookies, true, bookieDefaultInitialPort, false, "test", zkDataDir, localBookiesConfigDirName); } catch (Exception e) { LOG.error("Exiting LocalBookKeeper because of exception in main method", e); e.printStackTrace(); System.exit(-1); } }
Source:
<code>WebsocketSession(ClientCodec<ByteBuf> codec, Connection connection) { this.id = Integer.toHexString(System.identityHashCode(this)); this.codec = codec; this.connection = connection; this.outbound = (WebsocketOutbound) connection.outbound(); <START> DirectProcessor<ByteBuf> outboundProcessor = DirectProcessor.create(); <END> outboundSink = outboundProcessor.sink(); this.outbound .options(SendOptions::flushOnEach) .sendObject(outboundProcessor.map(TextWebSocketFrame::new)) .then() .subscribe( null, th -> LOGGER.error("Exception on sending for session={}, cause: {}", id, th)); WebsocketInbound inbound = (WebsocketInbound) connection.inbound(); inbound .aggregateFrames() .receive() .retain() .subscribe( byteBuf -> { ClientMessage msg; try { msg = codec.decode(byteBuf); } catch (Exception ex) { LOGGER.error("Response decoder failed: " + ex); return; } if (!msg.hasHeader(STREAM_ID)) { LOGGER.error("Ignore response: with null sid, session={}", msg, id); Optional.ofNullable(msg.data()).ifPresent(ReferenceCountUtil::safestRelease); return; } long sid = Long.valueOf(msg.header(STREAM_ID)); UnicastProcessor<ClientMessage> processor = inboundProcessors.get(sid); if (processor == null) { LOGGER.error( "Can't find processor by sid={} for response: {}, session={}", sid, msg, id); Optional.ofNullable(msg.data()).ifPresent(ReferenceCountUtil::safestRelease); return; } handleResponse(msg, processor::onNext, processor::onError, processor::onComplete); }); }</code><technical_language>UnicastProcessor? subscriber</technical_language>

Target:
WebsocketSession(ClientCodec<ByteBuf> codec, Connection connection) { this.id = Integer.toHexString(System.identityHashCode(this)); this.codec = codec; this.connection = connection; this.outbound = (WebsocketOutbound) connection.outbound(); UnicastProcessor<ByteBuf> outboundProcessor = UnicastProcessor.create(); outboundSink = outboundProcessor.sink(); this.outbound .options(SendOptions::flushOnEach) .sendObject(outboundProcessor.onBackpressureBuffer().map(TextWebSocketFrame::new)) .then() .subscribe( null, th -> LOGGER.error("Exception on sending for session={}, cause: {}", id, th)); WebsocketInbound inbound = (WebsocketInbound) connection.inbound(); inbound .aggregateFrames() .receive() .retain() .subscribe( byteBuf -> { ClientMessage msg; try { msg = codec.decode(byteBuf); } catch (Exception ex) { LOGGER.error("Response decoder failed: " + ex); return; } if (!msg.hasHeader(STREAM_ID)) { LOGGER.error("Ignore response: with null sid, session={}", msg, id); Optional.ofNullable(msg.data()).ifPresent(ReferenceCountUtil::safestRelease); return; } long sid = Long.valueOf(msg.header(STREAM_ID)); UnicastProcessor<ClientMessage> processor = inboundProcessors.get(sid); if (processor == null) { LOGGER.error( "Can't find processor by sid={} for response: {}, session={}", sid, msg, id); Optional.ofNullable(msg.data()).ifPresent(ReferenceCountUtil::safestRelease); return; } handleResponse(msg, processor::onNext, processor::onError, processor::onComplete); }); }
Source:
<code>public void parse_shouldReturnAnMrrtTemplateObjectIfFileIsValid() throws Exception { File file = new File(getClass().getClassLoader() <START> .getResource("mrrttemplates/radreport/ValidTemplate1.html") <END> .getFile()); FileInputStream in = new FileInputStream(file); MrrtReportTemplate template = parser.parse(in); assertNotNull(template); assertThat(template.getCharset(), is(CHARSET)); assertThat(template.getDcTermsTitle(), is(TEST_DCTERMS_TITLE)); assertThat(template.getDcTermsDescription(), is(TEST_DCTERMS_DESCRIPTION)); assertThat(template.getDcTermsIdentifier(), is(TEST_DCTERMS_IDENTIFIER)); assertThat(template.getDcTermsLanguage(), is(TEST_DCTERMS_LANGUAGE)); assertThat(template.getDcTermsLanguage(), is(TEST_DCTERMS_LANGUAGE)); assertThat(template.getDcTermsType(), is(TEST_DCTERMS_TYPE)); assertThat(template.getDcTermsPublisher(), is(TEST_DCTERMS_PUBLISHER)); assertThat(template.getDcTermsRights(), is(TEST_DCTERMS_RIGHTS)); assertThat(template.getDcTermsLicense(), is(TEST_DCTERMS_LICENSE)); assertThat(template.getDcTermsDate(), is(TEST_DCTERMS_DATE)); assertThat(template.getDcTermsCreator(), is(TEST_DCTERMS_CREATOR)); }</code><technical_language>@ivange94 changed template radreport ihe connectathon. rename folder ihe/connectathon/<year>/filename.html original filename ihe. easy for from</technical_language>

Target:
public void parse_shouldReturnAnMrrtTemplateObjectIfFileIsValid() throws Exception { File file = new File(getClass().getClassLoader() .getResource("mrrttemplates/ihe/connectathon/2015/CTChestAbdomen.html") .getFile()); FileInputStream in = new FileInputStream(file); MrrtReportTemplate template = parser.parse(in); assertNotNull(template); assertThat(template.getCharset(), is(CHARSET)); assertThat(template.getDcTermsTitle(), is(TEST_DCTERMS_TITLE)); assertThat(template.getDcTermsDescription(), is(TEST_DCTERMS_DESCRIPTION)); assertThat(template.getDcTermsIdentifier(), is(TEST_DCTERMS_IDENTIFIER)); assertThat(template.getDcTermsLanguage(), is(TEST_DCTERMS_LANGUAGE)); assertThat(template.getDcTermsLanguage(), is(TEST_DCTERMS_LANGUAGE)); assertThat(template.getDcTermsType(), is(TEST_DCTERMS_TYPE)); assertThat(template.getDcTermsPublisher(), is(TEST_DCTERMS_PUBLISHER)); assertThat(template.getDcTermsRights(), is(TEST_DCTERMS_RIGHTS)); assertThat(template.getDcTermsLicense(), is(TEST_DCTERMS_LICENSE)); assertThat(template.getDcTermsDate(), is(TEST_DCTERMS_DATE)); assertThat(template.getDcTermsCreator(), is(TEST_DCTERMS_CREATOR)); }
Source:
<code>public List<Event> execute(final LnClientConnection conn, final FindEventsQuery findEventsQuery) throws IOException, ProtocolAdapterException, TimeoutException { List<Event> eventList = new ArrayList<>(); final AttributeAddress configurationObjectValue = new AttributeAddress(CLASS_ID, EVENT_LOG_CATEGORY_OBISCODE_MAP.get(findEventsQuery.getEventLogCategory()), ATTRIBUTE_ID); final List<GetResult> getResultList = conn.get(configurationObjectValue); if (getResultList.isEmpty()) { throw new ProtocolAdapterException("No GetResult received while retrieving event register " + findEventsQuery.getEventLogCategory()); } if (getResultList.size() > 1) { throw new ProtocolAdapterException("Expected 1 GetResult while retrieving event log for " + findEventsQuery.getEventLogCategory() + ". Got " + getResultList.size()); } <START> final GetResult result = getResultList.get(0); END> if (!AccessResultCode.SUCCESS.equals(result.resultCode())) { LOGGER.info("Result of getting events for is {}", findEventsQuery.getEventLogCategory(), result.resultCode()); return eventList; } final DataObject resultData = result.resultData(); eventList = this.dataObjectToEventListConverter.convert(resultData); return this.filterEventList(eventList, findEventsQuery); }</code><technical_language>// A mean</technical_language>

Target:
public List<Event> execute(final LnClientConnection conn, final FindEventsQuery findEventsQuery) throws IOException, ProtocolAdapterException, TimeoutException { final SelectiveAccessDescription selectiveAccessDescription = this.getSelectiveAccessDescription( findEventsQuery.getFrom(), findEventsQuery.getUntil()); final AttributeAddress configurationObjectValue = new AttributeAddress(CLASS_ID, EVENT_LOG_CATEGORY_OBISCODE_MAP.get(findEventsQuery.getEventLogCategory()), ATTRIBUTE_ID, selectiveAccessDescription); final List<GetResult> getResultList = conn.get(configurationObjectValue); if (getResultList.isEmpty()) { throw new ProtocolAdapterException("No GetResult received while retrieving event register " + findEventsQuery.getEventLogCategory()); } if (getResultList.size() > 1) { throw new ProtocolAdapterException("Expected 1 GetResult while retrieving event log for " + findEventsQuery.getEventLogCategory() + ". Got " + getResultList.size()); } final GetResult result = getResultList.get(0); if (!AccessResultCode.SUCCESS.equals(result.resultCode())) { LOGGER.info("Result of getting events for is {}", findEventsQuery.getEventLogCategory(), result.resultCode()); throw new ProtocolAdapterException("Getting the events for " + findEventsQuery.getEventLogCategory() + " from the meter resulted in" + result.resultCode()); } final DataObject resultData = result.resultData(); return this.dataObjectToEventListConverter.convert(resultData); }
Source:
<code>public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) { Builder table = InMemoryRecordSet.builder(QUERY_TABLE); <START> List<QueryInfo> allQueryInfo = queryManager.getAllQueryInfo().stream() <END> .map(BasicQueryInfo::getQueryId) .map(queryId -> { try { return queryManager.getFullQueryInfo(queryId); } catch (NoSuchElementException e) { return null; } }) .filter(Objects::nonNull) .collect(toImmutableList()); for (QueryInfo queryInfo : allQueryInfo) { QueryStats queryStats = queryInfo.getQueryStats(); table.addRow( nodeId, queryInfo.getQueryId().toString(), queryInfo.getState().toString(), queryInfo.getSession().getUser(), queryInfo.getSession().getSource().orElse(null), queryInfo.getQuery(), queryInfo.getResourceGroupId().map(QuerySystemTable::resourceGroupIdToBlock).orElse(null), toMillis(queryStats.getQueuedTime()), toMillis(queryStats.getAnalysisTime()), toMillis(queryStats.getDistributedPlanningTime()), toTimeStamp(queryStats.getCreateTime()), toTimeStamp(queryStats.getExecutionStartTime()), toTimeStamp(queryStats.getLastHeartbeat()), toTimeStamp(queryStats.getEndTime())); } return table.build().cursor(); }</code><technical_language>I rename getAllQueryInfo getQueries</technical_language>

Target:
public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) { Builder table = InMemoryRecordSet.builder(QUERY_TABLE); List<QueryInfo> queryInfos = queryManager.getQueries().stream() .map(BasicQueryInfo::getQueryId) .map(queryId -> { try { return queryManager.getFullQueryInfo(queryId); } catch (NoSuchElementException e) { return null; } }) .filter(Objects::nonNull) .collect(toImmutableList()); for (QueryInfo queryInfo : queryInfos) { QueryStats queryStats = queryInfo.getQueryStats(); table.addRow( nodeId, queryInfo.getQueryId().toString(), queryInfo.getState().toString(), queryInfo.getSession().getUser(), queryInfo.getSession().getSource().orElse(null), queryInfo.getQuery(), queryInfo.getResourceGroupId().map(QuerySystemTable::resourceGroupIdToBlock).orElse(null), toMillis(queryStats.getQueuedTime()), toMillis(queryStats.getAnalysisTime()), toMillis(queryStats.getDistributedPlanningTime()), toTimeStamp(queryStats.getCreateTime()), toTimeStamp(queryStats.getExecutionStartTime()), toTimeStamp(queryStats.getLastHeartbeat()), toTimeStamp(queryStats.getEndTime())); } return table.build().cursor(); }
Source:
<code>public List<Node> getNodesInTopologicalOrder() { List<Node> topologicalList = new ArrayList<>(); List<Node> nodesToExamine = new ArrayList<>(); nodesToExamine.add(findNode(new SimpleUri("engine:shadowMapClearingNode"))); while (!nodesToExamine.isEmpty()) { Node currentNode = nodesToExamine.get(0); topologicalList.add(currentNode); nodesToExamine.addAll(nodeEdges.get(currentNode)); <START> nodesToExamine.remove(0); <END> } return topologicalList; }</code><technical_language>I -think- remove this line in block beginning of block write instead: Node currentNode = nodesToExamine.remove(0); is more in line Kahn's algorithm</technical_language>

Target:
public List<Node> getNodesInTopologicalOrder() { List<Node> topologicalList = new ArrayList<>(); Map<Node, Integer> inDegreeMap = Maps.newHashMap(); List<Node> nodesToExamine = Lists.newArrayList(); int visitedNodes = 0; for (Entry<Node, Collection<Node>> nodeEdgeList : reverseEdgeMap.asMap().entrySet()) { inDegreeMap.put(nodeEdgeList.getKey(), nodeEdgeList.getValue().size()); } for (Node node : nodeMap.values()) { if (!inDegreeMap.containsKey(node)) { inDegreeMap.put(node, 0); nodesToExamine.add(node); } } while (!nodesToExamine.isEmpty()) { Node currentNode = nodesToExamine.remove(0); for (Node adjacentNode : edgeMap.get(currentNode)) { int updatedInDegree = inDegreeMap.get(adjacentNode) - 1; inDegreeMap.put(adjacentNode, updatedInDegree); if (updatedInDegree == 0) { nodesToExamine.add(adjacentNode); } } topologicalList.add(currentNode); visitedNodes++; } if (visitedNodes != nodeMap.size()) { throw new RuntimeException("Cycle detected in the DAG: topological sorting not possible!"); } return topologicalList; }
Source:
<code>private static void checkAssertion(SamlAssertionWrapper assertion, String confirmMethod) throws WSSecurityException { if (OpenSAMLUtil.isMethodHolderOfKey(confirmMethod)) { if (assertion.getSubjectKeyInfo() == null) { <START> LOG.debug("There is no Subject KeyInfo to match the holder-of-key subject conf method"); <END> throw new WSSecurityException(ErrorCode.FAILED_CHECK, "noKeyInSAMLToken"); } if (!assertion.isSigned()) { LOG.debug("A holder-of-key assertion must be signed"); throw new WSSecurityException(ErrorCode.FAILED_CHECK, "invalidSAMLsecurity"); } } }</code><technical_language>This a debug statement, more of info trace</technical_language>

Target:
private static void checkAssertion(SamlAssertionWrapper assertion, String confirmMethod) throws WSSecurityException { if (OpenSAMLUtil.isMethodHolderOfKey(confirmMethod)) { if (assertion.getSubjectKeyInfo() == null) { LOG.info("There is no Subject KeyInfo to match the holder-of-key subject conf method"); throw new WSSecurityException(ErrorCode.FAILED_CHECK, "noKeyInSAMLToken"); } if (!assertion.isSigned()) { LOG.info("A holder-of-key assertion must be signed"); throw new WSSecurityException(ErrorCode.FAILED_CHECK, "invalidSAMLsecurity"); } } }
Source:
<code>private String resolveMessage(String message, Map<String, LinkedList<String>> variables) { String returnValue = message; RegExp regex = RegExp.compile(VARIABLE_PATTERN, "gi"); MatchResult result; while (returnValue.length() > 0) { <START> result = regex.exec(returnValue); <END> if (result == null) { break; } String match = result.getGroup(0); String key = match.substring(2, match.length() - 1); if (variables.containsKey(key)) { LinkedList<String> values = variables.get(key); String value = values.size() == 1 ? values.getFirst() : values.size() > 1 ? values.removeFirst() : ""; returnValue = returnValue.replace(match, value); } regex.setLastIndex(0); } return returnValue; }</code><technical_language>fishy me... returnValue is input for function I exec change it... remain >0 for ever. in some cases infinite looping another handle regexp: (copied stackoverflow...) RegExp regExp = RegExp.compile(patternStr); MatchResult matcher = regExp.exec(inputStr); boolean matchFound = (matcher != null); // equivalent regExp.test(inputStr); if (matchFound) { // Get groups for this match for (int i=0; i<=matcher.getGroupCount(); i++) { String groupStr = matcher.getGroup(i); System.out.println(groupStr); } }</technical_language>

Target:
private String resolveMessage(String message, Map<String, LinkedList<String>> variables) { String returnValue = message; RegExp regex = RegExp.compile(VARIABLE_PATTERN, "gi"); MatchResult result; while (returnValue.length() > 0) { result = regex.exec(returnValue); if (result == null) { break; } String match = result.getGroup(0); String key = match.substring(2, match.length() - 1); if (variables.containsKey(key)) { LinkedList<String> values = variables.get(key); String value = values.size() == 1 ? values.getFirst() : values.size() > 1 ? values.removeFirst() : ""; returnValue = returnValue.replace(match, value); } else { break; } regex.setLastIndex(0); } return returnValue; }
Source:
<code>public MoveRepresentationAction(Session session, final DAnalysis targetAnalysis, Collection<DRepresentation> selection) { super(); this.targetAnalysis = targetAnalysis; this.session = session; this.representations = Collections2.filter(selection, new Predicate<DRepresentation>() { @Override public boolean apply(DRepresentation input) { boolean result = true; EObject container = input.eContainer(); if (container instanceof DRepresentationContainer) { IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(container); if (permissionAuthority != null && <START> !permissionAuthority.canCreateIn(container)) { <END> result = false; } } if (result) { DRepresentationContainer targetContainer = DAnalysisSessionHelper.findContainerForAddedRepresentation(targetAnalysis, input); if (targetContainer != null) { IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(targetContainer); if (permissionAuthority != null && !permissionAuthority.canCreateIn(targetContainer)) { result = false; } } } return result; } }); final ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/forward.gif"); this.setImageDescriptor(descriptor); this.setText("move to " + targetAnalysis.eResource().getURI().toString()); if (this.representations.isEmpty()) { this.setEnabled(false); } }</code><technical_language>call a canDeleteInstance(input)</technical_language>

Target:
public MoveRepresentationAction(Session session, final DAnalysis targetAnalysis, Collection<DRepresentation> selection) { super(); this.targetAnalysis = targetAnalysis; this.session = session; this.representations = Collections2.filter(selection, new Predicate<DRepresentation>() { @Override public boolean apply(DRepresentation input) { boolean result = true; EObject container = input.eContainer(); if (container instanceof DRepresentationContainer) { IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(container); if (permissionAuthority != null && !permissionAuthority.canDeleteInstance(container)) { result = false; } } if (result) { DRepresentationContainer targetContainer = DAnalysisSessionHelper.findContainerForAddedRepresentation(targetAnalysis, input); if (targetContainer != null) { IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(targetContainer); if (permissionAuthority != null && !permissionAuthority.canCreateIn(targetContainer)) { result = false; } } } return result; } }); final ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/forward.gif"); this.setImageDescriptor(descriptor); this.setText("move to " + targetAnalysis.eResource().getURI().toString()); if (this.representations.isEmpty()) { this.setEnabled(false); } }
Source:
<code>private static Set<String> getClusterEmulatedMachines(VDSGroup cluster) { <START> if (cluster.getEmulatedMachine() != null) { <END> return new HashSet<>(Arrays.asList(cluster.getEmulatedMachine().split(","))); } else { return new HashSet<>(); } }</code><technical_language>mind reverting condition positive ? if (cluster.getEmulatedMachine() == null) { return new HashSet<>(); } else { return new HashSet<>(Arrays.asList(cluster.getEmulatedMachine().split(","))); }</technical_language>

Target:
private static Set<String> getClusterEmulatedMachines(VDSGroup cluster) { if (cluster.getEmulatedMachine() == null) { return new HashSet<>(); } else { return new HashSet<>(Arrays.asList(cluster.getEmulatedMachine().split(","))); } }
Source:
<code>protected void installLocations() { super.installLocations(); bind(RegionIdToURISupplier.class).to(RegionsToApiEndpoints.class).in(Scopes.SINGLETON); bind(ZoneIdsSupplier.class).to(ZoneIdsFromRegionIdToZoneIdsValues.class).in(Scopes.SINGLETON); <START> bind(RegionIdsSupplier.class).to(RegionIdsFromRegionIdToURIKeySet.class).in(Scopes.SINGLETON); <END> bind(ZoneIdToURISupplier.class).to(ZoneIdToURIFromJoinOnRegionIdToURI.class).in(Scopes.SINGLETON); bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON); }</code><technical_language>Remove this binding, is causing circular dependency. RegionsToApiEndpoints supplier provides endpoint for region @Region Supplier<Set<String>> (the RegionIdsSupplier). this binding configured get regions Map<String, Supplier<URI>> generated RegionIdToURISupplier, circular dependency. default implementation of RegionIdsSupplier populates list of regions based of jclouds.regions property, is want here, removing binding leave good regions properly configured</technical_language>

Target:
protected void installLocations() { super.installLocations(); bind(RegionIdToURISupplier.class).to(RegionsToApiEndpoints.class).in(Scopes.SINGLETON); bind(ZoneIdsSupplier.class).to(ZoneIdsFromRegionIdToZoneIdsValues.class).in(Scopes.SINGLETON); bind(ZoneIdToURISupplier.class).to(ZoneIdToURIFromJoinOnRegionIdToURI.class).in(Scopes.SINGLETON); bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON); }
Source:
<code>private void insertUserIntoGroup(final String authId, final String groupId, final Authentication.AuthResponse.PermissionLevel permissionLevel) throws AuthenticationException, DatabaseAccessException { final DBCollection collection = database.getCollection(DatabaseStringConstants.USER_GROUP_COLLECTION); final DBObject group = collection.findOne(new ObjectId(groupId), new BasicDBObject(DatabaseStringConstants.SALT, true)); if (group == null) { <START> throw new DatabaseAccessException("group could not be found"); <END> } final String salt = group.get(DatabaseStringConstants.SALT).toString(); String hash = null; try { hash = HashManager.toHex(HashManager.createHash(authId, salt).getBytes(StandardCharsets.UTF_8)); } catch (NoSuchAlgorithmException e) { throw new AuthenticationException(e); } if (hash == null) { throw new AuthenticationException("Unable to create authentication hash for group " + groupId, AuthenticationException.OTHER); } final BasicDBObject update = new BasicDBObject(hash, permissionLevel.getNumber()); database.getCollection(DatabaseStringConstants.USER_GROUP_COLLECTION).update( group, new BasicDBObject(DatabaseStringConstants.SET_COMMAND, update)); }</code><technical_language>"Group id " + groupId + " found."</technical_language>

Target:
private void insertUserIntoGroup(final String authId, final String groupId, final Authentication.AuthResponse.PermissionLevel permissionLevel) throws AuthenticationException, DatabaseAccessException { final DBCollection collection = database.getCollection(DatabaseStringConstants.USER_GROUP_COLLECTION); final DBObject group = collection.findOne(new ObjectId(groupId), new BasicDBObject(DatabaseStringConstants.SALT, true)); if (group == null) { throw new DatabaseAccessException("Group with id " + groupId + " could not be found."); } final String salt = group.get(DatabaseStringConstants.SALT).toString(); String hash = null; try { hash = HashManager.toHex(HashManager.createHash(authId, salt).getBytes(StandardCharsets.UTF_8)); } catch (NoSuchAlgorithmException e) { throw new AuthenticationException(e); } if (hash == null) { throw new AuthenticationException("Unable to create authentication hash for group " + groupId, AuthenticationException.OTHER); } final BasicDBObject update = new BasicDBObject(hash, permissionLevel.getNumber()); database.getCollection(DatabaseStringConstants.USER_GROUP_COLLECTION).update( group, new BasicDBObject(DatabaseStringConstants.SET_COMMAND, update)); }
Source:
<code>protected void eventHandle(ITmfEvent event) { if (!considerEvent(event)) { return; } try { String functionEntryName = functionEntry(event); if (functionEntryName != null) { long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); String thread = getThreadName(event); int quark = ss.getQuarkAbsoluteAndAdd(THREADS, thread, CALL_STACK); ITmfStateValue value = TmfStateValue.newValueString(functionEntryName); ss.pushAttribute(timestamp, value, quark); return; } String functionExitName = functionExit(event); if (functionExitName != null) { long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); String thread = getThreadName(event); int quark = ss.getQuarkAbsoluteAndAdd(THREADS, thread, CALL_STACK); ITmfStateValue poppedValue = ss.popAttribute(timestamp, quark); if (!functionExitName.equals(UNDEFINED) && <START> !functionExitName.equals(poppedValue.unboxStr())) { <END> Activator.logWarning(Messages.CallStackStateProvider_UmatchedPoppedValue); } } } catch (TimeRangeException e) { e.printStackTrace(); } catch (AttributeNotFoundException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } }</code><technical_language>poppedValue null if try pop (e.g. missed a push). unbox throw a NPE</technical_language>

Target:
protected void eventHandle(ITmfEvent event) { if (!considerEvent(event)) { return; } try { String functionEntryName = functionEntry(event); if (functionEntryName != null) { long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); String thread = getThreadName(event); int quark = ss.getQuarkAbsoluteAndAdd(THREADS, thread, CALL_STACK); ITmfStateValue value = TmfStateValue.newValueString(functionEntryName); ss.pushAttribute(timestamp, value, quark); return; } String functionExitName = functionExit(event); if (functionExitName != null) { long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); String thread = getThreadName(event); int quark = ss.getQuarkAbsoluteAndAdd(THREADS, thread, CALL_STACK); ITmfStateValue poppedValue = ss.popAttribute(timestamp, quark); String poppedName = (poppedValue == null ? NO_FUNCTION : poppedValue.unboxStr()); if (!functionExitName.equals(UNDEFINED) && !functionExitName.equals(poppedName)) { Activator.logWarning(NLS.bind( Messages.CallStackStateProvider_UnmatchedPoppedValue, functionExitName, poppedName)); } } } catch (TimeRangeException e) { e.printStackTrace(); } catch (AttributeNotFoundException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } }