Skip to content

Instantly share code, notes, and snippets.

View kombadzomba's full-sized avatar

Miloš Micić kombadzomba

View GitHub Profile
`
0 09-13 22:45:22.827 E/UCI4C (29395): u_getDataDirectory()=/data/user/0/net.dzomba.termin3/files/icu
1 09-13 22:45:22.861 D/Termin3 -> CouchDbManager(29395): Database found
2 09-13 22:45:22.876 D/Termin3 -> CouchDbManager(29395): Replication setup with https://----:[email protected]/couchdb/user_397/ is success
3 09-13 22:45:22.878 D/Termin3 -> CouchDbManager(29395): Replication setup with https://----:[email protected]/couchdb/user_397/ is success
4 09-13 22:45:22.878 D/Termin3 -> CouchDbManager(29395): checkIfInitializationDone
5 09-13 22:45:22.878 D/Termin3 -> CouchDbManager(29395): initialized[r] = false
6 09-13 22:45:22.881 D/Event (29395): No subscribers registered for event class net.dzomba.termin3.eventbus.DbNotInitializedEvent
7 09-13 22:45:22.882 D/Event (29395): No subscribers registered for event class de.greenrobot.event.NoSubscriberEvent
8 09-13 22:45:22.882 D/Termin3 -> CouchDbManager(29395): initialized[r] = false
0 09-15 20:54:42.617 W/Database( 7040): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
1 09-15 20:54:42.617 W/Database( 7040): at java.lang.Thread.run(Thread.java:818)
2 09-15 20:54:42.617 E/View ( 7040): Error getting last sequence indexed
3 09-15 20:54:42.617 E/View ( 7040): com.couchbase.lite.internal.database.sqlite.exception.SQLiteDatabaseCorruptException: database disk image is malformed (code 11): , while compiling: SELECT count(*) FROM sqlite_master
4 09-15 20:54:42.617 E/View ( 7040): at com.couchbase.lite.internal.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
5 09-15 20:54:42.617 E/View ( 7040): at com.couchbase.lite.internal.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:718)
6 09-15 20:54:42.617 E/View ( 7040): at com.couchbase.lite.internal.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:522)
7 09-15 20:54:42.617 E/View ( 7040): at com.couchbase.lite.storage.SQLiteStorageEngineBase.
public static void warmpupSearch() {
Observable observable = Observable.create(new Observable.OnSubscribe<LinkedList<TerminEntity>>() {
@Override
public void call(Subscriber<? super LinkedList<TerminEntity>> subscriber) {
try {
subscriber.onNext(CouchDbFacade.getInstance().getTerminByDateAndClientName(
null,
null,
null,
null));
public LinkedList<TerminEntity> getTerminByDateAndClientName(StaffEntity staff, Date startDate, Date endDate, String clientName) {
if (couchDbOrg == null) {
EventBus.getDefault().post(new DbNotInitializedEvent());
return new LinkedList<>();
}
synchronized (viewFactory.terminByClientNameView) {
TerminByClientNameView view = viewFactory.terminByClientNameView;
view.setDescending(true);
LinkedList<TerminEntity> results = (LinkedList<TerminEntity>) view.getData();
return new LinkedList(results);
public LinkedList<TerminEntity> getTerminByDateAndClientName(StaffEntity staff, Date startDate, Date endDate, String clientName) {
if (couchDbOrg == null) {
EventBus.getDefault().post(new DbNotInitializedEvent());
return new LinkedList<>();
}
synchronized (viewFactory.terminByClientNameView) {
TerminByClientNameView view = viewFactory.terminByClientNameView;
view.setDescending(true);
LinkedList<TerminEntity> results = (LinkedList<TerminEntity>) view.getData();
return new LinkedList(results);
public synchronized List<? extends CommonEntity> getData() {
Query orderedQuery = view.createQuery();
orderedQuery.setStartKey(startKey);
orderedQuery.setEndKey(endKey);
orderedQuery.setDescending(descending);
// data is protected variable
if (data == null) {
data = new LinkedList();
}
data.clear();
// inicijalizacija baze treba da je gotova tek kada se dovuku svi dokumenti replikacijom
public void checkIfInitializationDone() {
Log.d(TAG, "checkIfInitializationDone");
if (!isInitialized() && database.getDocumentCount() > 0) { // <-- LINE 375 IN FIRST LOGCAT: 36 09-13 22:45:23.180 E/Event (29395): at net.dzomba.termin3.model.couchdb.CouchDbManager.checkIfInitializationDone(CouchDbManager.java:375)
switch (databaseType) {
case ORG:
// initialization is done whenorg document exists
// and pull sync is over
if (CouchDbFacade.getInstance().getOrganization() != null && !isSyncInProgress()) {
setInitialized(true);
0 09-18 08:28:59.673 E/Database(26613): at android.os.Handler.dispatchMessage(Handler.java:102)
1 09-18 08:28:59.673 E/Database(26613): at android.os.Looper.loop(Looper.java:148)
2 09-18 08:28:59.673 E/Database(26613): at android.app.ActivityThread.main(ActivityThread.java:5527)
3 09-18 08:28:59.673 E/Database(26613): at java.lang.reflect.Method.invoke(Native Method)
4 09-18 08:28:59.673 E/Database(26613): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
5 09-18 08:28:59.673 E/Database(26613): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
6 09-18 08:28:59.673 E/Termin3 -> CouchDbManager(26613): Couldn't find database
7 09-18 08:28:59.674 W/System.err(26613): com.couchbase.lite.CouchbaseLiteException: Unable to create a storage engine, Status: 401 (HTTP 401 unauthorized)
8 09-18 08:28:59.674 W/System.err(26613): at com.couchbase.lite.store.SQLiteStore.open(SQLiteStore.java:200)
9 09-18 08:28:59.674 W/System.err(26613): at com.couchbase.lite.Database.open(Data
@kombadzomba
kombadzomba / gist:b3eadc88a4d5e488d3ec9a6d1b96e684
Created September 29, 2016 20:54
local replication status error 406
09-29 22:47:23.163 1917-2298/net.dzomba.termin3.stage D/Termin3 Stage -> CouchDbManager: Local replication ChangeEvent PUSH replication event. Source: Replication{http://user:pass@localhost:8160/org_974/, push} Transition: INITIAL -> RUNNING Total changes: 0 Completed changes: 0
09-29 22:47:23.184 1917-2338/net.dzomba.termin3.stage W/Router: Error 406: Can't satisfy request Accept: multipart/related, application/json (Content-Type = application/json)
09-29 22:47:23.186 1917-2300/net.dzomba.termin3.stage W/RemoteRequest: com.couchbase.lite.replicator.RemoteRequest {POST, http://---:---@localhost:8160/org_974/_revs_diff}: Got error status: 406 for http://user:pass@localhost:8160/org_974/_revs_diff. Reason: Not acceptable
09-29 22:47:23.190 1917-2300/net.dzomba.termin3.stage W/Sync: PusherInternal{http://---:---@localhost:8160/org_974/, push, 2a9b2}: Progress: set error = com.couchbase.lite.replicator.RemoteRequestResponseException: Not acceptable
09-29 22:48:19.557 1917-2298/net.dzomba.termin3.stage D/Termin3 S
database.setFilter("deviceFilter", new ReplicationFilter() {
@Override
public boolean filter(SavedRevision revision, Map<String, Object> params) {
String nameParam = (String) params.get(CommonEntity.FIELD_TYPE);
return nameParam != null && nameParam.equals(revision.getProperty(DocumentTypeCode.SYS_USER));
}
});