Java Code Examples for java.sql.SQLException.getLocalizedMessage()

The following are Jave code examples for showing how to use getLocalizedMessage() of the java.sql.SQLException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: QueryBuilder.java   View Source Code Vote up 6 votes
private void reportDatabaseError(SQLException e) {

        Log.getLogger().log(Level.FINE, null, e);
        
        String msg = isUnsupportedFeature(e)
	    ? NbBundle.getMessage(QueryBuilder.class, "UNSUPPORTED_FEATURE")
	    : e.getLocalizedMessage();
        
        reportProcessingError(msg);

        /*
        ConnectionStatusPanel csp = new ConnectionStatusPanel() ;
        csp.configureDisplay(sqlStatement.getConnectionInfo(), false, e.getLocalizedMessage(),  "", 0, false ) ;
        csp.setGeneralInfo(msg) ;
        csp.displayDialog( sqlStatement.getConnectionInfo() ) ;
        */

    }
 
Example 2
Project: KITE   File: ConfiguratorServlet.java   View Source Code Vote up 6 votes
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
  List<String> sourceList = Arrays.asList("SAUCE_LABS", "BROWSER_STACK", "TESTING_BOT");

  try {
    List<Object> compabilities = new ArrayList<>();
    for (String source : sourceList)
      compabilities
          .add(new CompatibilityDao(Utility.getCompDBConnection(this.getServletContext()))
              .getCompabilityList(source));
    request.setAttribute("compabilityList", compabilities);
  } catch (SQLException e) {
    e.printStackTrace();
    throw new KiteSQLException(e.getLocalizedMessage());
  }

  // get UI
  if (log.isDebugEnabled())
    log.debug("Displaying: configurator.vm");
  RequestDispatcher requestDispatcher = request.getRequestDispatcher("configurator.vm");
  requestDispatcher.forward(request, response);
}
 
Example 3
Project: KITE   File: ClientVersionServlet.java   View Source Code Vote up 6 votes
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {


    List<ClientVersion> clientVersionList;
    try {
        clientVersionList =
                new ClientVersionDao(Utility.getDBConnection(this.getServletContext())).getClientVersionList();
        if (log.isDebugEnabled())
            log.debug("out->: clientVersionList" + clientVersionList);
        request.setAttribute("clientVersionList", clientVersionList);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        throw new KiteSQLException(e.getLocalizedMessage());
    }

    // get UI
    if (log.isDebugEnabled())
        log.debug("Displaying: client_version.vm");
    RequestDispatcher requestDispatcher = request.getRequestDispatcher("client_version.vm");
    requestDispatcher.forward(request, response);
}
 
Example 4
Project: AgentWorkbench   File: DBConnection.java   View Source Code Vote up 5 votes
/**
 * This Method executes a SQL-Statement (Create, Insert, Update) in
 * the database and returns true if this was successful 
 * @param sqlStatement the SQL-Statement to execute
 * @return True, if the execution was successful
 */
public boolean getSqlExecuteUpdate(String sqlStatement) {
	
	boolean successfull = false;
	Statement state = null;
	try {
		state = getNewStatement();
		state.executeUpdate(sqlStatement);
		successfull = true;
		
	} catch (SQLException e) {
		//e.printStackTrace();
		String msg = e.getLocalizedMessage() + newLine;
		msg += sqlStatement;
		this.dbError.setText(msg);
		this.dbError.put2Clipboard(sqlStatement);
		this.dbError.setErrNumber( e.getErrorCode() );
		this.dbError.setHead( "Fehler bei der Ausf├╝hrung von 'executeUpdate'!" );
		this.dbError.setErr(true);
		this.dbError.show();
		
	} finally {
		try {
			if (state!=null) state.close();
		} catch (SQLException sqle) {
			sqle.printStackTrace();
		}
	}
	return successfull;
}
 
