auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean sendUsingSmpp(String from, String to, String body, TlvSet tlvSet, Charset encoding) { if ((SmppClientOpsThread.getSmppSession() != null && SmppClientOpsThread.getSmppSession().isBound()) && smppMessageHandler != null) { if(logger.isInfoEnabled()) { logger.info("SMPP session is available and connected, outbound message will be forwarded to : " + to ); logger.info("Encoding: " + encoding ); } SmsMessage record = (SmsMessage)this.attributes.get("record"); Sid sid = null; if(record!=null) { sid = record.getSid(); logger.error("record sid = "+sid.toString()); }else{ logger.error("record is null"); } try { final SmppOutboundMessageEntity sms = new SmppOutboundMessageEntity(to, from, body, encoding, tlvSet, sid); smppMessageHandler.tell(sms, null); }catch (final Exception exception) { logger.error("There was an error sending SMS to SMPP endpoint : " + exception); } return true; } return false; }

Target:
private boolean sendUsingSmpp(String from, String to, String body, TlvSet tlvSet, Charset encoding) { if ((SmppClientOpsThread.getSmppSession() != null && SmppClientOpsThread.getSmppSession().isBound()) && smppMessageHandler != null) { if(logger.isInfoEnabled()) { logger.info("SMPP session is available and connected, outbound message will be forwarded to : " + to ); logger.info("Encoding: " + encoding ); } SmsMessage record = (SmsMessage)this.attributes.get("record"); Sid sid = null; if(record!=null) { sid = record.getSid(); if(logger.isInfoEnabled()) { logger.info("record sid = "+sid.toString()); } }else{ logger.error("record is null"); } try { final SmppOutboundMessageEntity sms = new SmppOutboundMessageEntity(to, from, body, encoding, tlvSet, sid); smppMessageHandler.tell(sms, null); }catch (final Exception exception) { logger.error("There was an error sending SMS to SMPP endpoint : " + exception); } return true; } return false; }
Source:
public GenericEdge(GenericVertexRef source, GenericVertexRef target, Map<String, Object> properties) { super(properties); this.source = Objects.requireNonNull(source); this.target = Objects.requireNonNull(target); if(!source.getNamespace().equals(getNamespace()) && !target.getNamespace().equals(getNamespace())) { throw new IllegalArgumentException( String.format("Neither the namespace of the source VertexRef(namespace=%s) nor the target VertexRef(%s) matches our namespace=%s", source.getNamespace(), target.getNamespace(), getNamespace())); } this.setId(source.getNamespace() + ":" + source.getId() + "->" + target.getNamespace() + ":" + target.getId()); }

Target:
private GenericEdge(GenericVertexRef source, GenericVertexRef target, Map<String, Object> properties) { super(properties); this.source = Objects.requireNonNull(source); this.target = Objects.requireNonNull(target); if(!source.getNamespace().equals(getNamespace()) && !target.getNamespace().equals(getNamespace())) { throw new IllegalArgumentException( String.format("Neither the namespace of the source VertexRef(namespace=%s) nor the target VertexRef(%s) matches our namespace=%s", source.getNamespace(), target.getNamespace(), getNamespace())); } this.setId(source.getNamespace() + ":" + source.getId() + "->" + target.getNamespace() + ":" + target.getId()); }
Source:
private void notifyPacketReceived(final XBeePacket packet) { try { synchronized (packetReceiveListeners) { final ArrayList<IPacketReceiveListener> removeListeners = new ArrayList<IPacketReceiveListener>(); ScheduledExecutorService executor = Executors.newScheduledThreadPool(packetReceiveListeners.size()); for (final IPacketReceiveListener listener:packetReceiveListeners.keySet()) { executor.execute(new Runnable() { public void run() { if (packetReceiveListeners.get(listener) == ALL_FRAME_IDS) listener.packetReceived(packet); else if (((XBeeAPIPacket)packet).hasAPIFrameID() && ((XBeeAPIPacket)packet).getFrameID() == packetReceiveListeners.get(listener)) { listener.packetReceived(packet); removeListeners.add(listener); } } }); } executor.shutdown(); for (IPacketReceiveListener listener:removeListeners) packetReceiveListeners.remove(listener); } } catch (Exception e) { e.printStackTrace(); } }

Target:
private void notifyPacketReceived(final XBeePacket packet) { try { synchronized (packetReceiveListeners) { final ArrayList<IPacketReceiveListener> removeListeners = new ArrayList<IPacketReceiveListener>(); ScheduledExecutorService executor = Executors.newScheduledThreadPool(Math.min(MAXIMUM_PARALLEL_LISTENER_THREADS, packetReceiveListeners.size())); for (final IPacketReceiveListener listener:packetReceiveListeners.keySet()) { executor.execute(new Runnable() { public void run() { if (packetReceiveListeners.get(listener) == ALL_FRAME_IDS) listener.packetReceived(packet); else if (((XBeeAPIPacket)packet).needsAPIFrameID() && ((XBeeAPIPacket)packet).getFrameID() == packetReceiveListeners.get(listener)) { listener.packetReceived(packet); removeListeners.add(listener); } } }); } executor.shutdown(); for (IPacketReceiveListener listener:removeListeners) packetReceiveListeners.remove(listener); } } catch (Exception e) { e.printStackTrace(); } }
Source:
public static long inMillis(String durationStr) { String[] parts = durationStr.trim().split(":"); if (parts.length == 1) { return toMillis(parts[0]); } else if (parts.length == 2) { return toMillis("0", parts[0], parts[1]); } else if (parts.length == 3) { return toMillis(parts[0], parts[1], parts[2]); } else { throw new NumberFormatException(); } }

Target:
public static long inMillis(String durationStr) throws NumberFormatException { String[] parts = durationStr.trim().split(":"); if (parts.length == 1) { return toMillis(parts[0]); } else if (parts.length == 2) { return toMillis("0", parts[0], parts[1]); } else if (parts.length == 3) { return toMillis(parts[0], parts[1], parts[2]); } else { throw new NumberFormatException(); } }
Source:
public void lowerBoundDifferentNumberOfTokens() { Map<String, TrackingToken> newTokens = new HashMap<>(); newTokens.put("token1", new GlobalSequenceTrackingToken(1)); Map<String, TrackingToken> expectedTokens = new HashMap<>(); expectedTokens.put("token1", new GlobalSequenceTrackingToken(0)); expectedTokens.put("token2", new GlobalSequenceTrackingToken(0)); ; MultiSourceTrackingToken newMultiToken = (MultiSourceTrackingToken) testSubject .lowerBound(new MultiSourceTrackingToken(newTokens)); }

