Page MenuHomePhabricator

Moving the user package to Kotlin
Needs ReviewPublic

Authored by CLOVIS on Wed, Jan 30, 12:05 AM.

Details

Summary
  • Rename .java to .kt
  • Moving User to Kotlin
  • Moving Users from Java to Kotlin

Fixes T269

Test Plan

Run the tests

Diff Detail

Repository
rLIBWFJVA WildFyre Java Libary
Branch
T269-kotlin-users (branched from master)
Lint
Lint OK
Unit
Unit Test Errors
Build Status
Buildable 583
Build 583: arc lint + arc unit

Unit TestsFailed

Excuse: Will fix later
TimeTest
31,438 msUnit Tests
Picked up _JAVA_OPTIONS: -Djdk.net.URLClassPath.disableClassPathURLCheck=true Picked up _JAVA_OPTIONS: -Djdk.net.URLClassPath.disableClassPathURLCheck=true
34,255 msSpotBugs
Picked up _JAVA_OPTIONS: -Djdk.net.URLClassPath.disableClassPathURLCheck=true FAILURE: Build completed with 2 failures.

Event Timeline

CLOVIS created this revision.Wed, Jan 30, 12:05 AM
Harbormaster completed remote builds in B550: Diff 748.
CLOVIS planned changes to this revision.Wed, Jan 30, 12:06 AM

TODO;

  • Fix unit tests
  • Convert LoggedUser
CLOVIS updated this revision to Diff 750.Thu, Jan 31, 10:17 PM
  • Explaining why the let is ?.let and not !!.let & fixing broken Dokka link
  • Rename .java to .kt
  • Converting LoggedUser to Kotlin
  • TEMPORARY, TO BE REMOVED BEFORE LANDING
CLOVIS added inline comments.Thu, Jan 31, 10:20 PM
src/test/java/net/wildfyre/http/RequestTest.kt
90

@Info-Screen This is the request that breaks because of wrong captcha

CLOVIS planned changes to this revision.Thu, Jan 31, 10:20 PM
CLOVIS added a comment.Sat, Feb 9, 9:00 PM

@Info-Screen this was thrown by the API during testing for this diff:

Internal Server Error: /areas/sample/drafts/
Traceback (most recent call last):
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 303, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: database is locked

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/views.py", line 494, in dispatch
    response = self.handle_exception(exc)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/views.py", line 454, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/views.py", line 491, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/areas/views.py", line 279, in post
    return self.create(request)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/mixins.py", line 21, in create
    self.perform_create(serializer)
  File "/home/ivan/Projets/wildfyre/java/api/api/areas/views.py", line 282, in perform_create
    serializer.save(author=self.request.user, area=self.area, draft=True)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/serializers.py", line 214, in save
    self.instance = self.create(validated_data)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/serializers.py", line 917, in create
    instance = ModelClass.objects.create(**validated_data)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/query.py", line 417, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/ivan/Projets/wildfyre/java/api/api/areas/models.py", line 68, in save
    self.subscriber.add(self.author)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 898, in add
    self._add_items(self.source_field_name, self.target_field_name, *objs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 1065, in _add_items
    for obj_id in new_ids
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/query.py", line 466, in bulk_create
    ids = self._batched_insert(objs_without_pk, fields, batch_size)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/query.py", line 1148, in _batched_insert
    self._insert(item, fields=fields, using=self.db)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/query.py", line 1125, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1281, in execute_sql
    cursor.execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute
    return super().execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 303, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: database is locked
CLOVIS edited the summary of this revision. (Show Details)Sat, Feb 16, 10:53 AM
CLOVIS updated this revision to Diff 792.Sat, Feb 16, 10:59 AM
  • Moving User from Java to Kotlin
  • Rename .java to .kt
  • Moving Users from Java to Kotlin
  • Explaining why the let is ?.let and not !!.let & fixing broken Dokka link
  • Rename .java to .kt
  • Converting LoggedUser to Kotlin
  • Added JsonValue.minimalString & JsonValue.prettyString
  • Adding LoggedUser.postsList so that Java code can access the posts
  • No more parallel unit tests (the testing server can't handle them)
  • IssueInTransferException is now able to report on messages that do not parse to JSON
  • Better Kotlin integration