List of usage examples for java.util Objects requireNonNull
public static <T> T requireNonNull(T obj, Supplier<String> messageSupplier)
From source file:io.fabric8.maven.core.service.PortForwardService.java
public PortForwardService(KubernetesClient kubernetes, Logger log) { this.clientToolsService = new ClientToolsService(log); this.log = Objects.requireNonNull(log, "log"); this.kubernetes = Objects.requireNonNull(kubernetes, "kubernetes"); }
From source file:edu.usu.sdl.openstorefront.service.ReportServiceImpl.java
@Override public Report generateReport(Report report) { Objects.requireNonNull(report, "Report is required"); //save Report Report managedReport;// w w w . ja va2 s . c om if (StringUtils.isBlank(report.getReportId())) { managedReport = queueReport(report); } else { managedReport = persistenceService.findById(Report.class, report.getReportId()); } if (managedReport == null) { throw new OpenStorefrontRuntimeException("Unable to find report.", "Check report id: " + report.getReportId()); } managedReport.setRunStatus(RunStatus.WORKING); managedReport.setUpdateDts(TimeUtil.currentDate()); managedReport.setUpdateUser(OpenStorefrontConstant.SYSTEM_USER); managedReport = persistenceService.persist(managedReport); //run report try { BaseReport reportGenerator = BaseReport.getReport(report); reportGenerator.generateReport(); managedReport.setRunStatus(RunStatus.COMPLETE); managedReport.setUpdateDts(TimeUtil.currentDate()); managedReport.setUpdateUser(OpenStorefrontConstant.SYSTEM_USER); managedReport = persistenceService.persist(managedReport); } catch (Exception e) { managedReport.setRunStatus(RunStatus.ERROR); managedReport.setUpdateDts(TimeUtil.currentDate()); managedReport.setUpdateUser(OpenStorefrontConstant.SYSTEM_USER); managedReport = persistenceService.persist(managedReport); ErrorInfo errorInfo = new ErrorInfo(e, null); errorInfo.setErrorTypeCode(ErrorTypeCode.REPORT); errorInfo.setInputData("Report: " + report.getReportType() + " Format: " + report.getReportFormat() + " Report Id: " + report.getReportId() + " Create Date: " + report.getCreateDts()); getSystemService().generateErrorTicket(errorInfo); //Note: we don't need to rethrow as we want to track report error separatly. } return managedReport; }
From source file:io.helixservice.feature.configuration.dynamo.DynamoConfigResourceLocator.java
public DynamoConfigResourceLocator(String clientEndpoint, String accessKey, String secretKey, String tableName, String serviceName, boolean createTable) { Objects.requireNonNull(clientEndpoint, "clientEndpoint cannot be null"); Objects.requireNonNull(tableName, "tableName cannot be null"); Objects.requireNonNull(serviceName, "serviceName cannot be null"); this.clientEndpoint = clientEndpoint; this.accessKey = accessKey; this.secretKey = secretKey; this.tableName = tableName; this.serviceName = serviceName; configureDynamoConnection();// w ww . j a va2 s . c o m if (createTable) { createTable(); } }
From source file:ch.puzzle.itc.mobiliar.business.resourcerelation.entity.ProvidedResourceRelationEntity.java
public ProvidedResourceRelationEntity(ForeignableOwner owner) { super(Objects.requireNonNull(owner, "Owner must not be null")); }
From source file:com.github.horrorho.inflatabledonkey.protobuf.util.ProtocRawDecoder.java
public ProtocRawDecoder(String protocPath, ProcessManager processManager) { this.protocPath = Objects.requireNonNull(protocPath, "protocPath"); this.processManager = Objects.requireNonNull(processManager, "processManager"); }
From source file:ch.puzzle.itc.mobiliar.business.resourcerelation.entity.ConsumedResourceRelationEntity.java
public ConsumedResourceRelationEntity(ForeignableOwner owner) { super(Objects.requireNonNull(owner, "Owner must not be null")); }
From source file:io.fabric8.quickstarts.camel.teiid.TeiidServerAutoConfiguration.java
private String getServiceInfo(Environment environment, String serviceName, String infoType, String subType) { String propertyName = serviceName.toUpperCase().replace("-", "_"); propertyName += "_SERVICE_" + infoType.toUpperCase(); if (subType != null && subType.trim().length() > 0) { propertyName += "_" + subType.toUpperCase().replace("-", "_"); }/*from w ww. j a v a 2 s.c o m*/ String info = environment.getProperty(propertyName); Objects.requireNonNull(info, "Service " + infoType + " not found in the environment (" + propertyName + ")"); return info; }
From source file:com.smokejumperit.gradle.report.DependencyLicenseReport.java
public void setReportedConfiguration(Configuration configuration) { Objects.requireNonNull(configuration, "configuration to report"); setReportedConfiguration(configuration.getName()); }
From source file:org.apache.calcite.adapter.elasticsearch.EmbeddedElasticsearchPolicy.java
private EmbeddedElasticsearchPolicy(EmbeddedElasticsearchNode resource) { this.node = Objects.requireNonNull(resource, "resource"); this.mapper = new ObjectMapper(); this.closer = new Closer(); closer.add(node);//w w w. j a v a 2 s.co m }
From source file:net.andylizi.laserlib.LaserManagerImpl.java
@Override public Laser createLaser(Location start, Location end, boolean elder) throws RuntimeException { Objects.requireNonNull(start, "startloc cannot be null"); Objects.requireNonNull(end, "endloc cannot be null"); Validate.isTrue(start.getWorld().getUID().equals(end.getWorld().getUID()), "startLoc and endLoc must in the same world"); Location guardianPos = start.clone().add(0, -GUARDIAN_EYE_HEIGHT, 0); Location asPos = end.clone().add(0, -ARMORSTAND_EYE_HEIGHT, 0); try {/*from ww w. j a v a 2s . c om*/ DummyEntity dummyTarget = NMSUtil.createDummyArmorStand(asPos); DummyEntity dummyGuardian = NMSUtil.createDummyGuardian(guardianPos, elder, dummyTarget.getEntityId()); NMSUtil.dummyGuardians .add(new DummyGuardianRecord(dummyTarget.getEntityId(), dummyGuardian, dummyTarget)); return new DummyLaser(start, dummyGuardian, end, dummyTarget); } catch (ReflectiveOperationException ex) { throw new RuntimeException(ex); } }