auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void initGraphicsForVisibleAndInvisibleElements(IFigure figure, Graphics graphics, View correspondingView) { try { graphics.pushState(); ViewQuery viewQuery = new ViewQuery(correspondingView); if (figure instanceof SiriusWrapLabel) { EObject element = correspondingView.getElement(); if (element instanceof DDiagramElement) { EList<GraphicalFilter> graphicalFilters = ((DDiagramElement) element).getGraphicalFilters(); boolean isLabelFiltered = graphicalFilters.stream().anyMatch(HideLabelFilter.class::isInstance) || graphicalFilters.stream().anyMatch(HideFilter.class::isInstance) || (correspondingView instanceof Edge && !((DDiagramElement) correspondingView.getElement()).isVisible()); if (isLabelFiltered && viewQuery.isInShowingMode()) { graphics.setAlpha(50); } } } else if (figure.isVisible() != correspondingView.isVisible() && viewQuery.isInShowingMode()) { graphics.setAlpha(50); } } catch (IllegalStateException e) { System.out.println("initGraphicsForVisibleAndInvisibleElements"); } }

Target:
public static void initGraphicsForVisibleAndInvisibleElements(IFigure figure, Graphics graphics, View correspondingView) { try { graphics.pushState(); ViewQuery viewQuery = new ViewQuery(correspondingView); if (figure instanceof SiriusWrapLabel) { EObject element = correspondingView.getElement(); if (element instanceof DDiagramElement) { EList<GraphicalFilter> graphicalFilters = ((DDiagramElement) element).getGraphicalFilters(); boolean isLabelFiltered = graphicalFilters.stream().anyMatch(HideLabelFilter.class::isInstance) || graphicalFilters.stream().anyMatch(HideFilter.class::isInstance) || (correspondingView instanceof Edge && !((DDiagramElement) correspondingView.getElement()).isVisible()); if (isLabelFiltered && viewQuery.isInShowingMode()) { graphics.setAlpha(50); } } } else if (figure.isVisible() != correspondingView.isVisible() && viewQuery.isInShowingMode()) { graphics.setAlpha(50); } } catch (IllegalStateException e) { } }
Source:
protected void executeSave() { final AddNetworkWithSubnetParameters parameters = new AddNetworkWithSubnetParameters(getSelectedDc().getId(), getNetwork()); parameters.setVnicProfileRequired(false); parameters.setNetworkClusterList(createNetworkAttachments()); if (getExternal().getEntity()) { Provider<?> externalProvider = getExternalProviders().getSelectedItem(); ProviderNetwork providerNetwork = new ProviderNetwork(); providerNetwork.setProviderId(externalProvider.getId()); getNetwork().setProvidedBy(providerNetwork); if (hasDefinedSubnet()) { getSubnetModel().flush(); parameters.setExternalSubnet(getSubnetModel().getSubnet()); } if (getConnectedToPhysicalNetwork().getEntity() && getUsePhysicalNetworkFromDatacenter().getEntity()) { Network network = getDatacenterPhysicalNetwork().getSelectedItem(); providerNetwork.setPhysicalNetworkId(network.getId()); } else { providerNetwork.setCustomPhysicalNetworkName(getCustomPhysicalNetwork().getEntity()); providerNetwork.setExternalVlanId(getVLanTag().getEntity()); } Frontend.getInstance().runAction( hasDefinedSubnet() ? ActionType.AddNetworkWithSubnetOnProvider : ActionType.AddNetworkOnProvider, parameters, addNetworkCallback(), null); } else { Frontend.getInstance().runAction(ActionType.AddNetwork, parameters, addNetworkCallback(), null); } }

Target:
protected void executeSave() { final AddNetworkWithSubnetParameters parameters = new AddNetworkWithSubnetParameters(getSelectedDc().getId(), getNetwork()); parameters.setVnicProfileRequired(false); parameters.setNetworkClusterList(createNetworkAttachments()); if (getExternal().getEntity()) { Provider<?> externalProvider = getExternalProviders().getSelectedItem(); ProviderNetwork providerNetwork = new ProviderNetwork(); providerNetwork.setProviderId(externalProvider.getId()); getNetwork().setProvidedBy(providerNetwork); if (hasDefinedSubnet()) { getSubnetModel().flush(); parameters.setExternalSubnet(getSubnetModel().getSubnet()); } if (getConnectedToPhysicalNetwork().getEntity() && getUsePhysicalNetworkFromDatacenter().getEntity()) { Network network = getDatacenterPhysicalNetwork().getSelectedItem(); providerNetwork.setPhysicalNetworkId(network.getId()); } else if (getConnectedToPhysicalNetwork().getEntity() && getUsePhysicalNetworkFromCustom().getEntity()) { providerNetwork.setCustomPhysicalNetworkName(getCustomPhysicalNetwork().getEntity()); providerNetwork.setExternalVlanId(getVLanTag().getEntity()); } Frontend.getInstance().runAction( hasDefinedSubnet() ? ActionType.AddNetworkWithSubnetOnProvider : ActionType.AddNetworkOnProvider, parameters, addNetworkCallback(), null); } else { Frontend.getInstance().runAction(ActionType.AddNetwork, parameters, addNetworkCallback(), null); } }
Source:
public void testSetIPv4() throws CapabilityException, ProtocolException { ipCapability.setIPv4(getLogicalPort()); queueCapability.execute(); }

Target:
public void testSetIPv4() throws CapabilityException, ProtocolException { ipCapability.setIPv4(getLogicalPort(), getIPProtocolEndPoint()); queueCapability.execute(); }
Source:
private BigtableDataClient initializeDataClient() throws IOException { Channel channel = createChannel(options.getDataHost(), options.getChannelCount()); RetryOptions retryOptions = options.getRetryOptions(); return new BigtableDataGrpcClient(channel, batchPool, retryOptions, ClientCallService.DEFAULT); }

