auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static <OFFSET extends ZoneId> OFFSET assertValidZone( Supplier<OFFSET> func ) { try { return func.get(); } <START> catch ( DateTimeParseException e ) <END> { throw new InvalidTemporalArgumentException( e.getMessage(), e ); } }</code><technical_language>expect a ZoneRulesException (also)</technical_language>

Target:
static <OFFSET extends ZoneId> OFFSET assertValidZone( Supplier<OFFSET> func ) { try { return func.get(); } catch ( DateTimeException e ) { throw new InvalidValuesArgumentException( e.getMessage(), e ); } }
Source:
<code>public void modifyText( ModifyEvent modifyEvent ) { ExecutorService executorService = ExecutorUtil.getExecutor(); final String runConfiguration = jobMeta.environmentSubstitute( wRunConfiguration.getText() ); executorService.submit( () -> { List<Object> items = Arrays.asList( runConfiguration, false ); try { ExtensionPointHandler.callExtensionPoint( Spoon.getInstance().getLog(), KettleExtensionPoint .RunConfigurationSelection.id, items ); } catch ( KettleException ignored ) { } <START> if ( wWaitingToFinish != null && !wWaitingToFinish.isDisposed() ) { <END> display.asyncExec( () -> { if ( (Boolean) items.get( IS_PENTAHO ) ) { wWaitingToFinish.setSelection( false ); wWaitingToFinish.setEnabled( false ); } else { wWaitingToFinish.setEnabled( true ); } } ); } } ); }</code><technical_language>I this check done asyncExec. do asyncExec immediately execute. creating a new Runnable run UI thread. So, in point check wWaitingToFinish ok create new async execution. async execution runs wWaitingToFinish null disposed</technical_language>

Target:
public void modifyText( ModifyEvent modifyEvent ) { ExecutorService executorService = ExecutorUtil.getExecutor(); final String runConfiguration = jobMeta.environmentSubstitute( wRunConfiguration.getText() ); executorService.submit( () -> { List<Object> items = Arrays.asList( runConfiguration, false ); try { ExtensionPointHandler.callExtensionPoint( Spoon.getInstance().getLog(), KettleExtensionPoint .RunConfigurationSelection.id, items ); } catch ( KettleException ignored ) { } display.asyncExec( () -> { if ( wWaitingToFinish != null && !wWaitingToFinish.isDisposed() ) { if ( (Boolean) items.get( IS_PENTAHO ) ) { wWaitingToFinish.setSelection( false ); wWaitingToFinish.setEnabled( false ); } else { wWaitingToFinish.setEnabled( true ); } } } ); } ); }
Source:
<code>public static List<BlockMetaData> filterRowGroups(Filter filter, List<BlockMetaData> blocks, MessageType schema) { <START> Objects.requireNonNull(filter, "filter"); <END> return filter.accept(new RowGroupFilter(blocks, schema)); }</code><technical_language>More accurate error message</technical_language>

Target:
public static List<BlockMetaData> filterRowGroups(Filter filter, List<BlockMetaData> blocks, MessageType schema) { Objects.requireNonNull(filter, "filter cannot be null"); return filter.accept(new RowGroupFilter(blocks, schema)); }
Source:
<code>public void reregisterDoesNotLeakTransformer() throws Exception { <START> Converter stringToBanana = new MockConverterBuilder().from(DataTypeFactory.STRING).to(BANANA_DATA_TYPE).build(); <END> stringToBanana.setName("StringToBanana"); Converter copyStringToBanana = new MockConverterBuilder().from(DataTypeFactory.STRING).to(BANANA_DATA_TYPE).build(); copyStringToBanana.setName("StringToBanana"); muleRegistryHelper.registerTransformer(stringToBanana); muleRegistryHelper.registerTransformer(copyStringToBanana); muleRegistryHelper.lookupTransformers(DataTypeFactory.STRING, BANANA_DATA_TYPE); List<Transformer> transformers = muleRegistryHelper.lookupTransformers(DataTypeFactory.STRING, BANANA_DATA_TYPE); assertEquals(1, transformers.size()); }</code><technical_language>Static import</technical_language>

Target:
public void reregisterDoesNotLeakTransformer() throws Exception { Converter stringToBanana = new MockConverterBuilder().from(STRING).to(BANANA_DATA_TYPE).build(); stringToBanana.setName("StringToBanana"); Converter copyStringToBanana = new MockConverterBuilder().from(STRING).to(BANANA_DATA_TYPE).build(); copyStringToBanana.setName("StringToBanana"); muleRegistryHelper.registerTransformer(stringToBanana); muleRegistryHelper.registerTransformer(copyStringToBanana); muleRegistryHelper.lookupTransformers(DataTypeFactory.STRING, BANANA_DATA_TYPE); List<Transformer> transformers = muleRegistryHelper.lookupTransformers(STRING, BANANA_DATA_TYPE); assertThat(transformers, hasSize(1)); }
Source:
<code>protected final void check() { switch (type()) { case http: <START> HostAndPort host = HostAndPort.fromString(maybeHostAndPort().get()); <END> Preconditions.checkArgument(host.hasPort(), "Given hostname does not contain a port number: " + host); break; case direct: Preconditions.checkArgument(!maybeHostAndPort().isPresent() && !credentials().isPresent(), "Neither credential nor host-and-port may be configured for direct proxies"); break; default: throw new IllegalStateException("Unrecognized case; this is a library bug"); } if (credentials().isPresent()) { Preconditions.checkArgument(type() == Type.http, "credentials only valid for http proxies"); } }</code><technical_language>this NPE type=http host is specified</technical_language>

Target:
protected final void check() { switch (type()) { case HTTP: Preconditions.checkArgument(maybeHostAndPort().isPresent(), "host-and-port must be " + "configured for an HTTP proxy"); HostAndPort host = HostAndPort.fromString(maybeHostAndPort().get()); Preconditions.checkArgument(host.hasPort(), "Given hostname does not contain a port number: " + host); break; case DIRECT: Preconditions.checkArgument(!maybeHostAndPort().isPresent() && !credentials().isPresent(), "Neither credential nor host-and-port may be configured for DIRECT proxies"); break; default: throw new IllegalStateException("Unrecognized case; this is a library bug"); } if (credentials().isPresent()) { Preconditions.checkArgument(type() == Type.HTTP, "credentials only valid for http proxies"); } }
Source:
<code>private static boolean isSuppressWarnings(ASTAnnotation astAnnotation) { <START> return TypeHelper.isA(astAnnotation, "java.lang.SuppressWarnings"); <END> }</code><technical_language>suggestion return TypeHelper.isA(astAnnotation, SuppressWarnings.class); class is part of JRE, class</technical_language>

