Revision 0099339a src/gr/grnet/pithos/web/client/FilePropertiesDialog.java

b/src/gr/grnet/pithos/web/client/FilePropertiesDialog.java
112 112
		final Button ok = new Button("OK", new ClickHandler() {
113 113
			@Override
114 114
			public void onClick(ClickEvent event) {
115
				accept();
116
				closeDialog();
115
				if (accept())
116
					closeDialog();
117 117
			}
118 118
		});
119 119
		ok.addStyleName("button");
......
226 226
	 *
227 227
	 */
228 228
	@Override
229
	protected void accept() {
229
	protected boolean accept() {
230 230
		String newFilename = null;
231 231

  
232 232
		if (!name.getText().trim().equals(file.getName())) {
233 233
			newFilename = name.getText().trim();
234
			if (newFilename.length() == 0)
235
				newFilename = null;
234 236
		}
237
		
235 238

  
236 239
        final Map<String, String> newMeta = new HashMap<String, String>();
237 240
        for (int row = 1; row < metaTable.getRowCount(); row++) {
......
239 242
        	String value = ((TextBox) metaTable.getWidget(row, 1)).getText().trim();
240 243
        	if (key.length() > 0 && value.length() > 0)
241 244
        		newMeta.put(key, value);
245
        	else if ((key.length() > 0 && value.length() == 0) || (key.length() == 0 && value.length() > 0)) {
246
        		app.displayError("You have empty keys or values");
247
        		return false;
248
        	}
242 249
        }
243 250

  
244 251
        if (newFilename != null) {
......
296 303
        }
297 304
        else
298 305
            updateMetaData(app.getApiPath(), app.getUsername(), file.getUri() + "?update=", newMeta);
306
        return true;
299 307
	}
300 308

  
301 309
	protected void updateMetaData(String api, String owner, String path, Map<String, String> newMeta) {

Also available in: Unified diff