Load of Known null Value

BigPun

Mitglied
Java:
protected Http createHttp() {
                String proxyHost = null;
                Integer proxyPort = null;

		Http conf = new Http ();
	
		conf.setProxyHostname(proxyHost);
		conf.setProxyPort(proxyPort);

		return conf;

	}

Hi, brauch wieder Hilfe. Vielleicht kann mir einer diesen Bug erklären?!

Danke ^^
 
Was soll man da sagen? Wohin genau soll sich dein
Code:
Http
verbinden, wenn du [c]null[/c] als Adresse und Port angibst? Setze doch mal hübsche Strings wie "http://www.google.com" und "80" ein...
 
die Fehlermeldung
NP: Load of known null value (NP_LOAD_OF_KNOWN_NULL_VALUE)

The variable referenced at this point is known to be null due to an earlier check against null. Although this is valid, it might be a mistake (perhaps you intended to refer to a different variable, or perhaps the earlier check to see if the variable is null should have been a check to see if it was nonnull).
beschwert sich sicherlich vor allem technisch, dass du unnötige lokale Variablen mit null anlegst,
wenn sie immer null sind, dann brauchst du doch gar keine Variablen, übergib null als Wert?

falls später noch anderer Code reinkommt oder so, muss die Warnung in der Tat einfach ignoriert werden an dieser Stelle
 
Load of Known null Value in Zeile 7 und 8 bzw.

Code:
conf.setProxyHostname(proxyHost);
        conf.setProxyPort(proxyPort);
 
Hab ich immer noch nicht verstanden. Warum denkst Du es sei ein Bug, null an einen setter zu übergeben?
 

Zurück
Oben