auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String toString() { <START> ObjectMapper objectMapper = new ObjectMapper(); <END> objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")); Map<String, Object> map = new HashMap<>(); map.put("id", id); map.put("legalEntityType", legalEntityType); map.put("accountName", accountName); map.put("brand", brand); map.put("yourReference", yourReference); map.put("status", status); map.put("street", street); map.put("city", city); map.put("stateOrProvince", stateOrProvince); map.put("country", country); map.put("postalCode", postalCode); map.put("spreadTable", spreadTable); map.put("createdAt", createdAt); map.put("updatedAt", updatedAt); map.put("identificationType", identificationType); map.put("identificationValue", identificationValue); map.put("shortReference", shortReference); map.put("apiTrading", apiTrading); map.put("onlineTrading", onlineTrading); map.put("phoneTrading", phoneTrading); map.put("processThirdPartyFunds", processThirdPartyFunds); map.put("settlementType", settlementType); try { return objectMapper.writeValueAsString(map); } catch (JsonProcessingException e) { return String.format("{\"error\": \"%s\"}", e.getMessage()); } }</code><technical_language>is more succinct do final ObjectMapper objectMapper = new ObjectMapper().disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")); date format string defined a private static final data member a global static property is defined in classes</technical_language>

Target:
public String toString() { final ObjectMapper objectMapper = new ObjectMapper() .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .setDateFormat(new SimpleDateFormat(Utils.dateFormat)); Map<String, Object> map = new HashMap<>(); map.put("id", id); map.put("legalEntityType", legalEntityType); map.put("accountName", accountName); map.put("brand", brand); map.put("yourReference", yourReference); map.put("status", status); map.put("street", street); map.put("city", city); map.put("stateOrProvince", stateOrProvince); map.put("country", country); map.put("postalCode", postalCode); map.put("spreadTable", spreadTable); map.put("createdAt", createdAt); map.put("updatedAt", updatedAt); map.put("identificationType", identificationType); map.put("identificationValue", identificationValue); map.put("shortReference", shortReference); map.put("apiTrading", apiTrading); map.put("onlineTrading", onlineTrading); map.put("phoneTrading", phoneTrading); map.put("processThirdPartyFunds", processThirdPartyFunds); map.put("settlementType", settlementType); try { return objectMapper.writeValueAsString(map); } catch (JsonProcessingException e) { return String.format("{\"error\": \"%s\"}", e.getMessage()); } }
Source:
<code>public AbstractSagaManager<S> getSagaManager() { <START> Assert.state(config != null, () -> "Configuration is not initialized yet"); <END> return sagaManager.get(); }</code><technical_language>generic contained in sagaManager specifies AnnotatedSagaManager<S>, a AbstractSagaManager<S>. change this</technical_language>

Target:
public AnnotatedSagaManager<S> getSagaManager() { Assert.state(config != null, () -> "Configuration is not initialized yet"); return sagaManager.get(); }
Source:
<code>public void <START> setFixedYRange(@Nullable <END> Range fixedYRange) { this.fFixedYRange = fixedYRange; this.updateContent(); }</code><technical_language>calling this "fixRange(boolean fixed)" override getWindowRange()? a thought</technical_language>

Target:
public void setFixedYRange(@Nullable Range fixedYRange) { fFixedYRange = fixedYRange; updateContent(); }
Source:
<code>public static BoundAddColumn bind(AnalyzedAlterTableDropCheckConstraint dropCheckConstraint) { DocTableInfo tableInfo = dropCheckConstraint.tableInfo(); AnalyzedTableElements<Object> tableElementsBound = new AnalyzedTableElements<>(); AlterTableAddColumnPlan.addExistingPrimaryKeys(tableInfo, tableElementsBound); tableInfo.checkConstraints() .stream() <START> .filter(c -> false == c.name().equals(dropCheckConstraint.name())) <END> .forEach(c -> tableElementsBound.addCheckConstraint(tableInfo.ident(), c)); return new BoundAddColumn( tableInfo, tableElementsBound, Settings.builder().build(), AnalyzedTableElements.finalizeAndValidate( tableInfo.ident(), new AnalyzedTableElements<>(), tableElementsBound ), false, false ); }</code><technical_language>suggestion .filter(c -> !dropCheckConstraint.name().equals(c.name())) here, ignore NPE warnings</technical_language>

Target:
public static BoundAddColumn bind(AnalyzedAlterTableDropCheckConstraint dropCheckConstraint) { DocTableInfo tableInfo = dropCheckConstraint.tableInfo(); AnalyzedTableElements<Object> tableElementsBound = new AnalyzedTableElements<>(); AlterTableAddColumnPlan.addExistingPrimaryKeys(tableInfo, tableElementsBound); tableInfo.checkConstraints() .stream() .filter(c -> !dropCheckConstraint.name().equals(c.name())) .forEach(c -> tableElementsBound.addCheckConstraint(tableInfo.ident(), c)); return new BoundAddColumn( tableInfo, tableElementsBound, Settings.builder().build(), AnalyzedTableElements.finalizeAndValidate( tableInfo.ident(), new AnalyzedTableElements<>(), tableElementsBound ), false, false ); }
Source:
<code>public void checkApplyElementMutationRenderableShapes() { final ActivityShape shape = spy(makeShape()); final Node<View<?>, Edge> node = makeNode("uuid", shape); final MutationContext mutationContext = mock(MutationContext.class); <START> doNothing().when(shape).applyPosition(any(Node.class), <END> eq(mutationContext)); doNothing().when(shape).applyProperties(any(Node.class), eq(mutationContext)); doNothing().when(shape).applyTitle(anyString(), any(Node.class), eq(mutationContext)); handler.applyElementMutation(shape, node, true, true, mutationContext); verify(shape, times(1)).applyPosition(any(Node.class), eq(mutationContext)); verify(shape, times(1)).applyProperties(any(Node.class), eq(mutationContext)); verify(canvas, times(1)).draw(); }</code><technical_language>change checking a specific node instance more general node</technical_language>