Target:
private BigtableDataClient initializeDataClient() throws IOException { Channel channel = createChannel(options.getDataHost(), options.getChannelCount()); RetryOptions retryOptions = options.getRetryOptions(); return new BigtableDataGrpcClient(channel, batchPool, retryOptions); }
Source:
public void validate(final Environment env) throws ValidationException { try { for (final File file : env.files("*.xml")) { final String name = file.getAbsolutePath().substring( env.basedir().toString().length() ); if (env.exclude("xml", name)) { Logger.info(this, "%s: skipped", name); continue; } Logger.info(this, "%s: to be validated", name); final XML document = new XMLDocument(file); final List<String> schemas = document .xpath("/*/@xsi:schemaLocation"); if (schemas.isEmpty()) { throw new ValidationException( String.format( "XML validation exception: missing schema in %s", name ) ); } else { try { new StrictXML( document, new XSDDocument( URI.create( StringUtils.substringAfter( schemas.get(0), " " ) ).toURL() ) ); } catch (final IllegalStateException ex) { if (ex.getCause() != null && ex.getCause() instanceof SAXException) { this.warn(name, schemas.get(0), ex); } } } } } catch (final IOException ex) { throw new IllegalStateException(ex); } }

Target:
public void validate(final Environment env) throws ValidationException { try { for (final File file : env.files("*.xml")) { final String name = file.getAbsolutePath().substring( env.basedir().toString().length() ); if (env.exclude("xml", name)) { Logger.info(this, "%s: skipped", name); continue; } Logger.info(this, "%s: to be validated", name); final XML document = new XMLDocument(file); final List<String> schemas = document .xpath("/*/@xsi:schemaLocation"); if (schemas.isEmpty()) { throw new ValidationException( String.format( "XML validation exception: missing schema in %s", name ) ); } else { final String schema = schemas.get(0); try { new StrictXML( document, new XSDDocument( URI.create( StringUtils.substringAfter(schema, " ") ).toURL() ) ); } catch (final IllegalStateException ex) { if (ex.getCause() != null && ex.getCause() instanceof SAXException) { Logger.warn( this, "Failed to validate file %s against schema %s. Cause: %s", name, schema, ex.toString() ); } } } } } catch (final IOException ex) { throw new IllegalStateException(ex); } }
Source:
public Map<String, String> parseMessage(String message) { Map<String,String> dlr = new HashMap<String, String>(); final String idTag = "id:"; final String submitTag = "submit date:"; final String doneTag = "done date:"; final String statTag = "stat:"; final int idStartPos = message.indexOf(idTag)+idTag.length(); final int submitStartPos = message.indexOf(submitTag)+submitTag.length(); final int doneStartPos = message.indexOf(doneTag)+doneTag.length(); final int statStartPos = message.indexOf(statTag)+statTag.length(); final int idEndPos = message.indexOf(" ",idStartPos); final int submitEndPos = message.indexOf(" ",submitStartPos); final int doneEndPos = message.indexOf(" ",doneStartPos); final int statEndPos = message.indexOf(" ",statStartPos); final String messageId = message.substring(idStartPos, idEndPos); final String submit_date = message.substring(submitStartPos, submitEndPos); final String done_date = message.substring(doneStartPos, doneEndPos); final String stat = message.substring(statStartPos, statEndPos); dlr.put("id", messageId); dlr.put("submit_date", submit_date); dlr.put("sent_date", done_date); dlr.put("status", stat); return dlr; }

Target:
public DLRPayload parseMessage(String message) { DLRPayload dlr = new DLRPayload(); final String messageId = parseTagValue(message, ID_TAG); dlr.setId(messageId); final String submit_date = parseTagValue(message, SUBMIT_TAG); DateTime parsedDate = parseDate(submit_date); dlr.setSubmitDate(parsedDate); final String done_date = parseTagValue(message, DONE_TAG); DateTime doneDate = parseDate(done_date); dlr.setDoneDate(doneDate); final String stat = parseTagValue(message, STAT_TAG); Status parsedStatus = parseRestcommStatus(stat); dlr.setStat(parsedStatus); final String err = parseTagValue(message, ERR_TAG); dlr.setErr(err); final String sub = parseTagValue(message, SUB_TAG); dlr.setSub(sub); final String dlv = parseTagValue(message, DLVRD_TAG); dlr.setDlvrd(dlv); if (logger.isDebugEnabled()) { logger.debug("Parsed DLR is:" + dlr); } return dlr; }
Source:
public void testUnmarshalSeralizedObjectEmpty() throws Exception { AttributeAdapter attributeAdapter = getObjectAttributeAdapter(); Attribute attribute = new AttributeImpl("sampleAttr", Collections.emptyList()); AbstractAttributeType abstractAttributeType = attributeAdapter.marshal(attribute); Attribute result = attributeAdapter.unmarshal(abstractAttributeType); assertThat("Null attribute not returned.", result == null); }

Target:
public void testUnmarshalSeralizedObjectEmpty() throws Exception { AttributeAdapter attributeAdapter = getObjectAttributeAdapter(); Attribute attribute = new AttributeImpl("sampleAttr", Collections.emptyList()); AbstractAttributeType abstractAttributeType = attributeAdapter.marshal(attribute); Attribute result = attributeAdapter.unmarshal(abstractAttributeType); assertThat("Null attribute not returned.", result, is(Matchers.nullValue())); }
Source:
public final void check(Cache<Object, Object> cache, Object key, String cacheAddress) { DataContainer dataContainer = cache.getAdvancedCache().getDataContainer(); if (this == REMOVE || this == CONDITIONAL_REMOVE) { assertFalse("Key was not removed in '" + cacheAddress + "'!", dataContainer.containsKey(key)); } else { assertTrue("Cache '" + cacheAddress + "' does not contains key!", dataContainer.containsKey(key)); InternalCacheEntry entry = dataContainer.get(key); assertNotNull("Cache '" + cacheAddress + "' does not contains entry!", entry); assertEquals("Cache '" + cacheAddress + "' has wrong value!", FINAL_VALUE, entry.getValue()); } }

