Example usage for java.lang UnsupportedOperationException getMessage

List of usage examples for java.lang UnsupportedOperationException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.xlcloud.console.saml2.Saml2ServiceProviderConsumerServlet.java

/**
 * @param string/*w  w  w  .j a va2 s. c o  m*/
 * @return
 * @throws Saml2ResponseProcessingException 
 */
private SSOToken createSsoToken(String token) throws Saml2ResponseProcessingException {
    try {
        return SSOTokenManager.getInstance().createSSOToken(token);
    } catch (UnsupportedOperationException e) {
        LOG.error(e.getMessage(), e);
        throw new Saml2ResponseProcessingException(e);
    } catch (SSOException e) {
        LOG.error(e.getMessage(), e);
        throw new Saml2ResponseProcessingException(e);
    }
}

From source file:org.codice.pubsub.server.SubscriptionServer.java

public void runQuery(String msg, DateTime timestamp) {
    SearchQueryMessage queryMsg = null;//  w  w  w.  j  a va 2 s  .c  om
    try {
        queryMsg = new ObjectMapper().readValue(msg, SearchQueryMessage.class);

        /*
         * Set date / time filter to only get results from last time processor polled
         * Fetch content between last fetch and current time - 1 second (don't want to miss last millisecond updates).
         */
        String origQueryMsg = queryMsg.getQueryString();
        DateTimeFormatter fmt2 = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
        String after = fmt2.print(timestamp);
        DateTime newTime = DateTime.now().minusSeconds(1);
        String before = fmt2.print(newTime);

        String cqlSnippet = " AND modified BEFORE " + before + " AND modified AFTER " + after;
        LOGGER.debug("String to be processed: {}", origQueryMsg + cqlSnippet);
        queryMsg.setQueryString(origQueryMsg + cqlSnippet);

        //Build Query
        String cqlText = queryMsg.getQueryString();

        if (StringUtils.isNotEmpty(cqlText)) {
            Filter filter = null;
            try {
                filter = CQL.toFilter(cqlText);
                LOGGER.debug("CQL sets filter: {}", filter.toString());
            } catch (CQLException ce) {
                LOGGER.error("Fatal error while trying to build CQL-based Filter from cqlText : " + cqlText);
            }

            // Run through CSW filter as it has better CQL support
            try {
                FilterVisitor f = new CswRecordMapperFilterVisitor();
                filter = (Filter) filter.accept(f, null);
            } catch (UnsupportedOperationException ose) {
                try {
                    throw new CswException(ose.getMessage(), CswConstants.INVALID_PARAMETER_VALUE, null);
                } catch (CswException cwe) {
                    LOGGER.error(cwe.getMessage());
                }
            }

            if (catalogFramework != null && filter != null) {
                LOGGER.trace("Catalog Frameowork: " + catalogFramework.getVersion());
                //Starts QueryAndSend in a thread
                QueryAndSend qasInst = queryAndSend.newInstance();
                qasInst.setEnterprise(DEFAULT_IS_ENTERPRISE);
                qasInst.setFilter(filter);
                qasInst.setSubscriptionId(queryMsg.getSubscriptionId());
                qasInst.setNewTime(newTime);
                Callable<QueryControlInfo> worker = qasInst;
                Future<QueryControlInfo> ctrlInfo = executor.submit(worker);
                processMap.put(queryMsg.getSubscriptionId(), ctrlInfo);
            }
        }

    } catch (IOException ex) {
        LOGGER.error("Issues processing incoming query subscription: " + ex.getMessage());
        ex.printStackTrace();
    }
}

From source file:be.agiv.security.handler.WSAddressingHandler.java

