auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void whenNoParamsThenDefaultsAreUsed() throws Exception { final ArgumentCaptor<EventStreamConfig> configCaptor = ArgumentCaptor.forClass(EventStreamConfig.class); final EventStream eventStreamMock = mock(EventStream.class); when(eventStreamFactoryMock.createEventStream(any(), any(), configCaptor.capture())) .thenReturn(eventStreamMock); when(topicRepositoryMock.topicExists(eq(TEST_EVENT_TYPE))).thenReturn(true); when(topicRepositoryMock.areCursorsValid(eq(TEST_EVENT_TYPE), any())).thenReturn(true); final MockMvc mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), new MappingJackson2HttpMessageConverter(objectMapper)) .build(); mockMvc.perform( get(String.format("/event-types/%s/events", TEST_EVENT_TYPE)) .header("X-nakadi-cursors", "[{\"partition\":\"0\",\"offset\":\"0\"}]")) .andExpect(status().isOk()); <START> Thread.sleep(2000); <END> final EventStreamConfig expectedConfig = EventStreamConfig .builder() .withTopic(TEST_EVENT_TYPE) .withBatchLimit(1) .withBatchTimeout(30) .withCursors(ImmutableMap.of("0", "0")) .withStreamKeepAliveLimit(0) .withStreamLimit(0) .withStreamTimeout(0) .build(); assertThat(configCaptor.getValue(), equalTo(expectedConfig)); }</code><technical_language>retry strategy in order assert this fast possible. 2000 timeout 50 retries. Wdyt</technical_language>

Target:
public void whenNoParamsThenDefaultsAreUsed() throws Exception { final ArgumentCaptor<EventStreamConfig> configCaptor = ArgumentCaptor.forClass(EventStreamConfig.class); final EventStream eventStreamMock = mock(EventStream.class); when(eventStreamFactoryMock.createEventStream(any(), any(), configCaptor.capture())) .thenReturn(eventStreamMock); when(topicRepositoryMock.topicExists(eq(TEST_EVENT_TYPE))).thenReturn(true); when(topicRepositoryMock.areCursorsValid(eq(TEST_EVENT_TYPE), any())).thenReturn(true); final MockMvc mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), new MappingJackson2HttpMessageConverter(objectMapper)) .build(); mockMvc.perform( get(String.format("/event-types/%s/events", TEST_EVENT_TYPE)) .header("X-nakadi-cursors", "[{\"partition\":\"0\",\"offset\":\"0\"}]")) .andExpect(status().isOk()); final EventStreamConfig expectedConfig = EventStreamConfig .builder() .withTopic(TEST_EVENT_TYPE) .withBatchLimit(1) .withBatchTimeout(30) .withCursors(ImmutableMap.of("0", "0")) .withStreamKeepAliveLimit(0) .withStreamLimit(0) .withStreamTimeout(0) .build(); executeWithRetry(() -> assertThat(configCaptor.getValue(), equalTo(expectedConfig)), new RetryForSpecifiedTimeStrategy<Void>(2000) .withExceptionsThatForceRetry(MockitoException.class) .withWaitBetweenEachTry(50)); }
Source:
<code>public void whenPUTInvalidEventTypeThen422() throws Exception { EventType invalidEventType = buildEventType(); <START> invalidEventType.setCategory(EventCategory.UNDEFINED); <END> Problem expectedProblem = invalidProblem("category", "may not be empty"); putEventType(invalidEventType, invalidEventType.getName()) .andExpect(status().isUnprocessableEntity()) .andExpect(content().contentType("application/problem+json")) .andExpect(content().string(matchesProblem(expectedProblem))); }</code><technical_language>Is this correct? test expects a problem error "may empty" for category field, defined above</technical_language>

Target:
public void whenPUTInvalidEventTypeThen422() throws Exception { EventType invalidEventType = buildEventType(); final JSONObject jsonObject = new JSONObject(objectMapper.writeValueAsString(invalidEventType)); jsonObject.remove("category"); Problem expectedProblem = invalidProblem("category", "may not be null"); putEventType(jsonObject.toString(), invalidEventType.getName()) .andExpect(status().isUnprocessableEntity()) .andExpect(content().contentType("application/problem+json")) .andExpect(content().string(matchesProblem(expectedProblem))); }
Source:
<code>public void getIpv4AddressOfNetworkReturnsNullWhenThereIsNoNetworkOfGivenName() { nic.setIpv4Address(IPV4_ADDRESS); <START> assertThat(underTest.getIpv4AddressOfNetwork("not" + NETWORK_NAME), <END> nullValue(null)); }</code><technical_language>please create another constant</technical_language>

Target:
public void getIpv4AddressOfNetworkReturnsNullWhenThereIsNoNetworkOfGivenName() { nic.setIpv4Address(IPV4_ADDRESS); assertThat(underTest.getIpv4AddressOfNetwork(NETWORK_NAME2), nullValue(null)); }
Source:
<code>public void encryptAll(List<String> algorithms) { if (this.encryption == Encryption.CLEAR) { users.replaceAll((u, p) -> encryptPassword((String) u, realm, (String) p, algorithms)); <START> store(realm, encryption); <END> } }</code><technical_language>Encryption.ENCRYPTED? suggestion store(realm, Encryption.ENCRYPTED);</technical_language>

Target:
public void encryptAll(List<String> algorithms) { if (this.encryption == Encryption.CLEAR) { users.replaceAll((u, p) -> encryptPassword((String) u, realm, (String) p, algorithms)); this.encryption = Encryption.ENCRYPTED; store(realm, Encryption.ENCRYPTED); } }
Source:
<code>public void loadFilters() { view.addTextFilter(constants.Process_Definition_Name(), constants.Default_Process_Definition_Name(), true, <START> f -> addSearchFilter(f, <END> likeTo(COL_ID_PROCESSNAME, f.getValue(), false)) ); }</code><technical_language>suggestion f -> addSearchFilter(f, likeTo(COL_ID_PROCESSNAME, f.getValue(), false))</technical_language>