Target:
private static boolean isSuppressWarnings(ASTAnnotation astAnnotation) { return TypeHelper.isA(astAnnotation, SuppressWarnings.class); }
Source:
<code><START> public Aes128Cbc() { <END> super(ALGORITHM_NAME, KEY_SIZE); }</code><technical_language>This is a Checkstyle issue constructor scope exceeds class scope</technical_language>

Target:
Aes128Cbc() { super(ALGORITHM_NAME, KEY_SIZE); }
Source:
<code>public void testRemove() { tested.put("1", registry1); tested.put("2", <START> registry2); <END> assertTrue(tested.contains("1")); assertTrue(tested.contains("2")); tested.remove("1"); assertFalse(tested.contains("1")); assertTrue(tested.contains("2")); tested.remove("2"); assertFalse(tested.contains("1")); assertFalse(tested.contains("2")); }</code><technical_language>I guess good test registryDestroyer.accept(removed); invocation in testClear() test</technical_language>

Target:
public void testRemove() { tested.put("1", registry1); tested.put("2", registry2); assertTrue(tested.contains("1")); assertTrue(tested.contains("2")); tested.remove("1"); verify(registryDestroyer, times(1)).accept(eq(registry1)); assertFalse(tested.contains("1")); assertTrue(tested.contains("2")); tested.remove("2"); verify(registryDestroyer, times(1)).accept(eq(registry2)); assertFalse(tested.contains("1")); assertFalse(tested.contains("2")); }
Source:
<code>public void startConnection() { <START> if (!isSerialStarted) { <END> usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList(); if (!usbDevices.isEmpty()) { boolean keep = true; for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) { device = entry.getValue(); int deviceVID = device.getVendorId(); if (isSupportedDeviceID(deviceVID)) { usbManager.requestPermission(device, pendingIntent); keep = false; } else { connection = null; device = null; } if (!keep) { break; } } } } }</code><technical_language>I invert this return if isSerialStarted</technical_language>

Target:
public void startConnection() { if (isSerialStarted) { return; } usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList(); if (usbDevices.isEmpty()) { return; } boolean supportedDeviceFound = false; for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) { device = entry.getValue(); int deviceVID = device.getVendorId(); if (isSupportedDeviceID(deviceVID)) { usbManager.requestPermission(device, pendingIntent); supportedDeviceFound = true; break; } } if (!supportedDeviceFound) { connection = null; device = null; } }
Source:
<code>@Test public void onlineNodeShouldSucceedOnMaster() throws Exception { <START> final Computer masterComputer = j.jenkins.get().getComputer(""); <END> CLICommandInvoker.Result result = command .authorizedTo(Computer.CONNECT, Jenkins.READ) .invokeWithArgs(""); assertThat(result, succeededSilently()); assertThat(masterComputer.isOnline(), equalTo(true)); result = command .authorizedTo(Computer.CONNECT, Jenkins.READ) .invokeWithArgs(""); assertThat(result, succeededSilently()); assertThat(masterComputer.isOnline(), equalTo(true)); }</code><technical_language>suggestion final Computer masterComputer = j.jenkins.getComputer("");</technical_language>

Target:
@Test public void onlineNodeShouldSucceedOnMaster() throws Exception { final Computer masterComputer = j.jenkins.getComputer(""); CLICommandInvoker.Result result = command .authorizedTo(Computer.CONNECT, Jenkins.READ) .invokeWithArgs(""); assertThat(result, succeededSilently()); assertThat(masterComputer.isOnline(), equalTo(true)); result = command .authorizedTo(Computer.CONNECT, Jenkins.READ) .invokeWithArgs(""); assertThat(result, succeededSilently()); assertThat(masterComputer.isOnline(), equalTo(true)); }
Source:
<code>private static Autnum createAsBlockResponse(final RpslObject rpslObject) { final Autnum autnum = new Autnum(); <START> String key = rpslObject.getValueForAttribute(AttributeType.AS_BLOCK).toString(); <END> String[] startAndEndKey = key.split("-"); autnum.setHandle(startAndEndKey[0]); autnum.setName(key.replace(" ", "")); autnum.setStartAutnum(Long.parseLong(startAndEndKey[0].trim().substring(2))); autnum.setEndAutnum(Long.parseLong(startAndEndKey[1].trim().substring(2))); autnum.setType("DIRECT ALLOCATION"); autnum.getEntitySearchResults().addAll(createContactEntities(rpslObject)); return autnum; }</code><technical_language>final keyword possible, variables re-defined</technical_language>

Target:
private static Autnum createAsBlockResponse(final RpslObject rpslObject) { final Autnum autnum = new Autnum(); final String key = rpslObject.getValueForAttribute(AttributeType.AS_BLOCK).toString(); final AsBlockRange blockRange = getAsBlockRange(key); autnum.setHandle(blockRange.getBeginWithPrefix()); String asName = String.join("-", blockRange.getBeginWithPrefix(), blockRange.getEndWithPrefix()); autnum.setName(asName); autnum.setStartAutnum(blockRange.getBegin()); autnum.setEndAutnum(blockRange.getEnd()); autnum.setType(DIRECT_ALLOCATION); autnum.getEntitySearchResults().addAll(createContactEntities(rpslObject)); return autnum; }
Source:
<code>public List<JobConfig> getJobConfigs() { String json = ""; try { json = getPlanAsJson(); <START> } catch (Throwable t) { <END> log.warn("Failed to generate plan JSON"); } final String planJson = json; return getJobNodes().stream().map(n -> n.generateConfig(planJson)).collect(Collectors.toList()); }</code><technical_language>catch Exception, Throwable</technical_language>

Target:
public List<JobConfig> getJobConfigs() { String json = ""; try { json = getPlanAsJson(); } catch (Exception e) { log.warn("Failed to generate plan JSON", e); } final String planJson = json; return getJobNodes().stream().map(n -> n.generateConfig(planJson)).collect(Collectors.toList()); }
Source:
<code>@Override public T next() { byte[] data = iterator.next(); try { return converter.from(data); } catch (IOException e) { <START> sneakyRethrow(e); <END> throw new AssertionError(); } }</code><technical_language>If want, this return Throwable do throw sneakyRethrow(e) saves dealing control flow problems calling this method</technical_language>