Example 5
Project: KITE   File: ExecutionServlet.java   View Source Code Vote up 5 votes
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
  // TODO Auto-generated method stub
  // response.getWriter().append("Served at:
  // ").append(request.getContextPath());

  String configName = request.getParameter("name");
  if (configName == null)
    throw new KiteNoKeyException("name");
  if (log.isDebugEnabled())
    log.debug("in->name: " + configName);

  List<ConfigExecution> listOfExecution;
  List<ConfigTest> listOfDistinctTest;
  try {
    listOfDistinctTest = new ConfigTestDao(Utility.getDBConnection(this.getServletContext())).getTestList();
    request.setAttribute("listOfTest", listOfDistinctTest);
    listOfExecution = new ConfigExecutionDao(Utility.getDBConnection(this.getServletContext()))
            .getConfigExecutionList(configName);
    if (log.isDebugEnabled())
      log.debug("out->listOfExecution: " + listOfExecution);
    request.setAttribute("listOfExecution", listOfExecution);
  } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    throw new KiteSQLException(e.getLocalizedMessage());
  }

  // get UI
  if (log.isDebugEnabled())
    log.debug("Displaying: execution.vm");
  RequestDispatcher requestDispatcher = request.getRequestDispatcher("execution.vm");
  requestDispatcher.forward(request, response);
}
 
Example 6
Project: pgcodekeeper   File: SQLResultSetWrapper.java   View Source Code Vote up 5 votes
@Override
public int getInt(String columnName) throws WrapperAccessException {
    try {
        return rs.getInt(columnName);
    } catch (SQLException ex) {
        throw new WrapperAccessException(ex.getLocalizedMessage(), ex);
    }
}
 
Example 7
Project: KITE   File: ScoreBoardServlet.java   View Source Code Vote up 5 votes
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {


  List<Score> scoreList= new ArrayList<Score>();
  List<ConfigTest> listOfDistinctTest;
  try {
    listOfDistinctTest = new ConfigTestDao(Utility.getDBConnection(this.getServletContext())).getTestList();
    for (ConfigTest test: listOfDistinctTest){
      Long lastRun = new PublicOverviewDao(Utility.getDBConnection(this.getServletContext())).getRunList(test.getTestName()).get(0);
      OverviewResult tmp = new OverviewResult(
              new ResultTableDao(Utility.getDBConnection(this.getServletContext())).getResultList("TN"+test.getTestName()+"_"+lastRun.toString(), test.getTupleSize()));
      //OverviewResult tmp = new OverviewResult(new OverviewDao(Utility.getDBConnection(this.getServletContext())).getOverviewResultList(test.getTestName(), test.getTupleSize()),true);
      tmp.stableFilter();
      Score tmpScore= new Score(test, tmp);
      scoreList.add(tmpScore);
    }
    String scoreJson="{";
    for (Score score:scoreList){
      scoreJson+="\""+score.getTestName()+"\":";
      scoreJson+=score.getScoreJson();
      if (scoreList.indexOf(score)<scoreList.size()-1) {
        scoreJson+=",";
      }
    }
    scoreJson+="}";
    request.setAttribute("scoreJson", scoreJson);
  } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    throw new KiteSQLException(e.getLocalizedMessage());
  }

  if (log.isDebugEnabled())
    log.debug("Displaying: score.vm");
  RequestDispatcher requestDispatcher = request.getRequestDispatcher("score.vm");
  requestDispatcher.forward(request, response);
}
 
Example 8
Project: KITE   File: DashboardServlet.java   View Source Code Vote up 5 votes
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

  List<ConfigurationOverall> listOfConfig;
  List<Browser> listOfBrowser;
  List<ConfigTest> listOfDistinctTest;
  try {
    listOfDistinctTest = new ConfigTestDao(Utility.getDBConnection(this.getServletContext())).getTestList();
    request.setAttribute("listOfTest", listOfDistinctTest);
    listOfConfig = new ConfigExecutionDao(Utility.getDBConnection(this.getServletContext()))
            .getDistinctConfigExecutionList();
    listOfBrowser = new BrowserDao(Utility.getDBConnection(this.getServletContext()))
            .getBrowserList();
    listOfBrowser = new ArrayList<Browser>(new LinkedHashSet<Browser>(listOfBrowser));
    if (log.isDebugEnabled())
      log.debug("out->listOfConfigName: " + listOfConfig);
    request.setAttribute("listOfConfig", listOfConfig);
    request.setAttribute("listOfBrowser", listOfBrowser);
  } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    throw new KiteSQLException(e.getLocalizedMessage());
  }

  // get UI
  if (log.isDebugEnabled())
    log.debug("Displaying: dashboard.vm");
  RequestDispatcher requestDispatcher = request.getRequestDispatcher("dashboard.vm");
  requestDispatcher.forward(request, response);
}
 
