auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<Hotspot> proteinLocationHotspotsFilter(List<Hotspot> hotspots, ProteinLocation proteinLocation) { int start = proteinLocation.getStart(); int end = proteinLocation.getEnd(); String type = proteinLocation.getMutationType(); List<Hotspot> result = new ArrayList<>(); for (Hotspot hotspot: hotspots) { boolean validPosition = true; int hotspotStart = proteinPositionResolver.extractProteinPos(hotspot.getResidue()).getStart(); int hotspotStop = proteinPositionResolver.extractProteinPos(hotspot.getResidue()).getEnd(); <START> validPosition &= (start <= hotspotStop && end >= hotspotStart); <END> boolean validMissense = type.equals("Missense_Mutation") && (hotspot.getType().contains("3d") || hotspot.getType().contains("single residue")); boolean validInFrameInsertion = type.equals("In_Frame_Ins") || type.equals("In_Frame_Ins") && (hotspot.getType().contains("in-frame")); boolean validInFrameDeletion = type.equals("In_Frame_Del") || type.equals("In_Frame_Del") && (hotspot.getType().contains("in-frame")); boolean validSplice = type.equals("Splice_Site") || type.equals("Splice_Region") && (hotspot.getType().contains("splice")); if (validPosition && (validMissense || validInFrameInsertion || validInFrameDeletion || validSplice)) { result.add(hotspot); } } return result; }</code><technical_language>I previously approved this &= is confusing here, remove line initialize this boolean ( boolean validPosition = true;) change this line to: suggestion boolean validPosition = start <= hotspotStop && end >= hotspotStart;</technical_language>

Target:
public List<Hotspot> proteinLocationHotspotsFilter(List<Hotspot> hotspots, ProteinLocation proteinLocation) { int start = proteinLocation.getStart(); int end = proteinLocation.getEnd(); String type = proteinLocation.getMutationType(); List<Hotspot> result = new ArrayList<>(); for (Hotspot hotspot: hotspots) { int hotspotStart = proteinPositionResolver.extractProteinPos(hotspot.getResidue()).getStart(); int hotspotStop = proteinPositionResolver.extractProteinPos(hotspot.getResidue()).getEnd(); boolean validPosition = start <= hotspotStop && end >= hotspotStart; boolean validMissense = type.equals("Missense_Mutation") && (hotspot.getType().contains("3d") || hotspot.getType().contains("single residue")); boolean validInFrameInsertion = type.equals("In_Frame_Ins") || type.equals("In_Frame_Ins") && (hotspot.getType().contains("in-frame")); boolean validInFrameDeletion = type.equals("In_Frame_Del") || type.equals("In_Frame_Del") && (hotspot.getType().contains("in-frame")); boolean validSplice = type.equals("Splice_Site") || type.equals("Splice_Region") && (hotspot.getType().contains("splice")); if (validPosition && (validMissense || validInFrameInsertion || validInFrameDeletion || validSplice)) { result.add(hotspot); } } return result; }
Source:
<code>public synchronized void start() { logger.info("{} TaildirSource source starting with directory: {}", getName(), filePaths); try { reader = new ReliableTaildirEventReader.Builder() .filePaths(filePaths) .headerTable(headerTable) .positionFilePath(positionFilePath) .skipToEnd(skipToEnd) .addByteOffset(byteOffsetHeader) .cachePatternMatching(cachePatternMatching) .annotateFileName(fileHeader) .fileNameHeader(fileHeaderKey) .build(); } catch (IOException e) { throw new FlumeException("Error instantiating ReliableTaildirEventReader", e); } for (Entry<Long, TailFile> entry : reader.getTailFiles().entrySet()) { <START> inodePositionMap.put(entry.getKey() + "", entry.getValue().getPos() + ""); <END> inodePathMap.put(entry.getKey() + "", entry.getValue().getPath() + ""); } idleFileChecker = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("idleFileChecker").build()); idleFileChecker.scheduleWithFixedDelay(new idleFileCheckerRunnable(), idleTimeout, checkIdleInterval, TimeUnit.MILLISECONDS); super.start(); logger.debug("TaildirSource started"); sourceCounter.start(); }</code><technical_language>+ ""-s needed? <LINK_0> , String.valueOf is recommended. Please, if intent different</technical_language>

Target:
public synchronized void start() { logger.info("{} TaildirSource source starting with directory: {}", getName(), filePaths); try { reader = new ReliableTaildirEventReader.Builder() .filePaths(filePaths) .headerTable(headerTable) .positionFilePath(positionFilePath) .skipToEnd(skipToEnd) .addByteOffset(byteOffsetHeader) .cachePatternMatching(cachePatternMatching) .writePosOnCommit(writePosOnCommit) .annotateFileName(fileHeader) .fileNameHeader(fileHeaderKey) .build(); } catch (IOException e) { throw new FlumeException("Error instantiating ReliableTaildirEventReader", e); } if (writePosOnCommit) { for (Entry<Long, TailFile> entry : reader.getTailFiles().entrySet()) { inodePositionMap.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue().getPos())); inodePathMap.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue().getPath())); } } idleFileChecker = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("idleFileChecker").build()); idleFileChecker.scheduleWithFixedDelay(new idleFileCheckerRunnable(), idleTimeout, checkIdleInterval, TimeUnit.MILLISECONDS); if (!writePosOnCommit) { positionWriter = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("positionWriter").build()); positionWriter.scheduleWithFixedDelay(new PositionWriterRunnable(), writePosInitDelay, writePosInterval, TimeUnit.MILLISECONDS); } super.start(); logger.debug("TaildirSource started"); sourceCounter.start(); }
Source:
<code>public Set<String> getWhitelist() { <START> return whitelistedIDs; <END> }</code><technical_language>return direct access a collection instance method. A malicious method bypass access controls checks put in addElement removeElement methods. Typically this done return Collections.unmodifiableSet(whitelistedIDs); return new HashSet<>(whitelistedIDs); depending end user need change data for some other purpose. unmodifiable in this case. note provided methods remove clientIds whitelist blacklist, important</technical_language>

