Skip to content

Commit 6e6ba98

Browse files
committed
A bunch of small fixes, mostly docs and logs
1 parent a9e9c69 commit 6e6ba98

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

biojava-core/src/main/java/org/biojava/nbio/core/util/InputStreamProvider.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ public InputStreamProvider() {
7878

7979
}
8080

81-
/** get an InputStream for this file
82-
*
81+
/**
82+
* Get an InputStream for given file path.
83+
* The caller is responsible for closing the stream or otherwise
84+
* a resource leak can occur.
8385
* @param pathToFile the path of the file.
8486
* @return an InputStream for the file located at the path.
8587
* @throws IOException
@@ -144,8 +146,10 @@ public InputStream getInputStream(URL u)
144146
}
145147

146148

147-
/** get an InputStream for the file
148-
*
149+
/**
150+
* Get an InputStream for the file.
151+
* The caller is responsible for closing the stream or otherwise
152+
* a resource leak can occur.
149153
* @param f a File
150154
* @return an InputStream for the file
151155
* @throws IOException
@@ -229,7 +233,8 @@ else if ( fileName.endsWith(".Z")) {
229233
}
230234

231235

232-
/** Wrapper for new FileInputStream. if System.property biojava.cache.files is set, will try to load files from memory cache.
236+
/**
237+
* Wrapper for new FileInputStream. if System.property biojava.cache.files is set, will try to load files from memory cache.
233238
*
234239
* @param f
235240
* @return

biojava-structure/src/main/java/org/biojava/nbio/structure/contact/Grid.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
*/
3636
public class Grid {
3737

38-
private static final int SCALE=100; // i.e. we use units of hundreds of Amstrongs (thus cutoffs can be specified with a maximum precision of 0.01A)
38+
/**
39+
* The scale: we use units of hundredths of Angstroms (thus cutoffs can be specified with a maximum precision of 0.01A)
40+
*/
41+
private static final int SCALE=100;
3942

4043
private GridCell[][][] cells;
4144

@@ -160,7 +163,6 @@ public void addAtoms(Atom[] atoms, BoundingBox bounds) {
160163
* the 2 grids (i and j) are no more than one cell size apart. If they don't
161164
* overlap then they are too far apart so there's nothing to calculate, we set
162165
* the noOverlap flag and then {@link #getContacts()} will do no calculation at all.
163-
164166
*/
165167
private void fillGrid() {
166168

biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ private void writeID(StringWriter writer, String currentID) throws IOException{
212212

213213
}
214214

215-
/** Loads the definitions for this {@link ChemComp} from a local file and instantiates a new object.
215+
/**
216+
* Loads the definitions for this {@link ChemComp} from a local file and instantiates a new object.
216217
*
217218
* @param recordName the ID of the {@link ChemComp}
218219
* @return a new {@link ChemComp} definition.
@@ -263,7 +264,8 @@ public ChemComp getChemComp(String recordName) {
263264

264265
} catch (IOException e) {
265266

266-
logger.error("Could not parse chemical component file "+filename, e);
267+
logger.error("Could not parse chemical component file {}. Error: {}. "
268+
+ "There will be no chemical component info available for {}", filename, e.getMessage(), recordName);
267269

268270
}
269271
finally{
@@ -273,7 +275,7 @@ public ChemComp getChemComp(String recordName) {
273275
inStream.close();
274276
} catch (IOException e) {
275277
// This would be weird...
276-
logger.error("COULD NOT CLOSE CHEMICAL COMPONENT FILE ->>>>> RESOURCE LEAK RESOURCE LEAK. MAYDAY!!!!!!!!! MAYDAY!!!!");
278+
logger.error("Could not close chemical component file {}. A resource leak could occur!!", filename);
277279
}
278280
}
279281

biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,9 +973,9 @@ private Object buildObject(String className, List<String> loopFields, List<Strin
973973
m.invoke(o, val);
974974
}
975975
} catch (IllegalAccessException e) {
976-
logger.error("Could not invoke setter {} with value {} for class {}", m, val, className);
976+
logger.error("Could not invoke setter {} with value {} for class {}", methodName, val, className);
977977
} catch (InvocationTargetException e) {
978-
logger.error("Could not invoke setter {} with value {} for class {}", m, val, className);
978+
logger.error("Could not invoke setter {} with value {} for class {}", methodName, val, className);
979979
}
980980

981981
}

biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ private void findBridges() {
464464
Collections.sort(outList, new Comparator<Pair<Integer>>() {
465465
@Override
466466
public int compare(Pair<Integer> o1, Pair<Integer> o2) {
467-
// TODO Auto-generated method stub
468467
if(o1.getFirst()<o2.getFirst()){
469468
return -1;
470469
}

0 commit comments

Comments
 (0)