auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public synchronized void updateCatalog(CatalogContext catalogContext, HostMessenger messenger) { try { Map<String, ImportConfiguration> newProcessorConfig = loadNewConfigAndBundles(catalogContext); if (VoltDB.instance().getMode() == OperationMode.RUNNING && (m_processorConfig == null || !m_processorConfig.equals(newProcessorConfig))) { close(); startImporters(newProcessorConfig); readyForDataInternal(catalogContext, messenger); } else if (VoltDB.instance().getMode() != OperationMode.RUNNING){ <START> importLog.info("Catalog update is not restarting importers because cluster state is " + VoltDB.instance().getMode()); <END> } } catch (final Exception e) { VoltDB.crashLocalVoltDB("Error updating importers with new DDL and/or deployment.", true, e); } }</code><technical_language>This is verbose</technical_language>

Target:
public synchronized void updateCatalog(CatalogContext catalogContext, HostMessenger messenger) { try { Map<String, ImportConfiguration> newProcessorConfig = loadNewConfigAndBundles(catalogContext); if (m_processorConfig == null || !m_processorConfig.equals(newProcessorConfig)) { OperationMode clusterMode = VoltDB.instance().getMode(); if (clusterMode != OperationMode.PAUSED) { close(); startImporters(newProcessorConfig); readyForDataInternal(catalogContext, messenger); } else if (importLog.isDebugEnabled()) { importLog.debug("Catalog update is not restarting importers because cluster state is " + clusterMode); } } } catch (final Exception e) { VoltDB.crashLocalVoltDB("Error updating importers with new DDL and/or deployment.", true, e); } }
Source:
<code>public ProcessInstanceRerunTest() throws IOException { super(); cluster = servers.get(1); <START> clusterFS = cluster.getClusterHelper().getHadoopFS(); <END> }</code><technical_language>a list of FS objects here</technical_language>

Target:
public ProcessInstanceRerunTest() throws IOException { super(); cluster = servers.get(1); clusterFS = serverFS.get(1); }
Source:
<code>private Socket tryConnect() throws IOException { final InetAddress inetAddress = InetAddress.getByName(address); int count = 0; <START> while (true) { <END> try { getLog().info( format("Connecting to %s:%s", inetAddress, Integer.valueOf(port))); return new Socket(inetAddress, port); } catch (final IOException e) { if (++count > retryCount) { throw e; } getLog().info(e.getMessage()); try { Thread.sleep(1000); } catch (final InterruptedException ie) { throw new InterruptedIOException(); } } } }</code><technical_language>I prefer for (int count = 0; count <= retryCount; count++)</technical_language>

Target:
private Socket tryConnect() throws IOException { final InetAddress inetAddress = InetAddress.getByName(address); int count = 0; while (true) { try { getLog().info( format("Connecting to %s:%s", inetAddress, Integer.valueOf(port))); return new Socket(inetAddress, port); } catch (final IOException e) { if (++count > retryCount) { throw e; } getLog().info(e.getMessage()); sleep(); } } }
Source:
<code>public Date getTimeAfter(Date afterTime) { Date currentStartDate = getStartDate(); if (hasFloatingStartDate()) { try { clearCandidates(); setStartDate(afterTime); } catch (IllegalArgumentException | ParseException e) { logger.error("An exception occurred while setting the start date : '{}'", e.getMessage()); } } <START> if (getCandidates().isEmpty()) { <END> try { setStartDate(afterTime); } catch (ParseException e) { logger.error("An exception occurred while setting the start date : '{}'", e.getMessage()); } } if (!getCandidates().isEmpty()) { if (getCandidates().size() == 1) { return getCandidates().get(0); } else { while (getCandidates().size() > 1) { Collections.sort(getCandidates()); Date newStartDate = null; try { for (Date candidate : getCandidates()) { newStartDate = candidate; if (candidate.after(afterTime)) { setStartDate(currentStartDate); return candidate; } } clearCandidates(); setStartDate(newStartDate); } catch (IllegalArgumentException | ParseException e) { logger.error("An exception occurred while parsing the expression : '{}'", e.getMessage()); } } } } return null; }</code><technical_language>a else if here. If is a foating start date, set start date called. If this results in empty candidates list, is reason call again</technical_language>

Target:
public Date getTimeAfter(Date afterTime) { Date currentStartDate = getStartDate(); if (hasFloatingStartDate()) { try { clearCandidates(); setStartDate(afterTime); } catch (IllegalArgumentException | ParseException e) { logger.error("An exception occurred while setting the start date : '{}'", e.getMessage()); } } else if (getCandidates().isEmpty()) { try { setStartDate(afterTime); } catch (ParseException e) { logger.error("An exception occurred while setting the start date : '{}'", e.getMessage()); } } if (!getCandidates().isEmpty()) { if (getCandidates().size() == 1) { return getCandidates().get(0); } else { while (getCandidates().size() > 1) { Collections.sort(getCandidates()); Date newStartDate = null; try { for (Date candidate : getCandidates()) { newStartDate = candidate; if (candidate.after(afterTime)) { setStartDate(currentStartDate); return candidate; } } clearCandidates(); setStartDate(newStartDate); } catch (IllegalArgumentException | ParseException e) { logger.error("An exception occurred while parsing the expression : '{}'", e.getMessage()); } } } } return null; }
Source:
<code>protected abstract ModelNode buildRequestWithoutHeaders(CommandContext ctx) throws CommandFormatException; protected void addHeaders(CommandContext ctx, ModelNode request) throws CommandFormatException { if(!headers.isPresent(ctx.getParsedCommandLine())) { return; } final ModelNode headersNode = headers.toModelNode(ctx); if (headersNode != null && headersNode.getType() != ModelType.OBJECT) { <START> throw new IllegalArgumentException("--headers option has wrong value '"+headersNode+"'"); <END> } final ModelNode opHeaders = request.get(Util.OPERATION_HEADERS); opHeaders.set(headersNode); }</code><technical_language>Bartosz, correction :) I meant CommandFormatException. Thanks</technical_language>