Target:
@Override public T next() { byte[] data = iterator.next(); try { return converter.from(data); } catch (IOException e) { throw QueueFile.<Error>getSneakyThrowable(e); } }
Source:
<code>public Collection<Object> readData(Configuration conf, Path path) throws IOException { ArrayList<Object> collection = new ArrayList<>(); OrcFile.ReaderOptions readerOptions = new OrcFile.ReaderOptions(conf); Reader reader = OrcFile.createReader(path, readerOptions); RecordReader rows = reader.rows(); Object row = null; <START> for (; rows.hasNext(); ) { <END> row = rows.next(row); collection.add(row); } rows.close(); return collection; }</code><technical_language>aka while loop</technical_language>

Target:
public Collection<Object> readData(Configuration conf, Path path) throws IOException { ArrayList<Object> collection = new ArrayList<>(); OrcFile.ReaderOptions readerOptions = new OrcFile.ReaderOptions(conf); Reader reader = OrcFile.createReader(path, readerOptions); RecordReader rows = reader.rows(); Object row = null; while (rows.hasNext()) { row = rows.next(row); collection.add(row); } rows.close(); return collection; }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getTemplateType() != VmEntityType.INSTANCE_TYPE) { <START> validate(getVirtioRngValidator().canAddRngDevice(getVdsGroup(), getParameters().getRngDevice())); <END> } if (!getRngDevices().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_RNG_ALREADY_EXISTS); } return true; }</code><technical_language>return false if validation fails</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getTemplateType() != VmEntityType.INSTANCE_TYPE) { if (!validate(getVirtioRngValidator().canAddRngDevice(getVdsGroup(), getParameters().getRngDevice()))) { return false; } } if (!getRngDevices().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_RNG_ALREADY_EXISTS); } return true; }
Source:
<code>public void jsonObjectByBean2() { JSONObject jsonObject = new JSONObject(new MyBeanCustomName()); assertNotNull(jsonObject); assertEquals("Wrong number of keys found:", 5, jsonObject.keySet().size()); assertFalse("Normal field name (someString) processing did not work", jsonObject.has("someString")); assertFalse("Normal field name (myDouble) processing did not work", jsonObject.has("myDouble")); assertFalse("Normal field name (someFloat) processing did not work", jsonObject.has("someFloat")); assertFalse("Ignored field not found!", jsonObject.has("ignoredInt")); <START> assertTrue("Normal field name (someInt) found", <END> jsonObject.has("someInt")); assertTrue("Normal field name (someLong) found", jsonObject.has("someLong")); assertTrue("Overridden String field name (myStringField) found", jsonObject.has("myStringField")); assertTrue("Overridden String field name (Some Weird NAme that Normally Wouldn't be possible!) found", jsonObject.has("Some Weird NAme that Normally Wouldn't be possible!")); assertTrue("Overridden String field name (InterfaceField) found", jsonObject.has("InterfaceField")); }</code><technical_language>suggestion // getSomeInt() user-defined annotation assertTrue("Normal field name (someInt) found",</technical_language>

Target:
public void jsonObjectByBean2() { JSONObject jsonObject = new JSONObject(new MyBeanCustomName()); assertNotNull(jsonObject); assertEquals("Wrong number of keys found:", 5, jsonObject.keySet().size()); assertFalse("Normal field name (someString) processing did not work", jsonObject.has("someString")); assertFalse("Normal field name (myDouble) processing did not work", jsonObject.has("myDouble")); assertFalse("Normal field name (someFloat) processing did not work", jsonObject.has("someFloat")); assertFalse("Ignored field not found!", jsonObject.has("ignoredInt")); assertTrue("Normal field name (someInt) should have been found", jsonObject.has("someInt")); assertTrue("Normal field name (someLong) should have been found", jsonObject.has("someLong")); assertTrue("Overridden String field name (myStringField) should have been found", jsonObject.has("myStringField")); assertTrue("Overridden String field name (Some Weird NAme that Normally Wouldn't be possible!) should have been found", jsonObject.has("Some Weird NAme that Normally Wouldn't be possible!")); assertTrue("Overridden String field name (InterfaceField) should have been found", jsonObject.has("InterfaceField")); }
Source:
<code><START> void close() { <END> isOpen.set(false); try { chunkFillerThread.join(NonBlockingRouter.SHUTDOWN_WAIT_MS); } catch (InterruptedException e) { logger.error("Caught interrupted exception while waiting for chunkFillerThread to finish"); Thread.currentThread().interrupt(); } Iterator<PutOperation> iter = putOperations.iterator(); while (iter.hasNext()) { PutOperation op = iter.next(); NonBlockingRouter.completeOperation(op.getFuture(), op.getCallback(), null, new RouterException("Aborted operation because Router is closed", RouterErrorCode.RouterClosed)); iter.remove(); } }</code><technical_language>If feel close, managers implement Closeable</technical_language>

Target:
void close() { if (isOpen.compareAndSet(true, false)) { try { chunkFillerThread.join(NonBlockingRouter.SHUTDOWN_WAIT_MS); } catch (InterruptedException e) { logger.error("Caught interrupted exception while waiting for chunkFillerThread to finish"); Thread.currentThread().interrupt(); } completePendingOperations(); } }
Source:
<code>public void start() { if (started.compareAndSet(false, true)) { if (eventGenerator != null) { try { consumer = new KafkaConsumer<>(kafkaConsumerConf); final Collection<String> topicCollection = new LinkedList<>(); topicCollection.add(topic); consumer.subscribe(topicCollection); executorService.submit(new Runnable() { @Override public void run() { try { while(!closed.get()) { <START> final ConsumerRecords<K, V> consumerRecords = consumer.poll(pollTimeout); <END> for (final ConsumerRecord<K, V> record : consumerRecords) { eventGenerator.emitData(record); } } consumer.close(); } catch (final Exception e) { e.printStackTrace(); consumer.close(); } } }); } catch (final Exception e) { e.printStackTrace(); throw new RuntimeException("Failed to construct kafka consumer", e); } } } }</code><technical_language>CPU excessively if pollTimeout is small</technical_language>

