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.Compiler;

public class Main {
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}");
}

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();
} catch (Exception e) {
System.err.println("Compilation failure: " + e.toString());
} catch (Exception ex) {
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 sourcePath = outputPath + File.separator + generatedSourceName + getSourceExtension();

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

this.headerWriter = new PrintWriter(new BufferedWriter(new FileWriter(headerPath, true)));
this.sourceWriter = new PrintWriter(new BufferedWriter(new FileWriter(sourcePath, true)));
} catch (Exception e) {
LOG.error("Failed to create ouput path: ", e);
throw new KaaGeneratorException("Failed to create output path: " + e.toString());
} catch (Exception ex) {
LOG.error("Failed to create ouput path: ", ex);
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 {
writeToStream(hdrWriter, srcWriter);
}
} catch (Exception e) {
LOG.error("Failed to prepare source templates: ", e);
throw new KaaGeneratorException("Failed to prepare source templates: " + e.toString());
} catch (Exception ex) {
LOG.error("Failed to prepare source templates: ", ex);
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");
return schemaGenerationQueue.keySet();
} catch (Exception e) {
LOG.error("Failed to generate C sources: ", e);
throw new KaaGeneratorException("Failed to generate sources: " + e.toString());
} catch (Exception ex) {
LOG.error("Failed to generate C sources: ", ex);
throw new KaaGeneratorException("Failed to generate sources: " + ex.toString());
} finally {
headerWriter.close();
sourceWriter.close();
Expand Down
Expand Up @@ -83,9 +83,9 @@ public BucketInfo addLogRecord(LogRecord record) {
if (insertStatement == null) {
try {
insertStatement = database.compileStatement(PersistentLogStorageConstants.KAA_INSERT_NEW_RECORD);
} catch (SQLiteException e) {
Log.e(TAG, "Can't create row insert statement", e);
throw new RuntimeException(e);
} catch (SQLiteException ex) {
Log.e(TAG, "Can't create row insert statement", ex);
throw new RuntimeException(ex);
}
}
long leftConsumedSize = maxBucketSize - currentBucketSize;
Expand Down Expand Up @@ -136,13 +136,13 @@ public LogBucket getNextBucket() {
if (cursor.moveToFirst()) {
bucketId = cursor.getInt(0);
}
} catch (SQLiteException e) {
Log.e(TAG, "Can't retrieve min bucket ID", e);
} catch (SQLiteException ex) {
Log.e(TAG, "Can't retrieve min bucket ID", ex);
} finally {
try {
tryCloseCursor(cursor);
} catch (SQLiteException e) {
Log.e(TAG, "Unable to close cursor", e);
} catch (SQLiteException ex) {
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");
}
}
} catch (SQLiteException e) {
Log.e(TAG, "Can't retrieve unmarked records from storage", e);
} catch (SQLiteException ex) {
Log.e(TAG, "Can't retrieve unmarked records from storage", ex);
} finally {
try {
tryCloseCursor(cursor);
} catch (SQLiteException e) {
Log.e(TAG, "Unable to close cursor", e);
} catch (SQLiteException ex) {
Log.e(TAG, "Unable to close cursor", ex);
}
}
return logBlock;
Expand All @@ -210,8 +210,8 @@ private void updateBucketState(int bucketId) {
Log.w(TAG, "No log records were updated");
}

} catch (SQLiteException e) {
Log.e(TAG, "Failed to update state for bucket [" + bucketId + "]", e);
} catch (SQLiteException ex) {
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) {
try {
deleteByBucketIdStatement = database.compileStatement(PersistentLogStorageConstants.KAA_DELETE_BY_BUCKET_ID);
} catch (SQLiteException e) {
Log.e(TAG, "Can't create record block deletion statement", e);
throw new RuntimeException(e);
} catch (SQLiteException ex) {
Log.e(TAG, "Can't create record block deletion statement", ex);
throw new RuntimeException(ex);
}
}

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

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

propertiesHash = digest.digest();
} catch (NoSuchAlgorithmException e) {
LOG.warn("Failed to calculate hash for SDK properties: {}", e);
} catch (NoSuchAlgorithmException ex) {
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() {
try {
receiveOperationsServerList();
} catch (TransportException e) {
LOG.error("Error while receiving operations service list", e);
} catch (TransportException ex) {
LOG.error("Error while receiving operations service list", ex);
}
}
}, retryPeriod, TimeUnit.MILLISECONDS);
Expand All @@ -214,8 +214,8 @@ public void run() {
public void run() {
try {
receiveOperationsServerList();
} catch (TransportException e) {
LOG.error("Error while receiving operations service list", e);
} catch (TransportException ex) {
LOG.error("Error while receiving operations service list", ex);
}
}
}, retryPeriod, TimeUnit.MILLISECONDS);
Expand Down
Expand Up @@ -44,9 +44,9 @@ public IPTransportInfo(TransportConnectionInfo parent) {
buf.get(publicKeyData);
try {
this.publicKey = KeyUtil.getPublic(publicKeyData);
} catch (InvalidKeyException e) {
LOG.error("Can't initialize public key", e);
throw new RuntimeException(e);
} catch (InvalidKeyException ex) {
LOG.error("Can't initialize public key", ex);
throw new RuntimeException(ex);
}
byte[] hostData = new byte[buf.getInt()];
buf.get(hostData);
Expand Down
Expand Up @@ -535,11 +535,11 @@ public void run() {
LOG.debug("[{}] Going to invoke sync method", channel.getId());
channel.sync(task.getTypes());
}
} catch (InterruptedException e) {
} catch (InterruptedException ex) {
if (stop) {
LOG.debug("[{}] Worker is interrupted.", channel.getId());
} 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 {
processTypes(SUPPORTED_TYPES);
connectionFailed(false);
} catch (Exception e) {
} catch (Exception ex) {
if (!isShutdown()) {
LOG.error("Failed to receive operation servers list {}", e);
LOG.error("Failed to receive operation servers list {}", ex);
connectionFailed(true);
} 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.