Target:
protected abstract ModelNode buildRequestWithoutHeaders(CommandContext ctx) throws CommandFormatException; protected void addHeaders(CommandContext ctx, ModelNode request) throws CommandFormatException { if(!headers.isPresent(ctx.getParsedCommandLine())) { return; } final ModelNode headersNode = headers.toModelNode(ctx); if (headersNode != null && headersNode.getType() != ModelType.OBJECT) { throw new CommandFormatException("--headers option has wrong value '"+headersNode+"'"); } final ModelNode opHeaders = request.get(Util.OPERATION_HEADERS); opHeaders.set(headersNode); }
Source:
<code>public void testInvoiceItemMetadata() throws StripeException { Customer customer = Customer.create(defaultCustomerParams); <START> defaultInvoiceItemParams.put("customer", customer.getId()); <END> testMetadata(InvoiceItem.create(defaultInvoiceItemParams)); }</code><technical_language>This stomps defaultInvoiceItemParams is undesirable. I recommend creating a new map putAll, possibly making a helper method getInvoiceItemParams(String customer) in style of getUniqueCouponParams: java static Map<String, Object> getUniqueCouponParams() { Map<String, Object> uniqueParams = new HashMap<String, Object>(); uniqueParams.putAll(defaultCouponParams); uniqueParams.put("id", getUniqueCouponId()); return uniqueParams; }</technical_language>

Target:
public void testInvoiceItemMetadata() throws StripeException { testMetadata(InvoiceItem.create(getInvoiceItemParams())); }
Source:
<code>private List<Obs> getObsLeaves(Obs obsParent) { List<Obs> leaves = new ArrayList<>(); if (obsParent.hasGroupMembers()) { for (Obs child : obsParent.getGroupMembers()) { <START> if (!child.getVoided() && !child.isObsGrouping()) { <END> leaves.add(child); } else if (!child.getVoided()){ leaves.addAll(getObsLeaves(child)); } } } else if (!obsParent.getVoided()) { leaves.add(obsParent); } return leaves; }</code><technical_language>I find this harder read before</technical_language>

Target:
private List<Obs> getObsLeaves(Obs obsParent) { List<Obs> leaves = new ArrayList<>(); if (obsParent.hasGroupMembers()) { obsParent.getGroupMembers().forEach((child) -> { if (!child.getVoided() && !child.isObsGrouping()) { leaves.add(child); } else if (!child.getVoided() && child.isObsGrouping()) { leaves.addAll(getObsLeaves(child)); } }); } else if (!obsParent.getVoided()) { leaves.add(obsParent); } return leaves; }
Source:
<code>public CustomFormSubmodel(final Float accuracy, final Map<String, CustomFormModelField> fields, final String formType) { this.accuracy = accuracy; <START> this.fields = fields == null ? null : Collections.unmodifiableMap(new HashMap<>(fields)); <END> this.formType = formType; }</code><technical_language>suggestion this.fields = fields == null ? null : Collections.unmodifiableMap(fields);</technical_language>