Target:
public Set getWhitelist() { return Collections.unmodifiableSet(whitelistedIDs); }
Source:
<code>protected UserReference convertToType(Type targetType, Object value) { if (value == null) { return null; } WikiReference currentWikiReference = this.xcontextProvider.get().getWikiReference(); <START> return this.userReferenceResolver.resolve(value.toString(), currentWikiReference); <END> }</code><technical_language>hmmm this is correct. a current UserReferenceResolver<String> implementation instead</technical_language>

Target:
protected UserReference convertToType(Type targetType, Object value) { if (value == null) { return null; } return this.userReferenceResolver.resolve(value.toString()); }
Source:
<code>private boolean isDTreeItemContainerOwnedTreeItems(Notification notification) { <START> return notification.getFeature() == TreePackage.Literals.DTREE_ITEM_CONTAINER__OWNED_TREE_ITEMS && notification.getNotifier() instanceof DTreeItemContainer; <END> }</code><technical_language>Nitpick: instanceof check is redundant here</technical_language>

Target:
private boolean isDTreeItemContainerOwnedTreeItems(Notification notification) { return notification.getFeature() == TreePackage.Literals.DTREE_ITEM_CONTAINER__OWNED_TREE_ITEMS; }
Source:
<code>public static View hitTest(View view, float x, float y, @Nullable Predicate<View> viewSelector) { if (!ViewUtil.pointInView(view, x, y)) { return null; } if (!(view instanceof ViewGroup)) { return null; } final ViewGroup viewGroup = (ViewGroup)view; for (int i = viewGroup.getChildCount() - 1; i >= 0; --i) { final View child = viewGroup.getChildAt(i); <START> if (child.getVisibility() == View.INVISIBLE) { <END> continue; } if (viewSelector != null && !viewSelector.apply(child)) { continue; } PointF localPoint = new PointF(); if (ViewUtil.isTransformedPointInView(viewGroup, child, x, y, localPoint)) { if (child instanceof ViewGroup) { return hitTest(child, localPoint.x, localPoint.y, viewSelector); } else { return child; } } } return viewGroup; }</code><technical_language>Test for View.VISIBLE. want ignore invisible gone</technical_language>

Target:
public static View hitTest(View view, float x, float y, @Nullable Predicate<View> viewSelector) { if (!ViewUtil.pointInView(view, x, y)) { return null; } if (!(view instanceof ViewGroup)) { return null; } final ViewGroup viewGroup = (ViewGroup)view; for (int i = viewGroup.getChildCount() - 1; i >= 0; --i) { final View child = viewGroup.getChildAt(i); if (child.getVisibility() != View.VISIBLE) { continue; } if (viewSelector != null && !viewSelector.apply(child)) { continue; } PointF localPoint = new PointF(); if (ViewUtil.isTransformedPointInView(viewGroup, child, x, y, localPoint)) { if (child instanceof ViewGroup) { return hitTest(child, localPoint.x, localPoint.y, viewSelector); } else { return child; } } } return viewGroup; }
Source:
<code>public static String map(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus glusterVolumeStatus, String template) { switch (glusterVolumeStatus) { case UP: return GlusterState.UP.name(); case DOWN: return GlusterState.DOWN.name(); default: return null; } <START> } <END></code><technical_language>a step in right direction, uniform rest of application. For full uniformity: 1) Maintain GlusterStatus.java enum in API, map Backend values it. 2) Instead of status string, 'Status' object (I mention this before) easiest is follow existing example. For example, this VmMapper: model.setStatus(StatusUtils.create(map(entity.getstatus(), null))); 1) Backend VM status is mapped a rest-api status (an enum) 2) enum is StatusUtils.create() creates a 'Status' object 3) 'Status' object is set in rest-api entity (and entity is returned) Note this woule require changing in api.xsd, for GlusterBrick: <xs:element name="state" type="xs:string" minOccurs="0" maxOccurs="1"/> to: <xs:element name="state" type="Status" minOccurs="0" maxOccurs="1"/> for uniformity, this change GlusterVolume state</technical_language>

Target:
public static GlusterState map(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus glusterVolumeStatus, String template) { switch (glusterVolumeStatus) { case UP: return GlusterState.UP; case DOWN: return GlusterState.DOWN; default: return null; } }
Source:
<code>public static void readResponse(List<String> parameters, Map<String, String> parameterMap) { log.debug("Start finding parameters in response data and create extractors."); for (String parameter : parameters) { ExtractorData extractor = createExtractorForParameter(parameter, parameterMap.get(parameter)); if (extractor != null) { getListOfExtractor().add(extractor); } } <START> log.debug("Processing of sample results ended."); <END> updateJmxFile(parameterMap); }</code><technical_language>add some context this debug message useful</technical_language>

Target:
public static void readResponse(List<String> parameters, Map<String, String> parameterMap) { log.debug("Start finding parameters in response data and create extractors."); for (String parameter : parameters) { ExtractorData extractor = createExtractorForParameter(parameter, parameterMap.get(parameter)); if (extractor != null) { getListOfExtractor().add(extractor); } } log.debug("Processing of finding parameters in response data and creation of extractors ended."); updateJmxFile(parameterMap); }
Source:
<code>public void lookupByNameCaching() throws Throwable { when(registry.lookupByName(any())).thenReturn(java.util.Optional.of("malaFama")); BaseService service = new Utils.InvalidNamedAugmentedMethodService(); Method method = BaseService.class.getMethod("augmented"); injectParamsFromContextServiceMethodInvoker.invoke(service, method, null); injectParamsFromContextServiceMethodInvoker.invoke(service, method, null); <START> verify(registry).lookupByName(any()); <END> }</code><technical_language>add times(1) atMost(1) matchers</technical_language>

Target:
public void lookupByNameCaching() throws Throwable { when(registry.lookupByName(any())).thenReturn(java.util.Optional.of("malaFama")); BaseService service = new Utils.InvalidNamedAugmentedMethodService(); Method method = BaseService.class.getMethod("augmented"); injectParamsFromContextServiceMethodInvoker.invoke(service, method, null); injectParamsFromContextServiceMethodInvoker.invoke(service, method, null); verify(registry, times(1)).lookupByName(any()); }
Source:
<code>public void visitNamespaceStatement(NamespaceStatementTree tree) { aliases.clear(); <START> currentNamespace = tree.namespaceName() != null ? QualifiedName.create(tree.namespaceName()) : null; <END> super.visitNamespaceStatement(tree); boolean isBracketedNamespace = tree.openCurlyBrace() != null; if (isBracketedNamespace) { currentNamespace = null; aliases.clear(); } }</code><technical_language>clear aliases is wrong in case of nested namespace curly braces. Exiting a child namespace context restore parent namespace context a stack. discuss code: php namespace N1 { A B; namespace N2 { C D; new D(); } new B(); } // fullyQualifiedNames: C, A code: php namespace N1 { new A(); namespace N2 { new B(); } new C(); } // fullyQualifiedNames: N1\A, N1\N2\B, N1\C</technical_language>

