Example usage for java.lang IllegalAccessException IllegalAccessException

List of usage examples for java.lang IllegalAccessException IllegalAccessException

Introduction

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

Prototype

public IllegalAccessException(String s) 

Source Link

Document

Constructs an IllegalAccessException with a detail message.

Usage

From source file:org.apache.hadoop.chukwa.datastore.ViewStore.java

public void load(String uid, String vid) throws IllegalAccessException {
    StringBuilder vp = new StringBuilder();
    vp.append(usersViewPath);//from   w ww  .  j a v  a 2  s.  co m
    vp.append(File.separator);
    vp.append(uid);
    vp.append(File.separator);
    vp.append(vid);
    vp.append(".view");
    Path viewFile = new Path(vp.toString());
    try {
        FileSystem fs = FileSystem.get(config);
        if (!fs.exists(viewFile)) {
            StringBuilder pubPath = new StringBuilder();
            pubPath.append(publicViewPath);
            pubPath.append(File.separator);
            pubPath.append(vid);
            pubPath.append(".view");
            viewFile = new Path(pubPath.toString());
        }
        if (fs.exists(viewFile)) {
            FileStatus[] fstatus = fs.listStatus(viewFile);
            long size = fstatus[0].getLen();
            FSDataInputStream viewStream = fs.open(viewFile);
            byte[] buffer = new byte[(int) size];
            viewStream.readFully(buffer);
            viewStream.close();
            try {
                view = new ViewBean(new JSONObject(new String(buffer)));
                view.update();
            } catch (Exception e) {
                log.error(ExceptionUtil.getStackTrace(e));
                throw new IllegalAccessException("Unable to access view: " + vid);
            }
        }
    } catch (IOException ex) {
        log.error(ExceptionUtil.getStackTrace(ex));
    }
}

From source file:com.garethahealy.camelmapstruct.converter.MapStructTypeConverter.java

private String findMethodName(Class<?> from, Class<?> to) throws IllegalAccessException {
    String methodName;//from   w  w  w . jav  a  2  s .  co  m

    Table<Class<?>, Class<?>, String> resolved = configuration.getResolvedMappingMethods();
    if (resolved.containsRow(from) && resolved.containsColumn(to)) {
        methodName = resolved.get(from, to);
    } else {
        String innerMessage = "Did'nt find method on mapper " + mapper.getClass().getCanonicalName()
                + " that container a parameter of " + from.getCanonicalName() + "; Found possible matches: "
                + StringUtils.join(resolved.values(), ", ");

        LOG.error(innerMessage);

        throw new IllegalAccessException(innerMessage);
    }

    return methodName;
}

From source file:com.reactivetechnologies.platform.datagrid.HazelcastKeyValueAdapterBean.java

/**
 * Add a partition migration listener on the given map. Migration listeners have to be
 * registered before {@link #acceptJoin()} is invoked.
 * @param <V>/* w  w w .  j a  v  a  2 s . c o  m*/
 * @param callback
 * @throws IllegalAccessException if added after service is already started
 */
public <V> void addPartitionMigrationListener(PartitionMigrationCallback<V> callback)
        throws IllegalAccessException {
    if (!hz.isStarted()) {
        hz.addPartitionMigrationCallback(callback);
    } else
        throw new IllegalAccessException(
                "PartitionMigrationListener cannot be added after Hazelcast service has been started");
}

From source file:org.apache.axis.utils.BeanPropertyDescriptor.java

/**
 * Set the property value/*  w  ww. j a v a 2 s. co  m*/
 * @param obj is the object
 * @param newValue is the new value
 */
public void set(Object obj, Object newValue) throws InvocationTargetException, IllegalAccessException {
    Method writeMethod = myPD.getWriteMethod();
    if (writeMethod != null) {
        writeMethod.invoke(obj, new Object[] { newValue });
    } else {
        throw new IllegalAccessException(Messages.getMessage("badSetter00"));
    }
}

From source file:org.sparkcommerce.openadmin.server.service.persistence.module.provider.MediaFieldPersistenceProvider.java