Target:
public void lowerBoundDifferentNumberOfTokens() { Map<String, TrackingToken> newTokens = new HashMap<>(); newTokens.put("token1", new GlobalSequenceTrackingToken(1)); testSubject.lowerBound(new MultiSourceTrackingToken(newTokens)); }
Source:
public ScreenshotSize get() { if (config.getScreenshotSize() == ScreenshotSize.DOUBLE_SIZE) { return ScreenshotSize.DOUBLE_SIZE; } else if (config.getScreenshotSize() == ScreenshotSize.NORMAL_SIZE) { return ScreenshotSize.NORMAL_SIZE; } else if (config.getScreenshotSize() == ScreenshotSize.HALF_SIZE) { return ScreenshotSize.HALF_SIZE; } else if (config.getScreenshotSize() == ScreenshotSize.QUARTER_SIZE) { return ScreenshotSize.QUARTER_SIZE; } else { return ScreenshotSize.NORMAL_SIZE; } }

Target:
public ScreenshotSize get() { if(config.getScreenshotSize() != null) { return config.getScreenshotSize(); } else { return ScreenshotSize.NORMAL_SIZE; } }
Source:
private String getNextRunMessage(String field) { if (field.equals("minAllocatedMem")) { String translated = nextRunMessages.minAllocatedMem(); try { translated = nextRunMessages.getString("minAllocatedMem"); } catch (MissingResourceException e) { } return translated; } return field; }

Target:
private String getNextRunMessage(String field) { try { return nextRunMessages.getString(field); } catch (MissingResourceException e) { } return field; }
Source:
public void error(String message, Throwable t) { LoggerFactory lf = getLoggerFactory(); if (lf == null) { parentServletContext.log(message, t); } else { lf.getLogger(consumingContext.getBundle(), HttpServiceRuntimeImpl.class.getName(), Logger.class).error("{}", message, t); } }

Target:
public void error(String message, Throwable t) { Logger logger = loggerFactoryTracker.getService(); if (logger == null) { parentServletContext.log(String.valueOf(message), t); } else { logger.error(String.valueOf(message), t); } }
Source:
public String confirmation(@QueryParam("hash") String hash) throws Exception { QueryFactory query = orcsApi.getQueryFactory(null); AccountInfoData info = accountOps.getAccountData(accountId); int groupId = 0; int userId = 0; String[] combined = EncryptUtility.decrypt(hash, SECRET).split(":"); userId = Integer.parseInt(combined[0]); groupId = Integer.parseInt(combined[1]); if (info.getAccountId() != userId) { throw new OseeCoreException(String.format("Invalid hash[%s] in request", hash)); } ArtifactReadable user = query.fromBranch(COMMON).andLocalId(userId).getResults().getExactlyOne(); ArtifactReadable group = query.fromBranch(COMMON).andLocalId(groupId).getResults().getExactlyOne(); ResourceToken token = new ClassBasedResourceToken("groupUnsubscribe.html", getClass()); return PageFactory.realizePage(orcsApi.getResourceRegistry(), token, "userName", user.getName(), "groupName", group.getName(), "hash", hash); }

Target:
public String confirmation(@QueryParam("hash") String hash) throws Exception { Conditions.checkNotNull(hash, "Hash parameter"); QueryFactory query = orcsApi.getQueryFactory(null); AccountInfoData info = accountOps.getAccountData(accountId); int groupId = 0; int userId = 0; String[] combined = EncryptUtility.decrypt(hash, SECRET).split(":"); userId = Integer.parseInt(combined[0]); groupId = Integer.parseInt(combined[1]); if (info.getAccountId() != userId) { throw new OseeCoreException(String.format("Invalid hash[%s] in request", hash)); } ArtifactReadable user = query.fromBranch(COMMON).andLocalId(userId).getResults().getExactlyOne(); ArtifactReadable group = query.fromBranch(COMMON).andLocalId(groupId).getResults().getExactlyOne(); ResourceToken token = new ClassBasedResourceToken("groupUnsubscribe.html", getClass()); return PageFactory.realizePage(orcsApi.getResourceRegistry(), token, "userName", user.getName(), "groupName", group.getName(), "hash", hash); }
Source:
private String signJsonWebSignature(JsonFactory jsonFactory, JsonWebSignature.Header header, JsonWebToken.Payload payload) throws IOException { String signedContentString = Base64.encodeBase64URLSafeString(jsonFactory.toByteArray(header)) + "." + Base64.encodeBase64URLSafeString(jsonFactory.toByteArray(payload)); byte[] signedContentBytes = StringUtils.getBytesUtf8(signedContentString); try { byte[] signature = this.sign(signedContentBytes); return signedContentString + "." + Base64.encodeBase64URLSafeString(signature); } catch (Exception e) { throw new IOException( "Error signing service account access token request with private key.", e); } }

Target:
private String signJsonWebSignature(JsonFactory jsonFactory, JsonWebSignature.Header header, JsonWebToken.Payload payload) throws IOException { String signedContentString = Base64.encodeBase64URLSafeString(jsonFactory.toByteArray(header)) + "." + Base64.encodeBase64URLSafeString(jsonFactory.toByteArray(payload)); byte[] signedContentBytes = StringUtils.getBytesUtf8(signedContentString); try { byte[] signature = this.sign(signedContentBytes); return signedContentString + "." + Base64.encodeBase64URLSafeString(signature); } catch (SigningException e) { throw new IOException( "Error signing service account access token request with private key.", e); } }
Source:
public static boolean hasOpenCvLoaded() { return OPEN_CV_LOADED; }

Target:
public static boolean hasOpenCvLoaded() { return openCvLoaded; }
Source:
private boolean isUseJournalStore() throws IOException { return operations.readAttribute(TRANSACTIONS_ADDRESS, USE_JOURNAL_STORE_ATTR).value().asBoolean(); }

