firethorn

changeset 4294:7b4b6bf2b113 2.1.35-stv-issue-1182

Change in BaseTableVOTableController, added size check in ByteFormatter
author Stelios <stv@roe.ac.uk>
date Sun Mar 08 00:19:55 2020 +0200 (21 months ago)
parents a0341ca72077
children 0be118e0b007
files doc/notes/stv/20200305-Testing-1182.txt firethorn-webapp/src/main/java/uk/ac/roe/wfau/firethorn/webapp/votable/BaseTableVOTableController.java
line diff
     1.1 --- a/doc/notes/stv/20200305-Testing-1182.txt	Fri Mar 06 00:51:33 2020 +0200
     1.2 +++ b/doc/notes/stv/20200305-Testing-1182.txt	Sun Mar 08 00:19:55 2020 +0200
     1.3 @@ -293,7 +293,192 @@
     1.4  I-MDQ-QSUB-7 Submitting query: SELECT TOP 1 * FROM ATLASDR1.Filter
     1.5  I-MDQ-QSUB-8 Submitting query: SELECT TOP 1 * FROM ATLASDR1.FilterSections
     1.6  I-MDQ-QSUB-9 Submitting query: SELECT TOP 1 * FROM ATLASDR1.Multiframe
     1.7 +E-MDQ-QERX-1 Failed to parse result for TAP query SELECT TOP 1 * FROM BestDR1.DataConstants [The element type "TR" must be terminated by the matching end-tag "</TR>".]
     1.8 +org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1388; The element type "TR" must be terminated by the matching end-tag "</TR>".
     1.9 +	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1239)
    1.10 +	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    1.11 +	at uk.ac.starlink.ttools.taplint.VotLintTapRunner.readResultDocument(VotLintTapRunner.java:277)
    1.12 +	at uk.ac.starlink.ttools.taplint.VotLintTapRunner.readResultDocument(VotLintTapRunner.java:205)
    1.13 +	at uk.ac.starlink.ttools.taplint.VotLintTapRunner.executeQuery(VotLintTapRunner.java:112)
    1.14 +	at uk.ac.starlink.ttools.taplint.TapRunner.attemptGetResultTable(TapRunner.java:79)
    1.15 +	at uk.ac.starlink.ttools.taplint.ColumnMetadataStage$Checker.checkTable(ColumnMetadataStage.java:164)
    1.16 +	at uk.ac.starlink.ttools.taplint.ColumnMetadataStage$Checker.run(ColumnMetadataStage.java:145)
    1.17 +	at uk.ac.starlink.ttools.taplint.ColumnMetadataStage.run(ColumnMetadataStage.java:91)
    1.18 +	at uk.ac.starlink.ttools.taplint.TapLinter$4.execute(TapLinter.java:234)
    1.19 +	at uk.ac.starlink.ttools.task.LineInvoker.invoke(LineInvoker.java:303)
    1.20 +	at uk.ac.starlink.ttools.Stilts.main(Stilts.java:42)
    1.21 +E-MDQ-QERX-2 Failed to parse result for TAP query SELECT TOP 1 * FROM BestDR1.Frame [The element type "TR" must be terminated by the matching end-tag "</TR>".]
    1.22 +org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 6808; The element type "TR" must be terminated by the matching end-tag "</TR>".
    1.23 +	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1239)
    1.24 +	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    1.25 +	at uk.ac.starlink.ttools.taplint.VotLintTapRunner.readResultDocument(VotLintTapRunner.java:277)
    1.26 +	at uk.ac.starlink.ttools.taplint.VotLintTapRunner.readResultDocument(VotLintTapRunner.java:205)
    1.27 +	at uk.ac.starlink.ttools.taplint.VotLintTapRunner.executeQuery(VotLintTapRunner.java:112)
    1.28 +	at uk.ac.starlink.ttools.taplint.TapRunner.attemptGetResultTable(TapRunner.java:79)
    1.29 +	at uk.ac.starlink.ttools.taplint.ColumnMetadataStage$Checker.checkTable(ColumnMetadataStage.java:164)
    1.30 +	at uk.ac.starlink.ttools.taplint.ColumnMetadataStage$Checker.run(ColumnMetadataStage.java:145)
    1.31 +	at uk.ac.starlink.ttools.taplint.ColumnMetadataStage.run(ColumnMetadataStage.java:91)
    1.32 +	at uk.ac.starlink.ttools.taplint.TapLinter$4.execute(TapLinter.java:234)
    1.33 +	at uk.ac.starlink.ttools.task.LineInvoker.invoke(LineInvoker.java:303)
    1.34 +	at uk.ac.starlink.ttools.Stilts.main(Stilts.java:42)
    1.35  
    1.36  
    1.37 +2020-03-07 21:55:57,019 DEBUG [main-interface-4] [AbstractTableController] VOTABLE SQL [SELECT [XX_3B3RDH35VZR4OAAAAFYLN726NU] AS plateID, [XX_YGY2ZQF7GD7NSAAAAFYLN726OA] AS spRerun, [XX_CWE2AJ55BXX6UAAAAFYLN726OI] AS mjd, [XX_GAWHULRWTQ4U6AAAAFYLN726OU] AS plate, [XX_MB4WT3552XKZGAAAAFYLN726O4] AS tile, [XX_VLTGCL4FRH6YQAAAAFYLN726PE] AS mapMjd, [XX_SF5PA7ISEU5Z4AAAAFYLN726PM] AS nExp, [XX_AVNEDEEUS3QHOAAAAFYLN726PU] AS tai, [XX_FID5H6HPICWLUAAAAFYLN726P4] AS raBoresight, [XX_O4UN76VWK3CCMAAAAFYLN726QE] AS decBoresight, [XX_WU7IHMXE4M66UAAAAFYLN726QI] AS taiHMS, [XX_LLZR47YPAHTDIAAAAFYLN726QQ] AS expTime, [XX_UVLX5G7WDYCQQAAAAFYLN726QY] AS expTimeB1, [XX_7QJMKEIGIU7FEAAAAFYLN726RA] AS expTimeB2, [XX_QVJCHSZZH7PT2AAAAFYLN726RI] AS expTimeR1, [XX_LJZ5UCEGKAWMKAAAAFYLN726RQ] AS expTimeR2, [XX_LA5RF6EZP6DYWAAAAFYLN726RY] AS helioRV, [XX_WIIIVI2UPF4OOAAAAFYLN726SA] AS ra, [XX_BGXB2BRSMH6UGAAAAFYLN726SI] AS dec, [XX_AHI2HACBCWP2MAAAAFYLN726SQ] AS cx, [XX_4V24I4QCC45I6AAAAFYLN726SY] AS cy, [XX_YPKZSI2FLBZAIAAAAFYLN726TA] AS cz, [XX_EZVE3ZK5I45OSAAAAFYLN726TE] AS htmID, [XX_Q5QCA5HHLQBZKAAAAFYLN726TM] AS sn1_0, [XX_Z3ZGBJVEBFI2EAAAAFYLN726TU] AS sn1_1, [XX_EL2FOQTFU3UQIAAAAFYLN726TY] AS sn1_2, [XX_E7DTOKBU77IFYAAAAFYLN726UA] AS sn2_0, [XX_YNNXZOR4ZPDI4AAAAFYLN726UI] AS sn2_1, [XX_OPPF66MA2H6ZAAAAAFYLN726UM] AS sn2_2, [XX_GKNDT4ES7QXIKAAAAFYLN726UU] AS dateObs, [XX_UKNQXUTNPZNQSAAAAFYLN726U4] AS timeSys, [XX_KALHUXPWVDH44AAAAFYLN726VA] AS quality, [XX_BOUPGCPOH46GOAAAAFYLN726VI] AS name, [XX_3FX5IX5GRD2GIAAAAFYLN726VM] AS program, [XX_RIRMCIOR7OWZ4AAAAFYLN726VU] AS version, [XX_KHGIDNCKUNH5GAAAAFYLN726V4] AS observer, [XX_T3TBPO2PP2UXIAAAAFYLN726WE] AS camVer, [XX_BOOOP747GIO32AAAAFYLN726WM] AS spec2DVer, [XX_TQ3R5GOD52QAMAAAAFYLN726WU] AS utilsVer, [XX_C4L3CTATPSIFSAAAAFYLN726W4] AS spec1DVer, [XX_H4K2IK3NH5GUGAAAAFYLN726XE] AS readVer, [XX_DXYHJA6H76HO6AAAAFYLN726XI] AS combVer, [XX_QTS4365HS7PXAAAAAFYLN726XY] AS extinction_u, [XX_AMFO35VIP7CF2AAAAFYLN726YA] AS extinction_g, [XX_7ZHFSPKZ45W2EAAAAFYLN726YI] AS extinction_r, [XX_OMWMPWUX336ZKAAAAFYLN726ZA] AS extinction_i, [XX_LJXGWRWLEG7EOAAAAFYLN726ZI] AS extinction_z, [XX_OHX7FROEZ3MBYAAAAFYLN726ZM] AS isPrimary, [XX_M7GPEEQO3ZOZ4AAAAFYLN726ZU] AS cartridgeID, [XX_KR3Y4NSHXLAI2AAAAFYLN726Z4] AS plateVersion, [XX_KKRZJPEVKQCDUAAAAFYLN7262A] AS haMin, [XX_RGUWCCY3QNARIAAAAFYLN7262I] AS haMax, [XX_PJTTICJP5JGYGAAAAFYLN7262Q] AS mjdDesign, [XX_AXW6ECC34SP7IAAAAFYLN7262U] AS theta, [XX_2KX7VXQI3O7DIAAAAFYLN72624] AS fscanVersion, [XX_E24NAVLVULHACAAAAFYLN7263E] AS fmapVersion, [XX_MXRP5RNBUINN4AAAAFYLN7263I] AS fscanMode, [XX_NBOFX7452SSSOAAAAFYLN7263Q] AS fscanSpeed, [XX_HI7XA3HJE4HGIAAAAFYLN7263U] AS programType, [XX_K3UN453W5B3OCAAAAFYLN7263Y] AS programName, [XX_RQYVYJW76MQH2AAAAFYLN7264A] AS loadVersion, [XX_XENSGD2DHPVMEAAAAFYLN7264E] AS expID FROM [LIVEFirethornUserdataULOV20190307].[dbo].[XX_W4RVLBJBH5D4CAAAAFYLN726GA]] 
    1.38 +2020-03-07 21:55:57,025 DEBUG [main-interface-4] [AdqlTableEntity] columns() for [366605][temp.XX_W4RVLBJBH5D4CAAAAFYLN726GA] 
    1.39 +2020-03-07 21:55:57,025 DEBUG [main-interface-4] [BaseComponentEntity] scan for [366605][XX_W4RVLBJBH5D4CAAAAFYLN726GA] 
    1.40 +2020-03-07 21:55:57,025 DEBUG [main-interface-4] [BaseComponentEntity] scantest for [366605][XX_W4RVLBJBH5D4CAAAAFYLN726GA] 
    1.41 +2020-03-07 21:55:57,025 DEBUG [main-interface-4] [BaseComponentEntity$EntityFactory] scanperiod() 
    1.42 +2020-03-07 21:55:57,026 DEBUG [main-interface-4] [BaseComponentEntity$EntityFactory]   value [PT25H] 
    1.43 +2020-03-07 21:55:57,026 DEBUG [main-interface-4] [BaseComponentEntity] Factory scanperiod  [PT25H] 
    1.44 +2020-03-07 21:55:57,026 DEBUG [main-interface-4] [BaseComponentEntity] prevscan   [2020-03-07T21:55:54.095Z] 
    1.45 +2020-03-07 21:55:57,026 DEBUG [main-interface-4] [BaseComponentEntity] scanperiod [PT25H] 
    1.46 +2020-03-07 21:55:57,026 DEBUG [main-interface-4] [BaseComponentEntity] prev scan is recent - skipping 
    1.47 +2020-03-07 21:55:57,074 DEBUG [main-interface-4] [AbstractTableController] Exception:  
    1.48 +java.sql.SQLException: Unable to convert between net.sourceforge.jtds.jdbc.BlobImpl and TINYINT.
    1.49 +	at net.sourceforge.jtds.jdbc.Support.convert(Support.java:747)
    1.50 +	at net.sourceforge.jtds.jdbc.JtdsResultSet.getByte(JtdsResultSet.java:667)
    1.51 +	at net.sourceforge.jtds.jdbc.JtdsResultSet.getByte(JtdsResultSet.java:965)
    1.52 +	at uk.ac.roe.wfau.firethorn.webapp.votable.BaseTableVOTableController$ByteFormatter.format(BaseTableVOTableController.java:168)
    1.53 +	at uk.ac.roe.wfau.firethorn.webapp.votable.BaseTableVOTableController.cell(BaseTableVOTableController.java:413)
    1.54 +	at uk.ac.roe.wfau.firethorn.webapp.votable.AbstractTableController.cells(AbstractTableController.java:289)
    1.55 +	at uk.ac.roe.wfau.firethorn.webapp.votable.BaseTableVOTableController.row(BaseTableVOTableController.java:401)
    1.56 +	at uk.ac.roe.wfau.firethorn.webapp.votable.AbstractTableController.rows(AbstractTableController.java:259)
    1.57 +	at uk.ac.roe.wfau.firethorn.webapp.votable.AbstractTableController.body(AbstractTableController.java:384)
    1.58 +	at uk.ac.roe.wfau.firethorn.webapp.votable.AbstractTableController.write(AbstractTableController.java:435)
    1.59 +	at uk.ac.roe.wfau.firethorn.webapp.votable.AdqlTableVOTableController.votable(AdqlTableVOTableController.java:91)
    1.60 +	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    1.61 +	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    1.62 +	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    1.63 +	at java.lang.reflect.Method.invoke(Method.java:498)
    1.64 +	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
    1.65 +	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    1.66 +	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
    1.67 +	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
    1.68 +	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)
    1.69 +	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    1.70 +	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
    1.71 +	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    1.72 +	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
    1.73 +	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
    1.74 +	at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    1.75 +	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
    1.76 +	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    1.77 +	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    1.78 +	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    1.79 +	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    1.80 +	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    1.81 +	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    1.82 +	at uk.ac.roe.wfau.firethorn.webapp.catalina.ConnectionConfigFilter.doFilter(ConnectionConfigFilter.java:50)
    1.83 +	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    1.84 +	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    1.85 +	at uk.ac.roe.wfau.firethorn.webapp.pratchett.GnuTerryPratchett.doFilter(GnuTerryPratchett.java:58)
    1.86 +	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    1.87 +	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    1.88 +	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    1.89 +	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    1.90 +	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491)
    1.91 +	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
    1.92 +	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    1.93 +	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
    1.94 +	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    1.95 +	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    1.96 +	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
    1.97 +	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    1.98 +	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:764)
    1.99 +	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1388)
   1.100 +	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   1.101 +	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   1.102 +	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   1.103 +	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   1.104 +	at java.lang.Thread.run(Thread.java:748)
   1.105 +2020-03-07 21:55:57,075 ERROR [main-interface-4] [AbstractTableController] Exception reading SQL results [Unable to convert between net.sourceforge.jtds.jdbc.BlobImpl and TINYINT.] 
   1.106 +2020-03-07 21:55:57,077 DEBUG [main-interface-4] [HttpRequestDebug] Response headers 
   1.107  
   1.108 +# Looks like this does not work
   1.109 +# firethorn-webapp/src/main/java/uk/ac/roe/wfau/firethorn/webapp/votable/BaseTableVOTableController.java  / Line:168
   1.110 +  ..
   1.111  
   1.112 +  boolean isarray;
   1.113 +
   1.114 +	try {
   1.115 +		isarray = column.meta().adql().type().isarray();
   1.116 +			} catch (ProtectionException e) {
   1.117 +				isarray = false;
   1.118 +			}
   1.119 +
   1.120 +			if (!isarray) {
   1.121 +			    byte shortval = results.getByte(  ## Error in this line <-------------------
   1.122 +			            index()
   1.123 +			        );
   1.124 +			    builder.append(shortval);       
   1.125 +					
   1.126 +			} else {
   1.127 +			    
   1.128 +			    byte[] bytes = results.getBytes(
   1.129 +			        index()
   1.130 +			    );
   1.131 +			    
   1.132 +			    for (byte b : bytes) {
   1.133 +			        if(b<0) aux=256+b; else aux=b; 
   1.134 +			            builder.append(aux  + " ");
   1.135 +			    } 
   1.136 +				  
   1.137 +			}
   1.138 +		
   1.139 +}
   1.140 +
   1.141 +
   1.142 +
   1.143 +..
   1.144 +
   1.145 +
   1.146 +## This was fails
   1.147 +    
   1.148 +   http://gillian:8080/firethorn/tap/332798/sync?QUERY=SELECT+TOP+5+%2A+FROM+BestDR1.PlateX&REQUEST=doQuery&LANG=ADQL&FORMAT=VOTABLE
   1.149 +
   1.150 +
   1.151 +## Test passes after fixing the above to this:
   1.152 +
   1.153 +
   1.154 +               String byteArrayString = "";
   1.155 +                int aux;
   1.156 +	        final StringBuilder builder = new StringBuilder(); 
   1.157 +                int size=0;
   1.158 +                
   1.159 +                if (results.getObject(index())!=null){
   1.160 +                	
   1.161 +                    boolean isarray;
   1.162 +
   1.163 +                	try {
   1.164 +                		isarray = column.meta().adql().type().isarray();
   1.165 +                		size =  column.meta().adql().arraysize();
   1.166 +					} catch (ProtectionException e) {
   1.167 +						isarray = false;
   1.168 +					}
   1.169 +
   1.170 +					if (!isarray && size<=0) {
   1.171 +					    byte shortval = results.getByte(
   1.172 +					            index()
   1.173 +					        );
   1.174 +					    builder.append(shortval);       
   1.175 +							
   1.176 +					} else {
   1.177 +					    
   1.178 +					    byte[] bytes = results.getBytes(
   1.179 +					        index()
   1.180 +					    );
   1.181 +					    
   1.182 +					    for (byte b : bytes) {
   1.183 +					        if(b<0) aux=256+b; else aux=b; 
   1.184 +					            builder.append(aux  + " ");
   1.185 +					    } 
   1.186 +						  
   1.187 +					}
   1.188 +				
   1.189 +                }
   1.190 +
   1.191 +                byteArrayString = builder.toString();
   1.192 +                return byteArrayString.trim();
   1.193 +
   1.194 +
   1.195 +
     2.1 --- a/firethorn-webapp/src/main/java/uk/ac/roe/wfau/firethorn/webapp/votable/BaseTableVOTableController.java	Fri Mar 06 00:51:33 2020 +0200
     2.2 +++ b/firethorn-webapp/src/main/java/uk/ac/roe/wfau/firethorn/webapp/votable/BaseTableVOTableController.java	Sun Mar 08 00:19:55 2020 +0200
     2.3 @@ -153,19 +153,21 @@
     2.4                  String byteArrayString = "";
     2.5                  int aux;
     2.6  	            final StringBuilder builder = new StringBuilder(); 
     2.7 -                		
     2.8 +                int size=0;
     2.9 +                
    2.10                  if (results.getObject(index())!=null){
    2.11                  	
    2.12                      boolean isarray;
    2.13  
    2.14                  	try {
    2.15                  		isarray = column.meta().adql().type().isarray();
    2.16 +                		size =  column.meta().adql().arraysize();
    2.17  					} catch (ProtectionException e) {
    2.18  						isarray = false;
    2.19  					}
    2.20  
    2.21 -					if (!isarray) {
    2.22 -					    short shortval = results.getShort(
    2.23 +					if (!isarray && size<=0) {
    2.24 +					    byte shortval = results.getByte(
    2.25  					            index()
    2.26  					        );
    2.27  					    builder.append(shortval);