@Override
public FieldProviderResponse populateValue(PopulateValueRequest populateValueRequest, Serializable instance)
        throws PersistenceException {
    if (!canHandlePersistence(populateValueRequest, instance)) {
        return FieldProviderResponse.NOT_HANDLED;
    }/*  ww w  .  j  av a 2s .c  o  m*/
    FieldProviderResponse response = FieldProviderResponse.HANDLED;
    boolean dirty = false;
    try {
        setNonDisplayableValues(populateValueRequest);
        Class<?> valueType = null;
        if (!populateValueRequest.getProperty().getName().contains(FieldManager.MAPFIELDSEPARATOR)) {
            valueType = populateValueRequest.getReturnType();
        } else {
            String valueClassName = populateValueRequest.getMetadata().getMapFieldValueClass();
            if (valueClassName != null) {
                valueType = Class.forName(valueClassName);
            }
            if (valueType == null) {
                valueType = populateValueRequest.getReturnType();
            }
        }

        if (valueType == null) {
            throw new IllegalAccessException("Unable to determine the valueType for the rule field ("
                    + populateValueRequest.getProperty().getName() + ")");
        }

        if (Media.class.isAssignableFrom(valueType)) {
            Media newMedia = convertJsonToMedia(populateValueRequest.getProperty().getUnHtmlEncodedValue());
            Media media;
            try {
                media = (Media) populateValueRequest.getFieldManager().getFieldValue(instance,
                        populateValueRequest.getProperty().getName());
            } catch (FieldNotAvailableException e) {
                throw new IllegalArgumentException(e);
            }
            populateValueRequest.getProperty().setOriginalValue(convertMediaToJson(media));

            boolean persist = false;
            if (media == null) {
                media = (Media) valueType.newInstance();
                persist = true;
            }

            Map description = BeanUtils.describe(media);
            for (Object temp : description.keySet()) {
                String property = (String) temp;
                //ignore id and SandBoxDiscriminator fields
                String[] ignoredProperties = sandBoxHelper.getSandBoxDiscriminatorFieldList();
                ignoredProperties = (String[]) ArrayUtils.add(ignoredProperties, "id");
                Arrays.sort(ignoredProperties);
                if (Arrays.binarySearch(ignoredProperties, property) < 0) {
                    String prop1 = String.valueOf(description.get(property));
                    String prop2 = String.valueOf(BeanUtils.getProperty(newMedia, property));
                    if (!prop1.equals(prop2)) {
                        dirty = true;
                        break;
                    }
                }
            }

            if (dirty) {
                updateMediaFields(media, newMedia);
                if (persist) {
                    populateValueRequest.getPersistenceManager().getDynamicEntityDao().persist(media);
                }
                populateValueRequest.getFieldManager().setFieldValue(instance,
                        populateValueRequest.getProperty().getName(), media);
                response = FieldProviderResponse.HANDLED_BREAK;
            }
        } else {
            throw new UnsupportedOperationException("MediaFields only work with Media types.");
        }
    } catch (Exception e) {
        throw new PersistenceException(e);
    }
    populateValueRequest.getProperty().setIsDirty(dirty);

    return response;
}

From source file:org.infoscoop.service.TabLayoutService.java

/**
 * Return login user id if it can be edited
 * @return/* w w  w .  j  av a 2s. co m*/
 * @throws IllegalAccessException
 */
private String checkLoginUid() throws IllegalAccessException {
    ISPrincipal p = SecurityController.getPrincipalByType("UIDPrincipal");
    String myUid = p.getName();
    String lockingUid = tabLayoutDAO.selectLockingUid();
    /*
    if (lockingUid == null) {
       throw new IllegalAccessException("Temp data is not found.");
    }
    */
    if (myUid != null && !myUid.equals(lockingUid)) {
        if (lockingUid != null) {
            throw new IllegalAccessException("The user \"" + lockingUid + "\" is editing it.");
        } else {
            throw new IllegalAccessException("Your temprary record was deleted by another administrator.");
        }
    }

    return myUid;
}

From source file:org.rhq.modules.plugins.wildfly10.ConfigurationWriteDelegate.java

/**
 * Trigger loading of a configuration by talking to the remote resource.
 * @return The initialized configuration
 * @throws Exception If anything goes wrong.
 *///w  w w  .  jav  a  2s. c  o m
public Configuration loadResourceConfiguration() throws Exception {
    throw new IllegalAccessException("Please use ConfigurationLoadDelegate");
}

From source file:org.echocat.jomon.net.http.browsers.BrowserDefinitionFactory.java

@Nonnull
private BrowserDefinition createBrowserDefinitionFrom(@Nonnull Row row,
        @Nonnull Map<String, Map<String, String>> parentUserAgentToProperties) throws Exception {
    final String plainUserAgent = row.getValue("PropertyName");
    if (plainUserAgent == null) {
        throw new IllegalAccessException("The provided " + row + " contains a null UserAgent.");
    }//from  w  w w.  j a v  a2s.  c om
    final String userAgent = normalizeUserAgent(plainUserAgent);
    final String parentUserAgent = row.getValue("Parent");
    if (parentUserAgent == null) {
        throw new IllegalAccessException("The provided " + row + " contains a null Parent.");
    }
    final Map<String, String> properties = new HashMap<>();
    enrichWithPropertiesOfParentIfPossible(properties, userAgent, parentUserAgent, parentUserAgentToProperties);
    enrichWithPropertiesFromRow(properties, row);
    return new BrowserDefinition(userAgent, properties, parentUserAgent);
}

From source file:org.apache.hadoop.chukwa.datastore.UserStore.java

public void set(UserBean profile) throws IllegalAccessException {
    StringBuilder profilePath = new StringBuilder();
    profilePath.append(hiccPath);/* w ww  .  j  av  a  2s  .  c o m*/
    profilePath.append(File.separator);
    profilePath.append(profile.getId());
    profilePath.append(".profile");
    Path profileFile = new Path(profilePath.toString());
    FileSystem fs;
    try {
        fs = FileSystem.get(config);
        FSDataOutputStream out = fs.create(profileFile, true);
        out.write(profile.deserialize().toString().getBytes());
        out.close();
    } catch (IOException ex) {
        log.error(ExceptionUtil.getStackTrace(ex));
        throw new IllegalAccessException("Unable to access user profile database.");
    }
    this.profile = profile;
}

From source file:org.neo4art.graphdb.connection.BatchInserterConnectionManager.java

@Override
public Result executeCypherQuery(String query, Map<String, Object> parameters) {

    throw new RuntimeException(new IllegalAccessException("Method not allowed for this implementation."));
}