Target:
private boolean isUseJournalStore() throws IOException { return operations.readAttribute(TRANSACTIONS_ADDRESS, USE_JOURNAL_STORE_ATTR).booleanValue(); }
Source:
public static void checkDataBlock( PropertyBlock block, CheckerEngine<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> engine, RecordAccess records ) { if ( block.getKeyIndexId() < 0 ) { engine.report().invalidPropertyKey( block ); } else { engine.comparativeCheck( records.propertyKey( block.getKeyIndexId() ), propertyKey( block ) ); } PropertyType type = block.forceGetType(); if ( type == null ) { engine.report().invalidPropertyType( block ); } else { switch ( type ) { case STRING: engine.comparativeCheck( records.string( block.getSingleValueLong() ), DynamicReference.string( block ) ); break; case ARRAY: engine.comparativeCheck( records.array( block.getSingleValueLong() ), DynamicReference.array( block ) ); break; default: try { type.getValueNow( block, null ); } catch ( Exception e ) { engine.report().invalidPropertyValue( block ); } break; } } }

Target:
public static void checkDataBlock( PropertyBlock block, CheckerEngine<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> engine, RecordAccess records ) { if ( block.getKeyIndexId() < 0 ) { engine.report().invalidPropertyKey( block ); } else { engine.comparativeCheck( records.propertyKey( block.getKeyIndexId() ), propertyKey( block ) ); } PropertyType type = block.forceGetType(); if ( type == null ) { engine.report().invalidPropertyType( block ); } else { switch ( type ) { case STRING: engine.comparativeCheck( records.string( block.getSingleValueLong() ), DynamicReference.string( block ) ); break; case ARRAY: engine.comparativeCheck( records.array( block.getSingleValueLong() ), DynamicReference.array( block ) ); break; default: try { type.value( block, null ); } catch ( Exception e ) { engine.report().invalidPropertyValue( block ); } break; } } }
Source:
public ValidationResult diskImagesBelongToSameImageGroup() { Guid imageGroupId = null; for (DiskImage diskImage : diskImages) { if (imageGroupId == null || diskImage.getId().equals(imageGroupId)) { imageGroupId = diskImage.getId(); continue; } return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_SNAPSHOTS_DONT_BELONG_TO_SAME_DISK, String.format("diskalias %s", diskImage.getDiskAlias())); } return ValidationResult.VALID; }

Target:
public ValidationResult diskImagesBelongToSameImageGroup() { Guid imageGroupId = null; for (DiskImage diskImage : diskImages) { if (imageGroupId == null || diskImage.getId().equals(imageGroupId)) { imageGroupId = diskImage.getId(); continue; } return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_SNAPSHOTS_DONT_BELONG_TO_SAME_DISK); } return ValidationResult.VALID; }
Source:
public void actionPerformed(ActionEvent e) { try { backend.resetCoordinateToZero('Z'); } catch (Exception ex) { GUIHelpers.displayErrorDialog(ex.getLocalizedMessage()); } }

Target:
public void actionPerformed(ActionEvent e) { try { backend.resetCoordinateToZero(Z); } catch (Exception ex) { GUIHelpers.displayErrorDialog(ex.getLocalizedMessage()); } }
Source:
public void setupAuthStrategies() { if (config.getBoolean(ConfigProperties.KEYCLOAK_AUTHENTICATION) && keycloakAdapterConfiguration.getAdapterConfig() != null) { providers.add(injector.getInstance(KeycloakAuth.class)); } if (config.getBoolean(ConfigProperties.OAUTH_AUTHENTICATION)) { providers.add(injector.getInstance(OAuth.class)); } if (config.getBoolean(ConfigProperties.BASIC_AUTHENTICATION)) { providers.add(injector.getInstance(BasicAuth.class)); } if (config.getBoolean(ConfigProperties.SSL_AUTHENTICATION)) { providers.add(injector.getInstance(SSLAuth.class)); } if (config.getBoolean(ConfigProperties.TRUSTED_AUTHENTICATION)) { providers.add(injector.getInstance(TrustedConsumerAuth.class)); providers.add(injector.getInstance(TrustedUserAuth.class)); } }

Target:
public void setupAuthStrategies() { if (config.getBoolean(ConfigProperties.KEYCLOAK_AUTHENTICATION)) { providers.add(injector.getInstance(KeycloakAuth.class)); } if (config.getBoolean(ConfigProperties.OAUTH_AUTHENTICATION)) { providers.add(injector.getInstance(OAuth.class)); } if (config.getBoolean(ConfigProperties.BASIC_AUTHENTICATION)) { providers.add(injector.getInstance(BasicAuth.class)); } if (config.getBoolean(ConfigProperties.SSL_AUTHENTICATION)) { providers.add(injector.getInstance(SSLAuth.class)); } if (config.getBoolean(ConfigProperties.TRUSTED_AUTHENTICATION)) { providers.add(injector.getInstance(TrustedConsumerAuth.class)); providers.add(injector.getInstance(TrustedUserAuth.class)); } }
Source:
public void updateIdentifiersEmailSignInUpdatePhone() { mockHealthCodeAndAccountRetrieval(); when(accountDao.authenticate(STUDY, EMAIL_PASSWORD_SIGN_IN)).thenReturn(account); when(accountDao.getAccount(any())).thenReturn(account); IdentifierUpdate update = new IdentifierUpdate(EMAIL_PASSWORD_SIGN_IN, null, TestConstants.PHONE, null); StudyParticipant returned = participantService.updateIdentifiers(STUDY, CONTEXT, update); assertEquals(TestConstants.PHONE, account.getPhone()); assertEquals(Boolean.FALSE, account.getPhoneVerified()); verify(accountDao).authenticate(STUDY, EMAIL_PASSWORD_SIGN_IN); verify(accountDao).updateAccount(eq(account), any()); verify(accountWorkflowService, never()).sendEmailVerificationToken(any(), any(), any()); assertEquals(PARTICIPANT.getId(), returned.getId()); }