Target:
public void checkApplyElementMutationRenderableShapes() { final ActivityShape shape = spy(makeShape()); final Node<View<BPMNDefinition>, Edge> node = makeNode("uuid", shape); final MutationContext mutationContext = mock(MutationContext.class); doNothing().when(shape).applyPosition(eq(node), eq(mutationContext)); doNothing().when(shape).applyProperties(eq(node), eq(mutationContext)); doNothing().when(shape).applyTitle(anyString(), any(Node.class), eq(mutationContext)); handler.applyElementMutation(shape, node, true, true, mutationContext); verify(shape, times(1)).applyPosition(eq(node), eq(mutationContext)); verify(shape, times(1)).applyProperties(eq(node), eq(mutationContext)); verify(canvas, times(1)).draw(); }
Source:
<code>public boolean cleanDB(final DB db) { if (db == null) { throw new IllegalArgumentException("db must not be null"); } if (db.allocationProperties == null) { throw new IllegalArgumentException("db.allocationProperties must not be null"); } <START> final String dballocatorHostPort = System.getProperty("dballocator.host.port"); <END> if (StringUtils.isEmpty(dballocatorHostPort)) { throw new IllegalArgumentException("dballocator.host.port must not be empty"); } if (StringUtils.isEmpty(db.allocationProperties.getProperty("uuid"))) { throw new IllegalArgumentException("uuid must not be empty"); } final URL clean; try { clean = new URL(String.format("%s/Allocator/AllocatorServlet?operation=erase&uuid=%s", dballocatorHostPort, db.allocationProperties.getProperty("uuid") )); } catch (MalformedURLException e) { e.printStackTrace(); LOGGER.severe("Failed to construct clean DB URL, see: " + e.getMessage()); return false; } LOGGER.info("Cleaning database..."); final int statusCode; try { statusCode = ((HttpURLConnection) clean.openConnection()).getResponseCode(); } catch (IOException e) { e.printStackTrace(); LOGGER.severe("Failed to clean DB, see: " + e.getMessage()); return false; } LOGGER.info(String.format("Clean DB returned HTTP status code: %d", statusCode)); return statusCode == 200; }</code><technical_language>benefical create some utility method get property name returns throws IAE if empty? I remove a lot of if start of methods around</technical_language>

