Not able to pass Multiple image to Server Nodejs - javascript

I have created an application using an android studio and for server-side using NodeJs.I have tried to pass a single image and able to pass. This time, I want to pass multiple images to the server, but when I started change parameter from image:MultipleBody.Part to images:List<MultipartBody.Part> at Api.kt file, received an error message at the server-side. I don't know with a part that I'm doing it wrong. Hope can help me solve this problem. Thank you in advance.
$ node app Listening on port 4545... MulterError: Unexpected field
at wrappedFileFilter (C:\Users\user\Documents\GitHub\EIS-API\node_modules\multer\index.js:40:19)
at Busboy. (C:\Users\user\Documents\GitHub\EIS-API\node_modules\multer\lib\make-middleware.js:114:7)
at Busboy.emit (events.js:223:5)
at Busboy.emit (C:\Users\user\Documents\GitHub\EIS-API\node_modules\busboy\lib\main.js:38:33)
at PartStream. (C:\Users\user\Documents\GitHub\EIS-API\node_modules\busboy\lib\types\multipart.js:213:13)
at PartStream.emit (events.js:223:5)
at HeaderParser. (C:\Users\user\Documents\GitHub\EIS-API\node_modules\dicer\lib\Dicer.js:51:16)
at HeaderParser.emit (events.js:223:5)
at HeaderParser._finish (C:\Users\user\Documents\GitHub\EIS-API\node_modules\dicer\lib\HeaderParser.js:68:8)
at SBMH. (C:\Users\user\Documents\GitHub\EIS-API\node_modules\dicer\lib\HeaderParser.js:40:12)
MulterError: Unexpected field
at wrappedFileFilter (C:\Users\user\Documents\GitHub\EIS-API\node_modules\multer\index.js:40:19)
at Busboy. (C:\Users\user\Documents\GitHub\EIS-API\node_modules\multer\lib\make-middleware.js:114:7)
at Busboy.emit (events.js:223:5)
at Busboy.emit (C:\Users\user\Documents\GitHub\EIS-API\node_modules\busboy\lib\main.js:38:33)
at PartStream. (C:\Users\user\Documents\GitHub\EIS-API\node_modules\busboy\lib\types\multipart.js:213:13)
at PartStream.emit (events.js:223:5)
at HeaderParser. (C:\Users\user\Documents\GitHub\EIS-API\node_modules\dicer\lib\Dicer.js:51:16)
at HeaderParser.emit (events.js:223:5)
at HeaderParser._finish (C:\Users\user\Documents\GitHub\EIS-API\node_modules\dicer\lib\HeaderParser.js:68:8)
at SBMH. (C:\Users\user\Documents\GitHub\EIS-API\node_modules\dicer\lib\HeaderParser.js:40:12)
Api.kt
#Multipart
#POST("perkhidmatan_rumput/api/PostPemantauanPerkhidmatanPotingRumput" +
"/{zon}/{syarikat}/{alamat_syarikat}/{nama_penyelia}/{taman}/{bulan}/{tahun}" +
"/{masa}/{timeAMPM}/{pusingan}/{status}/{catatan}/{state}/{entryOperator}")
fun postPemantauanPerkhidmatanPotingRumput(
#Path("zon")zon:String,
#Path("syarikat")syarikat:String,
#Path("alamat_syarikat")alamat_syarikat:String,
#Path("nama_penyelia")nama_penyelia:String,
#Path("taman")taman:Int,
#Path("bulan")bulan:String,
#Path("tahun")tahun:String,
#Path("masa")masa:String,
#Path("timeAMPM")timeAMPM:String,
#Path("pusingan")pusingan:String,
#Path("status")status:String,
#Path("catatan")catatan:String,
#Path("state")state:String,
#Path("entryOperator")entryOperator:String,
#Part images:List<MultipartBody.Part>
//#Part image:MultipartBody.Part?
):LiveData<GenericApiResponse<OnResponse>>
PemoViewModel.kt
public fun getAllImages():List<MultipartBody.Part>?{
var info = getCurrentViewStateOrNew()
var pic:List<GambarSebelum>? = info.gambarSebelum
var images = mutableListOf<MultipartBody.Part>()
pic?.let {
for ( item in it){
var multipartBody: MultipartBody.Part? = null
item.url?.path?.let { filePath ->
val imageFile = File(filePath)
val requestBody =
RequestBody.create(
MediaType.parse("image/*"),
imageFile
)
multipartBody = MultipartBody.Part.createFormData(
"image",
imageFile.name,
requestBody
)
}
images.add(multipartBody!!);
}
}
return images;
}
PemoFragment.kt
_binding.btnLogin.setOnClickListener {
if(!isFill()){
Toast.makeText(requireContext(),"sila penuhkan ruang diatas..",Toast.LENGTH_SHORT).show()
return#setOnClickListener
}
var bulan:String = CALENDER.valueOf(_binding.idBulanSpinner.selectedItem.toString()).value
var taman:Int? = _viewModel.getTamanIdByTamanName(_binding.idTamanSpinner.selectedItem.toString())
var pusingan:String? = _viewModel.getPusinganByPusinganName(_binding.idPusinganSpinner.selectedItem.toString())
var status:String? = _viewModel.getStatusByStatusName(_binding.idStatusSpinner.selectedItem.toString())
var images:List<MultipartBody.Part>? = _viewModel.getAllImages()
if(taman != null && pusingan != null && status != null){
//insert information to server (database)
_viewModel.setStateEvent(
FormRumputStateEvent.SubmitPemantauanForm(
PemantauanPotongRumputResponse(
_binding.idZonsSpinner.selectedItem.toString(),
_binding.idNamaSyarikatEdit.text.toString(),
_binding.idAlamatSyarikat.text.toString(),
_binding.idNamaPenyeliaKontraktorEdit.text.toString(),
taman,
bulan,
_binding.idTahunEdit.text.toString(),
_binding.idMasaEdit.text.toString(),
_binding.idAmPmSpinner.selectedItem.toString(),
pusingan,
status,
_binding.idCatatanEdit.text.toString(),
STATE_STATUS.CREATE.name,
"ADMIN",
images!!
)
))
}else{
Toast.makeText(requireContext(),"[Error] Taman,Bulan,pusingan or status has Problem..",Toast.LENGTH_SHORT).show()
return#setOnClickListener
}
}
PemantauanPotongRumputResponse
data class PemantauanPotongRumputResponse(
#Expose
#SerializedName("zon")
val zon:String,
#Expose
#SerializedName("syarikat")
val syarikat:String,
#Expose
#SerializedName("alamat_syarikat")
val alamat_syarikat:String,
#Expose
#SerializedName("nama_penyelia")
val nama_penyelia:String,
#Expose
#SerializedName("taman")
val taman:Int,
#Expose
#SerializedName("bulan")
val bulan:String,
#Expose
#SerializedName("tahun")
val tahun:String,
#Expose
#SerializedName("masa")
val masa:String,
#Expose
#SerializedName("timeAMPM")
val timeAMPM:String,
#Expose
#SerializedName("pusingan")
val pusingan:String,
#Expose
#SerializedName("status")
val status:String,
#Expose
#SerializedName("catatan")
val catatan:String,
#Expose
#SerializedName("state")
val state:String,
#Expose
#SerializedName("entryOperator")
val entryOperator:String,
#Expose
#SerializedName("images")
val images:List<MultipartBody.Part>
)
SERVER SIDE
NODE.JS
router.post('/api/PostPemantauanPerkhidmatanPotingRumput/:zon/:syarikat/:alamat_syarikat/'+
':nama_penyelia/:taman/:bulan/:tahun/:masa/:timeAMPM/:pusingan/:status/:catatan/:state/'+
':entryOperator', upload.array('images',9),(req,res,next) =>{
try{
const file = req.files;
if (!file) {
res.status(400).json({
"status": "failed",
"code" : "400",
"message" : "Please upload file"
});
}
res.status(200).json({
"status": "success",
"code" : "200",
"message" : "file uploaded successfully"
});
console.log(file);
console.log(req.body);
}catch(err){
console.log(error.message);
res.status(200).json({
"status": "failed",
"code" : "500",
"message" : error.message
});
}
})

