List of usage examples for java.lang IndexOutOfBoundsException printStackTrace
public void printStackTrace()
From source file:luceneGazateer.EntryData.java
public static void produceCandidates(String indexPath, String fileName, GeoNameResolver resolver) throws IOException { BufferedReader filereader = new BufferedReader( new InputStreamReader(new FileInputStream(fileName), "UTF-8")); FileWriter ps = new FileWriter("output.txt", true); String line = ""; String testString = ""; String uri = ""; while ((line = filereader.readLine()) != null) { String[] locArgs = line.split("\t"); try {/* www .j a v a 2s .c o m*/ uri = locArgs[0]; testString = locArgs[1]; System.out.println(testString); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); System.exit(-1); } ArrayList<EntryData> resolved = resolver.searchDocuments(indexPath, testString, globalDocType); resolved.sort(new Comparator<EntryData>() { @Override public int compare(EntryData e1, EntryData e2) { Double diff = e1.getScore() - e2.getScore(); if (diff < 1e-6 && diff > -1e-6) return 0; else if (diff > 0) return -1; return 1; } }); ps.write("{\"query_string\":{\"uri\":\"" + uri + "\",\"name\":\"" + testString + "\", \"candidates\":"); ps.write("["); for (int i = 0; i < resolved.size(); i++) { //for(Map.Entry<String, Double> entry : candidatesEntryList){ ps.write("{\"uri\":\"" + resolved.get(i).getId() + "\","); ps.write("\"name\":\"" + resolved.get(i).getName() + "\","); ps.write("\"score\":\"" + resolved.get(i).getScore() + "\""); if (i < resolved.size() - 1) { ps.write("},"); } else { ps.write("}"); } //System.out.println("\t" + entry.getValue() + "\t" + entry.getKey()); } ps.write("]}}\n"); ps.flush(); } }
From source file:org.wso2.carbon.inbound.salesforce.poll.SoapLoginUtil.java
public static void login(HttpClient client, String username, String password) throws IOException, InterruptedException, SAXException, ParserConfigurationException { try {/*from ww w . jav a 2s .c o m*/ ContentExchange exchange = new ContentExchange(); exchange.setMethod("POST"); exchange.setURL(getSoapURL()); exchange.setRequestContentSource(new ByteArrayInputStream(soapXmlForLogin(username, password))); exchange.setRequestHeader("Content-Type", "text/xml"); exchange.setRequestHeader("SOAPAction", "''"); exchange.setRequestHeader("PrettyPrint", "Yes"); client.send(exchange); exchange.waitForDone(); try { String response = exchange.getResponseContent(); String tagSession = "<sessionId>"; String tagServerUrl = "<serverUrl>"; String serverUrl = response.substring(response.indexOf(tagServerUrl) + tagServerUrl.length(), response.indexOf("</serverUrl>")); sessionId = response.substring(response.indexOf(tagSession) + tagSession.length(), response.indexOf("</sessionId>")); LoginUrl = serverUrl.substring(0, serverUrl.indexOf("/services")); } catch (IndexOutOfBoundsException e) { log.error("Login credentials of Salesforce is wrong...."); throw new SynapseException("Login credentials of Salesforce is wrong....", e); } } catch (MalformedURLException e) { log.error("Error while building URL", e); } catch (InterruptedException e) { log.error("Error in exchange the asynchronous message", e); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { log.error("Error while login to Salesforce" + e.getMessage(), e); } }
From source file:foam.zizim.android.BoskoiService.java
public static int getColorForIncident(IncidentsData incident) { try {/*www.ja va 2 s.c o m*/ int end = incident.getIncidentCategories().indexOf(',') > -1 ? incident.getIncidentCategories().indexOf(',') : incident.getIncidentCategories().length(); String category = incident.getIncidentCategories().substring(0, end); String color = "#" + getCategoriesDetails(category)[0].getCategoryColor(); return Color.parseColor(color); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); return R.drawable.marker_color; } catch (NumberFormatException e) { e.printStackTrace(); return R.drawable.marker_color; } }
From source file:org.kalypso.model.wspm.core.profil.util.ProfileUtil.java
public static double getDoubleValueFor(final int componentIndex, final IRecord point) { try {//from w w w . j a v a 2 s . c o m final Object oValue = point.getValue(componentIndex); if (oValue instanceof Number) return ((Number) oValue).doubleValue(); return Double.NaN; } catch (final IndexOutOfBoundsException e) { e.printStackTrace(); return Double.NaN; } }
From source file:org.kalypso.model.wspm.core.profil.util.ProfileUtil.java
private static void doInterpolate(final int distanceCompIndex, final int valueCompIndex, final IRecord prevPoint, final IRecord nextPoint, final IRecord[] toInterpolate) { final Double prevDistance = prevPoint == null ? null : (Double) prevPoint.getValue(distanceCompIndex); final Double prevValue = prevPoint == null ? null : (Double) prevPoint.getValue(valueCompIndex); final Double nextDistance = nextPoint == null ? null : (Double) nextPoint.getValue(distanceCompIndex); final Double nextValue = nextPoint == null ? null : (Double) nextPoint.getValue(valueCompIndex); if (prevDistance == null || prevValue == null) { for (final IRecord point : toInterpolate) { point.setValue(valueCompIndex, nextValue); }//from ww w . jav a2s . co m } else if (nextDistance == null || nextValue == null) { for (final IRecord point : toInterpolate) { point.setValue(valueCompIndex, prevValue); } } else { for (final IRecord point : toInterpolate) { final Double distance = (Double) point.getValue(distanceCompIndex); if (distance != null) { try { final LinearEquation le = new LinearEquation(prevDistance, prevValue, nextDistance, nextValue); final double value = le.computeY(distance); point.setValue(valueCompIndex, value); } catch (final IndexOutOfBoundsException e) { e.printStackTrace(); } catch (final SameXValuesException e) { e.printStackTrace(); } } } } }
From source file:org.openhie.openempi.blocking.AbstractBlockingServiceBase.java
public void getRecordPairs(Object blockingServiceCustomParameters, String matchingServiceTypeName, Object matchingServiceCustomParameters, String leftTableName, String rightTableName, List<LeanRecordPair> pairs, boolean emOnly, FellegiSunterParameters fellegiSunterParameters) throws ApplicationException { // Default to using the iterators RecordPairSource source = getRecordPairSource(leftTableName, rightTableName); RecordPairIterator iter = source.iterator(leftTableName, rightTableName, emOnly, fellegiSunterParameters); for (; iter.hasNext();) { try {//from www . jav a 2 s .c o m if (!emOnly) pairs.add(iter.next()); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); // This shouldn't happen in theory. What to do? log.error("ERROR: blockingService pairs iterator couldn't return a value!"); } } log.warn("True matches: " + iter.getTrueMatchCounter()); }
From source file:org.strasa.web.updatestudy.view.GenotypicData.java
@Init public void init(@ExecutionArgParam("uploadModel") ProcessTabViewModel model) { studyFileMan = new StudyFileManagerImpl(); this.studyid = model.studyID; System.out.println("StudyId" + Integer.toString(model.studyID)); try {// ww w . jav a2 s . co m setGenotypicFiles(studyFileMan.getFileByStudyIdAndDataType(model.studyID, dataType)); } catch (IndexOutOfBoundsException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:com.ibm.iot.iotspark.IoTZScore.java
public void updateWindowZScoreMeans(Double a) { try {// w w w . ja v a 2 s .c om if (wentries.size() >= wsize) { //move value left for (int i = 0; i < wsize - 1; i++) { wentries.set(i, wentries.get(i + 1)); } //add the value a to the last slot wentries.set(wsize - 1, a); } else { wentries.add(a); } } catch (IndexOutOfBoundsException e) { e.printStackTrace(); } //need to recalculate wmu from scratch wmu = 0; wtemp = 0; for (int j = 0; j < wentries.size(); j++) { double delta = wentries.get(j) - wmu; wmu += delta / wentries.size(); if (wentries.size() > 0) { wtemp += delta * (wentries.get(j) - wmu); } } }
From source file:io.indy.drone.fragment.StrikeListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try {//from ww w . j ava 2s . c om mLocation = SQLDatabase.regionFromIndex(0); // worldwide } catch (IndexOutOfBoundsException e) { e.printStackTrace(); } }
From source file:com.grarak.kerneladiutor.fragments.kernel.CPUVoltageFragment.java
private void refresh() { new Thread(new Runnable() { @Override/*from ww w .j a va 2 s . c o m*/ public void run() { try { Thread.sleep(500); getActivity().runOnUiThread(new Runnable() { @Override public void run() { List<String> voltages = CPUVoltage.getVoltages(); if (voltages != null) for (int i = 0; i < mVoltageCard.length; i++) { try { if (voltagetable.get(CPUVoltage.getFreqs().get(i)) != null) { int stock = Integer .parseInt(voltagetable.get(CPUVoltage.getFreqs().get(i))); int current = Integer.parseInt(voltages.get(i)); String diff; if (stock > current) { diff = "(-" + (stock - current) + ")"; } else if (stock < current) { diff = "(+" + (current - stock) + ")"; } else { diff = ""; } mVoltageCard[i].setDescription( voltages.get(i) + getString(R.string.mv) + diff); } else { mVoltageCard[i] .setDescription(voltages.get(i) + getString(R.string.mv)); } mVoltageCard[i].setValue(voltages.get(i)); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } } }).start(); }