Skip to content

Commit

Permalink
CatchParameterName fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill380 committed Sep 27, 2016
1 parent 58729e8 commit 653253f
Show file tree
Hide file tree
Showing 67 changed files with 565 additions and 560 deletions.
Expand Up @@ -18,6 +18,7 @@




import org.kaaproject.kaa.avro.avrogen.compiler.ObjectiveCCompiler; import org.kaaproject.kaa.avro.avrogen.compiler.ObjectiveCCompiler;
import org.kaaproject.kaa.avro.avrogen.compiler.Compiler;


public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
Expand All @@ -27,10 +28,10 @@ public static void main(String[] args) {
+ "Need {FULL_PATH_TO_SCHEMA} {OUTPUT_PATH} {SOURCE_NAME}"); + "Need {FULL_PATH_TO_SCHEMA} {OUTPUT_PATH} {SOURCE_NAME}");
} }


org.kaaproject.kaa.avro.avrogen.compiler.Compiler compiler = new ObjectiveCCompiler(args[0], args[1], args[2]); Compiler compiler = new ObjectiveCCompiler(args[0], args[1], args[2]);
compiler.generate(); compiler.generate();
} catch (Exception e) { } catch (Exception ex) {
System.err.println("Compilation failure: " + e.toString()); System.err.println("Compilation failure: " + ex.toString());
} }
} }
} }
Expand Up @@ -106,16 +106,16 @@ public Compiler(String schemaPath, String outputPath, String sourceName) throws
String headerPath = outputPath + File.separator + generatedSourceName + ".h"; String headerPath = outputPath + File.separator + generatedSourceName + ".h";
String sourcePath = outputPath + File.separator + generatedSourceName + getSourceExtension(); String sourcePath = outputPath + File.separator + generatedSourceName + getSourceExtension();


Files.move(new File(headerTemplateGen()).toPath() Files.move(new File(headerTemplateGen()).toPath(),
, new File(headerPath).toPath(), StandardCopyOption.REPLACE_EXISTING); new File(headerPath).toPath(), StandardCopyOption.REPLACE_EXISTING);
Files.move(new File(sourceTemplateGen()).toPath() Files.move(new File(sourceTemplateGen()).toPath(),
, new File(sourcePath).toPath(), StandardCopyOption.REPLACE_EXISTING); new File(sourcePath).toPath(), StandardCopyOption.REPLACE_EXISTING);


this.headerWriter = new PrintWriter(new BufferedWriter(new FileWriter(headerPath, true))); this.headerWriter = new PrintWriter(new BufferedWriter(new FileWriter(headerPath, true)));
this.sourceWriter = new PrintWriter(new BufferedWriter(new FileWriter(sourcePath, true))); this.sourceWriter = new PrintWriter(new BufferedWriter(new FileWriter(sourcePath, true)));
} catch (Exception e) { } catch (Exception ex) {
LOG.error("Failed to create ouput path: ", e); LOG.error("Failed to create ouput path: ", ex);
throw new KaaGeneratorException("Failed to create output path: " + e.toString()); throw new KaaGeneratorException("Failed to create output path: " + ex.toString());
} }
} }


Expand Down Expand Up @@ -158,9 +158,9 @@ private void prepareTemplates(boolean toFile) throws KaaGeneratorException {
} else { } else {
writeToStream(hdrWriter, srcWriter); writeToStream(hdrWriter, srcWriter);
} }
} catch (Exception e) { } catch (Exception ex) {
LOG.error("Failed to prepare source templates: ", e); LOG.error("Failed to prepare source templates: ", ex);
throw new KaaGeneratorException("Failed to prepare source templates: " + e.toString()); throw new KaaGeneratorException("Failed to prepare source templates: " + ex.toString());
} }
} }


Expand Down Expand Up @@ -199,9 +199,9 @@ public Set<Schema> generate() throws KaaGeneratorException {


LOG.debug("Sources were successfully generated"); LOG.debug("Sources were successfully generated");
return schemaGenerationQueue.keySet(); return schemaGenerationQueue.keySet();
} catch (Exception e) { } catch (Exception ex) {
LOG.error("Failed to generate C sources: ", e); LOG.error("Failed to generate C sources: ", ex);
throw new KaaGeneratorException("Failed to generate sources: " + e.toString()); throw new KaaGeneratorException("Failed to generate sources: " + ex.toString());
} finally { } finally {
headerWriter.close(); headerWriter.close();
sourceWriter.close(); sourceWriter.close();
Expand Down
Expand Up @@ -83,9 +83,9 @@ public BucketInfo addLogRecord(LogRecord record) {
if (insertStatement == null) { if (insertStatement == null) {
try { try {
insertStatement = database.compileStatement(PersistentLogStorageConstants.KAA_INSERT_NEW_RECORD); insertStatement = database.compileStatement(PersistentLogStorageConstants.KAA_INSERT_NEW_RECORD);
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Can't create row insert statement", e); Log.e(TAG, "Can't create row insert statement", ex);
throw new RuntimeException(e); throw new RuntimeException(ex);
} }
} }
long leftConsumedSize = maxBucketSize - currentBucketSize; long leftConsumedSize = maxBucketSize - currentBucketSize;
Expand Down Expand Up @@ -136,13 +136,13 @@ public LogBucket getNextBucket() {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
bucketId = cursor.getInt(0); bucketId = cursor.getInt(0);
} }
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Can't retrieve min bucket ID", e); Log.e(TAG, "Can't retrieve min bucket ID", ex);
} finally { } finally {
try { try {
tryCloseCursor(cursor); tryCloseCursor(cursor);
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Unable to close cursor", e); Log.e(TAG, "Unable to close cursor", ex);
} }
} }


