Projects >> UniversalMediaServer >>4bef6b658058a560adffe530f6ea28d82e674d47

Chunk
Conflicting content
				}
			}
		});
<<<<<<< HEAD
		
		frame.setStatusCode(0, Messages.getString("PMS.130"), "connect_no-220.png");
=======

		frame.setStatusCode(0, Messages.getString("PMS.130"), "icon-status-connecting.png");
>>>>>>> f92651de9b6709e9d22b840a835c6502eafffbcc
		proxy = -1;

		LOGGER.info("Starting " + PropertiesUtil.getProjectProperties().get("project.name") + " " + getVersion());
Solution content
				}
			}
		});
		
		frame.setStatusCode(0, Messages.getString("PMS.130"), "icon-status-connecting.png");
		proxy = -1;

		LOGGER.info("Starting " + PropertiesUtil.getProjectProperties().get("project.name") + " " + getVersion());
File
PMS.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
	// and 1 shared folder), so log it by default so we can fix it.
	// BUT it's also called when the GUI is initialized (to populate the list of shared folders),
	// and we don't want this message to appear *before* the PMS banner, so allow that call to suppress logging	
<<<<<<< HEAD
	public File[] getFoldersConf(String tag, boolean log) {
		String folders = getConfiguration().getFolders(tag);
=======
	public File[] getFoldersConf(boolean log) {
		String folders = getConfiguration().getFolders();

>>>>>>> f92651de9b6709e9d22b840a835c6502eafffbcc
		if (folders == null || folders.length() == 0) {
			return null;
		}
Solution content
	// and 1 shared folder), so log it by default so we can fix it.
	// BUT it's also called when the GUI is initialized (to populate the list of shared folders),
	// and we don't want this message to appear *before* the PMS banner, so allow that call to suppress logging	
	public File[] getFoldersConf(String tag, boolean log) {
		String folders = getConfiguration().getFolders(tag);

		if (folders == null || folders.length() == 0) {
			return null;
		}
File
PMS.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Method signature
Variable
Chunk
Conflicting content
	public void registerPlayer(Player player) {
		PlayerFactory.registerPlayer(player);
	}
<<<<<<< HEAD
	
	private RemoteWeb web;
=======

	/*
	 * Check if UMS is running in headless (console) mode, since some Linux
	 * distros seem to not use java.awt.GraphicsEnvironment.isHeadless() properly
	 */
	public static boolean isHeadless() {
		try {
			javax.swing.JDialog d = new javax.swing.JDialog();
			d.dispose();
			return false;
		} catch (java.lang.NoClassDefFoundError e) {
			return true;
		} catch (java.awt.HeadlessException e) {
			return true;
		} catch (java.lang.InternalError e) {
			return true;
		}
	}
>>>>>>> f92651de9b6709e9d22b840a835c6502eafffbcc
}
Solution content
	public void registerPlayer(Player player) {
		PlayerFactory.registerPlayer(player);
	}

	/*
	 * Check if UMS is running in headless (console) mode, since some Linux
	 * distros seem to not use java.awt.GraphicsEnvironment.isHeadless() properly
	 */
	public static boolean isHeadless() {
		try {
			javax.swing.JDialog d = new javax.swing.JDialog();
			d.dispose();
			return false;
		} catch (java.lang.NoClassDefFoundError e) {
			return true;
		} catch (java.awt.HeadlessException e) {
			return true;
		} catch (java.lang.InternalError e) {
			return true;
		}
	}
	
	private RemoteWeb web;
}
File
PMS.java
Developer's decision
Concatenation
Kind of conflict
Attribute
Comment
Method declaration
Chunk
Conflicting content
		return true;
	}