Target:
public void loadFilters() { view.addTextFilter(constants.Name(), constants.Default_Process_Definition_Name(), true, f -> addSearchFilter(f, likeTo(COL_ID_PROCESSNAME, validateValue(f.getValue()), false)) ); }
Source:
<code>private ICPPEvaluation inc(ICPPEvaluation ptr, IASTNode point) { EvalFixed one = new EvalFixed(CPPBasicType.INT, ValueCategory.PRVALUE, IntegralValue.create(1)); <START> return new EvalBinary(IASTBinaryExpression.op_plus, ptr, one, point); <END> }</code><technical_language>EvalUnary prefix-increment operator. iterators required provide that, while random-access iterators required define a binary operator</technical_language>

Target:
private static ICPPEvaluation inc(ICPPEvaluation ptr, IASTNode point) { EvalFixed one = new EvalFixed(CPPBasicType.INT, ValueCategory.PRVALUE, IntegralValue.create(1)); return new EvalBinary(IASTBinaryExpression.op_plus, ptr, one, point); }
Source:
<code>private String decodeStatus(Position position, String value) { if (value != null) { switch (value.toLowerCase()) { case "acc on": case "accstart": position.set(Position.KEY_IGNITION, true); break; case "acc off": case "accstop": position.set(Position.KEY_IGNITION, false); break; case "help me!": position.set(Position.KEY_ALARM, Position.ALARM_SOS); break; case "help me": <START> position.set(Position.KEY_ALARM, Position.ALARM_SOS); <END> break; case "low battery": position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); break; case "move!": case "moved!": position.set(Position.KEY_ALARM, Position.ALARM_MOVEMENT); break; default: break; } } return null; }</code><technical_language>duplicate code here. Add switch case for exiting SOS alarm option</technical_language>

Target:
private String decodeStatus(Position position, String value) { if (value != null) { switch (value.toLowerCase()) { case "acc on": case "accstart": position.set(Position.KEY_IGNITION, true); break; case "acc off": case "accstop": position.set(Position.KEY_IGNITION, false); break; case "help me!": position.set(Position.KEY_ALARM, Position.ALARM_SOS); break; case "low battery": position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); break; case "move!": case "moved!": position.set(Position.KEY_ALARM, Position.ALARM_MOVEMENT); break; default: break; } } return null; }
Source:
<code>public void fileSeparatorShouldThrowExceptionWhenUsedAsPartOfFolderNameParameter() throws IOException { tempFolder.create(); thrown.expect(IOException.class); <START> thrown.expectMessage(String.format("%s%s%s%n%s", <END> "It's not possible to use the OS separator to create folder hierarchies like 'MyParentFolder'", File.separator, "'MyFolder'.", "Please use newFolder('MyParentFolder', 'MyFolder') instead")); tempFolder.newFolder("MyParentFolder" + File.separator + "MyFolder"); }</code><technical_language>pass a substring of expected message here? This is a bit hard read</technical_language>

