当前位置: 首页>>代码示例>>Java>>正文


Java SuppressWarnings类代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.annotations.SuppressWarnings的典型用法代码示例。如果您正苦于以下问题:Java SuppressWarnings类的具体用法?Java SuppressWarnings怎么用?Java SuppressWarnings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SuppressWarnings类属于edu.umd.cs.findbugs.annotations包,在下文中一共展示了SuppressWarnings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
/**
 * Initializes this collector by creating a {@link StatArchiveHandler} and registering it as a
 * handler.
 * 
 * @param config defines the configuration for the StatArchiveHandler
 * @param nanosTimeStamp the nanos time stamp to initialize stat archiver with
 * @param rollingFileHandler provides file rolling behavior
 */
@SuppressWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD",
    justification = "There is never more than one SampleCollector instance.")
public void initialize(final StatArchiveHandlerConfig config, final long nanosTimeStamp,
    final RollingFileHandler rollingFileHandler) {
  synchronized (SampleCollector.class) {
    instance = this;
    synchronized (this.sampleHandlers) {
      StatArchiveHandler newStatArchiveHandler =
          new StatArchiveHandler(config, this, rollingFileHandler);
      this.statArchiveHandler = newStatArchiveHandler;
      addSampleHandler(newStatArchiveHandler);
      newStatArchiveHandler.initialize(nanosTimeStamp);
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:SampleCollector.java

示例2: fileToString

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@SuppressWarnings(value = "DM_DEFAULT_ENCODING")
protected String fileToString(File f) {
	StringBuffer sb = new StringBuffer();
	try (FileReader fileRead = new FileReader(f); BufferedReader reader = new BufferedReader(fileRead);) {
		String line;
		while (true) {
			line = reader.readLine();
			if (line == null)
				break;
			sb.append(line);
			sb.append("\n");
		}
	} catch (Throwable e) {

	}
	return sb.toString();
}
 
开发者ID:SRI-CSL,项目名称:bixie,代码行数:18,代码来源:AbstractIcTest.java

示例3: fileToString

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@SuppressWarnings(value = "DM_DEFAULT_ENCODING")
protected String fileToString(File f) {
	StringBuffer sb = new StringBuffer();
	try (FileReader fileRead = new FileReader(f);
			BufferedReader reader = new BufferedReader(fileRead);) {
		String line;
		while (true) {
			line = reader.readLine();
			if (line == null)
				break;
			sb.append(line);
			sb.append("\n");
		}
	} catch (Throwable e) {

	}
	return sb.toString();
}
 
开发者ID:SRI-CSL,项目名称:bixie,代码行数:19,代码来源:AbstractIcTest.java

示例4: getIP

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@SuppressWarnings(value = "DM_DEFAULT_ENCODING", justification = "There are no other changes when the content encoding is not present in the HTTP response")
public String getIP() throws IpRetrievalException {
	try {
		URL url = new URL("https://icanhazip.com");
		URLConnection conn = url.openConnection();
		String encoding = conn.getContentEncoding();
		// open the stream and put it into BufferedReader
		InputStreamReader isr = encoding == null ? new InputStreamReader(
				conn.getInputStream()) : new InputStreamReader(
				conn.getInputStream(), encoding);
		BufferedReader br = new BufferedReader(isr);
		String line = br.readLine();
		br.close();
		log.info("Public IP: " + line);
		return line;
	} catch (Exception e) {
		log.error("Cannot get IP from " + "https://icanhazip.com");
		IpRetrievalException ex = new IpRetrievalException(
				"Cannot get IP from " + "https://icanhazip.com", e);
		ex.setProviderName(providerName());
		throw ex;
	}
}
 
开发者ID:maroussil,项目名称:Ec2InstanceStarter,代码行数:24,代码来源:IcanHazip.java

示例5: getIP

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@SuppressWarnings(value="DM_DEFAULT_ENCODING",justification="There are no other changes when the content encoding is not present in the HTTP response")
public String getIP() throws IpRetrievalException{
	try{
		URL url = new URL("https://icanhazip.com");
		URLConnection conn = url.openConnection();
		String encoding = conn.getContentEncoding();
		// open the stream and put it into BufferedReader
		InputStreamReader isr = encoding == null ? new InputStreamReader(conn.getInputStream()) : new InputStreamReader(conn.getInputStream(),encoding);
		BufferedReader br = new BufferedReader(isr);
		String line = br.readLine();
		br.close();
		log.info("Public IP: "+line);
		return line;
	}catch(Exception e){
		log.error("Cannot get IP from "+"https://icanhazip.com");
		IpRetrievalException ex = new IpRetrievalException("Cannot get IP from "+"https://icanhazip.com", e);
		ex.setProviderName(providerName());
		throw ex;
	}
}
 
开发者ID:renatodelgaudio,项目名称:awsroute53,代码行数:21,代码来源:IcanHazip.java

示例6: testStream

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
/**
 * Test dataset stream
 */
@java.lang.SuppressWarnings("unchecked")
@TestWith({"testMetaDataCsvBatch", "testMetaDataXmlBatch"})
public void testStream(TestMetaData testMetaData) throws IOException, EventDeliveryException, InterruptedException {
  assertEquals(((Integer) testMetaData.getParameters()[2].get(KEY_FLUME_PROCESS_FILE_COUNT)).intValue(),
    flumeServer.crankPipeline(FLUME_SUBSTITUTIONS, FLUME_CONFIG_FILE, testMetaData.getParameters()[0], testMetaData.getParameters()[1],
      FLUME_AGENT_NAME, (String) testMetaData.getParameters()[2].get(KEY_FLUME_SOURCE_NAME),
      (String) testMetaData.getParameters()[2].get(KEY_FLUME_SINK_NAME), new com.cloudera.framework.example.one.stream.Stream(),
      new HDFSEventSink(), (String) testMetaData.getParameters()[2].get(KEY_FLUME_OUTPUT_DIR),
      (Integer) testMetaData.getParameters()[2].get(KEY_FLUME_PROCESS_ITERATIONS), iterations -> 1));
  Driver driverStage = new Stage(dfsServer.getConf());
  assertEquals(SUCCESS, driverStage.runner(
    dfsServer.getPath(DIR_ABS_MYDS_RAW_CANONICAL).toString(), dfsServer.getPath(DIR_ABS_MYDS_STAGED).toString()));
  assertCounterEquals(testMetaData, driverStage.getCounters());
  Driver driverPartition = new Partition(dfsServer.getConf());
  assertEquals(SUCCESS, driverPartition.runner(dfsServer.getPath(DIR_ABS_MYDS_STAGED_CANONICAL).toString(),
    dfsServer.getPath(DIR_ABS_MYDS_PARTITIONED).toString()));
  assertCounterEquals(testMetaData, 1, driverPartition.getCounters());
  Driver driverProcess = new Cleanse(dfsServer.getConf());
  assertEquals(SUCCESS, driverProcess.runner(dfsServer.getPath(DIR_ABS_MYDS_PARTITIONED_CANONICAL).toString(), dfsServer.getPath
    (DIR_ABS_MYDS_CLEANSED).toString()));
  assertCounterEquals(testMetaData, 2, driverProcess.getCounters());
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:26,代码来源:Stream.java

示例7: logError

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@SuppressWarnings("DM_EXIT")
public void logError(String message, Throwable e) {
    if (e instanceof MissingClassException) {
        MissingClassException missingClassEx = (MissingClassException) e;
        ClassNotFoundException cnfe = missingClassEx.getClassNotFoundException();

        reportMissingClass(cnfe);
        // Don't report dataflow analysis exceptions due to missing classes.
        // Too much noise.
        return;

    }
    if (e instanceof MethodUnprofitableException) {
        // TODO: log this
        return;
    }
    System.err.println("Error: " + message);
    e.printStackTrace();
    System.exit(1);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:21,代码来源:DebugRepositoryLookupFailureCallback.java

示例8: call

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
        value = {"NP_LOAD_OF_KNOWN_NULL_VALUE"},
        justification = "Findbugs mis-diagnosing closeQuietly's built-in null check"
)
public String call() throws RuntimeException {
    InputStream is = null;
    try {
        is = hudson.remoting.Channel.class.getResourceAsStream("/jenkins/remoting/jenkins-version.properties");
        if (is == null) {
            return "N/A";
        }
        Properties properties = new Properties();
        try {
            properties.load(is);
            return properties.getProperty("version", "N/A");
        } catch (IOException e) {
            return "N/A";
        }
    } finally {
        IOUtils.closeQuietly(is);
    }
}
 
开发者ID:jenkinsci,项目名称:support-core-plugin,代码行数:23,代码来源:AboutJenkins.java

示例9: run_chokes_whenErrorConsumerIsNull

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@Test
@SuppressWarnings("NP_NONNULL_PARAM_VIOLATION")
public void run_chokes_whenErrorConsumerIsNull() throws Exception {
    // create command
    final String command = "bad";
    sut = new GMBatchCommand(service, command);
    // create the operation, add images and operators/options
    IMOperation op = new IMOperation();
    op.addImage(SOURCE_IMAGE);
    op.resize(800, 600);
    op.addImage(TARGET_IMAGE);
    final String message = "bad command";
    when(service.execute(anyListOf(String.class))).thenThrow(new GMException(message));
    exception.expect(CommandException.class);
    exception.expectMessage(message);
    sut.setErrorConsumer(null);

    // execute the operation
    sut.run(op);
}
 
开发者ID:sharneng,项目名称:gm4java,代码行数:21,代码来源:GMBatchCommandTest.java

示例10: run_works_whenOutputConsumerIsNull

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@Test
@SuppressWarnings("NP_NONNULL_PARAM_VIOLATION")
public void run_works_whenOutputConsumerIsNull() throws Exception {
    // create command
    final String command = "convert";
    sut = new GMBatchCommand(service, command);
    // create the operation, add images and operators/options
    IMOperation op = new IMOperation();
    op.addImage(SOURCE_IMAGE);
    op.resize(800, 600);
    op.addImage(TARGET_IMAGE);
    sut.setOutputConsumer(null);

    // execute the operation
    sut.run(op);

    verify(service).execute(Arrays.asList(command, SOURCE_IMAGE, "-resize", "800x600", TARGET_IMAGE));
}
 
开发者ID:sharneng,项目名称:gm4java,代码行数:19,代码来源:GMBatchCommandTest.java

示例11: run_handlesBufferedImageAsInput

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@Test
public void run_handlesBufferedImageAsInput() throws Exception {
    final String command = "convert";
    sut = new GMBatchCommand(service, command);
    BufferedImage image = ImageIO.read(getClass().getResourceAsStream("/a.png"));
    IMOperation op = new IMOperation();
    op.addImage();                        // input
    op.resize(80, 60);
    op.addImage();                        // output

    sut.run(op, image, TARGET_IMAGE);

    @java.lang.SuppressWarnings("unchecked")
    ArgumentCaptor<List<String>> captor = ArgumentCaptor.forClass((Class<List<String>>) (Class<?>) List.class);
    verify(service).execute(captor.capture());
    assertThat(captor.getValue(),
            equalTo(Arrays.asList(command, captor.getValue().get(1), "-resize", "80x60", TARGET_IMAGE)));
}
 
开发者ID:sharneng,项目名称:gm4java,代码行数:19,代码来源:GMBatchCommandTest.java

示例12: pressQEnterToContinue

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
                                                  value = "DM_DEFAULT_ENCODING",
                                                  justification = "Just reading key-input, encoding does not matter here")
static void pressQEnterToContinue() {
    try {
        // sleep a while to have the log output at the end
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        // nothing to do
    }
    LOG.info("\n\n\n************************************************\n Please press \"q + <Enter>\" to quit application\n************************************************\n\n");
    Scanner input = new Scanner(System.in);
    Pattern pattern = Pattern.compile("q");
    // wait until the user types q to quit
    input.next(pattern);
    input.close();
}
 
开发者ID:bmwcarit,项目名称:joynr,代码行数:18,代码来源:GpsConsumerApplication.java

示例13: StreamResourceTracker

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param streamFactoryList     array of StreamFactory objects which determine
 *                              where streams are created
 * @param lookupFailureCallback used when class hierarchy lookups fail
 */
@SuppressWarnings("EI2")
public StreamResourceTracker(StreamFactory[] streamFactoryList,
                             RepositoryLookupFailureCallback lookupFailureCallback) {

	this.streamFactoryList = streamFactoryList;
	this.lookupFailureCallback = lookupFailureCallback;
	this.streamOpenLocationMap = new HashMap<Location, Stream>();
	this.uninterestingStreamEscapeSet = new HashSet<Stream>();
	this.streamEscapeSet = new TreeSet<StreamEscape>();
	this.streamEquivalenceMap = new HashMap<Stream, StreamEquivalenceClass>();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:StreamResourceTracker.java

示例14: BetterTypeAnalysis

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
@SuppressWarnings("EI2")
	public BetterTypeAnalysis(MethodGen methodGen, String[] parameterSignatureList,
	                          CFG cfg, DepthFirstSearch dfs,
	                          TypeRepository typeRepository, TypeMerger typeMerger,
	                          RepositoryLookupFailureCallback lookupFailureCallback) {
		super(dfs);
		this.methodGen = methodGen;
		this.parameterSignatureList = parameterSignatureList;
//		this.cfg = cfg;
		this.typeRepository = typeRepository;
		this.typeMerger = typeMerger;
		this.lookupFailureCallback = lookupFailureCallback;
	}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:BetterTypeAnalysis.java

示例15: finish

import edu.umd.cs.findbugs.annotations.SuppressWarnings; //导入依赖的package包/类
/**
 * Mark the object as complete.
 *
 * @param missingClassList the list of names of missing classes
 */
@SuppressWarnings("EI2")
public void finish(String[] missingClassList) {
	if (missingClassList.length > 0)
		this.missingClassList = missingClassList;
	supertypeListInBFSOrder.trimToSize();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:SubtypeQueryResult.java


注:本文中的edu.umd.cs.findbugs.annotations.SuppressWarnings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。