Target:
public void updateIdentifiersEmailSignInUpdatePhone() { mockHealthCodeAndAccountRetrieval(); when(accountDao.authenticate(STUDY, EMAIL_PASSWORD_SIGN_IN)).thenReturn(account); when(accountDao.getAccount(any())).thenReturn(account); IdentifierUpdate update = new IdentifierUpdate(EMAIL_PASSWORD_SIGN_IN, null, TestConstants.PHONE, null); StudyParticipant returned = participantService.updateIdentifiers(STUDY, CONTEXT, update); assertEquals(TestConstants.PHONE, account.getPhone()); assertEquals(Boolean.FALSE, account.getPhoneVerified()); verify(accountDao).authenticate(STUDY, EMAIL_PASSWORD_SIGN_IN); verify(accountDao).updateAccount(eq(account), eq(null)); verify(accountWorkflowService, never()).sendEmailVerificationToken(any(), any(), any()); assertEquals(PARTICIPANT.getId(), returned.getId()); }
Source:
private boolean verifyLocalAvailableSpace(Set<Entity> entities) { val spaceRequired = downloadService.getSpaceRequired(entities); val spaceAvailable = getLocalAvailableSpace(); log.warn("space required: ({}) space available: ({})", FileUtils.byteCountToDisplaySize(spaceRequired), spaceRequired, FileUtils.byteCountToDisplaySize(spaceAvailable), spaceAvailable); if (spaceRequired > spaceAvailable) { terminal.printWarn("Insufficient space to download requested files: Require %s. %s Available", FileUtils.byteCountToDisplaySize(spaceRequired), FileUtils.byteCountToDisplaySize(spaceAvailable)); terminal.clearLine(); return false; } return true; }

Target:
private boolean verifyLocalAvailableSpace(Set<Entity> entities) { val spaceRequired = downloadService.getSpaceRequired(entities); val spaceAvailable = getLocalAvailableSpace(); log.warn("space required: ({}) space available: ({})", FormatUtils.formatBytes(spaceRequired), spaceRequired, FormatUtils.formatBytes(spaceAvailable), spaceAvailable); if (spaceRequired > spaceAvailable) { terminal.printWarn("Insufficient space to download requested files: Require %s. %s Available", FormatUtils.formatBytes(spaceRequired), FormatUtils.formatBytes(spaceAvailable)); terminal.clearLine(); return false; } return true; }
Source:
public void testBrokenStoreKeyConverter() throws Exception { InputAndExpected inputAndExpected = new InputAndExpected(pairList.get(0), VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0]); StoreCopier.Message output = transformer.transform(inputAndExpected.getInput()); verifyOutput(output, inputAndExpected.getExpected()); factory.setException(new BlobIdTransformerTestException()); inputAndExpected = new InputAndExpected(pairList.get(1), VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0]); try { transformer.transform(inputAndExpected.getInput()); fail("Did not throw StoreKeyConverterNotConvertedException"); } catch (StoreKeyConverter.StoreKeyConverterNotConvertedException e) { } factory.setException(null); inputAndExpected = new InputAndExpected(pairList.get(2), VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0]); output = transformer.transform(inputAndExpected.getInput()); verifyOutput(output, inputAndExpected.getExpected()); }

Target:
public void testBrokenStoreKeyConverter() throws Exception { InputAndExpected inputAndExpected = new InputAndExpected(pairList.get(0), VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0]); StoreCopier.Message output = transformer.transform(inputAndExpected.getInput()); verifyOutput(output, inputAndExpected.getExpected()); factory.setException(new BlobIdTransformerTestException()); inputAndExpected = new InputAndExpected(pairList.get(1), VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0]); try { transformer.transform(inputAndExpected.getInput()); fail("Did not throw IllegalStateException"); } catch (IllegalStateException e) { } factory.setException(null); inputAndExpected = new InputAndExpected(pairList.get(2), VALID_MESSAGE_FORMAT_INPUT_STREAM_IMPLS[0]); output = transformer.transform(inputAndExpected.getInput()); verifyOutput(output, inputAndExpected.getExpected()); }
Source:
public ProfitBricksImageExtension(ProfitBricksApi client, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, @Memoized Supplier<Set<? extends Location>> locations, @Named(POLL_PREDICATE_SNAPSHOT) Predicate<String> snapshotAvailablePredicate, Trackables trackables) { this.client = checkNotNull(client, "client"); this.userExecutor = checkNotNull(userExecutor, "userExecutor"); this.locations = checkNotNull(locations, "locations"); this.snapshotAvailablePredicate = checkNotNull(snapshotAvailablePredicate, "snapshotAvailablePredicate"); this.trackables = checkNotNull(trackables); }

Target:
ProfitBricksImageExtension(ProfitBricksApi client, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, @Memoized Supplier<Set<? extends Location>> locations, @Named(POLL_PREDICATE_SNAPSHOT) Predicate<String> snapshotAvailablePredicate, Trackables trackables) { this.client = client; this.userExecutor = userExecutor; this.locations = locations; this.snapshotAvailablePredicate = snapshotAvailablePredicate; this.trackables = trackables; }
Source:
private void updateTree() { long startTimeMs = SystemClock.elapsedRealtime(); ShadowDOM.Update domUpdate = createShadowDOMUpdate(); boolean isEmpty = domUpdate.isEmpty(); if (isEmpty) { domUpdate.abandon(); } else { applyDOMUpdate(domUpdate); } long endTimeMs = SystemClock.elapsedRealtime(); long deltaMs = endTimeMs - startTimeMs; LogUtil.e(String.format( "DOM.updateTree() completed in %s ms%s", Long.toString(deltaMs), isEmpty ? " (no changes)" : "")); }

Target:
private void updateTree() { long startTimeMs = SystemClock.elapsedRealtime(); ShadowDOM.Update domUpdate = createShadowDOMUpdate(); boolean isEmpty = domUpdate.isEmpty(); if (isEmpty) { domUpdate.abandon(); } else { applyDOMUpdate(domUpdate); } long deltaMs = SystemClock.elapsedRealtime() - startTimeMs; LogUtil.d( "DOM.updateTree() completed in %s ms%s", Long.toString(deltaMs), isEmpty ? " (no changes)" : ""); }
Source:
public Resource getPublishedResource(String path) throws ZebedeeException, IOException { try { return publishedContentReader.getResource(path); } catch (BadRequestException e) { return publishedContentReader.getResource(path + "/index.html"); } }