Target:
public void fileSeparatorShouldThrowExceptionWhenUsedAsPartOfFolderNameParameter() throws IOException { tempFolder.create(); thrown.expect(IOException.class); String errorMsg = "It's not possible to use the OS separator to create folder " + "hierarchies like 'MyParentFolder'%s'MyFolder'. Please use newFolder('MyParentFolder', "+ "'MyFolder') instead"; thrown.expectMessage(String.format(errorMsg,File.separator)); tempFolder.newFolder("MyParentFolder" + File.separator + "MyFolder"); }
Source:
<code>public void onNext(SuccessResponse successResponse) { Log.i(TAG, successResponse.toString()); userManager.removeAccount(); <START> userManager.refreshAccounts(); <END> logoutSuccess.setValue(successResponse); }</code><technical_language>do need this refresh? in callback in userManager for furture? --- ah is in ManageAccountActivity, feels wrong ;-( ... future -> userManager.refreshAccounts()</technical_language>

Target:
public void onNext(SuccessResponse successResponse) { Log.i(TAG, successResponse.toString()); logoutSuccess.setValue(successResponse); }
Source:
<code>public void startup(UncaughtExceptionHandler handler) { String name = Thread.currentThread().getName(); Threads.setDaemonThreadRunning(this, name + ".replicationSource.shipper" + walGroupId + "," + source.getQueueId(), <START> (t,e) -> { <END> handler.uncaughtException(t, e); while (true) { try { LOG.info("Refreshing replication sources now due " + "to previous error on shipper thread."); this.source.getSourceManager().refreshSources(this.source.getPeerId()); break; } catch (IOException e1) { LOG.error("Replication sources refresh failed.", e1); sleepForRetries("Sleeping before try refreshing sources again", sleepForRetries, 1, maxRetriesMultiplier); } } }); }</code><technical_language>OK, code is same... I move logic uncaughtException method? If abortOnError is true, about, try refresh source</technical_language>

Target:
public void startup(UncaughtExceptionHandler handler) { String name = Thread.currentThread().getName(); Threads.setDaemonThreadRunning(this, name + ".replicationSource.shipper" + walGroupId + "," + source.getQueueId(), handler::uncaughtException); }
Source:
<code>public Task<T> build() { MutableMap<String, Object> taskFlags = MutableMap.copyOf(flags); <START> if (name!=null) taskFlags.add("displayName", name); <END> if (description!=null) taskFlags.add("description", description); if (!tags.isEmpty()) taskFlags.add("tags", tags); if (Boolean.FALSE.equals(dynamic) && children.isEmpty()) { if (swallowChildrenFailures!=null) throw new IllegalArgumentException("Cannot set swallowChildrenFailures for non-dynamic task: "+this); return new BasicTask<T>(taskFlags, body); } if (Boolean.TRUE.equals(dynamic) || (dynamic==null && !parallel)) { if (parallel) throw new UnsupportedOperationException("No implementation of parallel dynamic aggregate task available"); DynamicSequentialTask<T> result = new DynamicSequentialTask<T>(taskFlags, body); if (swallowChildrenFailures!=null && swallowChildrenFailures.booleanValue()) result.swallowChildrenFailures(); for (TaskAdaptable t: children) result.queue(t.asTask()); return result; } if (body != null) { throw new UnsupportedOperationException("No implementation of non-dynamic task with both body and children"); } if (swallowChildrenFailures!=null) { throw new IllegalArgumentException("Cannot set swallowChildrenFailures for non-dynamic task: "+this); } if (parallel) return new ParallelTask(taskFlags, children); else return new SequentialTask(taskFlags, children); }</code><technical_language>If fluent-style, put. I method check semantics of mutableMap.add guessing others do same</technical_language>

Target:
public Task<T> build() { MutableMap<String, Object> taskFlags = MutableMap.copyOf(flags); if (name!=null) taskFlags.put("displayName", name); if (description!=null) taskFlags.put("description", description); if (!tags.isEmpty()) taskFlags.put("tags", tags); if (Boolean.FALSE.equals(dynamic) && children.isEmpty()) { if (swallowChildrenFailures!=null) throw new IllegalArgumentException("Cannot set swallowChildrenFailures for non-dynamic task: "+this); return new BasicTask<T>(taskFlags, body); } if (Boolean.TRUE.equals(dynamic) || (dynamic==null && !parallel)) { if (parallel) throw new UnsupportedOperationException("No implementation of parallel dynamic aggregate task available"); DynamicSequentialTask<T> result = new DynamicSequentialTask<T>(taskFlags, body); if (swallowChildrenFailures!=null && swallowChildrenFailures.booleanValue()) result.swallowChildrenFailures(); for (TaskAdaptable t: children) result.queue(t.asTask()); return result; } if (body != null) { throw new UnsupportedOperationException("No implementation of non-dynamic task with both body and children"); } if (swallowChildrenFailures!=null) { throw new IllegalArgumentException("Cannot set swallowChildrenFailures for non-dynamic task: "+this); } if (parallel) return new ParallelTask(taskFlags, children); else return new SequentialTask(taskFlags, children); }
Source:
<code><START> private static boolean isHDF5File(final File inputFile) { <END> try (final HDF5File hdf5File = new HDF5File(inputFile)) { logger.info(String.format("Opening %s as an HDF5 file...", hdf5File.getFile())); return true; } catch (final GATKException e) { return false; } }</code><technical_language>this delegated of classes deals HDF5 specifically?(like **HDF5AllelicPoNUtils**) some other classes want</technical_language>

Target:
private static boolean isHDF5File(final File inputFile) { try (final HDF5File hdf5File = new HDF5File(inputFile)) { logger.info(String.format("Opening %s as an HDF5 file...", hdf5File.getFile())); return true; } catch (final HDF5LibException e) { return false; } }
Source:
<code>public static HdfsSplitInfo[] getSplits(final String path, final String inputFormatClassName, final int numOfSplits) { final ExternalConstructor<JobConf> jobConfExternalConstructor = <START> new JobConfExternalConstructor(inputFormatClassName, path); <END> final InputSplit[] inputSplits; try { final JobConf jobConf = jobConfExternalConstructor.newInstance(); final InputFormat inputFormat = jobConf.getInputFormat(); inputSplits = inputFormat.getSplits(jobConf, numOfSplits); if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, "Splits: {0} {1}", new Object[] {Arrays.toString(inputSplits)}); } } catch (final IOException e) { throw new RuntimeException("Unable to get InputSplits using the specified InputFormat", e); } final HdfsSplitInfo[] hdfsSplitInfos = new HdfsSplitInfo[inputSplits.length]; for (int idx = 0; idx < inputSplits.length; idx++) { hdfsSplitInfos[idx] = new HdfsSplitInfo(path, inputSplits[idx], inputFormatClassName); } LOG.log(Level.FINE, "The number of splits: {0}", hdfsSplitInfos.length); return hdfsSplitInfos; }</code><technical_language>Replace Tang</technical_language>

Target:
public static HdfsSplitInfo[] getSplits(final String path, final String inputFormatClassName, final int numOfSplits) { final JobConf jobConf; try { final Tang tang = Tang.Factory.getTang(); jobConf = tang.newInjector( tang.newConfigurationBuilder() .bindNamedParameter(JobConfExternalConstructor.InputFormatClass.class, inputFormatClassName) .bindNamedParameter(JobConfExternalConstructor.InputPath.class, path) .bindConstructor(JobConf.class, JobConfExternalConstructor.class) .build()) .getInstance(JobConf.class); } catch (final InjectionException e) { throw new RuntimeException("Exception while injecting JobConf", e); } final InputSplit[] inputSplits; try { final InputFormat inputFormat = jobConf.getInputFormat(); inputSplits = inputFormat.getSplits(jobConf, numOfSplits); LOG.log(Level.FINEST, "Splits: {0}", Arrays.toString(inputSplits)); } catch (final IOException e) { throw new RuntimeException("Unable to get InputSplits using the specified InputFormat", e); } final HdfsSplitInfo[] hdfsSplitInfos = new HdfsSplitInfo[inputSplits.length]; for (int idx = 0; idx < inputSplits.length; idx++) { hdfsSplitInfos[idx] = HdfsSplitInfo.newBuilder() .setInputPath(path) .setInputSplit(inputSplits[idx]) .setInputFormatClassName(inputFormatClassName) .build(); } LOG.log(Level.FINE, "The number of splits: {0}", hdfsSplitInfos.length); return hdfsSplitInfos; }
Source:
<code>protected SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof SecretKeySpec) { return (SecretKeySpec) keySpec; } <START> throw new InvalidKeySpecException("keySpec must be SecretKeySpect, given: " + keySpec.getClass().getName()); <END> }</code><technical_language>For Exceptions this please add org.wildfly.security._private.ElytronMessages instead</technical_language>

