@@ -61,15 +61,9 @@ public static DataGroup[] voToDataGroups(String location) throws IOException {
61
61
* @return an array of DataGroup object
62
62
*/
63
63
public static DataGroup [] voToDataGroups (String location , boolean headerOnly ) throws IOException , DataAccessException {
64
- //VOTableBuilder votBuilder = new VOTableBuilder();
65
64
List <DataGroup > groups = new ArrayList <>();
66
65
67
66
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);
73
67
74
68
List <TableElement > tableAry = getTableElementsFromFile ( location , null );
75
69
for ( TableElement tableEl : tableAry ) {
@@ -109,23 +103,19 @@ private static String getElementAttribute(VOElement element, String attName) {
109
103
}
110
104
111
105
// 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 {
113
107
try {
114
108
policy = policy == null ? PREFER_MEMORY : policy ;
115
109
VOElementFactory voFactory = new VOElementFactory ();
116
110
voFactory .setStoragePolicy (policy );
117
- return voFactory .makeVOElement (infile );
111
+ return voFactory .makeVOElement (location );
118
112
} catch (SAXException |IOException e ) {
119
113
e .printStackTrace ();
120
- throw new DataAccessException ("unable to parse " + infile . getPath () + "\n " +
114
+ throw new DataAccessException ("unable to parse " + location + "\n " +
121
115
e .getMessage (), e );
122
116
}
123
117
}
124
118
125
- private static VOElement getVOElementFromVOTable (String location , StoragePolicy policy ) throws DataAccessException {
126
- return makeVOElement (new File (location ), policy );
127
- }
128
-
129
119
// get all <RESOURCE> under VOTable root or <RESOURCE>
130
120
private static VOElement [] getResourceChildren (VOElement parent ) {
131
121
return parent .getChildrenByName ( "RESOURCE" );
@@ -325,11 +315,6 @@ private static List<LinkInfo> makeLinkInfosFromField(TableElement tableEl, DataT
325
315
LinkInfo linkObj = linkElementToLinkInfo (link );
326
316
327
317
if (linkObj != null ) {
328
- List <LinkInfo > dtLinkInfos = dt .getLinkInfos ();
329
-
330
- if (dtLinkInfos != null ) {
331
- dtLinkInfos .add (linkObj );
332
- }
333
318
linkObjs .add (linkObj );
334
319
}
335
320
}
@@ -578,7 +563,7 @@ private static DataGroup convertToDataGroup(TableElement tableEl, StarTable tabl
578
563
579
564
// child elements <LINK> and <VALUES>
580
565
if (tableEl != null ) {
581
- makeLinkInfosFromField (tableEl , dt );
566
+ dt . setLinkInfos ( makeLinkInfosFromField (tableEl , dt ) );
582
567
getValuesFromField (tableEl , dt );
583
568
}
584
569
@@ -767,7 +752,7 @@ private static GroupInfo.RefInfo refInfoFromEl(VOElement el) {
767
752
public static FileAnalysis .Report analyze (File infile , FileAnalysis .ReportType type ) throws Exception {
768
753
769
754
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 );
771
756
List <FileAnalysis .Part > parts = describeDocument (root );
772
757
parts .forEach (report ::addPart );
773
758
0 commit comments