firethorn

changeset 4211:006fd7e861d3 2.1.28-tap-issues

Updated VOTable Controller to fix Byte Array Issue
author Stelios <stv@roe.ac.uk>
date Wed May 08 23:20:39 2019 +0300 (2019-05-08)
parents 4e7203353cf7
children 40233dc8a520 265f721c3327
files firethorn-webapp/src/main/java/uk/ac/roe/wfau/firethorn/webapp/votable/BaseTableVOTableController.java
line diff
     1.1 --- a/firethorn-webapp/src/main/java/uk/ac/roe/wfau/firethorn/webapp/votable/BaseTableVOTableController.java	Tue Apr 30 18:25:08 2019 +0300
     1.2 +++ b/firethorn-webapp/src/main/java/uk/ac/roe/wfau/firethorn/webapp/votable/BaseTableVOTableController.java	Wed May 08 23:20:39 2019 +0300
     1.3 @@ -151,14 +151,27 @@
     1.4          public String format(final ResultSet results)
     1.5          throws SQLException
     1.6              {
     1.7 +        		String byteArrayString = "";
     1.8      		
     1.9  	        	if (results.getObject(index())!=null){
    1.10 -	        		return results.getString(
    1.11 +	        		byte[] bytes = results.getBytes(
    1.12  	                            index()
    1.13  	                            );
    1.14 -		   		} else {
    1.15 -		   			return "";
    1.16 -		   		}
    1.17 +	        		
    1.18 +                    int aux;
    1.19 +   	                final StringBuilder builder = new StringBuilder();
    1.20 +			        for (byte b : bytes) {
    1.21 +		                 if(b<0) aux=256+b; else aux=b; 
    1.22 +		    	         builder.append(aux  + " ");
    1.23 +			        }
    1.24 +		
    1.25 +			        byteArrayString = builder.toString();
    1.26 +
    1.27 +				
    1.28 +				} 
    1.29 +					    
    1.30 +			    return byteArrayString.trim();
    1.31 +
    1.32              
    1.33              }
    1.34          }