Erro

2 respostas
M

Galera tenho o seguinte erro e não estou conseguindo descrobrir o que é o error é Illegal Character : /160.

O codigo é este.

public class MileageCalcStore {

/** Creates a new instance of MileageCalcStore */
public MileageCalcStore() {  
    
}
/<em>O error da neste metodo</em>/

public void saveCurrentState() {

RecordStore myStore = null;

try {

myStore = RecordStore.openRecordStore(“MileageCalcStore”, true);

int n = myStore.getNumRecords();

// crie as respresentações de “byte array” para armazenar

byte[] startingMileageBytes = Long.toString(this.startingMileageVal).getBytes();

byte[] currentMileageBytes =   Long.toString(this.currentMileageVal).getBytes();

byte[] totalFuelBytes =  Long.toString(this.totalFuelVal).getBytes();

byte[] totalCostBytes =  Long.toString(this.totalCostVal).getBytes();

// Temos  um conjunto de registros para usar?

if (n == 0) {

// não - crie novos registros

myStore.addRecord(startingMileageBytes, 0, startingMileageBytes.length);

myStore.addRecord(currentMileageBytes, 0, currentMileageBytes.length);

myStore.addRecord(totalFuelBytes, 0, totalFuelBytes.length);

myStore.addRecord(totalCostBytes, 0, totalCostBytes.length);

}

else {

// use registros existentes

myStore.setRecord(1, startingMileageBytes, 0, startingMileageBytes.length);

myStore.setRecord(2, currentMileageBytes, 0, currentMileageBytes.length);

myStore.setRecord(3, totalFuelBytes, 0, totalFuelBytes.length);

myStore.setRecord(4, totalCostBytes, 0, totalCostBytes.length);

}

}

catch(Exception ex) {

// omitido por breve - mas deve fazer algo com isto

}

finally {

if(myStore != null) {

try {

myStore.closeRecordStore();

}

catch(Exception ex) {

// ignore

}

}

}

}
public void loadCurrentState() {

RecordStore myStore = null;

try {

myStore = RecordStore.openRecordStore(MileageCalcStore, true);

int n = myStore.getNumRecords();

if(n == 0) {

// se não tiver um conjunto de registros, sue valores seguros

this.startingMileageVal = 0;

this.currentMileageVal = 0;

this.totalFuelVal = 0;

this.totalCostVal = 0;

}

else {

String startMile, currentMile, totCost, totFuel;

startMile = new String(myStore.getRecord(1));

currentMile = new String(myStore.getRecord(2));

totFuel = new String(myStore.getRecord(3));

totCost = new String(myStore.getRecord(4));

// agora analise a saída dos valores

this.startingMileageVal = Long.parseLong(startMile);

this.currentMileageVal = Long.parseLong(currentMile);

this.totalMileageVal = currentMileageVal - startingMileageVal;

this.totalFuelVal = Long.parseLong(totFuel);

this.totalCostVal = Long.parseLong(totCost);

}

}

catch(Exception ex) {

// TODO: faça algo como excessão (omitido por breve)

}

finally {

if(myStore != null) {

try {

myStore.closeRecordStore();

}

catch(Exception ex) {

// ignore

}

}

}

// agora atualize as médias e sumario

this.recalcAveragesAndUpdateSummary();

}
}

2 Respostas

Realm

hmm, faça um println() nos bytes que estão sendo gravados no RMS, quem sabe a transformação de String para byte esteja incorreta e gerando caracteres não suportados pelo RMS…

M

Como assim não entendi?

Criado 3 de novembro de 2006
Ultima resposta 3 de nov. de 2006
Respostas 2
Participantes 2