Target:
public boolean cleanDB(final DB db) { if (db == null) { throw new IllegalArgumentException("db must not be null"); } if (db.allocationProperties == null) { throw new IllegalArgumentException("db.allocationProperties must not be null"); } final String dballocatorHostPort = getProp("dballocator.host.port"); if (StringUtils.isEmpty(db.allocationProperties.getProperty("uuid"))) { throw new IllegalArgumentException("uuid must not be empty"); } final URL clean; try { clean = new URL(String.format("%s/Allocator/AllocatorServlet?operation=erase&uuid=%s", dballocatorHostPort, db.allocationProperties.getProperty("uuid") )); } catch (MalformedURLException e) { LOGGER.log(Level.SEVERE, "Failed to construct clean DB URL.", e); return false; } LOGGER.info("Cleaning database..."); final int statusCode; try { statusCode = ((HttpURLConnection) clean.openConnection()).getResponseCode(); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to clean DB.", e); return false; } LOGGER.info(String.format("Clean DB returned HTTP status code: %d", statusCode)); return statusCode == 200; }
Source:
<code>public void checkFindReferencesFeature() { String referenceInGreeterClass = <START> format("/%s/Greeter.ts\n" + "From:24:17 To:24:22", PROJECT_NAME); <END> String referenceInTestPrintClass = format("/%s/testPrint.ts\n" + "From:14:0 To:14:5", PROJECT_NAME); menu.runCommand(ASSISTANT, FIND_REFERENCES); findReferencesConsoleTab.waitAllReferencesWithText( referenceInGreeterClass, referenceInTestPrintClass); findReferencesConsoleTab.doubleClickOnReference(referenceInGreeterClass); editor.waitCursorPosition(25, 23); }</code><technical_language>Concatenation string weird</technical_language>

Target:
public void checkFindReferencesFeature() { String referenceInGreeterClass = format("/%s/Greeter.ts\nFrom:24:17 To:24:22", PROJECT_NAME); String referenceInTestPrintClass = format("/%s/testPrint.ts\nFrom:14:0 To:14:5", PROJECT_NAME); menu.runCommand(ASSISTANT, FIND_REFERENCES); findReferencesConsoleTab.waitAllReferencesWithText( referenceInGreeterClass, referenceInTestPrintClass); findReferencesConsoleTab.doubleClickOnReference(referenceInGreeterClass); editor.waitCursorPosition(25, 23); }
Source:
<code>public void getParameterName_BothOldAndNewAnnotations() throws NoSuchMethodException { <START> String actualResult = getParameterNameWithMethodNameAndParamIndex(TEST_METHOD_9, FIRST_INDEX); <END> assertEquals(SECOND_NAME_METHOD_ANNOTATION, actualResult); }</code><technical_language>Abbreviation for variable name: Result -> res. abbreviation rules</technical_language>

Target:
public void getParameterName_BothOldAndNewAnnotations() throws NoSuchMethodException { String actualRes = getParameterNameWithMethodNameAndParamIndex(TEST_METHOD_9, FIRST_INDEX); assertEquals(SECOND_NAME_METHOD_ANNOTATION, actualRes); }
Source:
<code><START> private String mergeTemplateMapping(IndexTemplateMetaData templateMetaData, Map<String, Object> newMapping) { <END> Map<String, Object> mergedMapping = new HashMap<>(); for (ObjectObjectCursor<String, CompressedXContent> cursor : templateMetaData.mappings()) { Map<String, Object> mapping = parseMapping(cursor.value.toString()); Object o = mapping.get(Constants.DEFAULT_MAPPING_TYPE); assert o instanceof Map : "o must not be null and must be instance of Map"; XContentHelper.update(mergedMapping, (Map) o, false); } XContentHelper.update(mergedMapping, newMapping, false); try { return Strings.toString(XContentFactory.contentBuilder(XContentType.JSON).map(MapBuilder.<String, Object>newMapBuilder().put( Constants.DEFAULT_MAPPING_TYPE, mergedMapping).map())); } catch (IOException e) { throw new ElasticsearchException("failed to serialize mapping"); } }</code><technical_language>here, AlterTableOperation.mergeTemplateMapping instead</technical_language>

Target:
private static String mergeTemplateMapping(IndexTemplateMetaData templateMetaData, Map<String, Object> newMapping) { Map<String, Object> merged = AlterTableOperation.mergeTemplateMapping(templateMetaData, newMapping); try { return Strings.toString(XContentFactory.contentBuilder(XContentType.JSON).map(MapBuilder.<String, Object>newMapBuilder().put( Constants.DEFAULT_MAPPING_TYPE, merged).map())); } catch (IOException e) { throw new ElasticsearchException("failed to serialize mapping"); } }
Source:
<code>private void advance() { int totalCycleCount = 0; BclData data = new BclData(outputLengths); for (int read = 0; read < outputLengths.length; read++) { for (int cycle = 0; cycle < outputLengths[read]; ++cycle) { try { CycleData currentCycleData = cycleData[totalCycleCount]; TileData currentTileData = currentCycleData.tileInfo[currentTile[totalCycleCount]]; try { if (cachedTile[totalCycleCount] == null) { if (!cachedFilter.containsKey(currentTileData.tileNum)) { cacheFilter(currentTileData); } cacheTile(totalCycleCount, currentTileData, currentCycleData); } } catch (IOException e) { throw new IOException(String.format("Error while reading from BCL file for cycle %d. Offending file on disk is %s", (totalCycleCount + 1), this.streamFiles[totalCycleCount].getAbsolutePath()), e); } if (!cachedTile[totalCycleCount].hasRemaining()) { currentTile[totalCycleCount]++; if (currentTile[totalCycleCount] >= currentCycleData.tileInfo.length - 1) { return; } currentTileData = currentCycleData.tileInfo[currentTile[totalCycleCount]]; if (!cachedFilter.containsKey(currentTileData.tileNum)) { cacheFilter(currentTileData); } cacheTile(totalCycleCount, currentTileData, currentCycleData); } int singleByte = cachedTile[totalCycleCount].get(); decodeQualityBinnedBasecall(data, read, cycle, singleByte, currentCycleData); <START> totalCycleCount++; <END> } catch (final IOException ioe) { throw new RuntimeIOException(ioe); } } } this.queue.add(data); }</code><technical_language>exploding nibbles</technical_language>

Target:
private void advance() { int totalCycleCount = 0; BclData data = new BclData(outputLengths); for (int read = 0; read < outputLengths.length; read++) { for (int cycle = 0; cycle < outputLengths[read]; cycle++) { try { CycleData currentCycleData = cycleData[totalCycleCount]; TileData currentTileData = currentCycleData.tileInfo[currentTile[totalCycleCount]]; try { if (cachedTile[totalCycleCount] == null) { if (!cachedFilter.containsKey(currentTileData.tileNum)) { cacheFilter(currentTileData); } cacheTile(totalCycleCount, currentTileData, currentCycleData); } } catch (IOException e) { throw new IOException(String.format("Error while reading from BCL file for cycle %d. Offending file on disk is %s", (totalCycleCount + 1), this.streamFiles[totalCycleCount].getAbsolutePath()), e); } if (!cachedTile[totalCycleCount].hasRemaining()) { currentTile[totalCycleCount]++; if (currentTile[totalCycleCount] > currentCycleData.tileInfo.length - 1) { return; } currentTileData = currentCycleData.tileInfo[currentTile[totalCycleCount]]; if (!cachedFilter.containsKey(currentTileData.tileNum)) { cacheFilter(currentTileData); } cacheTile(totalCycleCount, currentTileData, currentCycleData); } int singleByte = cachedTile[totalCycleCount].get(); decodeQualityBinnedBasecall(data, read, cycle, singleByte, currentCycleData); totalCycleCount++; } catch (final IOException ioe) { throw new RuntimeIOException(ioe); } } } this.queue.add(data); }
Source:
<code>public DefaultSchedulerMessageSource(MuleContext muleContext, PeriodicScheduler scheduler, boolean disallowConcurrentExecution) { this.muleContext = muleContext; this.scheduler = scheduler; this.disallowConcurrentExecution = disallowConcurrentExecution; notificationFunctions = new LinkedList<>(); notificationFunctions <START> .add((event, component) -> createConnectorMessageNotification(this, event, component.getLocation(), MESSAGE_RECEIVED)); <END> }</code><technical_language>this exact notification FlowProcessMediator is sending</technical_language>

Target:
public DefaultSchedulerMessageSource(MuleContext muleContext, PeriodicScheduler scheduler, boolean disallowConcurrentExecution) { this.muleContext = muleContext; this.scheduler = scheduler; this.disallowConcurrentExecution = disallowConcurrentExecution; }
Source:
<code>public void testValidUrl() throws Exception { _rule.setCode("404"); <START> _request.setHttpURI(HttpURI.build(_request.getHttpURI(), "/valid/uri.html").asImmutable()); <END> _rule.matchAndApply(_request.getRequestURI(), _request, _response); assertEquals(200, _response.getStatus()); }</code><technical_language>Remove asImmutable() this test class</technical_language>

Target:
public void testValidUrl() throws Exception { _rule.setCode("404"); _request.setHttpURI(HttpURI.build(_request.getHttpURI(), "/valid/uri.html")); _rule.matchAndApply(_request.getRequestURI(), _request, _response); assertEquals(200, _response.getStatus()); }
Source:
<code>public HashSet<T> remove(T element) { <START> return contains(element) ? new HashSet<>(tree.remove(element)) : this; <END> }</code><technical_language>tree? return instance removing element is contained? if so, compare tree == removed, removed = tree.remove(element)</technical_language>

Target:
public HashSet<T> remove(T element) { final HashArrayMappedTrie<T, Object> newTree = tree.remove(element); return newTree == tree ? this : new HashSet<>(newTree); }
Source:
<code>void cloneNodeContentWithProperties(final GraphCommandExecutionContext context) { final View cloneContent = getClone().getContent(); final View candidateContent = (View) getCandidate().getContent(); final Bounds contentBounds = candidateContent.getBounds(); final CloneManager cloneManager = context.getDefinitionManager().cloneManager(); final Object clonedDefinition = cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL); <START> cloneContent.setBounds(contentBounds); <END> cloneContent.setDefinition(clonedDefinition); }</code><technical_language>I is clone contentBounds, I creating a new instance properties. in is, reference contentBounds is used, if is modified point reflected both, cloned original node. idea of CloneManager is handle this kind of thing, suggestion insert logic clone manager clone bounds well, WDYT</technical_language>

Target:
void cloneNodeContentWithProperties(final GraphCommandExecutionContext context) { final View cloneContent = getClone().getContent(); final View candidateContent = (View) getCandidate().getContent(); final Bounds candidateBounds = candidateContent.getBounds(); final Bounds clonedBounds = cloneBounds(candidateBounds); final CloneManager cloneManager = context.getDefinitionManager().cloneManager(); final Object clonedDefinition = cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL); cloneContent.setBounds(clonedBounds); cloneContent.setDefinition(clonedDefinition); }
Source:
<code>public ISegmentTrackerImpl(Context context, Config config) { try { this.config = config; String writeKey = config.getSegmentConfig().getSegmentWriteKey(); boolean debugging = context.getResources().getBoolean(R.bool.analytics_debug); int queueSize = context.getResources().getInteger(R.integer.analytics_queue_size); int flushInterval = context.getResources().getInteger(R.integer.analytics_flush_interval); if (writeKey != null) { logger.debug("SegmentTracker created with write key: " + writeKey); Analytics.LogLevel logLevel = Analytics.LogLevel.NONE; <START> if (debugging) logLevel = Analytics.LogLevel.VERBOSE; <END> analytics = new Analytics.Builder(context, writeKey) .flushQueueSize(queueSize) .flushInterval(flushInterval, TimeUnit.SECONDS) .logLevel(logLevel) .build(); } else { logger.warn("writeKey is null, Segment analytics will not work."); } } catch(RuntimeException ex) { logger.error(ex); } catch(Exception ex) { logger.error(ex); } }</code><technical_language>I get rid of this variable, initialize builder: java .logLevel(debugging ? Analytics.LogLevel.VERBOSE : Analytics.LogLevel.NONE)</technical_language>

