Phabricator Issue Unhandled Exception ("AphrontQueryException") - #1048: Column 'description' cannot be null - phabricator

I recently updated Phabricator and when I try to create a new task, I receive the following error:
Unhandled Exception ("AphrontQueryException") - #1048: Column 'description' cannot be null
It´s important to say that this field isn´t marked as mandatory since this is not a custom field. Also, when I create a task by using another type o form, it works.

This sounds like you updated Phabricator, but didn't fully complete all steps (like updating the database or maybe restarting PHP). See https://secure.phabricator.com/book/phabricator/article/upgrading/

Related

Getting Cannot change locked branch exception in Guidewire PC

I am trying to make a readonly entity to writable by using
Transaction.runwithNewBundle(\bundle -> {
entity = bundle.add(entity)
})
but I am getting
java.lang.IllegalArgumentException: You cannot change a locked branch.
Please help me out with this.
I got it resolved. Guidewire provides one field in entity called "Locked". If it is set to true, the entity cannot be modified even in the Transaction.runwithNewBundle scope.Set it to false to resolve the exception.
That’s not really the best idea. You are trying to edit a branch (policyPeriod) that is essentially in a “thou shall not change” state. If the branch is bound or quoted and you modify it it’s likely you are at least invalidating the quote. I’d highly recommend NOT modifying a locked branch. Instead open it for edit first (if you can)
Simple! You cannot edit a branch that is Locked (Quoted or Bound). Click on "Edit Policy Transaction", bring back the status to Draft.

EntityMetadataWrapperException: Invalid data value given

On editing a node with a user of a particular role i get the following error a Drupal site. With only user 1 it works. Can't figure why. I debug the entity file, but it seems that the id disappear after iteration.
EntityMetadataWrapperException : Invalid data value given. Be sure it matches the required data type and format. dans EntityDrupalWrapper->set() (ligne 737 dans /sites/all/modules/entity/includes/entity.wrapper.inc).
No coding yet has been done for this only using contrib modules.
Since you haven't done any coding, it's probably bug of some contrib module, Entity API or you're dealing with malformed entity.
Try applying this patch: Add field information to exception message on validation exception, this will allow you to see on which value it fails.
In case you're using some custom coding, then check Entity metadata wrappers page for some examples. The common mistake is to not use array() for set() when dealing with multi-valued field, or opposite - extra array for single-valued field.
If you can reproduce the problem, you can debug the issue either by step-by-step debugger and do the breakpoint on Exception line, or do it manually by temporary adding: var_dump(debug_backtrace()); exit; just before the exception happens, so PHP can dump the backtrace of your current code with all the argument passed, so you can track your malformed entity or identify the failing contrib module.
See also: How to set a value on a field collection using entity metadata wrapper at DA

In Spring MVC, is there a way to implement error levels?

Within Spring MVC, is there way to identify the 'level' or 'type' of error? Examples include information, warning, and error messages?
Btw, this is purely for formatting purposes. For example, error messages tend to be in red text while warning messages are simply black.
** Updating for clarity:
In our current system, we have multiple levels of messages: error, warning, info. Is there anything built into SpringMVC, that allows me to set an error message's level?
Also, it appears that we're using BindingResults in the Controllers (specifically BeanPropertyBindingResults), and triggering a Validator (our custom class that implements Spring's Validator interface).
During validation we end up writing something like:
ValidationUtils.rejectIfEmptyOrWhitespace(errors, modelVariable, "required", new Object[] {variableDisplayName});
Or
errors.rejectValue("field", "fieldName");
In the end, we ended up extending ObjectError and FieldError to include a new field, 'ErrorLevel'. When creating a new error -we use these new objects so that we can set the ErrorLevel. On the JSP, we look for the ErrorLevel to determine how to display the messages.
First of all, there's no such thing as 'level' or type of error in existing validation features.
But if you want to achieve level of error just like logging error levels, you can do so by setting the errors as list in request flashmap.
Eg.
RequestContextUtils.getOutputFlashMap(request).put("ERROR_MESSAGES", Arrays.asList("test error"));
RequestContextUtils.getOutputFlashMap(request).put("WARN_MESSAGES", Arrays.asList("test error"));

Problem persisting collection of interfaces in JDO/Datanucleus. "unable to assign an object of type.."

