Merge lp:~tomdroid-dev/tomdroid/check-for-linebreak into lp:~tomdroid-maintainers/tomdroid/main

Proposed by Stefan Hammer
Status: Merged
Merged at revision: 286
Proposed branch: lp:~tomdroid-dev/tomdroid/check-for-linebreak
Merge into: lp:~tomdroid-maintainers/tomdroid/main
Diff against target: 92 lines (+16/-7)
4 files modified
NEWS (+1/-0)
res/values/strings.xml (+1/-1)
res/xml/preferences.xml (+4/-2)
src/org/tomdroid/ui/PreferencesActivity.java (+10/-4)
To merge this branch: bzr merge lp:~tomdroid-dev/tomdroid/check-for-linebreak
Reviewer Review Type Date Requested Status
Olivier Bilodeau Approve
Review via email: mp+100330@code.launchpad.net

Description of the change

To post a comment you must log in.
287. By Stefan Hammer

modified NEWS entry to save Olivier some work :-)

288. By Stefan Hammer

adding singleline=true is a better fix. Further, checking for tabs and spaces also avoids crashing

289. By Stefan Hammer

wicht copy/paste linebreaks could also go in... it is more save to also check for them. Now I am really done.

Revision history for this message
Olivier Bilodeau (plaxx) wrote :

merge!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2012-03-31 22:07:31 +0000
3+++ NEWS 2012-04-01 13:30:25 +0000
4@@ -13,6 +13,7 @@
5
6 -------------------------------------------------------------------------------
7 Versoin 0.?? released on ??
8+* Fix crash when authenticating a server URL that includes newline (Stefan Hammer, lp:902855)
9 * Can specify folder for SD Card Sync (ie: dropbox) (Stefan Hammer, lp:837119)
10 * Creating home-screen shortcuts to notes is now possible (Piotr Adamski,
11 lp:882703)
12
13=== modified file 'res/values/strings.xml'
14--- res/values/strings.xml 2012-03-31 21:13:15 +0000
15+++ res/values/strings.xml 2012-04-01 13:30:25 +0000
16@@ -57,7 +57,7 @@
17 <string name="prefAuthenticate">Authenticate</string>
18 <string name="prefLocation">Location on SD Card</string>
19 <string name="prefFolderCreated">The folder \"%1$s\" does not exist yet. Please connect your device to the computer, create the folder and fill it with *.note files.</string>
20- <string name="prefNoValidLocation">\"%1$s\" is no valid folder location. Please try again!</string>
21+ <string name="prefNoValidEntry">\"%1$s\" contains invalid characters.\nPlease try again!</string>
22
23 <string name="prefSyncCompleteAuth">Completing authentication. Please wait...</string>
24 <string name="prefSyncConnectionFailed">The connection to the server has failed, please check that the address you entered is correct.</string>
25
26=== modified file 'res/xml/preferences.xml'
27--- res/xml/preferences.xml 2012-01-12 12:14:57 +0000
28+++ res/xml/preferences.xml 2012-04-01 13:30:25 +0000
29@@ -33,12 +33,14 @@
30 <EditTextPreference android:key="sync_server"
31 android:title="@string/prefSyncServer"
32 android:positiveButtonText="@string/prefAuthenticate"
33- android:shouldDisableView="true"/>
34+ android:shouldDisableView="true"
35+ android:singleLine="true"/>
36
37 <EditTextPreference android:key="sd_location"
38 android:title="@string/prefLocation"
39 android:positiveButtonText="@string/btnOk"
40- android:shouldDisableView="true"/>
41+ android:shouldDisableView="true"
42+ android:singleLine="true"/>
43 </PreferenceCategory>
44 <PreferenceCategory android:title="@string/prefSearch">
45 <Preference
46
47=== modified file 'src/org/tomdroid/ui/PreferencesActivity.java'
48--- src/org/tomdroid/ui/PreferencesActivity.java 2012-03-31 21:08:34 +0000
49+++ src/org/tomdroid/ui/PreferencesActivity.java 2012-04-01 13:30:25 +0000
50@@ -112,6 +112,10 @@
51 Toast.LENGTH_SHORT).show();
52 return false;
53 }
54+ if ((serverUri.toString().contains("\t")) || (serverUri.toString().contains(" ")) || (serverUri.toString().contains("\n"))){
55+ noValidEntry(serverUri.toString());
56+ return false;
57+ }
58
59 authenticate((String) serverUri);
60 return true;
61@@ -127,8 +131,8 @@
62 if (locationUri.equals(Preferences.getString(Preferences.Key.SD_LOCATION))) {
63 return false;
64 }
65- if (locationUri.toString().contains("\n")) {
66- noValidLocation(locationUri.toString());
67+ if ((locationUri.toString().contains("\t")) || (locationUri.toString().contains("\n"))) {
68+ noValidEntry(locationUri.toString());
69 return false;
70 }
71
72@@ -277,6 +281,7 @@
73
74 private void folderNotExisting(String path) {
75 new AlertDialog.Builder(this)
76+ .setTitle(getString(R.string.error))
77 .setMessage(String.format(getString(R.string.prefFolderCreated), path))
78 .setNeutralButton(getString(R.string.btnOk), new OnClickListener() {
79 public void onClick(DialogInterface dialog, int which) {
80@@ -285,9 +290,10 @@
81 .show();
82 }
83
84- private void noValidLocation(String path) {
85+ private void noValidEntry(String Entry) {
86 new AlertDialog.Builder(this)
87- .setMessage(String.format(getString(R.string.prefNoValidLocation), path))
88+ .setTitle(getString(R.string.error))
89+ .setMessage(String.format(getString(R.string.prefNoValidEntry), Entry))
90 .setNeutralButton(getString(R.string.btnOk), new OnClickListener() {
91 public void onClick(DialogInterface dialog, int which) {
92 dialog.dismiss();

Subscribers

People subscribed via source and target branches