auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void UpdateOptionsNonLocalFS() { if (hosts == null || allHosts == null) { return; } if (getEntity() == null) { StopProgress(); <START> return; <END> } UICommand addHostAction = new UICommand("AddHost", this); if (hosts.size() > 1) { hosts.remove(0); } if (hosts.isEmpty()) { addHostAction.setTitle(ClusterConfigureHostsAction); getCompulsoryActions().add(addHostAction); } else { addHostAction.setTitle(ClusterAddAnotherHostAction); getOptionalActions().add(addHostAction); } if (getEntity().getStoragePoolId() == null) { addHostAction.getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .theClusterIsntAttachedToADcClusterGuide()); addHostAction.setIsExecutionAllowed(false); return; } ArrayList<VDS> availableHosts = new ArrayList<VDS>(); for (VDS vds : allHosts) { if (!getEntity().getId().equals(vds.getVdsGroupId()) && (vds.getStatus() == VDSStatus.Maintenance || vds.getStatus() == VDSStatus.PendingApproval) && vds.getSupportedClusterVersionsSet().contains(getEntity().getcompatibility_version())) { availableHosts.add(vds); } } UICommand selectHostAction = new UICommand("SelectHost", this); if (availableHosts.size() > 0) { if (hosts.isEmpty()) { selectHostAction.setTitle(SelectHostsAction); getCompulsoryActions().add(selectHostAction); } else { selectHostAction.setTitle(SelectHostsAction); getOptionalActions().add(selectHostAction); } } StopProgress(); }</code><technical_language>remove 'return' replace 'setWindow(null)'? (to prevent a blank dialog)</technical_language>

Target:
private void UpdateOptionsNonLocalFS() { if (hosts == null || allHosts == null) { return; } if (getEntity() == null) { StopProgress(); setWindow(null); return; } UICommand addHostAction = new UICommand("AddHost", this); if (hosts.size() > 1) { hosts.remove(0); } if (hosts.isEmpty()) { addHostAction.setTitle(ClusterConfigureHostsAction); getCompulsoryActions().add(addHostAction); } else { addHostAction.setTitle(ClusterAddAnotherHostAction); getOptionalActions().add(addHostAction); } if (getEntity().getStoragePoolId() == null) { addHostAction.getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .theClusterIsntAttachedToADcClusterGuide()); addHostAction.setIsExecutionAllowed(false); return; } ArrayList<VDS> availableHosts = new ArrayList<VDS>(); for (VDS vds : allHosts) { if (!getEntity().getId().equals(vds.getVdsGroupId()) && (vds.getStatus() == VDSStatus.Maintenance || vds.getStatus() == VDSStatus.PendingApproval) && vds.getSupportedClusterVersionsSet().contains(getEntity().getcompatibility_version())) { availableHosts.add(vds); } } UICommand selectHostAction = new UICommand("SelectHost", this); if (availableHosts.size() > 0) { if (hosts.isEmpty()) { selectHostAction.setTitle(SelectHostsAction); getCompulsoryActions().add(selectHostAction); } else { selectHostAction.setTitle(SelectHostsAction); getOptionalActions().add(selectHostAction); } } StopProgress(); }
Source:
<code>public void testActivateDeActivate() throws GridClientException { GridClientClusterState state = client.state(); boolean active = state.state() == ACTIVE; assertTrue(active); state.state(INACTIVE, true); IgniteEx ig1 = grid(0); IgniteEx ig2 = grid(1); assertFalse(ig1.active()); assertFalse(ig2.active()); assertEquals(state.state(), INACTIVE); <START> state.state(ACTIVE, true); <END> assertTrue(ig1.active()); assertTrue(ig2.active()); assertEquals(state.state(), ACTIVE); }</code><technical_language>is cluster deactivation, forceDeactivation false</technical_language>

Target:
public void testActivateDeActivate() throws GridClientException { GridClientClusterState state = client.state(); boolean active = active(state.state()); assertTrue(active); state.state(INACTIVE, true); IgniteEx ig1 = grid(0); IgniteEx ig2 = grid(1); assertFalse(ig1.active()); assertFalse(ig2.active()); assertEquals(INACTIVE, state.state()); state.state(ACTIVE, false); assertTrue(ig1.active()); assertTrue(ig2.active()); assertEquals(ACTIVE, state.state()); }
Source:
<code>public static boolean customImageExists(String storage, String key) { boolean retval = false; final AzureBlobClient azureBlob = ContextBuilder.newBuilder("azureblob") .credentials(storage, key) .buildApi(AzureBlobClient.class); <START> if (azureBlob.containerExists("system")) <END> retval = true; try { azureBlob.close(); } catch (IOException e) { e.printStackTrace(); } return retval; }</code><technical_language>return azureBlob.containerExists("system"); wrap in a try/finally block close context</technical_language>

Target:
public static boolean customImageExists(String storage, String key) { final AzureBlobClient azureBlob = ContextBuilder.newBuilder("azureblob") .credentials(storage, key) .buildApi(AzureBlobClient.class); try { return azureBlob.containerExists("system"); } finally { Closeables2.closeQuietly(azureBlob); } }
Source:
<code>public static List<Path> unrollPaths(final Collection<Path> inputs, final String... extensions) { if (extensions.length < 1) throw new IllegalArgumentException("Must provide at least one extension."); final Stack<Path> stack = new Stack<>(); final List<Path> output = new ArrayList<>(); stack.addAll(inputs); while (!stack.empty()) { final Path p = stack.pop(); final String name = p.toString(); boolean matched = false; for (final String ext : extensions) { if (!matched && name.endsWith(ext)) { output.add(p); matched = true; } } if (!matched) { try { Files.lines(p) .map(String::trim) .filter(s -> !s.isEmpty()) .forEach(s -> { final Path innerPath; try { innerPath = getPath(s); stack.push(innerPath); } catch (IOException e) { throw new IllegalArgumentException("cannot convert " + s + " to a Path."); } } ); } catch (IOException e) { <START> throw new IllegalArgumentException("had trouble reading from " + p.toUri().toString()); <END> } } } Collections.reverse(output); return output; }</code><technical_language>add exception e this newly thrown exception</technical_language>

