avatar

947

Extra debugging to try and save error pages for the various types of bidding errors.

by mrs, 09 Jun, 2009 11:11 AM
914 947  
4545      */
4646     if(mResultHash == null) {
4747       mResultHash = new HashMap<String, Integer>();
48       mResultHash.put("you('re| are) not permitted to bid on their listings.", AuctionServer.BID_ERROR_BANNED);
48       mResultHash.put("you('re| are) not permitted to bid on their listings.", AuctionServer.BID_ERROR_BANNED); /**/
4949       mResultHash.put("the item is no longer available because the auction has ended.", AuctionServer.BID_ERROR_ENDED);
5050       mResultHash.put("bidding has ended (for|on) this item", AuctionServer.BID_ERROR_ENDED);
5151       mResultHash.put("cannot proceed", AuctionServer.BID_ERROR_CANNOT);
5252       mResultHash.put("problem with bid amount", AuctionServer.BID_ERROR_AMOUNT);
53       mResultHash.put("your bid must be at least ", AuctionServer.BID_ERROR_TOO_LOW);
53       mResultHash.put("your bid must be at least ", AuctionServer.BID_ERROR_TOO_LOW); /*?*/
5454       mResultHash.put("you('ve| have) been outbid by another bidder", AuctionServer.BID_ERROR_OUTBID);
5555       mResultHash.put("you('ve| have) just been outbid", ebayServer.BID_ERROR_OUTBID);
5656       mResultHash.put("your bid is confirmed!", AuctionServer.BID_DUTCH_CONFIRMED);
------
5959       mResultHash.put("you('re| are) the current high bidder", AuctionServer.BID_WINNING);
6060       mResultHash.put("you('re| are) the first bidder", AuctionServer.BID_WINNING);
6161       mResultHash.put("you('re| are) the high bidder and currently in the lead", AuctionServer.BID_WINNING);
62       mResultHash.put("you('re| are) currently the highest bidder", AuctionServer.BID_WINNING);
62       mResultHash.put("you('re| are) currently the highest bidder", AuctionServer.BID_WINNING); /**/
6363       mResultHash.put("you purchased the item", AuctionServer.BID_WINNING);
6464       mResultHash.put("you('re| are) currently the high bidder, but the reserve hasn.t been met", AuctionServer.BID_ERROR_RESERVE_NOT_MET);
6565       mResultHash.put("the reserve price has not been met", AuctionServer.BID_ERROR_RESERVE_NOT_MET);
------
133133 
134134     if(rval.getDocument() != null) {
135135       checkSignOn(rval.getDocument());
136       checkBidErrors(rval.getDocument());
136       checkBidErrors(rval);
137137     }
138138 
139139     if(JConfig.queryConfiguration("my.jbidwatcher.enabled", "false").equals("true") &&
------
153153     }
154154 
155155     if(JConfig.debugging) inEntry.setLastStatus("Failed to bid. 'Show Last Error' from context menu to see the failure page from the bid attempt.");
156     JConfig.log().dump2File("unknown-" + inEntry.getIdentifier() + ".html", rval.getBuffer());
156157     inEntry.setErrorPage(rval.getBuffer());
157158 
158159     //  We don't recognize this error.  Damn.  Log it and freak.
------
236237     return new BidFormReturn(false, null, htmlDocument, loadedPage);
237238   }
238239 
239   private void checkBidErrors(JHTML htmlDocument) throws BadBidException {
240   private void checkBidErrors(BidFormReturn inVal) throws BadBidException {
241     JHTML htmlDocument = inVal.getDocument();
240242     String errMsg = htmlDocument.grep(mBidResultRegex);
241243     if(errMsg != null) {
242244       Matcher bidMatch = mFindBidResult.matcher(errMsg);
243245       bidMatch.find();
244246       String matched_error = bidMatch.group().toLowerCase();
245       throw new BadBidException(matched_error, getMatchedResult(matched_error));
247       Integer result = getMatchedResult(matched_error);
248       JConfig.log().dump2File("error-" + result + ".html", inVal.getBuffer());
249 
250       throw new BadBidException(matched_error, result);
246251     } else {
247252       String amount = htmlDocument.getNextContentAfterRegex("\\s*Enter\\s*");
248253       if (amount != null) {
249254         String orMore = htmlDocument.getNextContent();
250255         if (orMore != null && orMore.indexOf("or more") != -1) {
256           JConfig.log().dump2File("error-" + ebayServer.BID_ERROR_TOO_LOW + ".html", inVal.getBuffer());
251257           throw new BadBidException("Enter " + amount + orMore, ebayServer.BID_ERROR_TOO_LOW);
252258         }
253259       }
------
382388       bidMatch.find();
383389       String matched_error = bidMatch.group().toLowerCase();
384390       Integer bidResult = getMatchedResult(matched_error);
391       JConfig.log().dump2File("error-" + bidResult + ".html", loadedPage);
385392 
386393       int result = 0;
387394       if (bidResult != null) {
------
418425     }
419426 
420427     if(JConfig.debugging) inEntry.setLastStatus("Failed to load post-bid data. 'Show Last Error' from context menu to see the failure page from the post-bid page.");
428     JConfig.log().dump2File("unknown-" + inEntry.getIdentifier() + ".html", loadedPage);
421429     inEntry.setErrorPage(loadedPage);
422430 
423431     JConfig.log().logFile(safeBidInfo, loadedPage);