Examples of CoreException


Examples of ar.com.fdvs.dj.core.CoreException

        subreportParameter.setExpression(expression2);
        try {
          subreport.addParameter(subreportParameter );
        } catch (JRException e) {
          log.error("Error registering parameter for subreport, there must be another parameter with the same name");
          throw new CoreException(e.getMessage(),e);
        }
      }

      //some other options (cosmetic)
      //subreport.setStretchType(JRDesignElement.STRETCH_TYPE_NO_STRETCH);
View Full Code Here

Examples of bdsup2sub.core.CoreException

    public SupHD(String supFile) throws CoreException {
        try {
            buffer = new FileBuffer(supFile);
        } catch (FileBufferException ex) {
            throw new CoreException(ex.getMessage());
        }
        int bufsize = (int)buffer.getSize();

        SubPictureHD pic;
        int index = 0;
        try {
            while (index < bufsize) {
                if (Core.isCanceled()) {
                    throw new CoreException("Canceled by user!");
                }
                Core.setProgress(index);

                if (buffer.getWord(index) != 0x5350) {
                    throw new CoreException("ID 'SP' missing at index " + ToolBox.toHexLeftZeroPadded(index, 8) + "\n");
                }
                int masterIndex = index + 10; //end of header
                pic = new SubPictureHD();
                // hard code size since it's not part of the format???
                pic.setWidth(1920);
                pic.setHeight(1080);
                logger.info("#" + (subPictures.size() + 1) + "\n");
                pic.setStartTime(buffer.getDWordLE(index+=2)); // read PTS
                int packetSize = buffer.getDWord(index+=10);
                // offset to command buffer
                int ofsCmd = buffer.getDWord(index+=4) + masterIndex;
                pic.setImageBufferSize(ofsCmd - (index + 4));
                index  = ofsCmd;
                int dcsq = buffer.getWord(index);
                pic.setStartTime(pic.getStartTime() + (dcsq * 1024));
                logger.info("DCSQ start    ofs: " + ToolBox.toHexLeftZeroPadded(index, 8) + "  (" + ptsToTimeStr(pic.getStartTime()) + ")\n");
                index += 2; // 2 bytes: dcsq
                int nextIndex = buffer.getDWord(index) + masterIndex; // offset to next dcsq
                index += 5// 4 bytes: offset, 1 byte: start
                int cmd;
                boolean stopDisplay = false;
                boolean stopCommand = false;
                int alphaSum;
                int minAlphaSum = 256 * 256; // 256 fully transparent entries
                while(!stopDisplay) {
                    cmd = buffer.getByte(index++);
                    switch (cmd) {
                        case 0x01:
                            logger.info("DCSQ start    ofs: " + ToolBox.toHexLeftZeroPadded(index, 8) + "  (" + ptsToTimeStr(pic.getStartTime() + (dcsq * 1024)) + ")\n");
                            logger.warn("DCSQ start ignored due to missing DCSQ stop\n");
                            break;
                        case 0x02:
                            stopDisplay = true;
                            pic.setEndTime(pic.getStartTime() +(dcsq*1024));
                            logger.info("DCSQ stop     ofs: " + ToolBox.toHexLeftZeroPadded(index, 8) + "  (" + ptsToTimeStr(pic.getEndTime()) + ")\n");
                            break;
                        case 0x83: // palette
                            logger.trace("Palette info  ofs: " + ToolBox.toHexLeftZeroPadded(index, 8) + "\n");
                            pic.setPaletteOffset(index);
                            index += 0x300;
                            break;
                        case 0x84: // alpha
                            logger.trace("Alpha info    ofs: " + ToolBox.toHexLeftZeroPadded(index, 8) + "\n");
                            alphaSum = 0;
                            for (int i=index; i < index+0x100; i++) {
                                alphaSum += buffer.getByte(i);
                            }
                            if (alphaSum < minAlphaSum) {
                                pic.setAlphaOffset(index);
                                minAlphaSum = alphaSum;
                            } else {
                                logger.warn("Found faded alpha buffer -> alpha buffer skipped\n");
                            }

                            index += 0x100;
                            break;
                        case 0x85: // area
                            pic.setOfsX((buffer.getByte(index)<<4) | (buffer.getByte(index+1)>>4));
                            pic.setImageWidth((((buffer.getByte(index+1)&0xf)<<8) | (buffer.getByte(index+2))) - pic.getXOffset() + 1);
                            pic.setOfsY((buffer.getByte(index+3)<<4) | (buffer.getByte(index+4)>>4));
                            pic.setImageHeight((((buffer.getByte(index+4)&0xf)<<8) | (buffer.getByte(index+5))) - pic.getYOffset() + 1);
                            logger.trace("Area info     ofs: " + ToolBox.toHexLeftZeroPadded(index, 8) + "  ("
                                    + pic.getXOffset() + ", " + pic.getYOffset() + ") - (" + (pic.getXOffset() + pic.getImageWidth()) + ", "
                                    + (pic.getYOffset() + pic.getImageHeight()) + ")\n");
                            index += 6;
                            break;
                        case 0x86: // even/odd offsets
                            pic.setImageBufferOffsetEven(buffer.getDWord(index) + masterIndex);
                            pic.setImageBufferOffsetOdd(buffer.getDWord(index+4) + masterIndex);
                            logger.trace("RLE buffers   ofs: " + ToolBox.toHexLeftZeroPadded(index, 8)
                                    + "  (even: " + ToolBox.toHexLeftZeroPadded(pic.getImageBufferOffsetEven(), 8)
                                    + ", odd: " + ToolBox.toHexLeftZeroPadded(pic.getImageBufferOffsetOdd(), 8) + "\n");
                            index += 8;
                            break;
                        case 0xff:
                            if (stopCommand) {
                                logger.warn("DCSQ stop missing.\n");
                                for (++index; index < bufsize; index++)
                                    if (buffer.getByte(index++) != 0xff) {
                                        index--;
                                        break;
                                    }
                                stopDisplay = true;
                            } else {
                                index = nextIndex;
                                // add to display time
                                int d = buffer.getWord(index);
                                dcsq = d;
                                nextIndex = buffer.getDWord(index+2) + masterIndex;
                                stopCommand = (index == nextIndex);
                                logger.trace("DCSQ          ofs: " + ToolBox.toHexLeftZeroPadded(index, 8) + "  (" + (d * 1024 / 90)
                                        + "ms),    next DCSQ at ofs: " + ToolBox.toHexLeftZeroPadded(nextIndex, 8) + "\n");
                                index += 6;
                            }
                            break;
                        default:
                            throw new CoreException("Unexpected command " + cmd + " at index " + ToolBox.toHexLeftZeroPadded(index, 8));
                    }
                }
                index = masterIndex + packetSize;
                subPictures.add(pic);
            }
        } catch (CoreException ex) {
            if (subPictures.size() == 0) {
                throw ex;
            }
            logger.error(ex.getMessage() + "\n");
            logger.trace("Probably not all caption imported due to error.\n");
        } catch (FileBufferException ex) {
            if (subPictures.size() == 0) {
                throw new CoreException (ex.getMessage());
            }
            logger.error(ex.getMessage() + "\n");
            logger.trace("Probably not all caption imported due to error.\n");
        }
    }
