Package org.infoset.xml

Examples of org.infoset.xml.XMLException


  
   public void generate(final ItemDestination dest)
      throws XMLException
   {
      if (doc==null) {
         throw new XMLException("The feed instance was not instantiated using a document.");
      }
      ItemDestination top = new ItemDestination() {
         int level = 0;
         public void send(Item item)
            throws XMLException
View Full Code Here


            term(constructor,dest,t.getURI(),null);
            link(constructor,dest,"related",termRef);
            dest.send(constructor.createElementEnd(AtomResource.ENTRY_NAME));
         }
      } catch (Exception ex) {
         throw new XMLException("Exception while getting terms.",ex);
      }
      dest.send(constructor.createElementEnd(AtomResource.FEED_NAME));
      dest.send(constructor.createDocumentEnd());
   }
View Full Code Here

               }
              
            }
         }
      } catch (Exception ex) {
         throw new XMLException("Exception while getting ancestors.",ex);
      }
      dest.send(constructor.createCharacters("\n"));
      dest.send(constructor.createElementEnd(AtomResource.FEED_NAME));
      dest.send(constructor.createDocumentEnd());
   }
View Full Code Here

            dest.send(constructor.createCharacters(value.toString()));
         }

         dest.send(constructor.createElementEnd(AtomResource.CATEGORY_NAME));
      } catch (UnsupportedEncodingException ex) {
         throw new XMLException("Cannot decode term "+parts[1],ex);
      }
   }
View Full Code Here

                  } else {
                     log.info("Adding member ("+user.getAlias()+","+user.getUser().getUUID()+")");
                     group.addMember(user);
                  }
               } catch (SQLException ex) {
                  throw new XMLException("Database error while adding user "+sid+" to group ("+group.getAlias()+","+group.getUUID()+").",ex);
               } catch (IllegalArgumentException ex) {
                  log.warning("Bad UUID value '"+sid+"' on user in group ("+group.getAlias()+","+group.getUUID()+").");
               }
            }
         }
View Full Code Here

               }
               users.next().generate(constructor,dest);
               dest.send(constructor.createCharacters("\n"));
            }
         } catch (SQLException ex) {
            throw new XMLException("Cannot get member list for group.",ex);
         }
         dest.send(constructor.createElementEnd(XML.USERS_NAME));
         dest.send(constructor.createCharacters("\n"));
      }
      dest.send(constructor.createElementEnd(XML.GROUP_NAME));
View Full Code Here

                        Iterator errors = validate.getErrors();
                        while (errors.hasNext()) {
                           builder.append("\n");
                           builder.append(errors.next().toString());
                        }
                        throw new XMLException("Element "+end.getName()+" is not valid:"+builder.toString());
                     }
                     if (topLevelElements!=null) {
                        Name name = end.getName();
                        if (!topLevelElements.contains(name)) {
                           throw new XMLException("Unexpected document element "+name);
                        }
                     }
                  }
                  break;
            }
View Full Code Here

                           }
                        }
                     } catch (IllegalArgumentException ex) {
                        log.warning("Bad UUID value '"+sid+"' on role.");
                     } catch (SQLException ex) {
                        throw new XMLException("Database error creating role "+sid,ex);
                     }
                  }
               break;
               case ElementEndItem:
                  role = null;
            }
         } else if (level==4 && role!=null) {
            if (item.getType()==Item.ItemType.ElementItem) {
               Element e = (Element)item;
               if (e.getName().equals(XML.PERMISSION_NAME)) {
                  String sid = e.getAttributeValue("id");
                  String name = e.getAttributeValue("name");
                  if (sid==null && name==null) {
                     log.warning("A permission for role "+role.getUUID()+" must have at least the 'id' or 'name' attribute.");
                     return;
                  }
                  try {
                     Permission p = null;
                     if (sid!=null) {
                        UUID uuid = UUID.fromString(sid);
                        p = db.getPermission(uuid);
                     }
                     if (p==null && name!=null) {
                        p = db.getPermission(name);
                     }
                     if (p==null) {
                        log.warning("Cannot find permission ("+sid+","+name+") for role "+role.getUUID());
                     }
                     if (!role.hasPermission(p)) {
                        log.info("Adding permission ("+p.getName()+","+p.getUUID()+") to role.");
                        if (!role.addPermission(p)) {
                           log.warning("Cannot add permission "+p.getUUID()+" to role "+role.getUUID());
                        }
                     } else {
                        log.info("Role already has permission ("+p.getName()+","+p.getUUID()+") to role.");
                     }
                  } catch (IllegalArgumentException ex) {
                     log.warning("Bad UUID value '"+sid+"' on permission.");
                  } catch (SQLException ex) {
                     throw new XMLException("Database error adding permission "+sid+" to role "+role.getUUID(),ex);
                  }
               }
            }
         }
        
View Full Code Here

               name = null;
               email = null;
               alias = null;
               passwordMd5 = null;
            } catch (SQLException ex) {
               throw new XMLException("Database error while creating user "+id,ex);
            } catch (NoSuchAlgorithmException ex) {
               throw new XMLException("Password for user "+id+" could not be set.",ex);
            }
         }
         return user;
        
      }
View Full Code Here

                  } else {
                     log.info("Adding role ("+role.getName()+","+role.getUUID()+")");
                     user.addRole(role);
                  }
               } catch (SQLException ex) {
                  throw new XMLException("Database error while adding role "+sid+" to group ("+user.getAlias()+","+user.getUUID()+").",ex);
               } catch (IllegalArgumentException ex) {
                  log.warning("Bad UUID value '"+sid+"' on role in group ("+user.getAlias()+","+user.getUUID()+").");
               }
            }
         }
View Full Code Here

TOP

Related Classes of org.infoset.xml.XMLException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.