auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Map<String, Object> toObject() { final HashMap<String, Object> flowObj = new HashMap<>(); fillMapFromExecutable(flowObj); flowObj.put(EXECUTIONID_PARAM, this.executionId); flowObj.put(EXECUTIONPATH_PARAM, this.executionPath); flowObj.put(PROJECTID_PARAM, this.projectId); flowObj.put(PROJECTNAME_PARAM, this.projectName); if (this.scheduleId >= 0) { flowObj.put(SCHEDULEID_PARAM, this.scheduleId); } flowObj.put(SUBMITUSER_PARAM, this.submitUser); flowObj.put(VERSION_PARAM, this.version); flowObj.put(LASTMODIFIEDTIME_PARAM, this.lastModifiedTimestamp); flowObj.put(LASTMODIFIEDUSER_PARAM, this.lastModifiedUser); flowObj.put(AZKABANFLOWVERSION_PARAM, this.azkabanFlowVersion); flowObj.put(EXECUTIONOPTIONS_PARAM, this.executionOptions.toObject()); final ArrayList<String> proxyUserList = new ArrayList<>(this.proxyUsers); flowObj.put(PROXYUSERS_PARAM, proxyUserList); flowObj.put(SUBMITTIME_PARAM, this.submitTime); final List<Map<String, Object>> slaOptions = new ArrayList<>(); List<SlaOption> slaOptionList = this.executionOptions.getSlaOptions(); if (slaOptionList != null) { for (SlaOption slaOption : this.executionOptions.getSlaOptions()) { <START> slaOptions.add(slaOption.toObject()); <END> } } flowObj.put(SLAOPTIONS_PARAM, slaOptions); flowObj.put(IS_LOCKED_PARAM, this.isLocked); flowObj.put(FLOW_LOCK_ERROR_MESSAGE_PARAM, this.flowLockErrorMessage); return flowObj; }</code><technical_language>Review <LINK_0> element of list null. Is possible? If so, end throwing a Null pointer exception here</technical_language>

Target:
public Map<String, Object> toObject() { final HashMap<String, Object> flowObj = new HashMap<>(); fillMapFromExecutable(flowObj); flowObj.put(EXECUTIONID_PARAM, this.executionId); flowObj.put(EXECUTIONPATH_PARAM, this.executionPath); flowObj.put(PROJECTID_PARAM, this.projectId); flowObj.put(PROJECTNAME_PARAM, this.projectName); if (this.scheduleId >= 0) { flowObj.put(SCHEDULEID_PARAM, this.scheduleId); } flowObj.put(SUBMITUSER_PARAM, this.submitUser); flowObj.put(VERSION_PARAM, this.version); flowObj.put(LASTMODIFIEDTIME_PARAM, this.lastModifiedTimestamp); flowObj.put(LASTMODIFIEDUSER_PARAM, this.lastModifiedUser); flowObj.put(AZKABANFLOWVERSION_PARAM, this.azkabanFlowVersion); flowObj.put(EXECUTIONOPTIONS_PARAM, this.executionOptions.toObject()); final ArrayList<String> proxyUserList = new ArrayList<>(this.proxyUsers); flowObj.put(PROXYUSERS_PARAM, proxyUserList); flowObj.put(SUBMITTIME_PARAM, this.submitTime); final List<Map<String, Object>> slaOptions = new ArrayList<>(); List<SlaOption> slaOptionList = this.executionOptions.getSlaOptions(); if (slaOptionList != null) { for (SlaOption slaOption : slaOptionList) { slaOptions.add(slaOption.toObject()); } } flowObj.put(SLAOPTIONS_PARAM, slaOptions); flowObj.put(IS_LOCKED_PARAM, this.isLocked); flowObj.put(FLOW_LOCK_ERROR_MESSAGE_PARAM, this.flowLockErrorMessage); return flowObj; }
Source:
<code>protected void assertEncrypted(Path path) throws IOException { Configuration c = new Configuration(); String kmsKey = c.get(SERVER_SIDE_ENCRYPTION_KEY); ObjectMetadata objectMetadata = getFileSystem().getObjectMetadata(path); <START> assertEquals("SSE KMS key id should match", kmsKey, objectMetadata.getSSEAwsKmsKeyId()); <END> }</code><technical_language>checkstyle -line needs splitting. under/near 80 chars for side-by-side review</technical_language>

Target:
protected void assertEncrypted(Path path) throws IOException { S3AFileSystem fs = getFileSystem(); Configuration c = fs.getConf(); String kmsKey = c.getTrimmed(SERVER_SIDE_ENCRYPTION_KEY); EncryptionTestUtils.assertEncrypted(fs, path, SSE_KMS, kmsKey); }
Source:
<code>protected void setUp() throws Exception { super.setUp(); <START> RefUpdate refUpdate = db.updateRef("refs/remotes/origin/remote-a"); <END> refUpdate.setNewObjectId(db.resolve("refs/heads/a")); refUpdate.update(); refUpdate = db.updateRef("refs/remotes/origin/remote-b"); refUpdate.setNewObjectId(db.resolve("refs/heads/b")); refUpdate.update(); formatter = new MergeMessageFormatter(); }</code><technical_language>Style-nit: Insert a blank line right here</technical_language>

Target:
protected void setUp() throws Exception { super.setUp(); RefUpdate createRemoteRefA = db .updateRef("refs/remotes/origin/remote-a"); createRemoteRefA.setNewObjectId(db.resolve("refs/heads/a")); createRemoteRefA.update(); RefUpdate createRemoteRefB = db .updateRef("refs/remotes/origin/remote-b"); createRemoteRefB.setNewObjectId(db.resolve("refs/heads/b")); createRemoteRefB.update(); formatter = new MergeMessageFormatter(); }
Source:
<code>public void checkValidErrorMessage() { <START> runErrorMesaageCheck(false, true, false, false, ErrorMessage.invalidMask); <END> runErrorMesaageCheck(true, false, false, false, ErrorMessage.badPrefixOrNetmaskFormatMessage); runErrorMesaageCheck(false, false, false, false, ErrorMessage.badNetmaskFormatMessage); runErrorMesaageCheck(false, true, true, false, ErrorMessage.NoError); runErrorMesaageCheck(true, false, true, true, ErrorMessage.NoError); }</code><technical_language>argument random</technical_language>