Target:
public void visitNamespaceStatement(NamespaceStatementTree tree) { aliases.clear(); currentNamespace = tree.namespaceName() != null ? QualifiedName.create(tree.namespaceName()) : null; super.visitNamespaceStatement(tree); boolean isBracketedNamespace = tree.openCurlyBrace() != null; if (isBracketedNamespace) { resetNamespace(); } }
Source:
<code>public void shouldUseUsernameAsNamespaceWhenCreatingWorkspaceWithoutSpecifiedNamespace() throws Exception { final WorkspaceConfigDto configDto = createConfigDto(); final WorkspaceImpl workspace = createWorkspace(configDto); when(wsManager.createWorkspace( <START> any(WorkspaceConfig.class), anyString(), anyMapOf(String.class, String.class))) <END> .thenReturn(workspace); final Response response = given() .auth() .basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD) .contentType("application/json") .body(configDto) .when() .post( SECURE_PATH + "/workspace" + "?attribute=stackId:stack123" + "&attribute=factoryId:factory123" + "&attribute=custom:custom:value"); assertEquals(response.getStatusCode(), 201); assertEquals( new WorkspaceImpl(unwrapDto(response, WorkspaceDto.class), TEST_ACCOUNT), workspace); verify(wsManager) .createWorkspace( anyObject(), eq(NAMESPACE), eq( ImmutableMap.of( "stackId", "stack123", "factoryId", "factory123", "custom", "custom:value"))); }</code><technical_language>Java8, anyMapOf is required (and is deprecated in new releases) any() is enough for type inference</technical_language>

Target:
public void shouldUseUsernameAsNamespaceWhenCreatingWorkspaceWithoutSpecifiedNamespace() throws Exception { final WorkspaceConfigDto configDto = createConfigDto(); final WorkspaceImpl workspace = createWorkspace(configDto); when(wsManager.createWorkspace(any(WorkspaceConfig.class), anyString(), any())) .thenReturn(workspace); final Response response = given() .auth() .basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD) .contentType("application/json") .body(configDto) .when() .post( SECURE_PATH + "/workspace" + "?attribute=stackId:stack123" + "&attribute=factoryId:factory123" + "&attribute=custom:custom:value"); assertEquals(response.getStatusCode(), 201); assertEquals( new WorkspaceImpl(unwrapDto(response, WorkspaceDto.class), TEST_ACCOUNT), workspace); verify(wsManager) .createWorkspace( anyObject(), eq(NAMESPACE), eq( ImmutableMap.of( "stackId", "stack123", "factoryId", "factory123", "custom", "custom:value"))); }
Source:
<code>public void handle(YamlObject<?> obj, YamlParseContext context) { YamlSeq seq = obj.seq(); for (YamlObject o : seq) { YamlMap r = o.map(); Rule rule = factory.style.createRule(); featureStyle.rules().add(rule); rule.setName(r.str("name")); rule.setTitle(r.str("title")); rule.setAbstract(r.str("abstract")); context.push( r, <START> "legend", <END> new GraphicParser(factory) { @Override protected void graphic(Graphic g) { rule.setLegend(g); } }); if (r.has("filter")) { try { rule.setFilter(ECQL.toFilter(Util.removeExpressionBrackets(r.str("filter")))); } catch (CQLException e) { throw new RuntimeException("Error parsing filter", e); } } rule.setElseFilter(r.boolOr("else", false)); @Nullable ScaleRange range = Util.defaultForNull(parseScale(r), parseZoom(r, context)); if (range != null) { range.applyTo(rule); } context.push(r, "symbolizers", new SymbolizersParser(rule, factory)); } }</code><technical_language>This change in a separate commit is housekeeping unrelated other change</technical_language>

Target:
public void handle(YamlObject<?> obj, YamlParseContext context) { YamlSeq seq = obj.seq(); for (YamlObject o : seq) { YamlMap r = o.map(); Rule rule = factory.style.createRule(); featureStyle.rules().add(rule); rule.setName(r.str("name")); if (r.has("title")) { rule.setTitle(r.str("title")); } if (r.has("abstract")) { rule.setAbstract(r.str("abstract")); } rule.setTitle(r.str("title")); rule.setAbstract(r.str("abstract")); context.push( r, "legend", new GraphicParser(factory) { @Override protected void graphic(Graphic g) { rule.setLegend(g); } }); if (r.has("filter")) { try { rule.setFilter(ECQL.toFilter(Util.removeExpressionBrackets(r.str("filter")))); } catch (CQLException e) { throw new RuntimeException("Error parsing filter", e); } } rule.setElseFilter(r.boolOr("else", false)); @Nullable ScaleRange range = Util.defaultForNull(parseScale(r), parseZoom(r, context)); if (range != null) { range.applyTo(rule); } context.push(r, "symbolizers", new SymbolizersParser(rule, factory)); } }
Source:
<code>public synchronized void terminateJenkinsSlave(String name) { LOGGER.info("Terminating jenkins slave " + name); TaskID taskId = TaskID.newBuilder().setValue(name).build(); if (results.containsKey(taskId)) { LOGGER.info("Killing mesos task " + taskId); driver.killTask(taskId); } else { Request ref = null; <START> for (Request request : requests) { <END> if(request.request.slave.name.equals(name)){ ref = request; break; } } if(ref != null) { requests.remove(ref); ref = null; LOGGER.info("Removing enqueued mesos task " + name); } else LOGGER.warning("Asked to kill unknown mesos task " + taskId); } }</code><technical_language>Good catch. following: for (Request request : requests) { if (request.request.slave.names.equals(name)) { LOGGER.info("Removing enqueued mesos task " + name); requests.remove(request); return; } } LOGGER.warning("Asked kill unknown task " + name);</technical_language>