Able to Solved the problem. Just make sure the first parameter "images" at MultipartBody.Part.createFormData same at Server-Side parameter upload.array("images")
multipartBody = MultipartBody.Part.createFormData(
"images",
imageFile.name,
requestBody
)
PemoViewMode.kt
public fun getAllImages():List<MultipartBody.Part>?{
var info = getCurrentViewStateOrNew()
var pic:List<GambarSebelum>? = info.gambarSebelum
var images = mutableListOf<MultipartBody.Part>()
pic?.let {
for ( item in it){
var multipartBody: MultipartBody.Part? = null
item.url?.path?.let { filePath ->
val imageFile = File(filePath)
val requestBody =
RequestBody.create(
MediaType.parse("image/*"),
imageFile
)
multipartBody = MultipartBody.Part.createFormData(
"images",
imageFile.name,
requestBody
)
}
images.add(multipartBody!!);
}
}
return images;
}
SERVER-SIDE (NODEJS)
router.post('/api/PostPemantauanPerkhidmatanPotingRumput/:zon/:syarikat/:alamat_syarikat/'+
':nama_penyelia/:taman/:bulan/:tahun/:masa/:timeAMPM/:pusingan/:status/:catatan/:state/'+
':entryOperator', upload.array('images',9),(req,res,next) =>{
try{
const file = req.files;
if (!file) {
res.status(400).json({
"status": "failed",
"code" : "400",
"message" : "Please upload file"
});
}
res.status(200).json({
"status": "success",
"code" : "200",
"message" : "file uploaded successfully"
});
console.log(file);
console.log(req.body);
}catch(err){
console.log(error.message);
res.status(200).json({
"status": "failed",
"code" : "500",
"message" : error.message
});
}
})