Target:
protected SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof SecretKeySpec) { return (SecretKeySpec) keySpec; } throw log.keySpecMustBeSecretKeySpec(keySpec.getClass().getName()); }
Source:
<code>public void cleanUpBanner(String placementId) { Log.d(TAG, "cleanUpBanner"); Pair<String, VungleNativeAd> pair = activeBannerAds.get(placementId); if (pair != null) { <START> String adapterId = pair.first; END> removeListeners(adapterId); VungleNativeAd vungleNativeAd = pair.second; if (vungleNativeAd != null) { Log.d(TAG, "cleanUpBanner # finishDisplayingAd"); vungleNativeAd.finishDisplayingAd(); removeActiveBanner(placementId, adapterId); } } }</code><technical_language>TODO, a HashMap currently, 1 element returned</technical_language>

Target:
void cleanUpBanner(String placementId) { Log.d(TAG, "cleanUpBanner"); VungleNativeAd vungleNativeAd = activeBannerAds.get(placementId); if (vungleNativeAd != null) { Log.d(TAG, "cleanUpBanner # finishDisplayingAd"); vungleNativeAd.finishDisplayingAd(); removeActiveBanner(placementId); } }
Source:
<code>public static AccessModifier getAccessModifierFromModifiersToken(DetailAST ast) { final AccessModifier accessModifier; if (ScopeUtil.isInInterfaceOrAnnotationBlock(ast)) { <START> accessModifier = AccessModifier.PUBLIC; <END> } else { final DetailAST modsToken = ast.findFirstToken(TokenTypes.MODIFIERS); accessModifier = getAccessModifierFromModifiersTokenEx(modsToken); } return accessModifier; }</code><technical_language>Java 9 [private](<LINK_0> methods in interface definition. difference a class interface is default access modifier for class is package for interface is public</technical_language>

Target:
public static AccessModifier getAccessModifierFromModifiersToken(DetailAST ast) { final AccessModifier accessModifier; if (ScopeUtil.isInInterfaceOrAnnotationBlock(ast)) { accessModifier = AccessModifier.PUBLIC; } else { final DetailAST modsToken = ast.findFirstToken(TokenTypes.MODIFIERS); accessModifier = getAccessModifierFromModifiersTokenDirectly(modsToken); } return accessModifier; }
Source:
<code>private static boolean anyInterfaceSupportsIpV6() { try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface iface = interfaces.nextElement(); Enumeration<InetAddress> addresses = iface.getInetAddresses(); while (addresses.hasMoreElements()) { if (addresses.nextElement() instanceof Inet6Address) { return true; } } } } catch (SocketException e) { <START> logger.debug("Unable to detect if any interface supports IPv6, assuming no", e); <END> } return false; }</code><technical_language>about: assuming IPv4-only</technical_language>

Target:
private static boolean anyInterfaceSupportsIpV6() { try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface iface = interfaces.nextElement(); Enumeration<InetAddress> addresses = iface.getInetAddresses(); while (addresses.hasMoreElements()) { if (addresses.nextElement() instanceof Inet6Address) { return true; } } } } catch (SocketException e) { logger.debug("Unable to detect if any interface supports IPv6, assuming IPv4-only", e); } return false; }
Source:
<code>private void populateCPUList(ClusterModel clusterModel, List<ServerCpu> cpus, boolean canChangeArchitecture) { ServerCpu oldSelectedCpu = clusterModel.getCPU().getSelectedItem(); clusterModel.getCPU().setItems(cpus); clusterModel.getCPU().setSelectedItem(oldSelectedCpu != null ? Linq.firstOrDefault(cpus, new Linq.ServerCpuPredicate(oldSelectedCpu.getCpuName())) : null); if (clusterModel.getCPU().getSelectedItem() == null || !isCPUinitialized) { initCPU(); } if (clusterModel.getIsEdit()) { <START> if (canChangeArchitecture) { <END> getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(ArchitectureType.values()))); } else { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(clusterModel.getEntity() .getArchitecture()))); } ArchitectureType oldSelectedArch = (ArchitectureType) clusterModel.getArchitecture().getSelectedItem(); if (oldSelectedArch != null) { getArchitecture().setSelectedItem(oldSelectedArch); } else { getArchitecture().setSelectedItem(getEntity().getArchitecture()); } } else { filterUnsupportedArchs(clusterModel); getArchitecture().setSelectedItem(ArchitectureType.undefined); } }</code><technical_language>need filter here</technical_language>

Target:
private void populateCPUList(ClusterModel clusterModel, List<ServerCpu> cpus, boolean canChangeArchitecture) { ServerCpu oldSelectedCpu = clusterModel.getCPU().getSelectedItem(); clusterModel.getCPU().setItems(cpus); initSupportedArchitectures(clusterModel); clusterModel.getCPU().setSelectedItem(oldSelectedCpu != null ? Linq.firstOrDefault(cpus, new Linq.ServerCpuPredicate(oldSelectedCpu.getCpuName())) : null); if (clusterModel.getCPU().getSelectedItem() == null || !isCPUinitialized) { initCPU(); } if (clusterModel.getIsEdit()) { if (!canChangeArchitecture) { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(clusterModel.getEntity() .getArchitecture()))); } ArchitectureType oldSelectedArch = (ArchitectureType) clusterModel.getArchitecture().getSelectedItem(); if (oldSelectedArch != null) { getArchitecture().setSelectedItem(oldSelectedArch); } else { getArchitecture().setSelectedItem(getEntity().getArchitecture()); } } else { getArchitecture().setSelectedItem(ArchitectureType.undefined); } }
Source:
<code>protected void loadTemplate(File templateFile) { <START> String templateId = templateFile.getName().substring(0, templateFile.getName().lastIndexOf(".")); <END> try (FileInputStream inputStream = new FileInputStream(templateFile)) { this.stringLoader.putTemplate(templateId, read(inputStream)); logger.info("Loaded template from file {}", templateId, templateFile); } catch (Exception e) { logger.warn("Exception while loading template from due to {}", templateFile, e.getMessage(), e); } }</code><technical_language>This line e.g. resolveTemplateId method, reused in removeTemplate well</technical_language>