Target:
public ISegmentTrackerImpl(Context context, Config config) { try { this.config = config; String writeKey = config.getSegmentConfig().getSegmentWriteKey(); boolean debugging = context.getResources().getBoolean(R.bool.analytics_debug); int queueSize = context.getResources().getInteger(R.integer.analytics_queue_size); int flushInterval = context.getResources().getInteger(R.integer.analytics_flush_interval); if (writeKey != null) { logger.debug("SegmentTracker created with write key: " + writeKey); analytics = new Analytics.Builder(context, writeKey) .flushQueueSize(queueSize) .flushInterval(flushInterval, TimeUnit.SECONDS) .logLevel(debugging ? Analytics.LogLevel.VERBOSE : Analytics.LogLevel.NONE) .build(); } else { logger.warn("writeKey is null, Segment analytics will not work."); } } catch(RuntimeException ex) { logger.error(ex); } catch(Exception ex) { logger.error(ex); } }
Source:
<code>public void testSnapshotRemoteOnBothNodes() throws Exception { IgniteEx ig0 = startGrids(2); ig0.cluster().active(true); for (int i = 0; i < CACHE_KEYS_RANGE; i++) ig0.cache(DEFAULT_CACHE_NAME).put(i, i); <START> CheckpointProgress cpFut = ig0.context() <END> .cache() .context() .database() .forceCheckpoint("the next one"); cpFut.futureFor(CheckpointState.FINISHED).get(); IgniteSnapshotManager mgr0 = ig0.context() .cache() .context() .snapshotMgr(); IgniteSnapshotManager mgr1 = grid(1).context() .cache() .context() .snapshotMgr(); UUID node0 = grid(0).localNode().id(); UUID node1 = grid(1).localNode().id(); IgniteInternalFuture<?> futFrom1To0 = mgr0.createRemoteSnapshot(node1, owningParts(ig0, new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), node1), (part, grp) -> {}); IgniteInternalFuture<?> futFrom0To1 = mgr1.createRemoteSnapshot(node0, owningParts(grid(1), new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), node0), (part, grp) -> {}); futFrom0To1.get(); futFrom1To0.get(); }</code><technical_language>forceCheckpoint(ig0)</technical_language>

Target:
public void testSnapshotRemoteOnBothNodes() throws Exception { IgniteEx ig0 = startGrids(2); ig0.cluster().state(ClusterState.ACTIVE); for (int i = 0; i < CACHE_KEYS_RANGE; i++) ig0.cache(DEFAULT_CACHE_NAME).put(i, i); forceCheckpoint(ig0); IgniteSnapshotManager mgr0 = snp(ig0); IgniteSnapshotManager mgr1 = snp(grid(1)); UUID node0 = grid(0).localNode().id(); UUID node1 = grid(1).localNode().id(); Map<Integer, Set<Integer>> fromNode1 = owningParts(ig0, new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), node1); Map<Integer, Set<Integer>> fromNode0 = owningParts(grid(1), new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), node0); IgniteInternalFuture<?> futFrom1To0 = mgr0.createRemoteSnapshot(node1, fromNode1, (part, pair) -> assertTrue("Received partition has not been requested", fromNode1.get(pair.getGroupId()) .remove(pair.getPartitionId()))); IgniteInternalFuture<?> futFrom0To1 = mgr1.createRemoteSnapshot(node0, fromNode0, (part, pair) -> assertTrue("Received partition has not been requested", fromNode0.get(pair.getGroupId()) .remove(pair.getPartitionId()))); futFrom0To1.get(); futFrom1To0.get(); assertTrue("Not all of partitions have been received: " + fromNode1, fromNode1.get(CU.cacheId(DEFAULT_CACHE_NAME)).isEmpty()); assertTrue("Not all of partitions have been received: " + fromNode0, fromNode0.get(CU.cacheId(DEFAULT_CACHE_NAME)).isEmpty()); }
Source:
<code>protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setVdsGroupId(parameterMasterVm.getVdsGroupId()); if (VmDeviceUtils.shouldOverrideSoundDevice(getParameters().isSoundDeviceEnabled(), getParameters().getMasterVm(), getVm().getCompatibilityVersion())) { <START> parameters.setSoundDeviceEnabled(parameterMasterVm.getVmType() == VmType.Desktop); <END> } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getVdsGroup(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getVdsGroup() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setVdsGroupCompatibilityVersion(getVdsGroup().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getVdsGroup().getStoragePoolId()); } updateDiskInfoDestinationMap(); parameters.setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }</code><technical_language>set 'true' then, right</technical_language>

