Package com.opensymphony.module.propertyset

Examples of com.opensymphony.module.propertyset.InvalidPropertyTypeException


            {
                propertyType = rs.getInt(colItemType);

                if (propertyType != type)
                {
                    throw new InvalidPropertyTypeException();
                }

                switch (type)
                {
                  case PropertySet.BOOLEAN:
 
                      int boolVal = rs.getInt(colNumber);
                      o = new Boolean(boolVal == 1);
 
                      break;
 
                  case PropertySet.DATA:
                  {
                    //Ugly fix for old type of column in oracle which we used to run LONG RAW. We converted to blob and the code is different
                    String columnTypeName = rs.getMetaData().getColumnTypeName(4);
                    logger.info("columnTypeName: " + columnTypeName);
                    if(this.driverClassName.indexOf("oracle") > -1 && columnTypeName != null && columnTypeName.indexOf("RAW") == -1)
                    {
                      //System.out.println("Getting as blob");
                        Blob blob = rs.getBlob(colData);
                      //System.out.println("blob:" + blob);
                      if(blob != null)
                      {
                        try
                        {
                          InputStream in = blob.getBinaryStream();
                          ByteArrayOutputStream baos = new ByteArrayOutputStream();
                          byte[] buffer = new byte[(int)blob.length()];
                          InputStream is = in;
                            while (is.read(buffer) > 0) {
                              baos.write(buffer);
                            }
                            baos.flush();
                            String s = baos.toString();
                            //System.out.println("S: " + s + "...");
                            o = s.getBytes();
                        }
                        catch (Exception e)
                        {
                          e.printStackTrace();
                }
                      }
                      else
                      {
                        o = null;
                      }
                    }
                    else
                    {
                      o = rs.getBytes(colData);
                    }
           
                      break;
                  }
                  case PropertySet.DATE:
                      o = rs.getTimestamp(colDate);
 
                      break;
 
                  case PropertySet.DOUBLE:
                      o = new Double(rs.getDouble(colFloat));
 
                      break;
 
                  case PropertySet.INT:
                      o = new Integer(rs.getInt(colNumber));
 
                      break;
 
                  case PropertySet.LONG:
                      o = new Long(rs.getLong(colNumber));
 
                      break;
 
                  case PropertySet.STRING:
                      o = rs.getString(colString);
 
                      break;
 
                  default:
                      throw new InvalidPropertyTypeException("JDBCPropertySet doesn't support this type yet.");
                }
            }

            rs.close();
            ps.close();
View Full Code Here

TOP

Related Classes of com.opensymphony.module.propertyset.InvalidPropertyTypeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.