Example usage for java.lang NullPointerException getMessage

List of usage examples for java.lang NullPointerException getMessage

Introduction

In this page you can find the example usage for java.lang NullPointerException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:dentex.youtube.downloader.DashboardActivity.java

private boolean doDelete(final DashboardListItem currentItem, File fileToDel, boolean removeFromJsonAlso) {
    Utils.logger("v", "----------> BEGIN delete", DEBUG_TAG);
    boolean isResultOk = false;
    long id = Long.parseLong(currentItem.getId());

    if (currentItem.getStatus().equals(getString(R.string.json_status_in_progress))) {
        // stop download, remove temp file and update notification
        try {/*from ww  w.j a  v  a2  s  .com*/
            if (Maps.dtMap.containsKey(id)) {
                DownloadTask dt = Maps.dtMap.get(id);
                dt.cancel();
            } else {
                if (Maps.dtMap.size() > 0) {
                    // cancel (pause) every dt found
                    Utils.logger("w", "doDelete: id not found into 'dtMap'; canceling all tasks", DEBUG_TAG);
                    for (Iterator<DownloadTask> iterator = Maps.dtMap.values().iterator(); iterator
                            .hasNext();) {
                        DownloadTask dt = (DownloadTask) iterator.next();
                        dt.cancel();
                    }
                }
            }

            isResultOk = removeTemp(fileToDel, id);
        } catch (NullPointerException e) {
            Log.e(DEBUG_TAG, "dt.cancel(): " + e.getMessage());
            BugSenseHandler.sendExceptionMessage(DEBUG_TAG + "-> dt.cancel() @ doDelete: ", e.getMessage(), e);
        }
    } else if (currentItem.getStatus().equals(getString(R.string.json_status_paused))) {
        isResultOk = removeTemp(fileToDel, id);
    } else {
        // remove file and library reference
        isResultOk = removeCompleted(fileToDel);
    }

    if (removeFromJsonAlso/* && isResultOk*/) {
        // remove entry from JSON and reload Dashboard
        Json.removeEntryFromJsonFile(DashboardActivity.this, currentItem.getId());
    }

    refreshlist(DashboardActivity.this);
    Utils.logger("v", "----------> END delete", DEBUG_TAG);

    return isResultOk;
}

From source file:org.openbaton.clients.interfaces.client.openstack.OpenstackClient.java

@Override
public Network getNetworkById(VimInstance vimInstance, String extId) throws VimDriverException {
    log.debug("Finding Network with ExtId: " + extId + " on VimInstance with name: " + vimInstance.getName());
    try {/*from  w w w  .j  av  a  2s  . co  m*/
        NeutronApi neutronApi = ContextBuilder.newBuilder("openstack-neutron")
                .endpoint(vimInstance.getAuthUrl())
                .credentials(vimInstance.getTenant() + ":" + vimInstance.getUsername(),
                        vimInstance.getPassword())
                .modules(modules).overrides(overrides).buildApi(NeutronApi.class);
        NetworkApi networkApi = neutronApi.getNetworkApi(getZone(vimInstance));
        org.jclouds.openstack.neutron.v2.domain.Network jcloudsNetwork = networkApi.get(extId);
        Network network = new Network();
        network.setName(jcloudsNetwork.getName());
        network.setExtId(jcloudsNetwork.getId());
        network.setExternal(jcloudsNetwork.getExternal());
        network.setShared(jcloudsNetwork.getShared());
        network.setSubnets(new HashSet<Subnet>());
        for (String subnetId : jcloudsNetwork.getSubnets()) {
            network.getSubnets().add(getSubnetById(vimInstance, subnetId));
        }
        log.info("Found Network with ExtId: " + extId + " on VimInstance with name: " + vimInstance.getName()
                + " -> " + network);
        return network;
    } catch (NullPointerException e) {
        log.error("Not found Network with ExtId: " + extId + " on VimInstance with name: "
                + vimInstance.getName(), e);
        throw new NullPointerException("Not found Network with ExtId: " + extId + " on VimInstance with name: "
                + vimInstance.getName());
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new VimDriverException(e.getMessage());
    }
}