Example 9
Project: pgcodekeeper   File: JdbcLoader.java   View Source Code Vote up 5 votes
public boolean hasAllHelpers() throws IOException {
    // just makes new connection for now
    // smarter solution would be to make the class AutoCloseable
    try (Connection c = connector.getConnection()) {
        return JdbcReaderFactory.getAvailableHelperBits(c) == JdbcReaderFactory.getAllHelperBits();
    } catch (SQLException ex) {
        throw new IOException(ex.getLocalizedMessage(), ex);
    }
}
 
Example 10
Project: pgcodekeeper   File: SQLResultSetWrapper.java   View Source Code Vote up 5 votes
@Override
public double getDouble(String columnName) throws WrapperAccessException {
    try {
        return rs.getDouble(columnName);
    } catch (SQLException ex) {
        throw new WrapperAccessException(ex.getLocalizedMessage(), ex);
    }
}
 
Example 11
Project: pgcodekeeper   File: SQLResultSetWrapper.java   View Source Code Vote up 5 votes
@Override
public long getLong(String columnName) throws WrapperAccessException {
    try {
        return rs.getLong(columnName);
    } catch (SQLException ex) {
        throw new WrapperAccessException(ex.getLocalizedMessage(), ex);
    }
}
 
Example 12
Project: pgcodekeeper   File: SQLResultSetWrapper.java   View Source Code Vote up 5 votes
@Override
public short getShort(String columnName) throws WrapperAccessException {
    try {
        return rs.getShort(columnName);
    } catch (SQLException ex) {
        throw new WrapperAccessException(ex.getLocalizedMessage(), ex);
    }
}
 
Example 13
Project: pgcodekeeper   File: SQLResultSetWrapper.java   View Source Code Vote up 5 votes
@Override
public String getString(String columnName) throws WrapperAccessException {
    try {
        return rs.getString(columnName);
    } catch (SQLException ex) {
        throw new WrapperAccessException(ex.getLocalizedMessage(), ex);
    }
}
 
Example 14
Project: pgcodekeeper   File: SQLResultSetWrapper.java   View Source Code Vote up 5 votes
@Override
public float getFloat(String columnName) throws WrapperAccessException {
    try {
        return rs.getFloat(columnName);
    } catch (SQLException ex) {
        throw new WrapperAccessException(ex.getLocalizedMessage(), ex);
    }
}
 
Example 15
Project: pgcodekeeper   File: SQLResultSetWrapper.java   View Source Code Vote up 5 votes
@Override
public <T> T[] getArray(String columnName, Class<T> arrayElement) throws WrapperAccessException {
    try {
        Array arr = rs.getArray(columnName);
        if (arr != null) {
            @SuppressWarnings("unchecked")
            T[] ret = (T[]) arr.getArray();
            return ret;
        }
        return null;
    } catch (SQLException ex) {
        throw new WrapperAccessException(ex.getLocalizedMessage(), ex);
    }
}
 
Example 16
Project: KITE   File: TestsServlet.java   View Source Code Vote up 4 votes
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
  // TODO Auto-generated method stub
  // response.getWriter().append("Served at:
  // ").append(request.getContextPath());

  String strConfigId = request.getParameter("id");
  if (strConfigId == null)
    throw new KiteNoKeyException("id");
  if (log.isDebugEnabled())
    log.debug("in->id: " + strConfigId);
  int configId = Integer.parseInt(strConfigId);

  String configName = request.getParameter("configname");
  if (configName == null)
    throw new KiteNoKeyException("configname");
  if (log.isDebugEnabled())
    log.debug("in->configname: " + strConfigId);

  List<ConfigTest> listOfTest;
  List<ConfigTest> listOfDistinctTest;
  try {
    listOfDistinctTest = new ConfigTestDao(Utility.getDBConnection(this.getServletContext())).getTestList();
    request.setAttribute("listOfTestOverview", listOfDistinctTest);
    listOfTest = new ConfigTestDao(Utility.getDBConnection(this.getServletContext()))
            .getConfigTestList(configId);
    if (log.isDebugEnabled())
      log.debug("out->listOfTest: " + listOfTest);
    request.setAttribute("listOfTest", listOfTest);
    if (log.isDebugEnabled())
      log.debug("out->configName: " + configName);
    request.setAttribute("configName", configName);
    request.setAttribute("configID", strConfigId);
  } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    throw new KiteSQLException(e.getLocalizedMessage());
  }

  // get UI
  if (log.isDebugEnabled())
    log.debug("Displaying: tests.vm");
  RequestDispatcher requestDispatcher = request.getRequestDispatcher("tests.vm");
  requestDispatcher.forward(request, response);
}
 