Target:
protected void loadTemplate(File templateFile) { String templateId = resolveTemplateId(templateFile); try (FileInputStream inputStream = new FileInputStream(templateFile)) { this.stringLoader.putTemplate(templateId, read(inputStream)); logger.info("Loaded template from file {}", templateId, templateFile); } catch (Exception e) { logger.warn("Exception while loading template from due to {}", templateFile, e.getMessage(), e); } }
Source:
<code>public void run() { Map<String, List<String>> sourceIdToRenditionRefs = computeLiveDocumentRefsToRenditionRefs(); List<String> sourceIds = new ArrayList<>(sourceIdToRenditionRefs.keySet()); <START> <END> removeStoredRenditions(sourceIdToRenditionRefs, sourceIds); }</code><technical_language>If rework removeStoredRenditions a simple iterative method need do copy</technical_language>

Target:
public void run() { Map<String, List<String>> sourceIdToRenditionRefs = computeLiveDocumentRefsToRenditionRefs(); removeStoredRenditions(sourceIdToRenditionRefs); }
Source:
<code>public void testVersioning() throws Exception { conn.tableOperations().create(tableName); conn.tableOperations().removeProperty(tableName, "table.iterator.scan.vers"); conn.tableOperations().removeProperty(tableName, "table.iterator.majc.vers"); conn.tableOperations().removeProperty(tableName, "table.iterator.minc.vers"); final BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig()); Mutation m = new Mutation("row1"); m.put("colf", "colq", 1l, "value"); m.put("colf", "colq", 2l, "value"); bw.addMutation(m); bw.flush(); m = new Mutation("row1"); m.put("colf", "colq", 3l, "value"); m.put("colf", "colq", 4l, "value"); bw.addMutation(m); bw.flush(); ClientSideIteratorScanner csis = null; <START> try (Scanner scanner = conn.createScanner(tableName, new Authorizations())) { <END> csis = new ClientSideIteratorScanner(scanner); final IteratorSetting si = new IteratorSetting(10, "localvers", VersioningIterator.class); si.addOption("maxVersions", "2"); csis.addScanIterator(si); checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); checkResults(scanner, resultSet2, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); csis.fetchColumnFamily(new Text("colf")); checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); csis.clearColumns(); csis.fetchColumnFamily(new Text("none")); assertFalse(csis.iterator().hasNext()); } finally { if (csis != null) { csis.close(); } } }</code><technical_language>try-with-resources for scanner csis in block. I recall if separating character is a semicolon a comma. java try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY); ClientSideIteratorScanner csis = new ClientSideIteratorScanner(scanner)) { // ... } nest them, uglier</technical_language>

Target:
public void testVersioning() throws Exception { conn.tableOperations().create(tableName); conn.tableOperations().removeProperty(tableName, "table.iterator.scan.vers"); conn.tableOperations().removeProperty(tableName, "table.iterator.majc.vers"); conn.tableOperations().removeProperty(tableName, "table.iterator.minc.vers"); final BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig()); Mutation m = new Mutation("row1"); m.put("colf", "colq", 1l, "value"); m.put("colf", "colq", 2l, "value"); bw.addMutation(m); bw.flush(); m = new Mutation("row1"); m.put("colf", "colq", 3l, "value"); m.put("colf", "colq", 4l, "value"); bw.addMutation(m); bw.flush(); try (Scanner scanner = conn.createScanner(tableName, new Authorizations()); ClientSideIteratorScanner csis = new ClientSideIteratorScanner(scanner)) { final IteratorSetting si = new IteratorSetting(10, "localvers", VersioningIterator.class); si.addOption("maxVersions", "2"); csis.addScanIterator(si); checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); checkResults(scanner, resultSet2, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); csis.fetchColumnFamily(new Text("colf")); checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); csis.clearColumns(); csis.fetchColumnFamily(new Text("none")); assertFalse(csis.iterator().hasNext()); } }
Source:
<code>private void export(ClassData def) throws InvalidPluginException { Class<?> clazz; try { clazz = Class.forName(def.className, false, classLoader); } catch (ClassNotFoundException err) { throw new InvalidPluginException(String.format( "Cannot load %s with @Export(\"%s\")", def.className, def.exportedAsName), err); } Export export = clazz.getAnnotation(Export.class); if (export == null) { PluginLoader.log.warn(String.format( "In plugin %s asm incorrectly parsed %s with @Export(\"%s\")", pluginName, clazz.getName(), def.exportedAsName)); return; } <START> if (is(SecureStore.class.getName(), clazz)) { return; } <END> if (is("org.apache.sshd.server.Command", clazz)) { if (sshGen != null) { sshGen.export(export, clazz); } } else if (is("javax.servlet.http.HttpServlet", clazz)) { if (httpGen != null) { httpGen.export(export, clazz); listen(clazz, clazz); } } else { int cnt = sysListen.size(); listen(clazz, clazz); if (cnt == sysListen.size()) { throw new InvalidPluginException(String.format( "Class %s with @Export(\"%s\") not supported", clazz.getName(), export.value())); } } }</code><technical_language>Urgh. Yea I need skip this prevent throwing below, need a DynamicSet/DynamicMap of runtime. I cleaner declare DynamicSet.of(SecoreStore.class) in GerritGlobalModule this special case here</technical_language>

