X Tutup
Skip to content

Commit baefba4

Browse files
authored
Merge pull request #995 from aalhossary/master
Miscellaneous and minor enhancements
2 parents 6a54e3a + d62c7e6 commit baefba4

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public static String toUnixPath(String path) {
200200
public static String expandUserHome(String file) {
201201
// replace any / with the proper separator (/ or \ for Linux and Windows respectively).
202202
file = file.replaceAll("/", "\\"+File.separator); //The "\\" is to escape the separator if needed.
203-
if (file.startsWith("~" + File.separator)) {
203+
if (file.startsWith("~") && (file.length() == 1 || File.separator.equals(file.substring(1, 2)))) {
204204
file = System.getProperty("user.home") + file.substring(1);
205205
}
206206
return file;

biojava-core/src/test/java/org/biojava/nbio/core/util/FileDownloadUtilsTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ void unixPathReturnedUnchanged(){
131131
class ExpandUserHome {
132132
String currUserHome = System.getProperty("user.home");
133133
@Test
134+
void minimalPath (){
135+
String path="~";
136+
assertEquals(currUserHome, FileDownloadUtils.expandUserHome(path));
137+
}
138+
@Test
134139
void simplePath (){
135140
String path="~/sequence.gb";
136141
assertEquals(currUserHome+File.separator+"sequence.gb", FileDownloadUtils.expandUserHome(path));

biojava-modfinder/src/main/java/org/biojava/nbio/phosphosite/Dataset.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,21 @@
2020
*/
2121
package org.biojava.nbio.phosphosite;
2222

23-
import org.biojava.nbio.structure.align.util.AtomCache;
24-
import org.slf4j.Logger;
25-
import org.slf4j.LoggerFactory;
26-
27-
import java.io.*;
23+
import java.io.BufferedInputStream;
24+
import java.io.File;
25+
import java.io.FileOutputStream;
26+
import java.io.IOException;
27+
import java.io.InputStream;
2828
import java.net.URL;
2929
import java.nio.file.Files;
3030
import java.nio.file.StandardCopyOption;
31-
import java.util.ArrayList;
3231
import java.util.Arrays;
3332
import java.util.List;
3433
import java.util.stream.Collectors;
35-
import java.util.stream.Stream;
34+
35+
import org.biojava.nbio.structure.align.util.AtomCache;
36+
import org.slf4j.Logger;
37+
import org.slf4j.LoggerFactory;
3638

3739
/**
3840
* Phosphosite is available under the PhosphoSitePlus® is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License and is freely available for non-commercial purposes from

biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ private void pdb_ATOM_Handler(String line) {
17261726
startOfMolecule = false;
17271727

17281728

1729-
Character altLoc = new Character(line.substring (16, 17).charAt(0));
1729+
Character altLoc = line.substring (16, 17).charAt(0);
17301730
Group altGroup = null;
17311731

17321732

@@ -1931,7 +1931,7 @@ private void pdb_ATOM_Handler(String line) {
19311931

19321932

19331933

1934-
}
1934+
}
19351935

19361936

19371937
private Group getCorrectAltLocGroup( Character altLoc,

0 commit comments

Comments
 (0)
X Tutup