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


Java ClosedFileSystemException类代码示例

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


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

示例1: test

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
void test(boolean withOption) {
    System.err.println("Testing " + (withOption ? "with" : "without") + " option");
    try {
        String dump = "";
        RootDoc root = getRootDoc(withOption);
        for (ClassDoc cd: root.specifiedClasses()) {
            dump += dump(cd);
        }
        if (dump.contains("lib.Lib2.i")) {
            if (!withOption) {
                error("control case failed: Lib2 class file was read, unexpectedly, without using option");
            }
        } else {
            if (withOption) {
                error("test case failed: could not read Lib2 class file, using option");
            }
        }
    } catch (ClosedFileSystemException e) {
        error("Unexpected exception: " + e);
    }
    System.err.println();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:T8147801.java

示例2: test

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
void test(boolean withOption) {
    System.err.println("Testing " + (withOption ? "with" : "without") + " option");
    try {
        RootDoc root = getRootDoc(withOption);
        for (ClassDoc cd: root.specifiedClasses()) {
            dump("", cd);
        }
        if (!withOption) {
            error("expected option did not occur");
        }
    } catch (ClosedFileSystemException e) {
        if (withOption) {
            error("Unexpected exception: " + e);
        } else {
            System.err.println("Exception received as expected: " + e);
        }
    }
    System.err.println();
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:20,代码来源:T8147801.java

示例3: testCloseWillThrowAnExceptionForSubsequentCalls

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
@Test
public void testCloseWillThrowAnExceptionForSubsequentCalls() throws IOException {
	context.checking(new Expectations() {{
		allowing(cloudHostSettings).getName();
		will(returnValue("unit-test"));
		
		exactly(1).of(blobStoreContext).close();
	}});

	impl.close();
	Assert.assertFalse(impl.isOpen());
	
	try {
		impl.getBlobStoreContext();
		Assert.fail("Expected an exception");
	} catch (ClosedFileSystemException e) {
		// OK
	}
}
 
开发者ID:brdara,项目名称:java-cloud-filesystem-provider,代码行数:20,代码来源:CloudFileSystemTest.java

示例4: close

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
@Override
public void close(String runID) throws InvalidRunIdException, InvalidExecutionIdException {
	Run run = getRun(runID);
	try {
		Bundle dataBundle = run.getDataBundle();
		DataBundles.closeBundle(dataBundle);
	} catch (IOException | ClosedFileSystemException e) {
		logger.log(Level.WARNING, "Error closing data bundle for run " + runID, e);
	}
	runMap.remove(runID);
	postEvent(RUN_CLOSED, runID);
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:13,代码来源:RunServiceImpl.java

示例5: getOrigFS

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
/**
 * Thread-safe ClosedFileSystemException test
 * 
 * @return
 */
protected FileSystem getOrigFS() {
	FileSystem orig = origFS;
	if (orig == null || !orig.isOpen()) {
		throw new ClosedFileSystemException();
	}
	return orig;
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:13,代码来源:BundleFileSystem.java

示例6: supportedFileAttributeViews

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
@Override
public Set<String> supportedFileAttributeViews() {
	if (origFS == null) {
		throw new ClosedFileSystemException();
	}
	return origFS.supportedFileAttributeViews();
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:8,代码来源:BundleFileSystem.java

示例7: testClosedFSnewByteChannel

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
@Test( expected = ClosedFileSystemException.class )
@Category( Closable.class )
public void testClosedFSnewByteChannel() throws Exception {
    getClosedFS();

    FS.provider().newByteChannel( getClosedFileA(), Sets.asSet( READ ) );
}
 
开发者ID:openCage,项目名称:niotest,代码行数:8,代码来源:Tests07Closed.java

示例8: testCheckOpen

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
@Test
public void testCheckOpen() throws IOException {
  state.checkOpen(); // does not throw
  state.close();
  try {
    state.checkOpen();
    fail();
  } catch (ClosedFileSystemException expected) {
  }
}
 
开发者ID:google,项目名称:jimfs,代码行数:11,代码来源:FileSystemStateTest.java

示例9: shouldFindDescendantExceptionMapperFromException

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
@Test
public void shouldFindDescendantExceptionMapperFromException() throws Exception {
	Optional<JsonApiExceptionMapper> mapper = exceptionMapperRegistry.findMapperFor(ClosedFileSystemException.class);
	assertThat(mapper.isPresent()).isTrue();
	assertThat(mapper.get()).isExactlyInstanceOf(IllegalStateExceptionMapper.class);
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:7,代码来源:ExceptionMapperRegistryTest.java

示例10: run

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
void run() throws Exception {
    ToolBox tb = new ToolBox();
    Path jar = createJar(tb);

    Path src = Paths.get("src");
    tb.writeJavaFiles(src, "class C { p1.C1 c1; }");

    JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
    PrintWriter out = new PrintWriter(System.err, true);
    StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
    List<String> options = Arrays.asList("-classpath", jar.toString(), "-proc:none");
    Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(src.resolve("C.java"));
    com.sun.source.util.JavacTask task =
            (com.sun.source.util.JavacTask) comp.getTask(out, fm, null, options, null, files);
    task.parse();

    Elements elems = task.getElements();

    try {
        // Use  p1, p1.C1 as a control to verify normal behavior
        PackageElement p1 = elems.getPackageElement("p1");
        TypeElement p1C1 = elems.getTypeElement("p1.C1");
        System.err.println("p1: " + p1 + ";  p1C1: " + p1C1);
        if (p1C1 == null) {
            throw new Exception("p1.C1 not found");
        }

        // Now repeat for p2, p2.C2, closing the file manager early
        PackageElement p2 = elems.getPackageElement("p2");
        System.err.println("closing file manager");
        fm.close();
        TypeElement p2C2 = elems.getTypeElement("p2.C2");
        System.err.println("p2: " + p2 + ";  p2C2: " + p2C2);
        if (p2C2 != null) {
            throw new Exception("p2.C2 found unexpectedly");
        }
    } catch (ClosedFileSystemException e) {
        throw new Exception("unexpected exception thrown", e);
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:42,代码来源:FileSystemClosedTest.java

示例11: ensureOpen

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
final void ensureOpen() throws IOException {
    if (!isOpen()) {
        throw new ClosedFileSystemException();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:JrtFileSystem.java

示例12: checkClosed

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
void checkClosed() throws ClosedFileSystemException {
	if (closed.get()) {
		throw new ClosedFileSystemException();
	}
}
 
开发者ID:brdara,项目名称:java-cloud-filesystem-provider,代码行数:6,代码来源:CloudFileSystem.java

示例13: shouldFindDescendantExceptionMapperFromException

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
@Test
public void shouldFindDescendantExceptionMapperFromException() throws Exception {
    Optional<JsonApiExceptionMapper> mapper = exceptionMapperRegistry.findMapperFor(ClosedFileSystemException.class);
    assertThat(mapper.isPresent()).isTrue();
    assertThat(mapper.get()).isExactlyInstanceOf(IllegalStateExceptionMapper.class);
}
 
开发者ID:katharsis-project,项目名称:katharsis-framework,代码行数:7,代码来源:ExceptionMapperRegistryTest.java

示例14: checkClosed

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
private void checkClosed() {
  if(closed) throw new ClosedFileSystemException();
}
 
开发者ID:beijunyi,项目名称:ParallelGit,代码行数:4,代码来源:GfsStatusProvider.java

示例15: ensureOpen

import java.nio.file.ClosedFileSystemException; //导入依赖的package包/类
private void ensureOpen() throws IOException {
    if (!isOpen) {
        throw new ClosedFileSystemException();
    }
}
 
开发者ID:forax,项目名称:jigsaw-jrtfs,代码行数:6,代码来源:JrtFileSystem.java


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