Example 17
Project: KITE   File: ResultServlet.java   View Source Code Vote up 4 votes
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
  // TODO Auto-generated method stub
  // response.getWriter().append("Served at:
  // ").append(request.getContextPath());

  String testID = request.getParameter("test");
  if (testID == null)
    throw new KiteNoKeyException("testID");
  if (log.isDebugEnabled())
    log.debug("in->test ID: " + testID);



  OverviewResult listOfResult;
  List<ConfigTest> listOfDistinctTest;
  ConfigTest test;
  int testIDInt = Integer.parseInt(testID);
  try {
    listOfDistinctTest = new ConfigTestDao(Utility.getDBConnection(this.getServletContext())).getTestList();
    request.setAttribute("listOfTest", listOfDistinctTest);
    test = new ConfigTestDao(Utility.getDBConnection(this.getServletContext())).getTestById(testIDInt);
    request.setAttribute("test", test);
    listOfResult = new OverviewResult(
            new ResultTableDao(Utility.getDBConnection(this.getServletContext())).getResultList(test.getResultTable(),test.getTupleSize()));
    request.setAttribute("listOfResult", listOfResult);
    request.setAttribute("total", listOfResult.getListOfResultTable().size());
    request.setAttribute("jsonData", listOfResult.getSunburstJsonData());
    request.setAttribute("testJsonData", test.getJsonData());
    request.setAttribute("browserList", listOfResult.getDistincBrowserList());
  } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    throw new KiteSQLException(e.getLocalizedMessage());
  }

  // get UI
  if (log.isDebugEnabled())
    log.debug("Displaying: results.vm");
  RequestDispatcher requestDispatcher = request.getRequestDispatcher("results.vm");
  requestDispatcher.forward(request, response);
}
 
Example 18
Project: KITE   File: OverviewServlet.java   View Source Code Vote up 4 votes
/**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {

    String testName = request.getParameter("testname");
    String size = request.getParameter("size");
    if (testName == null)
      throw new KiteNoKeyException("test name");

    List<ConfigTest> listOfDistinctTest;
    OverviewResult listOfResult;
    List<ConfigTest> testList;

    try {
      listOfDistinctTest = new ConfigTestDao(Utility.getDBConnection(this.getServletContext())).getTestList();
      request.setAttribute("listOfTest", listOfDistinctTest);
      if (testName!=null){
        testList = new ConfigTestDao(Utility.getDBConnection(this.getServletContext())).getConfigTestList(testName);
        int tupleSize = testList.get(0).getTupleSize();
        listOfResult = new OverviewResult(new OverviewDao(Utility.getDBConnection(this.getServletContext())).getOverviewResultList(testName, tupleSize),
                new BrowserDao(Utility.getDBConnection(this.getServletContext())).getOverviewBrowserList());
        request.setAttribute("tupleSize", tupleSize);
        request.setAttribute("lastRun", testList.get(testList.size()-1).getStartTime());
        request.setAttribute("description", testList.get(0).getDescription());
        request.setAttribute("testname", testName);
        request.setAttribute("listOfVersion", Mapping.VersionList);
        request.setAttribute("listOfTests", testList);
        request.setAttribute("listOfResult", listOfResult);
        request.setAttribute("stats", listOfResult.getStat());
        request.setAttribute("jsonData", listOfResult.getSunburstJsonData());
        request.setAttribute("browserList", listOfResult.getDistincBrowserList());
      }
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      throw new KiteSQLException(e.getLocalizedMessage());
    }
    // get UI
    if (log.isDebugEnabled())
      log.debug("Displaying: overview_circle.vm");
    RequestDispatcher requestDispatcher = null;
/*    if (size.equalsIgnoreCase("2"))
      requestDispatcher = request.getRequestDispatcher("overview_2D.vm");
    else*/
      requestDispatcher = request.getRequestDispatcher("overview_circle.vm");
    requestDispatcher.forward(request, response);
  }
 