Target:
private void export(ClassData def) throws InvalidPluginException { Class<?> clazz; try { clazz = Class.forName(def.className, false, classLoader); } catch (ClassNotFoundException err) { throw new InvalidPluginException(String.format( "Cannot load %s with @Export(\"%s\")", def.className, def.exportedAsName), err); } Export export = clazz.getAnnotation(Export.class); if (export == null) { PluginLoader.log.warn(String.format( "In plugin %s asm incorrectly parsed %s with @Export(\"%s\")", pluginName, clazz.getName(), def.exportedAsName)); return; } if (is("org.apache.sshd.server.Command", clazz)) { if (sshGen != null) { sshGen.export(export, clazz); } } else if (is("javax.servlet.http.HttpServlet", clazz)) { if (httpGen != null) { httpGen.export(export, clazz); listen(clazz, clazz); } } else { int cnt = sysListen.size(); listen(clazz, clazz); if (cnt == sysListen.size()) { throw new InvalidPluginException(String.format( "Class %s with @Export(\"%s\") not supported", clazz.getName(), export.value())); } } }
Source:
<code>protected void processCurrentMessages(final ActorProcessingThread currentThread, final WebDebugger dbg) { assert size > 0; if (VmSettings.SNAPSHOTS_ENABLED && !VmSettings.TEST_SNAPSHOTS) { SnapshotBuffer sb = currentThread.getSnapshotBuffer(); <START> if (SnapshotBackend.getSnapshotVersion() > sb.getSnapshotVersion()) { <END> sb = currentThread.newSnapshot(); } sb.getRecord().handleTodos(sb); firstMessage.serialize(sb); } execute(firstMessage, currentThread, dbg); if (size > 1) { for (EventualMessage msg : mailboxExtension) { if (VmSettings.SNAPSHOTS_ENABLED && !VmSettings.TEST_SNAPSHOTS) { msg.serialize(currentThread.getSnapshotBuffer()); } execute(msg, currentThread, dbg); } } }</code><technical_language>Is this check selection of a new sb done part of getter method? This is responsibilities. a brittle if client do check</technical_language>

Target:
protected void processCurrentMessages(final ActorProcessingThread currentThread, final WebDebugger dbg) { assert size > 0; if (VmSettings.SNAPSHOTS_ENABLED && !VmSettings.TEST_SNAPSHOTS) { SnapshotBuffer sb = currentThread.getSnapshotBuffer(); sb.getRecord().handleTodos(sb); firstMessage.serialize(sb); } execute(firstMessage, currentThread, dbg); if (size > 1) { for (EventualMessage msg : mailboxExtension) { if (VmSettings.SNAPSHOTS_ENABLED && !VmSettings.TEST_SNAPSHOTS) { msg.serialize(currentThread.getSnapshotBuffer()); } execute(msg, currentThread, dbg); } } }
Source:
<code>private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); GlusterVolumeSnapshotEntity snapshot = (GlusterVolumeSnapshotEntity) getSelectedItem(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().confirmRestoreSnapshot() + " - " + getEntity().getName()); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); if (snapshot.getStatus() == GlusterSnapshotStatus.STARTED) { model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotRestoreWithStop()); } else { model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotRestore()); } UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); <START> UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this); END> model.getCommands().add(cancelCommand); }</code><technical_language>camelCase small letter starting</technical_language>

Target:
private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); GlusterVolumeSnapshotEntity snapshot = (GlusterVolumeSnapshotEntity) getSelectedItem(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmRestoreSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); if (snapshot.getStatus() == GlusterSnapshotStatus.STARTED) { model.setMessage(ConstantsManager.getInstance() .getConstants() .confirmVolumeSnapshotRestoreWithStopMessage()); } else { model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotRestoreMesage()); } UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }
Source:
<code>public void clear() { checkAvailable(); int size = records.size(); int removedSoFar = 0; do { Iterator<Map.Entry<KS, R>> iterator = records.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<KS, R> entry = iterator.next(); R record = entry.getValue(); if (records.remove(entry.getKey(), record)) { if (canUpdateStatsOf(record)) { nearCacheStats.decrementOwnedEntryMemoryCost(calculateMemoryCostOf(entry)); nearCacheStats.decrementOwnedEntryCount(); nearCacheStats.incrementInvalidations(); } removedSoFar++; } } <START> } while (removedSoFar < size && !records.isEmpty()); <END> nearCacheStats.incrementInvalidationRequests(); }</code><technical_language>Hm, I guess this method return if adding records</technical_language>