Related

Update collection using email inplace of _Id as the unique Id

I have 2 collection tables that only share emails as the unique ids of these 2 tables. The first one is Meteor.users() and SchoolStudents. I want to update the SchoolStudents collection based on the user's email. Though I have successfully updated using _id but the update isn't working using email as the Id. What's the better approach?
In this, it returned a success feedback but no update is made to the record. Bert.alert('Record updated successfully', 'success', 'growl-top-right');
Client code:
let user = Meteor.user();
let studentemail = user && user.emails && user.emails[0].address;
if (studentemail) {
console.log(studentemail);
Meteor.call('UpdateUser', studentemail, function (error, response) {
if (error) {
Bert.alert(error.reason, 'danger', 'growl-top-right');
return false;
} else {
Bert.alert('Record updated successfully', 'success', 'growl-top-right');
}
})
}
Server method
SchoolStudents.update({useremail: studentemail}, {$set: {'status.active': true, 'status.activedate': new Date()}});
This is a sample document from the SchoolStudents collection:
{
"_id" : "xgxZJFRkXGhHmHupY",
"firstname" : "Kehinde",
"lastname" : "Adeoya",
"middlename" : "Adekusibe",
"username" : "ken10ward",
"password" : "PvyLwY9d",
"useremail" : "kadeoya#appzonegroup.com",
"studentclass" : "ss8",
"dateofbirth" : "9-Mar-00",
"gender" : "f",
"ethinicity" : "black",
"mobile" : "8023472442",
"address" : "7 Abrahamoivc",
"city" : "bolson",
"lg" : "loveland",
"state" : "ekiti",
"country" : "Ukraine",
"registra" : "kadeoya",
"status" : {
"active" : false,
"activedate" : null
},
"userId" : "n5rqFSHbhm7zqADyB",
"createdAt" : ISODate("2017-09-05T18:45:14.877Z"),
"friendlySlugs" : {
"slug" : {
"base" : "kehinde-adeoya",
"index" : 5
}
},
"slug" : "kehinde-adeoya-5"
}
This is the server update code:
UpdateUser: function (studentemail) {
check(studentemail, String);
if (!Meteor.userId()) {
Meteor.Error('Not authorized');
return false;
} else {
SchoolStudents.update({useremail: studentemail}, {status: {active: true, activedate: new Date()}}, { upsert: true });
}
}
As it has been pointed to you, you're using user && user.emails && user.emails[0].address construct wrong way.
I suggest you to use this template to do things like that:
let studentemail;
try {
studentemail = user.emails[0].address.valueOf();
} catch (e) {
studentemail = null;
}
if (studentemail != null) {
...
}
This way you can omit numerous checks, like user != null and user.emails != null and user.emails.length > 0 etc and it will be guaranteed that in your studentemail variable you will get either null or user email address.
Added: User email address could be undefined, that's why you need != null check (non-strict). It will be false if variable is undefined or null.

Why can't I access the data in my JSON?

