List of usage examples for java.lang NullPointerException getMessage
public String getMessage()
From source file:org.pentaho.mantle.server.MantleServlet.java
/** * This method provides the content for the My Subscription section in the Workspace. * // w ww. ja va 2 s .c om * @return List<SubscriptionBean> List of subscriptions and their related information contained within the object. */ public ArrayList<SubscriptionBean> getSubscriptionsForMyWorkspace() { ISubscriptionRepository subscriptionRepository = PentahoSystem.get(ISubscriptionRepository.class, getPentahoSession()); final String currentUser = getPentahoSession().getName(); final List<ISubscription> userSubscriptionList = subscriptionRepository.getUserSubscriptions(currentUser); final ArrayList<SubscriptionBean> opSubscrList = new ArrayList<SubscriptionBean>(); Iterator<ISubscription> subscrIter = userSubscriptionList.iterator(); while (subscrIter.hasNext()) { final ISubscription currentSubscr = subscrIter.next(); final ActionInfo actionInfo = ActionInfo .parseActionString(currentSubscr.getContent().getActionReference()); String localizedName = actionInfo.getActionName(); try { SolutionFileInfo info = getSolutionFileInfo(actionInfo.getSolutionName(), actionInfo.getPath(), actionInfo.getActionName()); localizedName = info.getLocalizedName(); } catch (NullPointerException npe) { logger.error(npe.getMessage(), npe); continue; } Schedule schedule = null; final Iterator schedIterator = currentSubscr.getSchedules().iterator(); // Get the first schedule and get out of the loop // The code is below to avoid null pointer exceptions and get a schedule // only if it exists. if (schedIterator != null) { while (schedIterator.hasNext()) { schedule = (Schedule) schedIterator.next(); break; } } final SubscriptionBean subscriptionBean = new SubscriptionBean(); subscriptionBean.setId(currentSubscr.getId()); subscriptionBean.setName(currentSubscr.getTitle()); subscriptionBean.setXactionName(localizedName); if (!actionInfo.getActionName().endsWith(".")) { int lastDot = actionInfo.getActionName().lastIndexOf('.'); String type = actionInfo.getActionName().substring(lastDot + 1); IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, getPentahoSession()); //$NON-NLS-1$ IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext(); String contextPath = requestContext.getContextPath(); IContentInfo contentInfo = pluginManager.getContentInfoFromExtension(type, getPentahoSession()); String editSubscriptionUrl = null; if (contentInfo != null) { for (IPluginOperation operation : contentInfo.getOperations()) { if (operation.getId().equals("SCHEDULE_EDIT")) { editSubscriptionUrl = contextPath + operation.getCommand(); //$NON-NLS-1$ editSubscriptionUrl = editSubscriptionUrl.replaceAll("\\{subscription-id\\}", currentSubscr.getId()); break; } } } subscriptionBean.setPluginUrl(editSubscriptionUrl); } if (schedule != null) { subscriptionBean.setScheduleDate(schedule.getTitle()); } // We have static dashes here because thats the way data is being // displayed currently in 1.7 subscriptionBean.setSize("---"); //$NON-NLS-1$ subscriptionBean.setType("---"); //$NON-NLS-1$ subscriptionBean.setContent(getContentItems(subscriptionRepository, (Subscription) currentSubscr)); opSubscrList.add(subscriptionBean); } return opSubscrList; }
From source file:com.novartis.opensource.yada.util.QueryUtils.java
/** * Calls the appropriate setter method for {@code type} in the {@code pstmt}, * performing the appropriate type conversion or syntax change as needed * (e.g., for {@link java.sql.Date}s)/*from ww w .j a va 2 s. c o m*/ * * @param pstmt * the statement to which to assign the parameter values * @param index * the position of the parameter * @param type * the data type of the parameter * @param val * the value to assign */ @SuppressWarnings("static-method") private void setQueryParameter(PreparedStatement pstmt, int index, char type, String val) { String idx = (index < 10) ? " " + String.valueOf(index) : String.valueOf(index); l.debug("Setting param [" + idx + "] of type [" + String.valueOf(type) + "] to: " + val); try { switch (type) { case DATE: try { if ("".equals(val) || val == null) { pstmt.setNull(index, java.sql.Types.DATE); } else { SimpleDateFormat sdf = new SimpleDateFormat(STANDARD_DATE_FMT); ParsePosition pp = new ParsePosition(0); Date dateVal = sdf.parse(val, pp); if (dateVal == null) { sdf = new SimpleDateFormat(ORACLE_DATE_FMT); dateVal = sdf.parse(val, pp); } if (dateVal != null) { long t = dateVal.getTime(); java.sql.Date sqlDateVal = new java.sql.Date(t); pstmt.setDate(index, sqlDateVal); } } } catch (Exception e) { l.error("Error: " + e.getMessage()); } break; case INTEGER: try { int ival = Integer.parseInt(val); pstmt.setInt(index, ival); } catch (NumberFormatException nfe) { l.error("Error: " + nfe.getMessage()); l.debug("Setting param [" + String.valueOf(index) + "] of type [" + String.valueOf(type) + "] to: null"); pstmt.setNull(index, java.sql.Types.INTEGER); } catch (NullPointerException npe) { l.error("Error: " + npe.getMessage()); l.debug("Setting param [" + String.valueOf(index) + "] of type [" + String.valueOf(type) + "] to: null"); pstmt.setNull(index, java.sql.Types.INTEGER); } catch (Exception sqle) { l.error("Error: " + sqle.getMessage()); l.debug("Setting param [" + String.valueOf(index) + "] of type [" + String.valueOf(type) + "] to: 0"); pstmt.setNull(index, java.sql.Types.INTEGER); } break; case NUMBER: try { float fval = Float.parseFloat(val); pstmt.setFloat(index, fval); } catch (NumberFormatException nfe) { l.error("Error: " + nfe.getMessage()); l.debug("Setting param [" + String.valueOf(index) + "] of type [" + String.valueOf(type) + "] to: null"); pstmt.setNull(index, java.sql.Types.INTEGER); } catch (NullPointerException npe) { l.error("Error: " + npe.getMessage()); l.debug("Setting param [" + String.valueOf(index) + "] of type [" + String.valueOf(type) + "] to: null"); pstmt.setNull(index, java.sql.Types.INTEGER); } catch (Exception sqle) { l.error("Error: " + sqle.getMessage()); l.debug("Setting param [" + String.valueOf(index) + "] of type [" + String.valueOf(type) + "] to: null"); pstmt.setNull(index, java.sql.Types.INTEGER); } break; case OUTPARAM_DATE: ((CallableStatement) pstmt).registerOutParameter(index, java.sql.Types.DATE); break; case OUTPARAM_INTEGER: ((CallableStatement) pstmt).registerOutParameter(index, java.sql.Types.INTEGER); break; case OUTPARAM_NUMBER: ((CallableStatement) pstmt).registerOutParameter(index, java.sql.Types.FLOAT); break; case OUTPARAM_VARCHAR: ((CallableStatement) pstmt).registerOutParameter(index, java.sql.Types.VARCHAR); break; default: // VARCHAR2 pstmt.setString(index, val); break; } } catch (SQLException e) { e.printStackTrace(); l.error(e.getMessage()); } }
From source file:org.auraframework.test.util.AuraUITestingUtil.java
/** * Evaluate the given javascript in the current window. Upon completion, if the framework has loaded and is in a * test mode, then assert that there are no uncaught javascript errors. * <p>/*from w w w .j a v a 2 s. c om*/ * As an implementation detail, we accomplish this by wrapping the given javascript so that we can perform the error * check on each evaluation without doing a round-trip to the browser (which might be long in cases of remote test * runs). * * @return the result of calling {@link JavascriptExecutor#executeScript(String, Object...) with the given * javascript and args. */ public Object getEval(final String javascript, Object... args) { /** * Wrapping the javascript on the native Android browser is broken. By not using the wrapper we won't catch any * javascript errors here, but on passing cases this should behave the same functionally. See W-1481593. */ if (driver instanceof RemoteWebDriver && "android".equals(((RemoteWebDriver) driver).getCapabilities().getBrowserName())) { return getRawEval(javascript, args); } /** * Wrap the given javascript to evaluate and then check for any collected errors. Then, return the result and * errors back to the WebDriver. We must return as an array because * {@link JavascriptExecutor#executeScript(String, Object...)} cannot handle Objects as return values." */ String escapedJavascript = StringEscapeUtils.escapeEcmaScript(javascript); String wrapper = "var ret,scriptExecException;\n" + "try {\n" + String.format("var func = new Function('arguments', \"%s\");\n", escapedJavascript) + " ret = func.call(this, arguments);\n" + "} catch(e){\n" + " scriptExecException = e.message || e.toString();\n" + "}\n" + "var jstesterrors = (window.$A && window.$A.test) ? window.$A.test.getErrors() : '';\n" + "return [ret, jstesterrors, scriptExecException];"; try { Object obj = getRawEval(wrapper, args); Assert.assertTrue( "Expecting an instance of list, but get " + obj + ", when running: " + escapedJavascript, obj instanceof List); @SuppressWarnings("unchecked") List<Object> wrapResult = (List<Object>) obj; Assert.assertEquals("Wrapped javsascript execution expects an array of exactly 3 elements", 3, wrapResult.size()); Object exception = wrapResult.get(2); Assert.assertNull( "Following JS Exception occured while evaluating provided script:\n" + exception + "\n" + "Arguments: (" + Arrays.toString(args) + ")\n" + "Script:\n" + javascript + "\n", exception); String errors = (String) wrapResult.get(1); assertJsTestErrors(errors); rerunCount = 0; return wrapResult.get(0); } catch (WebDriverException e) { // shouldn't come here that often as we are also wrapping the js // script being passed to us in try/catch above Assert.fail("Script execution failed.\n" + "Exception type: " + e.getClass().getName() + "\n" + "Failure Message: " + e.getMessage() + "\n" + "Arguments: (" + Arrays.toString(args) + ")\n" + "Script:\n" + javascript + "\n"); throw e; } catch (NullPointerException npe) { // Although it should never happen, ios-driver is occasionally returning null when trying to execute the // wrapped javascript. Re-run the script a couple more times before failing. if (++rerunCount > 2) { Assert.fail("Script execution failed.\n" + "Failure Message: " + npe.getMessage() + "\n" + "Arguments: (" + Arrays.toString(args) + ")\n" + "Script:\n" + javascript + "\n"); } return getEval(javascript, args); } }
From source file:de.mkrtchyan.recoverytools.RecoveryTools.java
public void optimizeLayout() throws NullPointerException { try {//from w w w. jav a2s . com if (mDevice.isRecoverySupported() || mDevice.isKernelSupported()) { /** If device is supported start setting up layout */ if (getIntent().getAction().equals(Intent.ACTION_VIEW)) { /** Setting layout for flashing over external App for example File Browser */ setContentView(R.layout.flash_as); RelativeLayout FlashAsLayout = (RelativeLayout) findViewById(R.layout.flash_as); String path; if ((path = getIntent().getData().getPath()) != null) { final File IMG = new File(path); if (IMG.exists()) { TextView tvFlashAs = (TextView) findViewById(R.id.tvFlashAs); tvFlashAs.setText(String.format(getString(R.string.flash_as), IMG.getName())); } else { exit(); } RadioButton optAsRecovery = (RadioButton) findViewById(R.id.optAsRecovery); RadioButton optAsKernel = (RadioButton) findViewById(R.id.optAsKernel); if (!mDevice.isRecoverySupported()) { FlashAsLayout.removeView(optAsRecovery); optAsKernel.setChecked(true); } if (!mDevice.isKernelSupported()) { FlashAsLayout.removeView((optAsKernel)); } } else { exit(); } } else { setContentView(R.layout.recovery_tools); mRecoveryToolsLayout = (DrawerLayout) findViewById(R.id.RecoveryToolsLayout); mSwipeUpdater = (SwipeRefreshLayout) findViewById(R.id.swipe_updater); mSwipeUpdater.setColorScheme(R.color.custom_green, android.R.color.black, R.color.custom_green, android.R.color.darker_gray); mSwipeUpdater.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { Downloader updater = new Downloader(mContext, "http://dslnexus.de/Android/", "img_sums", RecoveryCollectionFile, new Runnable() { @Override public void run() { mDevice = new Device(mContext); } }); updater.setOverrideFile(true); updater.setRetry(true); updater.setHidden(true); Toast.makeText(mContext, "Refreshing recovery list", Toast.LENGTH_SHORT).show(); updater.setAfterDownload(new Runnable() { @Override public void run() { mSwipeUpdater.setRefreshing(false); Toast.makeText(mContext, "Update finished", Toast.LENGTH_SHORT).show(); mDevice.loadRecoveryList(); } }); updater.execute(); } }); LayoutInflater layoutInflater = getLayoutInflater(); DrawerLayout mMenuDrawer = (DrawerLayout) layoutInflater.inflate(R.layout.menu_drawer, mRecoveryToolsLayout, true); DrawerLayout mBackupDrawer = (DrawerLayout) layoutInflater.inflate(R.layout.backup_drawer, mRecoveryToolsLayout, true); mRecoveryToolsLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(mActivity, mRecoveryToolsLayout, R.drawable.ic_drawer, R.string.settings, R.string.app_name); mRecoveryToolsLayout.setDrawerListener(mDrawerToggle); mDrawerToggle.syncState(); mDrawerToggle.setDrawerIndicatorEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); String Styles[] = getResources().getStringArray(R.array.styles); if (mMenuDrawer != null) { Spinner spStyle = (Spinner) mMenuDrawer.findViewById(R.id.spStyle); ArrayAdapter<String> adapter = new ArrayAdapter<String>(mActivity, R.layout.custom_list_item, Styles); adapter.setDropDownViewResource(R.layout.custom_list_item); spStyle.setAdapter(adapter); spStyle.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 1: Common.setIntegerPref(mContext, PREF_NAME, PREF_STYLE, APPCOMPAT_LIGHT_DARK_BAR); restartActivity(); break; case 2: Common.setIntegerPref(mContext, PREF_NAME, PREF_STYLE, APPCOMPAT_LIGHT); restartActivity(); break; case 3: Common.setIntegerPref(mContext, PREF_NAME, PREF_STYLE, APPCOMPAT_DARK); restartActivity(); break; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); CheckBox cbShowAds = (CheckBox) mMenuDrawer.findViewById(R.id.cbShowAds); CheckBox cbLog = (CheckBox) mMenuDrawer.findViewById(R.id.cbLog); cbShowAds.setChecked(Common.getBooleanPref(mContext, PREF_NAME, PREF_KEY_ADS)); cbLog.setChecked(Common.getBooleanPref(mContext, Shell.PREF_NAME, Shell.PREF_LOG)); if (cbLog.isChecked()) { findViewById(R.id.bShowLogs).setVisibility(View.VISIBLE); } else { findViewById(R.id.bShowLogs).setVisibility(View.INVISIBLE); } cbShowAds.setChecked(Common.getBooleanPref(mContext, PREF_NAME, PREF_KEY_ADS)); } final TextView RecoveryVersion = (TextView) findViewById(R.id.tvVersion); RecoveryVersion.setText(mDevice.getRecoveryVersion() + "\n" + mDevice.getKernelVersion()); loadBackupDrawer(); AdView adView = (AdView) findViewById(R.id.adView); ViewGroup MainParent = (ViewGroup) adView.getParent(); /** Removing ads if user has turned off */ if (!Common.getBooleanPref(mContext, PREF_NAME, PREF_KEY_ADS)) { if (adView != null && MainParent != null) { MainParent.removeView(adView); } } if (MainParent != null) { if (!mDevice.isKernelSupported()) { /** If Kernel flashing is not supported remove flash options */ MainParent.removeView(findViewById(R.id.bFlashKernel)); } if (!mDevice.isRecoverySupported()) { /** If Recovery flashing is not supported remove flash options */ MainParent.removeView(findViewById(R.id.bFlashRecovery)); } } if (mBackupDrawer != null) { ViewGroup BackupDrawerParent = (ViewGroup) mBackupDrawer.getParent(); if (mDevice.isRecoveryOverRecovery()) { BackupDrawerParent.removeView(mBackupDrawer); } else { View createKernelBackup = findViewById(R.id.bCreateKernelBackup); View kernelBackups = findViewById(R.id.lvKernelBackups); View createRecoveryBackup = findViewById(R.id.bCreateRecoveryBackup); View recoveryBackups = findViewById(R.id.lvRecoveryBackups); if (!mDevice.isKernelSupported()) { /** If Kernel flashing is not supported remove backup views */ ((ViewGroup) createKernelBackup.getParent()).removeView(createKernelBackup); ((ViewGroup) kernelBackups.getParent()).removeView(kernelBackups); } if (!mDevice.isRecoverySupported()) { /** If Recovery flashing is not supported remove backup views */ ((ViewGroup) createRecoveryBackup.getParent()).removeView(createRecoveryBackup); ((ViewGroup) recoveryBackups.getParent()).removeView(recoveryBackups); } } } } } } catch (NullPointerException e) { throw new NullPointerException("Error while setting up Layout " + e.getMessage()); } }
From source file:org.clipsmonitor.gui.MapGeneratorTopComponent.java
private void PreviewMapMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PreviewMapMouseClicked try {//from ww w.j av a2 s . com model.setSizeScreen(PreviewMap.getWidth(), PreviewMap.getHeight()); int x = evt.getX(); int y = evt.getY(); actualPosClicked = model.getCellPosition(x, y); if (MapButton.isSelected()) { ExecUpdateMap(); } else { if (model.findIndexPosByColor(state) != -1) { actualPath = model.getLastPathOfPerson(state); ExecUpdateMove(); } else { String[][] move; move = model.getTmpMoveMap(actualPosClicked[0], actualPosClicked[1], state); model.ApplyUpdateOnMoveMap(move); model.CopyToActive(model.getMove()); PreviewMap.repaint(); } } } catch (NullPointerException err) { model.error(err.getMessage()); } }
From source file:dentex.youtube.downloader.ShareActivity.java
private void tempDownloadToSdcard(Request request) { videoUri = Uri.parse(dir_Downloads.toURI() + composedVideoFilename); Utils.logger("d", "** NEW ** videoUri: " + videoUri, DEBUG_TAG); request.setDestinationUri(videoUri); try {//w w w . j a va2 s . c o m enqueue = dm.enqueue(request); } catch (IllegalArgumentException e) { // probably useless try/catch Log.e(DEBUG_TAG, "tempDownloadToSdcard: " + e.getMessage()); BugSenseHandler.sendExceptionMessage(DEBUG_TAG + "-> tempDownloadToSdcard", e.getMessage(), e); } catch (NullPointerException ne) { Log.e(DEBUG_TAG, "callDownloadApk: " + ne.getMessage()); BugSenseHandler.sendExceptionMessage(DEBUG_TAG + "-> callDownloadApk: ", ne.getMessage(), ne); Toast.makeText(this, getString(R.string.error), Toast.LENGTH_LONG).show(); } }
From source file:servlets.Analysis_servlets.java
private void getAnalysisImageHandler(HttpServletRequest request, HttpServletResponse response) throws IOException { String analysis_id = request.getParameter("analysis_id"); String experiment_id = request.getParameter("experimentID"); try {/*from w ww .j a v a 2 s. co m*/ File file = new File(DATA_LOCATION + IMAGE_FILES_LOCATION.replaceAll("<experiment_id>", experiment_id) + analysis_id + ".png"); if (file.exists()) { response.reset(); response.addHeader("Access-Control-Allow-Origin", "*"); response.setContentType("image/png"); response.addHeader("Content-Disposition", "attachment; filename=" + analysis_id + ".png"); response.setContentLength((int) file.length()); FileInputStream fileInputStream = new FileInputStream(file); OutputStream responseOutputStream = response.getOutputStream(); int bytes; while ((bytes = fileInputStream.read()) != -1) { responseOutputStream.write(bytes); } responseOutputStream.close(); } } catch (NullPointerException e) { ServerErrorManager.addErrorMessage(4, Analysis_servlets.class.getName(), "get_analysis_img_handler", e.getMessage()); response.setStatus(400); response.getWriter().print(ServerErrorManager.getErrorResponse()); } catch (Exception e) { ServerErrorManager.addErrorMessage(4, Analysis_servlets.class.getName(), "get_analysis_img_handler", e.getMessage()); response.setStatus(400); response.getWriter().print(ServerErrorManager.getErrorResponse()); } }
From source file:com.becapps.easydownloader.ShareActivity.java
private void tempDownloadToSdcard(Request request) { videoUri = Uri.parse(dir_Downloads.toURI() + composedVideoFilename); Utils.logger("d", "** NEW ** videoUri: " + videoUri, DEBUG_TAG); request.setDestinationUri(videoUri); try {/*from w ww.j a v a2 s . c o m*/ enqueue = dm.enqueue(request); } catch (IllegalArgumentException e) { Log.e(DEBUG_TAG, "tempDownloadToSdcard: " + e.getMessage()); BugSenseHandler.sendExceptionMessage(DEBUG_TAG + "-> tempDownloadToSdcard", e.getMessage(), e); } catch (NullPointerException ne) { Log.e(DEBUG_TAG, "callDownloadApk: " + ne.getMessage()); BugSenseHandler.sendExceptionMessage(DEBUG_TAG + "-> tempDownloadToSdcard: ", ne.getMessage(), ne); Toast.makeText(this, getString(R.string.error), Toast.LENGTH_LONG).show(); } catch (SecurityException se) { Log.e(DEBUG_TAG, "callDownloadApk: " + se.getMessage()); BugSenseHandler.sendExceptionMessage(DEBUG_TAG + "-> tempDownloadToSdcard: ", se.getMessage(), se); Toast.makeText(this, getString(R.string.error), Toast.LENGTH_LONG).show(); } }
From source file:servlets.Analysis_servlets.java
private void getAnalysisPreviewImageHandler(HttpServletRequest request, HttpServletResponse response) throws IOException { String analysisID = request.getParameter("analysis_id"); String experiment_id = request.getParameter("experimentID"); try {// w ww .j a v a2 s .c o m File file = new File(DATA_LOCATION + IMAGE_FILES_LOCATION.replaceAll("<experiment_id>", experiment_id) + analysisID + "_prev.jpg"); if (file.exists()) { response.reset(); response.addHeader("Access-Control-Allow-Origin", "*"); response.setContentType("image/jpeg"); response.addHeader("Content-Disposition", "attachment; filename=" + analysisID + "_prev.jpg"); response.setContentLength((int) file.length()); FileInputStream fileInputStream = new FileInputStream(file); OutputStream responseOutputStream = response.getOutputStream(); int bytes; while ((bytes = fileInputStream.read()) != -1) { responseOutputStream.write(bytes); } responseOutputStream.close(); } } catch (NullPointerException e) { ServerErrorManager.addErrorMessage(4, Analysis_servlets.class.getName(), "get_analysis_img_prev_handler", e.getMessage()); response.setStatus(400); response.getWriter().print(ServerErrorManager.getErrorResponse()); } catch (Exception e) { ServerErrorManager.addErrorMessage(4, Analysis_servlets.class.getName(), "get_analysis_img_prev_handler", e.getMessage()); response.setStatus(400); response.getWriter().print(ServerErrorManager.getErrorResponse()); } }
From source file:com.chiorichan.plugin.PluginDescriptionFile.java
private void loadMap(Map<?, ?> map) throws InvalidDescriptionException { try {//from ww w .j a v a2 s . com name = map.get("name").toString(); if (!name.matches("^[A-Za-z0-9 _.-]+$")) { throw new InvalidDescriptionException("name '" + name + "' contains invalid characters."); } } catch (NullPointerException ex) { throw new InvalidDescriptionException(ex, "name is not defined"); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "name is of wrong type"); } try { version = map.get("version").toString(); } catch (NullPointerException ex) { throw new InvalidDescriptionException(ex, "version is not defined"); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "version is of wrong type"); } try { main = map.get("main").toString(); if (main.startsWith("com.chiori") && !main.startsWith("com.chiorichan.plugin")) throw new InvalidDescriptionException("main may not be within the com.chiori namespace"); } catch (NullPointerException ex) { throw new InvalidDescriptionException(ex, "main is not defined"); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "main is of wrong type"); } if (map.get("class-loader-of") != null) { classLoaderOf = map.get("class-loader-of").toString(); } if (map.get("depend") != null) { ImmutableList.Builder<String> dependBuilder = ImmutableList.<String>builder(); try { for (Object dependency : (Iterable<?>) map.get("depend")) { dependBuilder.add(dependency.toString()); } } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "depend is of wrong type"); } catch (NullPointerException e) { throw new InvalidDescriptionException(e, "invalid dependency format"); } depend = dependBuilder.build(); } if (map.get("libraries") != null) { ImmutableList.Builder<MavenLibrary> libraryBuilder = ImmutableList.<MavenLibrary>builder(); try { for (Object library : (Iterable<?>) map.get("libraries")) { try { libraryBuilder.add(new MavenLibrary(library.toString())); } catch (IllegalAccessException e) { Loader.getLogger().severe("Could not parse the library '" + library.toString() + "' for plugin '" + name + "', it will be ignored:"); Loader.getLogger().severe(e.getMessage()); } } } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "library is of wrong type"); } catch (NullPointerException e) { throw new InvalidDescriptionException(e, "invalid library format"); } libraries = libraryBuilder.build(); } if (map.get("softdepend") != null) { ImmutableList.Builder<String> softDependBuilder = ImmutableList.<String>builder(); try { for (Object dependency : (Iterable<?>) map.get("softdepend")) { softDependBuilder.add(dependency.toString()); } } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "softdepend is of wrong type"); } catch (NullPointerException ex) { throw new InvalidDescriptionException(ex, "invalid soft-dependency format"); } softDepend = softDependBuilder.build(); } if (map.get("loadbefore") != null) { ImmutableList.Builder<String> loadBeforeBuilder = ImmutableList.<String>builder(); try { for (Object predependency : (Iterable<?>) map.get("loadbefore")) { loadBeforeBuilder.add(predependency.toString()); } } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "loadbefore is of wrong type"); } catch (NullPointerException ex) { throw new InvalidDescriptionException(ex, "invalid load-before format"); } loadBefore = loadBeforeBuilder.build(); } if (map.get("website") != null) { website = map.get("website").toString(); } if (map.get("description") != null) { description = map.get("description").toString(); } if (map.get("load") != null) { try { order = RunLevel.valueOf(((String) map.get("load")).toUpperCase().replaceAll("\\W", "")); } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "load is of wrong type"); } catch (IllegalArgumentException ex) { throw new InvalidDescriptionException(ex, "load is not a valid choice"); } } if (map.get("authors") != null) { ImmutableList.Builder<String> authorsBuilder = ImmutableList.<String>builder(); if (map.get("author") != null) { authorsBuilder.add(map.get("author").toString()); } try { for (Object o : (Iterable<?>) map.get("authors")) { authorsBuilder.add(o.toString()); } } catch (ClassCastException ex) { throw new InvalidDescriptionException(ex, "authors are of wrong type"); } catch (NullPointerException ex) { throw new InvalidDescriptionException(ex, "authors are improperly defined"); } authors = authorsBuilder.build(); } else if (map.get("author") != null) { authors = ImmutableList.of(map.get("author").toString()); } else { authors = ImmutableList.<String>of(); } if (map.get("prefix") != null) { prefix = map.get("prefix").toString(); } }