From source file:org.openbaton.clients.interfaces.client.openstack.OpenstackClient.java

private Server getServerById(VimInstance vimInstance, String extId) throws VimDriverException {
    log.debug("Finding VM by ID: " + extId + " on VimInstance with name: " + vimInstance.getName());
    try {/*ww  w  .  ja  va2 s .  c o m*/
        NovaApi novaApi = ContextBuilder.newBuilder("openstack-nova").endpoint(vimInstance.getAuthUrl())
                .credentials(vimInstance.getTenant() + ":" + vimInstance.getUsername(),
                        vimInstance.getPassword())
                .modules(modules).overrides(overrides).buildApi(NovaApi.class);
        ServerApi serverApi = novaApi.getServerApi(getZone(vimInstance));
        org.jclouds.openstack.nova.v2_0.domain.Server jcloudsServer = serverApi.get(extId);
        log.debug("Found jclouds VM by ID: " + extId + " on VimInstance with name: " + vimInstance.getName()
                + " -> VM: " + jcloudsServer);
        Server server = new Server();
        server.setExtId(jcloudsServer.getId());
        server.setName(jcloudsServer.getName());
        server.setStatus(jcloudsServer.getStatus().value());
        server.setExtendedStatus(jcloudsServer.getExtendedStatus().toString());
        HashMap<String, List<String>> ipMap = new HashMap<>();

        for (String key : jcloudsServer.getAddresses().keys()) {
            List<String> ips = new ArrayList<>();
            for (Address address : jcloudsServer.getAddresses().get(key)) {
                ips.add(address.getAddr());
            }
            ipMap.put(key, ips);
        }

        server.setIps(ipMap);
        server.setFloatingIps(new HashMap<String, String>());
        server.setCreated(jcloudsServer.getCreated());
        server.setUpdated(jcloudsServer.getUpdated());
        Resource image = jcloudsServer.getImage();
        if (image != null) {
            server.setImage(getImageById(vimInstance, image.getId()));
        } else {
            log.warn("The image this server is using was deleted");
        }
        Resource flavor = jcloudsServer.getFlavor();
        if (flavor != null) {
            server.setFlavor(getFlavorById(vimInstance, flavor.getId()));
        } else {
            log.warn("The flavor this server is using was deleted");
        }
        log.info("Found VM by ID: " + extId + " on VimInstance with name: " + vimInstance.getName() + " -> VM: "
                + server);
        return server;
    } catch (NullPointerException e) {
        log.debug(
                "Not found jclouds VM by ID: " + extId + " on VimInstance with name: " + vimInstance.getName());
        throw new NullPointerException("Not found Server with ExtId: " + extId + " on VimInstance with name: "
                + vimInstance.getName());
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new VimDriverException(e.getMessage());
    }
}

From source file:dentex.youtube.downloader.DashboardActivity.java