Target:
public synchronized void terminateJenkinsSlave(String name) { LOGGER.info("Terminating jenkins slave " + name); TaskID taskId = TaskID.newBuilder().setValue(name).build(); if (results.containsKey(taskId)) { LOGGER.info("Killing mesos task " + taskId); driver.killTask(taskId); } else { for(Request request : requests) { if(request.request.slave.name.equals(name)) { LOGGER.info("Removing enqueued mesos task " + name); requests.remove(request); return; } } LOGGER.warning("Asked to kill unknown mesos task " + taskId); } }
Source:
<code>private void onSuccess() { <START> if (errorCount.getAndSet(0) >= config.storeIOErrorCountToTriggerShutdown) { <END> logger.info("Resetting the error count of BlobStore because restart or one operation succeeded", storeId); } }</code><technical_language>I understand if here. If errorCount() higher equal config.storeIOErrorCountToTriggerShutdown, store shutting/shut down</technical_language>

Target:
private void onSuccess() { errorCount.getAndSet(0); }
Source:
<code><START> public void testHasNotTaskChanged2() { <END> TaskData taskData = new TaskData(new TaskAttributeMapper(repository), connector.getConnectorKind(), repository.getRepositoryUrl(), "123"); TaskTask task = new TaskTask(repository.getConnectorKind(), repository.getRepositoryUrl(), "123"); Date now = new Date(); task.setAttribute(BugzillaRestTaskSchema.getDefault().DATE_MODIFICATION.getKey(), "" + now.getTime()); assertTrue(!connector.hasTaskChanged(repository, task, taskData)); }</code><technical_language>this happen want hasTaskChanged return true in this case</technical_language>

Target:
public void testHasNotTaskChanged2() { TaskData taskData = new TaskData(new TaskAttributeMapper(repository), connector.getConnectorKind(), repository.getRepositoryUrl(), "123"); TaskTask task = new TaskTask(repository.getConnectorKind(), repository.getRepositoryUrl(), "123"); Date now = new Date(); task.setAttribute(BugzillaRestTaskSchema.getDefault().DATE_MODIFICATION.getKey(), "" + now.getTime()); assertTrue(connector.hasTaskChanged(repository, task, taskData)); }
Source:
<code>protected void buildVmCD() { Map<String, Object> struct; boolean hasPayload = vm.getVmPayload() != null && vm.getVmPayload().getDeviceType() == VmDeviceType.CDROM; if (hasPayload) { <START> VmDevice vmDevice = <END> new VmDevice(new VmDeviceId(Guid.newGuid(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.CDROM.getName(), "", 0, vm.getVmPayload().getSpecParams(), true, true, true, "", null, null, null); struct = new HashMap<String, Object>(); addCdDetails(vmDevice, struct, vm); addDevice(struct, vmDevice, ""); } if (vm.isRunOnce() && !StringUtils.isEmpty(vm.getCdPath())) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.newGuid(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.CDROM.getName(), "", 0, null, true, true, true, "", null, null, null); struct = new HashMap<String, Object>(); addCdDetails(vmDevice, struct, vm); addDevice(struct, vmDevice, vm.getCdPath()); } else { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceGeneralType.DISK, VmDeviceType.CDROM.getName()); for (VmDevice vmDevice : vmDevices) { if (!vmDevice.getIsManaged()) { continue; } if (VmPayload.isPayload(vmDevice.getSpecParams())) { continue; } struct = new HashMap<String, Object>(); String cdPath = vm.getCdPath(); addCdDetails(vmDevice, struct, vm); addAddress(vmDevice, struct); addDevice(struct, vmDevice, cdPath == null ? "" : cdPath); } } }</code><technical_language>need create new vmDevice, need vmPayload object, is a vmDevice info (id,address..)</technical_language>

Target:
protected void buildVmCD() { Map<String, Object> struct; boolean hasPayload = vm.getVmPayload() != null && vm.getVmPayload().getDeviceType() == VmDeviceType.CDROM; if (hasPayload) { struct = new HashMap<String, Object>(); addCdDetails(vm.getVmPayload(), struct, vm); addDevice(struct, vm.getVmPayload(), ""); } if (vm.isRunOnce() && !StringUtils.isEmpty(vm.getCdPath())) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.newGuid(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.CDROM.getName(), "", 0, null, true, true, true, "", null, null, null); struct = new HashMap<String, Object>(); addCdDetails(vmDevice, struct, vm); addDevice(struct, vmDevice, vm.getCdPath()); } else { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceGeneralType.DISK, VmDeviceType.CDROM.getName()); for (VmDevice vmDevice : vmDevices) { if (!vmDevice.getIsManaged()) { continue; } if (VmPayload.isPayload(vmDevice.getSpecParams())) { continue; } struct = new HashMap<String, Object>(); String cdPath = vm.getCdPath(); addCdDetails(vmDevice, struct, vm); addAddress(vmDevice, struct); addDevice(struct, vmDevice, cdPath == null ? "" : cdPath); } } }
Source:
<code>public void LargeTest() { ITmfStateSystemBuilder fixture = createFixture(); int parentQuark = fixture.getQuarkAbsoluteAndAdd(PROCESS_PATH, THREAD_PATH, CALLSTACK_PATH); for (int i = 0; i < LARGE_AMOUNT_OF_SEGMENTS; i++) { int quark = fixture.getQuarkRelativeAndAdd(parentQuark, Integer.toString(i)); TmfStateValue statev = TmfStateValue.newValueLong(i); fixture.modifyAttribute(0, statev, quark); fixture.modifyAttribute(10, TmfStateValue.nullValue(), quark); } fixture.closeHistory(1002); String[] csp = { CALLSTACK_PATH }; String[] pp = { PROCESS_PATH }; String[] tp = { THREAD_PATH }; CallGraphAnalysis cga = new CallGraphAnalysis(); assertTrue(cga.iteratorOverStateSystem(fixture, tp, pp, csp, new NullProgressMonitor())); @NonNull ISegmentStore<? extends ISegment> sss = NonNullUtils.checkNotNull(cga.getSegmentStore()); Object[] segments = sss.toArray(); <START> assertEquals("Number of segments Found", LARGE_AMOUNT_OF_SEGMENTS, segments.length, ERROR); <END> }</code><technical_language>found, lowercase</technical_language>