Target:
public CustomFormSubmodel(final Float accuracy, final Map<String, CustomFormModelField> fields, final String formType) { this.accuracy = accuracy; this.fields = fields == null ? null : Collections.unmodifiableMap(fields); this.formType = formType; }
Source:
<code>private static void asMemoryInteger(JsonNode payload, String key, Consumer<Integer> consumer) { as(payload, key, raw -> { if (raw.isNumber()) { return raw.asInt(); } else if (raw.isTextual()) { <START> String text = raw.asText(); <END> if (text.toUpperCase().endsWith("G")) { return Integer.parseInt(text.substring(0, text.length() - 1)) * GIBI; } else if (text.toUpperCase().endsWith("GB")) { return Integer.parseInt(text.substring(0, text.length() - 2)) * GIBI; } else if (text.toUpperCase().endsWith("M")) { return Integer.parseInt(text.substring(0, text.length() - 1)); } else if (text.toUpperCase().endsWith("MB")) { return Integer.parseInt(text.substring(0, text.length() - 2)); } else { return 0; } } else { return 0; } }, consumer); }</code><technical_language>If put toUpperCase() here, read a bit affect of parsing. suggesting: String text = raw.asText().toUpperCase(); then: if (text.endsWith("G")) { return Integer.parseInt(text.substring(0, text.length() - 1)) * GIBI; } else if (text.endsWith("GB")) { return Integer.parseInt(text.substring(0, text.length() - 2)) * GIBI; } else if (text.endsWith("M")) { return Integer.parseInt(text.substring(0, text.length() - 1)); } else if (text.endsWith("MB")) { return Integer.parseInt(text.substring(0, text.length() - 2)); } else { on</technical_language>

Target:
private static void asMemoryInteger(JsonNode payload, String key, Consumer<Integer> consumer) { as(payload, key, raw -> { if (raw.isNumber()) { return raw.asInt(); } else if (raw.isTextual()) { String text = raw.asText().toUpperCase(); if (text.endsWith("G")) { return Integer.parseInt(text.substring(0, text.length() - 1)) * GIBI; } else if (text.endsWith("GB")) { return Integer.parseInt(text.substring(0, text.length() - 2)) * GIBI; } else if (text.endsWith("M")) { return Integer.parseInt(text.substring(0, text.length() - 1)); } else if (text.endsWith("MB")) { return Integer.parseInt(text.substring(0, text.length() - 2)); } else { return 0; } } else { return 0; } }, consumer); }
Source:
<code>private int normalizeAndValidatePageSize(int pageSize) throws WrongRequestParameterException { int currentPageSize = normalizePageSize(pageSize); validate(currentPageSize, (n) -> n<=0, PAGE_SIZE, "should be positive"); <START> validate(currentPageSize, (n) -> n>maxPageSize, PAGE_SIZE, "can't be bigger than "+maxPageSize); <END> validate(currentPageSize, (n) -> n<minPageSize, PAGE_SIZE, "can't be less than "+minPageSize); return currentPageSize; }</code><technical_language>change bigger -> greater</technical_language>

Target:
private int normalizeAndValidatePageSize(int pageSize) throws WrongRequestParameterException { int currentPageSize = normalizePageSize(pageSize); validate(currentPageSize, (n) -> n<=0, PAGE_SIZE, "may not be negative"); validate(currentPageSize, (n) -> n>maxPageSize, PAGE_SIZE, "may not be greater than "+maxPageSize); validate(currentPageSize, (n) -> n<minPageSize, PAGE_SIZE, "may not be less than "+minPageSize); return currentPageSize; }
Source:
<code>public static String getDefaultOpencgaHome() { return System.getenv("OPENCGA_HOME") != null ? <START> System.getenv("OPENCGA_HOME") : "./src/main/resources/opencga/"; <END> }</code><technical_language>is preferred getResource method for tests instead of regular relative paths due potential issues classpath</technical_language>

Target:
public static String getDefaultOpencgaHome() { return System.getenv("OPENCGA_HOME") != null ? System.getenv("OPENCGA_HOME") : GenotypedVcfJobTestUtils.class.getResource("/opencga/").getFile(); }
Source:
<code><START> StubWithGlobalSecondaryIndexItem randomStubWithGlobalSecondaryIndexItem() { <END> final StubWithGlobalSecondaryIndexItem stubItem = new StubWithGlobalSecondaryIndexItem(); stubItem.setId(randomId()); stubItem.setGsi(randomString(10)); stubItem.setGsiSupportingValue(randomInt(100)); stubItem.setVersion((long) randomInt(100)); return stubItem; }</code><technical_language>default/package level visibility</technical_language>

Target:
public StubWithGlobalSecondaryIndexItem randomStubWithGlobalSecondaryIndexItem() { final StubWithGlobalSecondaryIndexItem stubItem = new StubWithGlobalSecondaryIndexItem(); stubItem.setId(randomId()); stubItem.setGsi(randomString(10)); stubItem.setGsiSupportingValue(randomInt(100)); stubItem.setVersion((long) randomInt(100)); return stubItem; }
Source:
<code>public List<QueryError> getWarnings() <START> { <END> return warnings.get(); }</code><technical_language>expose this in JDBC too? ( <LINK_0> )</technical_language>

Target:
public List<QueryError> getWarnings() { synchronized (warnings) { return ImmutableList.copyOf(warnings); } }
Source:
<code>public static void renameStorageConfig() throws IOException { File sourceFile = new File(Utils.getWorkDirectory(), "credentials.xml"); File backUp; if (!sourceFile.exists()) { return; } <START> LOGGER.log(Level.INFO, sourceFile + " exists, rename azure storage credential will start now..."); <END> backUp = backupFile(sourceFile.getCanonicalPath()); Path path = Paths.get(sourceFile.getCanonicalPath()); try (Stream<String> stream = Files.lines(path)) { boolean needRename = stream.anyMatch(s -> s.contains(SOURCE_CONTENT)); if (!needRename) { return; } } try (Stream<String> stream = Files.lines(path)) { List<String> collect = stream .map(s -> s.replace(SOURCE_CONTENT, TARGET_CONTENT)) .collect(Collectors.toList()); Files.write(path, collect); } catch (IOException e) { LOGGER.warning("Fail to rename azure storage credential in credentials.xml file"); recoverFile(backUp.getCanonicalPath()); } removeFile(backUp.getCanonicalPath()); }</code><technical_language>need info merge? plugin installed get this log event time, I log if fines needs rename</technical_language>

Target:
public static void renameStorageConfig() throws IOException { File sourceFile = new File(Utils.getWorkDirectory(), "credentials.xml"); if (!sourceFile.exists()) { return; } Path path = Paths.get(sourceFile.getCanonicalPath()); try (Stream<String> stream = Files.lines(path)) { boolean needRename = stream.anyMatch(s -> s.contains(SOURCE_CONTENT)); if (!needRename) { return; } } LOGGER.log(Level.INFO, sourceFile + " exists, rename azure storage credential will start now..."); File backUp = backupFile(sourceFile.getCanonicalPath()); try (Stream<String> stream = Files.lines(path)) { List<String> collect = stream .map(s -> s.replace(SOURCE_CONTENT, TARGET_CONTENT)) .collect(Collectors.toList()); Files.write(path, collect); } catch (IOException e) { LOGGER.warning("Failed to rename azure storage credential in credentials.xml file"); recoverFile(backUp.getCanonicalPath()); } removeFile(backUp.getCanonicalPath()); }
Source:
<code>public void unpackInteger(IntegerHolder holder) throws IOException { byte b = consume(); if(Code.isFixInt(b)) { holder.setByte(b); return; } switch(b) { case Code.INT8: holder.setByte(readByte()); break; case Code.INT16: holder.setShort(readShort()); break; case Code.INT32: holder.setInt(readInt()); break; case Code.INT64: holder.setLong(readLong()); break; case Code.UINT8: byte u8 = readByte(); if(u8 < 0) { holder.setShort((short) (u8 & 0xFF)); } else { holder.setByte(u8); } break; case Code.UINT16: short u16 = readShort(); if(u16 < 0) { holder.setInt(u16 & 0xFFFF); } else { holder.setShort(u16); } break; case Code.UINT32: int u32 = readInt(); if(u32 < 0) { <START> holder.setLong((long) (u32 & 0x7fffffff) + 0x80000000L); <END> } else { holder.setInt(u32); } break; case Code.UINT64: long u64 = readLong(); if(u64 < 0L) { holder.setBigInteger(BigInteger.valueOf(u64 + Long.MAX_VALUE + 1L).setBit(63)); } else { holder.setLong(u64); } break; default: throw unexpected("Integer", b); } }</code><technical_language>calculate this result bit operation instead of combination of bit operation add operation? (long) (u32 & 0xffffffffL)</technical_language>

Target:
public void unpackInteger(IntegerHolder holder) throws IOException { byte b = consume(); if(Code.isFixInt(b)) { holder.setByte(b); return; } switch(b) { case Code.INT8: holder.setByte(readByte()); break; case Code.INT16: holder.setShort(readShort()); break; case Code.INT32: holder.setInt(readInt()); break; case Code.INT64: holder.setLong(readLong()); break; case Code.UINT8: byte u8 = readByte(); if(u8 < 0) { holder.setShort((short) (u8 & 0xFF)); } else { holder.setByte(u8); } break; case Code.UINT16: short u16 = readShort(); if(u16 < 0) { holder.setInt(u16 & 0xFFFF); } else { holder.setShort(u16); } break; case Code.UINT32: int u32 = readInt(); if(u32 < 0) { holder.setLong(u32 & 0xffffffffL); } else { holder.setInt(u32); } break; case Code.UINT64: long u64 = readLong(); if(u64 < 0L) { holder.setBigInteger(BigInteger.valueOf(u64 + Long.MAX_VALUE + 1L).setBit(63)); } else { holder.setLong(u64); } break; default: throw unexpected("Integer", b); } }
Source:
<code>public void clearValue() { image.setUrl(""); servingUrl = null; <START> attachment.set(new Attachment()); <END> uploadFailed.setVisible(false); downloadButton.setVisible(false); clearButton.setVisible(false); }</code><technical_language>attachment = Optional.absent() Optional.of(new Attachment())</technical_language>

Target:
public void clearValue() { uploader.setAttachment(new Attachment()); setState(State.NONE); }
Source:
<code><T> List<RangeFacetResult<T>> getRangeFacetsForField( Map<String, List<FacetResult>> facets, String expectedField, int expectedCount) { List<FacetResult> facetCollection = getFacetsForField(facets, expectedField, expectedCount); <START> return facetCollection.stream().map(facetResult -> new RangeFacetResult<T>(facetResult.getCount(), <END> (T) facetResult.getDocument().get(FACET_FROM), (T) facetResult.getDocument().get(FACET_TO))) .collect(Collectors.toList()); }</code><technical_language>logic create RangeFacetResult ValueFacetResult a FacetResult part of SDK, tests. customer facets need do this, easy</technical_language>

Target:
<T> List<RangeFacetResult<T>> getRangeFacetsForField( Map<String, List<FacetResult>> facets, String expectedField, int expectedCount) { List<FacetResult> facetCollection = getFacetsForField(facets, expectedField, expectedCount); return facetCollection.stream().map(RangeFacetResult<T>::new).collect(Collectors.toList()); }
Source:
<code>protected boolean canDoAction() { boolean retVal = true; if (getVmTemplate() == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } <START> <END> if (retVal && !VmTemplateHandler.isTemplateStatusIsNotLocked(getVmTemplateId())) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); retVal = false; } if (retVal) { DiskImageList images = templatesFromExport.get(LinqUtils.firstOrNull(templatesFromExport.keySet(), new Predicate<VmTemplate>() { @Override public boolean eval(VmTemplate t) { return t.getId().equals(getParameters().getVmTemplateId()); } })); if (images != null) { getParameters().setImages(Arrays.asList(images.getDiskImages())); } else { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } } if (retVal) { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retVal = validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); } if (retVal && getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); retVal = false; } if (retVal) { VmTemplate tmpl = DbFacade.getInstance().getVmTemplateDAO().get(getVmTemplateId()); if (tmpl != null) { retVal = (tmpl.getstatus() != VmTemplateStatus.Locked); if (!retVal) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } } } return retVal; }</code><technical_language>Great, checking a status of template is located DB. for? try run code</technical_language>

