java.lang.ArrayIndexOutOfBoundsException.printStackTrace()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(216)

本文整理了Java中java.lang.ArrayIndexOutOfBoundsException.printStackTrace()方法的一些代码示例,展示了ArrayIndexOutOfBoundsException.printStackTrace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayIndexOutOfBoundsException.printStackTrace()方法的具体详情如下:
包路径:java.lang.ArrayIndexOutOfBoundsException
类名称:ArrayIndexOutOfBoundsException
方法名:printStackTrace

ArrayIndexOutOfBoundsException.printStackTrace介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private static int readComponent(byte[] encoded, int position, int size) {
//        int component = encoded[position] & 0xff;
//        while ((--size) > 0){
//            component = (component << 8) | (encoded[++position] & 0xff);
//        }
//        return component;
    try {
      int component = 0;
      for (int i = size - 1; i >= 0; i--) {
        component = (component << 8) | (encoded[position + i] & 0xff);
      }
      return component;
//        position += size - 1;
//        
//        while ((--size) >= 0) {
//            component = (component << 8) | (encoded[position--] & 0xff);
//        }
//        return component;
    } catch (ArrayIndexOutOfBoundsException ex){
      ex.printStackTrace();
      return 0;
    }
  }

代码示例来源:origin: brianfrankcooper/YCSB

/**
 * Report a single value of a single metric. E.g. for read latency, operation="READ" and latency is the measured
 * value.
 */
public void measure(String operation, int latency) {
 if (measurementInterval == 1) {
  return;
 }
 try {
  OneMeasurement m = getOpMeasurement(operation);
  m.measure(latency);
 } catch (java.lang.ArrayIndexOutOfBoundsException e) {
  // This seems like a terribly hacky way to cover up for a bug in the measurement code
  System.out.println("ERROR: java.lang.ArrayIndexOutOfBoundsException - ignoring and continuing");
  e.printStackTrace();
  e.printStackTrace(System.out);
 }
}

代码示例来源:origin: brianfrankcooper/YCSB

/**
 * Report a single value of a single metric. E.g. for read latency, operation="READ" and latency is the measured
 * value.
 */
public void measureIntended(String operation, int latency) {
 if (measurementInterval == 0) {
  return;
 }
 try {
  OneMeasurement m = getOpIntendedMeasurement(operation);
  m.measure(latency);
 } catch (java.lang.ArrayIndexOutOfBoundsException e) {
  // This seems like a terribly hacky way to cover up for a bug in the measurement code
  System.out.println("ERROR: java.lang.ArrayIndexOutOfBoundsException - ignoring and continuing");
  e.printStackTrace();
  e.printStackTrace(System.out);
 }
}

代码示例来源:origin: iMeiji/Toutiao

e.printStackTrace();

代码示例来源:origin: marytts/marytts