Target:
public void LargeTest() { ITmfStateSystemBuilder fixture = createFixture(); int parentQuark = fixture.getQuarkAbsoluteAndAdd(PROCESS_PATH, THREAD_PATH, CALLSTACK_PATH); for (int i = 0; i < LARGE_AMOUNT_OF_SEGMENTS; i++) { int quark = fixture.getQuarkRelativeAndAdd(parentQuark, Integer.toString(i)); TmfStateValue statev = TmfStateValue.newValueLong(i); fixture.modifyAttribute(0, statev, quark); fixture.modifyAttribute(10, TmfStateValue.nullValue(), quark); } fixture.closeHistory(1002); String[] csp = { CALLSTACK_PATH }; String[] pp = { PROCESS_PATH }; String[] tp = { THREAD_PATH }; CGAnalysis cga = new CGAnalysis(); assertTrue(cga.iterateOverStateSystem(fixture, tp, pp, csp, new NullProgressMonitor())); @NonNull ISegmentStore<? extends ISegment> sss = NonNullUtils.checkNotNull(cga.getSegmentStore()); Object[] segments = sss.toArray(); assertEquals("Number of segments found", LARGE_AMOUNT_OF_SEGMENTS, segments.length, ERROR); }
Source:
<code>public void writeProviderAssignation(SourceWriter writer) { if (customProviderAnnotation != null) { JClassType customProvider = oracle.findType(customProviderAnnotation.value().getName()); writer.println("presenter = new " + customProvider.getQualifiedSourceName() + "<" + presenterClassName + ">( ginjector." + getPresenterMethodName + "() );"); <START> } else { <END> if (proxyStandardAnnotation != null) { writer.println("presenter = new StandardProvider<" + presenterClassName + ">( ginjector." + getPresenterMethodName + "() );"); } else if (proxyCodeSplitAnnotation != null) { writer.println("presenter = new CodeSplitProvider<" + presenterClassName + ">( ginjector." + getPresenterMethodName + "() );"); } else { assert proxyCodeSplitBundleAnnotation != null; writer.print("presenter = new CodeSplitBundleProvider<" + presenterClassName + ", " + bundleClassName + ">(ginjector." + getPresenterMethodName + "(), "); if (ginjectorInspector.isGenerated()) { writer.print(bundleClassName + "." + presenterClass.getSimpleSourceName().toUpperCase() + ");"); } else { writer.print(proxyCodeSplitBundleAnnotation.id() + ");"); } } } }</code><technical_language>this wrapped a else if</technical_language>

Target:
public void writeProviderAssignation(SourceWriter writer) { if (customProviderAnnotation != null) { JClassType customProvider = oracle.findType(customProviderAnnotation.value().getName()); writer.println("presenter = new " + customProvider.getQualifiedSourceName() + "( ginjector." + getPresenterMethodName + "() );"); } else if (proxyStandardAnnotation != null) { writer.println("presenter = new StandardProvider<" + presenterClassName + ">( ginjector." + getPresenterMethodName + "() );"); } else if (proxyCodeSplitAnnotation != null) { writer.println("presenter = new CodeSplitProvider<" + presenterClassName + ">( ginjector." + getPresenterMethodName + "() );"); } else { assert proxyCodeSplitBundleAnnotation != null; writer.print("presenter = new CodeSplitBundleProvider<" + presenterClassName + ", " + bundleClassName + ">(ginjector." + getPresenterMethodName + "(), "); if (ginjectorInspector.isGenerated()) { writer.print(bundleClassName + "." + presenterClass.getSimpleSourceName().toUpperCase() + ");"); } else { writer.print(proxyCodeSplitBundleAnnotation.id() + ");"); } } }
Source:
<code>public StarDoublePathElement(String key) { super(key); if ( StringUtils.countMatches(key, "*") != 2 ) { throw new IllegalArgumentException( "StarDoublePathElement should have two '*' in its key." ); } <START> else if ( "*".equals( key ) ) { <END> throw new IllegalArgumentException( "StarDoublePathElement should have a key that has two '*'." ); } String[] split = StringUtils.split(key, '*'); if ( key.startsWith( "*" ) && key.endsWith("*")) { prefix = ""; mid = split[0]; suffix = ""; } else if ( key.endsWith( "*" ) ) { prefix = split[0]; mid = split[1]; suffix = ""; } else if ( key.startsWith( "*" ) ) { prefix = ""; mid = split[0]; suffix = split[1]; } else{ prefix=split[0]; mid=split[1]; suffix=split[2]; } }</code><technical_language>this else if hit</technical_language>

Target:
public StarDoublePathElement(String key) { super(key); if ( StringUtils.countMatches(key, "*") != 2 ) { throw new IllegalArgumentException( "StarDoublePathElement should have two '*' in its key." ); } String[] split = key.split("\\*"); boolean startsWithStar = key.startsWith( "*" ); boolean endsWithStar = key.endsWith("*"); if ( startsWithStar && endsWithStar) { prefix = ""; mid = split[1]; suffix = ""; } else if ( endsWithStar ) { prefix = split[0]; mid = split[1]; suffix = ""; } else if ( startsWithStar ) { prefix = ""; mid = split[1]; suffix = split[2]; } else{ prefix=split[0]; mid=split[1]; suffix=split[2]; } }
Source:
<code><START> public static <END> Map<String, Long> buildIoTune( Guid diskProfileId, Map<Guid, Guid> diskProfileStorageQosMap, Map<Guid, Map<String, Long>> storageQosIoTuneMap) { if (diskProfileId == null) { return null; } Guid storageQosId = diskProfileStorageQosMap.get(diskProfileId); if (storageQosId == null) { StorageQos qos = DbFacade.getInstance().getStorageQosDao().getQosByDiskProfileId(diskProfileId); if (qos == null) { return null; } storageQosId = qos.getId(); diskProfileStorageQosMap.put(diskProfileId, storageQosId); storageQosIoTuneMap.put(storageQosId, IoTuneUtils.ioTuneMap(qos)); } return storageQosIoTuneMap.get(storageQosId); }</code><technical_language>of handleIoTune private</technical_language>