private static void updateProgressBars() {
    for (int i = 0; i < idEntries.size(); i++) {

        try {//w w  w  .  j a va 2 s.  c  o m
            if (statusEntries.get(i).equals(YTD.JSON_DATA_STATUS_IN_PROGRESS)) {

                String idstr = idEntries.get(i);
                long idlong = Long.parseLong(idstr);
                long bytes_downloaded = 0;
                long bytes_total = 0;
                int progress = 0;
                long speed = 0;

                try {
                    if (Maps.mDownloadSizeMap.get(idlong) != null) {
                        bytes_downloaded = Maps.mDownloadSizeMap.get(idlong); //YTD.downloadPartialSizeMap.get(idlong);
                        bytes_total = Maps.mTotalSizeMap.get(idlong); //YTD.downloadTotalSizeMap.get(idlong);
                        progress = (int) Maps.mDownloadPercentMap.get(idlong); //YTD.downloadPercentMap.get(idlong);
                        speed = Maps.mNetworkSpeedMap.get(idlong);
                    } else {
                        countdown--;
                        Utils.logger("w",
                                "updateProgressBars: waiting for DM Maps on id " + idstr + " # " + countdown,
                                DEBUG_TAG);
                        progress = -1;
                        bytes_downloaded = 0;
                        bytes_total = 0;
                        speed = 0;

                        DownloadTask dt = Maps.dtMap.get(idlong);

                        if (countdown == 0 && dt == null) {
                            Utils.logger("w",
                                    "countdown == 0 && dt == null; setting STATUS_PAUSED on id " + idstr,
                                    DEBUG_TAG);
                            Json.addEntryToJsonFile(sDashboard, idstr, typeEntries.get(i), linkEntries.get(i),
                                    posEntries.get(i), YTD.JSON_DATA_STATUS_PAUSED, pathEntries.get(i),
                                    filenameEntries.get(i), basenameEntries.get(i), audioExtEntries.get(i),
                                    sizeEntries.get(i), false);
                        }
                    }
                } catch (NullPointerException e) {
                    Log.e(DEBUG_TAG, "NPE @ updateProgressBars");
                }

                String readableBytesDownloaded = Utils.MakeSizeHumanReadable(bytes_downloaded, false);
                String readableBytesTotal = Utils.MakeSizeHumanReadable(bytes_total, false);

                String progressRatio;
                if (readableBytesTotal.equals("-")) {
                    progressRatio = "";
                } else {
                    progressRatio = readableBytesDownloaded + "/" + readableBytesTotal;
                }

                progressEntries.add(progress);
                partSizeEntries.add(progressRatio + " (" + String.valueOf(progress) + "%)");
                speedEntries.add(speed);
            } else {
                progressEntries.add(100);
                partSizeEntries.add("-/-");
                speedEntries.add((long) 0);
            }
        } catch (IndexOutOfBoundsException e) {
            Utils.logger("w", "updateProgressBars: " + e.getMessage(), DEBUG_TAG);
        }
    }
}

From source file:dentex.youtube.downloader.DashboardActivity.java

