Mercurial Hosting > luan
comparison lucene/src/luan/modules/lucene/LuceneIndex.java @ 601:d36027b41570 0.12
better error message
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Sep 2015 01:34:20 -0600 |
parents | 50540f0813e2 |
children | e54c1646eed0 |
comparison
equal
deleted
inserted
replaced
600:b926e53910dd | 601:d36027b41570 |
---|---|
140 } | 140 } |
141 | 141 |
142 public void save(LuanState luan,LuanTable doc) throws LuanException, IOException { | 142 public void save(LuanState luan,LuanTable doc) throws LuanException, IOException { |
143 if( doc.get(luan,"type")==null ) | 143 if( doc.get(luan,"type")==null ) |
144 throw new LuanException(luan,"missing 'type' field"); | 144 throw new LuanException(luan,"missing 'type' field"); |
145 Long id = (Long)doc.get(luan,"id"); | 145 Object obj = doc.get(luan,"id"); |
146 Long id; | |
147 try { | |
148 id = (Long)obj; | |
149 } catch(ClassCastException e) { | |
150 throw new LuanException(luan,"id should be Long but is "+obj.getClass().getSimpleName()); | |
151 } | |
146 | 152 |
147 boolean commit = !writeLock.isHeldByCurrentThread(); | 153 boolean commit = !writeLock.isHeldByCurrentThread(); |
148 writeLock.lock(); | 154 writeLock.lock(); |
149 try { | 155 try { |
150 if( id == null ) { | 156 if( id == null ) { |