Expand Down Expand Up @@ -178,13 +178,13 @@ public LogBucket getNextBucket() {
Log.i(TAG, "No unmarked log records found"); Log.i(TAG, "No unmarked log records found");
} }
} }
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Can't retrieve unmarked records from storage", e); Log.e(TAG, "Can't retrieve unmarked records from storage", ex);
} finally { } finally {
try { try {
tryCloseCursor(cursor); tryCloseCursor(cursor);
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Unable to close cursor", e); Log.e(TAG, "Unable to close cursor", ex);
} }
} }
return logBlock; return logBlock;
Expand All @@ -210,8 +210,8 @@ private void updateBucketState(int bucketId) {
Log.w(TAG, "No log records were updated"); Log.w(TAG, "No log records were updated");
} }


} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Failed to update state for bucket [" + bucketId + "]", e); Log.e(TAG, "Failed to update state for bucket [" + bucketId + "]", ex);
} }
} }
} }
Expand All @@ -223,9 +223,9 @@ public void removeBucket(int recordBlockId) {
if (deleteByBucketIdStatement == null) { if (deleteByBucketIdStatement == null) {
try { try {
deleteByBucketIdStatement = database.compileStatement(PersistentLogStorageConstants.KAA_DELETE_BY_BUCKET_ID); deleteByBucketIdStatement = database.compileStatement(PersistentLogStorageConstants.KAA_DELETE_BY_BUCKET_ID);
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Can't create record block deletion statement", e); Log.e(TAG, "Can't create record block deletion statement", ex);
throw new RuntimeException(e); throw new RuntimeException(ex);
} }
} }


Expand All @@ -241,8 +241,8 @@ public void removeBucket(int recordBlockId) {
} else { } else {
Log.i(TAG, "No records were removed from storage"); Log.i(TAG, "No records were removed from storage");
} }
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Failed to remove record block with id [" + recordBlockId + "]", e); Log.e(TAG, "Failed to remove record block with id [" + recordBlockId + "]", ex);
} }
} }
} }
Expand All @@ -254,9 +254,9 @@ public void rollbackBucket(int bucketId) {
if (resetBucketIdStatement == null) { if (resetBucketIdStatement == null) {
try { try {
resetBucketIdStatement = database.compileStatement(PersistentLogStorageConstants.KAA_RESET_BY_BUCKET_ID); resetBucketIdStatement = database.compileStatement(PersistentLogStorageConstants.KAA_RESET_BY_BUCKET_ID);
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Can't create bucket id reset statement", e); Log.e(TAG, "Can't create bucket id reset statement", ex);
throw new RuntimeException(e); throw new RuntimeException(ex);
} }
} }


Expand All @@ -274,8 +274,8 @@ public void rollbackBucket(int bucketId) {
Log.i(TAG, "No log records for bucket with id: [" + bucketId + "]"); Log.i(TAG, "No log records for bucket with id: [" + bucketId + "]");
} }


} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Failed to reset bucket with id [" + bucketId + "]", e); Log.e(TAG, "Failed to reset bucket with id [" + bucketId + "]", ex);
} }
} }
} }
Expand Down Expand Up @@ -325,14 +325,14 @@ private void retrieveBucketId() {


this.currentBucketId = ++currentBucketId; this.currentBucketId = ++currentBucketId;
} }
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Can't create select max bucket ID statement", e); Log.e(TAG, "Can't create select max bucket ID statement", ex);
throw new RuntimeException("Can't create select max bucket ID statement"); throw new RuntimeException("Can't create select max bucket ID statement");
} finally { } finally {
try { try {
tryCloseCursor(cursor); tryCloseCursor(cursor);
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Unable to close cursor", e); Log.e(TAG, "Unable to close cursor", ex);
} }
} }
} }
Expand Down Expand Up @@ -366,8 +366,8 @@ private void truncateIfBucketSizeIncompatible() {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
lastSavedBucketSize = cursor.getInt(0); lastSavedBucketSize = cursor.getInt(0);
} }
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Cannot retrieve storage param: bucketSize", e); Log.e(TAG, "Cannot retrieve storage param: bucketSize", ex);
throw new RuntimeException("Cannot retrieve storage param: bucketSize"); throw new RuntimeException("Cannot retrieve storage param: bucketSize");
} finally { } finally {
tryCloseCursor(cursor); tryCloseCursor(cursor);
Expand All @@ -379,8 +379,8 @@ private void truncateIfBucketSizeIncompatible() {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
lastSavedRecordCount = cursor.getInt(0); lastSavedRecordCount = cursor.getInt(0);
} }
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Cannot retrieve storage param: recordCount", e); Log.e(TAG, "Cannot retrieve storage param: recordCount", ex);
throw new RuntimeException("Cannot retrieve storage param: recordCount"); throw new RuntimeException("Cannot retrieve storage param: recordCount");
} finally { } finally {
tryCloseCursor(cursor); tryCloseCursor(cursor);
Expand All @@ -390,8 +390,8 @@ private void truncateIfBucketSizeIncompatible() {
if (lastSavedBucketSize != maxBucketSize || lastSavedRecordCount != maxRecordCount) { if (lastSavedBucketSize != maxBucketSize || lastSavedRecordCount != maxRecordCount) {
database.execSQL(PersistentLogStorageConstants.KAA_DELETE_ALL_DATA); database.execSQL(PersistentLogStorageConstants.KAA_DELETE_ALL_DATA);
} }
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Can't prepare delete statement", e); Log.e(TAG, "Can't prepare delete statement", ex);
throw new RuntimeException("Can't prepare delete statement"); throw new RuntimeException("Can't prepare delete statement");
} finally { } finally {
tryCloseCursor(cursor); tryCloseCursor(cursor);
Expand All @@ -411,8 +411,8 @@ private void updateStorageParams() {
updateInfoStatement.bindString(1, PersistentLogStorageConstants.STORAGE_RECORD_COUNT); updateInfoStatement.bindString(1, PersistentLogStorageConstants.STORAGE_RECORD_COUNT);
updateInfoStatement.bindLong(2, maxRecordCount); updateInfoStatement.bindLong(2, maxRecordCount);
updateInfoStatement.execute(); updateInfoStatement.execute();
} catch (SQLiteException e) { } catch (SQLiteException ex) {
Log.e(TAG, "Can't prepare update storage info statement", e); Log.e(TAG, "Can't prepare update storage info statement", ex);
throw new RuntimeException("Can't prepare update storage info statement"); throw new RuntimeException("Can't prepare update storage info statement");
} finally { } finally {
tryCloseStatement(updateInfoStatement); tryCloseStatement(updateInfoStatement);
Expand Down
Expand Up @@ -246,15 +246,15 @@ public void run() {
if (stateListener != null) { if (stateListener != null) {
stateListener.onStarted(); stateListener.onStarted();
} }
} catch (TransportException e) { } catch (TransportException ex) {
LOG.error("Start failed", e); LOG.error("Start failed", ex);
if (stateListener != null) { if (stateListener != null) {
stateListener.onStartFailure(new KaaClusterConnectionException(e)); stateListener.onStartFailure(new KaaClusterConnectionException(ex));
} }
} catch (KaaRuntimeException e) { } catch (KaaRuntimeException ex) {
LOG.error("Start failed", e); LOG.error("Start failed", ex);
if (stateListener != null) { if (stateListener != null) {
stateListener.onStartFailure(new KaaException(e)); stateListener.onStartFailure(new KaaException(ex));
} }
} }
} }
Expand Down Expand Up @@ -317,10 +317,10 @@ public void run() {
if (stateListener != null) { if (stateListener != null) {
stateListener.onPaused(); stateListener.onPaused();
} }
} catch (Exception e) { } catch (Exception ex) {
LOG.error("Pause failed", e); LOG.error("Pause failed", ex);
if (stateListener != null) { if (stateListener != null) {
stateListener.onPauseFailure(new KaaException(e)); stateListener.onPauseFailure(new KaaException(ex));
} }
} }
} }
Expand All @@ -342,10 +342,10 @@ public void run() {
if (stateListener != null) { if (stateListener != null) {
stateListener.onResume(); stateListener.onResume();
} }
} catch (Exception e) { } catch (Exception ex) {
LOG.error("Resume failed", e); LOG.error("Resume failed", ex);
if (stateListener != null) { if (stateListener != null) {
stateListener.onResumeFailure(new KaaException(e)); stateListener.onResumeFailure(new KaaException(ex));
} }
} }
} }
Expand Down
Expand Up @@ -53,12 +53,12 @@ public static KaaClient newClient(KaaClientPlatformContext context, KaaClientSta
boolean isAutogeneratedKeys) throws KaaRuntimeException { boolean isAutogeneratedKeys) throws KaaRuntimeException {
try { try {
return new BaseKaaClient(context, listener, isAutogeneratedKeys); return new BaseKaaClient(context, listener, isAutogeneratedKeys);
} catch (GeneralSecurityException e) { } catch (GeneralSecurityException ex) {
LOG.error("Failed to create Kaa client", e); LOG.error("Failed to create Kaa client", ex);
throw new KaaUnsupportedPlatformException(e); throw new KaaUnsupportedPlatformException(ex);
} catch (IOException e) { } catch (IOException ex) {
LOG.error("Failed to create Kaa client", e); LOG.error("Failed to create Kaa client", ex);
throw new KaaInvalidConfigurationException(e); throw new KaaInvalidConfigurationException(ex);
} }
} }
} }
Expand Up @@ -118,8 +118,8 @@ public byte[] getPropertiesHash() {
updateDigest(digest, SDK_TOKEN); updateDigest(digest, SDK_TOKEN);


propertiesHash = digest.digest(); propertiesHash = digest.digest();
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException ex) {
LOG.warn("Failed to calculate hash for SDK properties: {}", e); LOG.warn("Failed to calculate hash for SDK properties: {}", ex);
} }
} }


