Solved

getteing illegal start of expression error

Posted on 2008-06-19
2
228 Views
Last Modified: 2010-03-30
get illegal start of error for the method:

D:\java_src\webapps\autoapps\web\WEB-INF\classes\com\comtrol\autoapps\SpecsDT.java:97: illegal start of expression
    private String getHeader()
1 error

please help
package com.comtrol.autoapps;
 
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
 
import java.io.*;
 
import java.sql.*;
 
public class SpecsDT {
  HttpServlet servlet = null;
  Connection dbMSSQLServer = null;
  
  
  /** Creates a new instance of SpecsDT */
  public SpecsDT(HttpServlet servlet) {
    this.servlet = servlet;
  }
  
     public void startProc(String sku, int intFamily, String[] reports)
    {
        StringBuffer sb = new StringBuffer();
    boolean tlaFound = false;
    try{
       Class.forName("net.sourceforge.jtds.jdbc.Driver");
      dbMSSQLServer = DriverManager.getConnection("jdbc:jtds:sqlserver://204.73.219.28/cdms", "cdmswebuser", "cdmswebuser");
      
      //setup settings file for onefile.xml output and make file location (see below)
      FileWriter fw = new FileWriter("/sata2/XML/onefile.xml");
            
      sku = fixString(sku);
      Statement stmt = dbMSSQLServer.createStatement();
      String strSQL = "";
      strSQL = strSQL + "SELECT DISTINCT tla, HWProductTypeAbbv ";
      strSQL = strSQL + "FROM bomexpanded b INNER JOIN ";
      strSQL = strSQL + "tblhardware h ON h.modelnumber = b.tla INNER JOIN ";
      strSQL = strSQL + "_HWProductType t ON ";
      strSQL = strSQL + "h.HWProductTypeCode = t.HWProductTypeCode ";
      if (sku.equals("*")) strSQL = strSQL + "WHERE RTRIM(tla) <> ''";
      else strSQL = strSQL + "WHERE tla = '" + sku + "'";
      if (intFamily != 0) strSQL = strSQL + " and h.HWFamilyMemberCode = " + intFamily;
      ResultSet rs = stmt.executeQuery(strSQL);
      fw.write(getHeader());
      while(rs.next()){
        tlaFound = true;
        if (rs.getString(2) != null){
          String strProdHeader = getProductHeader(rs.getString(1));
          fw.write(strProdHeader);
          if (strProdHeader.length() > 0){ //Product header returned something
            fw.write(getPNRevision(rs.getString(1)));
            fw.write("\n" + "\t" + "</product>");
          }
        }
      }
      fw.write("\n</productcatalog>");
      fw.close();
    } catch (Exception e){
      e.printStackTrace();
    }
    
    try{
      dbMSSQLServer.close();
    } catch (Exception e){
      e.printStackTrace();
    }
    
    if (tlaFound && (!sku.equals("*") || intFamily != 0)){
      try{
        
             System.out.println("Running make script");
                for(int i=0; i<reports.length; i++) { 
          if (reports[i].equals("eng"))
           Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "eng"}); 
          if (reports[i].equals("es"))
           Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "es"});  
           if (reports[i].equals("forwebsite"))
              Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "web"});
           if (reports[i].equals("decl"))
              Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "decl"});
          if (reports[i].equals("mktg"))
             Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "mktg"});
           }
         }
            catch(Exception e)
            {
                System.out.println("Could not run makefile");
                e.printStackTrace();
            }
    }
 
    private String getHeader()
    {
        return "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n<!DOCTYPE productcatalog SYSTEM \"../DTD/onefile.dtd\"> \n<productcatalog> \n<title>Comtrol Product Catalog</title>";
    }
 
   private String getProductHeader(String a_partNo){
    
    int PN = 1;
    int PN_NAME = 2;
    int PN_DESC = 3;
    int PN_SHRTDESC = 4;
    int PN_PRICE = 5;
    int PN_DISC = 6;
    int PN_DISTYPRICE = 7;
    int PN_TYPE = 12;
    int PN_STATUS = 14;
    
    String strReturn = "";
    String strTemp = "";
    
    try{
      Statement stmt = dbMSSQLServer.createStatement();
      String strSQL = "select * from vw_specs_pricendesc where partnumber = '" + a_partNo.trim() + "'";
      ResultSet rs = stmt.executeQuery(strSQL);
      if(rs.next()){
        strReturn = "\n" + "\t" + "<product type=\"" + rs.getString(PN_TYPE).trim() +
          "\" id=\"" + a_partNo + "\" engineeringdesc=\"" + fixString(rs.getString(PN_DESC)) +
          "\" msrp=\"" + rs.getString(PN_PRICE) + "\" distribprice=\"" + rs.getString(PN_DISTYPRICE) +
          "\" distribpercentage=\"" + rs.getString(PN_DISC) + "\"";
        strSQL = "select componentpartnumber from vw_tla_assembly where partnumber = '" + a_partNo.trim() + "'";
        Statement stmt2 = dbMSSQLServer.createStatement();
        ResultSet rs2 = stmt2.executeQuery(strSQL);
        while(rs2.next()){
          strTemp = strTemp + rs2.getString(1) + "/";
        }
        if (strTemp.length() > 0) strTemp = strTemp.substring(0, strTemp.length() - 1);
        strReturn = strReturn + " producttype=\"" + strTemp + "\" discontinued=\"" + rs.getString(PN_STATUS) + "\"";
      }
      strReturn = strReturn + ">";
      strReturn = strReturn + "\n" + "\t" + "\t" + "<title>" + fixString(rs.getString(PN_NAME)) + "</title>" +
        "\n" + "\t" + "\t" + "<productdescription>" + fixString(rs.getString(PN_SHRTDESC)) + "</productdescription>";
      
    } catch (Exception e){
      e.printStackTrace();
    }
    return strReturn;
  }
  
  private String getPNRevision(String a_strPN){
    int BOM_TLA = 1;
    int BOM_TLAREV = 2;
    int BOM_PARENT = 3;
    int BOM_PARENTREV = 4;
    int BOM_COMPONENT = 5;
    int BOM_PARENTQTY = 7;
    int BOM_LOCATION = 8;
    int BOM_UNITS = 9;
    int BOM_DESC = 10;
    int BOM_PARENTDESC = 11;
    
    String strReturn = "";
    
    try{
      String strSQLHeader = "select distinct tla, max(tlarevision) from bomexpanded where tla = '" + a_strPN + "' group by tla";
      Statement stmtHeader = dbMSSQLServer.createStatement();
      ResultSet rsHeader = stmtHeader.executeQuery(strSQLHeader);
      while (rsHeader.next()){
        String strPN = rsHeader.getString(1);
        String strRev = rsHeader.getString(2);
        strReturn = "\n" + "\t" + "\t" + "<version id=\"" + strRev.trim() + "\">" +
          "\n" + "\t" + "\t" + "<title>Revision " + strRev.trim() + "</title>" +
          "\n" + "\t" + "\t" + "\t" + "<specifications>";
        
        CallableStatement stmtBody = dbMSSQLServer.prepareCall("{call sp_specificationxmldata(?,?)}");
        stmtBody.setString(1, strPN);
        stmtBody.setString(2, strRev);
        
        ResultSet rsBody = stmtBody.executeQuery();
        while (rsBody.next()){
          strReturn = strReturn + writeSpec(rsBody.getString(BOM_PARENT),
            rsBody.getString(BOM_PARENTREV),
            rsBody.getString(BOM_COMPONENT),
            rsBody.getString(BOM_PARENTQTY),
            rsBody.getString(BOM_UNITS),
            rsBody.getString(BOM_LOCATION),
            rsBody.getString(BOM_DESC),
            rsBody.getString(BOM_PARENTDESC));
        }
        
        Statement stmtBody2 = dbMSSQLServer.createStatement();
        ResultSet rsBody2 = stmtBody2.executeQuery("select distinct componentpartnumber from vw_bomexpanded_swspecs where partnumber = '" + strPN + "' order by componentpartnumber");
        while(rsBody2.next()) strReturn = strReturn + writeSpec2(strPN, strRev, rsBody2.getString(1), "sp_SWspecificationxmldata");
        strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "</specifications>" +
          "\n" + "\t" + "\t" + "</version>";
      }
    } catch (Exception e){
      e.printStackTrace();
    }
    return strReturn;
  }
  
  private String writeSpec(String a_bomParent, String a_bomParentRev, String a_bomComponent,
    String a_bomParentQty, String a_bomUnits, String a_bomLocation,
    String a_bomDesc, String a_bomParentDesc){
    String strReturn = "";
    String[] strArray;
    strReturn = "\n" + "\t" + "\t" + "\t" + "\t" + "<spec partnumber=\"" + a_bomComponent +
      "\" parentpn=\"" + a_bomParent + "\" quantity=\"" + truncString(a_bomParentQty) +
      "\" parentdescription=\"" + fixString(a_bomParentDesc) + "\">" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "<desc>" + fixString(a_bomDesc) + "</desc>" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "<values>";
    if (a_bomUnits == null) a_bomUnits = "";
    if (a_bomLocation == null) a_bomLocation = "";
    
    if (a_bomLocation.length() == 0){
      strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "\t" +
        "<value units=\"" + a_bomUnits + "\">" + "" + "</value>";
    } else{
      strArray = a_bomLocation.split(",");
      for (int i = 0; i < strArray.length; i++){
        strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "\t" +
          "<value units=\"" + a_bomUnits + "\">" + fixString(strArray[i]) + "</value>";
      }
    }
    strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "</values>" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "</spec>";
    
    return strReturn;
  }
  
  private String writeSpec2(String a_bomTLA, String a_bomRevision, String a_bomComponent, String a_strStoredProc){
    int BOM_UNITS = 9;
    int BOM_LOCATION = 8;
    String strReturn = "";
    String[] strArray;
    strReturn = "\n" + "\t" + "\t" + "\t" + "\t" + "<spec partnumber=\"" + a_bomComponent +
      "\" parentpn=\"" + a_bomTLA + "\" quantity=\"" + 0 +
      "\" parentdescription=\"" + "" + "\">" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "<desc>" + "" + "</desc>" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "<values>";
    
    try{
      CallableStatement stmt = dbMSSQLServer.prepareCall("{call " + a_strStoredProc + "(?,?,?)}");
      stmt.setString(1, a_bomTLA);
      stmt.setString(2, a_bomRevision);
      stmt.setString(3, a_bomComponent);
      
      ResultSet rs = stmt.executeQuery();
      
      while (rs.next()){
        strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "\t" +
          "<value units=\"" + rs.getString(BOM_UNITS) + "\">" + fixString(rs.getString(BOM_LOCATION)) + "</value>";
      }
      
      strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "</values>" +
        "\n" + "\t" + "\t" + "\t" + "\t" + "</spec>";
    } catch (Exception e){
      e.printStackTrace();
    }
    
    return strReturn;
  }
  
  private String fixString(String a_strIn){
    String strOut = "";
    String cNew;
    char c[] = {'<', '>', '&', '\"'};
    String replace[] = {"&lt;", "&gt;", "&amp;", "&quot;"};
    if (a_strIn == null) a_strIn = "";
    a_strIn = a_strIn.replaceAll("'", "''");
    for (int i = 0; i < a_strIn.length(); i++){
      cNew = "" + a_strIn.charAt(i);
      for (int j = 0; j < c.length; j++){
        if (a_strIn.charAt(i) == c[j]) cNew = replace[j];
      }
      strOut = strOut + cNew;
    }
    
    return strOut.trim();
  }
  
  private String fixAttribute(String a_strIn){
    return null;
  }
  
  private String truncString(String a_strIn){
    try{
      double dblVal = Double.valueOf(a_strIn).doubleValue();
      if (java.lang.Math.floor(dblVal) == dblVal) return "" + (int)dblVal;
      else return "" + dblVal;
    } catch(Exception e){
      return a_strIn;
    }
  }
  ;
}
}