View Full Code Here

Examples of ch.semafor.gendas.model.CoreException

    List<PropertyType> l = null; // NOPMD by wim on 9/20/10 9:14 AM
    final Query q = getEntityManager().createQuery( "from PropertyType where name = :name"); // NOPMD by wim on 9/20/10 9:14 AM
    q.setParameter( "name", name );
    l = q.getResultList();
     if( l == null || l.isEmpty() ){
       throw new CoreException("PropertyType '" + name + "' not found");
     }      
    return l.get(0);
  }
View Full Code Here

Examples of com.adito.core.CoreException

    private static void validate(String value) throws CoreException {
        int indexOf = value.indexOf(":");
        if (indexOf == -1) {
            if (!isHostNameValid(value)) {
                throw new CoreException(ErrorConstants.ERR_STRING_ISNT_IP_ADDRESS, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, value);
            }
        } else {
            String hostName = value.substring(0, indexOf);
            String port = value.substring(indexOf + 1);
            if (!isHostNameValid(hostName) || !isPortValid(port)) {
                throw new CoreException(ErrorConstants.ERR_STRING_ISNT_IP_ADDRESS, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, value);
            }
        }
    }
View Full Code Here

Examples of com.adito.core.CoreException

                try {
                    ServerSocket socket = new ServerSocket(portInt);
                    socket.close();
                } catch (Exception e) {
                    log.error("Failed to open server socket.", e);
                    throw new CoreException(ErrorConstants.ERR_INTERNAL_ERROR, ErrorConstants.CATEGORY_NAME,
                                    ErrorConstants.BUNDLE_NAME, e, value);
                }
            }
        }
    }