Target:
public final void check(Cache<Object, Object> cache, Object key, String cacheAddress) { DataContainer dataContainer = cache.getAdvancedCache().getDataContainer(); if (this == REMOVE || this == CONDITIONAL_REMOVE) { assertFalse("Key was not removed in '" + cacheAddress + "'!", dataContainer.containsKey(key)); } else { InternalCacheEntry entry = dataContainer.get(key); assertNotNull("Cache '" + cacheAddress + "' does not contains entry!", entry); assertEquals("Cache '" + cacheAddress + "' has wrong value!", FINAL_VALUE, entry.getValue()); } }
Source:
public void testComplexListArrayElementResetWithNull() { DocumentModel doc = session.createDocumentModel("/", "mydoc", "MyDocType"); doc.setPropertyValue("complexlist", (Serializable) Collections.singletonList(Collections.singletonMap("array", new String[]{"foo"}))); doc = session.createDocument(doc); session.save(); doc.setPropertyValue("complexlist", (Serializable) Collections.singletonList(Collections.singletonMap("array", null))); doc = session.saveDocument(doc); session.save(); @SuppressWarnings("unchecked") List<Map<String, Serializable>> list = (List<Map<String, Serializable>>) doc.getPropertyValue("complexlist"); assertEquals(1, list.size()); Map<String, Serializable> map = list.get(0); Object[] array = (Object[]) map.get("array"); assertNull(array); }

Target:
public void testComplexListArrayElementResetWithNull() { DocumentModel doc = session.createDocumentModel("/", "mydoc", "MyDocType"); doc.setPropertyValue("complexlist", (Serializable) Arrays.asList(Collections.singletonMap("array", new String[] { "foo" }))); doc = session.createDocument(doc); session.save(); doc.setPropertyValue("complexlist", (Serializable) Arrays.asList(Collections.singletonMap("array", null))); doc = session.saveDocument(doc); session.save(); @SuppressWarnings("unchecked") List<Map<String, Serializable>> list = (List<Map<String, Serializable>>) doc.getPropertyValue("complexlist"); assertEquals(1, list.size()); Map<String, Serializable> map = list.get(0); Object[] array = (Object[]) map.get("array"); assertNull(array); }
Source:
private void initJobsService() { RxSession rxSession = new RxSessionImpl(session); jobsService = new JobsServiceImpl(); jobsService.setMetricsService(metricsService); jobsService.setSession(rxSession); if (schedulerMode.equals("test")) { scheduler = new TestScheduler(rxSession); } else { scheduler = new SchedulerImpl(rxSession); } jobsService.setScheduler(scheduler); jobsService.start(); }

Target:
private void initJobsService() { RxSession rxSession = new RxSessionImpl(session); jobsService = new JobsServiceImpl(); jobsService.setMetricsService(metricsService); jobsService.setSession(rxSession); scheduler = new JobSchedulerFactory().getJobScheduler(rxSession); jobsService.setScheduler(scheduler); jobsService.start(); }
Source:
public boolean isValid(VdsNetworkInterface iface, ConstraintValidatorContext context) { NetworkBootProtocol bootProtocol = iface.getBootProtocol(); String address = iface.getAddress(); if (bootProtocol != null && bootProtocol == STATIC_IP) { if (isNullOrEmpty(address)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("NETWORK_ADDR_MANDATORY_IN_STATIC_IP") .addNode("address").addConstraintViolation(); return false; } } if (!isEmpty(iface.getBondName()) && !validateSlave(iface)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("SLAVE_INTERFACE_IS_MISCONFIGURED").addConstraintViolation(); return false; } if (validateLabel(iface)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("IMPROPER_INTERFACE_IS_LABELED").addConstraintViolation(); } return true; }

Target:
public boolean isValid(VdsNetworkInterface iface, ConstraintValidatorContext context) { NetworkBootProtocol bootProtocol = iface.getBootProtocol(); String address = iface.getAddress(); if (bootProtocol != null && bootProtocol == STATIC_IP) { if (isNullOrEmpty(address)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("NETWORK_ADDR_MANDATORY_IN_STATIC_IP") .addNode("address").addConstraintViolation(); return false; } } if (!isEmpty(iface.getBondName()) && !validateSlave(iface)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("SLAVE_INTERFACE_IS_MISCONFIGURED").addConstraintViolation(); return false; } if (!validateLabel(iface)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("IMPROPER_INTERFACE_IS_LABELED").addConstraintViolation(); } return true; }
Source:
static void queryWithQueryOptions(DatabaseClient dbClient) { try (ResultSet resultSet = dbClient .singleUse() .executeQuery( Statement .newBuilder("SELECT SingerId, AlbumId, AlbumTitle FROM Albums") .withQueryOptions(QueryOptions.newBuilder().setOptimizerVersion("latest").build()) .build())) { while (resultSet.next()) { System.out.printf( "%d %d %s\n", resultSet.getLong(0), resultSet.getLong(1), resultSet.getString(2)); } } }

Target:
static void queryWithQueryOptions(DatabaseClient dbClient) { try (ResultSet resultSet = dbClient .singleUse() .executeQuery( Statement .newBuilder("SELECT SingerId, AlbumId, AlbumTitle FROM Albums") .withQueryOptions(QueryOptions.newBuilder().setOptimizerVersion("1").build()) .build())) { while (resultSet.next()) { System.out.printf( "%d %d %s\n", resultSet.getLong(0), resultSet.getLong(1), resultSet.getString(2)); } } }
Source:
private boolean isLegalParameterName(final String parameterName) { return !(parameterName.equals(NAME) || parameterName.equals(OP) || parameterName.equals(OP_ADDR) || parameterName.equals(OPERATION_HEADERS)); }

Target:
private boolean isLegalParameterName(final String parameterName) { return !(parameterName.equals(OP) || parameterName.equals(OP_ADDR) || parameterName.equals(OPERATION_HEADERS)); }
Source:
public void recoverWorkflowInstancesFromDeadNodes() { List<InstanceInfo> instances = jdbc.query( "select id, state from nflow_workflow where executor_id in (select id from nflow_executor where " + executorGroupCondition + " and id <> " + getExecutorId() + " and expires < current_timestamp)", new RowMapper<InstanceInfo>() { @Override public InstanceInfo mapRow(ResultSet rs, int rowNum) throws SQLException { InstanceInfo instance = new InstanceInfo(); instance.id = rs.getInt("id"); instance.state = rs.getString("state"); return instance; } }); for (InstanceInfo instance : instances) { workflowInstanceDao.recoverWorkflowInstance(instance); } }

