Skip to content

Commit d085ead

Browse files
committed
FIREFLY-172: put back read from URL in VoTableReader
- set higher logging level for starlink to avoid repetitive warning messages
1 parent 6d0d1a4 commit d085ead

File tree

3 files changed

+8
-21
lines changed

3 files changed

+8
-21
lines changed

config/logging.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ java.util.logging.FileHandler.append=true
1212
#java.util.logging.FileHandler.count=3
1313
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
1414

15+
# lower starlink logging level to avoid the enormous amount of repetitive warning messages
16+
uk.ac.starlink.votable.level=SEVERE

src/firefly/java/edu/caltech/ipac/firefly/server/persistence/QueryVOTABLE.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public abstract class QueryVOTABLE extends IpacTablePartProcessor {
4242
public DataGroup fetchDataGroup(TableServerRequest req) throws DataAccessException {
4343
try {
4444
File votable = getSearchResult(getQueryString(req), getFilePrefix(req));
45-
DataGroup[] groups = VoTableReader.voToDataGroups(votable.getAbsolutePath(), false);
45+
DataGroup[] groups = VoTableReader.voToDataGroups(votable.getAbsolutePath());
4646
DataGroup dg;
4747
int tblIdx = req.getIntParam(TBL_INDEX, 0);
4848
if (groups.length <= tblIdx ) {

src/firefly/java/edu/caltech/ipac/table/io/VoTableReader.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,9 @@ public static DataGroup[] voToDataGroups(String location) throws IOException {
6161
* @return an array of DataGroup object
6262
*/
6363
public static DataGroup[] voToDataGroups(String location, boolean headerOnly) throws IOException, DataAccessException {
64-
//VOTableBuilder votBuilder = new VOTableBuilder();
6564
List<DataGroup> groups = new ArrayList<>();
6665

6766
try {
68-
//DataSource datsrc = DataSource.makeDataSource(voTableFile);
69-
//StoragePolicy policy = StoragePolicy.getDefaultPolicy();
70-
//TableSequence tseq = votBuilder.makeStarTables( datsrc, policy );
71-
//StarTableFactory stFactory = new StarTableFactory();
72-
//TableSequence tseq = stFactory.makeStarTables(location, null);
7367

7468
List<TableElement> tableAry = getTableElementsFromFile( location, null);
7569
for ( TableElement tableEl : tableAry ) {
@@ -109,23 +103,19 @@ private static String getElementAttribute(VOElement element, String attName) {
109103
}
110104

111105
// root VOElement for a votable file
112-
private static VOElement makeVOElement(File infile, StoragePolicy policy) throws DataAccessException {
106+
private static VOElement getVOElementFromVOTable(String location, StoragePolicy policy) throws DataAccessException {
113107
try {
114108
policy = policy == null ? PREFER_MEMORY : policy;
115109
VOElementFactory voFactory = new VOElementFactory();
116110
voFactory.setStoragePolicy(policy);
117-
return voFactory.makeVOElement(infile);
111+
return voFactory.makeVOElement(location);
118112
} catch (SAXException |IOException e) {
119113
e.printStackTrace();
120-
throw new DataAccessException("unable to parse "+ infile.getPath() + "\n" +
114+
throw new DataAccessException("unable to parse "+ location + "\n" +
121115
e.getMessage(), e);
122116
}
123117
}
124118

125-
private static VOElement getVOElementFromVOTable(String location, StoragePolicy policy) throws DataAccessException {
126-
return makeVOElement(new File(location), policy);
127-
}
128-
129119
// get all <RESOURCE> under VOTable root or <RESOURCE>
130120
private static VOElement[] getResourceChildren(VOElement parent) {
131121
return parent.getChildrenByName( "RESOURCE" );
@@ -325,11 +315,6 @@ private static List<LinkInfo> makeLinkInfosFromField(TableElement tableEl, DataT
325315
LinkInfo linkObj = linkElementToLinkInfo(link);
326316

327317
if (linkObj != null) {
328-
List<LinkInfo> dtLinkInfos = dt.getLinkInfos();
329-
330-
if (dtLinkInfos != null) {
331-
dtLinkInfos.add(linkObj);
332-
}
333318
linkObjs.add(linkObj);
334319
}
335320
}
@@ -578,7 +563,7 @@ private static DataGroup convertToDataGroup(TableElement tableEl, StarTable tabl
578563

579564
// child elements <LINK> and <VALUES>
580565
if (tableEl != null) {
581-
makeLinkInfosFromField(tableEl, dt);
566+
dt.setLinkInfos(makeLinkInfosFromField(tableEl, dt));
582567
getValuesFromField(tableEl, dt);
583568
}
584569

@@ -767,7 +752,7 @@ private static GroupInfo.RefInfo refInfoFromEl(VOElement el) {
767752
public static FileAnalysis.Report analyze(File infile, FileAnalysis.ReportType type) throws Exception {
768753

769754
FileAnalysis.Report report = new FileAnalysis.Report(type, TableUtil.Format.VO_TABLE.name(), infile.length(), infile.getPath());
770-
VOElement root = makeVOElement(infile, null);
755+
VOElement root = getVOElementFromVOTable(infile.getAbsolutePath(), null);
771756
List<FileAnalysis.Part> parts = describeDocument(root);
772757
parts.forEach(report::addPart);
773758

0 commit comments

Comments
 (0)