Target:
public void checkValidErrorMessage() { Random random = new Random(); runErrorMessageCheck(random.nextBoolean(), true, false, false, ErrorMessage.invalidMask); runErrorMessageCheck(true, false, random.nextBoolean(), false, ErrorMessage.badPrefixOrNetmaskFormatMessage); runErrorMessageCheck(false, false, random.nextBoolean(), random.nextBoolean(), ErrorMessage.badNetmaskFormatMessage); runErrorMessageCheck(false, true, true, random.nextBoolean(), ErrorMessage.NoError); runErrorMessageCheck(true, false, random.nextBoolean(), true, ErrorMessage.NoError); }
Source:
<code>public AbstractHttpResponse(CloseableHttpResponse httpResponse, Class<T> resultClass, boolean flatMapData) { this.resultClass = resultClass; try ( CloseableHttpResponse httpResponseToClose = httpResponse; InputStream inputStreamOfResponse = httpResponseToClose.getEntity().getContent(); TokenBuffer bufferedResponse = createTokenBuffer(inputStreamOfResponse); ) { JsonParser pointingOnErrors = findNextObject(bufferedResponse.asParserOnFirstToken(), "errors"); throwExceptionOnErrorEntry(pointingOnErrors); JsonParser unbufferedResults = findNextObject(bufferedResponse.asParserOnFirstToken(), "results"); if (unbufferedResults == null || !JsonToken.START_ARRAY.equals(unbufferedResults.currentToken())) { <START> throw new IOException("Current result object is not an array!"); <END> } TokenBuffer resultBuffer = createTokenBuffer(unbufferedResults); this.columns = readColumns(resultBuffer); this.queryStatistics = readQueryStatistics(resultBuffer); this.results = new ResultNodeIterator(this.mapper, resultBuffer.asParserOnFirstToken(), flatMapData); } catch (IOException e) { throw new UncheckedIOException(e); } }</code><technical_language>In fact this is a true statement for null non-arrays here, distinct error messages for case. added "complexity" easier for address another fact: exception throwing a lines in error case in a separate method. This nice level of abstraction</technical_language>

Target:
AbstractHttpResponse(CloseableHttpResponse httpResponse, Class<T> resultClass, boolean flatMapData) { this.resultClass = resultClass; try ( CloseableHttpResponse httpResponseToClose = httpResponse; InputStream inputStreamOfResponse = httpResponseToClose.getEntity().getContent(); TokenBuffer bufferedResponse = createTokenBuffer(inputStreamOfResponse); ) { JsonParser pointingOnErrors = findNextObject(bufferedResponse.asParserOnFirstToken(), "errors"); throwExceptionOnErrorEntry(pointingOnErrors); JsonParser unbufferedResults = findNextObject(bufferedResponse.asParserOnFirstToken(), "results"); throwExceptionOnIncorrectResultEntry(unbufferedResults); TokenBuffer resultBuffer = createTokenBuffer(unbufferedResults); this.columns = readColumns(resultBuffer); this.queryStatistics = readQueryStatistics(resultBuffer); this.results = new ResultNodeIterator(this.mapper, resultBuffer.asParserOnFirstToken(), flatMapData); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public void canGetTrimMarkAndLogSize() throws Exception { byte[] testString = "hello world".getBytes(); client.write(0, null, testString, Collections.emptyMap()).get(); LogData r = client.read(0).get().getAddresses().get(0L); assertThat (client.getTrimMark().get()); <START> assertThat (client.getLogFileSize ().get()); <END> }</code><technical_language>stonger assertions here, assertThat (client.getLogFileSize ().get()) is greater "hello world".getBytes() etc.</technical_language>

Target:
public void canGetTrimMarkAndLogSize() throws Exception { byte[] testString = "hello world".getBytes(); client.write(0, null, testString, Collections.emptyMap()).get(); LogData r = client.read(0).get().getAddresses().get(0L); assertThat (client.getTrimMark().get()==0); long startAddress = 0; long endAddress = client.getTrimMark().get(); assertThat(client.getLogStats(startAddress, endAddress).get().getUsedQuota() > testString.length); startAddress = endAddress; endAddress = client.getLogTail().get().getLogTail(); long size0 = client.getLogStats(startAddress, endAddress).get().getLogSize(); assertThat ( size0 > testString.length); long size1 = client.getLogStats(startAddress, endAddress + number).get().getLogSize(); assertThat(size0 == size1); }
Source:
<code><START> public void logCurrentState() { <END> logAllHeldAndOutstandingLocks(); StringBuilder logString = getGeneralLockStats(); for (Pair<String, ? extends Collection<?>> nameValuePair : ImmutableList.of( Pair.create("descriptorToLockMap", descriptorToLockMap.asMap().entrySet()), Pair.create("outstandingLockRequestMultimap", outstandingLockRequestMultimap.asMap().entrySet()), Pair.create("heldLocksTokenMap", heldLocksTokenMap.entrySet()), Pair.create("heldLocksGrantMap", heldLocksGrantMap.entrySet()), Pair.create("lockTokenReaperQueue", queueToOrderedList(lockTokenReaperQueue)), Pair.create("lockGrantReaperQueue", queueToOrderedList(lockGrantReaperQueue)), Pair.create("lockClientMultimap", lockClientMultimap.asMap().entrySet()), Pair.create("versionIdMap", versionIdMap.asMap().entrySet()))) { Collection<?> elements = nameValuePair.getRhSide(); logString.append(nameValuePair.getLhSide()).append(".size() = ").append(elements.size()).append("\n"); if (elements.size() > MAX_LOCKS_TO_LOG) { logString.append("WARNING: Only logging the first ").append(MAX_LOCKS_TO_LOG).append(" locks, "); logString.append("logging more is likely to OOM or slow down lock server to the point of failure"); } for (Object element : Iterables.limit(elements, MAX_LOCKS_TO_LOG)) { logString.append(element).append("\n"); } } logString.append("Finished logging current state. Time = ").append(currentTimeMillis()); log.error("Current State: {}", logString.toString()); log.error(logString.toString()); logCurrentHeldLocks(); logOutstandingLockRequests(); }</code><technical_language>I understand if want maintain backcompat this method in terms of logging is expected. said, this method on. chance refactor delegating other scoped methods. nice remove of LockServiceImpl. easiest move submit a refactor of current logging impl a smaller change add new logging capabilities</technical_language>

Target:
public void logCurrentState() { StringBuilder logString = getGeneralLockStats(); log.info("Current State: {}", logString.toString()); try { logAllHeldAndOutstandingLocks(); } catch (IOException e) { log.error("Can't dump state to Yaml: [{}]", e); throw new IllegalStateException(e); } }
Source:
<code>public void authenticateCorrectly() throws SecurityException, SecurityProviderNotFoundException { when(provider.authenticate(authentication)).thenReturn(authentication); manager.addProvider(provider); <START> Optional<Authentication> optional = Optional.ofNullable(manager.authenticate(authentication)); <END> verify(provider).authenticate(authentication); assertThat(optional.isPresent(), is(true)); assertThat(optional.get(), is(authentication)); }</code><technical_language>static import</technical_language>

Target:
public void authenticateCorrectly() throws SecurityException, SecurityProviderNotFoundException { when(provider.authenticate(authentication)).thenReturn(authentication); manager.addProvider(provider); Optional<Authentication> optional = ofNullable(manager.authenticate(authentication)); verify(provider).authenticate(authentication); assertThat(optional.get(), is(authentication)); }
Source:
<code>public static <START> AbstractCalledFunction create(long <END> start, long end, int depth, long value, @Nullable ICalledFunction parent) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } return new CalledFunction(start, end, value, depth, parent); }</code><technical_language>ICalledFunction CalledFunction</technical_language>