Target:
protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setVdsGroupId(parameterMasterVm.getVdsGroupId()); if (VmDeviceUtils.shouldOverrideSoundDevice(getParameters().isSoundDeviceEnabled(), getParameters().getMasterVm(), getVm().getCompatibilityVersion())) { parameters.setSoundDeviceEnabled(true); } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getVdsGroup(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getVdsGroup() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setVdsGroupCompatibilityVersion(getVdsGroup().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getVdsGroup().getStoragePoolId()); } updateDiskInfoDestinationMap(); parameters.setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }
Source:
<code>public void updateAdminAccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .build(); context.restoreAuthSystemState(); BitstreamFormatRest bitstreamFormatRest = converter.fromModel(bitstreamFormat); String token = getAuthToken(admin.getEmail(), password); bitstreamFormatRest.setShortDescription("Test short UPDATED"); getClient(token).perform(put("/api/core/bitstreamformats/" + bitstreamFormat.getID()) .content(mapper.writeValueAsBytes(bitstreamFormatRest)).contentType(contentType)) .andExpect(status().isOk()); getClient().perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) <START> .andExpect(jsonPath("$.description", is(bitstreamFormatRest.getDescription()))) <END> .andExpect(jsonPath("$.shortDescription", is(bitstreamFormatRest.getShortDescription()))) .andExpect(jsonPath("$.mimetype", is(bitstreamFormatRest.getMimetype()))) .andExpect(jsonPath("$.type", is("bitstreamformat"))) .andExpect(jsonPath("$._links.self.href", startsWith(REST_SERVER_URL))) .andExpect(jsonPath("$._links.self.href", endsWith("/api/core/bitstreamformats/" + bitstreamFormat.getID()))); }</code><technical_language>this is a suggestion, introducing a Matcher remove lot of redundant code tests</technical_language>

Target:
public void updateAdminAccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .build(); context.restoreAuthSystemState(); BitstreamFormatRest bitstreamFormatRest = converter.fromModel(bitstreamFormat); String token = getAuthToken(admin.getEmail(), password); bitstreamFormatRest.setShortDescription("Test short UPDATED"); getClient(token).perform(put("/api/core/bitstreamformats/" + bitstreamFormat.getID()) .content(mapper.writeValueAsBytes(bitstreamFormatRest)).contentType(contentType)) .andExpect(status().isOk()); getClient().perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", Matchers.is( BitstreamFormatMatcher .matchBitstreamFormat(bitstreamFormat.getID(), bitstreamFormatRest.getMimetype(), bitstreamFormatRest.getDescription(), bitstreamFormatRest.getShortDescription()) ))); }
Source:
<code>public static void main(String[] args) throws IOException, TimeoutException, TException, InterruptedException { FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); Properties properties = new Properties(); <START> properties.put(Options.PROP_URL, Options.DEFAULT_URL); <END> Options.Builder optionsBuilder = new Options.Builder(properties); Connection conn = Nats.connect(optionsBuilder.build()); FTransport transport = FNatsTransport.of(conn, NatsServer.SERVICE_SUBJECT); transport.open(); FStore.Client storeClient = new FStore.Client(new FServiceProvider(transport, protocolFactory)); Album album = storeClient.buyAlbum(new FContext("corr-id-1"), "ASIN-1290AIUBOA89", "ACCOUNT-12345"); System.out.println("Bought the album: " + album); storeClient.enterAlbumGiveaway(new FContext("corr-id-2"), "kevin@workiva.com", "Kevin"); transport.close(); conn.close(); }</code><technical_language>a couple of other places properties, change those? Other good</technical_language>