<<<<<<< HEAD
	
	///////////////////////////////////////////////////////////
	// Web stuff
	///////////////////////////////////////////////////////////
	
	private static final String KEY_NO_FOLDERS="no_shared";
    
    public String getFolders(String tag) {
    	if(tag == null) {
    		return getFolders();
    	}
    	String x=(tag.toLowerCase()+".folders").replaceAll(" ", "_");
    	String res=getString(x, "");
    	if(StringUtils.isEmpty(res)) {
    		return getFolders();
    	}
    	return res;
    }
    
    public String getVirtualFolders(String tag) {
    	if(tag == null) {
    		return getVirtualFolders();
    	}
    	String x=(tag.toLowerCase()+".vfolders").replaceAll(" ", "_");
    	String res=getString(x, "");
    	if(StringUtils.isEmpty(res)) {
    		return getVirtualFolders();
    	}
    	return res;
    }
    
    public boolean getNoFolders(String tag) {
    	if(tag == null) {
    		return getBoolean(KEY_NO_FOLDERS,false);
    	}
    	String x=(tag.toLowerCase()+".no_shared").replaceAll(" ", "_");
    	return getBoolean(x,false);
    }
    
    public String[] getPlugins(String tag) {
    	if(tag == null) {
    		return null;
    	}
    	String x=(tag.toLowerCase()+".plugins").replaceAll(" ", "_");
    	String str=getString(x,"");
    	if(StringUtils.isEmpty(str)) {
    		return null;
    	}
    	return str.split(",");
    }
=======

	/* Start without external netowrk (increase startup speed) */
	public static final String KEY_EXTERNAL_NETWORK = "external_network";

	public boolean getExternalNetwork() {
		return getBoolean(KEY_EXTERNAL_NETWORK, true);
	}

	public void setExternalNetwork(boolean b) {
		configuration.setProperty(KEY_EXTERNAL_NETWORK, b);
	}

	/* Credential path handling */
	public static final String KEY_CRED_PATH = "cred.path";

	public void initCred() throws IOException {
		String cp = getCredPath();
		if (StringUtils.isEmpty(cp)) {
			// need to make sure we got a cred path here
			cp = new File(getProfileDirectory() + File.separator + "UMS.cred").getAbsolutePath();
			configuration.setProperty(KEY_CRED_PATH, cp);
			try {
				configuration.save();
			} catch (ConfigurationException e) {
			}
		}

		// Now we know cred path is set
		File f = new File(cp);
		if (!f.exists()) {
			// cred path is set but file isn't there
			// create empty file with some comments
			FileOutputStream fos = new FileOutputStream(f);
			StringBuilder sb = new StringBuilder();
			sb.append("# Add credentials to the file");
			sb.append("\n");
			sb.append("# on the format tag=user,pwd");
			sb.append("\n");
			sb.append("# For example:");
			sb.append("\n");
			sb.append("# channels.xxx=name,secret");
			sb.append("\n");
			fos.write(sb.toString().getBytes());
			fos.flush();
			fos.close();
		}
	}

	public String getCredPath() {
		return getString(KEY_CRED_PATH, "");
	}

	public File getCredFile() {
		return new File(getCredPath());
	}

	public int getATZLimit() {
		int tmp = getInt(KEY_ATZ_LIMIT, 10000);
		if (tmp <= 2) {
			// this is silly, ignore
			tmp = 10000;
		}
		return tmp;
	}

	public void setATZLimit(int val) {
		if (val <= 2) {
			// clear prop
			configuration.clearProperty(KEY_ATZ_LIMIT);
			return;
		}
		configuration.setProperty(KEY_ATZ_LIMIT, val);
	}

	public void setATZLimit(String str) {
		try {
			setATZLimit(Integer.parseInt(str));
		} catch (Exception e) {
			setATZLimit(0);
		}
	}

	private String KEY_DATA_DIR = "data_dir_path";

	public String getDataDir() {
		return getString(KEY_DATA_DIR, "data");
	}

	public String getDataFile(String str) {
		return getDataDir() + File.separator + str;
	}