Target:
public static List<Path> unrollPaths(final Collection<Path> inputs, final String... extensions) { if (extensions.length < 1) throw new IllegalArgumentException("Must provide at least one extension."); final Stack<Path> stack = new Stack<>(); final List<Path> output = new ArrayList<>(); stack.addAll(inputs); while (!stack.empty()) { final Path p = stack.pop(); final String name = p.toString(); boolean matched = false; for (final String ext : extensions) { if (!matched && name.endsWith(ext)) { output.add(p); matched = true; } } if (!matched) { try { Files.lines(p) .map(String::trim) .filter(s -> !s.isEmpty()) .forEach(s -> { final Path innerPath; try { innerPath = getPath(s); stack.push(innerPath); } catch (IOException e) { throw new IllegalArgumentException("cannot convert " + s + " to a Path.", e); } } ); } catch (IOException e) { throw new IllegalArgumentException("had trouble reading from " + p.toUri().toString(), e); } } } Collections.reverse(output); return output; }
Source:
<code>public Collection<IResource> getItems(){ if(items == null) { ModelNode listNode = get(ITEMS); if (listNode.isDefined()) { <START> Collection<ModelNode> nodes = get(ITEMS).asList(); <END> items = new ArrayList<>(nodes.size()); IResourceFactory factory = getClient().getResourceFactory(); if (factory != null) { for (ModelNode node : nodes) { if (kind != null && !node.get(KIND).isDefined()) { set(node, KIND, kind); } if(!node.get(APIVERSION).isDefined()) { set(node, APIVERSION, getApiVersion()); } IResource resource = factory.create(node.toJSONString(true)); items.add(resource); } } } else { items = Collections.emptyList(); } } return Collections.unmodifiableCollection(items); }</code><technical_language>listNode.asList()</technical_language>

Target:
public Collection<IResource> getItems(){ if(items == null) { String key = getNode().has(OBJECTS) ? OBJECTS : ITEMS; ModelNode listNode = get(key); if (listNode.isDefined()) { Collection<ModelNode> nodes = get(key).asList(); items = new ArrayList<>(nodes.size()); IResourceFactory factory = getClient().getResourceFactory(); if (factory != null) { for (ModelNode node : nodes) { if (kind != null && !node.get(KIND).isDefined()) { set(node, KIND, kind); } if(!node.get(APIVERSION).isDefined()) { set(node, APIVERSION, getApiVersion()); } IResource resource = factory.create(node.toJSONString(true)); items.add(resource); } } } else { items = Collections.emptyList(); } } return Collections.unmodifiableCollection(items); }
Source:
<code>public Term substituteAndEvaluate(Map<Variable, ? extends Term> substitution, TermContext context) { <START> if ((!substitution.isEmpty() && !isGround()) || !isNormal()) { <END> return (Term) this.accept(new SubstituteAndEvaluateTransformer(substitution, context)); } else { return this; } }</code><technical_language>This condition is hard read. I prefer return isNormal && (substitution.isEmpty() || isGround()) ? this : (Term) this.accept(new SubstituteAndEvaluateTransformer(substitution, context));</technical_language>