Target:
public void recoverWorkflowInstancesFromDeadNodes() { List<InstanceInfo> instances = jdbc.query( "select id, state from nflow_workflow where executor_id in (select id from nflow_executor where " + executorGroupCondition + " and id <> " + getExecutorId() + " and expires < current_timestamp)", new RowMapper<InstanceInfo>() { @Override public InstanceInfo mapRow(ResultSet rs, int rowNum) throws SQLException { InstanceInfo instance = new InstanceInfo(); instance.id = rs.getInt("id"); instance.state = rs.getString("state"); return instance; } }); for (InstanceInfo instance : instances) { WorkflowInstanceAction action = new WorkflowInstanceAction.Builder().setExecutionStart(now()).setExecutionEnd(now()) .setType(recovery).setState(instance.state).setStateText("Recovered").setWorkflowInstanceId(instance.id).build(); workflowInstanceDao.recoverWorkflowInstance(instance.id, action); } }
Source:
public void test() throws InterruptedException { connect(); click(jq("@button").eq(0)); waitResponse(); assertEquals(jq(".z-button").outerHeight(), jq(".z-groupbox-content").height()); }

Target:
public void test() throws InterruptedException { connect(); JQuery btn = jq("@button").eq(0); click(btn); waitResponse(); assertEquals(btn.outerHeight(), jq(".z-groupbox-content").eq(0).height()); }
Source:
public void run(IAction action) { boolean performAction = MessageDialog.openConfirm(getShell(), "Discard Local Changes", "This will discard all local changes for the selected resources. Are you sure you want to do this ?"); if (performAction){ performDiscardChanges(); } }

Target:
public void run(IAction action) { boolean performAction = MessageDialog.openConfirm(getShell(), UIText.DiscardChangesAction_confirmActionTitle, UIText.DiscardChangesAction_confirmActionMessage); if (performAction){ performDiscardChanges(); } }
Source:
public final String generateUnusedStyle(final String commandId) { final Object[] existingImages = (Object[]) imagesById.get(commandId); if (existingImages == null) { return null; } final Set existingStyles = new HashSet(3); for (final Object styledImages : existingImages) { if (styledImages instanceof ImageDescriptor) { existingStyles.add(null); } else if (styledImages instanceof Map) { final Map styleMap = (Map) styledImages; existingStyles.addAll(styleMap.keySet()); } } if (!existingStyles.contains(null)) { return null; } StringBuilder generatedStyle = new StringBuilder("AUTOGEN:::"); int index = 0; while (existingStyles.contains(generatedStyle)) { generatedStyle.append((index++ % 10)); } return generatedStyle.toString(); }

Target:
public final String generateUnusedStyle(final String commandId) { final Object[] existingImages = (Object[]) imagesById.get(commandId); if (existingImages == null) { return null; } final Set existingStyles = new HashSet(3); for (final Object styledImages : existingImages) { if (styledImages instanceof ImageDescriptor) { existingStyles.add(null); } else if (styledImages instanceof Map) { final Map styleMap = (Map) styledImages; existingStyles.addAll(styleMap.keySet()); } } if (!existingStyles.contains(null)) { return null; } StringBuilder generatedStyle = new StringBuilder("AUTOGEN:::"); int index = 0; while (existingStyles.contains(generatedStyle)) { generatedStyle.append(index % 10); index++; } return generatedStyle.toString(); }
Source:
public List<IEventDeclaration> getEventDeclarations() { if( fEventUnsetId != null){ return ImmutableList.of(fEventUnsetId); } return fEvents; }

Target:
public List<IEventDeclaration> getEventDeclarations() { return ImmutableList.copyOf(fEvents); }
Source:
public boolean isReadOnly(ELContext elContext, @Nullable Object base, Object property) throws ELException { if (base == null) { String beanName = property.toString(); WebApplicationContext wac = getWebApplicationContext(elContext); return wac.containsBean(beanName); } return false; }

Target:
public boolean isReadOnly(ELContext elContext, @Nullable Object base, Object property) throws ELException { if (base == null) { String beanName = property.toString(); WebApplicationContext wac = getWebApplicationContext(elContext); if (wac.containsBean(beanName)) { return true; } } return false; }
Source:
private static void ttyCheck() { final Console console = System.console(); if(console != null) { System.out.println( "WARNING: Are you running agent.jar from an interactive console?\n" + "If so, you are probably using it incorrectly.\n" + "See <LINK_0>"); } }

Target:
private static void ttyCheck() { final Console console = System.console(); if(console != null) { System.out.println( "WARNING: Are you running agent from an interactive console?\n" + "If so, you are probably using it incorrectly.\n" + "See <LINK_1>"); } }
Source:
public void testProperties() { assertTrue(module instanceof TestStateSystemModule); TestStateSystemModule mod = (TestStateSystemModule) module; Map<String, String> properties = mod.getProperties(); assertEquals(mod.getBackendName() ,properties.get(Messages.TmfStateSystemAnalysisModule_PropertiesBackend)); }

Target:
public void testProperties() { assertTrue(module instanceof TestStateSystemModule); TestStateSystemModule mod = (TestStateSystemModule) module; Map<String, String> properties = mod.getProperties(); assertEquals(mod.getBackendName(), properties.get(Messages.TmfStateSystemAnalysisModule_PropertiesBackend)); assertEquals(mod.getId(), properties.get(org.eclipse.tracecompass.tmf.core.analysis.Messages.TmfAbstractAnalysisModule_LabelId)); }
Source:
public void testParsePartitionsFromFiles_wrong_type() { String root = "hdfs://host:123/partition_test/web_sales5/"; String[] spaths = { root + "c=3.14/ws_sold_date_sk=__HIVE_DEFAULT_PARTITION__/part-00780.c002.snappy.parquet", root + "c=3.14/ws_sold_date_sk=HELLO/part-00780.c002.snappy.parquet" }; Path basePath = new Path( "hdfs://host:123/partition_test/web_sales5/" ); HashSet<Path> basePaths = new HashSet<>(); basePaths.add(basePath); List<Path> files = Arrays.stream(spaths).map(Path::new).collect(toList()); StructType s = new StructType(); s = s.add("ws_sold_date_sk", DataTypes.DoubleType); try { com.splicemachine.spark.splicemachine.PartitionSpec ps = SparkExternalTableUtil.parsePartitionsFromFiles( files, true, basePaths, s,null); Assert.fail("no exception"); } catch(Exception e) { } }