Target:
protected boolean canDoAction() { boolean retVal = true; if (getVmTemplate() == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } if (retVal) { DiskImageList images = templatesFromExport.get(LinqUtils.firstOrNull(templatesFromExport.keySet(), new Predicate<VmTemplate>() { @Override public boolean eval(VmTemplate t) { return t.getId().equals(getParameters().getVmTemplateId()); } })); if (images != null) { getParameters().setImages(Arrays.asList(images.getDiskImages())); } else { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } } if (retVal) { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retVal = validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); } if (retVal && getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); retVal = false; } if (retVal) { VmTemplate tmpl = DbFacade.getInstance().getVmTemplateDAO().get(getVmTemplateId()); if (tmpl != null) { retVal = (tmpl.getstatus() != VmTemplateStatus.Locked); if (!retVal) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } } } return retVal; }
Source:
<code>private static void checkCompDenpendency(XMLResource xr, Map<String, XMLResource> rcmap) { if (xr.depends.size() > 0) { return; } for (String zkModule : ZK_MODULES) { if (zkModule.equals(xr.name)) return; } Element xrRoot = xr.document.getRootElement(); for (Element el :xrRoot.getElements("component")) { if (el.getElement("extends") == null) continue; List<Element> ambigComps = findAmbiguousComps(rcmap, el); if (! ambigComps.isEmpty()) { <START> String strictStirng =xrRoot.getElement("strict").getText(); <END> boolean strict = strictStirng == null ? false : Boolean.parseBoolean(strictStirng); String addonName = ""; for (Element ambigComp: ambigComps) { Element ambigRoot = ambigComp.getDocument().getRootElement(); addonName = addonName.concat("'").concat(ambigRoot.getElement("addon-name").getFirstChild().getNodeValue()).concat("', "); } String message = "In {}, you are extending component which is defined in {}please define <depends>element"; String[] messageArgs = new String[]{xr.url.toString(), el.getElementValue("extends", true), addonName}; warningMessage(message, messageArgs, strict); } } }</code><technical_language>1. String strictStirng = xrRoot.getElement("strict").getText(); (missing a space =) 2. if is <strict> tag</technical_language>