Target:
public Term substituteAndEvaluate(Map<Variable, ? extends Term> substitution, TermContext context) { return canSubstituteAndEvaluate(substitution) ? (Term) this.accept(new SubstituteAndEvaluateTransformer(substitution, context)) : this; }
Source:
<code>public boolean equals(Object obj) { <START> if (!(obj instanceof AccessToken)) { <END> return false; } IdToken other = (IdToken) obj; return Objects.equals(super.getTokenValue(), other.getTokenValue()) && Objects.equals(this.jws, other.jws); }</code><technical_language>suggestion if (!(obj instanceof IdToken)) {</technical_language>

Target:
public boolean equals(Object obj) { if (!(obj instanceof IdToken)) { return false; } IdToken other = (IdToken) obj; return Objects.equals(super.getTokenValue(), other.getTokenValue()) && Objects.equals(this.jsonWebSignature.getHeader(), other.jsonWebSignature.getHeader()) && Objects.equals(this.jsonWebSignature.getPayload(), other.jsonWebSignature.getPayload()); }
Source:
<code>public void onApplicationEvent(ApplicationEvent event) { LOG.debug("onApplicationEvent: {}", event); <START> if (event instanceof ContextRefreshedEvent && ((ContextRefreshedEvent) event).getApplicationContext().getId().equals(this.applicationContext.getId())) { <END> start(); } if (eventComponent != null) { eventComponent.onApplicationEvent(event); } }</code><technical_language>watch out for ApplicationContext::getId returning null suggestion if (event instanceof ContextRefreshedEvent && ((ContextRefreshedEvent) event).getApplicationContext() == this.applicationContext) {</technical_language>

Target:
public void onApplicationEvent(ApplicationEvent event) { LOG.debug("onApplicationEvent: {}", event); if (event instanceof ContextRefreshedEvent && ((ContextRefreshedEvent) event).getApplicationContext() == this.applicationContext) { start(); } if (eventComponent != null) { eventComponent.onApplicationEvent(event); } }
Source:
<code>public ActivationKeyDTO setPools(Set<ActivationKeyPoolDTO> pools) { if (pools != null) { if (this.pools == null) { this.pools = new HashSet<ActivationKeyPoolDTO>(); } else { this.pools.clear(); } for (ActivationKeyPoolDTO dto : pools) { if (dto == null || dto.getPoolId() == null || "".equals(dto.getPoolId())) { throw new IllegalArgumentException("collection contains null or incomplete dtos"); } <START> <END> this.pools.add(new ActivationKeyPoolDTO(dto.getPoolId(), dto.getQuantity())); } } else { this.pools = null; } return this; }</code><technical_language>Missing doc blocks of methods</technical_language>

Target:
public ActivationKeyDTO setPools(Set<ActivationKeyPoolDTO> pools) { if (pools != null) { if (this.pools == null) { this.pools = new HashSet<ActivationKeyPoolDTO>(); } else { this.pools.clear(); } for (ActivationKeyPoolDTO dto : pools) { if (dto == null || dto.getPoolId() == null || dto.getPoolId().isEmpty()) { throw new IllegalArgumentException("collection contains null or incomplete pools"); } this.pools.add(new ActivationKeyPoolDTO(dto.getPoolId(), dto.getQuantity())); } } else { this.pools = null; } return this; }
Source:
<code>static List<Arguments> testWhatIsValid() { return List.of( Arguments.of( "Attacker has air units and no destroyers vs Defender subs", givenBattleState() <START> .attackingUnits(List.of(givenUnit(), givenUnitIsAir())) <END> .defendingUnits(List.of(givenUnitCanNotBeTargetedBy(mock(UnitType.class)))) .build(), true), Arguments.of( "Attacker has air units and destroyers", givenBattleState() .attackingUnits(List.of(givenUnitDestroyer(), givenUnitIsAir())) .defendingUnits(List.of(mock(Unit.class))) .build(), false), Arguments.of( "Attacker has air units but no destroyers vs Defender with no subs", givenBattleState() .attackingUnits(List.of(givenUnit(), givenUnitIsAir())) .defendingUnits(List.of(givenUnit())) .build(), false)); }</code><technical_language>Nit, methods a parameter. like: givenUnitWithAttackPower(2) If is parameter, return is generic, typical (note 'any' word): givenAnyUnit() spell out is special is returned, done in example of: givenUnitIsAir()</technical_language>

Target:
static List<Arguments> testWhatIsValid() { return List.of( Arguments.of( "Attacker has air units and no destroyers vs Defender subs", givenBattleStateBuilder() .attackingUnits(List.of(givenAnyUnit(), givenUnitIsAir())) .defendingUnits(List.of(givenUnitCanNotBeTargetedBy(mock(UnitType.class)))) .build(), true), Arguments.of( "Attacker has air units and destroyers", givenBattleStateBuilder() .attackingUnits(List.of(givenUnitDestroyer(), givenUnitIsAir())) .defendingUnits(List.of(mock(Unit.class))) .build(), false), Arguments.of( "Attacker has air units but no destroyers vs Defender with no subs", givenBattleStateBuilder() .attackingUnits(List.of(givenAnyUnit(), givenUnitIsAir())) .defendingUnits(List.of(givenAnyUnit())) .build(), false)); }
Source:
<code>public void onToggleItemOffline(int pageIndex) { ReadingListPage page = readingList == null ? null : readingList.pages().get(pageIndex); if (page == null) { return; } if (page.offline()) { <START> toggleOffline(page); } else { toggleOffline(page); <END> } }</code><technical_language>toggled offline</technical_language>

Target:
public void onToggleItemOffline(int pageIndex) { ReadingListPage page = readingList == null ? null : readingList.pages().get(pageIndex); if (page == null) { return; } if (page.offline()) { CallbackTask.execute(() -> { List<ReadingListPage> occurrences = ReadingListDbHelper.instance().getAllPageOccurrences(ReadingListPage.toPageTitle(page)); return ReadingListDbHelper.instance().getListsFromPageOccurrences(occurrences); }, new CallbackTask.DefaultCallback<List<ReadingList>>() { @SuppressWarnings("checkstyle:magicnumber") @Override public void success(List<ReadingList> lists) { if (!isAdded()) { return; } if (lists.size() > 1) { AlertDialog dialog = new AlertDialog.Builder(getContext()) .setTitle(R.string.reading_list_confirm_remove_article_from_offline_title) .setMessage(getConfirmToggleOfflineMessage(page, lists)) .setPositiveButton(R.string.reading_list_confirm_remove_article_from_offline, (dialog1, which) -> toggleOffline(page)) .setNegativeButton(android.R.string.cancel, null) .create(); dialog.show(); TextView text = dialog.findViewById(android.R.id.message); text.setLineSpacing(0, 1.3f); } else { toggleOffline(page); } } }); } else { toggleOffline(page); } }
Source:
<code><START> void printUsage() { <END> final String usage = "java -jar VarSim.jar <tool> <tool_args>... \n" + " --= Simulation =-- \n" + " randvcf2vcf -- Randomly samples variants from a VCF file\n" + " randdgv2vcf -- Randomly samples variants from a DGV database file\n" + " --= Validation =-- \n" + " vcfcompare -- Generate JSON describing vcf accuracy relative to truth \n" + " samcompare -- Generate JSON describing alignment accuracy relative to truth \n" + " vcfstats -- Generate stats on size range and variant types in a VCF\n" + " --= Internal =-- \n" + " vcf2diploid -- Enhanced version of vcf2diploid from alleleseq \n" + " fastq_liftover -- Lifts over simulated FASTQ files to reference coordinates \n" + "\n"; System.err.println(VarSim.class.getSimpleName() + " " + VERSION); System.err.println(usage); }</code><technical_language>private</technical_language>

Target:
private void printUsage() { final String usage = "java -jar VarSim.jar <tool> <tool_args>... \n" + " --= Simulation =-- \n" + " randvcf2vcf -- Randomly samples variants from a VCF file\n" + " randdgv2vcf -- Randomly samples variants from a DGV database file\n" + " --= Validation =-- \n" + " vcfcompare -- Generate JSON describing vcf accuracy relative to truth \n" + " samcompare -- Generate JSON describing alignment accuracy relative to truth \n" + " vcfstats -- Generate stats on size range and variant types in a VCF\n" + " --= Internal =-- \n" + " vcf2diploid -- Enhanced version of vcf2diploid from alleleseq \n" + " fastq_liftover -- Lifts over simulated FASTQ files to reference coordinates \n" + "\n"; System.err.println(VarSim.class.getSimpleName() + " " + VERSION); System.err.println(usage); }
Source:
<code><START> public boolean equals(Object o) { <END> return false; }</code><technical_language>is hashCode equals implemented this? UserResourceProfilePK instances userId gatewayID equal hash value, right</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserResourceProfilePK that = (UserResourceProfilePK) o; if (!getUserId().equals(that.getUserId())) return false; return getGatewayID().equals(that.getGatewayID()); }
Source:
<code>public void auditLoggingOffForInboundRealTime() { AdapterCORE_X12DSRealTimeProxyObjectFactory mockFactory = mock(AdapterCORE_X12DSRealTimeProxyObjectFactory.class); PassthroughInboundCORE_X12DSRealTime realTimeX12 = new PassthroughInboundCORE_X12DSRealTime(mockFactory, getAuditLogger(false)); COREEnvelopeRealTimeRequest request = new COREEnvelopeRealTimeRequest(); AssertionType assertion = new AssertionType(); Properties webContextProperties = new Properties(); AdapterCORE_X12DSRealTimeProxy mockAdapterProxy = mock(AdapterCORE_X12DSRealTimeProxy.class); <START> when(mockFactory.getAdapterCORE_X12DocSubmissionProxy()).thenReturn(mockAdapterProxy); <END> COREEnvelopeRealTimeResponse expectedResponse = new COREEnvelopeRealTimeResponse(); when(mockAdapterProxy.realTimeTransaction(request, assertion)).thenReturn(expectedResponse); COREEnvelopeRealTimeResponse actualResponse = realTimeX12.realTimeTransaction(request, assertion, webContextProperties); verify(mockEJBLogger, never()).auditResponseMessage(eq(request), eq(actualResponse), eq(assertion), isNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.FALSE), eq(webContextProperties), eq(NhincConstants.CORE_X12DS_REALTIME_SERVICE_NAME), any(COREX12RealTimeAuditTransforms.class)); }</code><technical_language>variables in methods. declared class variables</technical_language>