My PHP is:
if(!empty($_POST)&&($_POST['action']=='edit'))
{
foreach ($_POST['selected'] as $edit_id)
{
$query = "SELECT * FROM grocery WHERE id = $edit_id";
$result = dbQuery($query);
break;
}
$rowArr=array();
$inRow = mysqli_fetch_array($result);
$id = $inRow['id'];
$shop = $inRow['shop'];
$category = $inRow['category'];
$item = $inRow['item'];
$qnty = $inRow['quantity'];
$unit = $inRow['unit'];
$price_based_on = $inRow['price_based_on'];
$mrp = $inRow['MRP'];
$sellers_price = $inRow['sellers_price'];
$last_updated_on = $inRow['last_updated_on'];
array_push($rowArr, array('id' => $id, 'shop' => $shop, 'category' =>$category, 'item' => $item, 'qnty' => $qnty, 'unit' => $unit, 'price_based_on' => $price_based_on, 'mrp' => $mrp, 'sellers_price' => $sellers_price, 'last_updated_on' => $last_updated_on));
echo json_encode(array('rowArr' => $rowArr));
}
The output (JSON) produced by the above script is: (I've ensured this is produced in the Chrome's console)
{
"rowArr": [
{
"id": "30",
"shop": "Subhash",
"category": "Spices",
"item": "Duta Corriander Powder",
"qnty": "50",
"unit": "gm",
"price_based_on": "Packet",
"mrp": "15.00",
"sellers_price": "12.00",
"last_updated_on": "2016-12-03"
}
]
}
My jQuery is:
$('#edit').click(function(){
var data = $("#list :input").serialize();
$.post($("#list").attr('action'), data, function(json)
{
if(json.rowArr.length>0)
console.log("Data Exists");
else
console.log("Empty");
currentRow = json.rowArr[0];
console.log(json.rowArr[0].id);
$("#id").val(currentRow.id);
$("#id_disp").val(currentRow.id);
});
});
Strangely enough, neither Data Exists or Empty is produced by the above loop. And when I try to access the JSON data, json.rowArr[0].id I get the following error:
Uncaught TypeError: Cannot read property 'length' of undefined
Why is this happening? How do I fix it?
You should explicitly tell jQuery that your response has JSON format. You should pass 'json' as fourth argument of $.post, according to docs.
$('#edit').click(function(){
var data = $("#list :input").serialize();
$.post($("#list").attr('action'), data, function(json) {
if(json.rowArr.length>0)
console.log("Data Exists");
else
console.log("Empty");
currentRow = json.rowArr[0];
console.log(json.rowArr[0].id);
$("#id").val(currentRow.id);
$("#id_disp").val(currentRow.id);
}, 'json');
});

Ajax Message not displaying

I try to display an error message but it does'nt work.
When the email does'nt exist,
I have this message : Thank you : your email is added
But if the email is always in mailchimp or other error, I haven't message under the button submit.
Do you have an idea to resolve this point ?
Thank you
The detail of the error come from server.
string(88) "400: ****** is already a list member. Use PUT to insert or update list members."
array(5) {
["type"]=>
string(77) "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/"
["title"]=>
string(13) "Member Exists"
["status"]=>
int(400)
["detail"]=>
string(83) "********* is already a list member. Use PUT to insert or update list members."
["instance"]=>
string(0) ""
}
my javascript is
$footer .= '
<script>
$(document).ready(function() {
$('#signup').submit(function() {
$("#message").html("<div class=\"alert alert-info\" style=\"padding:05px; margin-top:5px;\" role=\"alert\">Thank you : your email is added</div>");
$.ajax({
url: 'ext/api/mailchimp_v3/subscribe.php', // proper url to your "store-address.php" file
type: 'POST', // <- IMPORTANT
dataType: 'json',
data: $('#signup').serialize() + '&ajax=true',
success: function(msg) {
var message = '';
var result = '';
message = $.parseJSON(msg);
if (message.status === 'pending') { // success
result = '<div class=\"alert alert-success\" role=\"alert\">Thank you: an email has sent you for confirmation</div>';
} else { // error
result = '<div class=\"alert alert-danger\" role=\"alert\">Error ' + message.detail + '</div>';
}
},
complete: function(message) {
$('#message').html('<div> ' + message.title + '</div>'); // display the message
}
});
$('#fname').attr('value',''); // reset input field
$('#lname').attr('value',''); // reset input field
$('#email').attr('value',''); // reset input field
return false;
});
});
</script>';
PHP code
if ( isset($_POST['anonymous'])) {
$list_id = MODULES_HEADER_TAGS_MAILCHIMP_LIST_ANONYMOUS;
$merge_vars = [
'FNAME' => '',
'LNAME' => ''
];
} else {
$list_id = MODULES_HEADER_TAGS_MAILCHIMP_LIST_CUSTOMERS;
$merge_vars = [
'FNAME' => $_POST['firstname'],
'LNAME' => $_POST['lastname']
];
}
$array = [
'email_address' => $_POST['email'],
'merge_fields' => $merge_vars,
'status' => MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE
];
if (MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE == 'pending') {
$status = 'pending';
} else {
$status = 'subscribed';
}
$mc = new \MailChimp($key);
// add the email to your list
$result = $mc->post('/lists/' . $list_id . '/members', $array);
//send
json_encode($result);
// If being called via ajax, run the function, else fail - console
if ( MODULES_HEADER_TAGS_MAILCHIMP_DEBUG == 'True') {
if ($_POST['ajax']) {
var_dump($result); // send the response back
} else {
var_dump('Method not allowed - please ensure JavaScript is enabled in this browser');
}
}