Target:
private static CalledFunction create(long start, long end, int depth, long value, @Nullable ICalledFunction parent) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } return new CalledFunction(start, end, value, depth, parent); }
Source:
<code>public void setServers(@NotNull List<ServerEntity> servers) { List<ServerEntity> list = new ArrayList<>(); for (ServerEntity serverEntity : servers) { <START> if (!Constants.TERMINAL_REFERENCE.equals(serverEntity.getRef())){ END> list.add(serverEntity); } } this.servers.setRowData(list); }</code><technical_language>a bit hard read constructions, do is simplify that</technical_language>

Target:
public void setServers(@NotNull List<ServerEntity> servers) { Iterable<ServerEntity> serversToDisplay = filter(servers, new Predicate<ServerEntity>() { @Override public boolean apply(ServerEntity serverEntity) { String reference = serverEntity.getRef(); return !TERMINAL_REFERENCE.equals(reference); } }); this.servers.setRowData(newArrayList(serversToDisplay)); }
Source:
<code>public static void setBiomeArrayMethod(boolean jeidPresent) { try { if (jeidPresent) { biomeArrayMethod = Chunk.class.getMethod("getIntBiomeArray"); } else <START> biomeArrayMethod = Chunk.class.getMethod("getBiomeArray"); <END> } catch (NoSuchMethodException e) { throw new RuntimeException(e); } }</code><technical_language>Please add for one-liner</technical_language>

Target:
public static void setBiomeArrayMethod(boolean jeidPresent) { try { if (jeidPresent) { biomeArrayMethod = Chunk.class.getMethod("getIntBiomeArray"); } else { biomeArrayMethod = Chunk.class.getMethod("getBiomeArray"); } } catch (NoSuchMethodException e) { throw new RuntimeException(e); } }
Source:
<code>public void setup(Context.OperatorContext context) { operatorId = context.getId(); if (isRecoveryPathRelativeToAppPath) { statePath = context.getValue(DAG.APPLICATION_PATH) + Path.SEPARATOR + recoveryPath; } else { statePath = recoveryPath; <START> } <END> try { fileContext = FileContextUtils.getFileContext(statePath); setupWals(context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID)); } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>Is statePath shared for logical operators? if 2 operators in a DAG window data manager</technical_language>