Target:
private static void checkCompDenpendency(XMLResource xr, Map<String, XMLResource> rcmap) { if (xr.depends.size() > 0) { return; } for (String zkModule : ZK_MODULES) { if (zkModule.equals(xr.name)) return; } Element xrRoot = xr.document.getRootElement(); Element strictElement = xrRoot.getElement("strict"); boolean strict = strictElement == null ? false : Boolean.parseBoolean(strictElement.getText(true)); for (Element el : xrRoot.getElements("component")) { if (el.getElement("extends") == null) continue; List<Element> ambigComps = findAmbiguousComps(rcmap, el); if (!ambigComps.isEmpty()) { StringBuilder addonNameBuilder = new StringBuilder(); String addonName = ""; for (Element ambigComp : ambigComps) { Element ambigRoot = ambigComp.getDocument().getRootElement(); addonNameBuilder.append("'").append(ambigRoot.getElement("addon-name").getFirstChild().getNodeValue()).append("', "); } String message = "In {}, you are extending component which is defined in {}please define <depends> element"; String[] messageArgs = new String[]{xr.url.toString(), el.getElementValue("extends", true), addonNameBuilder.toString()}; warningMessage(message, messageArgs, strict); } } }
Source:
<code>public void expiration_task_starts_on_new_node_after_migration_when_there_is_expirable_entry() { Config config = new Config(); config.setProperty(taskPeriodSecondsPropName(), "1"); TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(); final HazelcastInstance node1 = factory.newHazelcastInstance(config); CacheManager cacheManager = createCacheManager(node1); Cache cache = cacheManager.createCache("test", new CacheConfig()); <START> ((ICache) cache).put(1, 1, new ExpiryPolicy() { <END> @Override public Duration getExpiryForCreation() { return Duration.ONE_HOUR; } @Override public Duration getExpiryForAccess() { return Duration.ONE_HOUR; } @Override public Duration getExpiryForUpdate() { return Duration.ONE_HOUR; } }); final HazelcastInstance node2 = factory.newHazelcastInstance(config); node1.shutdown(); assertTrueEventually(new AssertTask() { @Override public void run() { assertTrue("There should be one ClearExpiredRecordsTask started", hasClearExpiredRecordsTaskStarted(node2)); } }); }</code><technical_language>new HazelcastExpiryPolicy(10000, 10000, 10000) this shorter</technical_language>

Target:
public void expiration_task_starts_on_new_node_after_migration_when_there_is_expirable_entry() { Config config = new Config(); config.setProperty(taskPeriodSecondsPropName(), "1"); TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(); final HazelcastInstance node1 = factory.newHazelcastInstance(config); CacheManager cacheManager = createCacheManager(node1); Cache cache = cacheManager.createCache("test", new CacheConfig()); ((ICache) cache).put(1, 1, new HazelcastExpiryPolicy(ONE_HOUR, ONE_HOUR, ONE_HOUR)); final HazelcastInstance node2 = factory.newHazelcastInstance(config); node1.shutdown(); assertTrueEventually(new AssertTask() { @Override public void run() { assertTrue("There should be one ClearExpiredRecordsTask started", hasClearExpiredRecordsTaskStarted(node2)); } }); }
Source:
<code>private String applyTemplate(Map<String, Serializable> map) { try { return template.apply(map); } catch (IOException ioe) { <START> LOGGER.error("Unable to apply template '" + templateText + "'", ioe); <END> } return null; }</code><technical_language>this parameterized</technical_language>

Target:
private String applyTemplate(Map<String, Serializable> map) { try { return template.apply(map); } catch (IOException ioe) { LOGGER.error("Unable to apply template {}", templateText, ioe); } return null; }
Source:
<code>public List<FileBlockInfo> getFileBlockInfos() { <START> return new ArrayList<>(mFileBlockInfos.values()); <END> }</code><technical_language>this called often, list copy expensive</technical_language>

Target:
public List<FileBlockInfo> getFileBlockInfos() { return mFileBlockInfoList; }
Source:
<code>public void testHtml() { String simple = "<head></head>"; String normal = "<a href=\"www.tracecompass.org\">Trace Compass</a>"; String complexValid = "<body id=\"useless tag\">"+ "<div attribute=someattr> <a>\tSkip to main page <!-- Sign Up to our Newsletter --></a> "+ "</body>"; String broken1 = "<head><head>"; String broken2 = "<head></body>"; String broken3 = "Vince wants his name in the unit tests"; ToolTipString simpleHtml = ToolTipString.fromHtml(simple); ToolTipString normalHtml = ToolTipString.fromHtml(normal); ToolTipString complexHtml = ToolTipString.fromHtml(complexValid); ToolTipString brokenHtml1 = ToolTipString.fromHtml(broken1); ToolTipString brokenHtml2 = ToolTipString.fromHtml(broken2); ToolTipString brokenHtml3 = ToolTipString.fromHtml(broken3); assertNotNull(simpleHtml); assertNotNull(normalHtml); assertNotNull(complexHtml); assertNotNull(brokenHtml1); assertNotNull(brokenHtml2); <START> assertNotNull(brokenHtml3); <END> assertEquals("", simpleHtml.toString()); assertEquals("Trace Compass", normalHtml.toString()); assertEquals(" \tSkip to main page ", complexHtml.toString()); assertEquals("", brokenHtml1.toString()); assertEquals("", brokenHtml2.toString()); assertEquals(broken3, brokenHtml3.toString()); assertEquals(simple, simpleHtml.toHtmlString()); assertEquals(normal, normalHtml.toHtmlString()); assertEquals(complexValid, complexHtml.toHtmlString()); assertEquals(broken1, brokenHtml1.toHtmlString()); assertEquals(broken2, brokenHtml2.toHtmlString()); assertEquals(broken3, brokenHtml3.toHtmlString()); }</code><technical_language>necessary, test fail</technical_language>

Target:
public void testHtml() { String simple = "<head></head>"; String normal = "<a href=\"www.tracecompass.org\">Trace Compass</a>"; String complexValid = "<body id=\"useless tag\">"+ "<div attribute=someattr> <a>\tSkip to main page <!-- Sign Up to our Newsletter --></a> "+ "</body>"; String broken1 = "<head><head>"; String broken2 = "<head></body>"; String broken3 = "Vince wants his name in the unit tests"; ToolTipString simpleHtml = ToolTipString.fromHtml(simple); ToolTipString normalHtml = ToolTipString.fromHtml(normal); ToolTipString complexHtml = ToolTipString.fromHtml(complexValid); ToolTipString brokenHtml1 = ToolTipString.fromHtml(broken1); ToolTipString brokenHtml2 = ToolTipString.fromHtml(broken2); ToolTipString brokenHtml3 = ToolTipString.fromHtml(broken3); assertEquals("", simpleHtml.toString()); assertEquals("Trace Compass", normalHtml.toString()); assertEquals(" \tSkip to main page ", complexHtml.toString()); assertEquals("", brokenHtml1.toString()); assertEquals("", brokenHtml2.toString()); assertEquals(broken3, brokenHtml3.toString()); assertEquals(simple, simpleHtml.toHtmlString()); assertEquals(normal, normalHtml.toHtmlString()); assertEquals(complexValid, complexHtml.toHtmlString()); assertEquals(broken1, brokenHtml1.toHtmlString()); assertEquals(broken2, brokenHtml2.toHtmlString()); assertEquals(broken3, brokenHtml3.toHtmlString()); }
Source:
<code>private void initListeners() { listen(Message.BOOKMARKS, (sender, subject, args) -> { <START> show(); <END> }); listen(Message.LOADED, (sender, subject, args) -> { switch (subject) { case "known mutations": assert args[0] instanceof List<?>; List<KnownMutation> knownMutations = (List<KnownMutation>) args[0]; listItems.addAll(knownMutations); return; case "annotations": assert args[0] instanceof List<?>; List<GeneAnnotation> genes = (List<GeneAnnotation>) args[0]; listItems.addAll(genes); return; default: return; } }); }</code><technical_language>redundant curly brackets</technical_language>

