Comments (4)
Holder ... However another developer could easily make the mistake of adding a static method that does not need data.
I'd say that is extremely unlikely. The design is such that Config has only the one job and I don't see that design changing. We get no real benefit from adding a Holder class per se. I don't think we need to make such a change.
Should throw either UncheckedIOException or ignored (as in the file no longer exists).
Well I don't think it should be ignored, I don't see a strong argument that ignoring that FileNotFoundException is the right thing to do.
It is certainly an unexpected state that a resource file exists and then doesn't when it is read. Throwing UncheckedIOException seems ok but IllegalStateException also seems ok given it has detected an unexpected and illegal state. I'll have a closer look there.
from avaje-config.
So yes lets change to use UncheckedIOException for better consistency.
I'll rename this issue to reflect this change. I don't see the desire for the Holder change but it you want to continue to push for that add some more comments here and lets see.
from avaje-config.
I've no objections to this
from avaje-config.
Also this:
Should throw either UncheckedIOException
or ignored (as in the file no longer exists).
EDIT that whole code block looks like duplication of stuff that Configuration.builder should do or know about:
InputStream resource(String resourcePath, InitialLoader.Source source) {
InputStream is = null;
if (source == InitialLoader.Source.RESOURCE) {
is = resourceStream(resourcePath);
if (is != null) {
loadedResources.add("resource:" + resourcePath);
}
} else {
File file = new File(resourcePath);
if (file.exists()) {
try {
is = new FileInputStream(file);
loadedResources.add("file:" + resourcePath);
loadedFiles.add(file);
} catch (FileNotFoundException e) {
throw new IllegalStateException(e);
}
}
}
return is;
}
EDIT whoops I put this in the wrong place
from avaje-config.
Related Issues (20)
- ENH: Add Configuration.evalModify() ... to perform evaluation of expressions that modify properties in place
- Use AppLog.getLogger() rather than System.getLogger() to allow customization
- Remove the warning log messages when yml file extension is used rather than yaml
- Change so that properties via command line arguments is ALWAYS read (it wasn't when test resources detected)
- load.properties parameter should load from jar resources HOT 5
- loading from .localdev supports .yaml but not .yml (Add support for .yml with .localdev configuration)
- Maven Plugin Feature (and some other features). HOT 28
- SPI for initialization HOT 46
- Change from System.Logger to use events and control how those events are logged. HOT 2
- Event System does not coalesce changes properly HOT 8
- Document or fix hard dependency on avaje-inject when using module-path HOT 15
- Interpolation doesn't work in the same resource file.
- Multi-Profile support
- Make a Parser interface
- Support TOML? HOT 5
- Load configuration from a specific file - is it possible? HOT 14
- Extracting property source. HOT 6
- Inconsistency with builder and initial loader. Default resource loader does not use the System class loader? HOT 19
- Potential NPE in CoreConfigurationBuilder HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avaje-config.