Target:
public void start() { if (started.compareAndSet(false, true)) { if (eventGenerator != null) { try { consumer = new KafkaConsumer<>(kafkaConsumerConf); final Collection<String> topicCollection = new LinkedList<>(); topicCollection.add(topic); consumer.subscribe(topicCollection); executorService.submit(new Runnable() { @Override public void run() { try { while(!closed.get()) { final ConsumerRecords<K, V> consumerRecords = consumer.poll(pollTimeout); for (final ConsumerRecord<K, V> record : consumerRecords) { eventGenerator.emitData(record); } } } catch (final Exception e) { e.printStackTrace(); } finally { consumer.close(); } } }); } catch (final Exception e) { e.printStackTrace(); throw new RuntimeException("Failed to construct kafka consumer", e); } } } }
Source:
<code>private void onButtonOne(boolean action) { List<TagDto> selectedList; if (action) { selectedList = gridStorageR.getSelectionModel().getSelectedItems(); gridStorageR.getSelectionModel().selectNext(false); descriptionPanel.setText(gridStorageR.getSelectionModel().getSelectedItem().getDescription()); gridStorageL.getSelectionModel().deselectAll(); gridStorageL.getStore().addAll(selectedList); for (int i = 0; i < selectedList.size(); i++) { gridStorageR.getStore().remove(selectedList.get(i)); } } else { selectedList = gridStorageL.getSelectionModel().getSelectedItems(); gridStorageL.getSelectionModel().selectNext(false); descriptionPanel.setText(gridStorageL.getSelectionModel().getSelectedItem().getDescription()); gridStorageR.getSelectionModel().deselectAll(); gridStorageR.getStore().addAll(selectedList); for (int i = 0; i < selectedList.size(); i++) { gridStorageL.getStore().remove(selectedList.get(i)); } <START> } <END> }</code><technical_language>understand code is repeated</technical_language>

Target:
private void onButtonOne(boolean action) { if (action) { move(gridStorageL,gridStorageR); } else { move(gridStorageR,gridStorageL); } }
Source:
<code>public void compilePattern(){ if(!isRegularExpression){ <START> stringPayloadPattern = escapeMetaCharacters(stringPayloadPattern); <END> } if (isIgnoreCase) { this.payloadPattern = Pattern.compile(stringPayloadPattern, Pattern.MULTILINE | Pattern.CASE_INSENSITIVE); } else { this.payloadPattern = Pattern.compile(stringPayloadPattern, Pattern.MULTILINE); } }</code><technical_language>Pattern.quote, note change stringPayloadPattern itself, this compiling in UI show user</technical_language>

Target:
private void compilePattern(){ if (ignoreCase) { this.payloadPattern = Pattern.compile(!regularExpression ? Pattern.quote(stringPayloadPattern) : stringPayloadPattern , Pattern.MULTILINE | Pattern.CASE_INSENSITIVE); } else { this.payloadPattern = Pattern.compile(!regularExpression ? Pattern.quote(stringPayloadPattern) : stringPayloadPattern , Pattern.MULTILINE); } }
Source:
<code>private void emitStaticOverloads(String propName, ObjectType objType, JSType propertyType) { if (!objType.isFunctionType()) { return; } ObjectType superType = getSuperType((FunctionType) objType); if (superType == null || superType.getConstructor() == null) { return; } <START> superType = superType.getConstructor(); <END> if (!superType.hasProperty(propName)) { return; } JSType superPropType = superType.getPropertyType(propName); if (!superPropType.equals(propertyType)) { emit(" "); emitBreak(); visitProperty(propName, superType, true); } }</code><technical_language>This closure API is odd, a new var superTypeCtor</technical_language>

Target:
private void emitStaticOverloads(String propName, ObjectType objType, JSType propertyType) { if (!objType.isFunctionType()) { return; } ObjectType superType = getSuperType((FunctionType) objType); if (superType == null || superType.getConstructor() == null) { return; } FunctionType superTypeCtor = superType.getConstructor(); if (!superTypeCtor.hasProperty(propName)) { return; } JSType superPropType = superTypeCtor.getPropertyType(propName); if (!superPropType.equals(propertyType)) { if (!propertyType.isFunctionType() || !superPropType.isFunctionType()) { throw new IllegalArgumentException("Found a statically declared field that does not match" + "the type of a parent field with the same name, which is illegal in TypeScript.\n" + "at " + objType.getDisplayName() + "." + propName); } emit(" "); emitBreak(); visitProperty(propName, superTypeCtor, true); } }
Source:
<code><START> public void setContactId(String contactId) { <END> this.contactId = contactId; }</code><technical_language>@lorobode update setters builder pattern return LinkedContact object</technical_language>

Target:
public LinkedContact setContactId(String contactId) { this.contactId = contactId; return this; }
Source:
<code>public void checkAttributeSemantics(PerunSessionImpl sess, User user, Attribute attribute) throws InternalErrorException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { <START> Utils.notNull(attribute, "attribute"); <END> try { Attribute a = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, VSUP_NAMESPACE); if (!Objects.equals(attribute.getValue(),a.getValue())) { throw new WrongReferenceAttributeValueException(attribute, a, user, null, user, null, "Eduroam login must match VŠUP login "+a.getValue()); } } catch (AttributeNotExistsException ex) { throw new ConsistencyErrorException("Login namespace attribute for VŠUP must exists.", ex); } super.checkAttributeSemantics(sess, user, attribute); }</code><technical_language>is here. Object attribute null</technical_language>

Target:
public void checkAttributeSemantics(PerunSessionImpl sess, User user, Attribute attribute) throws InternalErrorException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { try { Attribute a = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, VSUP_NAMESPACE); if (!Objects.equals(attribute.getValue(),a.getValue())) { throw new WrongReferenceAttributeValueException(attribute, a, user, null, user, null, "Eduroam login must match VŠUP login "+a.getValue()); } } catch (AttributeNotExistsException ex) { throw new ConsistencyErrorException("Login namespace attribute for VŠUP must exists.", ex); } super.checkAttributeSemantics(sess, user, attribute); }
Source:
<code>public void onActivityCreated(Bundle savedInstanceState) { Log_OC.i(TAG, "onActivityCreated() start"); super.onActivityCreated(savedInstanceState); mDirectory = mContainerActivity.getCurrentFolder(); mAdapter = new LocalFileListAdapter(mDirectory, isShowingJustFolders(), getActivity()); setListAdapter(mAdapter); if (savedInstanceState != null) { mAdapter.setCheckedFiles(savedInstanceState.getStringArrayList(OUT_STATE_CHECKED_FILES)); mNoOfFilesSelected = savedInstanceState.getIntegerArrayList(OUT_STATE_NO_OF_FILES_SELECTED); } else{ <START> mNoOfFilesSelected = new ArrayList<Integer>(); <END> } Log_OC.i(TAG, "onActivityCreated() stop"); }</code><technical_language>do need Integer here, write <></technical_language>