Target:
public Resource getPublishedResource(String path) throws ZebedeeException, IOException { try { return publishedContentReader.getResource(path); } catch (BadRequestException e) { if(path.startsWith("/visualisations/")) { return publishedContentReader.getResource(path + "/index.html"); } throw e; } }
Source:
void registerSelectorActiveConnections(final AtomicLong numActiveConnections) { Gauge<Long> selectorActiveConnectionsCount = new Gauge<Long>() { @Override public Long getValue() { return numActiveConnections.get(); } }; registry.register(MetricRegistry.name(Selector.class, selectorIndex++ + "SelectorActiveConnectionsCount"), selectorActiveConnectionsCount); }

Target:
void registerSelectorActiveConnections(final AtomicLong numActiveConnections) { selectorActiveConnectionsList.add(numActiveConnections); }
Source:
SSLSocketFactory sslSocketFactory(Provider<Credentials> credentials) { List<Object> creds = ListCredentials.asList(credentials.get()); String keystorePath = creds.get(0).toString(); String keystorePassword = creds.get(1).toString(); try { BufferedInputStream keystoreStream = new BufferedInputStream(new FileInputStream(keystorePath)); keystoreStream.mark(1024); KeyStore keystore = KeyStore.getInstance("JKS"); try { keystore.load(keystoreStream, keystorePassword.toCharArray()); } catch (IOException e) { if (!"Invalid keystore format".equals(e.getMessage())) throw e; keystoreStream.reset(); keystore = KeyStore.getInstance("PKCS12"); keystore.load(keystoreStream, keystorePassword.toCharArray()); } KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init(keystore, keystorePassword.toCharArray()); KeyManager[] km = kmf.getKeyManagers(); SSLContext context = SSLContext.getInstance("TLSv1.1"); context.init(km, null, null); return context.getSocketFactory(); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Keystore file not found"); } catch (IOException e) { throw new IllegalArgumentException("Keystore could not be read"); } catch (GeneralSecurityException e) { throw new IllegalArgumentException("Keystore could not be initialised"); } }

Target:
SSLSocketFactory sslSocketFactory(Provider<Credentials> credentials) { List<Object> creds = ListCredentials.asList(credentials.get()); String cert = creds.get(0).toString(); String key = creds.get(1).toString(); try { Certificate certObj = Pems.readCertificate(cert); PrivateKey keyObj = Pems.readPrivateKey(key); KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); KeyStore keyStore = KeyStore.getInstance("PKCS12"); keyStore.load(null, null); keyStore.setKeyEntry("dummy alias", keyObj, null, new Certificate[] { certObj }); kmf.init(keyStore, null); SSLContext context = SSLContext.getInstance("TLSv1.1"); context.init(kmf.getKeyManagers(), null, null); return context.getSocketFactory(); } catch (IOException e) { throw new IllegalArgumentException("Key or certificate could not be read"); } catch (GeneralSecurityException e) { throw new IllegalArgumentException("Key or certificate could not be initialised"); } }
Source:
boolean testRow(final int i, final long startTime) throws IOException { try { RegionInfo regionInfo = connection.getRegionLocator(table.getName()) .getRegionLocation(getSplitKey(i), false).getRegion(); if (LOG.isDebugEnabled()) { LOG.debug("deleting region from meta: " + regionInfo); } Delete delete = MetaTableAccessor .makeDeleteFromRegionInfo(regionInfo, HConstants.LATEST_TIMESTAMP); try (Table t = MetaTableAccessor.getMetaHTable(connection)) { t.delete(delete); } } catch (IOException ie) { LOG.error("cannot find region with start key: " + i); } return true; }

Target:
boolean testRow(final int i, final long startTime) throws IOException { try { RegionInfo regionInfo = connection.getRegionLocator(table.getName()) .getRegionLocation(getSplitKey(i), false).getRegion(); LOG.debug("deleting region from meta: " + regionInfo); Delete delete = MetaTableAccessor .makeDeleteFromRegionInfo(regionInfo, HConstants.LATEST_TIMESTAMP); try (Table t = MetaTableAccessor.getMetaHTable(connection)) { t.delete(delete); } } catch (IOException ie) { LOG.error("cannot find region with start key: " + i); } return true; }
Source:
private void handleTagNamesMessage(final TagNamesMessage message) { if (message.isFailure()) { LOGGER.warn( "Failed to get tag names for metric " + message.getMetricName(), message.getThrowable()); getSelf().tell(FETCH_METRIC, ActorRef.noSender()); } else { _periodsInFlight = Lists.newArrayList(RollupPeriod.values()); final String metricName = message.getMetricName(); for (final RollupPeriod period : RollupPeriod.values()) { PatternsCS.pipe( fetchLastDataPoint(metricName + period.getSuffix(), period) .handle((response, failure) -> buildLastDataPointResponse(metricName, period, message.getTagNames(), response, failure) ), getContext().dispatcher()) .to(getSelf()); } } }

Target:
private void handleTagNamesMessage(final TagNamesMessage message) { _metrics.recordCounter("rollup/tag_names_message/received", 1); if (message.isFailure()) { LOGGER.warn() .setMessage("Failed to get tag names for metric.") .addData("metricName", message.getMetricName()) .setThrowable(message.getFailure().get()) .log(); getSelf().tell(FETCH_METRIC, ActorRef.noSender()); } else { _periodsInFlight = Lists.newArrayList(RollupPeriod.values()); final String metricName = message.getMetricName(); final long startTime = System.nanoTime(); for (final RollupPeriod period : RollupPeriod.values()) { PatternsCS.pipe( fetchLastDataPoint(metricName + period.getSuffix(), period) .handle((response, failure) -> { final String baseMetricName = "rollup/last_data_point_" + period.name().toLowerCase(); _metrics.recordCounter(baseMetricName + "/success", failure == null ? 1 : 0); _metrics.recordTimer( baseMetricName + "/request", System.nanoTime() - startTime, Optional.of(Units.NANOSECOND)); return buildLastDataPointResponse(metricName, period, message.getTagNames(), response, failure); }), getContext().dispatcher()) .to(getSelf()); } } }
Source:
private void setFocusToFilterBox() { if (TestController.isTestMode()) { ui.triggerEvent(new UIComponentFocusEvent(UIComponentFocusEvent.EventType.FILTER_BOX)); } filterTextField.requestFocus(); filterTextField.setText(filterTextField.getText().trim()); filterTextField.positionCaret(filterTextField.getLength()); addEventHandler(KeyEvent.KEY_PRESSED, event -> { if (KeyboardShortcuts.downIssue.match(event) || KeyboardShortcuts.upIssue.match(event)) { listView.selectNthItem(1); } }); }

Target:
private void setFocusToFilterBox() { if (TestController.isTestMode()) { ui.triggerEvent(new UIComponentFocusEvent(UIComponentFocusEvent.EventType.FILTER_BOX)); } filterTextField.requestFocus(); filterTextField.setText(filterTextField.getText().trim()); filterTextField.positionCaret(filterTextField.getLength()); }
Source:
public void addContents(@NonNull Container result) { result.add( new Content("nodes/master/networkInterface.md") { @Override public void writeTo(OutputStream os) throws IOException { os.write(getNetworkInterface(Jenkins.getInstance()).getBytes("utf-8")); } } ); for (final Node node : Jenkins.getInstance().getNodes()) { result.add( new Content("nodes/slave/" + node.getNodeName() + "/networkInterface.md") { @Override public void writeTo(OutputStream os) throws IOException { os.write(getNetworkInterface(node).getBytes("utf-8")); } } ); } }

Target:
public void addContents(@NonNull Container result) { result.add( new Content("nodes/master/networkInterface.md") { @Override public void writeTo(OutputStream os) throws IOException { os.write(getNetworkInterface(Jenkins.getInstance()).getBytes("UTF-8")); } } ); for (final Node node : Jenkins.getInstance().getNodes()) { result.add( new Content("nodes/slave/" + node.getNodeName() + "/networkInterface.md") { @Override public void writeTo(OutputStream os) throws IOException { os.write(getNetworkInterface(node).getBytes("UTF-8")); } } ); } }
Source:
public TableViewerBuilder(TableViewer viewer, Composite tableContainer) { this.viewer = viewer; viewer.setComparer(new EqualityComparer()); tableLayout = new AutoResizeTableLayout(viewer.getTable()); System.out.println("TableViewerBuilder: Passed layout: " + tableContainer.getLayout()); if(tableContainer.getLayout() == null) { tableContainer.setLayout(new GridLayout()); GridData gd = new GridData(GridData.FILL_BOTH); viewer.getTable().setLayoutData(gd); } else if(tableContainer.getLayout() instanceof FillLayout) { } else if(tableContainer.getLayout() instanceof GridLayout) { GridData gd = new GridData(GridData.FILL_BOTH); viewer.getTable().setLayoutData(gd); } viewer.getTable().setLayout(tableLayout); }

Target:
public TableViewerBuilder(TableViewer viewer, Composite tableContainer) { this.viewer = viewer; viewer.setComparer(new EqualityComparer()); this.tableLayout = new TableColumnLayout(); tableContainer.setLayout(tableLayout); }
Source:
private Map<String, Object> getAlwaysMatch() throws IOException { CharSource charSource = backingStore.asByteSource().asCharSource(UTF_8); try (Reader reader = charSource.openBufferedStream(); JsonInput input = json.newInput(reader)) { input.beginObject(); while (input.hasNext()) { String name = input.nextName(); if ("capabilities".equals(name)) { input.beginObject(); while (input.hasNext()) { name = input.nextName(); if ("alwaysMatch".equals(name)) { return input.read(MAP_TYPE); } else { input.skipValue(); } } input.endObject(); } else { input.skipValue(); } } } return null; }

Target:
private @Nullable Map<String, Object> getAlwaysMatch() throws IOException { CharSource charSource = backingStore.asByteSource().asCharSource(UTF_8); try (Reader reader = charSource.openBufferedStream(); JsonInput input = json.newInput(reader)) { input.beginObject(); while (input.hasNext()) { String name = input.nextName(); if (CAPABILITIES.equals(name)) { input.beginObject(); while (input.hasNext()) { name = input.nextName(); if (ALWAYS_MATCH.equals(name)) { return input.read(MAP_TYPE); } input.skipValue(); } input.endObject(); } else { input.skipValue(); } } } return null; }
Source:
protected Duration getConfirmTimeout() { if (this.confirmTimeout == null) { return DEFAULT_CONFIRM_TIMEOUT; } return this.confirmTimeout; }

Target:
protected Duration getConfirmTimeout() { return this.confirmTimeout; }
Source:
protected void initListeners() { super.initListeners(); videoTitleRoot.setLongClickable(true); videoTitleRoot.setOnLongClickListener(this); uploaderRootLayout.setOnClickListener(this); uploaderRootLayout.setOnLongClickListener(this); videoTitleRoot.setOnClickListener(this); thumbnailBackgroundButton.setOnClickListener(this); detailControlsBackground.setOnClickListener(this); detailControlsPopup.setOnClickListener(this); detailControlsAddToPlaylist.setOnClickListener(this); detailControlsDownload.setOnClickListener(this); detailControlsDownload.setOnLongClickListener(this); detailControlsBackground.setLongClickable(true); detailControlsPopup.setLongClickable(true); detailControlsBackground.setOnLongClickListener(this); detailControlsPopup.setOnLongClickListener(this); detailControlsBackground.setOnTouchListener(getOnControlsTouchListener()); detailControlsPopup.setOnTouchListener(getOnControlsTouchListener()); }

Target:
protected void initListeners() { super.initListeners(); videoTitleRoot.setOnLongClickListener(this); uploaderRootLayout.setOnClickListener(this); uploaderRootLayout.setOnLongClickListener(this); videoTitleRoot.setOnClickListener(this); thumbnailBackgroundButton.setOnClickListener(this); detailControlsBackground.setOnClickListener(this); detailControlsPopup.setOnClickListener(this); detailControlsAddToPlaylist.setOnClickListener(this); detailControlsDownload.setOnClickListener(this); detailControlsDownload.setOnLongClickListener(this); detailControlsBackground.setLongClickable(true); detailControlsPopup.setLongClickable(true); detailControlsBackground.setOnLongClickListener(this); detailControlsPopup.setOnLongClickListener(this); detailControlsBackground.setOnTouchListener(getOnControlsTouchListener()); detailControlsPopup.setOnTouchListener(getOnControlsTouchListener()); }
Source:
public void should_compile_as_containsAnyElementsOf_declares_bounded_wildcard_parameter() { Map<String, String> map = newHashMap("some_key", "some_value"); Iterable<Map<String, String>> iterable = list(map); assertThat(iterable).extracting("some_key").containsAnyElementsOf(list("some_value", "some_other_value")); }

Target:
public void should_compile_as_containsAnyElementsOf_declares_bounded_wildcard_parameter() { Iterable<String> iterable = list("some_value", "some_different_value"); assertThat(iterable).containsAnyElementsOf(list("some_value", "some_other_value")); }
Source:
public static Collection<Object[]> data() { return asList(new Object[][] { {new CombinedApp(), new AbstractStubWebDriver.StubAndroidDriver(), DefaultAndroidWidget.class}, {new CombinedApp(), new AbstractStubWebDriver.StubSelendroidDriver(), DefaultSelendroidWidget.class}, {new CombinedApp(), new AbstractStubWebDriver.StubIOSDriver(), DefaultIosWidget.class}, {new CombinedApp(), new AbstractStubWebDriver.StubIOSXCUITDriver(), DefaultIosXCUITWidget.class}, {new CombinedApp(), new AbstractStubWebDriver.StubWindowsDriver(), DefaultWindowsWidget.class}, {new CombinedApp(), new AbstractStubWebDriver.StubBrowserDriver(), DefaultFindByWidget.class}, {new CombinedApp(), new AbstractStubWebDriver.StubAndroidBrowserOrWebViewDriver(), DefaultFindByWidget.class}, {new PartiallyCombinedApp(), new AbstractStubWebDriver.StubAndroidDriver(), DefaultAndroidWidget.class}, {new PartiallyCombinedApp(), new AbstractStubWebDriver.StubSelendroidDriver(), DefaultSelendroidWidget.class}, {new PartiallyCombinedApp(), new AbstractStubWebDriver.StubIOSDriver(), AbstractWidget.class}, {new PartiallyCombinedApp(), new AbstractStubWebDriver.StubIOSXCUITDriver(), AbstractWidget.class}, {new PartiallyCombinedApp(), new AbstractStubWebDriver.StubWindowsDriver(), AbstractWidget.class}, {new PartiallyCombinedApp(), new AbstractStubWebDriver.StubBrowserDriver(), DefaultFindByWidget.class}, {new PartiallyCombinedApp(), new AbstractStubWebDriver.StubAndroidBrowserOrWebViewDriver(), DefaultFindByWidget.class} }); }

Target:
public static Collection<Object[]> data() { return asList( dataArray(new CombinedApp(), new AbstractStubWebDriver.StubAndroidDriver(), DefaultAndroidWidget.class), dataArray(new CombinedApp(), new AbstractStubWebDriver.StubSelendroidDriver(), DefaultSelendroidWidget.class), dataArray(new CombinedApp(), new AbstractStubWebDriver.StubIOSDriver(), DefaultIosWidget.class), dataArray(new CombinedApp(), new AbstractStubWebDriver.StubIOSXCUITDriver(), DefaultIosXCUITWidget.class), dataArray(new CombinedApp(), new AbstractStubWebDriver.StubWindowsDriver(), DefaultWindowsWidget.class), dataArray(new CombinedApp(), new AbstractStubWebDriver.StubBrowserDriver(), DefaultFindByWidget.class), dataArray(new CombinedApp(), new AbstractStubWebDriver.StubAndroidBrowserOrWebViewDriver(), DefaultFindByWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubAndroidDriver(), DefaultAndroidWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubSelendroidDriver(), DefaultSelendroidWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubIOSDriver(), DefaultStubWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubIOSXCUITDriver(), DefaultStubWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubWindowsDriver(), DefaultStubWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubBrowserDriver(), DefaultFindByWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubAndroidBrowserOrWebViewDriver(), DefaultFindByWidget.class) ); }
Source:
private static boolean executeJar(String jarPath, String argsAndOptions) { String command = String.format("java -jar %1$s %2$s", jarPath, argsAndOptions).trim(); log("Starting JAR with command: " + command); Process process; try { process = Runtime.getRuntime().exec(command); } catch (IOException e) { log("Failed to run command. Error: " + e.toString()); return false; } return process.isAlive(); }

Target:
private static boolean executeJar(String jarPath, String argsAndOptions) { String command = String.format("java -jar %s %s", jarPath, argsAndOptions).trim(); log("Starting JAR with command: " + command); Process process; try { process = Runtime.getRuntime().exec(command); } catch (IOException e) { log("Failed to run command. Error: " + e.toString()); return false; } return process.isAlive(); }
Source:
public static TaskShowDto map(Task task) { TaskShowDto dto = new TaskShowDto(task); if (task.getEndpoint() != null) { dto.setEndpoint(EndpointMapper.map(task.getEndpoint())); } for (Template template: task.getTemplates()){ dto.addTemplate(new TemplateShowDto(template)); } return dto; }

Target:
public static TaskShowDto map(Task task) { TaskShowDto dto = new TaskShowDto(task); if (task.getEndpoint() != null) { dto.setEndpoint(EndpointMapper.map(task.getEndpoint())); } if (task.getTemplates() != null){ dto.setTemplates(task .getTemplates() .stream() .map(TemplateShowDto::new) .collect(Collectors.toList())); } return dto; }
Source:
private void printStageTree(StageStats stage, String indent, AtomicInteger stageNumberCounter) { long now = System.nanoTime(); String id = String.valueOf(stageNumberCounter.getAndIncrement()); String name = indent + id; name += Strings.repeat(".", max(0, 10 - name.length())); String bytesPerSecond; String rowsPerSecond; if (stage.isDone()) { bytesPerSecond = formatDataRate(new DataSize(0, BYTE), new Duration(0, SECONDS), false); rowsPerSecond = formatCountRate(0, new Duration(0, SECONDS), false); } else { PreviousStageStatus previousStage = mappingPreviousStageStatuses.containsKey(id) ? mappingPreviousStageStatuses.get(id) : new PreviousStageStatus(start, 0, 0); Duration elapsedTime = succinctNanos(now - previousStage.getNanoTime()); bytesPerSecond = formatDataRate(bytes(stage.getProcessedBytes() - previousStage.getProcessedBytes()), elapsedTime, false); rowsPerSecond = formatCountRate(stage.getProcessedRows() - previousStage.getProcessedRows(), elapsedTime, false); mappingPreviousStageStatuses.put(id, new PreviousStageStatus(now, stage.getProcessedBytes(), stage.getProcessedRows())); } String stageSummary = String.format("%10s%1s %5s %6s %5s %7s %6s %5s %5s", name, stageStateCharacter(stage.getState()), formatCount(stage.getProcessedRows()), rowsPerSecond, formatDataSize(bytes(stage.getProcessedBytes()), false), bytesPerSecond, stage.getQueuedSplits(), stage.getRunningSplits(), stage.getCompletedSplits()); reprintLine(stageSummary); for (StageStats subStage : stage.getSubStages()) { printStageTree(subStage, indent + " ", stageNumberCounter); } }

Target:
private void printStageTree(StageStats stage, String indent, AtomicInteger stageNumberCounter) { long now = System.nanoTime(); String id = String.valueOf(stageNumberCounter.getAndIncrement()); String name = indent + id; name += Strings.repeat(".", max(0, 10 - name.length())); String bytesPerSecond; String rowsPerSecond; if (stage.isDone()) { bytesPerSecond = formatDataRate(new DataSize(0, BYTE), new Duration(0, SECONDS), false); rowsPerSecond = formatCountRate(0, new Duration(0, SECONDS), false); } else { progressStatsHistory.addStageProgressStats(id, new ProgressStats(now, stage.getProcessedBytes(), stage.getProcessedRows())); bytesPerSecond = progressStatsHistory.formatStageInstantDataRate(id); rowsPerSecond = progressStatsHistory.formatStageInstantRowCountRate(id); } String stageSummary = String.format("%10s%1s %5s %6s %5s %7s %6s %5s %5s", name, stageStateCharacter(stage.getState()), formatCount(stage.getProcessedRows()), rowsPerSecond, formatDataSize(bytes(stage.getProcessedBytes()), false), bytesPerSecond, stage.getQueuedSplits(), stage.getRunningSplits(), stage.getCompletedSplits()); reprintLine(stageSummary); for (StageStats subStage : stage.getSubStages()) { printStageTree(subStage, indent + " ", stageNumberCounter); } }
Source:
public void setTaskVariables(Map<String, Object> taskVariables) { this.taskVariables = taskVariables; }

Target:
private void setTaskVariables(Map<String, Object> taskVariables) { this.taskVariables = taskVariables; }
Source:
public void process(Exchange exchange) throws Exception { HttpClient httpClient = this.component.getHttpClient(); GetMethod getMethod = new GetMethod(workdayUri); this.autheticationClient.configure(httpClient, getMethod); try { int statusCode = httpClient.executeMethod(getMethod); if (statusCode != HttpStatus.SC_OK) { throw new IllegalStateException("Got the invalid http status value '" + getMethod.getStatusLine() + "' as the result of the RAAS '" + workdayUri + "'"); } String report = getEndpoint().getCamelContext().getTypeConverter().mandatoryConvertTo(String.class, getMethod.getResponseBodyAsStream()); if ("".equals(report)) { throw new IllegalStateException("Got the unexpected value '" + report + "' as the result of the report '" + workdayUri + "'"); } exchange.getIn().setBody(report); exchange.getIn().setHeader(WORKDAY_RAAS_HEADER , workdayUri); } finally { getMethod.releaseConnection(); } }

Target:
public void process(Exchange exchange) throws Exception { PoolingHttpClientConnectionManager httpClientConnectionManager = endpoint .getWorkdayConfiguration().getHttpConnectionManager(); CloseableHttpClient httpClient = HttpClientBuilder.create() .setConnectionManager(httpClientConnectionManager).build(); HttpGet httpGet = new HttpGet(this.workdayUri); this.autheticationClient.configure(httpClient, httpGet); CloseableHttpResponse httpResponse = httpClient.execute(httpGet); if (httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new IllegalStateException("Got the invalid http status value '" + httpResponse.getStatusLine() + "' as the result of the RAAS '" + workdayUri + "'"); } String report = getEndpoint().getCamelContext().getTypeConverter().mandatoryConvertTo(String.class, httpResponse.getEntity().getContent()); if (report.isEmpty()) { throw new IllegalStateException("Got the unexpected value '" + report + "' as the result of the report '" + workdayUri + "'"); } exchange.getIn().setBody(report); exchange.getIn().setHeader(WORKDAY_RAAS_HEADER , workdayUri); }
Source:
public static void main(final String[] args) throws IOException { if (args.length < 4) { System.out.println("Please enter the command-line parameters: "); System.out.println("submit-jar $jar_path$ $driver_address$ $driver_port"); return; } final String type = args[0]; if (type.compareToIgnoreCase("submit-jar") == 0) { final String jarPath = args[1]; final File file = new File(jarPath); if (!file.exists()) { System.out.println("File " + jarPath + " does not exist"); return; } final String address = args[2]; final int port = Integer.valueOf(args[3]); try (final MISTExecutionEnvironment ee = new MISTDefaultExecutionEnvironmentImpl(address, port)) { final JarUploadResult result = ee.submitJar(Arrays.asList(jarPath)); if (result.getIsSuccess()) { System.out.println("App identifier: " + result.getIdentifier()); return; } else { System.out.println("Submission failed: " + result.getMsg()); } } catch (final Exception e) { e.printStackTrace(); } } else { System.out.println("Not supported operation"); return; } }

Target:
public static void main(final String[] args) throws IOException { if (args.length < 4) { System.out.println("Please enter the command-line parameters: "); System.out.println("submit-jar $jar_path$ $driver_address$ $driver_port$"); return; } final String type = args[0]; if (type.compareToIgnoreCase("submit-jar") == 0) { final String jarPath = args[1]; final File file = new File(jarPath); if (!file.exists()) { System.out.println("File " + jarPath + " does not exist"); return; } final String address = args[2]; final int port = Integer.valueOf(args[3]); try (final MISTExecutionEnvironment ee = new MISTDefaultExecutionEnvironmentImpl(address, port)) { final JarUploadResult result = ee.submitJar(Arrays.asList(jarPath)); if (result.getIsSuccess()) { System.out.println("App identifier: " + result.getIdentifier()); return; } else { System.out.println("Submission failed: " + result.getMsg()); } } catch (final Exception e) { e.printStackTrace(); } } else { System.out.println("Not supported operation"); return; } }