Target:
public void testParsePartitionsFromFiles_wrong_type() { String root = "hdfs://host:123/partition_test/web_sales5/"; String[] spaths = { root + "c=3.14/ws_sold_date_sk=__HIVE_DEFAULT_PARTITION__/part-00780.c002.snappy.parquet", root + "c=3.14/ws_sold_date_sk=HELLO/part-00780.c002.snappy.parquet" }; Path basePath = new Path( "hdfs://host:123/partition_test/web_sales5/" ); HashSet<Path> basePaths = new HashSet<>(); basePaths.add(basePath); List<Path> files = Arrays.stream(spaths).map(Path::new).collect(toList()); StructType s = new StructType(); s = s.add("ws_sold_date_sk", DataTypes.DoubleType); try { SparkExternalTableUtil.parsePartitionsFromFiles(files, true, basePaths, s,null); Assert.fail("no exception"); } catch( Exception e) { Assert.assertEquals(e.toString(), "java.lang.IllegalArgumentException: Column ws_sold_date_sk is double, can't parse HELLO"); } }
Source:
public void should_ReturnNull_When_AnnotatedId() throws NoSuchMethodException { String error = explicitNullableTypeChecker .checkValueForAnnotatedElement(null, getClass().getMethod("methodWithIdAnnotation")); Assert.assertNull("Method with @Id annotation should allow null value", error); error = explicitNullableTypeChecker.checkValueForAnnotatedElement( 1l, getClass().getMethod("methodWithIdAnnotation")); Assert.assertNull("Method with @Id annotation should allow null value", error); }

Target:
public void should_ReturnNull_When_AnnotatedId() throws NoSuchMethodException { String error = explicitNullableTypeChecker .checkValueForAnnotatedElement(null, getClass().getMethod("methodWithIdAnnotation")); Assert.assertNull("Method with @Id annotation should allow null value", error); error = explicitNullableTypeChecker.checkValueForAnnotatedElement( 1l, getClass().getMethod("methodWithIdAnnotation")); Assert.assertNull("Method with @Id annotation should allow non-null value", error); }
Source:
public void initiate(ChannelHandlerContext ctx) throws Exception { loggerNet.debug("RLPX protocol activated"); nodeId = myKey.getNodeId(); handshake = new EncryptionHandshake(ECKey.fromNodeId(nodeId).getPubKeyPoint()); Object msg; if (config.eip8()) { AuthInitiateMessageV4 initiateMessage = handshake.createAuthInitiateV4(myKey); initiatePacket = handshake.encryptAuthInitiateV4(initiateMessage); msg = initiateMessage; } else { AuthInitiateMessage initiateMessage = handshake.createAuthInitiate(null, myKey); initiatePacket = handshake.encryptAuthMessage(initiateMessage); msg = initiateMessage; } final ByteBuf byteBufMsg = ctx.alloc().buffer(initiatePacket.length); byteBufMsg.writeBytes(initiatePacket); ctx.writeAndFlush(byteBufMsg).sync(); channel.getNodeStatistics().rlpxAuthMessagesSent.add(); if (loggerNet.isDebugEnabled()) loggerNet.debug("To: \t{} \tSend: \t{}", ctx.channel().remoteAddress(), msg); }

Target:
public void initiate(ChannelHandlerContext ctx) throws Exception { loggerNet.debug("RLPX protocol activated"); nodeId = myKey.getNodeId(); handshake = new EncryptionHandshake(ECKey.fromNodeId(this.remoteId).getPubKeyPoint()); Object msg; if (config.eip8()) { AuthInitiateMessageV4 initiateMessage = handshake.createAuthInitiateV4(myKey); initiatePacket = handshake.encryptAuthInitiateV4(initiateMessage); msg = initiateMessage; } else { AuthInitiateMessage initiateMessage = handshake.createAuthInitiate(null, myKey); initiatePacket = handshake.encryptAuthMessage(initiateMessage); msg = initiateMessage; } final ByteBuf byteBufMsg = ctx.alloc().buffer(initiatePacket.length); byteBufMsg.writeBytes(initiatePacket); ctx.writeAndFlush(byteBufMsg).sync(); channel.getNodeStatistics().rlpxAuthMessagesSent.add(); if (loggerNet.isDebugEnabled()) loggerNet.debug("To: \t{} \tSend: \t{}", ctx.channel().remoteAddress(), msg); }
Source:
private boolean isSupportedType(String type) { boolean supported = false; switch (type) { case "ear": case "war": case "rar": case "eba": case "esa": case "liberty-assembly": supported = true; break; case "jar": if (installThinProject) { supported = true; } break; default: break; } return supported; }

Target:
private boolean isSupportedType(String type) { boolean supported = false; switch (type) { case "ear": case "rar": case "eba": case "esa": case "liberty-assembly": if(installThinProject) { log.warn("thin-project cannot be configured for installAppPackages for the " + type + " packaging type"); } else { supported = true; } break; case "war": supported = true; break; case "jar": if (installThinProject) { supported = true; } break; default: break; } return supported; }
Source:
public void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ACTIVITY_REQUEST_DESCRIPTION_EDIT && resultCode == RESULT_OK) { FeedbackUtil.showMessage(this, data.getSerializableExtra(INTENT_EXTRA_ACTION) == ADD_CAPTION ? getString(R.string.description_edit_success_saved_image_caption_snackbar) : getString(R.string.description_edit_success_saved_image_caption_in_lang_snackbar, app.language().getAppLanguageLocalizedName(targetLanguageCode))); layOutGalleryDescription(); setResult(ACTIVITY_RESULT_IMAGE_CAPTION_ADDED); } if (requestCode == ACTIVITY_REQUEST_ADD_IMAGE_TAGS && resultCode == RESULT_OK) { FeedbackUtil.showMessage(this, getString(R.string.description_edit_success_saved_image_tags_snackbar)); layOutGalleryDescription(); setResult(ACTIVITY_RESULT_IMAGE_CAPTION_ADDED); } }