private void handleOutboundMessage(SOAPMessageContext context) throws SOAPException {
    LOG.debug("adding WS-Addressing headers");
    SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope();
    SOAPHeader header = envelope.getHeader();
    if (null == header) {
        header = envelope.addHeader();/*  w  w w  .  j ava 2s . c o  m*/
    }

    String wsuPrefix = null;
    String wsAddrPrefix = null;
    Iterator namespacePrefixesIter = envelope.getNamespacePrefixes();
    while (namespacePrefixesIter.hasNext()) {
        String namespacePrefix = (String) namespacePrefixesIter.next();
        String namespace = envelope.getNamespaceURI(namespacePrefix);
        if (WSConstants.WS_ADDR_NAMESPACE.equals(namespace)) {
            wsAddrPrefix = namespacePrefix;
        } else if (WSConstants.WS_SECURITY_UTILITY_NAMESPACE.equals(namespace)) {
            wsuPrefix = namespacePrefix;
        }
    }
    if (null == wsAddrPrefix) {
        wsAddrPrefix = getUniquePrefix("a", envelope);
        envelope.addNamespaceDeclaration(wsAddrPrefix, WSConstants.WS_ADDR_NAMESPACE);
    }
    if (null == wsuPrefix) {
        /*
         * Using "wsu" is very important for the IP-STS X509 credential.
         * Apparently the STS refuses when the namespace prefix of the
         * wsu:Id on the WS-Addressing To element is different from the
         * wsu:Id prefix on the WS-Security timestamp.
         */
        wsuPrefix = "wsu";
        envelope.addNamespaceDeclaration(wsuPrefix, WSConstants.WS_SECURITY_UTILITY_NAMESPACE);
    }

    SOAPFactory factory = SOAPFactory.newInstance();

    SOAPHeaderElement actionHeaderElement = header
            .addHeaderElement(new QName(WSConstants.WS_ADDR_NAMESPACE, "Action", wsAddrPrefix));
    actionHeaderElement.setMustUnderstand(true);
    actionHeaderElement.addTextNode(this.action);

    SOAPHeaderElement messageIdElement = header
            .addHeaderElement(new QName(WSConstants.WS_ADDR_NAMESPACE, "MessageID", wsAddrPrefix));
    String messageId = "urn:uuid:" + UUID.randomUUID().toString();
    context.put(MESSAGE_ID_CONTEXT_ATTRIBUTE, messageId);
    messageIdElement.addTextNode(messageId);

    SOAPHeaderElement replyToElement = header
            .addHeaderElement(new QName(WSConstants.WS_ADDR_NAMESPACE, "ReplyTo", wsAddrPrefix));
    SOAPElement addressElement = factory.createElement("Address", wsAddrPrefix, WSConstants.WS_ADDR_NAMESPACE);
    addressElement.addTextNode("http://www.w3.org/2005/08/addressing/anonymous");
    replyToElement.addChildElement(addressElement);

    SOAPHeaderElement toElement = header
            .addHeaderElement(new QName(WSConstants.WS_ADDR_NAMESPACE, "To", wsAddrPrefix));
    toElement.setMustUnderstand(true);

    toElement.addTextNode(this.to);

    String toIdentifier = "to-id-" + UUID.randomUUID().toString();
    toElement.addAttribute(new QName(WSConstants.WS_SECURITY_UTILITY_NAMESPACE, "Id", wsuPrefix), toIdentifier);
    try {
        toElement.setIdAttributeNS(WSConstants.WS_SECURITY_UTILITY_NAMESPACE, "Id", true);
    } catch (UnsupportedOperationException e) {
        // Axis2 has missing implementation of setIdAttributeNS
        LOG.error("error setting Id attribute: " + e.getMessage());
    }
    context.put(TO_ID_CONTEXT_ATTRIBUTE, toIdentifier);
}

From source file:org.apache.hadoop.mapreduce.v2.hs.server.HSAdminServer.java

@Override
public void refreshLoadedJobCache() throws IOException {
    UserGroupInformation user = checkAcls("refreshLoadedJobCache");

    try {//from  ww  w.java  2 s .c o m
        jobHistoryService.refreshLoadedJobCache();
    } catch (UnsupportedOperationException e) {
        HSAuditLogger.logFailure(user.getShortUserName(), "refreshLoadedJobCache", adminAcl.toString(),
                HISTORY_ADMIN_SERVER, e.getMessage());
        throw e;
    }
    HSAuditLogger.logSuccess(user.getShortUserName(), "refreshLoadedJobCache", HISTORY_ADMIN_SERVER);
}

From source file:de.hybris.platform.customerticketingaddon.controllers.pages.AccountSupportTicketsPageController.java

/**
 * Used for retrieving page to create a customer support ticket.
 *
 * @param model//from  ww  w . j  ava  2 s  .c om
 * @return View String
 * @throws CMSItemNotFoundException
 */
@RequestMapping(value = "/add-support-ticket", method = RequestMethod.GET)
@RequireHardLogIn
public String addSupportTicket(final Model model) throws CMSItemNotFoundException {
    storeCmsPageInModel(model,
            getContentPageForLabelOrId(CustomerticketingaddonConstants.ADD_SUPPORT_TICKET_PAGE));
    setUpMetaDataForContentPage(model,
            getContentPageForLabelOrId(CustomerticketingaddonConstants.ADD_SUPPORT_TICKET_PAGE));

    model.addAttribute(WebConstants.BREADCRUMBS_KEY,
            getBreadcrumbs(CustomerticketingaddonConstants.TEXT_SUPPORT_TICKETING_ADD));
    model.addAttribute(ThirdPartyConstants.SeoRobots.META_ROBOTS,
            ThirdPartyConstants.SeoRobots.NOINDEX_NOFOLLOW);
    model.addAttribute(CustomerticketingaddonConstants.SUPPORT_TICKET_FORM, new SupportTicketForm());
    model.addAttribute(CustomerticketingaddonConstants.MAX_UPLOAD_SIZE, Long.valueOf(maxUploadSizeValue));
    model.addAttribute(CustomerticketingaddonConstants.MAX_UPLOAD_SIZE_MB,
            FileUtils.byteCountToDisplaySize(maxUploadSizeValue));
    try {
        model.addAttribute(CustomerticketingaddonConstants.SUPPORT_TICKET_ASSOCIATED_OBJECTS,
                ticketFacade.getAssociatedToObjects());
        model.addAttribute(CustomerticketingaddonConstants.SUPPORT_TICKET_CATEGORIES,
                ticketFacade.getTicketCategories());
    } catch (final UnsupportedOperationException ex) {
        LOG.error(ex.getMessage(), ex);
    }

    return getViewForPage(model);
}

