fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.Matcher;
  7. import java.util.regex.Pattern;
  8.  
  9.  
  10. /* Name of the class has to be "Main" only if the class is public. */
  11. class Ideone
  12. {
  13. public static void main (String[] args) throws java.lang.Exception
  14. {
  15. String fullStack =
  16. " at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)\n" +
  17. " at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)\n" +
  18. " at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)\n" +
  19. " at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)\n" +
  20. " at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:296)\n" +
  21. " at org.hibernate.impl.SessionImpl.afterOperation(SessionImpl.java:595)\n" +
  22. " at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1724)\n" +
  23. " at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)\n" +
  24. " at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)\n" +
  25. " at ixl.auth.db.AuthTokenController.findAuthTokenByKey(AuthTokenController.java:61)\n" +
  26. " at ixl.auth.struts.AuthInterceptor.intercept(AuthInterceptor.java:71)\n" +
  27. " ... 53 more\n" +
  28. "Caused by: java.sql.SQLException: Failed to check out database session -- ixl.conf.pool.ObjectPoolException: Requester is blacklisted: ip=169.244.71.193 browser=169.244.71.193.1389976355654343 uri=/actions/api/v1/search/\n" +
  29. " at ixl.sql.ManagedSqlConnection.getInternalConnection(ManagedSqlConnection.java:452)\n" +
  30. " at ixl.sql.ManagedSqlConnection.isClosed(ManagedSqlConnection.java:127)\n" +
  31. " at org.hibernate.jdbc.ConnectionManager.isAutoCommit(ConnectionManager.java:212)\n" +
  32. " at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:287)\n" +
  33. " ... 59 more\n";
  34.  
  35. System.out.println("Original string:\n" + fullStack);
  36. final String ipPattern = "=[[0-9]+\\.]+";
  37. final String ipReplace = "=xxx";
  38. Pattern compiledIpPattern = Pattern.compile(ipPattern);
  39. for (String line : fullStack.split("\n"))
  40. {
  41. Matcher ipMatcher = compiledIpPattern.matcher(line);
  42. if (ipMatcher.find()) {
  43. line = ipMatcher.replaceAll(ipReplace);
  44. }
  45. System.out.println(line);
  46. }
  47. }
  48. }
Success #stdin #stdout 0.16s 57764KB
stdin
Standard input is empty
stdout
Original string:
  at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
	at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:296)
	at org.hibernate.impl.SessionImpl.afterOperation(SessionImpl.java:595)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1724)
	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
	at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)
   at ixl.auth.db.AuthTokenController.findAuthTokenByKey(AuthTokenController.java:61)
   at ixl.auth.struts.AuthInterceptor.intercept(AuthInterceptor.java:71)
	... 53 more
Caused by: java.sql.SQLException: Failed to check out database session -- ixl.conf.pool.ObjectPoolException: Requester is blacklisted: ip=169.244.71.193 browser=169.244.71.193.1389976355654343 uri=/actions/api/v1/search/
   at ixl.sql.ManagedSqlConnection.getInternalConnection(ManagedSqlConnection.java:452)
   at ixl.sql.ManagedSqlConnection.isClosed(ManagedSqlConnection.java:127)
	at org.hibernate.jdbc.ConnectionManager.isAutoCommit(ConnectionManager.java:212)
	at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:287)
	... 59 more

  at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
	at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:296)
	at org.hibernate.impl.SessionImpl.afterOperation(SessionImpl.java:595)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1724)
	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
	at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)
   at ixl.auth.db.AuthTokenController.findAuthTokenByKey(AuthTokenController.java:61)
   at ixl.auth.struts.AuthInterceptor.intercept(AuthInterceptor.java:71)
	... 53 more
Caused by: java.sql.SQLException: Failed to check out database session -- ixl.conf.pool.ObjectPoolException: Requester is blacklisted: ip=xxx browser=xxx uri=/actions/api/v1/search/
   at ixl.sql.ManagedSqlConnection.getInternalConnection(ManagedSqlConnection.java:452)
   at ixl.sql.ManagedSqlConnection.isClosed(ManagedSqlConnection.java:127)
	at org.hibernate.jdbc.ConnectionManager.isAutoCommit(ConnectionManager.java:212)
	at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:287)
	... 59 more