Target:
private static Map<String, Long> buildIoTune( Guid diskProfileId, Map<Guid, Guid> diskProfileStorageQosMap, Map<Guid, Map<String, Long>> storageQosIoTuneMap) { if (diskProfileId == null) { return null; } Guid storageQosId = diskProfileStorageQosMap.get(diskProfileId); if (storageQosId == null) { StorageQos qos = DbFacade.getInstance().getStorageQosDao().getQosByDiskProfileId(diskProfileId); if (qos == null) { return null; } storageQosId = qos.getId(); diskProfileStorageQosMap.put(diskProfileId, storageQosId); storageQosIoTuneMap.put(storageQosId, IoTuneUtils.ioTuneMapFrom(qos)); } return storageQosIoTuneMap.get(storageQosId); }
Source:
<code>public void rememberExecution(LocalDateTime timestamp) { this.lastExecution = timestamp; this.numberOfExecutions++; if (this.runs != null) { <START> this.runs = this.runs - 1; <END> } }</code><technical_language>suggestion this.runs -= 1;</technical_language>

Target:
public void rememberExecution(LocalDateTime timestamp) { this.lastExecution = timestamp; this.numberOfExecutions++; if (this.runs != null) { this.runs -= 1; } }
Source:
<code>private Direction getLevelingDirection() { if (driveSpeed.direction() == Direction.STOP && <START> driveSpeed.speed() == DriveObject.StopSpeed) { <END> if (mLevelUp.getValue() == false) { return Direction.UP; } else if (mLevelDown.getValue() == false) { return Direction.DOWN; } } return driveSpeed.direction(); }</code><technical_language>Nah this is totally wrong. level stop. in diagram thingy. VOTE FOR HIGH LEVEL REQUIREMENT VIOLATIONS</technical_language>

Target:
private Direction getLevelingDirection() { Direction d = driveSpeed.direction(); if (mLevelUp.getValue() == false) return (d == Direction.DOWN) ? Direction.STOP : Direction.UP; else if (mLevelDown.getValue() == false) return (d == Direction.UP) ? Direction.STOP : Direction.DOWN; return Direction.STOP; }
Source:
<code>public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, positionCount); boolean[] seen = new boolean[dictionary.getPositionCount()]; boolean[] used = new boolean[dictionary.getPositionCount()]; for (int i = 0; i < positions.length; i++) { if (positions[i]) { int position = getId(i); if (!seen[position]) { if (!dictionary.isNull(position)) { used[position] = true; } <START> seen[position] = true; <END> } } } return dictionary.getPositionsSizeInBytes(used); }</code><technical_language>I need variable here. I need isNull check all. I null check in getRegionSizeInBytes is necessary. In addition, forgot change DictionaryBlock.getRegionSizeInBytes</technical_language>

Target:
public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, positionCount); boolean[] used = new boolean[dictionary.getPositionCount()]; for (int i = 0; i < positions.length; i++) { if (positions[i]) { used[getId(i)] = true; } } return dictionary.getPositionsSizeInBytes(used) + Integer.BYTES * countUsedPositions(positions); }
Source:
<code>private void enableSchedule(Id scheduleId) throws IOException, SystemExitException { DigdagClient client = buildClient(); <START> Optional<String> mode = modeString == null ? Optional.absent() : Optional.of(modeString); <END> client.enableSchedule(scheduleId, mode, Optional.absent()); ln("Enabled schedule id: %s", scheduleId); }</code><technical_language>trivial things, Optional.fromNullable()</technical_language>

Target:
private void enableSchedule(Id scheduleId) throws IOException, SystemExitException { DigdagClient client = buildClient(); client.enableSchedule(scheduleId); ln("Enabled schedule id: %s", scheduleId); }
Source:
<code>private void checkIfEditMetadataAllowedInCurrentStep(Context context, XmlWorkflowItem xmlWorkflowItem) { try { ClaimedTask claimedTask = claimedTaskService.findByWorkflowIdAndEPerson(context, xmlWorkflowItem, context.getCurrentUser()); if (claimedTask == null) { throw new UnprocessableEntityException("WorkflowItem with id " + xmlWorkflowItem.getID() + " has not been claimed yet."); } Workflow workflow = workflowFactory.getWorkflow(claimedTask.getWorkflowItem().getCollection()); Step step = workflow.getStep(claimedTask.getStepID()); WorkflowActionConfig currentActionConfig = step.getActionConfig(claimedTask.getActionID()); if (!currentActionConfig.getProcessingAction().getOptions().contains(SUBMIT_EDIT_METADATA)) { throw new UnprocessableEntityException(SUBMIT_EDIT_METADATA + " is not a valid option on this " + "action (" + currentActionConfig.getProcessingAction().getClass() + ")."); } } catch (SQLException | WorkflowConfigurationException e) { <START> throw new RuntimeException(e.getMessage(), e); <END> } }</code><technical_language>This provide a more useful error message updated new RuntimeException(e); Simply returning e.getMessage() useful here</technical_language>

Target:
private void checkIfEditMetadataAllowedInCurrentStep(Context context, XmlWorkflowItem xmlWorkflowItem) { try { ClaimedTask claimedTask = claimedTaskService.findByWorkflowIdAndEPerson(context, xmlWorkflowItem, context.getCurrentUser()); if (claimedTask == null) { throw new UnprocessableEntityException("WorkflowItem with id " + xmlWorkflowItem.getID() + " has not been claimed yet."); } Workflow workflow = workflowFactory.getWorkflow(claimedTask.getWorkflowItem().getCollection()); Step step = workflow.getStep(claimedTask.getStepID()); WorkflowActionConfig currentActionConfig = step.getActionConfig(claimedTask.getActionID()); if (!currentActionConfig.getProcessingAction().getOptions().contains(SUBMIT_EDIT_METADATA)) { throw new UnprocessableEntityException(SUBMIT_EDIT_METADATA + " is not a valid option on this " + "action (" + currentActionConfig.getProcessingAction().getClass() + ")."); } } catch (SQLException e) { throw new RuntimeException("SQLException in " + this.getClass() + "#checkIfEditMetadataAllowedInCurrentStep trying to retrieve workflowitem from db by eperson.", e); } catch (WorkflowConfigurationException e) { throw new RuntimeException("WorkflowConfigurationException in " + this.getClass() + "#checkIfEditMetadataAllowedInCurrentStep trying to retrieve workflow configuration from config", e); } }
Source:
<code>public void sendMessage_shouldSetRecipientIfAddressIsNotNull() throws MessageException { String recipient1 = "address1"; String recipient2 = "address2"; Context.getAuthenticatedUser().setUserProperty(OpenmrsConstants.USER_PROPERTY_NOTIFICATION_ADDRESS, recipient2); MessageSender messageSender = new MailMessageSender(); Context.getMessageService().setMessageSender(messageSender); Message messageObj = new Message(1,recipient1,"sender","subject","content"); try { <START> Context.getMessageService().sendMessage(messageObj, Context.getAuthenticatedUser()); <END> } catch (MessageException e) { if (!e.getMessage().contains(NO_SMTP_SERVER_ERROR)) { e.printStackTrace(); fail(); } } assertEquals(messageObj.getRecipients(),recipient1 + "," + recipient2); }</code><technical_language>this service</technical_language>