Expand Down
Expand Up @@ -199,8 +199,8 @@ private void resolveFailoverStatus(FailoverStatus status) {
public void run() { public void run() {
try { try {
receiveOperationsServerList(); receiveOperationsServerList();
} catch (TransportException e) { } catch (TransportException ex) {
LOG.error("Error while receiving operations service list", e); LOG.error("Error while receiving operations service list", ex);
} }
} }
}, retryPeriod, TimeUnit.MILLISECONDS); }, retryPeriod, TimeUnit.MILLISECONDS);
Expand All @@ -214,8 +214,8 @@ public void run() {
public void run() { public void run() {
try { try {
receiveOperationsServerList(); receiveOperationsServerList();
} catch (TransportException e) { } catch (TransportException ex) {
LOG.error("Error while receiving operations service list", e); LOG.error("Error while receiving operations service list", ex);
} }
} }
}, retryPeriod, TimeUnit.MILLISECONDS); }, retryPeriod, TimeUnit.MILLISECONDS);
Expand Down
Expand Up @@ -44,9 +44,9 @@ public IPTransportInfo(TransportConnectionInfo parent) {
buf.get(publicKeyData); buf.get(publicKeyData);
try { try {
this.publicKey = KeyUtil.getPublic(publicKeyData); this.publicKey = KeyUtil.getPublic(publicKeyData);
} catch (InvalidKeyException e) { } catch (InvalidKeyException ex) {
LOG.error("Can't initialize public key", e); LOG.error("Can't initialize public key", ex);
throw new RuntimeException(e); throw new RuntimeException(ex);
} }
byte[] hostData = new byte[buf.getInt()]; byte[] hostData = new byte[buf.getInt()];
buf.get(hostData); buf.get(hostData);
Expand Down
Expand Up @@ -535,11 +535,11 @@ public void run() {
LOG.debug("[{}] Going to invoke sync method", channel.getId()); LOG.debug("[{}] Going to invoke sync method", channel.getId());
channel.sync(task.getTypes()); channel.sync(task.getTypes());
} }
} catch (InterruptedException e) { } catch (InterruptedException ex) {
if (stop) { if (stop) {
LOG.debug("[{}] Worker is interrupted.", channel.getId()); LOG.debug("[{}] Worker is interrupted.", channel.getId());
} else { } else {
LOG.warn("[{}] Worker is interrupted.", channel.getId(), e); LOG.warn("[{}] Worker is interrupted.", channel.getId(), ex);
} }
} }
} }
Expand Down
Expand Up @@ -90,12 +90,12 @@ public void run() {
try { try {
processTypes(SUPPORTED_TYPES); processTypes(SUPPORTED_TYPES);
connectionFailed(false); connectionFailed(false);
} catch (Exception e) { } catch (Exception ex) {
if (!isShutdown()) { if (!isShutdown()) {
LOG.error("Failed to receive operation servers list {}", e); LOG.error("Failed to receive operation servers list {}", ex);
connectionFailed(true); connectionFailed(true);
} else { } else {
LOG.debug("Failed to receive operation servers list {}", e); LOG.debug("Failed to receive operation servers list {}", ex);
} }
} }
} }
Expand Down

0 comments on commit 653253f

Please sign in to comment.