private void pauseresume(final DashboardListItem currentItem) {

    final String itemID = currentItem.getId();
    long itemIDlong = Long.parseLong(itemID);

    Utils.logger("d", "pauseresume on id " + itemID, DEBUG_TAG);

    if (currentItem.getStatus().equals(getString(R.string.json_status_in_progress))) {
        BugSenseHandler.leaveBreadcrumb("...pausing");

        try {//  w w w . ja v a 2  s.  c o  m
            if (Maps.dtMap.containsKey(itemIDlong)) {
                DownloadTask dt = Maps.dtMap.get(itemIDlong);
                dt.cancel();
            } else {
                if (Maps.dtMap.size() > 0) {
                    // cancel (pause) every dt found
                    Utils.logger("w", "pauseresume: id not found into 'dtMap'; canceling all tasks", DEBUG_TAG);
                    for (Iterator<DownloadTask> iterator = Maps.dtMap.values().iterator(); iterator
                            .hasNext();) {
                        DownloadTask dt = (DownloadTask) iterator.next();
                        dt.cancel();
                    }
                }
            }
        } catch (NullPointerException e) {
            Log.e(DEBUG_TAG, "dt.cancel() @ pauseresume: " + e.getMessage());
            BugSenseHandler.sendExceptionMessage(DEBUG_TAG + "-> dt.cancel() @ pauseresume: ", e.getMessage(),
                    e);
        }

        YTD.removeIdUpdateNotification(itemIDlong);

        // update the JSON file entry
        Json.addEntryToJsonFile(DashboardActivity.this, itemID, currentItem.getType(), currentItem.getYtId(),
                currentItem.getPos(), YTD.JSON_DATA_STATUS_PAUSED, currentItem.getPath(),
                currentItem.getFilename(), currentItem.getBasename(), currentItem.getAudioExt(),
                currentItem.getSize(), false);
    }

    if (currentItem.getStatus().equals(getString(R.string.json_status_paused))) {
        BugSenseHandler.leaveBreadcrumb("...resuming");
        String link = YTD.videoinfo.getString(String.valueOf(itemID) + "_link", null);

        if (link != null) {
            DownloadTaskListener dtl = new DownloadTaskListener() {

                @Override
                public void preDownload(DownloadTask task) {
                    long ID = task.getDownloadId();
                    Utils.logger("d", "__preDownload on ID: " + ID, DEBUG_TAG);

                    Maps.mNetworkSpeedMap.put(ID, (long) 0);

                    Json.addEntryToJsonFile(sDashboard, String.valueOf(ID), currentItem.getType(),
                            currentItem.getYtId(), currentItem.getPos(), YTD.JSON_DATA_STATUS_IN_PROGRESS,
                            currentItem.getPath(), currentItem.getFilename(), currentItem.getBasename(),
                            currentItem.getAudioExt(), currentItem.getSize(), false);

                    YTD.sequence.add(ID);

                    YTD.NotificationHelper(sDashboard);
                }

                @Override
                public void updateProcess(DownloadTask task) {
                    /*YTD.downloadPercentMap = task.getDownloadPercentMap();
                    YTD.downloadTotalSizeMap = task.getTotalSizeMap();
                    YTD.downloadPartialSizeMap = task.getDownloadSizeMap();*/
                }

                @Override
                public void finishDownload(DownloadTask task) {
                    long ID = task.getDownloadId();
                    Utils.logger("d", "__finishDownload on ID: " + ID, DEBUG_TAG);

                    Utils.scanMedia(getApplicationContext(),
                            new String[] { currentItem.getPath() + File.separator + currentItem.getFilename() },
                            new String[] { "video/*" });

                    long downloadTotalSize = Maps.mTotalSizeMap.get(ID);
                    String size = String.valueOf(Utils.MakeSizeHumanReadable(downloadTotalSize, false));

                    Json.addEntryToJsonFile(sDashboard, String.valueOf(ID), currentItem.getType(),
                            currentItem.getYtId(), currentItem.getPos(), YTD.JSON_DATA_STATUS_COMPLETED,
                            currentItem.getPath(), currentItem.getFilename(), currentItem.getBasename(),
                            currentItem.getAudioExt(), size, false);

                    if (DashboardActivity.isDashboardRunning)
                        DashboardActivity.refreshlist(sDashboard);

                    YTD.removeIdUpdateNotification(ID);

                    YTD.videoinfo.edit().remove(ID + "_link").apply();
                    //YTD.videoinfo.edit().remove(ID + "_position").apply();

                    Maps.removeFromAllMaps(ID);
                }

                @Override
                public void errorDownload(DownloadTask task, Throwable error) {
                    String nameOfVideo = task.getDownloadedFileName();
                    long ID = task.getDownloadId();

                    Utils.logger("w", "__errorDownload on ID: " + ID, DEBUG_TAG);

                    if (error != null && error instanceof InvalidYoutubeLinkException) {
                        Toast.makeText(sDashboard, nameOfVideo + ": " + getString(R.string.downloading) + "\n"
                                + getString(R.string.wait), Toast.LENGTH_LONG).show();

                        Json.addEntryToJsonFile(sDashboard, String.valueOf(ID), YTD.JSON_DATA_TYPE_V,
                                currentItem.getYtId(), currentItem.getPos(), YTD.JSON_DATA_STATUS_PAUSED,
                                currentItem.getPath(), nameOfVideo, currentItem.getBasename(),
                                currentItem.getAudioExt(), currentItem.getSize(), false);

                        reDownload(currentItem, "AUTO");
                    } else {
                        Toast.makeText(sDashboard, nameOfVideo + ": " + getString(R.string.download_failed),
                                Toast.LENGTH_LONG).show();

                        Json.addEntryToJsonFile(sDashboard, String.valueOf(ID), YTD.JSON_DATA_TYPE_V,
                                currentItem.getYtId(), currentItem.getPos(), YTD.JSON_DATA_STATUS_PAUSED,
                                currentItem.getPath(), nameOfVideo, currentItem.getBasename(),
                                currentItem.getAudioExt(), currentItem.getSize(), false);

                        if (DashboardActivity.isDashboardRunning)
                            DashboardActivity.refreshlist(sDashboard);

                        YTD.removeIdUpdateNotification(ID);
                    }
                }
            };

            //TODO
            try {
                DownloadTask dt = new DownloadTask(this, itemIDlong, link, currentItem.getFilename(),
                        currentItem.getPath(), dtl, true);
                Maps.dtMap.put(itemIDlong, dt);
                dt.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
            } catch (MalformedURLException e) {
                Log.e(DEBUG_TAG, "unable to start Download Manager -> " + e.getMessage());
            }
        } else {
            //notifyOpsNotSupported();
            reDownload(currentItem, "AUTO");
        }
    }
    refreshlist(sDashboard);
}