Target:
public void setup(Context.OperatorContext context) { operatorId = context.getId(); if (isStatePathRelativeToAppPath) { fullStatePath = context.getValue(DAG.APPLICATION_PATH) + Path.SEPARATOR + statePath; } else { fullStatePath = statePath; } try { fileContext = FileContextUtils.getFileContext(fullStatePath); setupWals(context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID)); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public void update() { <START> displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaque")).attachDepthBufferTo(displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE)); <END> }</code><technical_language>remove TODO: get renaming anyway</technical_language>

Target:
public void update() { sceneOpaqueFbo = displayResolutionDependentFBOs.get(READONLY_GBUFFER); refractiveReflectiveFbo = displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE); sceneOpaqueFbo.attachDepthBufferTo(refractiveReflectiveFbo); }
Source:
<code>private boolean isAuthFailure(Throwable error) { boolean authFailure = true; if (error instanceof AllNodesFailedException) { <START> Collection<Throwable> errors = ((AllNodesFailedException) error).getErrors().values(); <END> for (Throwable nodeError : errors) { if (!(nodeError instanceof AuthenticationException)) { authFailure = false; break; } } } return authFailure; }</code><technical_language>if getErrors() return empty connection treat AuthFailure. Is ok for us? Is possible</technical_language>

Target:
private boolean isAuthFailure(Throwable error) { boolean authFailure = true; if (error instanceof AllNodesFailedException) { Collection<Throwable> errors = ((AllNodesFailedException) error).getErrors().values(); if (errors.size() == 0) { return false; } for (Throwable nodeError : errors) { if (!(nodeError instanceof AuthenticationException)) { authFailure = false; break; } } } return authFailure; }
Source:
<code>public String getDataLabelTextWithIndex(int index) { <START> wait.forElementVisible(itemLabels.get(index)); <END> return itemLabels.get(index).getText(); }</code><technical_language>store variable</technical_language>

Target:
public String getDataLabelTextWithIndex(int index) { WebElement selectedLabel = itemLabels.get(index); wait.forElementVisible(selectedLabel); return selectedLabel.getText(); }
Source:
<code><START> protected PageCacheNumberArray( PagedFile pagedFile, int entrySize, long length, <END> long defaultValue, long base ) throws IOException { this.pagedFile = pagedFile; this.entrySize = entrySize; this.entriesPerPage = pagedFile.pageSize() / entrySize; this.length = length; this.defaultValue = defaultValue; this.base = base; try ( PageCursor cursorToSetLength = pagedFile.io( 0, PF_SHARED_WRITE_LOCK ) ) { setLength( cursorToSetLength, length ); } if ( defaultValue != 0 ) { setDefaultValue( defaultValue ); } }</code><technical_language>some of protected items package private</technical_language>

Target:
PageCacheNumberArray( PagedFile pagedFile, int entrySize, long length, long defaultValue, long base ) throws IOException { this.pagedFile = pagedFile; this.entrySize = entrySize; this.entriesPerPage = pagedFile.pageSize() / entrySize; this.length = length; this.defaultValue = defaultValue; this.base = base; try ( PageCursor cursorToSetLength = pagedFile.io( 0, PF_SHARED_WRITE_LOCK ) ) { setLength( cursorToSetLength, length ); } if ( defaultValue != 0 ) { setDefaultValue( defaultValue ); } }
Source:
<code>public void process(int journalVersion, long offset, ByteBuffer entry) throws IOException { if (!printJournalVersion) { <START> System.out.println("Journal Version : " + journalVersion); <END> printJournalVersion = true; } }</code><technical_language>Logger please</technical_language>

Target:
public void process(int journalVersion, long offset, ByteBuffer entry) throws IOException { LOG.warn("Journal Version : " + journalVersion); }
Source:
<code>public EList<Table> getMatchingTables(final EObject expectedTableContext) { final List<Table> filteredTables = new ArrayList<>(); ECrossReferenceAdapter crossRef = ECrossReferenceAdapter.getCrossReferenceAdapter(expectedTableContext); final Collection<Setting> crossReference = crossRef.getNonNavigableInverseReferences(expectedTableContext, true); for (final Setting set : crossReference) { final EObject eobject = set.getEObject(); switch (this.contextFilterRule) { case SEMANTIC_CONTEXT: if (false == isSemanticContext(eobject, expectedTableContext)) { continue; } break; case GRAPHICAL_CONTEXT: if (false == isGraphicalContext(eobject, expectedTableContext)) { continue; <START> } <END> case BOTH: if (false == (isSemanticContext(eobject, expectedTableContext) || isGraphicalContext(eobject, expectedTableContext))) { continue; } break; default: } final Table table; if (eobject instanceof Table) { table = (Table) eobject; } else { continue; } if (matchTableKind(table) && matchTableType(table)) { filteredTables.add(table); } } return ECollections.unmodifiableEList(filteredTables); }</code><technical_language>is break here, is intentional</technical_language>

Target:
public EList<Table> getMatchingTables(final EObject expectedTableContext) { final List<Table> filteredTables = new ArrayList<>(); ECrossReferenceAdapter crossRef = ECrossReferenceAdapter.getCrossReferenceAdapter(expectedTableContext); final Collection<Setting> crossReference = crossRef.getNonNavigableInverseReferences(expectedTableContext, true); for (final Setting set : crossReference) { final EObject eobject = set.getEObject(); switch (this.contextFilterRule) { case SEMANTIC_CONTEXT: if (false == isSemanticContext(eobject, expectedTableContext)) { continue; } break; case GRAPHICAL_CONTEXT: if (false == isGraphicalContext(eobject, expectedTableContext)) { continue; } break; case BOTH: if (false == (isSemanticContext(eobject, expectedTableContext) || isGraphicalContext(eobject, expectedTableContext))) { continue; } break; default: } final Table table; if (eobject instanceof Table) { table = (Table) eobject; } else { continue; } if (matchTableKind(table) && matchTableType(table)) { filteredTables.add(table); } } return ECollections.unmodifiableEList(filteredTables); }
Source:
<code>public Iterator<TileEntity> iterator() { <START> return new Iterator<TileEntity>() { <END> int index = 0; Iterator<List<TileEntity>> iterator = values().iterator(); List<TileEntity> currentList; @Override public boolean hasNext() { while(currentList == null || currentList.size() <= index) { if(iterator.hasNext()) { currentList = iterator.next(); index = 0; } else return false; } return true; } @Override public TileEntity next() { TileEntity value = currentList.get(index); index++; return value; } @Override public void remove() { currentList.remove(index-1); } }; }</code><technical_language>guava utilities here</technical_language>

Target:
public Iterator<TileEntity> iterator() { return new Iterator<TileEntity>() { int index = 0; int expModCount = ChunkedTileEntityList.this.modCount; Iterator<List<TileEntity>> iterator = content.values().iterator(); List<TileEntity> currentList; @Override public boolean hasNext() { while (currentList == null || currentList.size() <= index) { if (iterator.hasNext()) { currentList = iterator.next(); index = 0; } else return false; } return true; } @Override public TileEntity next() { this.checkCoModifications(); TileEntity value = currentList.get(index); index++; return value; } @Override public void remove() { this.checkCoModifications(); ChunkedTileEntityList.this.totalCount--; currentList.remove(index - 1); } protected void checkCoModifications() { if (this.expModCount != ChunkedTileEntityList.this.modCount) throw new ConcurrentModificationException(); } }; }
Source:
<code>private AzkabanFlow(final String name, final Props props, final Map<String, AzkabanNode> nodes, final List<String> dependsOn) { <START> super(name, Constants.NODE_TYPE_FLOW, props, dependsOn); <END> this.nodes = nodes; }</code><technical_language>i slightly add more argument in AzkabanFlow constructor called type, builder handle default parameter passing</technical_language>

Target:
private AzkabanFlow(final String name, final Props props, final Map<String, AzkabanNode> nodes, final List<String> dependsOn) { super(name, Constants.FLOW_NODE_TYPE, props, dependsOn); this.nodes = nodes; }
Source:
<code>public NetInterfaceStatus getNetInterfaceStatus() { <START> return netInterfaceStatus; <END> }</code><technical_language>Please run clean</technical_language>

Target:
public NetInterfaceStatus getNetInterfaceStatus() { return this.netInterfaceStatus; }
Source:
<code>public void run() { final RecipeResourceCopier copier = new RecipeResourceCopier( "assets/appliedenergistics2/recipes/" ); final File configDirectory = AppEng.instance().getConfigDirectory(); final File generatedRecipesDir = new File( configDirectory, "generated recipes" ); final File userRecipesDir = new File( configDirectory, "user recipes" ); try { FileUtils.forceMkdir( generatedRecipesDir ); FileUtils.forceMkdir( userRecipesDir ); FileUtils.cleanDirectory( generatedRecipesDir ); copier.copyTo( generatedRecipesDir ); this.handler.parseRecipes( new ConfigLoader( generatedRecipesDir, userRecipesDir ), "index.recipe" ); } catch( IOException e ) { e.printStackTrace(); this.handler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" ); } catch( URISyntaxException e ) { <START> e.printStackTrace(); <END> this.handler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" ); } }</code><technical_language>changed a more meaningful AELog. Else people start complaining "stacktraces crashing game" :grin:</technical_language>

