void addAnnotation(final Annotation annotation) throws ADLException { final Annotation previousAnnotation = annotations.put(annotation .getClass(), annotation); if (previousAnnotation != null) { throw new ADLException(AnnotationErrors.DUPLICATED_ANNOTATION, previousAnnotation); } }
@Override protected void handleException(ADLException e) throws Exception { MojoFailureException mojoFailureException = new MojoFailureException(e .getError().toString()); mojoFailureException.initCause(e); throw mojoFailureException; }
/** * Initialize petals composite * * @throws PetalsException * */ private void initializePetalsComposite() throws PetalsException { try { petalsComposite = fractalHelper .createNewComponent(FractalHelper.PETALS_COMPOSITE); petalsContentController = Fractal .getContentController(petalsComposite); } catch (ADLException e) { e.printStackTrace(); String msg = "Error creating petalsComposite."; throw new PetalsException(msg, e); } catch (NoSuchInterfaceException e) { System.out.println("NoSuchInterfaceException"); e.printStackTrace(); String msg = "Error creating petalsComposite."; throw new PetalsException(msg, e); } }
protected File getOutputDir(final Map<Object, Object> context) throws ADLException { File outDir = (File) context.get(OUTPUT_DIR_CONTEXT_KEY); if (outDir == null) outDir = new File(DEFAULT_OUTPUT_DIR); if (outDir.exists()) { if (!outDir.isDirectory()) { throw new ADLException(IOErrors.INVALID_OUTPUT_DIR, outDir); } } else { outDir.mkdirs(); } return outDir; }
pluginLogger.fine("Plugin instantiated using FractalADL factory."); } catch (final ADLException e) { if (e.getError().getTemplate() == ADLErrors.ADL_NOT_FOUND) throw new PluginException(PluginErrors.PLUGIN_NOT_FOUND, pluginADL); else
protected File mkdirs(final File outputFile) throws ADLException { final File parent = outputFile.getParentFile(); if (parent.exists()) { if (!parent.isDirectory()) { throw new ADLException(GenericErrors.GENERIC_ERROR, "IO Error: cannot create directory \"" + parent.getPath() + "\". File exists but is not a directory."); } } else { parent.mkdirs(); } return outputFile; }
public void exec() throws ADLException, InterruptedException { final List<String> cmd = new ArrayList<String>(); cmd.add(this.cmd); cmd.add("-c"); cmd.addAll(CompilerContextHelper.getCFlags(context)); cmd.addAll(flags); cmd.add("-o"); cmd.add(outputFile.getAbsolutePath()); cmd.add(inputFile.getAbsolutePath()); // execute command final int rValue = ExecutionHelper.exec(getDescription(), cmd); if (rValue != 0) { throw new ADLException(CompilerErrors.COMPILER_ERROR, inputFile .getPath()); } }
public void exec() throws ADLException, InterruptedException { final List<String> cmd = new ArrayList<String>(); cmd.add(this.cmd); cmd.add("-E"); cmd.addAll(CompilerContextHelper.getCFlags(context)); cmd.addAll(flags); cmd.add("-o"); cmd.add(outputFile.getAbsolutePath()); cmd.add(inputFile.getAbsolutePath()); // execute command final int rValue = ExecutionHelper.exec(getDescription(), cmd); if (rValue != 0) { throw new ADLException(CompilerErrors.COMPILER_ERROR, inputFile .getPath()); } }
private void checkControllerContainer(final ControllerContainer container) throws ADLException { Controller ctrl = container.getController(); if (ctrl != null) { if (ctrl.getDescriptor() == null) { throw new ADLException("Controller descriptor missing", (Node) ctrl); } } } }
public void exec() throws ADLException, InterruptedException { final List<String> cmd = new ArrayList<String>(); cmd.add(this.cmd); cmd.add("-o"); cmd.add(outputFile.getAbsolutePath()); for (final File inputFile : inputFiles) { cmd.add(inputFile.getPath()); } final String linkerScript = getLinkerScript(context); if (linkerScript != null) { cmd.add("-T"); cmd.add(linkerScript); } cmd.addAll(getLDFlags(context)); cmd.addAll(flags); // execute command final int rValue = ExecutionHelper.exec(getDescription(), cmd); if (rValue != 0) { throw new ADLException(CompilerErrors.COMPILER_ERROR, outputFile .getPath()); } }
private void checkImplementationContainer( final ImplementationContainer container) throws ADLException { Implementation impl = container.getImplementation(); if (impl != null) { String className = impl.getClassName(); if (className == null) { throw new ADLException("Implementation class name missing", (Node) impl); } } }
if (signature == null) { if (!extend) { throw new ADLException("Signature missing", (Node)attrs); } else { return; c = getClassLoader(context).loadClass(signature); } catch (ClassNotFoundException e) { throw new ADLException( "Invalid signature '" + signature + "'", (Node)attrs, e); String attrValue = attributes[i].getValue(); if (attrName == null) { throw new ADLException("Attribute name missing", (Node)attributes[i]); throw new ADLException("Attribute value missing", (Node)attributes[i]); getter = c.getMethod(getterName, new Class[0]); } catch (Exception e) { throw new ADLException("No such attribute", (Node)attributes[i], e); Integer.valueOf(attrValue); } catch (NumberFormatException e) { throw new ADLException( "Bad integer value: " + attrValue, (Node)attributes[i]); Long.valueOf(attrValue); } catch (NumberFormatException e) { throw new ADLException(
/** * @param container * @param extend * @throws ADLException */ private void checkGenericAttributesContainer(final GenericAttributesContainer container, final boolean extend) throws ADLException { GenericAttributes attrs = container.getGenericAttributes(); if (attrs != null) { Attribute[] attributes = attrs.getAttributes(); for (int i = 0; i < attributes.length; ++i) { String attrName = attributes[i].getName(); String attrValue = attributes[i].getValue(); if (attrName == null) { throw new ADLException("Attribute name missing", (Node) attributes[i]); } if (attrValue == null) { throw new ADLException("Attribute value missing", (Node) attributes[i]); } } } }
public Definition load(final String name, final Map<Object, Object> context) throws ADLException { final URL templateFile = locateTemplateComponent(name, context); TemplateComponent tc; try { tc = readTemplate(templateFile); } catch (final IOException e) { throw new ADLException(ADLErrors.IO_ERROR, e, templateFile.getPath()); } catch (final ParseException e) { final ErrorLocator locator = new BasicErrorLocator( templateFile.getPath(), e.currentToken.beginLine, e.currentToken.beginColumn); throw new ADLException(ADLErrors.PARSE_ERROR, locator, e.getMessage()); } if (!tc.getName().equals(name)) { throw new ADLException(ADLErrors.WRONG_DEFINITION_NAME, tc, name, tc .getName()); } String content = tc.getContent(); content = content.substring(content.indexOf("$${") + 3); content = content.substring(0, content.indexOf("}$$")); final String groupLine = "group " + tc.getName().substring(tc.getName().lastIndexOf('.') + 1) + ";\n"; tc.setContent(groupLine + content); return tc; }
if (binder.getType() == null || binder.getType().equalsIgnoreCase("")) { throw new ADLException( "The type of the binder to use can't be empty"); throw new ADLException( "Interface to be used by the binder missing"); } else {
} catch (final IOException e) { throw new ADLException(GenericErrors.GENERIC_ERROR, e, "Can't open file \"" + inputFile.getPath() + "\"."); mpp.parseFile(); } catch (final RecognitionException e) { throw new ADLException(MPPErrors.PARSE_ERROR, e, inputFile.getPath(), "MPP parse error."); throw new ADLException(MPPErrors.PARSE_ERROR, inputFile.getPath(), errorMsg.toString());
if (exp.getType() == null || exp.getType().equalsIgnoreCase("")) { throw new ADLException( "The type of the exporter to use can't be empty"); throw new ADLException( "Interface to be used by the exporter missing"); } else {
throw new ADLException(DeployErrors.DEFINITION_MISSING, dc .astGetSource());
/** * @param pc * @throws ADLException */ public static void verify(ParameterContainer pc) throws ADLException { if (pc.getParameters().length > 0) { for (Parameter p : pc.getParameters()) { log.config("ADL Parameter to be verified: [" + p.getName() + ":" + p.getValue() + "] "); if ((p.getName() == null) || (p.getName().equalsIgnoreCase(""))) { throw new ADLException( "The name of a parameter can't be empty"); } else if (p.getValue() == null || p.getValue().equalsIgnoreCase("")) { throw new ADLException("The value for parameter '" + p.getName() + "' can't be empty"); } } } } }
@Override protected void checkRemoteInterface( final RemoteInterfaceDefinition definition, final Map<Object, Object> context) throws ADLException { for (final Method m : ((MethodContainer) definition).getMethods()) { final Type returnType = Util.getContainedType((m)); /* The return value must be serializable */ if (!isSerializable(returnType)) throw new ADLException(EXBErrors.IDL_INVALID_TYPE, "The return type of the method is not serializable", returnType); /* Each parameter must be serializable */ for (final Parameter p : ((ParameterContainer) m).getParameters()) { final Type paramType = Util.getContainedType((p)); if (!isSerializable(paramType)) throw new ADLException(EXBErrors.IDL_INVALID_TYPE, "The type of the parameter '" + p.getName() + "' is not serializable", paramType); } } } }