View Full Code Here

Examples of com.adito.core.CoreException

    try {
      if (properties != null && properties.containsKey("minLength"))
        min = Integer.parseInt(properties.getProperty("minLength"));
    } catch (NumberFormatException nfe) {
      log.error("Failed to get minimum value for validator.", nfe);
      throw new CoreException(ErrorConstants.ERR_INTERNAL_ERROR,
              ErrorConstants.CATEGORY_NAME,
              ErrorConstants.BUNDLE_NAME,
              null,
              value);
    }
    int max = maxLength;
    try {
      if (properties != null && properties.containsKey("maxLength"))
        max = Integer.parseInt(properties.getProperty("maxLength"));
    } catch (NumberFormatException nfe) {
      log.error("Failed to get maximum value for validator.", nfe);
      throw new CoreException(ErrorConstants.ERR_INTERNAL_ERROR,
              ErrorConstants.CATEGORY_NAME,
              ErrorConstants.BUNDLE_NAME,
              null,
              value);
    }

    // Validate
    if (value.length() < min) {
      throw new CoreException(ErrorConstants.ERR_STRING_TOO_SHORT,
              ErrorConstants.CATEGORY_NAME,
              ErrorConstants.BUNDLE_NAME,
              null,
              String.valueOf(min),
              String.valueOf(max),
              value,
              null);
    }
    if (value.length() > max) {
      throw new CoreException(ErrorConstants.ERR_STRING_TOO_LONG,
              ErrorConstants.CATEGORY_NAME,
              ErrorConstants.BUNDLE_NAME,
              null,
              String.valueOf(min),
              String.valueOf(max),
              value,
              null);
    }

    // Regular expression
    String regExp = properties == null ? this.regExp : Util.trimmedOrBlank(properties.getProperty("regExp", this.regExp));
    if (regExp != null && !regExp.equals("") && !value.matches(regExp)) {
      throw new CoreException(regExpErrCode,
              ErrorConstants.CATEGORY_NAME,
              ErrorConstants.BUNDLE_NAME,
              null,
              String.valueOf(regExp),
              value,
              null,
              null);

    }

    // Simple pattern
    String pattern = Util.trimmedOrBlank(properties == null ? this.pattern : properties.getProperty("pattern", this.pattern));
    if (!pattern.equals("")) {
      pattern = Util.parseSimplePatternToRegExp(pattern);
      if(!value.matches(pattern)) {
        throw new CoreException(ErrorConstants.ERR_STRING_DOESNT_MATCH_SIMPLE_PATTERN,
                ErrorConstants.CATEGORY_NAME,
                ErrorConstants.BUNDLE_NAME,
                null,
                String.valueOf(pattern),
                value,
View Full Code Here

Examples of com.adito.core.CoreException

            if(properties != null && properties.containsKey("minValue"))
                min = Integer.parseInt(properties.getProperty("minValue"));
        }
        catch(NumberFormatException nfe) {
            log.error("Failed to get minimum value for validator.", nfe);
            throw new CoreException(ErrorConstants.ERR_INTERNAL_ERROR, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, value);
        }
        int max = defaultMax;
        try {
            if(properties != null && properties.containsKey("maxValue"))
                max = Integer.parseInt(properties.getProperty("maxValue"));
        }
        catch(NumberFormatException nfe) {
            log.error("Failed to get maximum value for validator.", nfe);
            throw new CoreException(ErrorConstants.ERR_INTERNAL_ERROR, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, value);
        }

      /* We may support replacement variables so
       * to validate we must replace with the minimum value
       */      
      if(properties != null && "true".equalsIgnoreCase(properties.getProperty("replacementVariables"))) {
        Replacer r = new Replacer() {
        public String getReplacement(Pattern pattern, Matcher matcher, String replacementPattern) {
          return replacementPattern;
        }       
        };
        ReplacementEngine re = new ReplacementEngine();
        re.addPattern(VariableReplacement.VARIABLE_PATTERN, r, String.valueOf(min));
        value = re.replace(value);
      }
       
        // Validate
        try {
            int i  = Integer.parseInt(value);
            if(i < min || i > max) {
                throw new CoreException(ErrorConstants.ERR_INTEGER_OUT_OF_RANGE, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, String.valueOf(min), String.valueOf(max), value, null);               
            }
        }
        catch(NumberFormatException nfe) {
            throw new CoreException(ErrorConstants.ERR_NOT_AN_INTEGER, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, String.valueOf(min), String.valueOf(max), value, null);
        }
    }
View Full Code Here

Examples of com.adito.core.CoreException

    }
   
    private static void assertIsAscii (String value) throws CodedException {
        try {
            if (!value.equals(URLEncoder.encode(value, UTF_8))) {
                throw new CoreException(ErrorConstants.ERR_STRING_NON_ASCII, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, value);
            }
        } catch (UnsupportedEncodingException e) {
            // ignore, this just isn't going to happen
        }
    }