Target:
public void onActivityCreated(Bundle savedInstanceState) { Log_OC.i(TAG, "onActivityCreated() start"); super.onActivityCreated(savedInstanceState); mDirectory = mContainerActivity.getCurrentFolder(); mAdapter = new LocalFileListAdapter(mDirectory, isShowingJustFolders(), getActivity()); setListAdapter(mAdapter); if (savedInstanceState != null) { mAdapter.setCheckedFiles(savedInstanceState.getStringArrayList(OUT_STATE_CHECKED_FILES)); mNoOfFilesSelected = savedInstanceState.getIntegerArrayList(OUT_STATE_NO_OF_FILES_SELECTED); } else { mNoOfFilesSelected = new ArrayList<>(); } Log_OC.i(TAG, "onActivityCreated() stop"); }
Source:
<code>protected ResourceResponse createResourceResponse(Attributes attributes, Path path) { try { if (path == null) { throw new WicketRuntimeException( "Please override #newResourceResponse() and provide a path if using a constructor which doesn't take one as argument."); } this.path = path; long size = getSize(); ResourceResponse resourceResponse = new ResourceResponse(); resourceResponse.setContentType(getMimeType()); resourceResponse.setAcceptRange(ContentRangeType.BYTES); resourceResponse.setContentLength(size); <START> if (path != null && path.getFileName() != null) { <END> resourceResponse.setFileName(path.getFileName().toString()); } RequestCycle cycle = RequestCycle.get(); Long startbyte = cycle.getMetaData(CONTENT_RANGE_STARTBYTE); Long endbyte = cycle.getMetaData(CONTENT_RANGE_ENDBYTE); resourceResponse.setWriteCallback( new PartWriterCallback(getInputStream(), size, startbyte, endbyte)); return resourceResponse; } catch (IOException e) { throw new WicketRuntimeException( "An error occurred while processing the media resource response", e); } }</code><technical_language>I need check *path != null* is checked (and a WicketRuntimeException is thrown if is null) - else good</technical_language>

Target:
protected ResourceResponse createResourceResponse(Attributes attributes, Path path) { try { if (path == null) { throw new WicketRuntimeException( "Please override #newResourceResponse() and provide a path if using a constructor which doesn't take one as argument."); } this.path = path; long size = getSize(); ResourceResponse resourceResponse = new ResourceResponse(); resourceResponse.setContentType(getMimeType()); resourceResponse.setAcceptRange(ContentRangeType.BYTES); resourceResponse.setContentLength(size); if (path.getFileName() != null) { resourceResponse.setFileName(path.getFileName().toString()); } RequestCycle cycle = RequestCycle.get(); Long startbyte = cycle.getMetaData(CONTENT_RANGE_STARTBYTE); Long endbyte = cycle.getMetaData(CONTENT_RANGE_ENDBYTE); resourceResponse.setWriteCallback( new PartWriterCallback(getInputStream(), size, startbyte, endbyte)); return resourceResponse; } catch (IOException e) { throw new WicketRuntimeException( "An error occurred while processing the media resource response", e); } }
Source:
<code><START> public Boolean getHighlyAvailableLocalMaintenance() { <END> return this.mVdsStatistics.getHighlyAvailableLocalMaintenance(); }</code><technical_language>is a special reason wrapped classes</technical_language>

Target:
public boolean getHighlyAvailableLocalMaintenance() { return this.mVdsStatistics.getHighlyAvailableLocalMaintenance(); }
Source:
<code>public short getShort(int col) { <START> return col == 2 ? columnNumber : col == 6 ? getTypeSize() : 0; <END> }</code><technical_language>sparse arrays shortValues, populate in next() dereference column index</technical_language>

Target:
public short getShort(int col) { return shortValues[col]; }
Source:
<code>public void testCompartmentMappingsRecursion() throws Exception { Diagnostician diagnostician = new Diagnostician(); Diagnostic diagnostic = null; DDiagram representation = getRepresentation(VERTICAL_STACK); <START> ContainerMapping parentMapping = getContainerMapping(representation); final ContainerMapping containerMapping = parentMapping.getAllContainerMappings().get(0); <END> changeChildrenPresentation(containerMapping, ContainerLayout.VERTICAL_STACK); diagnostic = diagnostician.validate(modeler); assertEquals("The VSM is not valid, a compartment should not contain a vertical stack container", Diagnostic.ERROR, diagnostic.getSeverity()); undo(); changeChildrenPresentation(containerMapping, ContainerLayout.HORIZONTAL_STACK); diagnostic = diagnostician.validate(modeler); assertEquals("The VSM is not valid, a compartment should not contain a horizontal stack container", Diagnostic.ERROR, diagnostic.getSeverity()); }</code><technical_language>regionContainerMapping regionMapping check parent mapping is in stack mode</technical_language>

Target:
public void testCompartmentMappingsRecursion() throws Exception { Diagnostician diagnostician = new Diagnostician(); Diagnostic diagnostic = null; DDiagram representation = getRepresentation(VERTICAL_STACK); ContainerMapping regionContainerMapping = getContainerMapping(representation); assertEquals("The '" + regionContainerMapping.getName() + "' should displays its children in vertical stack", ContainerLayout.VERTICAL_STACK, regionContainerMapping.getChildrenPresentation()); final ContainerMapping regionMapping = regionContainerMapping.getAllContainerMappings().get(0); changeChildrenPresentation(regionMapping, ContainerLayout.VERTICAL_STACK); diagnostic = diagnostician.validate(modeler); assertEquals("The VSM is not valid, a region container mapping should not contain another region container mapping", Diagnostic.ERROR, diagnostic.getSeverity()); undo(); changeChildrenPresentation(regionMapping, ContainerLayout.HORIZONTAL_STACK); diagnostic = diagnostician.validate(modeler); assertEquals("The VSM is not valid, a region container mapping should not contain another region container mapping", Diagnostic.ERROR, diagnostic.getSeverity()); }
Source:
<code>protected String getRegkeyFromRequest() { String regkey = getRequestParamValue(Const.ParamsNames.REGKEY); if (regkey == null) { return getRequestParamValue(Const.ParamsNames.REGKEY_LEGACY); } else { <START> log.severe("TEAMMATES accessed using old join link"); <END> return regkey; } }</code><technical_language>log.severe in other branch</technical_language>