Target:
public void sendMessage_shouldSetRecipientIfAddressIsNotNull() { String recipient1 = "address1"; String recipient2 = "address2"; getAuthenticatedUser().setUserProperty(OpenmrsConstants.USER_PROPERTY_NOTIFICATION_ADDRESS, recipient2); MessageSender messageSender = new MailMessageSender(); ms.setMessageSender(messageSender); Message messageObj = new Message(1,recipient1,"sender","subject","content"); try { ms.sendMessage(messageObj, getAuthenticatedUser()); } catch (MessageException e) { if (!e.getMessage().contains(NO_SMTP_SERVER_ERROR)) { e.printStackTrace(); fail(); } } assertEquals(messageObj.getRecipients(),recipient1 + "," + recipient2); }
Source:
<code>public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); <START> mAllergensFromDao = Utils.getAppDaoSession(this.getActivity()).getAllergenDao().loadAll(); <END> api = new OpenFoodAPIClient(getActivity()); mView = view; mSettings = getActivity().getSharedPreferences("prefs", 0); boolean firstRunAlert = mSettings.getBoolean("firstRunAlert", true); if (firstRunAlert) { new MaterialDialog.Builder(getContext()) .title(R.string.alert_dialog_warning_title) .content(R.string.warning_alert_data) .positiveText(R.string.ok_button) .show(); SharedPreferences.Editor editor = mSettings.edit(); editor.putBoolean("firstRunAlert", false); editor.apply(); } mRvAllergens = (RecyclerView) view.findViewById(R.id.alergens_recycle); mAllergensEnabled = Utils.getAppDaoSession(this.getActivity()).getAllergenDao().queryBuilder().where(AllergenDao.Properties.Enable.eq("true")).list(); mAdapter = new AllergensAdapter(mAllergensEnabled, getActivity()); mRvAllergens.setAdapter(mAdapter); mRvAllergens.setLayoutManager(new LinearLayoutManager(view.getContext())); mRvAllergens.setHasFixedSize(true); }</code><technical_language>Utils.getAppDaoSession(getActivity()).getAllergenDao() is times in this class, consider create a class field like: java AllerhenDao dao; public void onViewCreated() { dao = Utils.getAppDaoSession(getActivity()).getAllergenDao() }</technical_language>

Target:
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mAllergenDao = Utils.getAppDaoSession(getActivity()).getAllergenDao(); mAllergensFromDao = mAllergenDao.loadAll(); api = new OpenFoodAPIClient(getActivity()); mView = view; mSettings = getActivity().getSharedPreferences("prefs", 0); boolean firstRunAlert = mSettings.getBoolean("firstRunAlert", true); if (firstRunAlert) { new MaterialDialog.Builder(getContext()) .title(R.string.alert_dialog_warning_title) .content(R.string.warning_alert_data) .positiveText(R.string.ok_button) .show(); SharedPreferences.Editor editor = mSettings.edit(); editor.putBoolean("firstRunAlert", false); editor.apply(); } mRvAllergens = (RecyclerView) view.findViewById(R.id.alergens_recycle); mAllergensEnabled = mAllergenDao.queryBuilder().where(AllergenDao.Properties.Enable.eq("true")).list(); mAdapter = new AllergensAdapter(mAllergensEnabled, getActivity()); mRvAllergens.setAdapter(mAdapter); mRvAllergens.setLayoutManager(new LinearLayoutManager(view.getContext())); mRvAllergens.setHasFixedSize(true); }
Source:
<code>public Iterator<Resource> iterateResources(String startPath, final boolean recursive) { if (relativePath != null) startPath = startPath.equals("") ? relativePath : relativePath + "/" + startPath; <START> final String startName = PathUtils.canonicalize(PathUtils.relativize(startPath)); <END> List<String> directory = this.directory; if (directory == null) { synchronized (jarFile) { directory = this.directory; if (directory == null) { directory = new ArrayList<>(); final Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { final JarEntry jarEntry = entries.nextElement(); if (! jarEntry.isDirectory()) { directory.add(jarEntry.getName()); } } this.directory = directory; } } } final Iterator<String> iterator = directory.iterator(); return new Iterator<Resource>() { private Resource next; public boolean hasNext() { while (next == null) { if (! iterator.hasNext()) { return false; } final String name = iterator.next(); if ((recursive ? PathUtils.isChild(startName, name) : PathUtils.isDirectChild(startName, name))) { try { next = new JarEntryResource(jarFile, name, relativePath, getJarURI(jarURI, name).toURL()); } catch (Exception ignored) { } } } return true; } public Resource next() { if (! hasNext()) { throw new NoSuchElementException(); } try { return next; } finally { next = null; } } public void remove() { throw new UnsupportedOperationException(); } }; }</code><technical_language>This necessary for Windows. Is this logic replicated anywhere</technical_language>