View Full Code Here

Examples of com.adito.core.CoreException

            if(properties != null && properties.containsKey("minValue"))
                min = Integer.parseInt(properties.getProperty("minValue"));
        }
        catch(NumberFormatException nfe) {
            log.error("Failed to get minimum value for validator.", nfe);
            throw new CoreException(ErrorConstants.ERR_INTERNAL_ERROR, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, value);
        }
        int max = defaultMax;
        try {
            if(properties != null && properties.containsKey("maxValue"))
                max = Integer.parseInt(properties.getProperty("maxValue"));
        }
        catch(NumberFormatException nfe) {
            log.error("Failed to get maximum value for validator.", nfe);
            throw new CoreException(ErrorConstants.ERR_INTERNAL_ERROR, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, value);
        }

      /* We may support replacement variables so
       * to validate we must replace with the minimum value
       */      
      if(properties != null && "true".equalsIgnoreCase(properties.getProperty("replacementVariables"))) {
        Replacer r = new Replacer() {
        public String getReplacement(Pattern pattern, Matcher matcher, String replacementPattern) {
          return replacementPattern;
        }       
        };
        ReplacementEngine re = new ReplacementEngine();
        re.addPattern(VariableReplacement.VARIABLE_PATTERN, r, String.valueOf(min));
        value = re.replace(value);
      }
       
        // Validate
        try {
            int i  = Integer.parseInt(value);
            if(i < min || i > max) {
                throw new CoreException(ErrorConstants.ERR_INTEGER_OUT_OF_RANGE, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, String.valueOf(min), String.valueOf(max), value, null);               
            }
        }
        catch(NumberFormatException nfe) {
            throw new CoreException(ErrorConstants.ERR_NOT_AN_INTEGER, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, String.valueOf(min), String.valueOf(max), value, null);
        }
    }
View Full Code Here

Examples of com.adito.core.CoreException

    private static final String COMMON_NAME = "cn=";
    private static final String ORGANISATIONAL_UNIT = "ou=";
   
    public void validate(PropertyDefinition definition, String value, Properties properties) throws CodedException {
        if (!startsWith(value, COMMON_NAME) && !startsWith(value, ORGANISATIONAL_UNIT)) {
            throw new CoreException(ErrorConstants.ERR_STRING_NON_DN, ErrorConstants.CATEGORY_NAME, ErrorConstants.BUNDLE_NAME, null, value);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.