Target:
protected String getRegkeyFromRequest() { String regkey = getRequestParamValue(Const.ParamsNames.REGKEY); if (regkey == null) { log.severe("TEAMMATES accessed using old join link"); return getRequestParamValue(Const.ParamsNames.REGKEY_LEGACY); } else { return regkey; } }
Source:
<code>protected <S> S post(String url, Object object, Class<S> clazz) { <START> String json = null; <END> try { json = mapper.writeValueAsString(object); } catch (JsonProcessingException e) { String message = String.format("Could not process %s: %s", object.getClass().getSimpleName(), object.toString()); throw new BridgeSDKException(message, e); } HttpResponse response = post(url, json); return getResponseBodyAsType(response, clazz); }</code><technical_language>Minor: need initialize json null. avoid initializing json null accidentally send null json server</technical_language>

Target:
protected <S> S post(String url, Object object, Class<S> clazz) { try { String json = mapper.writeValueAsString(object); HttpResponse response = post(url, json); return getResponseBodyAsType(response, clazz); } catch (JsonProcessingException e) { String message = String.format("Could not process %s: %s", object.getClass().getSimpleName(), object.toString()); throw new BridgeSDKException(message, e); } }
Source:
<code><START> private Collection<PatchLineComment> addCommentsInFile( <END> Collection<PatchLineComment> commentsOnFile, Collection<PatchLineComment> allComments, String file) { for (PatchLineComment c : allComments) { String currentFilename = c.getKey().getParentKey().getFileName(); if (currentFilename.equals(file)) { commentsOnFile.add(c); } } return commentsOnFile; }</code><technical_language>static, order public methods</technical_language>

Target:
private static Collection<PatchLineComment> addCommentsInFile( Collection<PatchLineComment> commentsOnFile, Collection<PatchLineComment> allComments, String file) { for (PatchLineComment c : allComments) { String currentFilename = c.getKey().getParentKey().getFileName(); if (currentFilename.equals(file)) { commentsOnFile.add(c); } } return commentsOnFile; }
Source:
<code>private boolean isTooLarge(BigDecimal value) { BigDecimal scaled = value.multiply( scalingFactor ); return ( scaled.compareTo( BigDecimal.valueOf( Long.MAX_VALUE ) ) > 0 || <START> scaled.compareTo( BigDecimal.valueOf( Long.MIN_VALUE ) ) < 0 <END> ); }</code><technical_language>put BigDecimal.valueOf( Long.MAX_VALUE ) BigDecimal.valueOf( Long.MIN_VALUE ) in constants instead of computing for call of this method</technical_language>

Target:
private boolean isTooLarge(BigDecimal value) { BigDecimal scaled = value.multiply( scalingFactor ); return ( scaled.compareTo( NumberScaleConstants.MIN_LONG_AS_BIGDECIMAL ) < 0 || scaled.compareTo( NumberScaleConstants.MAX_LONG_AS_BIGDECIMAL ) > 0 ); }
Source:
<code>public void install(String extensionId) { Extension ext = getExtension(extensionId, null); if (ext instanceof MarketplaceExtension && !ext.isInstalled()) { MarketplaceExtension mpExt = (MarketplaceExtension) ext; String type = getType(extensionId); switch (type) { case "ruletemplate": String url = mpExt.getDownloadUrl(); try { String template = getTemplate(url); marketplaceRuleTemplateProvider.addTemplateAsJSON(extensionId, template); } catch (ParsingException e) { postFailureEvent(extensionId, "Template is not valid."); logger.error("Rule template from marketplace is invalid: {}", e.getMessage()); } catch (IOException e) { postFailureEvent(extensionId, "Template cannot be downloaded."); logger.error("Rule template from marketplace cannot be downloaded: {}", e.getMessage()); } break; default: <START> postFailureEvent(extensionId, "Id not known."); <END> } postInstalledEvent(extensionId); } }</code><technical_language>A break (also for statement) nice</technical_language>

Target:
public void install(String extensionId) { Extension ext = getExtension(extensionId, null); if (ext instanceof MarketplaceExtension) { MarketplaceExtension mpExt = (MarketplaceExtension) ext; for (MarketplaceExtensionHandler handler : extensionHandlers) { if (handler.supports(mpExt)) { if (!handler.isInstalled(mpExt)) { try { handler.install(mpExt); postInstalledEvent(extensionId); } catch (MarketplaceHandlerException e) { postFailureEvent(extensionId, e.getMessage()); } } else { postFailureEvent(extensionId, "Extension is already installed."); } return; } } } postFailureEvent(extensionId, "Extension not known."); }
Source:
<code>public void testSatisfiedNetworkRequestDoesNotTriggerOnUnavailable() { NetworkRequest nr = new NetworkRequest.Builder().addTransportType( NetworkCapabilities.TRANSPORT_WIFI).build(); final TestNetworkCallback networkCallback = new TestNetworkCallback(); final int timeoutMs = 150; mCm.requestNetwork(nr, networkCallback, timeoutMs); mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI); mWiFiNetworkAgent.connect(false); networkCallback.expectAvailableCallbacks(mWiFiNetworkAgent, false, false, <START> timeoutMs + TEST_CALLBACK_TIMEOUT_MS); <END> networkCallback.assertNoCallback(); }</code><technical_language>timeoutMs ? forgotten switched constant. Is condition in this test 200 is enough</technical_language>