From source file:org.xlrnet.tibaija.memory.Value.java

@Override
public int compareTo(@NotNull Value o) {
    checkNotNull(o);// ww w.  j ava  2  s.  c om

    if (Objects.equals(this, o))
        return 0;

    try {
        if (!(this.isNumber() || o.isNumber()))
            throw new IllegalTypeException("Comparison not supported for right type",
                    Variables.VariableType.NUMBER, type);
        return complexComparator.compare(this.complex(), o.complex());
    } catch (UnsupportedOperationException u) {
        throw new TIArgumentException("Illegal operation: " + u.getMessage(), this, o);
    }
}

From source file:com.sap.prd.mobile.ios.mios.xcodeprojreader.jaxb.JAXBPlistParserTest.java

@Test
public void convertOpenStepToXML() throws Exception {
    JAXBPlistParser parser = new JAXBPlistParser();
    try {/*from w w  w  . java2 s  .c  om*/
        parser.load(fileNameOpenStep);
        Assert.fail();
    } catch (javax.xml.bind.UnmarshalException e) {
        if (!(e.getCause().getClass() == SAXParseException.class)) {
            Assert.fail();
        }
    }

    File xmlProj = File.createTempFile("project", ".pbxproj");
    xmlProj.deleteOnExit();

    try {
        parser.convert(fileNameOpenStep, xmlProj.getAbsolutePath());
        Plist plist = parser.load(xmlProj.getAbsolutePath());
        assertEquals("1.0", plist.getVersion());
    } catch (UnsupportedOperationException ex) {
        // If we are running on a non Mac OS X system an UnsupportedOperationException is expected
        assertFalse("The convert function should only fail on non Mac OS X systems", SystemUtils.IS_OS_MAC_OSX);
        assertTrue("Wrong UnsupportedOperationException message", ex.getMessage().contains("Mac OS X"));
    }

}

From source file:org.dataone.proto.trove.mn.rest.base.AbstractWebController.java

@ResponseStatus(value = HttpStatus.NOT_IMPLEMENTED)
@ExceptionHandler(UnsupportedOperationException.class)
public void handleException(UnsupportedOperationException exception, HttpServletRequest request,
        HttpServletResponse response) {//w  w w. j  a v a2  s.  c o m
    NotImplemented notImplemented = new NotImplemented("000", exception.getMessage());
    handleBaseException((BaseException) notImplemented, request, response);
}

From source file:org.apache.fop.fonts.SingleByteFont.java

/**
 * Updates the mapping variable based on the encoding.
 * @param encoding the name of the encoding
 *//*from w  ww .ja v a2  s .co m*/
protected void updateMapping(String encoding) {
    try {
        this.mapping = CodePointMapping.getMapping(encoding);
    } catch (UnsupportedOperationException e) {
        log.error("Font '" + super.getFontName() + "': " + e.getMessage());
    }
}

From source file:org.sakaiproject.poll.tool.entityproviders.PollVoteEntityProvider.java

@Deprecated
public List<?> getEntities(EntityReference ref, Search search) {
    String currentUserId = userDirectoryService.getCurrentUser().getId();

    Restriction pollRes = search.getRestrictionByProperty("pollId");

    if (pollRes == null || pollRes.getSingleValue() == null) {
        //  throw new IllegalArgumentException("Must include a non-null pollId in order to retreive a list of votes");
        return null;
    }/*from  w w w.  ja v  a  2s  .  co m*/
    Long pollId = null;
    boolean viewVoters = false;
    if (developerHelperService.isUserAdmin(developerHelperService.getCurrentUserReference())) {
        viewVoters = true;
    }
    try {
        pollId = developerHelperService.convert(pollRes.getSingleValue(), Long.class);
    } catch (UnsupportedOperationException e) {
        throw new IllegalArgumentException("Invalid: pollId must be a long number: " + e.getMessage(), e);
    }
    Poll poll = pollListManager.getPollById(pollId);
    if (poll == null) {
        throw new IllegalArgumentException(
                "pollId (" + pollId + ") is invalid and does not match any known polls");
    }
    List<Vote> votes = pollVoteManager.getAllVotesForPoll(poll);

    if (developerHelperService.isEntityRequestInternal(ref.toString())) {
        // ok for all internal requests
    } else if (!pollListManager.isAllowedViewResults(poll, currentUserId)) {
        // TODO - check vote location and perm?
        // not allowed to view
        throw new SecurityException("User (" + currentUserId + ") cannot view vote (" + ref + ")");
    }
    if (viewVoters)
        return votes;
    else
        return anonymizeVotes(votes);
}