Target:
public void run() { final RecipeResourceCopier copier = new RecipeResourceCopier( "assets/appliedenergistics2/recipes/" ); final File configDirectory = AppEng.instance().getConfigDirectory(); final File generatedRecipesDir = new File( configDirectory, "generated-recipes" ); final File userRecipesDir = new File( configDirectory, "user-recipes" ); final File readmeGenDest = new File( generatedRecipesDir, "README.html" ); final File readmeUserDest = new File( userRecipesDir, "README.html" ); try { FileUtils.forceMkdir( generatedRecipesDir ); FileUtils.forceMkdir( userRecipesDir ); FileUtils.cleanDirectory( generatedRecipesDir ); copier.copyTo( generatedRecipesDir ); FileUtils.copyFile( readmeGenDest, readmeUserDest ); this.handler.parseRecipes( new ConfigLoader( generatedRecipesDir, userRecipesDir ), "index.recipe" ); } catch( IOException e ) { AELog.error( e ); this.handler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" ); } catch( URISyntaxException e ) { AELog.error( e ); this.handler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" ); } }
Source:
<code>public void writeBfqFiles() { <START> final Iterator<SAMRecord> iterator = SamReaderFactory.makeDefault().open(bamFile).iterator(); <END> final TagFilter tagFilter = new TagFilter(ReservedTagConstants.XN, 1); final FailsVendorReadQualityFilter qualityFilter = new FailsVendorReadQualityFilter(); final WholeReadClippedFilter clippedFilter = new WholeReadClippedFilter(); if (!pairedReads) { List<SamRecordFilter> filters = new ArrayList<SamRecordFilter>(); filters.add(tagFilter); filters.add(clippedFilter); if (!this.includeNonPfReads) { filters.add(qualityFilter); } writeSingleEndBfqs(iterator, filters); codec1.close(); } else { writePairedEndBfqs(iterator, tagFilter, qualityFilter, clippedFilter); codec1.close(); codec2.close(); } log.info("Wrote " + wrote + " bfq records."); }</code><technical_language>is this iterator closed</technical_language>

Target:
public void writeBfqFiles() { final SamReader reader = SamReaderFactory.makeDefault().open(bamFile); final Iterator<SAMRecord> iterator = reader.iterator(); final TagFilter tagFilter = new TagFilter(ReservedTagConstants.XN, 1); final FailsVendorReadQualityFilter qualityFilter = new FailsVendorReadQualityFilter(); final WholeReadClippedFilter clippedFilter = new WholeReadClippedFilter(); if (!pairedReads) { List<SamRecordFilter> filters = new ArrayList<SamRecordFilter>(); filters.add(tagFilter); filters.add(clippedFilter); if (!this.includeNonPfReads) { filters.add(qualityFilter); } writeSingleEndBfqs(iterator, filters); codec1.close(); } else { writePairedEndBfqs(iterator, tagFilter, qualityFilter, clippedFilter); codec1.close(); codec2.close(); } log.info("Wrote " + wrote + " bfq records."); CloserUtil.close(reader); }
Source:
<code>static Resource findStyle(StyleInfo style) throws IOException { GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); Resource styleFile = loader.get("/styles/" + style.getFilename()); if (styleFile != null && styleFile.getType() == Resource.Type.RESOURCE && Resources.canRead(styleFile)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Style " + style.getName() + " found"); } return styleFile; } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Style " + style.getName() + " not found. Trying to search in the layer workspace"); } Resource workspaces = loader.get ("/workspaces"); <START> styleFile = workspaces.get(style.getWorkspace().getName() + "/styles/" + style.getFilename()); <END> if (styleFile != null && styleFile.getType() == Resource.Type.RESOURCE && Resources.canRead(styleFile)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "The style file cannot be found anywhere. We need to skip the SLD file"); } return null; } return styleFile; } }</code><technical_language>String concatenation build paths is antipattern is easy miss a separator. a builder Resource.get(String ...) code cleaner</technical_language>

Target:
static Resource findStyle(StyleInfo style) throws IOException { GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); Resource styleFile = loader.get(Paths.path("styles", style.getFilename())); if (styleFile != null && styleFile.getType() == Resource.Type.RESOURCE && Resources.canRead(styleFile)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Style " + style.getName() + " found"); } return styleFile; } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Style " + style.getName() + " not found. Trying to search in the layer workspace"); } styleFile = loader.get(Paths.path("workspaces", style.getWorkspace().getName(), "styles", style.getFilename())); if (styleFile != null && styleFile.getType() == Resource.Type.RESOURCE && Resources.canRead(styleFile)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "The style file cannot be found anywhere. We need to skip the SLD file"); } return null; } return styleFile; } }
Source:
<code>public synchronized void uploadExecutableFlow(final ExecutableFlow flow) throws ExecutorManagerException { final String useExecutorParam = flow.getExecutionOptions().getFlowParameters().get(ExecutionOptions.USE_EXECUTOR); <START> final String executorId = StringUtils.isNotEmpty(useExecutorParam) ? useExecutorParam : "-1"; <END> final String INSERT_EXECUTABLE_FLOW = "INSERT INTO execution_flows " + "(project_id, flow_id, version, status, submit_time, submit_user, update_time, " + "use_executor) values (?,?,?,?,?,?,?,?)"; final long submitTime = System.currentTimeMillis(); flow.setStatus(Status.PREPARING); flow.setSubmitTime(submitTime); final SQLTransaction<Long> insertAndGetLastID = transOperator -> { transOperator.update(INSERT_EXECUTABLE_FLOW, flow.getProjectId(), flow.getFlowId(), flow.getVersion(), Status.PREPARING.getNumVal(), submitTime, flow.getSubmitUser(), submitTime, executorId); transOperator.getConnection().commit(); return transOperator.getLastInsertId(); }; try { final long id = this.dbOperator.transaction(insertAndGetLastID); logger.info("Flow given " + flow.getFlowId() + " given id " + id); flow.setExecutionId((int) id); updateExecutableFlow(flow); } catch (final SQLException e) { throw new ExecutorManagerException("Error creating execution.", e); } }</code><technical_language>null consistent default in db</technical_language>

