Examples of FileFormatException


Examples of bnGUI.venn.geometry.FileFormatException

                    header = false;
                    continue;
                }
                StringTokenizer tok = new StringTokenizer(line,"\t");          
                if( tok.countTokens() != 9 )
                    throw new FileFormatException("CategoryList: Error in line "+in.getLineNumber());
               
                int     groupID = 0,
                        nTotal = 0,
                        nChange = 0;
                double  Enrichment = 0.0,
                        pValue = 1.0,
                        FDR = 1.0;
                String term = null;
                String  groupName, keyName;
               
                try
                {
                    // category gene nTotal nChange enrichment pValue nCat CRMean FDR
                    groupName   = tok.nextToken().trim();
                   
                    if( groupName.length() < 3 || !groupName.startsWith("GO:") )
                        continue; // ignore unwanted records
                   
                    keyName     = tok.nextToken().trim();
                    nTotal      =  Integer.parseInt(tok.nextToken().trim());
                    nChange     =  Integer.parseInt(tok.nextToken().trim());
                    Enrichment =  Double.parseDouble(tok.nextToken().trim());                 
                    pValue     = Math.pow(10.0,Double.parseDouble(tok.nextToken().trim().replace(',','.')));
                    tok.nextToken();
                    tok.nextToken();
                    FDR         = Double.parseDouble(tok.nextToken().trim().replace(',','.'));
                   
                    int idx = groupName.indexOf('_');
                    if( idx < 0 )
                        continue;
                   
                    groupID = Integer.parseInt( groupName.substring(3,idx) );
                    term = groupName.substring( idx+1 );
                }
                catch( NumberFormatException e )
                {
                    throw new FileFormatException("Error in element file at line "+in.getLineNumber());
                }
                Integer gval = (Integer)groupMap.get(new Integer(groupID));
                if( gval == null )
                { // entry not found in category list -> create new entry
                  gval = new Integer(groupNumber);
View Full Code Here

Examples of bnGUI.venn.geometry.FileFormatException

          header = false;
          continue;
        }
        StringTokenizer tok = new StringTokenizer(line,"\t");     
        if( tok.countTokens() != 9 && tok.countTokens() != 12 )
          throw new FileFormatException("Gene summary export (.se) file in line "+in.getLineNumber()+ " wrong number of fields");
        if (numTokens == -1) {
          numTokens = tok.countTokens();
        } else {
          if (tok.countTokens() != numTokens) {
            throw new FileFormatException("Gene summary export (.se) file in line "+in.getLineNumber()+ " number of fields has changed");
          }
        }
       
        int   groupID = 0,
            nTotal = 0,
            nUnder = 0,
            nOver = 0,
            nChange = 0;
        double   pUnder = 1.0,
            pOver = 1.0,
            pChange = 1.0,
            fdrUnder = -777.0,
            fdrOver = -888.0,
            fdrChange = -999.0;
        String term = null;
        try
        {
          String tmp = tok.nextToken().trim();
          if( tmp.equalsIgnoreCase("null") )
            continue;
          if( tmp.equalsIgnoreCase("all") )
            groupID = 0;
          else
            groupID = Integer.parseInt(tmp);
          nTotal =  Integer.parseInt(tok.nextToken().trim());
          nUnder =  Integer.parseInt(tok.nextToken().trim());
          nOver =  Integer.parseInt(tok.nextToken().trim());
          nChange =  Integer.parseInt(tok.nextToken().trim());
          pUnder = Double.parseDouble(tok.nextToken().trim().replace(',','.'));
          pOver = Double.parseDouble(tok.nextToken().trim().replace(',','.'));
          pChange = Double.parseDouble(tok.nextToken().trim().replace(',','.'));
          if (numTokens == 12) {
            fdrUnder = Double.parseDouble(tok.nextToken().trim().replace(',','.'));
            fdrOver = Double.parseDouble(tok.nextToken().trim().replace(',','.'));
            fdrChange = Double.parseDouble(tok.nextToken().trim().replace(',','.'));
          }
          term = tok.nextToken().trim();
        }
        catch( NumberFormatException e )
        {
          System.err.println( e.getStackTrace() );
          throw new FileFormatException("Gene summary export (.se) file in line "+in.getLineNumber());
        }
//        double pValue = 1.0;
//        if( pUnder < pValue ) {
//          pValue = pUnder;
//        }
View Full Code Here