Target:
public void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if ((requestCode == ACTIVITY_REQUEST_DESCRIPTION_EDIT || requestCode == ACTIVITY_REQUEST_ADD_IMAGE_TAGS) && resultCode == RESULT_OK) { ABTestSuggestedEditsSnackbarFunnel abTestFunnel = new ABTestSuggestedEditsSnackbarFunnel(); DescriptionEditActivity.Action action = (data != null && data.hasExtra(INTENT_EXTRA_ACTION)) ? (DescriptionEditActivity.Action) data.getSerializableExtra(INTENT_EXTRA_ACTION) : (requestCode == ACTIVITY_REQUEST_ADD_IMAGE_TAGS) ? ADD_IMAGE_TAGS : null; Snackbar snackbar = FeedbackUtil.makeSnackbar(this, action == ADD_CAPTION ? getString(R.string.description_edit_success_saved_image_caption_snackbar) : (action == TRANSLATE_CAPTION) ? getString(R.string.description_edit_success_saved_image_caption_in_lang_snackbar, app.language().getAppLanguageLocalizedName(targetLanguageCode)) : getString(R.string.description_edit_success_saved_image_tags_snackbar), FeedbackUtil.LENGTH_DEFAULT); if (abTestFunnel.shouldSeeSnackbarAction() && action != null) { snackbar.setAction(R.string.suggested_edits_tasks_onboarding_get_started, view -> startActivity(SuggestionsActivity.newIntent(this, action))); } snackbar.show(); abTestFunnel.logSnackbarShown(); layOutGalleryDescription(); setResult((requestCode == ACTIVITY_REQUEST_DESCRIPTION_EDIT) ? ACTIVITY_RESULT_IMAGE_CAPTION_ADDED : ACTIVITY_REQUEST_ADD_IMAGE_TAGS); } }
Source:
public void redirectHomePage() { Helpers.running(Helpers.fakeApplication(), () -> { Result result = Helpers.route(application, controllers.routes.HomeController.index()); assertThat(result.status(), equalTo(Helpers.SEE_OTHER)); assertThat(result.redirectLocation(), equalTo("/computers")); }); }

Target:
public void redirectHomePage() { Result result = Helpers.route(application, controllers.routes.HomeController.index()); assertThat(result.status(), equalTo(Helpers.SEE_OTHER)); assertThat(result.redirectLocation().get(), equalTo("/computers")); }
Source:
public boolean equals(Object obj) { if(!(obj instanceof GlusterVolumeProfileInfo)) { return false; } GlusterVolumeProfileInfo profileInfo = (GlusterVolumeProfileInfo) obj; if(!ObjectUtils.objectsEqual(getVolumeId(), profileInfo.getVolumeId())){ return false; } return true; }

Target:
public boolean equals(Object obj) { if(!(obj instanceof GlusterVolumeProfileInfo)) { return false; } GlusterVolumeProfileInfo profileInfo = (GlusterVolumeProfileInfo) obj; if(!ObjectUtils.objectsEqual(getVolumeId(), profileInfo.getVolumeId())){ return false; } if(!ObjectUtils.objectsEqual(getBrickProfileDetails(), profileInfo.getBrickProfileDetails())) { return false; } if(!ObjectUtils.objectsEqual(getNfsProfileDetails(), profileInfo.getNfsProfileDetails())) { return false; } return true; }
Source:
protected void modelIncomplete(boolean isGlobalRequest) { if (isGlobalRequest) { Object input = getInput(); if (input != null && input instanceof TmfStatisticsTreeNode) { TmfStatisticsTreeRootFactory.removeStatTreeRoot(getTreeID()); } resetUpdateSynchronization(); sendPendingUpdate(); } else { resetTimeRangeValue(); } refresh(); waitCursor(false); }

Target:
protected void modelIncomplete(boolean isGlobalRequest) { if (isGlobalRequest) { Object input = getInput(); if (input instanceof TmfStatisticsTreeNode) { TmfStatisticsTreeRootFactory.removeStatTreeRoot(getTreeID()); } resetUpdateSynchronization(); sendPendingUpdate(); } else { resetTimeRangeValue(); } refresh(); waitCursor(false); }
Source:
protected boolean acquireLockInternal() { if (context.getParentLock() != null) { final EngineLock requiredLock = buildLock(); return context.getParentLock().covers(requiredLock, getLockProperties().getScope()); } if (context.getLock() == null) { EngineLock lock = buildLock(); if (lock != null) { Pair<Boolean, Set<String>> lockAcquireResult = getLockManager().acquireLock(lock); if (lockAcquireResult.getFirst()) { log.info("Lock Acquired to object '{}'", lock); context.withLock(lock); } else { log.info("Failed to Acquire Lock to object '{}'", lock); getReturnValue().getValidationMessages() .addAll(extractVariableDeclarations(lockAcquireResult.getSecond())); return false; } } } return true; }

Target:
protected boolean acquireLockInternal() { if (context.getParentLock() != null) { return context.getParentLock().covers(buildLock(), getLockProperties().getScope()); } if (context.getLock() == null) { EngineLock lock = buildLock(); if (lock != null) { Pair<Boolean, Set<String>> lockAcquireResult = getLockManager().acquireLock(lock); if (lockAcquireResult.getFirst()) { log.info("Lock Acquired to object '{}'", lock); context.withLock(lock); } else { log.info("Failed to Acquire Lock to object '{}'", lock); getReturnValue().getValidationMessages() .addAll(extractVariableDeclarations(lockAcquireResult.getSecond())); return false; } } } return true; }
Source:
public void login(String username, String password) { usernameField.sendKeys(username); passwordField.sendKeys(password); signInButton.click(); }

Target:
public void login(String username, String password) { wait.forElementVisible(usernameField); wait.forElementVisible(passwordField); wait.forElementClickable(signInButton); usernameField.sendKeys(username); passwordField.sendKeys(password); signInButton.click(); }
Source:
private void handleSaveFailure (Throwable e) { Log.e(App.LOG_TAG, "Could not save tree", e); safeDismiss(saveDialog); Toast.makeText(App.getAppInstance(), "Could not save tree", Toast.LENGTH_SHORT).show(); }

Target:
private void handleSaveFailure (Throwable e) { String msg = getString(R.string.save_tree_failure); Log.e(App.LOG_TAG, msg, e); safeDismiss(saveDialog); Toast.makeText(App.getAppInstance(), msg, Toast.LENGTH_SHORT).show(); }
Source:
protected void init() { if (!initialized) { Profiler profiler = Profiler.create(LOG).startInfo("JavaClasspath initialization"); initialized = true; binaries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_BINARIES); List<File> libraries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_LIBRARIES); if (binaries.isEmpty() && libraries.isEmpty() && useDeprecatedProperties()) { throw new AnalysisException("sonar.binaries and sonar.libraries are deprecated since version 2.5 of sonar-java-plugin, please use sonar.java.binaries and sonar.java.libraries instead"); } elements = Lists.newArrayList(binaries); if(libraries.isEmpty()) { LOG.warn("Bytecode of dependencies was not provided for analysis of source files, " + "you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property"); } elements.addAll(libraries); profiler.stopInfo(); } }