From source file:com.android.ex.chips.RecipientEditTextView.java

private CharSequence createChip(final RecipientEntry entry, final boolean pressed) {
    final String displayText = createAddressText(entry);
    if (TextUtils.isEmpty(displayText))
        return null;
    SpannableString chipText = null;/*from  w ww .j  ava2  s . c  om*/
    // Always leave a blank space at the end of a chip.
    final int textLength = displayText.length() - 1;
    chipText = new SpannableString(displayText);
    if (!mNoChips)
        try {
            final DrawableRecipientChip chip = constructChipSpan(entry, pressed, false /*
                                                                                        * leave space for contact
                                                                                        * icon
                                                                                        */);
            chipText.setSpan(chip, 0, textLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            chip.setOriginalText(chipText.toString());
        } catch (final NullPointerException e) {
            Log.e(TAG, e.getMessage(), e);
            return null;
        }
    return chipText;
}

From source file:com.android.ex.chips.RecipientEditTextView.java

/**
 * Remove selection from this chip. Unselecting a RecipientChip will render the chip without a delete icon and with
 * an unfocused background. This is called when the RecipientChip no longer has focus.
 */// w  w  w . ja va  2  s  . c  o m
private void unselectChip(final DrawableRecipientChip chip) {
    final int start = getChipStart(chip);
    final int end = getChipEnd(chip);
    final Editable editable = getText();
    mSelectedChip = null;
    if (start == -1 || end == -1) {
        Log.w(TAG, "The chip doesn't exist or may be a chip a user was editing");
        setSelection(editable.length());
        commitDefault();
    } else {
        getSpannable().removeSpan(chip);
        QwertyKeyListener.markAsReplaced(editable, start, end, "");
        editable.removeSpan(chip);
        try {
            if (!mNoChips)
                editable.setSpan(constructChipSpan(chip.getEntry(), false, false), start, end,
                        Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        } catch (final NullPointerException e) {
            Log.e(TAG, e.getMessage(), e);
        }
    }
    setCursorVisible(true);
    setSelection(editable.length());
    /*if(mAlternatesPopup!=null&&mAlternatesPopup.isShowing())
      mAlternatesPopup.dismiss();*/
}

From source file:com.android.ex.chips.RecipientEditTextView.java

/**
 * Create a chip that represents just the email address of a recipient. At some later point, this chip will be
 * attached to a real contact entry, if one exists.
 *///ww w  .  jav a 2s .c o m
// VisibleForTesting
void createReplacementChip(final int tokenStart, final int tokenEnd, final Editable editable,
        final boolean visible) {
    if (alreadyHasChip(tokenStart, tokenEnd))
        // There is already a chip present at this location.
        // Don't recreate it.
        return;
    String token = editable.toString().substring(tokenStart, tokenEnd);
    final String trimmedToken = token.trim();
    final int commitCharIndex = trimmedToken.lastIndexOf(COMMIT_CHAR_COMMA);
    if (commitCharIndex != -1 && commitCharIndex == trimmedToken.length() - 1)
        token = trimmedToken.substring(0, trimmedToken.length() - 1);
    final RecipientEntry entry = createTokenizedEntry(token);
    if (entry != null) {
        DrawableRecipientChip chip = null;
        try {
            if (!mNoChips) {
                /*
                 * leave space for the contact icon if this is not just an email address
                 */
                final boolean leaveSpace = TextUtils.isEmpty(entry.getDisplayName())
                        || TextUtils.equals(entry.getDisplayName(), entry.getDestination());
                chip = visible ? constructChipSpan(entry, false, leaveSpace)
                        : new InvisibleRecipientChip(entry);
            }
        } catch (final NullPointerException e) {
            Log.e(TAG, e.getMessage(), e);
        }
        editable.setSpan(chip, tokenStart, tokenEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        // Add this chip to the list of entries "to replace"
        if (chip != null) {
            if (mTemporaryRecipients == null)
                mTemporaryRecipients = new ArrayList<DrawableRecipientChip>();
            chip.setOriginalText(token);
            mTemporaryRecipients.add(chip);
        }
    }
}

From source file:com.android.ex.chips.RecipientEditTextView.java

/**
 * Show specified chip as selected. If the RecipientChip is just an email address, selecting the chip will take the
 * contents of the chip and place it at the end of the RecipientEditTextView for inline editing. If the
 * RecipientChip is a complete contact, then selecting the chip will change the background color of the chip, show
 * the delete icon, and a popup window with the address in use highlighted and any other alternate addresses for the
 * contact./* w w  w.java2 s  . co  m*/
 *
 * @param currentChip
 * Chip to select.
 * @return A RecipientChip in the selected state or null if the chip just contained an email address.
 */
private DrawableRecipientChip selectChip(final DrawableRecipientChip currentChip) {
    if (shouldShowEditableText(currentChip)) {
        final CharSequence text = currentChip.getValue();
        final Editable editable = getText();
        final Spannable spannable = getSpannable();
        final int spanStart = spannable.getSpanStart(currentChip);
        final int spanEnd = spannable.getSpanEnd(currentChip);
        spannable.removeSpan(currentChip);
        editable.delete(spanStart, spanEnd);
        setCursorVisible(true);
        setSelection(editable.length());
        editable.append(text);
        return constructChipSpan(RecipientEntry.constructFakeEntry((String) text, isValid(text.toString())),
                true, false);
    } else if (currentChip.getContactId() == RecipientEntry.GENERATED_CONTACT || currentChip.isGalContact()) {
        final int start = getChipStart(currentChip);
        final int end = getChipEnd(currentChip);
        getSpannable().removeSpan(currentChip);
        DrawableRecipientChip newChip;
        try {
            if (mNoChips)
                return null;
            newChip = constructChipSpan(currentChip.getEntry(), true, false);
        } catch (final NullPointerException e) {
            Log.e(TAG, e.getMessage(), e);
            return null;
        }
        final Editable editable = getText();
        QwertyKeyListener.markAsReplaced(editable, start, end, "");
        if (start == -1 || end == -1)
            Log.d(TAG, "The chip being selected no longer exists but should.");
        else
            editable.setSpan(newChip, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        newChip.setSelected(true);
        if (shouldShowEditableText(newChip))
            scrollLineIntoView(getLayout().getLineForOffset(getChipStart(newChip)));
        //showAddress(newChip,mAddressPopup,getWidth());
        setCursorVisible(false);
        return newChip;
    } else {
        final int start = getChipStart(currentChip);
        final int end = getChipEnd(currentChip);
        getSpannable().removeSpan(currentChip);
        DrawableRecipientChip newChip;
        try {
            newChip = constructChipSpan(currentChip.getEntry(), true, false);
        } catch (final NullPointerException e) {
            Log.e(TAG, e.getMessage(), e);
            return null;
        }
        final Editable editable = getText();
        QwertyKeyListener.markAsReplaced(editable, start, end, "");
        if (start == -1 || end == -1)
            Log.d(TAG, "The chip being selected no longer exists but should.");
        else
            editable.setSpan(newChip, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        newChip.setSelected(true);
        if (shouldShowEditableText(newChip))
            scrollLineIntoView(getLayout().getLineForOffset(getChipStart(newChip)));
        //showAlternates(newChip,mAlternatesPopup,getWidth());
        setCursorVisible(false);
        return newChip;
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.edit.ClassgroupRetryController.java

public void doPost(HttpServletRequest req, HttpServletResponse response) {
    if (!isAuthorizedToDisplayPage(req, response, SimplePermission.USE_MISCELLANEOUS_ADMIN_PAGES.ACTION)) {
        return;/*from  w  w  w  .  j a  v  a  2  s. c  o  m*/
    }

    VitroRequest request = new VitroRequest(req);

    //create an EditProcessObject for this and put it in the session
    EditProcessObject epo = super.createEpo(request);

    String action = null;
    if (epo.getAction() == null) {
        action = "insert";
        epo.setAction("insert");
    } else {
        action = epo.getAction();
    }

    VClassGroupDao cgDao = ModelAccess.on(getServletContext()).getWebappDaoFactory().getVClassGroupDao();

    epo.setDataAccessObject(cgDao);

    VClassGroup vclassGroupForEditing = null;
    if (!epo.getUseRecycledBean()) {
        if (request.getParameter("uri") != null) {
            try {
                vclassGroupForEditing = (VClassGroup) cgDao.getGroupByURI(request.getParameter("uri"));
                action = "update";
                epo.setAction("update");
            } catch (NullPointerException e) {
                log.error("Need to implement 'record not found' error message.");
            }
            if (vclassGroupForEditing == null) {
                //UTF-8 expected due to URIEncoding on Connector in server.xml
                String uriToFind = new String(request.getParameter("uri"));
                vclassGroupForEditing = (VClassGroup) cgDao.getGroupByURI(uriToFind);
            }
        } else {
            vclassGroupForEditing = new VClassGroup();
        }
        epo.setOriginalBean(vclassGroupForEditing);
    } else {
        vclassGroupForEditing = (VClassGroup) epo.getNewBean();
    }

    //validators
    List<Validator> validatorList = new ArrayList<Validator>();
    validatorList.add(new RequiredFieldValidator());
    epo.getValidatorMap().put("PublicName", validatorList);

    //make a postinsert pageforwarder that will send us to a new class's fetch screen
    epo.setPostInsertPageForwarder(new VclassGroupInsertPageForwarder());
    //make a postdelete pageforwarder that will send us to the list of classes
    epo.setPostDeletePageForwarder(new UrlForwarder("listGroups"));

    //set the getMethod so we can retrieve a new bean after we've inserted it
    try {
        Class[] args = new Class[1];
        args[0] = String.class;
        epo.setGetMethod(cgDao.getClass().getDeclaredMethod("getGroupByURI", args));
    } catch (NoSuchMethodException e) {
        log.error(this.getClass().getName() + " could not find the getGroupByURI method");
    }

    FormObject foo = new FormObject();
    foo.setErrorMap(epo.getErrMsgMap());
    epo.setFormObject(foo);

    FormUtils.populateFormFromBean(vclassGroupForEditing, action, foo, epo.getBadValueMap());

    RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
    request.setAttribute("bodyJsp", "/templates/edit/formBasic.jsp");
    request.setAttribute("formJsp", "/templates/edit/specific/classgroup_retry.jsp");
    request.setAttribute("scripts", "/templates/edit/formBasic.js");
    request.setAttribute("title", "Classgroup Editing Form");
    request.setAttribute("_action", action);
    request.setAttribute("unqualifiedClassName", "VClassGroup");
    setRequestAttributes(request, epo);

    try {
        rd.forward(request, response);
    } catch (Exception e) {
        log.error("VclassGroupRetryController could not forward to view.");
        log.error(e.getMessage());
        log.error(e.getStackTrace());
    }

}