Open in new window

0
Comment
Question by:sadaf_syed
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
manuel_m earned 450 total points
ID: 21825310
You have to close the method with a curly braket after line 90 and remove the last braket in the class on line  288.
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
 
import java.io.*;
 
import java.sql.*;
 
public class SpecsDT {
  HttpServlet servlet = null;
  Connection dbMSSQLServer = null;
  
  
  /** Creates a new instance of SpecsDT */
  public SpecsDT(HttpServlet servlÏet) {
    this.servlet = servlet;
  }
  
     public void startProc(String sku, int intFamily, String[] reports)
    {
        StringBuffer sb = new StringBuffer();
    boolean tlaFound = false;
    try{
       Class.forName("net.sourceforge.jtds.jdbc.Driver");
      dbMSSQLServer = DriverManager.getConnection("jdbc:jtds:sqlserver://204.73.219.28/cdms", "cdmswebuser", "cdmswebuser");
      
      //setup settings file for onefile.xml output and make file location (see below)
      FileWriter fw = new FileWriter("/sata2/XML/onefile.xml");
            
      sku = fixString(sku);
      Statement stmt = dbMSSQLServer.createStatement();
      String strSQL = "";
      strSQL = strSQL + "SELECT DISTINCT tla, HWProductTypeAbbv ";
      strSQL = strSQL + "FROM bomexpanded b INNER JOIN ";
      strSQL = strSQL + "tblhardware h ON h.modelnumber = b.tla INNER JOIN ";
      strSQL = strSQL + "_HWProductType t ON ";
      strSQL = strSQL + "h.HWProductTypeCode = t.HWProductTypeCode ";
      if (sku.equals("*")) strSQL = strSQL + "WHERE RTRIM(tla) <> ''";
      else strSQL = strSQL + "WHERE tla = '" + sku + "'";
      if (intFamily != 0) strSQL = strSQL + " and h.HWFamilyMemberCode = " + intFamily;
      ResultSet rs = stmt.executeQuery(strSQL);
      fw.write(getHeader());
      while(rs.next()){
        tlaFound = true;
        if (rs.getString(2) != null){
          String strProdHeader = getProductHeader(rs.getString(1));
          fw.write(strProdHeader);
          if (strProdHeader.length() > 0){ //Product header returned something
            fw.write(getPNRevision(rs.getString(1)));
            fw.write("\n" + "\t" + "</product>");
          }
        }
      }
      fw.write("\n</productcatalog>");
      fw.close();
    } catch (Exception e){
      e.printStackTrace();
    }
    
    try{
      dbMSSQLServer.close();
    } catch (Exception e){
      e.printStackTrace();
    }
    
    if (tlaFound && (!sku.equals("*") || intFamily != 0)){
      try{
        
             System.out.println("Running make script");
                for(int i=0; i<reports.length; i++) { 
          if (reports[i].equals("eng"))
           Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "eng"}); 
          if (reports[i].equals("es"))
           Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "es"});  
           if (reports[i].equals("forwebsite"))
              Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "web"});
           if (reports[i].equals("decl"))
              Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "decl"});
          if (reports[i].equals("mktg"))
             Runtime.getRuntime().exec(new String[] {"/bin/sh", "/sata2/XML/make", "-t", "mktg"});
           }
         }
            catch(Exception e)
            {
                System.out.println("Could not run makefile");
                e.printStackTrace();
            }
    }
    }
 
    private String getHeader()
    {
        return "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n<!DOCTYPE productcatalog SYSTEM \"../DTD/onefile.dtd\"> \n<productcatalog> \n<title>Comtrol Product Catalog</title>";
    }
 
   private String getProductHeader(String a_partNo){
    
    int PN = 1;
    int PN_NAME = 2;
    int PN_DESC = 3;
    int PN_SHRTDESC = 4;
    int PN_PRICE = 5;
    int PN_DISC = 6;
    int PN_DISTYPRICE = 7;
    int PN_TYPE = 12;
    int PN_STATUS = 14;
    
    String strReturn = "";
    String strTemp = "";
    
    try{
      Statement stmt = dbMSSQLServer.createStatement();
      String strSQL = "select * from vw_specs_pricendesc where partnumber = '" + a_partNo.trim() + "'";
      ResultSet rs = stmt.executeQuery(strSQL);
      if(rs.next()){
        strReturn = "\n" + "\t" + "<product type=\"" + rs.getString(PN_TYPE).trim() +
          "\" id=\"" + a_partNo + "\" engineeringdesc=\"" + fixString(rs.getString(PN_DESC)) +
          "\" msrp=\"" + rs.getString(PN_PRICE) + "\" distribprice=\"" + rs.getString(PN_DISTYPRICE) +
          "\" distribpercentage=\"" + rs.getString(PN_DISC) + "\"";
        strSQL = "select componentpartnumber from vw_tla_assembly where partnumber = '" + a_partNo.trim() + "'";
        Statement stmt2 = dbMSSQLServer.createStatement();
        ResultSet rs2 = stmt2.executeQuery(strSQL);
        while(rs2.next()){
          strTemp = strTemp + rs2.getString(1) + "/";
        }
        if (strTemp.length() > 0) strTemp = strTemp.substring(0, strTemp.length() - 1);
        strReturn = strReturn + " producttype=\"" + strTemp + "\" discontinued=\"" + rs.getString(PN_STATUS) + "\"";
      }
      strReturn = strReturn + ">";
      strReturn = strReturn + "\n" + "\t" + "\t" + "<title>" + fixString(rs.getString(PN_NAME)) + "</title>" +
        "\n" + "\t" + "\t" + "<productdescription>" + fixString(rs.getString(PN_SHRTDESC)) + "</productdescription>";
      
    } catch (Exception e){
      e.printStackTrace();
    }
    return strReturn;
  }
  
  private String getPNRevision(String a_strPN){
    int BOM_TLA = 1;
    int BOM_TLAREV = 2;
    int BOM_PARENT = 3;
    int BOM_PARENTREV = 4;
    int BOM_COMPONENT = 5;
    int BOM_PARENTQTY = 7;
    int BOM_LOCATION = 8;
    int BOM_UNITS = 9;
    int BOM_DESC = 10;
    int BOM_PARENTDESC = 11;
    
    String strReturn = "";
    
    try{
      String strSQLHeader = "select distinct tla, max(tlarevision) from bomexpanded where tla = '" + a_strPN + "' group by tla";
      Statement stmtHeader = dbMSSQLServer.createStatement();
      ResultSet rsHeader = stmtHeader.executeQuery(strSQLHeader);
      while (rsHeader.next()){
        String strPN = rsHeader.getString(1);
        String strRev = rsHeader.getString(2);
        strReturn = "\n" + "\t" + "\t" + "<version id=\"" + strRev.trim() + "\">" +
          "\n" + "\t" + "\t" + "<title>Revision " + strRev.trim() + "</title>" +
          "\n" + "\t" + "\t" + "\t" + "<specifications>";
        
        CallableStatement stmtBody = dbMSSQLServer.prepareCall("{call sp_specificationxmldata(?,?)}");
        stmtBody.setString(1, strPN);
        stmtBody.setString(2, strRev);
        
        ResultSet rsBody = stmtBody.executeQuery();
        while (rsBody.next()){
          strReturn = strReturn + writeSpec(rsBody.getString(BOM_PARENT),
            rsBody.getString(BOM_PARENTREV),
            rsBody.getString(BOM_COMPONENT),
            rsBody.getString(BOM_PARENTQTY),
            rsBody.getString(BOM_UNITS),
            rsBody.getString(BOM_LOCATION),
            rsBody.getString(BOM_DESC),
            rsBody.getString(BOM_PARENTDESC));
        }
        
        Statement stmtBody2 = dbMSSQLServer.createStatement();
        ResultSet rsBody2 = stmtBody2.executeQuery("select distinct componentpartnumber from vw_bomexpanded_swspecs where partnumber = '" + strPN + "' order by componentpartnumber");
        while(rsBody2.next()) strReturn = strReturn + writeSpec2(strPN, strRev, rsBody2.getString(1), "sp_SWspecificationxmldata");
        strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "</specifications>" +
          "\n" + "\t" + "\t" + "</version>";
      }
    } catch (Exception e){
      e.printStackTrace();
    }
    return strReturn;
  }
  
  private String writeSpec(String a_bomParent, String a_bomParentRev, String a_bomComponent,
    String a_bomParentQty, String a_bomUnits, String a_bomLocation,
    String a_bomDesc, String a_bomParentDesc){
    String strReturn = "";
    String[] strArray;
    strReturn = "\n" + "\t" + "\t" + "\t" + "\t" + "<spec partnumber=\"" + a_bomComponent +
      "\" parentpn=\"" + a_bomParent + "\" quantity=\"" + truncString(a_bomParentQty) +
      "\" parentdescription=\"" + fixString(a_bomParentDesc) + "\">" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "<desc>" + fixString(a_bomDesc) + "</desc>" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "<values>";
    if (a_bomUnits == null) a_bomUnits = "";
    if (a_bomLocation == null) a_bomLocation = "";
    
    if (a_bomLocation.length() == 0){
      strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "\t" +
        "<value units=\"" + a_bomUnits + "\">" + "" + "</value>";
    } else{
      strArray = a_bomLocation.split(",");
      for (int i = 0; i < strArray.length; i++){
        strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "\t" +
          "<value units=\"" + a_bomUnits + "\">" + fixString(strArray[i]) + "</value>";
      }
    }
    strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "</values>" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "</spec>";
    
    return strReturn;
  }
  
  private String writeSpec2(String a_bomTLA, String a_bomRevision, String a_bomComponent, String a_strStoredProc){
    int BOM_UNITS = 9;
    int BOM_LOCATION = 8;
    String strReturn = "";
    String[] strArray;
    strReturn = "\n" + "\t" + "\t" + "\t" + "\t" + "<spec partnumber=\"" + a_bomComponent +
      "\" parentpn=\"" + a_bomTLA + "\" quantity=\"" + 0 +
      "\" parentdescription=\"" + "" + "\">" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "<desc>" + "" + "</desc>" +
      "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "<values>";
    
    try{
      CallableStatement stmt = dbMSSQLServer.prepareCall("{call " + a_strStoredProc + "(?,?,?)}");
      stmt.setString(1, a_bomTLA);
      stmt.setString(2, a_bomRevision);
      stmt.setString(3, a_bomComponent);
      
      ResultSet rs = stmt.executeQuery();
      
      while (rs.next()){
        strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "\t" +
          "<value units=\"" + rs.getString(BOM_UNITS) + "\">" + fixString(rs.getString(BOM_LOCATION)) + "</value>";
      }
      
      strReturn = strReturn + "\n" + "\t" + "\t" + "\t" + "\t" + "\t" + "</values>" +
        "\n" + "\t" + "\t" + "\t" + "\t" + "</spec>";
    } catch (Exception e){
      e.printStackTrace();
    }
    
    return strReturn;
  }
  
  private String fixString(String a_strIn){
    String strOut = "";
    String cNew;
    char c[] = {'<', '>', '&', '\"'};
    String replace[] = {"&lt;", "&gt;", "&amp;", "&quot;"};
    if (a_strIn == null) a_strIn = "";
    a_strIn = a_strIn.replaceAll("'", "''");
    for (int i = 0; i < a_strIn.length(); i++){
      cNew = "" + a_strIn.charAt(i);
      for (int j = 0; j < c.length; j++){
        if (a_strIn.charAt(i) == c[j]) cNew = replace[j];
      }
      strOut = strOut + cNew;
    }
    
    return strOut.trim();
  }
  
  private String fixAttribute(String a_strIn){
    return null;
  }
  
  private String truncString(String a_strIn){
    try{
      double dblVal = Double.valueOf(a_strIn).doubleValue();
      if (java.lang.Math.floor(dblVal) == dblVal) return "" + (int)dblVal;
      else return "" + dblVal;
    } catch(Exception e){
      return a_strIn;
    }
  }
}

Open in new window

0
 
LVL 17

Assisted Solution

by:contactkarthi
contactkarthi earned 50 total points
ID: 21825312
you didnt close the bracket for

 if (tlaFound && (!sku.equals("*") || intFamily != 0)){
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse console opening separately 2 50
add projects t working set in maven 2 72
java imports not found 4 71
convert Absolute path to relative path of FTP location 7 51
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question