Target:
public synchronized void uploadExecutableFlow(final ExecutableFlow flow) throws ExecutorManagerException { final String useExecutorParam = flow.getExecutionOptions().getFlowParameters().get(ExecutionOptions.USE_EXECUTOR); final String executorId = StringUtils.isNotEmpty(useExecutorParam) ? useExecutorParam : null; final String INSERT_EXECUTABLE_FLOW = "INSERT INTO execution_flows " + "(project_id, flow_id, version, status, submit_time, submit_user, update_time, " + "use_executor) values (?,?,?,?,?,?,?,?)"; final long submitTime = System.currentTimeMillis(); flow.setStatus(Status.PREPARING); flow.setSubmitTime(submitTime); final SQLTransaction<Long> insertAndGetLastID = transOperator -> { transOperator.update(INSERT_EXECUTABLE_FLOW, flow.getProjectId(), flow.getFlowId(), flow.getVersion(), Status.PREPARING.getNumVal(), submitTime, flow.getSubmitUser(), submitTime, executorId); transOperator.getConnection().commit(); return transOperator.getLastInsertId(); }; try { final long id = this.dbOperator.transaction(insertAndGetLastID); logger.info("Flow given " + flow.getFlowId() + " given id " + id); flow.setExecutionId((int) id); updateExecutableFlow(flow); } catch (final SQLException e) { throw new ExecutorManagerException("Error creating execution.", e); } }
Source:
<code>private static List<VdsNetworkInterface> findBridgedNetworkInterfaces(Map<String, Object> bridge, Map<String, VdsNetworkInterface> vdsInterfaces) { List<VdsNetworkInterface> interfaces = new ArrayList<>(); Object[] ports = (Object[]) bridge.get("ports"); if (ports != null) { <START> Arrays.stream(ports).filter(port -> vdsInterfaces.containsKey(port.toString())) .forEach(port -> interfaces.add(vdsInterfaces.get(port.toString()))); <END> } return interfaces; }</code><technical_language>I Java 8 is below: List<VdsNetworkInterface> interfaces = Arrays .stream(ports) .filter(port -> vdsInterfaces.containsKey(port.toString())) .map(port -> vdsInterfaces.get(port.toString())).collect(Collectors.toList());</technical_language>

Target:
private static List<VdsNetworkInterface> findBridgedNetworkInterfaces(Map<String, Object> bridge, Map<String, VdsNetworkInterface> vdsInterfaces) { Object[] ports = (Object[]) bridge.get("ports"); List<VdsNetworkInterface> interfaces if (ports != null) { return Arrays.stream(ports).filter(port -> vdsInterfaces.containsKey(port.toString())) .map(port -> vdsInterfaces.get(port.toString())).collect(Collectors.toList()); } return new ArrayList<>(); }
Source:
<code>public Optional<String> getName() { try { <START> return Optional.of(URLEncoder.encode(pathPrefix + source.getName(), "UTF-8")); <END> } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }</code><technical_language>for example remotePath.resolve(source.getName()) if pathPrefix a java.nio.path.Path</technical_language>