Target:
public void clear() { checkAvailable(); int size = records.size(); records.clear(); nearCacheStats.setOwnedEntryCount(0); nearCacheStats.setOwnedEntryMemoryCost(0L); nearCacheStats.incrementInvalidations(size); nearCacheStats.incrementInvalidationRequests(); }
Source:
<code>private EObject findSemanticRoot(final Resource res) { EObject root = res.getContents().get(0); EClass eCls = root.eClass(); boolean isXSD = Iterables.any(eCls.getEAnnotations(), new Predicate<EAnnotation>() { @Override public boolean apply(EAnnotation annotation) { boolean isExtMetadata = <START> "http:/ END> if (isExtMetadata) { EMap<String, String> details = annotation.getDetails(); if (details.containsKey("name") && details.get("name").isEmpty() && details.containsKey("kind") && "mixed".equals(details.get("kind"))) { return true; } } return false; } }); if (isXSD) { for (int featureID = 0; featureID < eCls.getFeatureCount(); featureID++) { EStructuralFeature eFeature = eCls.getEStructuralFeature(featureID); String name = eFeature.getName(); if (!"mixed".equals(name) && !"xMLNSPrefixMap".equals(name) && !"xSISchemaLocation".equals(name)) { Object obj = root.eGet(eFeature); if (obj instanceof EObject) { root = (EObject) obj; break; } } } } return root; }</code><technical_language>ExtendedMetaData.ANNOTATION_URI.equals</technical_language>

Target:
private EObject findSemanticRoot(final Resource res) { EObject root = res.getContents().get(0); EClass eClass = root.eClass(); ExtendedMetaData extendedMetaData = ExtendedMetaData.INSTANCE; if (extendedMetaData.isDocumentRoot(eClass)) { EReference xmlnsPrefixMapFeature = extendedMetaData.getXMLNSPrefixMapFeature(eClass); EReference xsiSchemaLocationFeature = extendedMetaData.getXSISchemaLocationMapFeature(eClass); EAttribute mixedFeatureFeature = extendedMetaData.getMixedFeature(eClass); for (int featureID = 0; featureID < eClass.getFeatureCount(); featureID++) { EStructuralFeature feature = eClass.getEStructuralFeature(featureID); if (feature != mixedFeatureFeature && feature != xmlnsPrefixMapFeature && feature != xsiSchemaLocationFeature) { Object obj = root.eGet(feature); if (obj instanceof EObject) { root = (EObject) obj; break; } } } } return root; }
Source:
<code>public void setSupportedDomainVersionsString(String supportedDomainVersions) { <START> this.supportedDomainVersions = Stream.of(supportedDomainVersions.split(",")) <END> .map(Integer::valueOf) .collect(Collectors.toList()); }</code><technical_language>try parseSupportedVersions method if applicable (i.e. Set<Version> instead of List<Integer>)</technical_language>

Target:
public void setSupportedDomainVersionsString(String supportedDomainVersions) { if (supportedDomainVersions == null) { return; } this.supportedDomainVersions = Stream.of(supportedDomainVersions.split(",")) .map(Integer::valueOf) .collect(Collectors.toList()); }
Source:
<code>QueryInfo getQueryInfo(Optional<StageInfo> rootStage) { QueryState state = queryState.get(); ExecutionFailureInfo failureCause = null; ErrorCode errorCode = null; if (state == QueryState.FAILED) { failureCause = this.failureCause.get(); if (failureCause != null) { errorCode = failureCause.getErrorCode(); } } boolean completeInfo = getAllStages(rootStage).stream().allMatch(StageInfo::isFinalStageInfo); boolean isScheduled = isScheduled(rootStage); <START> List<TaskId> failedTasks = getAllStages(rootStage).stream() <END> .map(StageInfo::getTasks) .flatMap(List::stream) .filter(taskInfo -> taskInfo.getTaskStatus().getState() == TaskState.FAILED) .map(TaskInfo::getTaskStatus) .map(TaskStatus::getTaskId) .collect(toImmutableList()); return new QueryInfo( queryId, session.toSessionRepresentation(), state, memoryPool.get().getId(), isScheduled, self, outputManager.getQueryOutputInfo().map(QueryOutputInfo::getColumnNames).orElse(ImmutableList.of()), query, getQueryStats(rootStage), Optional.ofNullable(setCatalog.get()), Optional.ofNullable(setSchema.get()), Optional.ofNullable(setPath.get()), setSessionProperties, resetSessionProperties, setRoles, addedPreparedStatements, deallocatedPreparedStatements, Optional.ofNullable(startedTransactionId.get()), clearTransactionId.get(), updateType.get(), rootStage, failureCause, errorCode, warningCollector.getWarnings(), inputs.get(), output.get(), completeInfo, resourceGroup, queryType, failedTasks); }</code><technical_language>I double check frequency of getBasicQueryInfo get called, this expensive (since iterate tasks)</technical_language>

Target:
QueryInfo getQueryInfo(Optional<StageInfo> rootStage) { QueryState state = queryState.get(); ExecutionFailureInfo failureCause = null; ErrorCode errorCode = null; if (state == QueryState.FAILED) { failureCause = this.failureCause.get(); if (failureCause != null) { errorCode = failureCause.getErrorCode(); } } boolean completeInfo = getAllStages(rootStage).stream().allMatch(StageInfo::isFinalStageInfo); boolean isScheduled = isScheduled(rootStage); Optional<List<TaskId>> failedTasks; if (state.isDone()) { failedTasks = Optional.of(getAllStages(rootStage).stream() .map(StageInfo::getTasks) .flatMap(List::stream) .filter(taskInfo -> taskInfo.getTaskStatus().getState() == TaskState.FAILED) .map(TaskInfo::getTaskStatus) .map(TaskStatus::getTaskId) .collect(toImmutableList())); } else { failedTasks = Optional.empty(); } return new QueryInfo( queryId, session.toSessionRepresentation(), state, memoryPool.get().getId(), isScheduled, self, outputManager.getQueryOutputInfo().map(QueryOutputInfo::getColumnNames).orElse(ImmutableList.of()), query, getQueryStats(rootStage), Optional.ofNullable(setCatalog.get()), Optional.ofNullable(setSchema.get()), Optional.ofNullable(setPath.get()), setSessionProperties, resetSessionProperties, setRoles, addedPreparedStatements, deallocatedPreparedStatements, Optional.ofNullable(startedTransactionId.get()), clearTransactionId.get(), updateType.get(), rootStage, failureCause, errorCode, warningCollector.getWarnings(), inputs.get(), output.get(), completeInfo, resourceGroup, queryType, failedTasks); }
Source:
<code>protected void delete(Context context, UUID id) { <START> context.turnOffAuthorisationSystem(); <END> Bitstream bit = null; try { bit = bs.find(context, id); if (bit.getCommunity() != null | bit.getCollection() != null) { throw new RuntimeException(); } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } try { bs.delete(context, bit); } catch (SQLException | AuthorizeException | IOException e) { throw new RuntimeException(e.getMessage(), e); } context.restoreAuthSystemState(); }</code><technical_language>I check weekend if is remove this workaround, I create issue remember</technical_language>

Target:
protected void delete(Context context, UUID id) throws AuthorizeException { Bitstream bit = null; try { bit = bs.find(context, id); if (bit.getCommunity() != null | bit.getCollection() != null) { throw new UnprocessableEntityException("The bitstream cannot be deleted it is a logo"); } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } try { bs.delete(context, bit); } catch (SQLException | IOException e) { throw new RuntimeException(e.getMessage(), e); } }
Source:
<code>public void testReadConfigurationFile() throws IOException, ConfigException { <START> File file = new File("test.conf"); <END> OutputStream io = new FileOutputStream(file); try { io.write((ENABLE_CLIENT_SASL_KEY + "=true\n").getBytes()); io.write((ZK_SASL_CLIENT_USERNAME + "=ZK\n").getBytes()); io.write((LOGIN_CONTEXT_NAME_KEY + "=MyClient\n").getBytes()); io.write((ZOOKEEPER_SERVER_REALM + "=HADOOP.COM\n").getBytes()); io.write(("dummyProperty=dummyValue").getBytes()); io.flush(); } finally { io.close(); } try { ZKClientConfig conf = new ZKClientConfig(); conf.addConfiguration(file.getAbsolutePath()); assertEquals(conf.getProperty(ENABLE_CLIENT_SASL_KEY), "true"); assertEquals(conf.getProperty(ZK_SASL_CLIENT_USERNAME), "ZK"); assertEquals(conf.getProperty(LOGIN_CONTEXT_NAME_KEY), "MyClient"); assertEquals(conf.getProperty(ZOOKEEPER_SERVER_REALM), "HADOOP.COM"); assertNotNull(conf.getProperty("dummyProperty")); } finally { if (file != null) { file.delete(); } } }</code><technical_language>a File.createTempFile("test", "conf"), no</technical_language>

Target:
public void testReadConfigurationFile() throws IOException, ConfigException { File file = File.createTempFile("clientConfig", ".conf", testData); file.deleteOnExit(); Properties clientConfProp = new Properties(); clientConfProp.setProperty(ENABLE_CLIENT_SASL_KEY, "true"); clientConfProp.setProperty(ZK_SASL_CLIENT_USERNAME, "ZK"); clientConfProp.setProperty(LOGIN_CONTEXT_NAME_KEY, "MyClient"); clientConfProp.setProperty(ZOOKEEPER_SERVER_REALM, "HADOOP.COM"); clientConfProp.setProperty("dummyProperty", "dummyValue"); OutputStream io = new FileOutputStream(file); try { clientConfProp.store(io, "Client Configurations"); } finally { io.close(); } ZKClientConfig conf = new ZKClientConfig(); conf.addConfiguration(file.getAbsolutePath()); assertEquals(conf.getProperty(ENABLE_CLIENT_SASL_KEY), "true"); assertEquals(conf.getProperty(ZK_SASL_CLIENT_USERNAME), "ZK"); assertEquals(conf.getProperty(LOGIN_CONTEXT_NAME_KEY), "MyClient"); assertEquals(conf.getProperty(ZOOKEEPER_SERVER_REALM), "HADOOP.COM"); assertEquals(conf.getProperty("dummyProperty"), "dummyValue"); file.delete(); }
Source:
<code>private void processWithAccessKeyLogger(Set<AccessLogData> logSet, File file) throws IOException { FileWriter writer = new FileWriter(file, true); try { for (Iterator<AccessLogData> iterator = logSet.iterator(); iterator.hasNext(); iterator.remove()) { writer.write(iterator.next().getLogMessage()); writer.write("\r\n"); } writer.flush(); } finally { <START> writer.close(); <END> } }</code><technical_language>FileWriter in try-with-resource, is better</technical_language>

Target:
private void processWithAccessKeyLogger(Set<AccessLogData> logSet, File file) throws IOException { try (FileWriter writer = new FileWriter(file, true)) { for (Iterator<AccessLogData> iterator = logSet.iterator(); iterator.hasNext(); iterator.remove()) { writer.write(iterator.next().getLogMessage()); writer.write("\r\n"); } writer.flush(); } }
Source:
<code>private void addPartitionSplitChangeToPendingAssignments(Collection<KafkaPartitionSplit> newPartitionSplits) { int numReaders = context.currentParallelism(); for (KafkaPartitionSplit split : newPartitionSplits) { int ownerReader = split.getTopicPartition().hashCode() % numReaders; pendingPartitionSplitAssignment.computeIfAbsent(ownerReader, r -> new HashSet<>()).add(split); } <START> LOG.debug("Assigned to readers of consumer group {}.", newPartitionSplits, numReaders, consumerGroupId); <END> }</code><technical_language>nit: add a INFO log this? useful if need debug assignment problem</technical_language>

Target:
private void addPartitionSplitChangeToPendingAssignments(Collection<KafkaPartitionSplit> newPartitionSplits) { int numReaders = context.currentParallelism(); for (KafkaPartitionSplit split : newPartitionSplits) { int ownerReader = getSplitOwner(split.getTopicPartition(), numReaders); pendingPartitionSplitAssignment.computeIfAbsent(ownerReader, r -> new HashSet<>()).add(split); } LOG.debug("Assigned to readers of consumer group {}.", newPartitionSplits, numReaders, consumerGroupId); }
Source:
<code>public void testRangeRequestSimpleBlob() throws Exception { for (int i = 0; i < 5; i++) { blobSize = random.nextInt(maxChunkSize) + 1; int randomOne = random.nextInt(blobSize); int randomTwo = random.nextInt(blobSize); testRangeRequestClosedRange(Math.min(randomOne, randomTwo), Math.max(randomOne, randomTwo), true); } blobSize = random.nextInt(maxChunkSize) + 1; testRangeRequestClosedRange(0, blobSize - 1, true); testRangeRequestOpenRange(random.nextInt(blobSize), true); testRangeRequestLastNBytes(random.nextInt(blobSize) + 1, true); testRangeRequestLastNBytes(blobSize + 1, false); testRangeRequestClosedRange(random.nextInt(blobSize), blobSize + 5, false); testRangeRequestOpenRange(blobSize, false); testRangeRequestClosedRange(blobSize, blobSize + 20, false); <START> testRangeRequestLastNBytes(0, true); <END> }</code><technical_language>do similar tests for contains start end offset useful</technical_language>

Target:
public void testRangeRequestSimpleBlob() throws Exception { for (int i = 0; i < 5; i++) { blobSize = random.nextInt(maxChunkSize) + 1; int randomOne = random.nextInt(blobSize); int randomTwo = random.nextInt(blobSize); testRangeRequestOffsetRange(Math.min(randomOne, randomTwo), Math.max(randomOne, randomTwo), true); } blobSize = random.nextInt(maxChunkSize) + 1; testRangeRequestOffsetRange(0, blobSize - 1, true); testRangeRequestFromStartOffset(random.nextInt(blobSize), true); testRangeRequestLastNBytes(random.nextInt(blobSize) + 1, true); testRangeRequestLastNBytes(blobSize + 1, false); testRangeRequestOffsetRange(random.nextInt(blobSize), blobSize + 5, false); testRangeRequestFromStartOffset(blobSize, false); testRangeRequestOffsetRange(blobSize, blobSize + 20, false); testRangeRequestLastNBytes(0, true); testRangeRequestOffsetRange(0, 0, true); testRangeRequestOffsetRange(blobSize - 1, blobSize - 1, true); testRangeRequestFromStartOffset(blobSize - 1, true); testRangeRequestLastNBytes(1, true); }