Example 19
Project: KITE   File: PublicOverviewServlet.java   View Source Code Vote up 4 votes
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

  String testName = request.getParameter("testname");
  String startTime = request.getParameter("time");
  String description = "";
  if (testName == null)
    testName= "IceConnectionTest";

  OverviewResult listOfResult;
  List<String> listOfDistinctTest;
  List<Long> listOfRuns;

  try {
    listOfDistinctTest = new ConfigTestDao(Utility.getDBConnection(this.getServletContext())).get1v1TestList();
    request.setAttribute("listOfTest", listOfDistinctTest);
    listOfRuns = new PublicOverviewDao(Utility.getDBConnection(this.getServletContext())).getRunList(testName);
    description = new PublicOverviewDao(Utility.getDBConnection(this.getServletContext())).getDescription(testName);
    request.setAttribute("listOfRuns", listOfRuns);
    request.setAttribute("testname", testName);
    request.setAttribute("description", description);
    request.setAttribute("stableList", Mapping.StableList);
    if (startTime==null&&!listOfRuns.isEmpty())
      startTime = listOfRuns.get(0).toString();
    if (startTime!=null){
      request.setAttribute("startTime", Long.parseLong(startTime));
      String tmp = "TN"+testName+"_"+startTime;
      listOfResult = new OverviewResult(
              new ResultTableDao(Utility.getDBConnection(this.getServletContext())).getResultList(tmp,2));
      listOfResult.stableFilter();
      request.setAttribute("jsonData", listOfResult.getSunburstJsonData());
    }
  } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    throw new KiteSQLException(e.getLocalizedMessage());
  }
  // get UI
  if (log.isDebugEnabled())
    log.debug("Displaying: public-overview.vm");
  RequestDispatcher requestDispatcher = request.getRequestDispatcher("public-overview.vm");
  requestDispatcher.forward(request, response);
}
 
Example 20
Project: KITE   File: GetJsonDataServlet.java   View Source Code Vote up 4 votes
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
 *      response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    // TODO Auto-generated method stub
    String location = request.getParameter("location");
    if (location == null)
        throw new KiteNoKeyException("location");
    OverviewResult listOfResult =null;

    String testName = request.getParameter("testName");
    if (testName == null)
        throw new KiteNoKeyException("testName");
    String strSize = request.getParameter("size");
    if (strSize == null)
        throw new KiteNoKeyException("tuple size");
    int size = Integer.parseInt(strSize);
    String strval = request.getParameter("val");
    if (strval == null)
        throw new KiteNoKeyException("value");
    try{
        if(location.equalsIgnoreCase("result"))
            listOfResult = new OverviewResult(new ResultTableDao(Utility.getDBConnection(this.getServletContext())).getRequestedResultList(testName,size, strval));
        else
            listOfResult = new OverviewResult(new OverviewDao(Utility.getDBConnection(this.getServletContext())).getRequestedOverviewResultList(testName, size,strval),
                    new BrowserDao(Utility.getDBConnection(this.getServletContext())).getOverviewBrowserList());
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        throw new KiteSQLException(e.getLocalizedMessage());
    }

    String name = request.getParameter("name");
    if (name != null) {
        String version = request.getParameter("version");
        if (version == null)
            throw new KiteNoKeyException("tuple size");
        String platform = request.getParameter("platform");
        if (platform == null)
            throw new KiteNoKeyException("platform");
        Browser browser = new Browser(name, version, platform);
        listOfResult.browserFilter(browser);
    }

    if (listOfResult.getListOfResultTable().size()>0)
        response.getWriter().print(listOfResult.getSunburstJsonData());
    else {
        String res="{";
        res+="\"total\":0,";
        res+="\"overall\":[],";
        res+="\"result\":[],";
        res+="\"sunburst\":{";
        res+="\"name\":\"result\",";
        res+="\"children\": []}";
        res+="}";
        response.getWriter().print(res);
    }

}