Target:
public Iterator<Resource> iterateResources(String startPath, final boolean recursive) { if (relativePath != null) startPath = startPath.equals("") ? relativePath : relativePath + "/" + startPath; final String startName = PathUtils.canonicalize(PathUtils.relativize(startPath)); List<String> directory = this.directory; if (directory == null) { synchronized (jarFile) { directory = this.directory; if (directory == null) { directory = new ArrayList<>(); final Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { final JarEntry jarEntry = entries.nextElement(); if (! jarEntry.isDirectory()) { directory.add(jarEntry.getName()); } } this.directory = directory; } } } final Iterator<String> iterator = directory.iterator(); return new Iterator<Resource>() { private Resource next; public boolean hasNext() { while (next == null) { if (! iterator.hasNext()) { return false; } final String name = iterator.next(); if ((recursive ? PathUtils.isChild(startName, name) : PathUtils.isDirectChild(startName, name))) { try { next = new JarEntryResource(jarFile, name, relativePath, getJarURI(name).toURL()); } catch (Exception ignored) { } } } return true; } public Resource next() { if (! hasNext()) { throw new NoSuchElementException(); } try { return next; } finally { next = null; } } public void remove() { throw new UnsupportedOperationException(); } }; }
Source:
<code>private void removeFromDB(String serviceName, String type, String userId) throws CredentialStoreException { try { Connection connection = getConnection(); try { String application = findApplicationName(); if(StringUtil.isEmpty(userId)){ userId = serviceName+application; } PreparedStatement ps = connection .prepareStatement("DELETE FROM "+getTableName()+" WHERE APPID = ? AND SERVICENAME = ? AND USERID = ? AND TYPE = ?"); <START> try { <END> ps.setString(1, application); ps.setString(2, serviceName); ps.setString(3, userId); ps.setString(4, type); ps.executeUpdate(); } finally { ps.close(); } } finally { connection.close(); } } catch (SQLException e) { logger.log(Level.SEVERE, "deleteConsumerToken : ", e); throw new CredentialStoreException(e, "DBTokenStore.java : deleteConsumerToken caused a SQLException"); } }</code><technical_language>nested try/catch/finally blocks mixed throws statements. simplify this</technical_language>

Target:
private void removeFromDB(String serviceName, String type, String userId) throws CredentialStoreException { try { Connection connection = getConnection(); try { String application = findApplicationName(); if(StringUtil.isEmpty(userId)){ userId = ""; } PreparedStatement ps = connection .prepareStatement("DELETE FROM "+getTableName()+" WHERE APPID = ? AND SERVICENAME = ? AND USERID = ? AND TYPE = ?"); try { ps.setString(1, application); ps.setString(2, serviceName); ps.setString(3, userId); ps.setString(4, type); ps.executeUpdate(); } finally { ps.close(); } } finally { connection.close(); } } catch (SQLException e) { logger.log(Level.SEVERE, "deleteConsumerToken : ", e); throw new CredentialStoreException(e, "DBTokenStore.java : deleteConsumerToken caused a SQLException"); } }
Source:
<code>protected Set<Value.Immutable<?>> api$getVanillaValues() { Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); <START> this.breeder().ifPresent(v -> vanillaValues.add(v.asImmutable())); <END> vanillaValues.add(this.breedTime().asImmutable()); return vanillaValues; }</code><technical_language>Map immutable, do ifPresent method references</technical_language>

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.breedTime().asImmutable()); values.add(this.canBreed().asImmutable()); this.breeder().map(Value::asImmutable).ifPresent(values::add); return values; }
Source:
<code>public IndexProcessingResults(Map<StoreKey, Info> keyToState, long processedCount, long putCount, long deleteCount, Set<StoreKey> duplicatePuts, Set<StoreKey> putAfterDeletes, Set<StoreKey> duplicateDeletes) { this.keyToState = keyToState; this.processedCount = processedCount; <START> this.putCount = putCount; <END> this.deleteCount = deleteCount; this.duplicatePuts = duplicatePuts; this.putAfterDeletes = putAfterDeletes; this.duplicateDeletes = duplicateDeletes; activeCount = keyToState.values().stream().filter(value -> value.getStates().contains(BlobState.Valid)).count(); }</code><technical_language>doc</technical_language>

Target:
IndexProcessingResults(Map<StoreKey, Info> keyToState, long processedCount, long putCount, long deleteCount, Set<StoreKey> duplicatePuts, Set<StoreKey> putAfterDeletes, Set<StoreKey> duplicateDeletes) { this.keyToState = keyToState; this.processedCount = processedCount; this.putCount = putCount; this.deleteCount = deleteCount; this.duplicatePuts = duplicatePuts; this.putAfterDeletes = putAfterDeletes; this.duplicateDeletes = duplicateDeletes; activeCount = keyToState.values().stream().filter(value -> value.getStates().contains(BlobState.Valid)).count(); }
Source:
<code>private String getResourcePath(String subscriptionID, String topicName) { String resourcePath = this.topicStoragePath; topicName = topicName.replaceAll("\\.", RegistryConstants.PATH_SEPARATOR); if (!topicName.startsWith(RegistryConstants.PATH_SEPARATOR)) { resourcePath = resourcePath + RegistryConstants.PATH_SEPARATOR; } <START> if (topicName.indexOf('*') > -1){ <END> topicName = topicName.substring(0, topicName.indexOf('*')); } else if (topicName.indexOf('#') > -1){ topicName = topicName.substring(0, topicName.indexOf('#')); } resourcePath = resourcePath + topicName; if (!resourcePath.endsWith(RegistryConstants.PATH_SEPARATOR)) { resourcePath = resourcePath + RegistryConstants.PATH_SEPARATOR; } resourcePath = resourcePath + EventBrokerConstants.EB_CONF_WS_SUBSCRIPTION_COLLECTION_NAME + RegistryConstants.PATH_SEPARATOR + subscriptionID; return resourcePath; }</code><technical_language>Extract '*' '#' constants if defined else</technical_language>

Target:
private String getResourcePath(String subscriptionID, String topicName) { String resourcePath = this.topicStoragePath; topicName = topicName.replaceAll("\\.", RegistryConstants.PATH_SEPARATOR); if (!topicName.startsWith(RegistryConstants.PATH_SEPARATOR)) { resourcePath = resourcePath + RegistryConstants.PATH_SEPARATOR; } if (topicName.indexOf(STAR_WILDCARD) > -1) { topicName = topicName.substring(0, topicName.indexOf(STAR_WILDCARD)); } else { if (topicName.indexOf(HASH_WILDCARD) > -1) { topicName = topicName.substring(0, topicName.indexOf(HASH_WILDCARD)); } } resourcePath = resourcePath + topicName; if (!resourcePath.endsWith(RegistryConstants.PATH_SEPARATOR)) { resourcePath = resourcePath + RegistryConstants.PATH_SEPARATOR; } resourcePath = resourcePath + EventBrokerConstants.EB_CONF_WS_SUBSCRIPTION_COLLECTION_NAME + RegistryConstants.PATH_SEPARATOR + subscriptionID; return resourcePath; }