Target:
protected void init() { if (!initialized) { Profiler profiler = Profiler.create(LOG).startInfo("JavaClasspath initialization"); initialized = true; binaries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_BINARIES); List<File> libraries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_LIBRARIES); if (binaries.isEmpty() && libraries.isEmpty() && useDeprecatedProperties()) { throw new AnalysisException( "sonar.binaries and sonar.libraries are not supported since version 4.0 of sonar-java-plugin, please use sonar.java.binaries and sonar.java.libraries instead"); } elements = Lists.newArrayList(binaries); if(libraries.isEmpty()) { LOG.warn("Bytecode of dependencies was not provided for analysis of source files, " + "you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property"); } elements.addAll(libraries); profiler.stopInfo(); } }
Source:
private void setOptionalDependencies(TargetPlatformConfiguration result, Xpp3Dom resolverDom) { String value = getStringValue(resolverDom.getChild("optionalDependencies")); if (null == value) { return; } else switch (value) { case OPTIONAL_RESOLUTION_REQUIRE: result.setOptionalResolutionAction(OptionalResolutionAction.REQUIRE); break; case OPTIONAL_RESOLUTION_IGNORE: result.setOptionalResolutionAction(OptionalResolutionAction.IGNORE); break; default: throw new BuildFailureException("Illegal value of <optionalDependencies> dependency resolution parameter: " + value); } }

Target:
private void setOptionalDependencies(TargetPlatformConfiguration result, Xpp3Dom resolverDom) { String value = getStringValue(resolverDom.getChild("optionalDependencies")); if (value == null) { return; } else switch (value) { case OPTIONAL_RESOLUTION_REQUIRE: result.setOptionalResolutionAction(OptionalResolutionAction.REQUIRE); break; case OPTIONAL_RESOLUTION_IGNORE: result.setOptionalResolutionAction(OptionalResolutionAction.IGNORE); break; default: throw new BuildFailureException("Illegal value of <optionalDependencies> dependency resolution parameter: " + value); } }
Source:
private void updateDiskImageDynamic() { VDSReturnValue ret = runVdsCommand( VDSCommandType.GetImageInfo, new GetImageInfoVDSCommandParameters(getDestinationDiskImage().getStoragePoolId().getValue(), getDestinationDiskImage().getStorageIds().get(0), getDestinationDiskImage().getId(), getDestinationDiskImage().getImageId())); DiskImage imageFromIRS = (DiskImage) ret.getReturnValue(); DiskImageDynamic diskImageDynamic = getDiskImageDynamicDAO().get(getDestinationDiskImage().getImageId()); if (imageFromIRS != null && diskImageDynamic != null) { diskImageDynamic.setactual_size(imageFromIRS.getActualSizeFromDiskImage()); getDiskImageDynamicDAO().update(diskImageDynamic); } }

Target:
private void updateDiskImageDynamic() { try { VDSReturnValue ret = runVdsCommand( VDSCommandType.GetImageInfo, new GetImageInfoVDSCommandParameters(getDestinationDiskImage().getStoragePoolId().getValue(), getDestinationDiskImage().getStorageIds().get(0), getDestinationDiskImage().getId(), getDestinationDiskImage().getImageId())); DiskImage imageFromIRS = (DiskImage) ret.getReturnValue(); DiskImageDynamic diskImageDynamic = getDiskImageDynamicDAO().get(getDestinationDiskImage().getImageId()); if (imageFromIRS != null && diskImageDynamic != null) { diskImageDynamic.setactual_size(imageFromIRS.getActualSizeFromDiskImage()); getDiskImageDynamicDAO().update(diskImageDynamic); } else { throw new VdcBLLException(VdcBllErrors.ENGINE, "Can't find Snapshot's DiskImage by ID"); } } catch (VdcBLLException e) { log.errorFormat("GetImageInfo on disk {0} did not complete successfully. error {1}", getDestinationDiskImage().getImageId(), e.getMessage()); } }
Source:
public V putIfAbsent(final K key, final V value) throws CacheWriterException { statusTransitioner.checkAvailable(); checkNonNull(key, value); final AtomicBoolean installed = new AtomicBoolean(false); final Function<K, V> mappingFunction = memoize(new Function<K, V>() { @Override public V apply(final K k) { if (cacheWriter != null) { try { cacheWriter.write(k, null, value); } catch (Exception e) { throw newCacheWriterException(e); } } installed.set(true); return value; } }); try { ValueHolder<V> inCache = store.computeIfAbsent(key, mappingFunction); if (installed.get()) { return null; } else { return inCache.value(); } } catch (CacheAccessException e) { V v = null; try { v = mappingFunction.apply(key); if (cacheWriter != null) { store.remove(key); } else { final Store.ValueHolder<V> holder = store.get(key); if (holder == null) { resilienceStrategy.possiblyInconsistent(key, e); } else { return holder.value(); } } } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } return v; } }

Target:
public V putIfAbsent(final K key, final V value) throws CacheWriterException { statusTransitioner.checkAvailable(); checkNonNull(key, value); final AtomicBoolean installed = new AtomicBoolean(false); final Function<K, V> mappingFunction = memoize(new Function<K, V>() { @Override public V apply(final K k) { if (cacheWriter != null) { try { cacheWriter.write(k, null, value); } catch (Exception e) { throw newCacheWriterException(e); } } installed.set(true); return value; } }); try { ValueHolder<V> inCache = store.computeIfAbsent(key, mappingFunction); if (installed.get()) { return null; } else { return inCache.value(); } } catch (CacheAccessException e) { V computedValue = null; try { computedValue = mappingFunction.apply(key); if (cacheWriter != null) { store.remove(key); } else { final Store.ValueHolder<V> holder = store.get(key); if (holder == null) { resilienceStrategy.possiblyInconsistent(key, e); } else { return holder.value(); } } } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } return installed.get() ? null : computedValue; } }
Source:
public byte[] getAPIData() { ByteArrayOutputStream data = new ByteArrayOutputStream(); try { data.write(sourceAddress64.getValue()); data.write(sourceAddress16.getValue()); data.write(receiveOptions); if (receivedData != null) data.write(receivedData); } catch (IOException e) { e.printStackTrace(); } return data.toByteArray(); }