Examples of bnGUI.venn.geometry.FileFormatException

         
      if( line.length() > 0 )
      {     
        StringTokenizer tok = new StringTokenizer(line,"\t");     
        if( tok.countTokens() < 3 )
          throw new FileFormatException("Gene category summary (.gce) file at line "+in.getLineNumber() +" wrong number of fields");
       
        String   strID = tok.nextToken().trim();
        if( strID.length() < 3 || !strID.startsWith("GO:") )
          continue; // ignore unwanted records
       
        String   groupName = tok.nextToken().trim(),
            keyName = tok.nextToken().trim();
       
        if( strID.length() < 4 )
          throw new FileFormatException("Gene category summary (.gce) file at line "+in.getLineNumber());
        strID = strID.substring(3);
       
        int goID = 0;
        try {
          if( !strID.equalsIgnoreCase("all") )
            goID = Integer.parseInt(strID);
        }
        catch( NumberFormatException e )
        {
          throw new FileFormatException("Gene category summary (.gce) file in line "+in.getLineNumber()+" illegal field value in first column");
        }
       
        Integer gval = (Integer)groupMap.get(new Integer(goID));
        if( gval == null )
        { // entry not found in category list -> continue
View Full Code Here

Examples of bnGUI.venn.geometry.FileFormatException

                   
            if( line.length() > 0 )
            {          
                String[] L = line.split("\t");
                if( L.length != 2 )
                    throw new FileFormatException("List: Error in line "+in.getLineNumber()+": Wrong number of fields");
               
                String  keyName = L[0].trim(),
                        groupName = L[1].trim();
               
View Full Code Here

Examples of com.google.code.fqueue.exception.FileFormatException

      readerIndex = 1;
      writerIndex = 1;
    } else {
      dbRandFile = new RandomAccessFile(dbFile, "rwd");
      if (dbRandFile.length() < 32) {
        throw new FileFormatException("file format error");
      }
      byte[] b = new byte[this.dbFileLimitLength];
      dbRandFile.read(b);
      ByteBuffer buffer = ByteBuffer.wrap(b);
      b = new byte[LogEntity.MAGIC.getBytes().length];
View Full Code Here

Examples of com.google.code.fqueue.exception.FileFormatException

      createLogEntity();
      FileRunner.addCreateFile(Integer.toString(fileNumber + 1));
    } else {
      raFile = new RandomAccessFile(file, "rwd");
      if (raFile.length() < LogEntity.messageStartPosition) {
        throw new FileFormatException("file format error");
      }
      fc = raFile.getChannel();
      mappedByteBuffer = fc.map(MapMode.READ_WRITE, 0,
          this.fileLimitLength);
      // magicString
      byte[] b = new byte[8];
      mappedByteBuffer.get(b);
      magicString = new String(b);
      if (magicString.equals(MAGIC) == false) {
        throw new FileFormatException("file format error");
      }
      // version
      version = mappedByteBuffer.getInt();
      // nextfile
      nextFile = mappedByteBuffer.getInt();
View Full Code Here

Examples of com.liosha.domain.FileFormatException

                fromToValues.put(from, toTokenizer.nextToken().trim());
                from = null;
            }
        }
        if (fromToValues.size() == 0) {
            throw new FileFormatException("Not valid file, please check the file or choose another one");
        }
        return fromToValues;
    }
View Full Code Here

Examples of org.apache.xmlbeans.impl.piccolo.io.FileFormatException

  public static void importDb(String appcode,ZipInputStream zis) throws FileFormatException,Exception{
    String fileContent = null;
      try{
        //get the zipped file list entry
        ZipEntry ze = zis.getNextEntry();
        if (ze==null) throw new FileFormatException("Looks like the uploaded file is not a valid export.");
        if(ze.isDirectory()){
          ze = zis.getNextEntry();
        }
        if(ze!=null){
          File newFile = File.createTempFile("export",".json");
          FileOutputStream fout = new FileOutputStream(newFile);
          for (int c = zis.read(); c != -1; c = zis.read()) {
            fout.write(c);
          }
          fout.close();
          fileContent = FileUtils.readFileToString(newFile);
          newFile.delete();
        }else{
          throw new FileFormatException("Looks like the uploaded file is not a valid export.");
        }
        ZipEntry manifest = zis.getNextEntry();
        if(manifest!=null){
          File manifestFile = File.createTempFile("manifest",".txt");
          FileOutputStream fout = new FileOutputStream(manifestFile);
          for (int c = zis.read(); c != -1; c = zis.read()) {
            fout.write(c);
          }
          fout.close();
          String manifestContent  = FileUtils.readFileToString(manifestFile);
          manifestFile.delete();
          Pattern p = Pattern.compile(BBInternalConstants.IMPORT_MANIFEST_VERSION_PATTERN);
          Matcher m = p.matcher(manifestContent);
          if(m.matches()){
            String version = m.group(1);
            if (version.compareToIgnoreCase("0.6.0")<0){ //we support imports from version 0.6.0
              throw new FileFormatException(String.format("Current baasbox version(%s) is not compatible with import file version(%s)",BBConfiguration.getApiVersion(),version));
            }else{
              if (Logger.isDebugEnabled()) Logger.debug("Version : "+version+" is valid");
            }
          }else{
            throw new FileFormatException("The manifest file does not contain a version number");
          }
        }else{
          throw new FileFormatException("Looks like zip file does not contain a manifest file");
        }
        if (Logger.isDebugEnabled()) Logger.debug("Importing: "+fileContent);
        if(fileContent!=null && StringUtils.isNotEmpty(fileContent.trim())){
          DbHelper.importData(appcode, fileContent);
          zis.closeEntry();
          zis.close();
        }else{
          throw new FileFormatException("The import file is empty");
        }
      }catch(FileFormatException e){
        Logger.error(e.getMessage());
        throw e;
      }catch(Throwable e){
View Full Code Here

Examples of org.bitbucket.kchau.longshot.exceptions.FileFormatException

    }
   
    catch (FileFormatException e)
    {
      System.out.println("AudioInterface_createAudioObject-\tFAIL");
      throw new FileFormatException(e);
    }
   
    catch(FileDoesNotExistException e)
    {
      System.out.println("AudioInterface_createAudioObject-\tFAIL");
View Full Code Here

Examples of org.jnetstream.capture.FileFormatException

     
    } else if (header.get(0) == PcapFile.MAGIC_PATTERN_LE[0]) {
      return ByteOrder.LITTLE_ENDIAN;
     
    } else {
      throw new FileFormatException("Invalid PCAP block header magic number");
    }
  }
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.