Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issues with loading with or without AWS credentials #3

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/main/java/org/bigdataviewer/n5/XmlIoN5CloudImageLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import org.janelia.saalfeldlab.n5.N5Reader;
import org.janelia.saalfeldlab.n5.universe.N5Factory;
import org.janelia.saalfeldlab.n5.universe.N5Factory.StorageFormat;
import org.jdom2.Element;

import mpicbg.spim.data.XmlHelpers;
Expand Down Expand Up @@ -72,7 +73,23 @@ public N5CloudImageLoader fromXml( final Element elem, final URI basePathURI, fi
{
// final String version = elem.getAttributeValue( "version" );
final URI uri = XmlHelpers.loadPathURI( elem, "n5", basePathURI );
final N5Reader n5Reader = N5Factory.createReader( uri.toString() );
//final N5Reader n5Reader = N5Factory.createReader( uri.toString() );

N5Reader n5Reader;

try
{
//System.out.println( "Trying reading with credentials ..." );
N5Factory factory = new N5Factory();
factory.s3UseCredentials();
n5Reader = factory.openReader( StorageFormat.N5, uri );
}
catch ( Exception e )
{
//System.out.println( "With credentials failed; trying anonymous ..." );
n5Reader = new N5Factory().openReader( StorageFormat.N5, uri );
}

return new N5CloudImageLoader( n5Reader, uri, sequenceDescription );
}
}
Loading