Target:
private void initListeners() { listen(Message.BOOKMARKS, (sender, subject, args) -> setVisibility(true) ); listen(Message.LOADED, (sender, subject, args) -> { if ("known mutations".equals(subject) || "annotations".equals(subject)) { assert args[0] instanceof List<?>; List<AbstractBookmark> bookmarks = (List<AbstractBookmark>) args[0]; listItems.addAll(bookmarks); } }); }
Source:
<code>public StringBuilder getTaskBoardStoryTaskListText(String filterName) { int storyLength = 0; ArrayList<TaskBoard_Story> storyList = new ArrayList<TaskBoard_Story>(); if ((mSprintBacklogMapper != null) && (mSprintBacklogMapper.getSprintId() > 0)) { ArrayList<StoryObject> stories = mSprintBacklogLogic.getStoriesByImp(); <START> HashMap<Long, ArrayList<TaskObject>> storyToTasks = getStoryToTasksMap(stories); <END> stories = filterStory(stories, storyToTasks, filterName); for (StoryObject story : stories) { storyList.add(create_TaskBoard_Story(story, storyToTasks.get(story.getId()))); } storyLength = stories.size(); } else { storyLength = 0; } Gson gson = new GsonBuilder().disableHtmlEscaping().create();; LinkedHashMap<String, Object> jsonMap = new LinkedHashMap<String, Object>(); jsonMap.put("Stories", storyList); jsonMap.put("success", true); jsonMap.put("Total", storyLength); return new StringBuilder(gson.toJson(jsonMap)); }</code><technical_language>remove map</technical_language>

Target:
public StringBuilder getTaskBoardStoryTaskListText(String filterName) { int storyLength = 0; ArrayList<TaskBoard_Story> storyList = new ArrayList<TaskBoard_Story>(); if ((mSprintBacklogMapper != null) && (mSprintBacklogMapper.getSprintId() > 0)) { ArrayList<StoryObject> stories = mSprintBacklogLogic.getStoriesByImp(); HashMap<Long, ArrayList<TaskObject>> storyToTasks = getStoryToTasksMap(stories); stories = filterStory(stories, storyToTasks, filterName); for (StoryObject story : stories) { storyList.add(createTaskBoardStory(story, storyToTasks.get(story.getId()))); } storyLength = stories.size(); } else { storyLength = 0; } Gson gson = new GsonBuilder().disableHtmlEscaping().create();; LinkedHashMap<String, Object> jsonMap = new LinkedHashMap<String, Object>(); jsonMap.put("Stories", storyList); jsonMap.put("success", true); jsonMap.put("Total", storyLength); return new StringBuilder(gson.toJson(jsonMap)); }
Source:
<code>public void deleteTenant(WebContext ctx, String tenantId) { Optional<Tenant> t = oma.find(Tenant.class, tenantId); if (t.isPresent()) { <START> if (!Objects.equals(t.get().getId(), tenants.getRequiredTenant().getId())) { <END> throw Exceptions.createHandled().withNLSKey("TenantController.cannotDeleteSelf").handle(); } oma.delete(t.get()); showDeletedMessage(); } tenants(ctx); }</code><technical_language>Entity equal</technical_language>

Target:
public void deleteTenant(WebContext ctx, String tenantId) { Optional<Tenant> t = oma.find(Tenant.class, tenantId); if (t.isPresent()) { if (t.get().equals(tenants.getRequiredTenant())) { throw Exceptions.createHandled().withNLSKey("TenantController.cannotDeleteSelf").handle(); } oma.delete(t.get()); showDeletedMessage(); } tenants(ctx); }
Source:
<code>public static URLConnection getConnection(String bucketName, String objectKey, String awsAccessKeyId, String awsAccessSecret) throws IOException { <START> <END> final String date = getDate(); final String payload = String.format(GET_PAYLOAD, date, bucketName, objectKey); final String signature = MD5Util.generateHMAC(payload, awsAccessSecret); final URL url = new URL(String.format(S3_URL, bucketName, objectKey)); final URLConnection conn = url.openConnection(); conn.setConnectTimeout(CONNECTION_TIMEOUT); conn.setReadTimeout(CONNECTION_TIMEOUT); conn.setRequestProperty("Date", date); conn.setRequestProperty("Authorization", "AWS " + awsAccessKeyId + ":" + signature); return conn; }</code><technical_language>I wondering foresee a scenario multiple AWS access credentials I imagine this put private</technical_language>

Target:
public static URLConnection getConnection(String bucketName, String objectKey, String awsAccessKeyId, String awsAccessSecret) throws IOException { final String date = getDate(); final String payload = String.format(GET_PAYLOAD, date, bucketName, objectKey); final String signature = MD5Util.generateHMAC(payload, awsAccessSecret); final URL url = new URL(String.format(S3_URL, bucketName, objectKey)); final URLConnection conn = url.openConnection(); conn.setConnectTimeout(CONNECTION_TIMEOUT); conn.setReadTimeout(CONNECTION_TIMEOUT); conn.addRequestProperty("Cache-Control", "no-cache,max-age=0"); conn.setRequestProperty("Date", date); conn.setRequestProperty("Authorization", "AWS " + awsAccessKeyId + ":" + signature); return conn; }
Source:
<code>public String getPackageName() { if (clazz.getPackage() != null) { return clazz.getPackage().getName(); } <START> return null; <END> }</code><technical_language>this method return null? return empty string</technical_language>