>>>>>>> f92651de9b6709e9d22b840a835c6502eafffbcc
}
Solution content
		configuration.setProperty(KEY_ATZ_LIMIT, val);

		return true;
	}

	/* Start without external netowrk (increase startup speed) */
	public static final String KEY_EXTERNAL_NETWORK = "external_network";

	public boolean getExternalNetwork() {
		return getBoolean(KEY_EXTERNAL_NETWORK, true);
	}

	public void setExternalNetwork(boolean b) {
		configuration.setProperty(KEY_EXTERNAL_NETWORK, b);
	}

	/* Credential path handling */
	public static final String KEY_CRED_PATH = "cred.path";

	public void initCred() throws IOException {
		String cp = getCredPath();
		if (StringUtils.isEmpty(cp)) {
			// need to make sure we got a cred path here
    	}
			cp = new File(getProfileDirectory() + File.separator + "UMS.cred").getAbsolutePath();
			configuration.setProperty(KEY_CRED_PATH, cp);
			try {
				configuration.save();
			} catch (ConfigurationException e) {
			}
		}

		// Now we know cred path is set
		File f = new File(cp);
		if (!f.exists()) {
			// cred path is set but file isn't there
			// create empty file with some comments
			FileOutputStream fos = new FileOutputStream(f);
			StringBuilder sb = new StringBuilder();
			sb.append("# Add credentials to the file");
			sb.append("\n");
			sb.append("# on the format tag=user,pwd");
			sb.append("\n");
			sb.append("# For example:");
			sb.append("\n");
			sb.append("# channels.xxx=name,secret");
			sb.append("\n");
			fos.write(sb.toString().getBytes());
			fos.flush();
			fos.close();
		}
	}

	public String getCredPath() {
		return getString(KEY_CRED_PATH, "");
	}

	public File getCredFile() {
		return new File(getCredPath());
	}

	public int getATZLimit() {
		int tmp = getInt(KEY_ATZ_LIMIT, 10000);
		if (tmp <= 2) {
			// this is silly, ignore
			tmp = 10000;
		}
		return tmp;
	}

	public void setATZLimit(int val) {
		if (val <= 2) {
			// clear prop
			configuration.clearProperty(KEY_ATZ_LIMIT);
			return;
		}
	}

	public void setATZLimit(String str) {
		try {
			setATZLimit(Integer.parseInt(str));
		} catch (Exception e) {
			setATZLimit(0);
		}
	}

	private String KEY_DATA_DIR = "data_dir_path";

	public String getDataDir() {
		return getString(KEY_DATA_DIR, "data");
	}

	public String getDataFile(String str) {
		return getDataDir() + File.separator + str;
	}
	
	///////////////////////////////////////////////////////////
	// Web stuff
	///////////////////////////////////////////////////////////
	
	private static final String KEY_NO_FOLDERS="no_shared";
    
    public String getFolders(String tag) {
    	if(tag == null) {
    		return getFolders();
    	}
    	String x=(tag.toLowerCase()+".folders").replaceAll(" ", "_");
    	String res=getString(x, "");
    	if(StringUtils.isEmpty(res)) {
    		return getFolders();
    	}
    	return res;
    }
    
    public String getVirtualFolders(String tag) {
    	if(tag == null) {
    		return getVirtualFolders();
    	}
    	String x=(tag.toLowerCase()+".vfolders").replaceAll(" ", "_");
    	String res=getString(x, "");
    	if(StringUtils.isEmpty(res)) {
    		return getVirtualFolders();
    	}
    	return res;
    }
    
    public boolean getNoFolders(String tag) {
    	if(tag == null) {
    		return getBoolean(KEY_NO_FOLDERS,false);
    	}
    	String x=(tag.toLowerCase()+".no_shared").replaceAll(" ", "_");
    	return getBoolean(x,false);
    }
    
    public String[] getPlugins(String tag) {
    	if(tag == null) {
    		return null;
    	String x=(tag.toLowerCase()+".plugins").replaceAll(" ", "_");
    	String str=getString(x,"");
    	if(StringUtils.isEmpty(str)) {
    		return null;
    	}
    	return str.split(",");
    }
}
File
PmsConfiguration.java
Developer's decision
Concatenation
Kind of conflict
Attribute
Comment
Method declaration