Target:
public byte[] getAPIData() { ByteArrayOutputStream data = new ByteArrayOutputStream(); try { data.write(sourceAddress64.getValue()); data.write(sourceAddress16.getValue()); data.write(receiveOptions); if (receivedData != null) data.write(receivedData); } catch (IOException e) { } return data.toByteArray(); }
Source:
IgnoreCondition create() { checkConditionType(); try { return createCondition(); } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new RuntimeException(e); } }

Target:
IgnoreCondition create() { checkConditionType(); try { return createCondition(); } catch (RuntimeException re) { throw Throwables.propagate(re); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public void finalize(Item item) { try (DataDomainManager manager = new DataDomainManager()) { DataDomain domain = manager.getDomainForItem(item); ItemManager items = new ItemManager(); SortedSet<String> domainValues = domain.getDomainValues(); if(item.getItemType() == Item.ItemType.aggregation){ domainValues.clear(); domainValues = DataDomainUtility.getOnlyVisibleDomainValues(item, manager, items); } manager.close(); items.close(); Integer minimum = Integer.parseInt(domainValues.first()); Integer maximum = Integer.parseInt(domainValues.last()); AttributeRange range = new AttributeRange(minimum, maximum); RainbowColorMap colorMap = new RainbowColorMap(range); String[] tmpColors = new String[domainValues.size()]; float[] tmpThresholds = new float[domainValues.size()]; List<Map<String, Object>> tmpBins = new ArrayList<>(); int i = 0; for (String year : domainValues) { Integer intYear = Integer.parseInt(year); Color color = colorMap.valueToColor(intYear); String hex = ColorUtility.toHexLowercase(color); tmpColors[i] = hex; tmpThresholds[i] = (float) intYear; Map<String, Object> binMap = new HashMap<>(); binMap.put("years", intYear); binMap.put("color", hex); tmpBins.add(binMap); i++; } wrapped = new SLDConfig(jspPath, units, style, strokeWidth, SLDGenerator.STROKE_OPACITY_DEFAULT, attrs, tmpThresholds, tmpColors, tmpBins, LegendType.CONTINUOUS); } }

Target:
public void finalize(Item item) { try (DataDomainManager manager = new DataDomainManager(); ItemManager items = new ItemManager()) { DataDomain domain = manager.getDomainForItem(item); SortedSet<String> domainValues = domain.getDomainValues(); if(item.getItemType() == Item.ItemType.aggregation){ domainValues.clear(); domainValues = DataDomainUtility.getOnlyVisibleDomainValues(item, manager, items); } Integer minimum = Integer.parseInt(domainValues.first()); Integer maximum = Integer.parseInt(domainValues.last()); AttributeRange range = new AttributeRange(minimum, maximum); RainbowColorMap colorMap = new RainbowColorMap(range); String[] tmpColors = new String[domainValues.size()]; float[] tmpThresholds = new float[domainValues.size()]; List<Map<String, Object>> tmpBins = new ArrayList<>(); int i = 0; for (String year : domainValues) { Integer intYear = Integer.parseInt(year); Color color = colorMap.valueToColor(intYear); String hex = ColorUtility.toHexLowercase(color); tmpColors[i] = hex; tmpThresholds[i] = (float) intYear; Map<String, Object> binMap = new HashMap<>(); binMap.put("years", intYear); binMap.put("color", hex); tmpBins.add(binMap); i++; } wrapped = new SLDConfig(jspPath, units, style, strokeWidth, SLDGenerator.STROKE_OPACITY_DEFAULT, attrs, tmpThresholds, tmpColors, tmpBins, LegendType.CONTINUOUS); } }
Source:
public void testRefreshConfig() throws Exception { GerritConfiguration config = client.refreshConfig(new NullProgressMonitor()); assertNotNull(config); assertNotNull(config.getGerritConfig()); assertNotNull(config.getProjects()); assertNotNull(config.getGerritConfig().getWildProject()); assertEquals("All-Projects", config.getGerritConfig().getWildProject().toString()); assertNotNull(config.getGerritConfig().getSchemes()); }

Target:
public void testRefreshConfig() throws Exception { GerritConfiguration config = client.refreshConfig(new NullProgressMonitor()); assertNotNull(config); assertNotNull(config.getGerritConfig()); assertNotNull(config.getProjects()); assertNotNull(config.getGerritConfig().getWildProject()); assertEquals("All-Projects", config.getGerritConfig().getWildProject().toString()); if (client.getVersion().getMinor() >= 12) { assertNotNull(config.getGerritConfig().getSchemes()); } }
Source:
Mono<Response<DetectLanguageResult>> detectLanguageWithResponse(String text, String countryHint, Context context) { List<DetectLanguageInput> languageInputs = new ArrayList<>(); languageInputs.add(new DetectLanguageInput(Integer.toString(0), text, countryHint)); return detectBatchLanguagesWithResponse(languageInputs, null, context).flatMap(response -> { if (response.getValue().iterator().hasNext()) { return Mono.justOrEmpty(new SimpleResponse<>(response, response.getValue().iterator().next())); } return monoError(logger, new RuntimeException("Unable to retrieve language for the provided text.")); }); }

Target:
Mono<Response<DetectLanguageResult>> detectLanguageWithResponse(String text, String countryHint, Context context) { Objects.requireNonNull(text, "'text' cannot be null."); List<DetectLanguageInput> languageInputs = Collections.singletonList(new DetectLanguageInput("0", text, countryHint)); return detectBatchLanguagesWithResponse(languageInputs, null, context).map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); }
Source:
public void setMass(float mass) { if (mass <= 0) { logger.error("Invalid value for the mass. It can't be less than or equal to zero."); this.mass = 1; } this.mass = mass; }

Target:
public void setMass(float mass) { if (mass <= 0) { logger.error("Invalid value for the mass. It can't be less than or equal to zero."); this.mass = 1; } else { this.mass = mass; } }