Target:
public String getPackageName() { if (clazz.getPackage() != null) { return clazz.getPackage().getName(); } return ""; }
Source:
<code>public final void listReleaseAssets() throws java.io.IOException { final FakeRequest req = new FakeRequest(); final Coordinates.Simple coords = new Coordinates.Simple("test", "releases"); final Release release = new RtRelease( req, coords, 1 ); MatcherAssert.assertThat( release.iterate( req, coords ), <START> Matchers.notNullValue() <END> ); }</code><technical_language>a good assertion. check a release is returned</technical_language>

Target:
public final void listReleaseAssets() throws java.io.IOException { final FakeRequest req = new FakeRequest(); final Coordinates.Simple coords = new Coordinates.Simple("test", "releases"); final Release release = new RtRelease( req, coords, 1 ); MatcherAssert.assertThat( release.iterate( req, coords ), Matchers.instanceOf(Request.class) ); }
Source:
<code><START> private List<OperatorDTO> adaptToOperatorDTOs(List<Operator> operators) { <END> List<OperatorDTO> dtos = Lists.newArrayList(); for (Operator operator : operators) { dtos.add(new OperatorDTO(operator.id, operator.name, operator.state, operator.description, operator.domainName, operator.friendlyName)); } return dtos; }</code><technical_language>tests for this</technical_language>

Target:
private List<OperatorDTO> adaptToOperatorDTOs(List<Operator> operators) { List<OperatorDTO> dtos = Lists.newArrayList(); for (Operator operator : operators) { dtos.add(new OperatorDTO(operator.id.value, operator.name, operator.state.name(), operator.description, operator.domainName, operator.friendlyName, operator.emergencyNumber)); } return dtos; }
Source:
<code>public void test_AllOf_LClass() { try { EnumSet.allOf((Class) null); fail("Should throw NullPointerException"); } catch (NullPointerException e) { } try { EnumSet.allOf(Enum.class); fail("Should throw ClassCastException"); } catch (ClassCastException cce) { } EnumSet<EnumFoo> enumSet = EnumSet.allOf(EnumFoo.class); <START> assertEquals("Size of enumSet should be 64", 64, enumSet.size()); <END> assertFalse( "enumSet should not contain null value", enumSet.contains(null)); assertTrue( "enumSet should contain EnumFoo.a", enumSet.contains(EnumFoo.a)); assertTrue( "enumSet should contain EnumFoo.b", enumSet.contains(EnumFoo.b)); enumSet.add(EnumFoo.a); assertSize(64, enumSet); EnumSet<EnumFoo> anotherSet = EnumSet.allOf(EnumFoo.class); assertEquals("Should be equal", enumSet, anotherSet); assertNotSame("Should not be identical", enumSet, anotherSet); EnumSet<HugeEnum> hugeEnumSet = EnumSet.allOf(HugeEnum.class); assertSize(65, hugeEnumSet); assertFalse(hugeEnumSet.contains(null)); assertTrue(hugeEnumSet.contains(HugeEnum.a)); assertTrue(hugeEnumSet.contains(HugeEnum.b)); hugeEnumSet.add(HugeEnum.a); assertSize(65, hugeEnumSet); EnumSet<HugeEnum> anotherHugeSet = EnumSet.allOf(HugeEnum.class); assertEquals(hugeEnumSet, anotherHugeSet); assertNotSame(hugeEnumSet, anotherHugeSet); }</code><technical_language>assertSize() below</technical_language>

Target:
public void test_AllOf_LClass() { try { EnumSet.allOf((Class) null); fail("Should throw NullPointerException"); } catch (NullPointerException e) { } try { EnumSet.allOf(Enum.class); fail("Should throw ClassCastException"); } catch (ClassCastException cce) { } EnumSet<EnumFoo> enumSet = EnumSet.allOf(EnumFoo.class); assertEquals("Size of enumSet should be 64", 64, enumSet.size()); assertFalse( "enumSet should not contain null value", enumSet.contains(null)); assertTrue( "enumSet should contain EnumFoo.a", enumSet.contains(EnumFoo.a)); assertTrue( "enumSet should contain EnumFoo.b", enumSet.contains(EnumFoo.b)); enumSet.add(EnumFoo.a); assertEquals("Should be equal", 64, enumSet.size()); EnumSet<EnumFoo> anotherSet = EnumSet.allOf(EnumFoo.class); assertEquals("Should be equal", enumSet, anotherSet); assertNotSame("Should not be identical", enumSet, anotherSet); EnumSet<HugeEnum> hugeEnumSet = EnumSet.allOf(HugeEnum.class); assertEquals(65, hugeEnumSet.size()); assertFalse(hugeEnumSet.contains(null)); assertTrue(hugeEnumSet.contains(HugeEnum.a)); assertTrue(hugeEnumSet.contains(HugeEnum.b)); hugeEnumSet.add(HugeEnum.a); assertEquals(65, hugeEnumSet.size()); EnumSet<HugeEnum> anotherHugeSet = EnumSet.allOf(HugeEnum.class); assertEquals(hugeEnumSet, anotherHugeSet); assertNotSame(hugeEnumSet, anotherHugeSet); }
Source:
<code>public CompletionStage<Result> query() { try { final MetricsQuery query = parseQueryJson(); final CompletionStage<TimeSeriesResult> response = _queryExecutor.executeQuery(query.getQuery()); return response.<JsonNode>thenApply(_mapper::valueToTree).thenApply(Results::ok); } catch (final RuntimeException ex) { <START> return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex))); <END> } catch (final ExecutionException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex.getProblems()))); } }</code><technical_language>this a 500</technical_language>