I am getting below error whilst trying to persist an object that has a collection of interfaces which I want to hold a couple of different types of objects. Seems to be happening almost randomly. Sometimes after restarting it works ok ( I might be doing something wrong though).
class CommentList {
#Persistent
#Join
ArrayList<IComment> = new ArrayList<IComment>();
}
somewhere else...
CommentList cl = new CommentList();
cl.addComment( new SimpleComment() );
cl.addComment( new SpecialComment() );
repo.persist( cl );
I can see the join table has been created in my DB along with ID fields for each of the Implementation classes of IComment.
SimpleComment and SpecialComment implement IComment. If I just add a SimpleComment it works fine. As soon as I start trying to add other types of objects I start to get the errors.
error im getting
java.lang.ClassCastException: Field "com.myapp.model.CommentList.comments" is a reference field (interface/Object) of type com.myapp.behaviours.IComment but DataNucleus is unable to assign an object of type "com.myapp.model.ShortComment" to this field. You can only assign this field to a type specified by the "implementation-classes" extension attribute.
at org.datanucleus.store.mapped.mapping.MultiMapping.setObject(MultiMapping.java:220)
at org.datanucleus.store.mapped.mapping.ReferenceMapping.setObject(ReferenceMapping.java:526)
at org.datanucleus.store.mapped.mapping.MultiMapping.setObject(MultiMapping.java:200)
at org.datanucleus.store.rdbms.scostore.BackingStoreHelper.populateElementInStatement(BackingStoreHelpe
r.java:135)
at org.datanucleus.store.rdbms.scostore.RDBMSJoinListStoreSpecialization.internalAdd(RDBMSJoinListStore
Specialization.java:443)
at org.datanucleus.store.mapped.scostore.JoinListStore.internalAdd(JoinListStore.java:233)
When it does save, if I restart the server and try to query for a list of the comments, I get null values returned.
I'm using mysql backend - if I switch to db4o it works fine.
Please let me know if any info would be useful.
If you have any idea where I might be going wrong or can provide some sample code for persisting collection of different objects implementing the same interface that would be appreciated.
Thanks for any help.
Tom
When I used interfaces I just enabled dynamicSchemaUpdates (some persistence property with a name like that) and FK's are added when needed. The log gives all SQL I think
I fixed this by specifying
<extension implemention-classes="SimpleComment SpecialComment"/>
for the field cl in my pacakge.jdo.

ASP.NET page change causes an object array in Session to be unable to cast to it's own type?

I am storing an array of a custom serializable class in session on my site. When a page on the site changes, suddenly it renders them invalid, and tells me that it can't cast the type to it's own type. I assume the class version numbers are changing or something?!
I'd appreciate avoiding the "don't use session" answers, unless it's a really simple solution. I'm not trying to redesign this whole process.
Unable to cast object of type 'ShipmentPackages[]' to type 'ShipmentPackages[]'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'ShipmentPackages[]' to type 'ShipmentPackages[]'.
Source Error:
Line 21: Else
Line 22: If Not Session("ShipmentList") Is Nothing Then
Line 23: ShipmentList = DirectCast(Session("ShipmentList"), ShipmentPackages()).ToList
Line 24: End If
Line 25: End If
I have seen this message a number of times myself, it is very annoying! As you pointed out, it probably because the assembly version changed. In Asp.Net, when the page changes, the code gets recompiled. Depending on where you put the class will determine if the class gets recompiled with the page or not. I would suggest moving any "model" type classes to a separate project. This will avoid this problem as well as the urge to mix view/controller and model code :).
You can also try serializing the object into session as XML. If you do, you should be able to deserialize it even if the assembly changes, though not if the properties on the object change.
I know you said you didn't want to hear this, but you might also consider not putting objects in the session. This makes it difficult to scale your application if the time ever comes that it is necessary. The sooner you fix this the easier it will be to fix.
A few days ago I got annoyed by this issue too. Alas Brian's first solution will only work as long as you do not need to compile the "model-project" again. If you do that (because of a bugfix, etc.) and update the running application (with users holding their session during the update-process, what is done in my case) you get the exception again :-(!
In my special case the best solution was really easy! I changed "DirectCast" to "TryCast". If the assemblyversion changed and casting fails, trycast will return nothing. In this case, or if I haven't written the dictionary/collection to the session yet, I fetch my data (again) over the database and store afterwards. The next time casting will work ;-)! And another great point, this works also if the interface of the object will change!

Resources