Target:
public void testSatisfiedNetworkRequestDoesNotTriggerOnUnavailable() { NetworkRequest nr = new NetworkRequest.Builder().addTransportType( NetworkCapabilities.TRANSPORT_WIFI).build(); final TestNetworkCallback networkCallback = new TestNetworkCallback(); final int timeoutMs = 150; mCm.requestNetwork(nr, networkCallback, timeoutMs); mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI); mWiFiNetworkAgent.connect(false); networkCallback.expectAvailableCallbacks(mWiFiNetworkAgent, false, false, TEST_CALLBACK_TIMEOUT_MS); networkCallback.assertNoCallback(); }
Source:
<code>public void close() throws Exception { if (tracerFactory != null) { tracerFactory.close(); } <START> if (transportFactories.production() <END> .isPresent()) { transportFactories.production() .get() .close(); } if (storages.production() .isPresent()) { storages.production() .get() .close(); } }</code><technical_language>elimitate repeating if (... .production().isPresent()) { ...} please introduce API EnvironmentDependantValue itself. I cases in this class</technical_language>

Target:
public void close() throws Exception { tracerFactory.ifPresentForEnvironment(Production.class, AutoCloseable::close); transportFactory.ifPresentForEnvironment(Production.class, AutoCloseable::close); storageFactory.ifPresentForEnvironment(Production.class, AutoCloseable::close); }
Source:
<code>List<MetricFamilySamples> fromMeter(String name, Meter meter) { return Arrays.asList( new MetricFamilySamples(name + "_total", Type.COUNTER, GENERIC_HELP_MESSAGE, Arrays.asList(new MetricFamilySamples.Sample(name + "_total", new ArrayList<String>(), new ArrayList<String>(), meter.getCount()))), <START> new MetricFamilySamples(name + "_1m_rate", Type.GAUGE, GENERIC_HELP_MESSAGE, <END> Arrays.asList(new MetricFamilySamples.Sample(name + "_1m_rate", new ArrayList<String>(), new ArrayList<String>(), meter.getOneMinuteRate()))), new MetricFamilySamples(name + "_5m_rate", Type.GAUGE, GENERIC_HELP_MESSAGE, Arrays.asList(new MetricFamilySamples.Sample(name + "_5m_rate", new ArrayList<String>(), new ArrayList<String>(), meter.getFiveMinuteRate()))), new MetricFamilySamples(name + "_15m_rate", Type.GAUGE, GENERIC_HELP_MESSAGE, Arrays.asList(new MetricFamilySamples.Sample(name + "_15m_rate", new ArrayList<String>(), new ArrayList<String>(), meter.getFifteenMinuteRate()))), new MetricFamilySamples(name + "_mean_rate", Type.GAUGE, GENERIC_HELP_MESSAGE, Arrays.asList(new MetricFamilySamples.Sample(name + "_mean_rate", new ArrayList<String>(), new ArrayList<String>(), meter.getMeanRate()))) ); }</code><technical_language>Drop rates, prometheus calculate total</technical_language>

Target:
List<MetricFamilySamples> fromMeter(String name, Meter meter) { return Arrays.asList( new MetricFamilySamples(name + "_total", Type.COUNTER, getHelpMessage(name, meter), Arrays.asList(new MetricFamilySamples.Sample(name + "_total", new ArrayList<String>(), new ArrayList<String>(), meter.getCount()))) ); }
Source:
<code>public void testLogErrorDoesntLogWhenNoAnnotation() throws Exception { Log log = mock(Log.class); <START> LoggedUtils.logError(log, "", new Object(), new Exception()); <END> }</code><technical_language>Need verify interactions log</technical_language>

Target:
public void testLogErrorDoesntLogWhenNoAnnotation() throws Exception { Log log = mock(Log.class); LoggedUtils.logError(log, "", new Object(), new Exception()); verifyZeroInteractions(log); }
Source:
<code>private Map<String, Integer> getSystemStatistics() { Map<String, Integer> res = new HashMap<String, Integer>(); int totalVMs = getTotalVMsStat(); int activeVMs = getActiveVMsStat(); int downVMs = (totalVMs - activeVMs) < 0 ? 0 : (totalVMs - activeVMs); int totalHosts = getTotalHostsStat(); int activeHosts = getActiveHostsStat(); int maintenanceHosts = getMaintenanceHostsStat(); int downHosts = <START> (totalHosts - activeHosts - maintenanceHosts) < 0 ? 0 : (totalHosts - activeHosts - maintenanceHosts); <END> int totalUsers = getTotalUsersStat(); int activeUsers = getActiveUsersStat(); int totalStorageDomains = getTotalStorageDomainsStat(); int activeStorageDomains = getActiveStorageDomainsStat(); res.put(QueryConstants.SYSTEM_STATS_TOTAL_VMS_FIELD, totalVMs); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_VMS_FIELD, activeVMs); res.put(QueryConstants.SYSTEM_STATS_DOWN_VMS_FIELD, downVMs); res.put(QueryConstants.SYSTEM_STATS_TOTAL_HOSTS_FIELD, totalHosts); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_HOSTS_FIELD, activeHosts); res.put(QueryConstants.SYSTEM_STATS_MAINTENANCE_HOSTS_FIELD, maintenanceHosts); res.put(QueryConstants.SYSTEM_STATS_DOWN_HOSTS_FIELD, downHosts); res.put(QueryConstants.SYSTEM_STATS_TOTAL_USERS_FIELD, totalUsers); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_USERS_FIELD, activeUsers); res.put(QueryConstants.SYSTEM_STATS_TOTAL_STORAGE_DOMAINS_FIELD, totalStorageDomains); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_STORAGE_DOMAINS_FIELD, activeStorageDomains); return res; }</code><technical_language>a bit long. assign ? : left parameter. a suggestion</technical_language>

