use of java.util.zip.ZipError in project j2objc by google.
the class ZipErrorTest method test_constructor.
/**
* {@link java.util.zip.ZipError#ZipError(String)}
*/
public void test_constructor() {
ZipError error = new ZipError("ZipError");
assertEquals("ZipError", error.getMessage());
}
use of java.util.zip.ZipError in project spf4j by zolyfarkas.
the class MavenSchemaResolver method resolveSchema.
@Override
@SuppressFBWarnings("PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP")
public Schema resolveSchema(final String id) {
SchemaRef ref = new SchemaRef(id);
try {
File artifact = MavenRepositoryUtils.resolveArtifact(ref.getGroupId(), ref.getArtifactId(), classifier, extension, ref.getVersion(), remotes, repoSystem, repoSystemSession);
URI zipUri = URI.create("jar:" + artifact.toURI().toURL());
FileSystem zipFs;
synchronized (zipUri.toString().intern()) {
// newFileSystem fails if already one there...
try {
zipFs = FileSystems.newFileSystem(zipUri, Collections.emptyMap());
} catch (FileSystemAlreadyExistsException ex) {
zipFs = FileSystems.getFileSystem(zipUri);
} catch (ZipError ze) {
throw new AvroRuntimeException("Cannot resolve " + id, ze);
}
}
for (Path root : zipFs.getRootDirectories()) {
Path index = root.resolve("schema_index.properties");
if (Files.exists(index)) {
Properties prop = new Properties();
try (BufferedReader indexReader = Files.newBufferedReader(index)) {
prop.load(indexReader);
}
String schemaName = prop.getProperty(ref.getRef());
if (schemaName == null) {
throw new AvroRuntimeException("unable to resolve schema: " + id + " missing from index " + index);
}
Path schemaPath = root.resolve(schemaName.replace('.', '/') + ".avsc");
try (BufferedInputStream bis = new BufferedInputStream(Files.newInputStream(schemaPath))) {
return new Schema.Parser().parse(bis);
}
}
}
throw new IOException("unable to resolve schema: " + id);
} catch (ArtifactResolutionException | IOException ex) {
throw new AvroRuntimeException("Cannot resolve " + id, ex);
}
}
use of java.util.zip.ZipError in project j2objc by google.
the class ZipErrorTest method test_serialization.
/**
* java.util.zip.ZipError#Serialization()
*/
public void test_serialization() throws Exception {
ZipError error = new ZipError("serialization test");
SerializationTest.verifySelf(error);
}
use of java.util.zip.ZipError in project j2objc by google.
the class ZipErrorTest method testSerializationCompatibility.
/**
* serialization/deserialization compatibility with RI.
*/
public void testSerializationCompatibility() throws Exception {
ZipError error = new ZipError("serialization test");
SerializationTest.verifyGolden(this, error);
}
Aggregations