Dynamic field names in MongoDB using Mongoose

. Sample of collection Flights :
{
"Orig" : "AGP",
"Dest" : "CMN",
"Description_Flight" : "One-Stop-Narrow Type",
"Description_Flight_2" : "WESTERN EUROPE/WESTERN EUROPE",
"Mkt_Al" : "0B"
}
. Sample of collection Coeff :
{
"Regions" : "WESTERN EUROPE/WESTERN EUROPE",
"Non-Stop-Narrow Type" : 2.4109,
"Non-Stop-Supersonic" : 2.71828,
"One-Stop-Narrow Type" : 2.22554,
"One-Stop-Turbo" : 0.92312,
"One-Stop-Wide Type" : 11.24586,
"One-Stop Online-Turbo" : 0.07577
}
What I want ?
I Have my starting collection, Flights and for each document I want to put a score, a score which based on the Description_Flight_2 and Description_Flight.
Example :
For example, in my sample I have :
"Description_Flight" : "One-Stop-Narrow Type",
"Description_Flight_2" : "WESTERN EUROPE/WESTERN EUROPE",
So, I should go to the Coeff collection, and find the region :
"WESTERN EUROPE/WESTERN EUROPE"
and then take the appropriate value, here I should take this value in this line :
"One-Stop-Narrow Type" : 2.22554,
I have tried this :
mongoose.connect('mongodb://localhost/mydb');
var cSchema = new Schema({},{ strict: false, collection: 'flights' }),
dflights = mongoose.model("flights", cSchema);
var rSchema = new Schema({},{ strict: false, collection: 'coeff' }),
coeff = mongoose.model("coeff", rSchema);
mongoose.set('debug', false);
mongoose.connection.on("open", function (err) {
if (err) throw err;
dflights.find({}).lean().exec(function (err, flights) {
if (err) throw err;
flights.forEach(function(flight) {
var Flight_Description = "", score =0 ;
coeff.findOne({Regions : flight.Description_Flight_2}).lean().exec(function (err, coef) {
And here the important lines :
Flight_Description = flight.Description_Flight;
score = (coef != null ) ? coef.Flight_Description : "Missed data";
Here the last lines
if ( score != 0)
dflights.collection.update({_id:flight._id}, { $set : { score :score } } );
});
});
});
});
Please how can I achieve the above ?
The correct code should be:
score = (coef != null ) ? coef[Flight_Description] : "Missed data";

issue in display of html content stored in database in java