Target:
private Map<String, Integer> getSystemStatistics() { Map<String, Integer> res = new HashMap<String, Integer>(); int totalVMs = getTotalVMsStat(); int activeVMs = getActiveVMsStat(); int downVMs = (totalVMs - activeVMs) < 0 ? 0 : (totalVMs - activeVMs); int totalHosts = getTotalHostsStat(); int activeHosts = getActiveHostsStat(); int maintenanceHosts = getMaintenanceHostsStat(); int downHosts = (totalHosts - activeHosts - maintenanceHosts) < 0 ? 0 : (totalHosts - activeHosts - maintenanceHosts); res.put(QueryConstants.SYSTEM_STATS_TOTAL_VMS_FIELD, totalVMs); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_VMS_FIELD, activeVMs); res.put(QueryConstants.SYSTEM_STATS_DOWN_VMS_FIELD, downVMs); res.put(QueryConstants.SYSTEM_STATS_TOTAL_HOSTS_FIELD, totalHosts); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_HOSTS_FIELD, activeHosts); res.put(QueryConstants.SYSTEM_STATS_MAINTENANCE_HOSTS_FIELD, maintenanceHosts); res.put(QueryConstants.SYSTEM_STATS_DOWN_HOSTS_FIELD, downHosts); res.put(QueryConstants.SYSTEM_STATS_TOTAL_USERS_FIELD, getTotalUsersStat()); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_USERS_FIELD, getActiveUsersStat()); res.put(QueryConstants.SYSTEM_STATS_TOTAL_STORAGE_DOMAINS_FIELD, getTotalStorageDomainsStat()); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_STORAGE_DOMAINS_FIELD, getActiveStorageDomainsStat()); return res; }
Source:
<code>public void onClose() { <START> scheduledExecutorService.shutdownNow(); <END> }</code><technical_language>I need flush too? is else account? good explicit test for this: - start a backend extremely high refresh time - send a write operation backend - verify index change is visible - close backend - verify changes stored</technical_language>

Target:
public void onClose() { scheduledExecutorService.shutdown(); }
Source:
<code>private void setPassphrase(String imei) { byte[] passphrase_string = imei.getBytes(); byte[] passphrase_salt = PASSPHRASE_SALT.getBytes(); byte[] input = new byte[passphrase_string.length + passphrase_salt.length]; System.arraycopy(passphrase_string, 0, input, 0, passphrase_string.length); System.arraycopy(passphrase_salt, 0, input, passphrase_string.length, passphrase_salt.length); MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e1) { Log.e(TAG, "Error initializing SHA1 message digest"); } <START> byte[] result_byte = md.digest(input); <END> passphrase = new String(result_byte); }</code><technical_language>@orhan89 I guess md.digest((imei+PASSPHRASE_SALT).getBytes()) works? is SHA-1 good enough do need a stronger encryption? UPDATE: SHA-256</technical_language>

Target:
private void setPassphrase(String imei) { String salt = sMainPrefs.getString(Advanced.ENCRYPT_DATABASE_SALT, DEFAULT_PASSPHRASE_SALT); MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e1) { Log.e(TAG, "Error initializing SHA-1 message digest"); } byte[] result_byte = md.digest((imei+salt).getBytes()); passphrase = new String(result_byte); }
Source:
<code>public void testMetricsFromClippedOverhangs() throws IOException { final File input = new File(TEST_DATA_DIR, "namesorted.test.sam"); final File outfile = File.createTempFile("metrics", ".txt"); outfile.deleteOnExit(); final String[] args = new String[] { "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath() }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics, Comparable<?>> output = new MetricsFile<CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics, Comparable<?>>(); output.read(new FileReader(outfile)); for (final CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics metrics : output.getMetrics()) { final boolean isRaw = metrics.TYPE == CollectWgsMetricsFromQuerySorted.METRICS_TYPE.RAW; Assert.assertEquals(metrics.TOTAL_BASES, 606); Assert.assertEquals(metrics.TOTAL_PASSING_BASES, isRaw ? 238 : 200); Assert.assertEquals(metrics.PCT_EXC_OVERLAP, isRaw ? 0.085809 : 0.013201); <START> Assert.assertEquals(metrics.PCT_EXC_BASEQ, isRaw ? 0.188119 : 0.156766); END> Assert.assertEquals(metrics.PCT_EXC_MAPQ, isRaw ? 0.0 : 0.166667); Assert.assertEquals(metrics.PCT_EXC_DUPE, 0.333333); Assert.assertEquals(metrics.TOTAL_READ_PAIRS, 3); Assert.assertEquals(metrics.TOTAL_DUPE_PAIRS, 1); Assert.assertEquals(metrics.TOTAL_ORIENTED_PAIRS, 2); Assert.assertEquals(metrics.MEAN_INSERT_SIZE, 118.0); } }</code><technical_language>mapping quality affect denominator</technical_language>

Target:
public void testMetricsFromClippedOverhangs() throws IOException { final File input = new File(TEST_DATA_DIR, "namesorted.test.sam"); final File outfile = File.createTempFile("metrics", ".txt"); outfile.deleteOnExit(); final String[] args = new String[] { "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath() }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics, Comparable<?>> output = new MetricsFile<CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics, Comparable<?>>(); output.read(new FileReader(outfile)); for (final CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics metrics : output.getMetrics()) { final boolean isRaw = metrics.TYPE == CollectWgsMetricsFromQuerySorted.FILTERING_STRINGENCY.RAW; Assert.assertEquals(metrics.TOTAL_BASES, 606); Assert.assertEquals(metrics.TOTAL_PASSING_BASES, isRaw ? 238 : 200); Assert.assertEquals(metrics.PCT_EXC_OVERLAP, isRaw ? 0.085809 : 0.013201); Assert.assertEquals(metrics.PCT_EXC_BASEQ, isRaw ? 0.188119 : 0.156766); Assert.assertEquals(metrics.PCT_EXC_MAPQ, isRaw ? 0.0 : 0.166667); Assert.assertEquals(metrics.PCT_EXC_DUPE, 0.333333); Assert.assertEquals(metrics.TOTAL_READ_PAIRS, 3); Assert.assertEquals(metrics.TOTAL_DUPE_PAIRS, 1); Assert.assertEquals(metrics.TOTAL_ORIENTED_PAIRS, 2); Assert.assertEquals(metrics.MEAN_INSERT_SIZE, 118.0); } }
Source:
<code>public Mono<Void> fireAndForget(Payload payload) { try { if (leaseHandler != null) { MissingLeaseException leaseError = leaseHandler.useLease(); if (leaseError != null) { <START> return Mono.error(leaseError); <END> } } return requestHandler.fireAndForget(payload); } catch (Throwable t) { return Mono.error(t); } }</code><technical_language>need release payload</technical_language>

Target:
public Mono<Void> fireAndForget(Payload payload) { try { if (leaseHandler.useLease()) { return requestHandler.fireAndForget(payload); } else { payload.release(); return Mono.error(leaseHandler.leaseError()); } } catch (Throwable t) { return Mono.error(t); } }