List of usage examples for java.util Objects requireNonNull
public static <T> T requireNonNull(T obj)
From source file:org.fcrepo.camel.ldpath.FedoraProvider.java
@Override public List<String> buildRequestUrl(final String resourceUri, final Endpoint endpoint) { LOGGER.debug("Processing: " + resourceUri); Objects.requireNonNull(resourceUri); try {/*from w w w. j a va 2 s. c o m*/ final Optional<String> nonRdfSourceDescUri = getNonRDFSourceDescribedByUri(resourceUri); if (nonRdfSourceDescUri.isPresent()) { return Collections.singletonList(nonRdfSourceDescUri.get()); } } catch (IOException ex) { throw new UncheckedIOException(ex); } return Collections.singletonList(resourceUri); }
From source file:net.sf.jabref.logic.journals.AbbreviationParser.java
public void readJournalListFromFile(File file, Charset encoding) throws FileNotFoundException { try (FileInputStream stream = new FileInputStream(Objects.requireNonNull(file)); InputStreamReader reader = new InputStreamReader(stream, Objects.requireNonNull(encoding))) { readJournalList(reader);/*from ww w. java2 s . co m*/ } catch (FileNotFoundException e) { throw e; } catch (IOException e) { LOGGER.warn("Could not read journal list from file " + file.getAbsolutePath(), e); } }
From source file:io.github.retz.web.Client.java
protected Client(URI uri, Authenticator authenticator, boolean checkCert) { this.uri = Objects.requireNonNull(uri); this.authenticator = Objects.requireNonNull(authenticator); this.checkCert = checkCert; if (uri.getScheme().equals("https") && !checkCert) { LOG.warn(//from w w w .j av a2 s. c o m "DANGER ZONE: TLS certificate check is disabled. Set 'retz.tls.insecure = false' at config file to supress this message."); try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, new TrustManager[] { new WrongTrustManager() }, new java.security.SecureRandom()); socketFactory = sc.getSocketFactory(); hostnameVerifier = new NoOpHostnameVerifier(); } catch (NoSuchAlgorithmException e) { throw new AssertionError(e.toString()); } catch (KeyManagementException e) { throw new AssertionError(e.toString()); } } else { socketFactory = null; hostnameVerifier = null; } this.retz = Retz.connect(uri, authenticator, socketFactory, hostnameVerifier); System.setProperty("http.agent", Client.VERSION_STRING); }
From source file:com.conwet.silbops.msg.AdvertiseMsg.java
public void setAdvertise(Advertise advertise) { this.advertise = Objects.requireNonNull(advertise); }
From source file:org.eclipse.hono.messaging.MessageForwardingEndpoint.java
/** * Creates an endpoint for a Vertx instance. * /*from w w w. j a v a2 s.c o m*/ * @param vertx The Vertx instance to use. */ protected MessageForwardingEndpoint(final Vertx vertx) { super(Objects.requireNonNull(vertx)); }
From source file:com.conwet.silbops.msg.ContextMsg.java
public void setId(String id) { this.id = Objects.requireNonNull(id); }
From source file:org.eclipse.hono.authorization.impl.InMemoryAuthorizationService.java
/** * Set the resource that the authorization rules should be loaded from. * <p>/*w ww . ja va 2s . c om*/ * If not set the default permissions will be loaded from <em>classpath:permissions.json</em>. * * @param permissionsResource The resource. */ public void setPermissionsPath(final Resource permissionsResource) { this.permissionsResource = Objects.requireNonNull(permissionsResource); }
From source file:com.bodybuilding.argos.discovery.ClusterListDiscovery.java
@VisibleForTesting ClusterListDiscovery(Collection<String> servers, RestTemplate restTemplate) { super(UPDATE_INTERVAL, TimeUnit.MILLISECONDS); Objects.requireNonNull(servers); LOG.debug("Configured with {}", servers); this.servers = new ArrayList<>(servers); this.restTemplate = restTemplate; }
From source file:com.envision.envservice.common.JSONFilter.java
/** * ??Filter//from ww w . ja va 2 s . c o m * * @param validator ??? * @param params ?? * @param jsonValueParams ??, ???JSON * Key: (?)??KEY * Value: JSON?? */ public static ValueFilter buildLimitFieldFilter(final BaseValidator validator, final Map<String, Object> params, final Map<String, String> jsonValueParams) { Objects.requireNonNull(validator); ValueFilter limitFieldFilter = new ValueFilter() { @Override public Object process(Object object, String name, Object value) { if (!(object instanceof Filterable)) { throw new RuntimeException(object.getClass().getName() + " not support limit field filter."); } Filterable filterableObj = Filterable.class.cast(object); try { if (filterableObj.isFilterField(name)) { if (jsonValueParams != null) { for (Map.Entry<String, String> me : jsonValueParams.entrySet()) { params.put(me.getKey(), BeanUtils.getProperty(object, me.getValue())); } } return validator.validate(params).getFlag() ? defaultIfNull(value) : null; } else { return defaultIfNull(value); } } catch (Exception e) { throw new RuntimeException("Filter Fail.", e); } } }; return limitFieldFilter; }
From source file:nu.yona.server.subscriptions.entities.Buddy.java
private Buddy(UUID id, UUID userId, String firstName, String lastName, String nickname, UUID buddyAnonymizedId) { super(id, firstName, lastName, Objects.requireNonNull(nickname)); this.userId = Objects.requireNonNull(userId); this.buddyAnonymizedId = Objects.requireNonNull(buddyAnonymizedId); this.devices = new HashSet<>(); setLastStatusChangeTimeToNow();//from ww w . j ava 2 s. co m }