CPD Results

The following document contains the results of PMD's CPD 5.3.2.

Duplications

File Line
ejava/examples/asyncmarket/ejb/AuctionMgmtEJB.java 262
ejava/examples/asyncmarket/ejb/BuyerEJB.java 136
            throw new MarketException("error removing auction items" + ex);
        }
    }
    
    private List<AuctionItem> makeDTO(List<AuctionItem> items) {
        List<AuctionItem> dto = new ArrayList<AuctionItem>();
        for (AuctionItem item : items) {
            dto.add(makeDTO(item));
        }
        return dto;
    }

    private AuctionItem makeDTO(AuctionItem item) {
        AuctionItem dto = new AuctionItem(item.getId());
        dto.setVersion(item.getVersion());
        dto.setName(item.getName());
        dto.setStartDate(item.getStartDate());
        dto.setEndDate(item.getEndDate());
        dto.setMinBid(item.getMinBid());
        dto.setBids(makeDTO(item.getBids(), dto));
        dto.setWinningBid(null);
        dto.setClosed(item.isClosed());
        return dto;
    }

    private List<Bid> makeDTO(List<Bid> bids, AuctionItem item) {
        List<Bid> dtos = new ArrayList<Bid>();
        for (Bid bid : bids) {
            Bid dto = new Bid(bid.getId());
            dto.setAmount(bid.getAmount());
            dto.setItem(item);
            item.getBids().add(dto);
            dto.setBidder(makeDTO(bid.getBidder(),dto));
            dtos.add(dto);
        }
        return dtos;
    }
File Line
ejava/examples/asyncmarket/ejb/AuctionMgmtEJB.java 215
ejava/examples/asyncmarket/ejb/SellerEJB.java 131
            message.setJMSType("saleUpdate");
            message.setLong("id", item.getId());
            message.setString("name", item.getName());
            message.setString("seller", item.getOwner().getUserId());
            message.setLong("startDate", item.getStartDate().getTime());
            message.setLong("endDate", item.getEndDate().getTime());
            message.setDouble("minBid", item.getMinBid());
            message.setDouble("bids", item.getBids().size());
            message.setDouble("highestBid", 
                    (item.getHighestBid() == null ? 0.00 :
                        item.getHighestBid().getAmount()));            
            producer.send(message);
            log.debug("sent=" + message);
        }
        finally {
            if (producer != null)   { producer.close(); }
        }
    }

    
    public void removeBid(long bidId) throws MarketException {
File Line
ejava/examples/asyncmarket/ejb/AuctionMgmtEJB.java 215
ejava/examples/asyncmarket/ejb/SellerEJB.java 131
ejava/examples/asyncmarket/ejb/SellerEJB.java 261
            message.setJMSType("saleUpdate");
            message.setLong("id", item.getId());
            message.setString("name", item.getName());
            message.setString("seller", item.getOwner().getUserId());
            message.setLong("startDate", item.getStartDate().getTime());
            message.setLong("endDate", item.getEndDate().getTime());
            message.setDouble("minBid", item.getMinBid());
            message.setDouble("bids", item.getBids().size());
            message.setDouble("highestBid",