package com.google.sps.agents;
 
// Imports the Google Cloud client library
import com.google.cloud.dialogflow.v2.QueryInput;
import com.google.cloud.dialogflow.v2.QueryResult;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import com.google.sps.agents.Agent;
import com.google.sps.data.Location;
import com.google.sps.data.Output;
import com.google.sps.utils.LocationUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
 
/**
 * Weather Agent
 */
public class Weather implements Agent {
    private final String intentName;
    private String displayAddress;
    private String searchAddress;
    private String output = null;
    private String redirect = null;
    
    public Weather(String intentName, Map<String, Value> parameters) {
        this.intentName = intentName;
        try {
            setParameters(parameters);
        } catch (Exception e) {
            return;
        }
    }

	@Override 
	public void setParameters(Map<String, Value> parameters) {
        this.displayAddress = LocationUtils.getDisplayAddress("address", parameters);
        this.searchAddress = LocationUtils.getFormattedAddress("address", parameters);
        if (!displayAddress.isEmpty() && !searchAddress.isEmpty()){
            String baseURL = "http://www.google.com/search?q=weather+in+";
		    String[] individualWords = searchAddress.split(" ");
            String endURL = String.join("+", individualWords);
            this.redirect = baseURL + endURL;
            this.output = "Redirecting you to the current forecast in " + displayAddress + ".";
        }
    }
	
	@Override
	public String getOutput() {
        return this.output;
	}

	@Override
	public String getDisplay() {
		return null;
	}

	@Override
	public String getRedirect() {
		return this.redirect;
    }
}

@@ -679,44 +679,8 @@
 ll;%0A
-    private String redirect = null;%0A
     
@@ -1299,18 +1299,24 @@
 r+in+%22;%0A
-%09%09
+        
     Stri
@@ -1770,29 +1770,20 @@
 %09return 
-this.redirect
+null
 ;%0A    %7D%0A

Fix redirect return to null