System.out.println("Completed Audio Conversion successfully... Done.");
} catch (ArrayIndexOutOfBoundsException e) {
  e.printStackTrace();
  progressBar.setValue(0);
  System.err

代码示例来源:origin: marytts/marytts

System.out.println("Completed Audio Conversion successfully... Done.");
} catch (ArrayIndexOutOfBoundsException e) {
  e.printStackTrace();
  progressBar.setValue(0);
  System.err

代码示例来源:origin: oracle/opengrok

System.err.println("An error occurred - this may mean that the input file is not well-formated.");
System.err.println();
ex.printStackTrace(System.err);
System.exit(3);

代码示例来源:origin: jwpttcg66/NettyGameServer

/**
 * 注意如有需要,请使用@see {@link AIUtils#luckyDraw(float[])}
 * <p>
 * 抽奖 按照rateAry[i]要求的概率 返回 i; 计算物品必然掉落的情况 适用
 *
 * @param rateAry 概率数组 要求 数组元素 和为1
 *
 * @return
 */
@Deprecated
public static int luckyDraw(float[] rateAry) {
  if (rateAry == null) {
    return -1;// modified by sxf 090310
  }
  int[] balls = new int[100];
  int pt = 0;
  for (int i = 0; i < rateAry.length; i++) {
    int mulRate = (int) (rateAry[i] * 100);
    for (int j = 0; j < mulRate; j++) {
      try {
        balls[pt] = i;
      } catch (ArrayIndexOutOfBoundsException e) {
        e.printStackTrace();
        return rateAry.length - 1;
      }
      pt++;
    }
  }
  return balls[random(0, 99)];
}

代码示例来源:origin: SadaqaWorks/Word-By-Word-Quran-Android

public String getCorpusArabicType(long typeId) {
 int typeIdInt = (int) typeId - 1;
 corpusArabicTypeArray = context.getResources().getStringArray(R.array.corpus_word_type);
 String corpusArabicType = "";
 try {
  corpusArabicType = corpusArabicTypeArray[typeIdInt];
 } catch (ArrayIndexOutOfBoundsException e) {
  e.printStackTrace();
 }
 return corpusArabicType;
}

代码示例来源:origin: matsim-org/matsim

@Override
public double getLinkTravelTime(Link link, double time, Person person,
    Vehicle vehicle) {
  time = time % 86400;
  try {
    return times[indices.get(link.getId().toString())][(int) (time / travelTimeBinSize)];
  } catch (ArrayIndexOutOfBoundsException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return time;
}

代码示例来源:origin: laucherish/PureZhihuD

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
  if (!mEnable) {
    return false;
  }
  try {
    return mDragHelper.shouldInterceptTouchEvent(event);
  } catch (ArrayIndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: matsim-org/matsim

@Override
public double getLinkTravelTime(Link link, double time, Person person,
    Vehicle vehicle) {
  time = time % 86400;
  try {
    return times[indices.get(link.getId().toString())][(int) (time / travelTimeBinSize)];
  } catch (ArrayIndexOutOfBoundsException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return time;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

private boolean checkValidIndex(int index) {
  if (index < 0 || index >= size()) {
    new ArrayIndexOutOfBoundsException(index).printStackTrace(); // NOI18N
    // Error ???
    // FIXUP ???
    return false;
  }
  return true;
}

代码示例来源:origin: 7449/codeKK-Android

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
  if (!mEnable) {
    return false;
  }
  try {
    return mDragHelper.shouldInterceptTouchEvent(event);
  } catch (ArrayIndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: i2p/i2p.i2p

} else {
  System.err.println(error);
  aioobe.printStackTrace(System.out);

代码示例来源:origin: cmu-phil/tetrad

private void estimate(DataSet dataSet, BayesPm bayesPm, double thresh) {
  try {
    EmBayesEstimator estimator = new EmBayesEstimator(bayesPm, dataSet);
    this.estimateBayesIm = estimator.maximization(thresh);
    this.dataSet = estimator.getMixedDataSet();
  }
  catch (ArrayIndexOutOfBoundsException e) {
    e.printStackTrace();
    throw new RuntimeException("Value assignments between Bayes PM " +
        "and discrete data set do not match.");
  }
}

代码示例来源:origin: EvoSuite/evosuite

public void printStackTrace(PrintWriter p) {
  if(!MockFramework.isEnabled()){
    super.printStackTrace(p);
    return;
  }
  getDelegate().printStackTrace(p);
}

代码示例来源:origin: EvoSuite/evosuite

@Override
public void printStackTrace(PrintStream p) {
  if(!MockFramework.isEnabled()){
    super.printStackTrace(p);
    return;
  }
  getDelegate().printStackTrace(p);
}

代码示例来源:origin: EvoSuite/evosuite

@Override
public void printStackTrace() {
  if(!MockFramework.isEnabled()){
    super.printStackTrace();
    return;
  }
  getDelegate().printStackTrace();
}

代码示例来源:origin: com.github.steveash.mallet/mallet

public static double cov(Univariate x,Univariate y) {
 double sumxy=0;
 int i,n=(x.size()>=y.size() ? x.size():y.size());
 try {
  for(i=0;i<x.size();i++)
   sumxy+=(x.elementAt(i)-x.mean())*(y.elementAt(i)-y.mean());
 }
 catch (ArrayIndexOutOfBoundsException e) {
  logger.info ("size of x != size of y");
  e.printStackTrace();
 }
 return(sumxy/(n-1));
}

相关文章