Target:
public void auditLoggingOffForInboundRealTime() { PassthroughInboundCORE_X12DSRealTime realTimeX12 = new PassthroughInboundCORE_X12DSRealTime(mockFactory, getAuditLogger(false)); when(mockFactory.getAdapterCORE_X12DocSubmissionProxy()).thenReturn(mockAdapterProxy); COREEnvelopeRealTimeResponse expectedResponse = new COREEnvelopeRealTimeResponse(); when(mockAdapterProxy.realTimeTransaction(request, assertion)).thenReturn(expectedResponse); COREEnvelopeRealTimeResponse actualResponse = realTimeX12.realTimeTransaction(request, assertion, webContextProperties); verify(mockEJBLogger, never()).auditResponseMessage(eq(request), eq(actualResponse), eq(assertion), isNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.FALSE), eq(webContextProperties), eq(NhincConstants.CORE_X12DS_REALTIME_SERVICE_NAME), any(COREX12RealTimeAuditTransforms.class)); }
Source:
<code><START> public CacheQuery<T> limit(int limit) { <END> this.limit = limit; return this; }</code><technical_language>@Overrding public line Ignite code style</technical_language>

Target:
@Override public CacheQuery<T> limit(int limit) { this.limit = limit; return this; }
Source:
<code>public Resource createNew(String newName, InputStream in, Long length, String contentType) throws IOException, DotRuntimeException { if(newName.matches("^\\.(.*)-Spotlight$")){ newName = newName + ".spotlight"; } User user=(User)HttpManager.request().getAuthorization().getTag(); if(!path.endsWith("/")){ path = path + "/"; } if(!dotDavHelper.isTempResource(newName)){ try { dotDavHelper.setResourceContent(path + newName, in, contentType, null, java.util.Calendar.getInstance().getTime(), user, isAutoPub); IFileAsset f = dotDavHelper.loadFile(path + newName,user); Resource fr = new FileResourceImpl(f, f.getFileName()); return fr; }catch (Exception e){ Logger.error(this, "An error occurred while creating new file: " + (newName != null ? newName : "Unknown") + " in this path: " + (path != null ? path : "Unknown") + " " + e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } } else { try { if(!originalPath.endsWith("/")){ <START> originalPath = originalPath + "/"; <END> } File f = dotDavHelper.createTempFile("/" + host.getHostname() + originalPath + newName); FileUtils.copyStreamToFile(f, in, null); Resource tr = new TempFileResourceImpl(f, originalPath + newName, isAutoPub); return tr; } catch (Exception e){ Logger.error(this, "Error creating temp file", e); throw new DotRuntimeException(e.getMessage(), e); } } }</code><technical_language>replace originalPath = (!originalPath.endsWith("/"))?originalPath + "/":originalPath;</technical_language>

Target:
public Resource createNew(String newName, InputStream in, Long length, String contentType) throws IOException, DotRuntimeException { if(newName.matches("^\\.(.*)-Spotlight$")){ newName = newName + ".spotlight"; } User user=(User)HttpManager.request().getAuthorization().getTag(); if(!path.endsWith("/")){ path = path + "/"; } if(!dotDavHelper.isTempResource(newName)){ try { dotDavHelper.setResourceContent(path + newName, in, contentType, null, java.util.Calendar.getInstance().getTime(), user, isAutoPub); final IFileAsset iFileAsset = dotDavHelper.loadFile(path + newName,user); final Resource fileResource = new FileResourceImpl(iFileAsset, iFileAsset.getFileName()); return fileResource; }catch (Exception e){ Logger.error(this, "An error occurred while creating new file: " + (newName != null ? newName : "Unknown") + " in this path: " + (path != null ? path : "Unknown") + " " + e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } } else { try { originalPath = (!originalPath.endsWith("/"))?originalPath + "/":originalPath; final File tempFile = dotDavHelper.createTempFile("/" + host.getHostname() + originalPath + newName); FileUtils.copyStreamToFile(tempFile, in, null); final Resource tempFileResource = new TempFileResourceImpl(tempFile, originalPath + newName, isAutoPub); return tempFileResource; } catch (Exception e){ Logger.error(this, "Error creating temp file", e); throw new DotRuntimeException(e.getMessage(), e); } } }
Source:
<code>public String buildMessage(String userInput){ SharedPreferences prefs = CommCareApplication._().getCurrentApp().getAppPreferences(); String username = CommCareApplication._().getSession().getLoggedInUser().getUsername(); String version = CommCareApplication._().getCurrentVersionString(); <START> String domain = prefs.getString(HttpRequestGenerator.USER_DOMAIN_SUFFIX,"not found"); <END> String message = "Problem reported via CommCareODK. " + "\n User: " + username + "\n Domain: " + domain + "\n CCODK version: " + version + "\n Device Model: " + Build.MODEL + "\n Manufacturer: " + Build.MANUFACTURER + "\n Android Version: " + Build.VERSION.RELEASE + "\n Message: " + userInput; return message; }</code><technical_language>This Hq, I assume</technical_language>

Target:
public String buildMessage(String userInput){ SharedPreferences prefs = CommCareApplication._().getCurrentApp().getAppPreferences(); String username = CommCareApplication._().getSession().getLoggedInUser().getUsername(); String version = CommCareApplication._().getCurrentVersionString(); String domain = prefs.getString(HttpRequestGenerator.USER_DOMAIN_SUFFIX,"not found"); String postURL = prefs.getString("PostURL", null);; String message = "Problem reported via CommCareODK. " + "\n User: " + username + "\n Domain: " + domain + "\n PostURL: " + postURL + "\n CCODK version: " + version + "\n Device Model: " + Build.MODEL + "\n Manufacturer: " + Build.MANUFACTURER + "\n Android Version: " + Build.VERSION.RELEASE + "\n Message: " + userInput; return message; }
Source:
<code>public Response createConnection(String resource) { if (urlValidator.isValid(resource)) { webClient = WebClient.create(resource); webClient.path(resource); } else { webClient = WebClient.create(url + resource + ".zip"); webClient.path(url + resource + ".zip"); } <START> return webClient.get(); <END> }</code><technical_language>a Secure CXF client here? @stustison</technical_language>

Target:
public Response createConnection(String resource) { if (URL_VALIDATOR.isValid(resource)) { webClient = WebClient.create(resource); webClient.path(resource); } else { webClient = WebClient.create(url + resource + ".zip"); webClient.path(url + resource + ".zip"); } return webClient.get(); }
Source:
<code>public void shouldIdentifyMultipleTimeouts() { assertEquals(6000, GremlinScriptChecker.parse("g.with('evaluationTimeout', 1000L).with(true).V().out('knows');" + "g.with('evaluationTimeout', 1000L).with(true).V().out('knows')\n" + " " \n" + " \n" + <START> " g.with('evaluationTimeout', 1000L).with(true).V().out('knows')\n" + <END> " g.with(Tokens.ARGS_SCRIPT_EVAL_TIMEOUT, 1000L).with(true).V().out('knows')\n" + " g.with(ARGS_EVAL_TIMEOUT, 1000L).with(true).V().out('knows')\n" + " g.with('scriptEvaluationTimeout', 1000L).with(true).V().out('knows')"). getTimeout().get().longValue()); }</code><technical_language>This a ; end</technical_language>

Target:
public void shouldIdentifyMultipleTimeouts() { assertEquals(6000, GremlinScriptChecker.parse("g.with('evaluationTimeout', 1000L).with(true).V().out('knows');" + "g.with('evaluationTimeout', 1000L).with(true).V().out('knows');\n" + " " \n" + " \n" + " g.with('evaluationTimeout', 1000L).with(true).V().out('knows');\n" + " g.with(Tokens.ARGS_SCRIPT_EVAL_TIMEOUT, 1000L).with(true).V().out('knows');\n" + " g.with(ARGS_EVAL_TIMEOUT, 1000L).with(true).V().out('knows');\n" + " g.with('scriptEvaluationTimeout', 1000L).with(true).V().out('knows');"). getTimeout().get().longValue()); }
Source:
<code>private void publishAlertEvent(Alert alert, String event) { HistoryReference historyReference = hrefs.get(alert.getSourceHistoryId()); if (historyReference == null) { historyReference = Control.getSingleton() .getExtensionLoader() .getExtension(ExtensionHistory.class) .getHistoryReference(alert.getSourceHistoryId()); } Map<String, String> map = new HashMap<>(); map.put(AlertEventPublisher.ALERT_ID, Integer.toString(alert.getAlertId())); map.put(AlertEventPublisher.HISTORY_REFERENCE_ID, Integer.toString(alert.getSourceHistoryId())); map.put(AlertEventPublisher.NAME, alert.getName()); map.put(AlertEventPublisher.URI, alert.getUri().toString()); map.put(AlertEventPublisher.PARAM, alert.getParam()); map.put(AlertEventPublisher.RISK, Integer.toString(alert.getRisk())); map.put(AlertEventPublisher.RISK_STRING, Alert.MSG_RISK[alert.getRisk()]); map.put(AlertEventPublisher.CONFIDENCE, Integer.toString(alert.getConfidence())); map.put(AlertEventPublisher.CONFIDENCE_STRING, Alert.MSG_CONFIDENCE[alert.getConfidence()]); <START> map.put(AlertEventPublisher.SOURCE, alert.getSource().getI18nKey()); <END> ZAP.getEventBus().publishSyncEvent( AlertEventPublisher.getPublisher(), new Event(AlertEventPublisher.getPublisher(), event, new Target(historyReference.getSiteNode()), map)); }</code><technical_language>suggest returning ID instead, key is more change ID</technical_language>

Target:
private void publishAlertEvent(Alert alert, String event) { HistoryReference historyReference = hrefs.get(alert.getSourceHistoryId()); if (historyReference == null) { historyReference = Control.getSingleton() .getExtensionLoader() .getExtension(ExtensionHistory.class) .getHistoryReference(alert.getSourceHistoryId()); } Map<String, String> map = new HashMap<>(); map.put(AlertEventPublisher.ALERT_ID, Integer.toString(alert.getAlertId())); map.put(AlertEventPublisher.HISTORY_REFERENCE_ID, Integer.toString(alert.getSourceHistoryId())); map.put(AlertEventPublisher.NAME, alert.getName()); map.put(AlertEventPublisher.URI, alert.getUri().toString()); map.put(AlertEventPublisher.PARAM, alert.getParam()); map.put(AlertEventPublisher.RISK, Integer.toString(alert.getRisk())); map.put(AlertEventPublisher.RISK_STRING, Alert.MSG_RISK[alert.getRisk()]); map.put(AlertEventPublisher.CONFIDENCE, Integer.toString(alert.getConfidence())); map.put(AlertEventPublisher.CONFIDENCE_STRING, Alert.MSG_CONFIDENCE[alert.getConfidence()]); map.put(AlertEventPublisher.SOURCE, Integer.toString(alert.getSource().getId())); ZAP.getEventBus().publishSyncEvent( AlertEventPublisher.getPublisher(), new Event(AlertEventPublisher.getPublisher(), event, new Target(historyReference.getSiteNode()), map)); }
Source:
<code>private static String translateRef(String oldPrefix, String newPrefix, String ref) { if (!ref.startsWith(oldPrefix)) <START> throw new IllegalArgumentException(ref + " does not start with " <END> + oldPrefix); return newPrefix + ref.substring(oldPrefix.length()); }</code><technical_language>Needs JGitText entry, I</technical_language>

Target:
private static String translateRef(String oldPrefix, String newPrefix, String ref) { if (!ref.startsWith(oldPrefix)) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().invalidRefName, ref)); return newPrefix + ref.substring(oldPrefix.length()); }
Source:
<code>public long getUsedMemoryOnHost(final String hostname) { <START> return this.jobRepository.getTotalMemoryUsedOnHost(hostname, RUNNING_JOB_SET); <END> }</code><technical_language>this active CLAIMED</technical_language>

Target:
public long getUsedMemoryOnHost(final String hostname) { return this.jobRepository.getTotalMemoryUsedOnHost(hostname, USING_MEMORY_JOB_SET); }
Source:
<code>public void addPartitions(String databaseName, String tableName, List<CatalogProtos.PartitionDescProto> partitions , boolean ifNotExists) { HiveCatalogStoreClientPool.HiveCatalogStoreClient client = null; List<Partition> addPartitions = TUtil.newList(); CatalogProtos.PartitionDescProto existingPartition = null; try { client = clientPool.getClient(); for (CatalogProtos.PartitionDescProto partitionDescProto : partitions) { existingPartition = getPartition(databaseName, tableName, partitionDescProto.getPartitionName()); if (existingPartition == null) { Partition partition = new Partition(); partition.setDbName(databaseName); partition.setTableName(tableName); List<String> values = Lists.newArrayList(); for(CatalogProtos.PartitionKeyProto keyProto : partitionDescProto.getPartitionKeysList()) { values.add(keyProto.getPartitionValue()); } partition.setValues(values); Table table = client.getHiveClient().getTable(databaseName, tableName); StorageDescriptor sd = table.getSd(); sd.setLocation(partitionDescProto.getPath()); partition.setSd(sd); addPartitions.add(partition); } } if (addPartitions.size() > 0) { <START> List<Partition> results = client.getHiveClient().add_partitions(addPartitions, true, true); <END> } } catch (Exception e) { throw new TajoInternalError(e); } finally { if (client != null) { client.release(); } } }</code><technical_language>List<Partition> results is used</technical_language>

Target:
public void addPartitions(String databaseName, String tableName, List<CatalogProtos.PartitionDescProto> partitions , boolean ifNotExists) { HiveCatalogStoreClientPool.HiveCatalogStoreClient client = null; List<Partition> addPartitions = TUtil.newList(); CatalogProtos.PartitionDescProto existingPartition = null; try { client = clientPool.getClient(); for (CatalogProtos.PartitionDescProto partitionDescProto : partitions) { existingPartition = getPartition(databaseName, tableName, partitionDescProto.getPartitionName()); if (existingPartition == null) { Partition partition = new Partition(); partition.setDbName(databaseName); partition.setTableName(tableName); List<String> values = Lists.newArrayList(); for(CatalogProtos.PartitionKeyProto keyProto : partitionDescProto.getPartitionKeysList()) { values.add(keyProto.getPartitionValue()); } partition.setValues(values); Table table = client.getHiveClient().getTable(databaseName, tableName); StorageDescriptor sd = table.getSd(); sd.setLocation(partitionDescProto.getPath()); partition.setSd(sd); addPartitions.add(partition); } } if (addPartitions.size() > 0) { client.getHiveClient().add_partitions(addPartitions, true, true); } } catch (Exception e) { throw new TajoInternalError(e); } finally { if (client != null) { client.release(); } } }
Source:
<code>@Override public Collection<Object> statusSnapshot() { <START> return mgr.statusSnapshot().get().stream() <END> .filter(Objects::nonNull) .collect(Collectors.toSet()); }</code><technical_language>filter nulls here</technical_language>

Target:
@Override public Map<Object, Boolean> statusSnapshot() { return mgr.statusSnapshot().get(); }
Source:
<code>private String loadFile(String version) throws IOException { <START> return readAndCloseQuietly(getResource(SCHEMAS_LOCATION + version + "/" + SCHEMA_FILENAME)); <END> }</code><technical_language>if bad version is passed, a ugly message "File found...etc" is sense prettify somehow, wdyt</technical_language>

Target:
private String loadFile(String version) throws IOException { try { return readAndCloseQuietly(getResource(SCHEMAS_LOCATION + version + "/" + SCHEMA_FILENAME)); } catch (IOException ioe) { throw new IOException( String.format( "Unable to load devfile schema with version '%s'. Supported versions are '%s'", version, SUPPORTED_VERSIONS), ioe); } }
Source:
<code>private Credentials extractCredentials(int index) { Credentials result = new Credentials(); <START> String uri = this.uri[index]; <END> result.uri = uri; Credentials explicitCredentials = getUsernamePassword(); result.username = explicitCredentials.username; result.password = explicitCredentials.password; try { URL url = new URL(uri); String userInfo = url.getUserInfo(); if (StringUtils.isEmpty(userInfo) || ":".equals(userInfo)) { return result; } String bare = UriComponentsBuilder.fromHttpUrl(uri).userInfo(null).build() .toUriString(); result.uri = bare; if (!userInfo.contains(":")) { userInfo = userInfo + ":"; } int sepIndex=userInfo.indexOf(":"); result.username = userInfo.substring(0, sepIndex); result.password = userInfo.substring(sepIndex +1); if (explicitCredentials.password != null) { result.password = explicitCredentials.password; } if (!"user".equals(explicitCredentials.username)) { result.username = explicitCredentials.username; } return result; } catch (MalformedURLException e) { throw new IllegalStateException("Invalid URL: " + uri); } }</code><technical_language>I this isnt throw ArrayIndexOutOfBoundsException</technical_language>

Target:
private Credentials extractCredentials(int index) { Credentials result = new Credentials(); int noOfUrl = this.uri.length; if (index < 0 || index >= noOfUrl) { throw new IllegalStateException("Trying to access an invalid array index"); } String uri = this.uri[index]; result.uri = uri; Credentials explicitCredentials = getUsernamePassword(); result.username = explicitCredentials.username; result.password = explicitCredentials.password; try { URL url = new URL(uri); String userInfo = url.getUserInfo(); if (StringUtils.isEmpty(userInfo) || ":".equals(userInfo)) { return result; } String bare = UriComponentsBuilder.fromHttpUrl(uri).userInfo(null).build() .toUriString(); result.uri = bare; if (!userInfo.contains(":")) { userInfo = userInfo + ":"; } int sepIndex = userInfo.indexOf(":"); result.username = userInfo.substring(0, sepIndex); result.password = userInfo.substring(sepIndex + 1); if (explicitCredentials.password != null) { result.password = explicitCredentials.password; } if (!"user".equals(explicitCredentials.username)) { result.username = explicitCredentials.username; } return result; } catch (MalformedURLException e) { throw new IllegalStateException("Invalid URL: " + uri); } }
Source:
<code>public void testAcceleoMtlCollectionEvaluationOnArrayValues() { IInterpreter interpreter = new AcceleoMTLInterpreter(); EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute(); eAttribute.setName("a1"); String varExampleName = "varWithArray"; String[] arrayValue = new String[] { eAttribute.getName() }; interpreter.setVariable(varExampleName, arrayValue); String expression = "[" + varExampleName + "/]"; evaluateObject(interpreter, eAttribute, expression, arrayValue); evaluateCollection(interpreter, eAttribute, expression, Collections.<EObject> emptyList()); EObject[] eobjectArrayValue = new EObject[] { eAttribute }; interpreter.setVariable(varExampleName, eobjectArrayValue); evaluateObject(interpreter, eAttribute, expression, eobjectArrayValue); evaluateCollection(interpreter, eAttribute, expression, <START> Arrays.asList(eobjectArrayValue)); <END> interpreter.dispose(); }</code><technical_language>create a new ArrayList wrap this</technical_language>

Target:
public void testAcceleoMtlCollectionEvaluationOnArrayValues() { IInterpreter interpreter = new AcceleoMTLInterpreter(); EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute(); eAttribute.setName("a1"); String varExampleName = "varWithArray"; String[] arrayValue = new String[] { eAttribute.getName() }; interpreter.setVariable(varExampleName, arrayValue); String expression = "[" + varExampleName + "/]"; evaluateObject(interpreter, eAttribute, expression, arrayValue); evaluateCollection(interpreter, eAttribute, expression, Collections.<EObject> emptyList()); EObject[] eobjectArrayValue = new EObject[] { eAttribute }; interpreter.setVariable(varExampleName, eobjectArrayValue); evaluateObject(interpreter, eAttribute, expression, eobjectArrayValue); evaluateCollection(interpreter, eAttribute, expression, new ArrayList<EObject>(Arrays.asList(eobjectArrayValue))); interpreter.dispose(); }
Source:
<code>public KubernetesPluginsToolingApplier( @Named("che.workspace.sidecar.image_pull_policy") String sidecarImagePullPolicy, @Named("che.workspace.sidecar.default_memory_limit_mb") long defaultSidecarMemoryLimitMB, @Named("che.workspace.sidecar.default_memory_request_mb") long defaultSidecarMemoryRequestMB, @Named("che.workspace.sidecar.default_cpu_limit_cores") String defaultSidecarCpuLimitCores, @Named("che.workspace.sidecar.default_cpu_request_cores") String defaultSidecarCpuRequestCores, @Named("che.agents.auth_enabled") boolean isAuthEnabled, ProjectsRootEnvVariableProvider projectsRootEnvVariableProvider, ChePluginsVolumeApplier chePluginsVolumeApplier, EnvVars envVars) { this.defaultSidecarMemoryLimitBytes = String.valueOf(defaultSidecarMemoryLimitMB * 1024 * 1024); this.defaultSidecarMemoryRequestBytes = <START> String.valueOf(defaultSidecarMemoryRequestMB * 1024 * 1024); <END> this.defaultSidecarCpuLimitCores = Float.toString(KubernetesSize.toCores(defaultSidecarCpuLimitCores)); this.defaultSidecarCpuRequestCores = Float.toString(KubernetesSize.toCores(defaultSidecarCpuRequestCores)); this.isAuthEnabled = isAuthEnabled; this.sidecarImagePullPolicy = validImagePullPolicies.contains(sidecarImagePullPolicy) ? sidecarImagePullPolicy : null; this.projectsRootEnvVariableProvider = projectsRootEnvVariableProvider; this.chePluginsVolumeApplier = chePluginsVolumeApplier; this.envVars = envVars; }</code><technical_language>I do this calculation in tested method in case of cores</technical_language>

Target:
public KubernetesPluginsToolingApplier( @Named("che.workspace.sidecar.image_pull_policy") String sidecarImagePullPolicy, @Named("che.workspace.sidecar.default_memory_limit_mb") long defaultSidecarMemoryLimitMB, @Named("che.workspace.sidecar.default_memory_request_mb") long defaultSidecarMemoryRequestMB, @Named("che.workspace.sidecar.default_cpu_limit_cores") String defaultSidecarCpuLimitCores, @Named("che.workspace.sidecar.default_cpu_request_cores") String defaultSidecarCpuRequestCores, @Named("che.agents.auth_enabled") boolean isAuthEnabled, ProjectsRootEnvVariableProvider projectsRootEnvVariableProvider, ChePluginsVolumeApplier chePluginsVolumeApplier, EnvVars envVars) { this.defaultSidecarMemoryLimitBytes = toBytesString(defaultSidecarMemoryLimitMB); this.defaultSidecarMemoryRequestBytes = toBytesString(defaultSidecarMemoryRequestMB); this.defaultSidecarCpuLimitCores = Float.toString(KubernetesSize.toCores(defaultSidecarCpuLimitCores)); this.defaultSidecarCpuRequestCores = Float.toString(KubernetesSize.toCores(defaultSidecarCpuRequestCores)); this.isAuthEnabled = isAuthEnabled; this.sidecarImagePullPolicy = validImagePullPolicies.contains(sidecarImagePullPolicy) ? sidecarImagePullPolicy : null; this.projectsRootEnvVariableProvider = projectsRootEnvVariableProvider; this.chePluginsVolumeApplier = chePluginsVolumeApplier; this.envVars = envVars; }
Source:
<code>CompletableFuture<RegistrationResponse> registerTaskExecutor(ResourceID resourceID) throws Exception { final TaskExecutorGateway taskExecutorGateway = new TestingTaskExecutorGatewayBuilder() .createTestingTaskExecutorGateway(); ((TestingRpcService) resourceManager.getRpcService()).registerGateway(resourceID.toString(), taskExecutorGateway); <START> <END> final TaskExecutorRegistration taskExecutorRegistration = new TaskExecutorRegistration( resourceID.toString(), resourceID, 1234, new HardwareDescription(1, 2L, 3L, 4L), ResourceProfile.ZERO, ResourceProfile.ZERO); return runInMainThread(() -> resourceManager.registerTaskExecutor(taskExecutorRegistration, TIMEOUT_TIME)) .get(TIMEOUT_SEC, TimeUnit.SECONDS); }</code><technical_language>a class wide TestingRpcService avoid this casting here</technical_language>

Target:
CompletableFuture<RegistrationResponse> registerTaskExecutor(ResourceID resourceID) { final TaskExecutorGateway taskExecutorGateway = new TestingTaskExecutorGatewayBuilder() .createTestingTaskExecutorGateway(); RPC_SERVICE_RESOURCE.getTestingRpcService().registerGateway(resourceID.toString(), taskExecutorGateway); final TaskExecutorRegistration taskExecutorRegistration = new TaskExecutorRegistration( resourceID.toString(), resourceID, 1234, new HardwareDescription(1, 2L, 3L, 4L), ResourceProfile.ZERO, ResourceProfile.ZERO); return resourceManager.getSelfGateway(ResourceManagerGateway.class) .registerTaskExecutor(taskExecutorRegistration, TIMEOUT_TIME); }
Source:
<code>public Long getUuid() { <START> return new Long(999994); <END> }</code><technical_language>'L'</technical_language>

Target:
public Long getUuid() { return 999994L; }
Source:
<code>public void testDurationWeighting() { final SleepScore.Weighting weighting = new SleepScore.DurationHeavyWeighting(); final MotionScore fakeMotion = new MotionScore(0, 0, 0.0f, 0, 90); final Integer fakeDuration = 80; final Integer fakeEnvironment = 100; final SleepScore.Builder builder = new SleepScore.Builder(); final SleepScore sleepScore = builder.withEnvironmentalScore(fakeEnvironment) .withSleepDurationScore(fakeDuration) .withMotionScore(fakeMotion) .withWeighting(weighting) .build(); Integer calculatedWeight = Math.round((weighting.motion * fakeMotion.score) + (weighting.duration * fakeDuration) + (weighting.environmental * fakeEnvironment)); assertThat(sleepScore, notNullValue()); assertThat(sleepScore.value, is(calculatedWeight)); <START> assertThat(sleepScore.value, greaterThan(0)); <END> assertThat(sleepScore.value, lessThan(100)); assertThat(sleepScore.motionScore, is(fakeMotion)); assertThat(sleepScore.sleepDurationScore, is(fakeDuration)); assertThat(sleepScore.environmentalScore, is(fakeEnvironment)); }</code><technical_language>GTE</technical_language>

Target:
public void testDurationWeighting() { final SleepScore.Weighting weighting = new SleepScore.DurationHeavyWeighting(); final MotionScore fakeMotion = new MotionScore(0, 0, 0.0f, 0, 90); final Integer fakeDuration = 80; final Integer fakeEnvironment = 100; final SleepScore.Builder builder = new SleepScore.Builder(); final SleepScore sleepScore = builder.withEnvironmentalScore(fakeEnvironment) .withSleepDurationScore(fakeDuration) .withMotionScore(fakeMotion) .withWeighting(weighting) .build(); Integer calculatedWeight = Math.round((weighting.motion * fakeMotion.score) + (weighting.duration * fakeDuration) + (weighting.environmental * fakeEnvironment)); assertThat(sleepScore, notNullValue()); assertThat(sleepScore.value, is(calculatedWeight)); assertThat(sleepScore.value, greaterThanOrEqualTo(0)); assertThat(sleepScore.value, lessThanOrEqualTo(100)); assertThat(sleepScore.motionScore, is(fakeMotion)); assertThat(sleepScore.sleepDurationScore, is(fakeDuration)); assertThat(sleepScore.environmentalScore, is(fakeEnvironment)); }
Source:
<code>public void prepareAnalyzer(Engine engine) throws InitializationException { super.prepareAnalyzer(engine); try { this.open(engine.getDatabase()); } catch (IOException ex) { LOGGER.debug("Exception initializing the Lucene Index", ex); throw new InitializationException("An exception occurred initializing the Lucene Index", ex); } catch (DatabaseException ex) { LOGGER.debug("Exception accessing the database", ex); throw new InitializationException("An exception occurred accessing the database", ex); } final String[] tmp = engine.getSettings().getArray(Settings.KEYS.ECOSYSTEM_SKIP_CPEANALYZER); if (tmp == null) { skipEcosystems = new ArrayList<>(); } else { LOGGER.info("Skipping CPE Analysis for {}", StringUtils.join(tmp, ",")); skipEcosystems = Arrays.asList(tmp); } <START> minLuceneScore = engine.getSettings().getFloat(Settings.KEYS.ECOSYSTEM_SKIP_CPEANALYZER, 30); <END> suppression = new CpeSuppressionAnalyzer(); suppression.initialize(engine.getSettings()); suppression.prepareAnalyzer(engine); }</code><technical_language>Copy&Paste-Error? suggestion minLuceneScore = engine.getSettings().getFloat(Settings.KEYS.LUCENE_MIN_SCORE_FILTER, 30);</technical_language>

Target:
public void prepareAnalyzer(Engine engine) throws InitializationException { super.prepareAnalyzer(engine); try { this.open(engine.getDatabase()); } catch (IOException ex) { LOGGER.debug("Exception initializing the Lucene Index", ex); throw new InitializationException("An exception occurred initializing the Lucene Index", ex); } catch (DatabaseException ex) { LOGGER.debug("Exception accessing the database", ex); throw new InitializationException("An exception occurred accessing the database", ex); } final String[] tmp = engine.getSettings().getArray(Settings.KEYS.ECOSYSTEM_SKIP_CPEANALYZER); if (tmp == null) { skipEcosystems = new ArrayList<>(); } else { LOGGER.info("Skipping CPE Analysis for {}", StringUtils.join(tmp, ",")); skipEcosystems = Arrays.asList(tmp); } minLuceneScore = engine.getSettings().getFloat(Settings.KEYS.LUCENE_MIN_SCORE_FILTER, 30); suppression = new CpeSuppressionAnalyzer(); suppression.initialize(engine.getSettings()); suppression.prepareAnalyzer(engine); }
Source:
<code>public synchronized ITmfTimestamp readEnd() { try { Long pos = fFile.length() - 1; while (pos > 0) { while (pos > 0) { fFile.seek(pos - 1); <START> if (fFile.read() == '<') { <END> break; } pos--; } ITmfLocation location = new TmfLongLocation(pos); ITmfContext context = seekEvent(location); ITmfEvent event = parseEvent(context); context.dispose(); if (event != null) { return event.getTimestamp(); } pos--; } } catch (IOException e) { return null; } return null; }</code><technical_language>If element for is "<log>", this code returns location of 'l'. location of '<', requires extra loop (or fail if event)</technical_language>

Target:
public synchronized ITmfTimestamp readEnd() { byte[] inputNameBytes = ("<" + fRecordInputElement.getInputName()).getBytes(); try { Long pos = fFile.length() - inputNameBytes.length; while (pos >= 0) { searchloop: while (pos >= 0) { fFile.seek(pos); for (byte c : inputNameBytes) { if (c != fFile.read()) { break searchloop; } } pos--; } ITmfLocation location = new TmfLongLocation(pos); ITmfContext context = seekEvent(location); ITmfEvent event = parseEvent(context); context.dispose(); if (event != null) { return event.getTimestamp(); } pos -= inputNameBytes.length; } } catch (IOException e) { return null; } return null; }