Target:
public Optional<String> getName() { try { return Optional.of(URLEncoder.encode(relativePath + source.getName(), "UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
Source:
<code>public DataContainer toContainer() { <START> return new MemoryDataContainer().set(Keys.LOCK_TOKEN, this.lockToken.get()); <END> }</code><technical_language>this.value instead</technical_language>

Target:
public DataContainer toContainer() { return new MemoryDataContainer().set(Keys.LOCK_TOKEN, this.value); }
Source:
<code>public void decrementCommitsInProgress() { this.commitSessionLock.lock(); try { <START> Preconditions.checkState(this.commitsInProgress.get() > 0); <END> final int newCount = this.commitsInProgress.decrementAndGet(); if (newCount == 0) { this.noOutstandingCommits.signal(); } } finally { this.commitSessionLock.unlock(); } }</code><technical_language>This represents a loss in debugging information. custom message in IllegalStateException for debugging purposes</technical_language>

Target:
public void decrementCommitsInProgress() { this.commitSessionLock.lock(); try { Preconditions.checkState(this.commitsInProgress.get() > 0); final int newCount = this.commitsInProgress.decrementAndGet(); if (newCount == 0) { this.noOutstandingCommits.signalAll(); } } finally { this.commitSessionLock.unlock(); } }
Source:
<code>private static void createMenuItem(Menu parent, final TableColumn column) { final MenuItem itemName = new MenuItem(parent, SWT.CHECK); itemName.setText(column.getText()); itemName.setSelection(column.getResizable()); itemName.addSelectionListener(new SelectionAdapter() { <START> @Override <END> public void widgetSelected(SelectionEvent e) { if (itemName.getSelection()) { column.setWidth(150); column.setResizable(true); } else { column.setWidth(0); column.setResizable(false); } } }); }</code><technical_language>alignment Vogel's tutorial too? wrong ;) This re-used in other places in this class too</technical_language>

Target:
private static void createMenuItem(Menu parent, final TableColumn column) { final MenuItem itemName = new MenuItem(parent, SWT.CHECK); itemName.setText(column.getText()); itemName.setSelection(column.getResizable()); itemName.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (itemName.getSelection()) { column.setWidth((int) column.getData(WIDTH)); column.setResizable(true); } else { column.setWidth(0); column.setResizable(false); } } }); }
Source:
<code>public Interview create(String interviewId) throws HttpRequestException, QuestionsBlockNotFound, WrongCriteriaException, InterviewNotFoundException { Interview interview = new Interview(interviewId); List<QuestionsBlock> allQuestionsBlocks = new ArrayList<QuestionsBlock>(); allQuestionsBlocks.add(questionsBlockServices.getStandardQuestionsBlock()); Appointment appointment = httpRequestExecutor.getObjectByID(interviewId, Appointment.class); List<String> Users = appointment.getUserIdList(); for (int i = 0; i < Users.size(); i++){ User user = httpRequestExecutor.getObjectByID(Users.get(i), User.class); QuestionsBlock userQuestionsBlock = new QuestionsBlock(user); List<QuestionInformation> userQuestionInformationList = new ArrayList<QuestionInformation>(); List<Question> Questions = user.getQuestions(); <START> for (int i1 = 0; i1 < Questions.size(); i1++){ <END> QuestionInformation questionInformation = new QuestionInformation(); questionInformation.setQuestion(Questions.get(i1).getQuestionBody()); questionInformation.setWeight(Questions.get(i1).getWeight()); questionInformation.setQuestionInformationID(String.valueOf(i1)); questionInformation.setQuestionsBlockId(Users.get(i)); userQuestionInformationList.add(questionInformation); } userQuestionsBlock.setQuestions(userQuestionInformationList); userQuestionsBlock.setQuestionsBlockID(Users.get(i)); allQuestionsBlocks.add(userQuestionsBlock); } interview.setQuestionsBlocks(allQuestionsBlocks); interview.setType(InterviewType.InterviewWithUserAndStandardQuestions); return interview; }</code><technical_language>another name of variable j instead i1</technical_language>

Target:
public Interview create(String interviewId) throws HttpRequestException { Interview interview = new Interview(interviewId); List<QuestionsBlock> allQuestionsBlocks = new ArrayList<QuestionsBlock>(); allQuestionsBlocks.add(questionsBlockServices.getStandardQuestionsBlock()); Appointment appointment = httpRequestExecutor.getObjectByID(interviewId, Appointment.class); List<String> Users = appointment.getUserIdList(); for (int i = 0; i < Users.size(); i++){ User user = httpRequestExecutor.getObjectByID(Users.get(i), User.class); QuestionsBlock userQuestionsBlock = new QuestionsBlock(user); List<QuestionInformation> userQuestionInformationList = new ArrayList<QuestionInformation>(); List<Question> Questions = user.getQuestions(); for (int j = 0; j < Questions.size(); j++){ QuestionInformation questionInformation = new QuestionInformation(); questionInformation.setQuestion(Questions.get(j).getQuestionBody()); questionInformation.setWeight(Questions.get(j).getWeight()); questionInformation.setQuestionInformationID(String.valueOf(j)); questionInformation.setQuestionsBlockId(Users.get(i)); userQuestionInformationList.add(questionInformation); } userQuestionsBlock.setQuestions(userQuestionInformationList); userQuestionsBlock.setQuestionsBlockID(Users.get(i)); allQuestionsBlocks.add(userQuestionsBlock); } interview.setQuestionsBlocks(allQuestionsBlocks); interview.setType(InterviewType.InterviewWithUserAndStandardQuestions); return interview; }
Source:
<code>public WorkspaceFileRevision(final IResource resource) { <START> super(resource.getFullPath().toString()); <END> rsrc = resource; }</code><technical_language>This is wrong. getFullPath returns workspace path (e.g. /org.eclipse.egit.ui/plugin.xml). getLocation(), returns file system path</technical_language>

Target:
public WorkspaceFileRevision(final IResource resource) { super(resource.getLocation().toString()); rsrc = resource; }
Source:
<code>private static void renderTabIndex( Control control ) { if( control instanceof Shell ) { resetTabIndices( ( Shell )control ); computeTabIndices( ( Shell )control, 1 ); } int actual = getTabIndex( control ); int preserved = getRemoteAdapter( control ).getPreservedTabIndex(); <START> if( changed( control, actual, preserved, Integer.MIN_VALUE ) ) { <END> getRemoteObject( control ).set( PROP_TAB_INDEX, actual ); } }</code><technical_language>a occur in practice is a hack express "always render initial value". express this explicitly, e.g. omitting defaultValue parameter</technical_language>

Target:
private static void renderTabIndex( Control control ) { if( control instanceof Shell ) { resetTabIndices( ( Shell )control ); computeTabIndices( ( Shell )control, 1 ); } ControlRemoteAdapter remoteAdapter = getRemoteAdapter( control ); int actual = getTabIndex( control ); int preserved = remoteAdapter.getPreservedTabIndex(); if( !remoteAdapter.isInitialized() || actual != preserved ) { getRemoteObject( control ).set( PROP_TAB_INDEX, actual ); } }
Source:
<code>protected int computeHash() { int hashCode = 1; hashCode = hashCode * Utils.HASH_PRIME + baseTerms.hashCode(); <START> hashCode = hashCode * Utils.HASH_PRIME + cells.hashCode(); <END> return hashCode; }</code><technical_language>Is for objects test equal hashcodes</technical_language>

Target:
protected int computeHash() { int hashCode = 1; hashCode = hashCode * Utils.HASH_PRIME + cells.hashCode(); hashCode = hashCode * Utils.HASH_PRIME + collectionVariables.hashCode(); return hashCode; }
Source:
<code>public static String fromClass(Class<?> clazz) { Package classPackage = clazz.getPackage(); <START> String userAgent = classPackage.getImplementationTitle(); <END> String version = classPackage.getImplementationVersion(); checkArgument(userAgent != null, "Cannot load user agent from implementation title"); checkArgument(version != null, "Cannot load version from implementation version"); return getUserAgent(userAgent, version); }</code><technical_language>I personally this style, you? String userAgent = checkNotNull(classPackage.getImplementationTitle(), "Cannot determine user agent package of class " + clazz);</technical_language>

Target:
public static String fromClass(Class<?> clazz) { Package classPackage = clazz.getPackage(); String userAgent = classPackage.getImplementationTitle(); String version = classPackage.getImplementationVersion(); checkArgument(userAgent != null, "Cannot load user agent from implementation title for class: %s", clazz); checkArgument(version != null, "Cannot load version from implementation version for class: %s", clazz); return getUserAgent(userAgent, version); }
Source:
<code>public void testBug395126_missing() { ResourceLocator .imageDescriptorFromBundle("org.eclipse.jface", "platform:/plugin/org.eclipse.jface/$nl$/icons/does-not-exist.gif") <START> .orElseThrow(() -> new AssertionError()); <END> }</code><technical_language>this..</technical_language>

Target:
public void testBug395126_missing() { ImageDescriptor imageDescriptor = ResourceLocator.imageDescriptorFromBundle("org.eclipse.jface", "platform:/plugin/org.eclipse.jface/$nl$/icons/does-not-exist.gif").orElse(null); Image image = null; try { image = imageDescriptor.createImage(false); assertNull(image); } finally { if (image != null) { image.dispose(); } } }
Source:
<code>public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.adminAction(sender.getName(), "Opping all players on the server", false); boolean doSetGamemode = false; GameMode targetGamemode = GameMode.CREATIVE; if (args.length != 0) { if (args[0].equals("-c")) { doSetGamemode = true; targetGamemode = GameMode.CREATIVE; } <START> else if (TFM_AdminList.isSeniorAdmin(sender)) <END> { if (args[0].equals("-s")) { doSetGamemode = true; targetGamemode = GameMode.SURVIVAL; } } for (Player player : server.getOnlinePlayers()) { player.setOp(true); player.sendMessage(TFM_Command.YOU_ARE_OP); if (doSetGamemode) { player.setGameMode(targetGamemode); } } return true; } }</code><technical_language>removed this replace a permissions check. Surly leaving this performing permissions check this IF statement. if senior easily throw a perms error, able / done this... more work for this around</technical_language>

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.adminAction(sender.getName(), "Opping all players on the server", false); boolean doSetGamemode = false; GameMode targetGamemode = GameMode.CREATIVE; if (args.length != 0) { if (args[0].equals("-c")) { doSetGamemode = true; targetGamemode = GameMode.CREATIVE; } else if (args[0].equals("-s")) { if (TFM_AdminList.isSeniorAdmin(sender)) { doSetGamemode = true; targetGamemode = GameMode.SURVIVAL; } else { sender.sendMessage(TFM_Command.MSG_NO_PERMS); } } for (Player player : server.getOnlinePlayers()) { player.setOp(true); player.sendMessage(TFM_Command.YOU_ARE_OP); if (doSetGamemode) { player.setGameMode(targetGamemode); } } return true; } }
Source:
<code>private void readVersion() { final String command = fScriptCommand.get(0); final List<String> commandLine = ImmutableList.<@NonNull String> builder() .add(command).add(MI_VERSION_FLAG).build(); final String output = getOutputFromCommand(commandLine); if (output == null) { Activator.instance().logInfo(String.format(LOG_NO_MI_VERSION_FMT, command)); return; } final String versionString = output.trim(); if (!versionString.matches("\\d+\\.\\d+")) { Activator.instance().logInfo(String.format(LOG_NO_MI_VERSION_FMT, command)); return; } final String logMsg = String.format("Command \"%s\" reports MI version %s", command, versionString); Activator.instance().logInfo(logMsg); final String[] parts = versionString.split("\\."); final int major = Integer.valueOf(parts[0]); <START> final int minor = Integer.valueOf(parts[1]); <END> fMiVersion = major * 100 + minor; }</code><technical_language>do want catch a number format exception, asking</technical_language>

