List of usage examples for java.lang String contentEquals
public boolean contentEquals(CharSequence cs)
From source file:hudson.plugins.ansicolor.AnsiColorNote.java
/** * Annotate output that contains ANSI codes and hide raw text. *///from www.j av a2 s . co m @Override public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) { try { String colorizedData = colorize(StringEscapeUtils.escapeHtml(this.data), this.getColorMap()); if (!colorizedData.contentEquals(this.data)) { text.addMarkup(charPos, colorizedData); text.addMarkup(charPos, charPos + text.getText().length(), "<span style=\"display: none;\">", "</span>"); } } catch (Exception e) { LOG.log(Level.WARNING, "Failed to add markup to \"" + text + "\"", e); } return null; }
From source file:cl.ipp.katbag.fragment.PlayerBook.java
public void playSound(String identifier) { if (!identifier.contentEquals("")) { int sound = mainActivity.getResources().getIdentifier(identifier, "raw", mainActivity.getPackageName()); stopPlayer();/*from ww w . jav a 2 s. c om*/ mPlayer = MediaPlayer.create(mainActivity.context, sound); mPlayer.start(); } }
From source file:org.apache.hadoop.mapred.TestTaskEnvironment.java
@Test public void testTaskEnv() throws Throwable { ttConf.set("mapreduce.admin.user.shell", "/bin/testshell"); ttConf.set("mapreduce.admin.user.env", "key1=value1,key2=value2"); ttConf.set("mapred.child.env", "ROOT=$HOME"); final Map<String, String> env = new HashMap<String, String>(); String user = "test"; JobConf taskConf = new JobConf(ttConf); TaskAttemptID attemptID = new TaskAttemptID("test", 0, true, 0, 0); Task task = new MapTask(null, attemptID, 0, null, MAP_SLOTS); task.setConf(taskConf);//ww w. ja v a 2 s .co m TaskInProgress tip = tt.new TaskInProgress(task, taskConf); RunningJob rjob = new RunningJob(attemptID.getJobID()); TaskController taskController = new DefaultTaskController(); taskController.setConf(ttConf); rjob.distCacheMgr = new TrackerDistributedCacheManager(ttConf, taskController) .newTaskDistributedCacheManager(attemptID.getJobID(), taskConf); final TaskRunner taskRunner = task.createRunner(tt, tip, rjob); String errorInfo = "Child error"; String mapredChildEnv = taskRunner.getChildEnv(taskConf); taskRunner.updateUserLoginEnv(errorInfo, user, taskConf, env); taskRunner.setEnvFromInputString(errorInfo, env, mapredChildEnv); final Vector<String> vargs = new Vector<String>(1); File pidFile = new File(TEST_DIR, "pid"); vargs.add(writeScript("ENV", "/bin/env ", pidFile).getAbsolutePath()); final File workDir = new File(TEST_DIR, "work"); workDir.mkdir(); final File stdout = new File(TEST_DIR, "stdout"); final File stderr = new File(TEST_DIR, "stderr"); Map<String, String> jvmenvmap = env; String javaOpts = taskRunner.getChildJavaOpts(ttConf, JobConf.MAPRED_MAP_TASK_JAVA_OPTS); assertTrue(jvmenvmap.containsKey("SHELL")); assertTrue(jvmenvmap.containsValue("/bin/testshell")); assertTrue(jvmenvmap.containsKey("key2")); assertTrue(jvmenvmap.containsValue("value2")); assertTrue(javaOpts, javaOpts.contains("Xmx")); assertTrue(javaOpts, javaOpts.contains("IPv4")); String root = jvmenvmap.get("ROOT"); assertTrue(root, root.contentEquals(System.getenv("HOME"))); }
From source file:com.microsoft.office.sfb.healthcare.SkypeCall.java
/** * Invoked from SkypeCallFragment when inflated. Provides the TextureView for preview to the * SkypeManagerImpl// w ww .j a va 2 s .c o m * * @param callView * @param newMeetingURI */ @Override public void onFragmentInteraction(View callView, String newMeetingURI) { try { if (newMeetingURI.contentEquals(getString(R.string.callFragmentInflated))) { return; } if (newMeetingURI.contentEquals(getString(R.string.leaveCall))) { getSupportFragmentManager().popBackStack(VIDEO_FRAGMENT_STACK_STATE, FragmentManager.POP_BACK_STACK_INCLUSIVE); finish(); } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:org.silverpeas.core.contribution.model.WysiwygContent.java
/** * Modifies the text of this content. The content is effectively modified only if the specified * text is different to the actual one; in such a case, the content is marked as modified and * is then elective for the next storage update. * @param richTest the new text to set. If null then an empty text is set. *//*ww w. j a va 2 s . c om*/ public void setData(final String richTest) { String newText = richTest == null ? "" : richTest; if (!newText.contentEquals(this.text)) { this.text = newText; this.modified = true; } }
From source file:com.nadmm.airports.utils.SectionedCursorAdapter.java
private void setSections() { Cursor c = getCursor();//w ww. j a va2 s .c o m if (c.moveToFirst()) { ArrayList<Section> sections = new ArrayList<Section>(); String last = ""; int offset = 0; // offset positions for the headers we're adding do { String cur = getSectionName(); if (!cur.contentEquals(last)) { Section section = new Section(c.getPosition(), cur); section.sectionedPosition = section.firstPosition + offset; mSections.append(section.sectionedPosition, section); ++offset; last = cur; } } while (c.moveToNext()); } }
From source file:org.londonsburning.proxy.ProxyPrinter.java
/** * @param flagParserParam flagParser/*from w ww .ja v a 2 s . c om*/ */ public final void printProxies(final FlagParser flagParserParam) { for (String arg : flagParserParam.getFlags()) { if (!arg.contentEquals(flagParserParam.getSkipBasicLandsFlag())) { File file = new File(arg); Deck deck = new Deck(file); deck.parse(); File htmlFile = new File(arg.replace(".dec", ".html")); generateHtml(deck, htmlFile, flagParserParam.isSkipBasicLands()); logger.info("Output file: " + htmlFile.getName()); } } }
From source file:com.moodmap.HomeActivity.java
static public int getLocationTypeFromString(String locationStr) { int locationType = Constants.kUnknownLocation; if (locationStr.contentEquals(Constants.kOtherLocationStr)) { locationType = Constants.kOtherLocation; } else if (locationStr.contentEquals(Constants.kHomeLocationStr)) { locationType = Constants.kHomeLocation; } else if (locationStr.contentEquals(Constants.kWorkLocationStr)) { locationType = Constants.kWorkLocation; } else if (locationStr.contentEquals(Constants.kOnTheGoLocationStr)) { locationType = Constants.kOnTheGoLocation; }// w w w . j a v a 2 s .co m return (locationType); }
From source file:com.company.millenium.iwannask.RegistrationIntentService.java
/** * Persist registration to third-party servers. * * Modify this method to associate the user's GCM registration token with any server-side account * maintained by your application.//from w w w. ja v a 2 s.c om * * @param token The new token. */ private void sendRegistrationToServer(String token) { // Add custom implementation, as needed. try { // Prepare JSON containing the GCM message content. What to send and where to send. JSONObject jGcmData = new JSONObject(); // What to send in GCM message. jGcmData.put("token", token); String session = getCookie(Constants.SERVER_URL, "session"); // Create connection to send GCM Message request. URL url = new URL(Constants.SERVER_URL + "/register_token"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("Content-Type", "application/json"); if (session == null) { // we couldn't get a cookie, try later throw new NoCookieException(); } conn.setRequestProperty("Cookie", "session=" + session); conn.setRequestMethod("POST"); conn.setDoOutput(true); // Send GCM message content. OutputStream outputStream = conn.getOutputStream(); outputStream.write(jGcmData.toString().getBytes()); // Read GCM response. InputStream inputStream = conn.getInputStream(); String resp = inputStream.toString(); if (resp.contentEquals("success")) { } //String resp1 = IOUtils.toString(inputStream); } catch (NoCookieException e) { System.out.println("Unable to get the session cookie"); e.printStackTrace(); } catch (IOException e) { System.out.println("Unable to send GCM message."); System.out.println("Please ensure that API_KEY has been replaced by the server " + "API key, and that the device's registration token is correct (if specified)."); e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } }
From source file:org.addhen.smssync.net.SyncScheme.java
public SyncScheme(String json) { try {/*from w w w . j a v a 2 s.co m*/ if (!json.contentEquals("")) { init(json); } else { throw new Exception("Empty scheme spec, loading default"); } } catch (Exception ex) { Logger.log(SyncScheme.class.getSimpleName(), ex.getMessage()); //Init default init(SyncMethod.POST, SyncDataFormat.URLEncoded, "secret", "from", "message", "message_id", "sent_timestamp", "sent_to", "device_id"); } }