Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9306653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:13:14+00:00 2026-06-19T00:13:14+00:00

I do a Action on Middle ware and if its success i get the

  • 0

I do a Action on Middle ware and if its success i get the Value as

String result = ["RESULT","DELETE","OK"]

And in Case if the Operation is Failed i get the resposne as

String result = ["RESULT","DELETE","ERROR"]

I need to know if the Operation is success Or Fail so for this i have done this

public class Test {

    public static void main(String args[]) {

        String result = "[\"RESULT\",\"DELETE\",\"ERROR\"]";

        if (!result.contains("ERROR")) {
            System.out.println("success");
        } else {
            System.out.println("Failed");
        }

    }

This is working fine , but not sure if this has any negative impact / or in cases the code may Fail .

Please suggest if there is a better approach .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T00:13:15+00:00Added an answer on June 19, 2026 at 12:13 am

    Your code can fail if, for instance, you get a success message containing ERROR (not likely, but can happen).

    You should use a library to parse the result into a List/Array, look here on StackOverflow for a ton of solutions for parsing Json Strings to Objects in Java (Jackson is a library to do this, for instance).

    You should also validate against a pre-set number of hypothesis, for instance, creating an enum for the possible result types, and checking if it’s one of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a action result method i would like to run. How can i
I get this error about my routes file SystemStackError (stack level too deep): actionpack
I have uploaded my project to heroku, but I get this error: NoMethodError in
I'm new to Django and I'm still trying to get to grips with its
I get this error when I run 'rails g' (my app seems to run
When I refresh the page I get this error message: ActionController::RoutingError (No route matches
Any ideas on how to get rid of this error. Started GET /favicon.ico for
I only get this error in Development Environtment after editing some code (any code)
I get this error in the browser when I attempt to view localhost:3000/galleries Routing
The action I'm repeating over and over is transplanting my changes from default to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.