Target:
public CompletionStage<Result> query() { final JsonNode body = request().body().asJson(); if (body == null) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson("null body for query"))); } try { final MetricsQuery query = _mapper.treeToValue(body, MetricsQuery.class); final CompletionStage<TimeSeriesResult> response = _queryExecutor.executeQuery(query.getQuery()); return response.<JsonNode>thenApply(_mapper::valueToTree).thenApply(Results::ok); } catch (final RuntimeException ex) { return CompletableFuture.completedFuture(Results.internalServerError(createErrorJson(ex))); } catch (final QueryExecutionException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex.getProblems()))); } catch (final JsonProcessingException e) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(e))); } }
Source:
<code>public Map<String, Ref> getRemoteRefs() throws IOException { Map<String, Ref> matches = new HashMap<String, Ref>(); RefDatabase rdb = repository.getRefDatabase(); for (RefSpec spec : getSubscribeSpecs()) { String remoteRef; boolean isTag = spec.getSource().startsWith(Constants.R_TAGS); if (isTag) remoteRef = spec.getSource(); else remoteRef = getRemoteRefFromLocal(remote, spec.getSource()); Collection<Ref> c; if (spec.isWildcard()) { remoteRef = remoteRef.substring(0, remoteRef.length() - 1); <START> c = rdb.getRefs(remoteRef).values(); <END> } else { Ref r = rdb.getRef(remoteRef); if (r == null) continue; c = Collections.singleton(r); } for (Ref r : c) { if (isTag) matches.put(r.getName(), r); else matches.put(getLocalRefFromRemote(getRemote(), r.getName()), r); } } return matches; }</code><technical_language>This is costly, amount of refs need grabbing local references passing Map around</technical_language>

Target:
public Map<String, Ref> getRemoteRefs() throws IOException { if (remoteRefs == null) cacheRemoteRefs(); return remoteRefs; }
Source:
<code><START> protected void handleStMgrRegisterRequest( <END> REQID rid, SocketChannel channel, CheckpointManager.RegisterStMgrRequest request ) { LOG.info("Got a register request from " + request.getStmgrId() + " host:port " + channel.socket().getRemoteSocketAddress()); CheckpointManager.RegisterStMgrResponse.Builder responseBuilder = CheckpointManager.RegisterStMgrResponse.newBuilder(); if (!request.getTopologyName().equals(topologyName)) { LOG.severe("The register message was from a different topology: " + request.getTopologyName()); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK)); } else if (!request.getTopologyId().equals(topologyId)) { LOG.severe("The register message was from a different topology id: " + request.getTopologyName()); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK)); } else if (connection != null) { LOG.warning("We already have an active connection from the stmgr " + request.getStmgrId() + ". Closing existing connection..."); try { connection.close(); } catch (IOException e) { LOG.warning("Failed to close connection from: " + connection.socket().getRemoteSocketAddress()); } connection = null; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK)); } else { connection = channel; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.OK)); } sendResponse(rid, channel, responseBuilder.build()); }</code><technical_language>is implementation of this method handleTMasterRegisterRequest? duplicates</technical_language>

Target:
protected void handleStMgrRegisterRequest( REQID rid, SocketChannel channel, CheckpointManager.RegisterStMgrRequest request ) { LOG.info(String.format("Got a StMgr register request from %s running on host:port %s", request.getStmgrId(), channel.socket().getRemoteSocketAddress())); CheckpointManager.RegisterStMgrResponse.Builder responseBuilder = CheckpointManager.RegisterStMgrResponse.newBuilder(); if (!checkRegistrationValidity(request.getTopologyName(), request.getTopologyId())) { String errorMessage = String.format("The StMgr register message came with a different " + "topologyName: %s and/or topologyId: %s", request.getTopologyName(), request.getTopologyId()); LOG.severe(errorMessage); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK) .setMessage(errorMessage)); } else if (!checkExistingConnection()) { String errorMessage = "Please try again"; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK) .setMessage(errorMessage)); } else { connection = channel; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.OK)); } sendResponse(rid, channel, responseBuilder.build()); }
Source:
<code>public void testOpenAndCloseConcurrency() { SWTBotUtil.createProject(TRACE_PROJECT_NAME); File fTestFile = new File(CTF_TRACE.getPath()); String path = fTestFile.getAbsolutePath(); assertNotNull(fTestFile); assumeTrue(fTestFile.exists()); final MultiStatus status = new MultiStatus("lttn2.kernel.ui.swtbot.tests", IStatus.OK, null, null); IJobManager mgr = Job.getJobManager(); JobChangeAdapter changeListener = new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { Job job = event.getJob(); <START> if ((job.getName().startsWith("Running analysis")) && (job.getResult().getSeverity() == IStatus.ERROR)) { <END> status.add(job.getResult()); } } }; mgr.addJobChangeListener(changeListener); for (int i = 0; i < 10; i++) { SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.delay(1000); workbenchbot.closeAllEditors(); if (!status.isOK()) { SWTBotUtil.deleteProject(TRACE_PROJECT_NAME, workbenchbot); fail(handleErrorStatus(status)); } } SWTBotUtil.deleteProject(TRACE_PROJECT_NAME, workbenchbot); }</code><technical_language>"Running analysis" string is localized, long test is in english, OK, (are forced in english do language a machine is in?) If another identify analysis job this title, preferable</technical_language>

Target:
public void testOpenAndCloseConcurrency() { SWTBotUtil.createProject(TRACE_PROJECT_NAME); File fTestFile = new File(CTF_TRACE.getPath()); String path = fTestFile.getAbsolutePath(); assertNotNull(fTestFile); assumeTrue(fTestFile.exists()); final MultiStatus status = new MultiStatus("lttn2.kernel.ui.swtbot.tests", IStatus.OK, null, null); IJobManager mgr = Job.getJobManager(); JobChangeAdapter changeListener = new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { Job job = event.getJob(); String jobNamePrefix = NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, ""); if ((job.getName().startsWith(jobNamePrefix)) && (job.getResult().getSeverity() == IStatus.ERROR)) { status.add(job.getResult()); } } }; mgr.addJobChangeListener(changeListener); for (int i = 0; i < 10; i++) { SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.delay(1000); workbenchbot.closeAllEditors(); if (!status.isOK()) { SWTBotUtil.deleteProject(TRACE_PROJECT_NAME, workbenchbot); fail(handleErrorStatus(status)); } } SWTBotUtil.deleteProject(TRACE_PROJECT_NAME, workbenchbot); }