Target:
private void readVersion() { final String command = fScriptCommand.get(0); final List<String> commandLine = ImmutableList.<@NonNull String> builder() .add(command).add(MI_VERSION_FLAG).build(); final String output = getOutputFromCommand(commandLine); if (output == null) { Activator.instance().logInfo(String.format(LOG_NO_MI_VERSION_FMT, command)); return; } final String versionString = output.trim(); if (!versionString.matches("\\d{1,3}\\.\\d{1,3}")) { Activator.instance().logInfo(String.format(LOG_NO_MI_VERSION_FMT, command)); return; } final String logMsg = String.format("Command \"%s\" reports MI version %s", command, versionString); Activator.instance().logInfo(logMsg); final String[] parts = versionString.split("\\."); final int major = Integer.valueOf(parts[0]); final int minor = Integer.valueOf(parts[1]); fMiVersion = major * 100 + minor; }
Source:
<code>public void testContribOverride() throws Exception { <START> deployContrib("org.nuxeo.ecm.core.api.tests", "OSGI-INF/test-pathsegment-contrib.xml"); <END> applyInlineDeployments(); PathSegmentService service = Framework.getService(PathSegmentService.class); DocumentModel doc = DocumentModelProxy.newDocumentModel("My Document"); assertEquals("my-document", service.generatePathSegment(doc)); deployContrib("org.nuxeo.ecm.core.api.tests", "OSGI-INF/test-pathsegment-contrib2.xml"); applyInlineDeployments(); service = Framework.getService(PathSegmentService.class); assertEquals("My Document", service.generatePathSegment(doc)); }</code><technical_language>pushInlineDeployments</technical_language>

Target:
public void testContribOverride() throws Exception { pushInlineDeployments("org.nuxeo.ecm.core.api.tests:OSGI-INF/test-pathsegment-contrib.xml"); PathSegmentService service = Framework.getService(PathSegmentService.class); DocumentModel doc = DocumentModelProxy.newDocumentModel("My Document"); assertEquals("my-document", service.generatePathSegment(doc)); pushInlineDeployments("org.nuxeo.ecm.core.api.tests:OSGI-INF/test-pathsegment-contrib2.xml"); service = Framework.getService(PathSegmentService.class); assertEquals("My Document", service.generatePathSegment(doc)); }