Target:
public static void main(String[] args) throws IOException, TException, InterruptedException { FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); Options.Builder optionsBuilder = new Options.Builder().server(Options.DEFAULT_URL); Connection conn = Nats.connect(optionsBuilder.build()); FTransport transport = FNatsTransport.of(conn, NatsServer.SERVICE_SUBJECT); transport.open(); FStore.Client storeClient = new FStore.Client(new FServiceProvider(transport, protocolFactory)); Album album = storeClient.buyAlbum(new FContext("corr-id-1"), "ASIN-1290AIUBOA89", "ACCOUNT-12345"); System.out.println("Bought the album: " + album); storeClient.enterAlbumGiveaway(new FContext("corr-id-2"), "kevin@workiva.com", "Kevin"); transport.close(); conn.close(); }
Source:
<code>public void test_diff_same_user_nodiff() { final UserPersistence userPersistence = new UserPersistence(); final UserHBM userHBM = new UserHBM(); final User user = new User(); userHBM.setPassword("xxx"); user.setPassword("xxx"); userHBM.setCompanyId("yyy"); user.setCompanyId("yyy"); <START> userHBM.setEmailAddress("eee"); <END> user.setEmailAddress("eee"); userHBM.setLayoutIds("iii"); user.setLayoutIds("iii"); userHBM.setUserId("111"); user.setUserId("111"); Assert.assertFalse(userPersistence.diff(userHBM, user)); }</code><technical_language>![Codacy](<LINK_0> Issue found: [The String literal "eee" appears 15 times in this file; occurrence is line 33](<LINK_1></technical_language>

Target:
public void test_diff_same_user_nodiff() { final UserPersistence userPersistence = new UserPersistence(); final UserHBM userHBM = new UserHBM(); final User user = new User(); userHBM.setPassword(TOKEN_XXX); user.setPassword(TOKEN_XXX); userHBM.setCompanyId(TOKEN_YYY); user.setCompanyId(TOKEN_YYY); userHBM.setEmailAddress(TOKEN_EEE); user.setEmailAddress(TOKEN_EEE); userHBM.setLayoutIds(TOKEN_III); user.setLayoutIds(TOKEN_III); userHBM.setUserId(TOKEN_USER_ID); user.setUserId(TOKEN_USER_ID); Assert.assertFalse(userPersistence.diff(userHBM, user)); }
Source:
<code>private Map<String, Object> generateJsonDiskDescription(Map<String, Object> descriptionFields, String... descriptionFieldsPriority) { String diskAlias = descriptionFields.get(DISK_ALIAS).toString(); Map<String, Object> descriptionMap = new TreeMap<>(); <START> int descriptionAvailableLength = METADATA_DESCRIPTION_MAX_LENGTH; <END> for (int priority = 0; priority < descriptionFieldsPriority.length; ++priority) { String fieldName = descriptionFieldsPriority[priority]; String fieldValue = descriptionFields.get(fieldName).toString(); descriptionAvailableLength = addFieldToDescriptionMap(descriptionMap, diskAlias, fieldName, fieldValue, descriptionAvailableLength); if (descriptionAvailableLength <= 0) { String storedFieldValue = (String) descriptionMap.get(fieldName); String[] descriptionFieldsLeft = Arrays.copyOfRange(descriptionFieldsPriority, priority, descriptionFieldsPriority.length); String diskFieldsNames = StringUtils.join(descriptionFieldsLeft, ", ", 0, descriptionFieldsLeft.length); if (storedFieldValue == null) { auditLogFailedToStoreDiskFields(diskAlias, diskFieldsNames); } else if (storedFieldValue.length() < fieldValue.length()) { auditLogFailedToStoreEntireDiskField(diskAlias, fieldName, storedFieldValue, diskFieldsNames); } break; } } return descriptionMap; }</code><technical_language>instead declaring parameter here, try pass METADATA_DESCRIPTION_MAX_LENGTH argument in line 59. declare descriptionAvailableLength return addFieldToDescriptionMap</technical_language>

Target:
private Map<String, Object> generateJsonDiskDescription(Map<String, Object> descriptionFields, String... descriptionFieldsPriority) { Map<String, Object> descriptionMap = new TreeMap<>(); int descriptionAvailableLength = METADATA_DESCRIPTION_MAX_LENGTH; for (int priority = 0; priority < descriptionFieldsPriority.length; ++priority) { String fieldName = descriptionFieldsPriority[priority]; String fieldValue = descriptionFields.get(fieldName).toString(); descriptionAvailableLength = addFieldToDescriptionMap(descriptionMap, fieldName, fieldValue, descriptionAvailableLength); if (descriptionAvailableLength < 0) { String diskAlias = descriptionFields.get(DISK_ALIAS).toString(); String storedFieldValue = (String) descriptionMap.get(fieldName); String[] descriptionFieldsLeft = Arrays.copyOfRange(descriptionFieldsPriority, priority, descriptionFieldsPriority.length); String diskFieldsNames = StringUtils.join(descriptionFieldsLeft, ", ", 0, descriptionFieldsLeft.length); if (storedFieldValue == null) { auditLogFailedToStoreDiskFields(diskAlias, diskFieldsNames); } else if (storedFieldValue.length() < fieldValue.length()) { auditLogFailedToStoreEntireDiskField(diskAlias, fieldName, storedFieldValue, diskFieldsNames); } break; } } return descriptionMap; }
Source:
<code>public void metadataImportTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = communityService.create(null, context); collectionService.create(context, community); String fileLocation = configurationService.getProperty("dspace.dir") + testProps.get("test.importcsv") .toString(); String[] args = new String[] {"metadata-import", "-f", fileLocation, "-e", eperson.getEmail(), "-s"}; TestDSpaceRunnableHandler testDSpaceRunnableHandler = new TestDSpaceRunnableHandler(); ScriptLauncher.handleScript(args, ScriptLauncher.getConfig(kernelImpl), testDSpaceRunnableHandler, kernelImpl); <START> Item importedItem = itemService.findAll(context).next(); <END> assertTrue( StringUtils.equals( itemService.getMetadata(importedItem, "dc", "contributor", "author", Item.ANY).get(0).getValue(), "Donald, SmithImported")); }</code><technical_language>This line potentially fragile (and performance load Items memory find "next()" one). Is other parse out Item created output of metadata-import script? prefer if test *output* of script is correct here</technical_language>

Target:
public void metadataImportTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = communityService.create(null, context); Collection collection = collectionService.create(context, community); context.restoreAuthSystemState(); String fileLocation = new File(testProps.get("test.importcsv").toString()).getAbsolutePath(); String[] args = new String[] {"metadata-import", "-f", fileLocation, "-e", eperson.getEmail(), "-s"}; TestDSpaceRunnableHandler testDSpaceRunnableHandler = new TestDSpaceRunnableHandler(); ScriptLauncher.handleScript(args, ScriptLauncher.getConfig(kernelImpl), testDSpaceRunnableHandler, kernelImpl); Item importedItem = itemService.findAll(context).next(); assertTrue( StringUtils.equals( itemService.getMetadata(importedItem, "dc", "contributor", "author", Item.ANY).get(0).getValue(), "Donald, SmithImported")); context.turnOffAuthorisationSystem(); itemService.delete(context, itemService.find(context, importedItem.getID())); collectionService.delete(context, collectionService.find(context, collection.getID())); communityService.delete(context, communityService.find(context, community.getID())); context.restoreAuthSystemState(); }
Source:
<code>public void dictionaryNameProviderTestUTF8() throws Exception { TypeKey oldKey = new TypeKey("old"); File dictionaryFile = new File(TestsProperties.getJackRootDir(), <START> "jack/tests/com/android/jack/shrob/obfuscation/nameprovider/dictionaryUTF8.txt"); <END> DictionaryNameProvider dnp = new DictionaryNameProvider(dictionaryFile, new LowerCaseAlphabeticalNameProvider()); Assert.assertEquals("abc", dnp.getNewName(oldKey)); Assert.assertEquals("def", dnp.getNewName(oldKey)); Assert.assertEquals("ghi", dnp.getNewName(oldKey)); Assert.assertEquals("jkl", dnp.getNewName(oldKey)); Assert.assertEquals("mno", dnp.getNewName(oldKey)); Assert.assertEquals("pqr", dnp.getNewName(oldKey)); Assert.assertEquals("stu", dnp.getNewName(oldKey)); Assert.assertEquals("vw$", dnp.getNewName(oldKey)); Assert.assertEquals("xyz_", dnp.getNewName(oldKey)); Assert.assertEquals("éà", dnp.getNewName(oldKey)); Assert.assertEquals("abc", dnp.getNewName(oldKey)); Assert.assertEquals("a", dnp.getNewName(oldKey)); }</code><technical_language>dictionnary-utf8.txt (coherency encoding tests naming non-java dir files in Jack</technical_language>

Target:
public void dictionaryNameProviderTestUTF8() throws Exception { TypeKey oldKey = new TypeKey("old"); File dictionaryFile = new File(TestsProperties.getJackRootDir(), "jack/tests/com/android/jack/shrob/obfuscation/nameprovider/dictionary-utf8.txt"); DictionaryNameProvider dnp = new DictionaryNameProvider(dictionaryFile, new LowerCaseAlphabeticalNameProvider()); Assert.assertEquals("abc", dnp.getNewName(oldKey)); Assert.assertEquals("def", dnp.getNewName(oldKey)); Assert.assertEquals("ghi", dnp.getNewName(oldKey)); Assert.assertEquals("jkl", dnp.getNewName(oldKey)); Assert.assertEquals("mno", dnp.getNewName(oldKey)); Assert.assertEquals("pqr", dnp.getNewName(oldKey)); Assert.assertEquals("stu", dnp.getNewName(oldKey)); Assert.assertEquals("vw$", dnp.getNewName(oldKey)); Assert.assertEquals("xyz_", dnp.getNewName(oldKey)); Assert.assertEquals("éà", dnp.getNewName(oldKey)); Assert.assertEquals("abc", dnp.getNewName(oldKey)); Assert.assertEquals("a", dnp.getNewName(oldKey)); }
Source:
<code>public void testMessageCountAfterUnsubscribe() throws Exception { String topicName = "myTopic"; String groupId = "groupId"; AmqpConsumerAdapter adapter = createAdapterWithNonDurableConf(topicName, groupId, false); when(mockChannel.messageCount(anyString())).thenReturn(42L); adapter.subscribe((jsonMessage, ackHandler) -> { }); verify(mockChannel).exchangeDeclare(topicName, "fanout", false, true, null); Optional<Long> expectedAnswerWhileSubscribed = Optional.of(42L); Optional<Long> expectedAnswerWhileUnsubscribed = Optional.empty(); Optional<Long> resultWhileSubscribed = adapter.messageCount(); adapter.unsubscribe(); Optional<Long> resultWhileUnsubscribed = adapter.messageCount(); verify(mockChannel, times(1)).messageCount(anyString()); <START> assertEquals(resultWhileSubscribed, expectedAnswerWhileSubscribed); <END> assertEquals(resultWhileUnsubscribed, expectedAnswerWhileUnsubscribed); }</code><technical_language>wrong order</technical_language>

Target:
public void testMessageCountAfterUnsubscribe() throws Exception { String topicName = "myTopic"; String groupId = "groupId"; AmqpConsumerAdapter adapter = createAdapterWithNonDurableConf(topicName, groupId, false); when(mockChannel.messageCount(anyString())).thenReturn(42L); adapter.subscribe((jsonMessage, ackHandler) -> { }); verify(mockChannel).exchangeDeclare(topicName, "fanout", false, true, null); Optional<Long> expectedAnswerWhileSubscribed = Optional.of(42L); Optional<Long> expectedAnswerWhileUnsubscribed = Optional.empty(); Optional<Long> resultWhileSubscribed = adapter.messageCount(); adapter.unsubscribe(); Optional<Long> resultWhileUnsubscribed = adapter.messageCount(); verify(mockChannel, times(1)).messageCount(anyString()); assertEquals(expectedAnswerWhileSubscribed, resultWhileSubscribed); assertEquals(expectedAnswerWhileUnsubscribed, resultWhileUnsubscribed); }
Source:
<code>public ProjectCode makePlaceHolder(String id, String name) { ProjectCode projectCode = new ProjectCode(); <START> projectCode.setUuid(id); <END> projectCode.setCodeName(name); projectCode.setCodeValue(name); projectCode.setCodeGroup(name); return projectCode; }</code><technical_language>I projectCode.setCodeName(id); name unique</technical_language>

Target:
public ProjectCode makePlaceHolder(String id, String name) { ProjectCode projectCode = new ProjectCode(); projectCode.setUuid(id); projectCode.setCodeName(id); projectCode.setCodeValue(name); projectCode.setCodeGroup(name); return projectCode; }
Source:
<code>protected Object[] parameterValues() { <START> String partitions = String.format("{%s, %s}", Arrays.toString(p0.getNodes()), Arrays.toString(p1.getNodes())); <END> return concat(super.parameterValues(), partitions); }</code><technical_language>Interpreting DenyReadWriteRemoveAllTest[[0, 1, 2], [3]] failed in test results kind of tough, give partition scenarios a name instead. TBH I started thinking this I some factory() implementations I realized I idea new int[]{0,1,2}, new int[]{3} changes test compared new int[]{0,1}, new int[]{2}</technical_language>

Target:
protected Object[] parameterValues() { return concat(super.parameterValues(), description); }
Source:
<code>public void start() throws Exception { logger.trace("Starting Dmx transmitter ..."); transmitter = new DmxTransmitter(this); <START> transmitter.setTransmitRefresh(transmitRefreshMs); <END> transmitterTimer = new Timer(true); transmitterTimer.schedule(transmitter, 0, TRANSMIT_FREQUENCY_MS); logger.trace("Dmx transmitter started."); }</code><technical_language>variables/members/methods phrase refreshInterval changed code is easier follow</technical_language>

Target:
public void start() throws Exception { logger.trace("Starting Dmx transmitter ..."); transmitter = new DmxTransmitter(this); transmitterTimer = new Timer(true); transmitterTimer.schedule(transmitter, 0, TRANSMIT_FREQUENCY_MS); logger.trace("Dmx transmitter started."); }
Source:
<code>public void testPrepareStitchPoints() { final int expectedAmountJumpPoints = 2; EmbroideryList points = new EmbroideryList(); points.add(new PointF(0, 0)); points.add(new PointF(1000, 1000)); ArrayList<DSTFileGenerator.StitchPoint> stitchPoints = fileGenerator.prepareStitchPoints(points); assertEquals(points.size() + expectedAmountJumpPoints, stitchPoints.size()); int index = 0; <START> for (int i = 0; i < stitchPoints.size(); i++) { <END> if (i > 0) { assertTrue(Math.abs(stitchPoints.get(i - 1).point.x - stitchPoints.get(i).point.x) < DSTFileGenerator .MAXDISTANCE); assertTrue(Math.abs(stitchPoints.get(i - 1).point.y - stitchPoints.get(i).point.y) < DSTFileGenerator .MAXDISTANCE); } if (!stitchPoints.get(i).jump) { PointF point = (PointF) points.get(index); assertEquals(stitchPoints.get(i).point.x, point.x * DSTFileGenerator.STITCHPOINTUNITFACTOR); assertEquals(stitchPoints.get(i).point.y, point.y * DSTFileGenerator.STITCHPOINTUNITFACTOR); index += 1; } } }</code><technical_language>loops branching statements avoided in tests, this double index loop construction is extremely hard read comprehend. construct a EmbroideryList points in a end a reasonable size prepareStitchPoints expected ArrayList<DSTFileGenerator.StitchPoint> compare to. construct a EmbroideryListPoints points small interpolates point assert against. jump points</technical_language>

Target:
public void testPrepareStitchPoints() { final DSTFileGenerator.StitchPoint[] expectedStitchpoints = new DSTFileGenerator.StitchPoint[]{ new DSTFileGenerator.StitchPoint(new PointF(0, 0)), new DSTFileGenerator.StitchPoint(new PointF(0, 0), true), new DSTFileGenerator.StitchPoint(new PointF(100, 100), true), new DSTFileGenerator.StitchPoint(new PointF(200, 200))}; EmbroideryList points = new EmbroideryList(); points.add(new PointF(0, 0)); points.add(new PointF(100, 100)); ArrayList<DSTFileGenerator.StitchPoint> stitchPoints = fileGenerator.prepareStitchPoints(points); assertArrayEquals(expectedStitchpoints, stitchPoints.toArray()); }
Source:
<code>public void testRequestWithReply() throws Exception { defaultInboundGateway.start(); sendChannel.send(new GenericMessage<String>("test1")); Assert.assertEquals("test1".toUpperCase(), outputChannel.receive().getPayload()); defaultInboundGateway.stop(); <START> } <END></code><technical_language>Need more tests (error paths, timeouts etc)</technical_language>

Target:
public void testRequestWithReply() throws Exception { sendChannel.send(new GenericMessage<String>("test1")); Assert.assertEquals("test1".toUpperCase(), outputChannel.receive(10000).getPayload()); }
Source:
<code>public Lock obtain(Object lockKey) { Assert.isInstanceOf(String.class, lockKey); String path = (String) lockKey; RedisLock lock; <START> synchronized (this.locks) { <END> lock = this.locks.get(path); if (lock == null) { lock = new RedisLock(path); this.locks.put(path, lock); } } return lock; }</code><technical_language>ConcurrentHashMap.putIfAbsent blocks keys segment map - point of view is more performant verbose comparing current impl. nailed Java 1.4</technical_language>

Target:
public Lock obtain(Object lockKey) { Assert.isInstanceOf(String.class, lockKey); String path = (String) lockKey; return this.locks.computeIfAbsent(path, RedisLock::new); }
Source:
<code>private void assertOutput(Collection<Page> pages, FluoClient client) throws Exception { JavaRDD<Page> pagesRDD = sc.parallelize(new ArrayList<>(pages)); Assert.assertEquals(pages.size(), pagesRDD.count()); IndexStats stats = new IndexStats(sc); JavaPairRDD<RowColumn, Bytes> accumuloIndex = IndexUtil.createAccumuloIndex(stats, pagesRDD); JavaPairRDD<RowColumn, Bytes> fluoIndex = <START> IndexUtil.createFluoIndex(accumuloIndex, 5).sortByKey(); <END> boolean foundDiff = false; foundDiff |= diffAccumuloTable(accumuloIndex.collect()); foundDiff |= diffFluoTable(client, fluoIndex.collect()); if (foundDiff) { printFluoTable(client); printAccumuloTable(); printRDD(accumuloIndex.collect()); printRDD(fluoIndex.collect()); } Assert.assertFalse(foundDiff); }</code><technical_language>changing 5 FluoApp.NUM_BUCKETS</technical_language>

Target:
private void assertOutput(Collection<Page> pages, FluoClient client) throws Exception { JavaRDD<Page> pagesRDD = sc.parallelize(new ArrayList<>(pages)); Assert.assertEquals(pages.size(), pagesRDD.count()); IndexStats stats = new IndexStats(sc); JavaPairRDD<RowColumn, Bytes> accumuloIndex = IndexUtil.createAccumuloIndex(stats, pagesRDD); JavaPairRDD<RowColumn, Bytes> fluoIndex = IndexUtil.createFluoIndex(accumuloIndex, FluoApp.NUM_BUCKETS); boolean foundDiff = false; foundDiff |= diffAccumuloTable(accumuloIndex.collect()); foundDiff |= diffFluoTable(client, fluoIndex.collect()); if (foundDiff) { printFluoTable(client); printAccumuloTable(); printRDD(accumuloIndex.collect()); printRDD(fluoIndex.collect()); } Assert.assertFalse(foundDiff); }