Here i am trying to display html content stored in database.When i try it to display in js it gives me "Uncaught ReferenceError: VAR_1 is not defined" in console.
Database:
<div id="dashboard-greeting" class="museo">
<div class="dashboard-greeting-instructions">
<span>Track Progress</span>
<div class="dashboard-greeting-counter round">
<div class="dashboard-counter-label">Courses Completed</div>
<div class="dashboard-counter-value">VAR_1</div>
</div>
<div class="dashboard-greeting-counter round">
<div class="dashboard-counter-label">Courses Needed</div>
<div id="subNeeded" class="dashboard-counter-value"></div>
<script>
var subNeedVar = VAR_2 - VAR_1;
$("#subNeeded").html(subNeedVar);
</script>
</div>
</div>
</div>
.js
<div class="tool-button-container">
<input type="submit" name="View" value="LookUp" id="campaignSubmit" class="buOrange large" onClick="validateConfigValues('configKeyName');"/> </div>
function validateConfigValues(id1){
$.ajax({
type: 'POST',
url: '<%=request.getContextPath()%>/adminConfigTest',
data: ({configKeyName:configKeyName, clientId :clientId ,batchId : batchId, languageId : languageId}),
cache: false,
success: function(data) {
var deleteCachingBtn = $('<br><div id="deleteBtn"><Button id="deleteCaching" name="deleteCaching" class="buOrange large" onClick=deleteFromCaching(\'' + configKeyName + '\')> Remove from Cache </div>');
var displayStringAppData = "";
var obj = JSON.parse(data);
$.each(obj, function(index,value) {
displayStringAppData = displayStringAppData+"<br>"+value+"<br>";
alert("displayStringAppData"+displayStringAppData);
});
$("#dbModelWindow").html(displayStringAppData);
if(~data.indexOf("Config is not found in DB also.")) {
} else {
$("#dbModelWindow").append(deleteCachingBtn);
}
$('#dbModelWindow').modal({
"escClose": true,
"overlayClose": true,
"onShow": function() { $.modal.setContainerDimensions();},
});
},
error: function(xhr, textStatus, error){
alert("Error occured. Please try after some time.");
}
});
}
}
.java
#RequestMapping(value="/adminConfigTest", method= RequestMethod.POST)
#PreAuthorize("hasPermission(#adminConfigTest,'ADMIN_TEXT_CONFIG')")
#ResponseBody
public String getAdminConfigTestPost(HttpServletRequest request) throws Exception {
String configKeyName = request.getParameter("configKeyName");
String clientId = request.getParameter("clientId");
String batchId = request.getParameter("batchId");
String language = request.getParameter("languageId");
List<String> arrList = new ArrayList<String>();
try{
Number languageId = null;
if(StringUtils.isBlank(language)){
languageId = RCConstants.ENGLISH_LANGUAGE_ID;
} else {
languageId = Long.parseLong(language);
}
if(StringUtils.isBlank(clientId)){
configManager.getConfigValue(configKeyName, null, "", false, true, languageId, arrList);
}
if(!StringUtils.isBlank(clientId) && StringUtils.isBlank(batchId)){
configManager.getConfigValue(configKeyName, Long.parseLong(clientId), "", false, true, languageId, arrList);
}
if(!StringUtils.isBlank(batchId)){
configManager.getConfigValue(configKeyName, Long.parseLong(batchId), languageId, arrList);
}
} catch (Exception e) {
logger.error(e ,e);
throw e;
}
return JSONSerializer.toJSON(arrList).toString();
}
public String getConfigValue(String configKey, Number batchId, Number languageId, List<String> arrList)throws Exception{
if(arrList != null){
arrList.add("Get config value for : "+ configKey);
arrList.add("batch Id : "+ batchId);
arrList.add("Language : "+ StringUtils.getLanguageCode(languageId));
}
try{
String configKeyValue = null;
String localConfigKeyWithBatchId = batchId+"-"+configKey+"-"+StringUtils.getLanguageCode(languageId);
String queryString = "from Config as model where model.configKeyName = ? and model.batchMetaDataId = ? and model.languageId = ? and model.isDeleted = 0" ;
List<Config> configList = getHibernateTemplate().find(queryString, configKey , batchId ,languageId);
if(!configList.isEmpty()) {
for (Config config : configList) {
configKeyValue = config.getConfigKeyValue();
}
CacheUtil.put(RCConstants.LOCAL_CACHE_WITH_BATCH,localConfigKeyWithBatchId, configKeyValue);
logger.debug("Returning value from db : "+configKey+" - "+configKeyValue);
if(arrList != null){
arrList.add("Db: returning batch and language specific value : " + configKeyValue );
}
}
return configKeyValue;
} catch (RuntimeException re) {
log.error(re, re);
throw re;
}
}
CacheUtil.java
public static Cache localEhCache = null;
public static Cache localEhCacheWithBatchId = null;
public static void put(int cacheNumber, Object key, Object value) {
if (cacheNumber == RCConstants.LOCAL_CACHE) {
localEhCache.put(new Element(key, value));
} else if (cacheNumber == RCConstants.LOCAL_CACHE_WITH_BATCH) {
localEhCacheWithBatchId.put(new Element(key, value));
}
}
But if i rewrite VAR_1 again by erasing VAR_1. It wont show this error.
I googled about this topic but didn't find any solution.
Please help me or suggest me what is going wrong here.

Categories

Resources