auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Fairy createFairy(DataMaster dataMaster, Locale locale, Random random) { FairyModule fairyModule = getFairyModuleForLocale(dataMaster, locale, random); Injector injector = Guice.createInjector(fairyModule); FairyFactory instance = injector.getInstance(FairyFactory.class); return instance.createFairy(); }

Target:
public static Fairy createFairy(DataMaster dataMaster, Locale locale, Random random) { FairyModule fairyModule = getFairyModuleForLocale(dataMaster, locale, random); Injector injector = Guice.createInjector(fairyModule); FairyFactory fairyFactory = injector.getInstance(FairyFactory.class); return fairyFactory.createFairy(); }
Source:
public TimeOfDayTriggerHandler(Trigger module) { super(module); String time = (String) module.getConfiguration().get(CFG_TIME); try { String[] parts = time.split(":"); expression = new RecurrenceExpression("FREQ=DAILY;BYHOUR=" + parts[0] + ";BYMINUTE=" + parts[1]); } catch (Exception e) { throw new IllegalArgumentException("'time' parameter is not in valid format ' hh:mm'.", e); } scheduler = ExpressionThreadPoolManager.getExpressionScheduledPool(TimerModuleHandlerFactory.THREADPOOLNAME); }

Target:
public TimeOfDayTriggerHandler(Trigger module) { super(module); String time = module.getConfiguration().get(CFG_TIME).toString(); try { String[] parts = time.split(":"); expression = new RecurrenceExpression("FREQ=DAILY;BYHOUR=" + parts[0] + ";BYMINUTE=" + parts[1]); } catch (ArrayIndexOutOfBoundsException | ParseException e) { throw new IllegalArgumentException("'time' parameter is not in valid format 'hh:mm'.", e); } scheduler = ExpressionThreadPoolManager.getExpressionScheduledPool(TimerModuleHandlerFactory.THREADPOOLNAME); }
Source:
public static String getFileNamePath(final String filename, final FieldbookProperties fieldbookProperties) { String filenamePath = ""; StringBuilder filenameBuilder = new StringBuilder(); filenameBuilder.append(fieldbookProperties.getUploadDirectory()); filenameBuilder.append(File.separator); filenameBuilder.append(SettingsUtil.cleanSheetAndFileName(filename)); filenamePath = filenameBuilder.toString(); return filenamePath; }

Target:
public static String getFileNamePath(final String filename, final FieldbookProperties fieldbookProperties) { final StringBuilder filenameBuilder = new StringBuilder(); filenameBuilder.append(fieldbookProperties.getUploadDirectory()); filenameBuilder.append(File.separator); filenameBuilder.append(SettingsUtil.cleanSheetAndFileName(filename)); final String filenamePath = filenameBuilder.toString(); return filenamePath; }
Source:
public void showFileSelection() { ISelection selection = fViewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Iterator<?> itr = structuredSelection.iterator(); String failedFiles = ""; while (itr.hasNext()) { Object element = itr.next(); if (element == null) { return; } FileInfo fileInfo; if (fViewer instanceof TableViewer) { fileInfo = ((StringToFileInfoImpl) element).getValue(); } else { fileInfo = ((GerritDiffNode) element).getFileInfo(); } String status = fileInfo.getStatus(); if (status.compareTo("D") != 0) { if (UIUtils.openSingleFile(fileInfo, fGerritClient, fileInfo.getRevision(), 0) == false) { failedFiles += fileInfo.getPath() + '\n'; } } QueryHelpers.markAsReviewed(fGerritClient, fileInfo); } if (!failedFiles.isEmpty()) { UIUtils.displayInformation("Files not found", Messages.UIFilesTable_2 + '\n' + failedFiles); } } }

Target:
public void showFileSelection() { ISelection selection = fViewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Iterator<?> itr = structuredSelection.iterator(); String failedFiles = ""; while (itr.hasNext()) { Object element = itr.next(); if (element == null) { return; } FileInfo fileInfo; if (fViewer instanceof TableViewer) { fileInfo = ((StringToFileInfoImpl) element).getValue(); } else { fileInfo = ((GerritDiffNode) element).getFileInfo(); } String status = fileInfo.getStatus(); if (status.compareTo("D") != 0) { if (UIUtils.openSingleFile(fileInfo, fGerritClient, fileInfo.getRevision(), 0) == false) { failedFiles += fileInfo.getPath() + '\n'; } } QueryHelpers.markAsReviewed(fGerritClient, fileInfo); } if (!failedFiles.isEmpty()) { UIUtils.displayInformation(Messages.UIFilesTable_3, Messages.UIFilesTable_2 + '\n' + failedFiles); } } }
Source:
public boolean canHandler(Request request) { String authheader = request.getHeader(Constants.AUTHORIZATION_HEADER); if (authheader != null && authheader.startsWith(Constants.BASIC_AUTH_HEADER)) { return true; } return false; }

Target:
public boolean canHandler(Request request) { String authheader = request.getHeader(Constants.AUTHORIZATION_HEADER); return (authheader != null && authheader.startsWith(Constants.BASIC_AUTH_HEADER)); }
Source:
private List<Node> getChildNodesForElement(Object element) { NodeDescriptor nodeDescriptor = mDOMProvider.getNodeDescriptor(element); int childNodeCount = nodeDescriptor.getChildCount(element); List<Node> childNodes; if (childNodeCount == 0) { childNodes = Collections.emptyList(); } else { childNodes = new ArrayList<>(childNodeCount); for (int i = 0; i < childNodeCount; ++i) { Object childElement = nodeDescriptor.getChildAt(element, i); Node childNode = createNodeForElement(childElement); childNodes.add(childNode); } } return childNodes; }

Target:
private List<Node> getChildNodesForElement(Object element) { NodeDescriptor descriptor = mDOMProvider.getNodeDescriptor(element); int childNodeCount = descriptor.getChildCount(element); List<Node> childNodes; if (childNodeCount == 0) { childNodes = Collections.emptyList(); } else { childNodes = new ArrayList<Node>(childNodeCount); for (int i = 0; i < childNodeCount; ++i) { Object childElement = descriptor.getChildAt(element, i); Node childNode = createNodeForElement(childElement); childNodes.add(childNode); } } return childNodes; }
Source:
private boolean checkMountableFile() { DockerClient dockerClient = client(); MountableFile mountableFile = MountableFile.forClasspathResource(ResourceReaper.class.getName().replace(".", "/") + ".class"); Volume volume = new Volume("/dummy"); try { return runInsideDocker( createContainerCmd -> createContainerCmd.withBinds(new Bind(mountableFile.getResolvedPath(), volume, AccessMode.ro)), (__, containerId) -> { try (InputStream stream = dockerClient.copyArchiveFromContainerCmd(containerId, volume.getPath()).exec()) { stream.read(); return true; } catch (Exception e) { return false; } } ); } catch (Exception e) { log.debug("Failed to check mountable file", e); return false; } }

Target:
private boolean checkMountableFile() { DockerClient dockerClient = client(); MountableFile mountableFile = MountableFile.forClasspathResource(ResourceReaper.class.getName().replace(".", "/") + ".class"); Volume volume = new Volume("/dummy"); try { return runInsideDocker( createContainerCmd -> createContainerCmd.withBinds(new Bind(mountableFile.getResolvedPath(), volume, AccessMode.ro)), (__, containerId) -> { try (InputStream stream = dockerClient.copyArchiveFromContainerCmd(containerId, volume.getPath()).exec()) { stream.read(); return true; } catch (Exception e) { return false; } } ); } catch (Exception e) { log.debug("Failure while checking for mountable file support", e); return false; } }
Source:
public JSONObject dispatch(JsonRpcPeer peer, String methodName, @Nullable JSONObject params) throws JsonRpcException { MethodDispatchHelper dispatchHelper = findMethodDispatcher(methodName); if (dispatchHelper == null) { throw new JsonRpcException(new JsonRpcError(JsonRpcError.ErrorCode.METHOD_NOT_FOUND, "Not implemented: " + methodName, null )); } Stetho.getAnalyticsLogger().track( "inspector_method_called", Collections.singletonMap("name", methodName)); try { return dispatchHelper.invoke(peer, params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); ExceptionUtil.propagateIfInstanceOf(cause, JsonRpcException.class); throw ExceptionUtil.propagate(cause); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (JSONException e) { throw new JsonRpcException(new JsonRpcError(JsonRpcError.ErrorCode.INTERNAL_ERROR, e.toString(), null )); } }

Target:
public JSONObject dispatch(JsonRpcPeer peer, String methodName, @Nullable JSONObject params) throws JsonRpcException { MethodDispatchHelper dispatchHelper = findMethodDispatcher(methodName); if (dispatchHelper == null) { throw new JsonRpcException(new JsonRpcError(JsonRpcError.ErrorCode.METHOD_NOT_FOUND, "Not implemented: " + methodName, null )); } if (mAnalyticsLogger != null) { mAnalyticsLogger.track( "inspector_method_called", Collections.singletonMap("name", methodName)); } try { return dispatchHelper.invoke(peer, params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); ExceptionUtil.propagateIfInstanceOf(cause, JsonRpcException.class); throw ExceptionUtil.propagate(cause); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (JSONException e) { throw new JsonRpcException(new JsonRpcError(JsonRpcError.ErrorCode.INTERNAL_ERROR, e.toString(), null )); } }
Source:
public static int getHeaderBlockStartColumnIndex(final List<GridColumn<?>> allColumns, final GridColumn.HeaderMetaData headerMetaData, final int headerRowIndex, final int headerColumnIndex) { int candidateHeaderColumnIndex = headerColumnIndex; if (candidateHeaderColumnIndex == 0) { return candidateHeaderColumnIndex; } while (candidateHeaderColumnIndex > 0) { final GridColumn candidateColumn = allColumns.get(candidateHeaderColumnIndex - 1); final List<GridColumn.HeaderMetaData> candidateHeaderMetaData = candidateColumn.getHeaderMetaData(); if (candidateHeaderMetaData.size() - 1 < headerRowIndex) { break; } if (!candidateHeaderMetaData.get(headerRowIndex).equals(headerMetaData)) { break; } candidateHeaderColumnIndex--; } return candidateHeaderColumnIndex; }

Target:
public static int getHeaderBlockStartColumnIndex(final List<GridColumn<?>> allColumns, final GridColumn.HeaderMetaData headerMetaData, final int headerRowIndex, final int headerColumnIndex) { int candidateHeaderColumnIndex = headerColumnIndex; if (candidateHeaderColumnIndex == 0) { return candidateHeaderColumnIndex; } while (candidateHeaderColumnIndex > 0) { final GridColumn candidateColumn = allColumns.get(candidateHeaderColumnIndex - 1); final List<GridColumn.HeaderMetaData> candidateHeaderMetaData = candidateColumn.getHeaderMetaData(); if (candidateHeaderMetaData.size() - 1 < headerRowIndex) { break; } if (!Objects.equals(candidateHeaderMetaData.get(headerRowIndex), headerMetaData)) { break; } candidateHeaderColumnIndex--; } return candidateHeaderColumnIndex; }
Source:
public void playSound(Location location, Sound sound, float volume, float pitch) { if (location == null || sound == null) return; double radiusSquared = Math.pow(Math.min(volume * 16D, 16D), 2); for (Player player : getRawPlayers()) { if (player.getLocation().distanceSquared(location) <= radiusSquared) { player.playSound(location, sound, volume, pitch); } } }

Target:
public void playSound(Location location, Sound sound, float volume, float pitch) { if (location == null || sound == null) return; double radiusSquared = Math.pow(Math.min(volume * 16, 16), 2); for (Player player : getRawPlayers()) { if (player.getLocation().distanceSquared(location) <= radiusSquared) { player.playSound(location, sound, volume, pitch); } } }
Source:
public void checkInterrupted() { assert fd != -1; if (nIterationsSinceCheck == nIterationsPerCheck) { nIterationsSinceCheck = 0; int nRead = nf.peek(fd, buffer, bufferSize); if (nRead == 0) { return; } if (nRead < 0) { throw CairoException.instance(0).put("Interrupting SQL processing, client fd ").put(fd).put(" is closed"); } int index = 0; long ptr = buffer; while (index < nRead) { byte b = Unsafe.getUnsafe().getByte(ptr + index); if (b != (byte) '\r' && b != (byte) '\n') { break; } index++; } if (index > 0) { nf.recv(fd, buffer, index); } } else { nIterationsSinceCheck++; } }

Target:
public void checkInterrupted() { assert fd != -1; if (nIterationsSinceCheck == nIterationsPerCheck) { nIterationsSinceCheck = 0; checkConnection(); } else { nIterationsSinceCheck++; } }
Source:
public GameManager() { board = new Board(); getChildren().add(board); board.resetGameProperty().addListener((ov, b, b1) -> { if (b1) { initializeGameGrid(); startGame(); } }); initializeGameGrid(); startGame(); board.setGameStart(true); }

Target:
public GameManager() { board = new Board(); getChildren().add(board); board.resetGameProperty().addListener((OValue, booleanFirst, booleanSecond) -> { if (booleanSecond) { initializeGameGrid(); startGame(); } }); initializeGameGrid(); startGame(); board.setGameStart(true); }
Source:
private void updateLabelList() { AsyncQuery getLabelsQuery = new AsyncQuery(); getLabelsQuery.asyncCallback = new INewAsyncCallback() { @SuppressWarnings("unchecked") @Override public void onSuccess(Object model, Object result) { final List<Label> allLabels = (List<Label>) result; if (getIsNew()) { labelList.setItems(allLabels); labelList.setSelectedItems(new ArrayList<Label>()); } else { AsyncQuery getLabelsByVmIdQuery = new AsyncQuery(); getLabelsByVmIdQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<Label> vmLabelsList = (List<Label>) returnValue; labelList.setItems(allLabels); labelList.setSelectedItems(vmLabelsList); } }; Guid vmId = ((ExistingVmModelBehavior) getBehavior()).getVm().getId(); AsyncDataProvider.getInstance().getLabelListByEntityId(getLabelsByVmIdQuery, vmId); } labelList.setIsChangeable(false); } }; AsyncDataProvider.getInstance().getLabelList(getLabelsQuery); }

Target:
private void updateLabelList() { AsyncQuery getLabelsQuery = new AsyncQuery(); getLabelsQuery.asyncCallback = new INewAsyncCallback() { @SuppressWarnings("unchecked") @Override public void onSuccess(Object model, Object result) { final List<Label> allLabels = (List<Label>) result; boolean isExistingVmBehavior = getBehavior() instanceof ExistingVmModelBehavior; if (isExistingVmBehavior) { AsyncQuery getLabelsByVmIdQuery = new AsyncQuery(); getLabelsByVmIdQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<Label> vmLabelsList = (List<Label>) returnValue; labelList.setItems(allLabels); labelList.setSelectedItems(vmLabelsList); } }; Guid vmId = ((ExistingVmModelBehavior) getBehavior()).getVm().getId(); AsyncDataProvider.getInstance().getLabelListByEntityId(getLabelsByVmIdQuery, vmId); } else { labelList.setItems(allLabels); labelList.setSelectedItems(new ArrayList<Label>()); } labelList.setIsChangeable(false); } }; AsyncDataProvider.getInstance().getLabelList(getLabelsQuery); }
Source:
ShutdownTask(ShardInfo shardInfo, IRecordProcessor recordProcessor, RecordProcessorCheckpointer recordProcessorCheckpointer, ShutdownReason reason, IKinesisProxy kinesisProxy, InitialPositionInStreamExtended initialPositionInStream, boolean cleanupLeasesOfCompletedShards, boolean ignoreUnexpectedChildShards, KinesisClientLibLeaseCoordinator leaseCoordinator, long backoffTimeMillis, GetRecordsCache getRecordsCache, ShardSyncer shardSyncer, ShardSyncStrategy shardSyncStrategy) { this.shardInfo = shardInfo; this.recordProcessor = recordProcessor; this.recordProcessorCheckpointer = recordProcessorCheckpointer; this.reason = reason; this.kinesisProxy = kinesisProxy; this.initialPositionInStream = initialPositionInStream; this.cleanupLeasesOfCompletedShards = cleanupLeasesOfCompletedShards; this.ignoreUnexpectedChildShards = ignoreUnexpectedChildShards; this.leaseManager = leaseCoordinator.getLeaseManager(); this.leaseCoordinator = leaseCoordinator; this.backoffTimeMillis = backoffTimeMillis; this.getRecordsCache = getRecordsCache; this.shardSyncer = shardSyncer; this.shardSyncStrategy = shardSyncStrategy; }

Target:
ShutdownTask(ShardInfo shardInfo, IRecordProcessor recordProcessor, RecordProcessorCheckpointer recordProcessorCheckpointer, ShutdownReason reason, IKinesisProxy kinesisProxy, InitialPositionInStreamExtended initialPositionInStream, boolean cleanupLeasesOfCompletedShards, boolean ignoreUnexpectedChildShards, KinesisClientLibLeaseCoordinator leaseCoordinator, long backoffTimeMillis, GetRecordsCache getRecordsCache, ShardSyncer shardSyncer, ShardSyncStrategy shardSyncStrategy) { this.shardInfo = shardInfo; this.recordProcessor = recordProcessor; this.recordProcessorCheckpointer = recordProcessorCheckpointer; this.reason = reason; this.kinesisProxy = kinesisProxy; this.initialPositionInStream = initialPositionInStream; this.cleanupLeasesOfCompletedShards = cleanupLeasesOfCompletedShards; this.ignoreUnexpectedChildShards = ignoreUnexpectedChildShards; this.leaseCoordinator = leaseCoordinator; this.backoffTimeMillis = backoffTimeMillis; this.getRecordsCache = getRecordsCache; this.shardSyncer = shardSyncer; this.shardSyncStrategy = shardSyncStrategy; }
Source:
private void addSpanRequestAttributes(Span span, Context context, String spanName) { Objects.requireNonNull(span, "'span' cannot be null."); span.putAttribute(COMPONENT, AttributeValue.stringAttributeValue(parseComponentValue(spanName))); span.putAttribute( MESSAGE_BUS_DESTINATION, AttributeValue.stringAttributeValue(getOrDefault(ENTITY_PATH_KEY, "", String.class, context))); span.putAttribute( PEER_ENDPOINT, AttributeValue.stringAttributeValue(getOrDefault(HOST_NAME_KEY, "", String.class, context))); }

Target:
private void addSpanRequestAttributes(Span span, Context context, String spanName) { Objects.requireNonNull(span, "'span' cannot be null."); span.putAttribute(COMPONENT, AttributeValue.stringAttributeValue(parseComponentValue(spanName))); span.putAttribute( MESSAGE_BUS_DESTINATION, AttributeValue.stringAttributeValue(getOrDefault(context, ENTITY_PATH_KEY, "", String.class))); span.putAttribute( PEER_ENDPOINT, AttributeValue.stringAttributeValue(getOrDefault(context, HOST_NAME_KEY, "", String.class))); }
Source:
public boolean matches( Message<T> message ) { if ( message == null ) { return false; } boolean toMatches = to == null || to.toString().equals( message.getHeader( Message.TO ) ); boolean fromMatches = from == null || from.toString().equals( ((Message) message).getHeader( Message.FROM ) ); boolean typeMatches = theMessageType == null || theMessageType == ((Message) message).getMessageType(); boolean payloadMatches = payload == null || payload.equals( ((Message) message).getPayload() ); boolean headersMatch = true; for ( String header : headers ) { headersMatch = headersMatch && matchHeaderAndValue( header, ((Message) message).getHeader( header ) ); } return fromMatches && toMatches && typeMatches && payloadMatches && headersMatch; }

Target:
public boolean matches( Message<T> message ) { if ( message == null ) { return false; } boolean toMatches = to == null || to.toString().equals( message.getHeader( Message.TO ) ); boolean fromMatches = from == null || from.toString().equals( message.getHeader( Message.FROM ) ); boolean typeMatches = theMessageType == null || theMessageType == ((Message) message).getMessageType(); boolean payloadMatches = payload == null || payload.equals( message.getPayload() ); boolean headersMatch = true; for ( String header : headers ) { headersMatch = headersMatch && matchHeaderAndValue( header, message.getHeader( header ) ); } return fromMatches && toMatches && typeMatches && payloadMatches && headersMatch; }
Source:
public Image apply(OSImage image) { ImageBuilder builder = new ImageBuilder() .id(image.label()) .name(image.name()) .description(image.description()) .status(Image.Status.AVAILABLE) .uri(image.mediaLink()) .providerId(image.publisherName()) .location(createLocation(image.location())); OperatingSystem.Builder osBuilder = setOperatingSystem(image); return builder.operatingSystem(osBuilder.build()).build(); }

Target:
public Image apply(OSImage image) { ImageBuilder builder = new ImageBuilder() .id(image.name()) .name(image.label()) .description(image.description()) .status(Image.Status.AVAILABLE) .uri(image.mediaLink()) .providerId(image.name()) .location(createLocation(image.location())); OperatingSystem.Builder osBuilder = osFamily().apply(image); return builder.operatingSystem(osBuilder.build()).build(); }
Source:
public void configure() throws Exception { MongoDbFactory mongoDbFactory = this.prepareMongoFactory(DEFAULT_COLLECTION_NAME); MongoTemplate template = new MongoTemplate(mongoDbFactory); store = new MongoDbMetadataStore(template); }

Target:
public void configure() throws Exception { final MongoDbFactory mongoDbFactory = this.prepareMongoFactory(DEFAULT_COLLECTION_NAME); store = new MongoDbMetadataStore(mongoDbFactory); }
Source:
private String getImplementationVersion() { Package pkg = getClass().getPackage(); if (pkg != null) { return pkg.getImplementationVersion(); } return null; }

Target:
private String getImplementationVersion() { Package pkg = getClass().getPackage(); return (pkg == null) ? null : pkg.getImplementationVersion(); }
Source:
public static boolean isCollectionPackage(String filename) { return filename != null && (filename.toLowerCase().endsWith(".colpkg") || filename.toLowerCase().endsWith(".colpkg.zip") || filename.equals("collection.apkg")); }

Target:
public static boolean isCollectionPackage(String filename) { return filename != null && (filename.toLowerCase().endsWith(".colpkg") || filename.toLowerCase().endsWith(".colpkg.zip") || (filename.equals("collection.apkg") || filename.equals("collection.apkg.zip"))); }
Source:
protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) { AddressEndpoint addressEndpoint = new AddressEndpoint(); OMAttribute name = epConfig.getAttribute( new QName(XMLConfigConstants.NULL_NAMESPACE, "name")); if (name != null) { addressEndpoint.setName(name.getAttributeValue()); } OMElement httpStatusElement = epConfig.getFirstChildWithName(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "httpStatus")); if(httpStatusElement != null) { ArrayList<String> l = new ArrayList<String>(); l.add("500"); l.add("501"); l.add("502"); addressEndpoint.setHttpStatusCodes(l); } OMElement addressElement = epConfig.getFirstChildWithName( new QName(SynapseConstants.SYNAPSE_NAMESPACE, "address")); if (addressElement != null) { EndpointDefinition definition = createEndpointDefinition(addressElement); addressEndpoint.setDefinition(definition); processAuditStatus(definition, addressEndpoint.getName(), addressElement); } processProperties(addressEndpoint, epConfig); return addressEndpoint; }

Target:
protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) { AddressEndpoint addressEndpoint = new AddressEndpoint(); OMAttribute name = epConfig.getAttribute( new QName(XMLConfigConstants.NULL_NAMESPACE, "name")); if (name != null) { addressEndpoint.setName(name.getAttributeValue()); } OMElement addressElement = epConfig.getFirstChildWithName( new QName(SynapseConstants.SYNAPSE_NAMESPACE, "address")); if (addressElement != null) { EndpointDefinition definition = createEndpointDefinition(addressElement); addressEndpoint.setDefinition(definition); processAuditStatus(definition, addressEndpoint.getName(), addressElement); } processProperties(addressEndpoint, epConfig); return addressEndpoint; }
Source:
private void InitializeHelpers() { try { for (StorageType storageType : StorageType.values()) { Class<?> actionType = null; String formattedClassName = String.format("%1$s.%2$s%3$s", ACTION_TYPE_PACKAGE, storageType.name(), ACTION_TYPE_CLASS); try { actionType = Class.forName(formattedClassName); } catch (ClassNotFoundException cnfe) { if (storageType != StorageType.ALL && storageType != StorageType.UNKNOWN) { log.debugFormat("StorageHelperDirector Error:: the lookup for following class has failed: {0}" , formattedClassName); } } if (actionType != null) { Constructor<?> info = actionType.getConstructors()[0]; IStorageHelper currentHelper = (IStorageHelper) info.newInstance(null); _helpers.put(storageType, currentHelper); } } } catch (Exception ex) { log.error("StorageHelperDirector Error:: exception was encountered during InitializeHelpers() execution", ex); throw new ApplicationException("JTODO missing exception", ex); } }

Target:
private void InitializeHelpers() { try { for (StorageType storageType : StorageType.values()) { if (storageType != StorageType.ALL && storageType != StorageType.UNKNOWN) { Class<?> actionType = null; String formattedClassName = String.format("%1$s.%2$s%3$s", ACTION_TYPE_PACKAGE, storageType.name(), ACTION_TYPE_CLASS); try { actionType = Class.forName(formattedClassName); } catch (ClassNotFoundException cnfe) { log.debugFormat("StorageHelperDirector Error:: the lookup for following class has failed: {0}" , formattedClassName); } if (actionType != null) { Constructor<?> info = actionType.getConstructors()[0]; IStorageHelper currentHelper = (IStorageHelper) info.newInstance(null); _helpers.put(storageType, currentHelper); } } } } catch (Exception ex) { log.error("StorageHelperDirector Error:: exception was encountered during InitializeHelpers() execution", ex); throw new ApplicationException("JTODO missing exception", ex); } }
Source:
private String sliceAddress(String assignment) { String[] tokens = assignment.split("\\p{javaSpaceChar}+"); if (tokens.length < 1) { throw new RuntimeException("Could not find ip address"); } return tokens[0]; }

Target:
private String sliceAddress(String assignment) { String[] tokens = assignment.split("\\p{javaSpaceChar}+"); if (tokens.length < 1) { throw new RuntimeException("Could not find ip address in " + assignment); } return tokens[0]; }
Source:
public void messageReceived(IoSession ioSession, Object message) throws Exception { String messageString = (String) message; SessionID remoteSessionID = MessageUtils.getReverseSessionID(messageString); Session quickFixSession = findQFSession(ioSession, remoteSessionID); if (quickFixSession != null) { final boolean rejectGarbledMessage = quickFixSession.isRejectGarbledMessage(); final Log sessionLog = quickFixSession.getLog(); sessionLog.onIncoming(messageString); try { Message fixMessage = parse(quickFixSession, messageString); processMessage(ioSession, fixMessage); } catch (InvalidMessage e) { if (rejectGarbledMessage) { final Message fixMessage = e.getFixMessage(); if ( fixMessage != null ) { sessionLog.onErrorEvent("Processing garbled message: " + e.getMessage()); processMessage(ioSession, fixMessage); return; } } if (MessageUtils.isLogon(messageString)) { sessionLog.onErrorEvent("Invalid LOGON message, disconnecting: " + e.getMessage()); ioSession.closeNow(); } else { sessionLog.onErrorEvent("Invalid message: " + e.getMessage()); } } } else { boolean logMessageWhenSessionNotFound = true; if (sessionSettings.isSetting(Session.SETTING_LOG_MESSAGE_WHEN_SESSION_NOT_FOUND)) { logMessageWhenSessionNotFound = sessionSettings.getBool(Session.SETTING_LOG_MESSAGE_WHEN_SESSION_NOT_FOUND); } if (logMessageWhenSessionNotFound) { log.error("Disconnecting; received message for unknown session: {}", messageString); } else { log.error("Disconnecting; received message for unknown session. remoteSessionID: {}", remoteSessionID); } ioSession.closeNow(); } }

Target:
public void messageReceived(IoSession ioSession, Object message) throws Exception { String messageString = (String) message; SessionID remoteSessionID = MessageUtils.getReverseSessionID(messageString); Session quickFixSession = findQFSession(ioSession, remoteSessionID); if (quickFixSession != null) { final boolean rejectGarbledMessage = quickFixSession.isRejectGarbledMessage(); final Log sessionLog = quickFixSession.getLog(); sessionLog.onIncoming(messageString); try { Message fixMessage = parse(quickFixSession, messageString); processMessage(ioSession, fixMessage); } catch (InvalidMessage e) { if (rejectGarbledMessage) { final Message fixMessage = e.getFixMessage(); if ( fixMessage != null ) { sessionLog.onErrorEvent("Processing garbled message: " + e.getMessage()); processMessage(ioSession, fixMessage); return; } } if (MessageUtils.isLogon(messageString)) { sessionLog.onErrorEvent("Invalid LOGON message, disconnecting: " + e.getMessage()); ioSession.closeNow(); } else { sessionLog.onErrorEvent("Invalid message: " + e.getMessage()); } } } else { if (logMessageWhenSessionNotFound) { log.error("Disconnecting; received message for unknown session: {}", messageString); } else { log.error("Disconnecting; received message for unknown session. remoteSessionID: {}", remoteSessionID); } ioSession.closeNow(); } }
Source:
private void animateInAppMessage(WebViewManager.Position displayLocation, View messageView, View backgroundView) { final CardView messageViewCardView = messageView.findViewWithTag(IN_APP_MESSAGE_CARD_VIEW_TAG); Animation.AnimationListener cardViewAnimCallback = createAnimationListenerForAndroidApi23Elevation(messageViewCardView); switch (displayLocation) { case TOP_BANNER: animateTop(messageViewCardView, webView.getHeight(), cardViewAnimCallback); break; case BOTTOM_BANNER: animateBottom(messageViewCardView, webView.getHeight(), cardViewAnimCallback); break; case CENTER_MODAL: case FULL_SCREEN: animateCenter(messageView, backgroundView, cardViewAnimCallback, null); break; } }

Target:
private void animateInAppMessage(WebViewManager.Position displayLocation, View messageView, View backgroundView) { final CardView messageViewCardView = messageView.findViewWithTag(IN_APP_MESSAGE_CARD_VIEW_TAG); Animation.AnimationListener cardViewAnimCallback = null; if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) cardViewAnimCallback = createAnimationListenerForAndroidApi23Elevation(messageViewCardView); switch (displayLocation) { case TOP_BANNER: animateTop(messageViewCardView, webView.getHeight(), cardViewAnimCallback); break; case BOTTOM_BANNER: animateBottom(messageViewCardView, webView.getHeight(), cardViewAnimCallback); break; case CENTER_MODAL: case FULL_SCREEN: animateCenter(messageView, backgroundView, cardViewAnimCallback, null); break; } }
Source:
private static Optional<CatchUp> findJob(CatchUpId id, DeliveryRunInfo deliveryInfo) { Optional<CatchUp> stateVisibileToDelivery = deliveryInfo.getCatchUpJobList() .stream() .filter((job) -> job.getId() .equals(id)) .findFirst(); return stateVisibileToDelivery; }

Target:
private static Optional<CatchUp> findJob(CatchUpId id, DeliveryRunInfo deliveryInfo) { Optional<CatchUp> stateVisibileToDelivery = deliveryInfo.getCatchUpJobList() .stream() .filter((job) -> id.equals(job.getId())) .findFirst(); return stateVisibileToDelivery; }
Source:
fromValue(String value) { try { return valueOf(value); } catch (IllegalArgumentException e) { return UNRECOGNIZED; } }

Target:
fromValue(String value) { return Enums.getIfPresent(Algorithm.class, value).or(UNRECOGNIZED); }
Source:
public ChangeDetail call() throws OrmException, NoSuchEntityException, IllegalStateException, PatchSetInfoNotAvailableException, NoSuchChangeException { final Change.Id changeId = patchSetId.getParentKey(); final ChangeControl changeControl = changeControlFactory.validateFor(changeId); List<SubmitRecord> result = changeControl.canSubmit(db, patchSetId); if (result.isEmpty()) { throw new IllegalStateException("Cannot submit"); } switch (result.get(0).status) { case OK: ChangeUtil.submit(patchSetId, user, db, opFactory, merger); return changeDetailFactory.create(changeId).call(); case NOT_READY: { for (SubmitRecord.Label lbl : result.get(0).labels) { switch (lbl.status) { case OK: break; case REJECT: throw new IllegalStateException("Blocked by " + lbl.label); case NEED: throw new IllegalStateException("Needs " + lbl.label); case IMPOSSIBLE: throw new IllegalStateException("Cannnot submit, check project access"); default: throw new IllegalArgumentException("Unknown status " + lbl.status); } } throw new IllegalStateException("Cannot submit"); } case CLOSED: throw new IllegalStateException("Change is closed"); case GROUP_NOT_READY: throw new IllegalStateException( "Change is part of a group, and not all changes in the group are submittable"); case RULE_ERROR: if (result.get(0).errorMessage != null) { throw new IllegalStateException(result.get(0).errorMessage); } else { throw new IllegalStateException("Internal rule error"); } default: throw new IllegalStateException("Uknown status " + result.get(0).status); } }

Target:
public ChangeDetail call() throws OrmException, NoSuchEntityException, IllegalStateException, PatchSetInfoNotAvailableException, NoSuchChangeException { final Change.Id changeId = patchSetId.getParentKey(); final ChangeControl changeControl = changeControlFactory.validateFor(changeId); List<SubmitRecord> result = changeControl.canSubmit(db, patchSetId); if (result.isEmpty()) { throw new IllegalStateException("Cannot submit"); } switch (result.get(0).status) { case OK: ChangeUtil.submit(patchSetId, user, db, opFactory, merger); return changeDetailFactory.create(changeId).call(); case NOT_READY: { for (SubmitRecord.Label lbl : result.get(0).labels) { switch (lbl.status) { case OK: break; case REJECT: throw new IllegalStateException("Blocked by " + lbl.label); case NEED: throw new IllegalStateException("Needs " + lbl.label); case IMPOSSIBLE: throw new IllegalStateException("Cannnot submit, check project access"); default: throw new IllegalArgumentException("Unknown status " + lbl.status); } } throw new IllegalStateException("Cannot submit"); } case CLOSED: throw new IllegalStateException("Change is closed"); case GROUP_NOT_READY: throw new IllegalStateException( "Change is codependent on changes that are not all submittable at this moment"); case RULE_ERROR: if (result.get(0).errorMessage != null) { throw new IllegalStateException(result.get(0).errorMessage); } else { throw new IllegalStateException("Internal rule error"); } default: throw new IllegalStateException("Uknown status " + result.get(0).status); } }
Source:
private void doCriticalMemoryHitTestOnServer(boolean createPR, final boolean disabledQueryMonitorForLowMem, final int queryTimeout, final boolean hitCriticalThreshold) { final VM server = VM.getVM(0); final int numObjects = 200; try { final int port = AvailablePortHelper.getRandomAvailableTCPPort(); startCacheServer(server, port, disabledQueryMonitorForLowMem, queryTimeout, createPR); populateData(server); doTestCriticalHeapAndQueryTimeout(server, server, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); } server.invoke("Executing query when system is 'Normal'", () -> { try { QueryService qs = getCache().getQueryService(); Query query = qs.newQuery("Select * From /" + "portfolios"); SelectResults results = (SelectResults) query.execute(); assertThat(results.size()).isEqualTo(numObjects); } catch (QueryInvocationTargetException | FunctionDomainException | TypeMismatchException | NameResolutionException e) { fail(""); } }); doTestCriticalHeapAndQueryTimeout(server, server, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); } } finally { stopServer(server); } }

Target:
private void doCriticalMemoryHitTestOnServer(boolean createPR, final boolean disabledQueryMonitorForLowMem, final int queryTimeout, final boolean hitCriticalThreshold) throws InterruptedException { final VM server = VM.getVM(0); final int numObjects = 200; try { final int port = AvailablePortHelper.getRandomAvailableTCPPort(); startCacheServer(server, port, disabledQueryMonitorForLowMem, queryTimeout, createPR); populateData(server); doTestCriticalHeapAndQueryTimeout(server, server, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); } server.invoke("Executing query when system is 'Normal'", () -> { QueryService qs = getCache().getQueryService(); Query query = qs.newQuery("Select * From /" + "portfolios"); SelectResults results = (SelectResults) query.execute(); assertThat(results.size()).isEqualTo(numObjects); }); doTestCriticalHeapAndQueryTimeout(server, server, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); } } finally { stopServer(server); } }
Source:
public Optional<ChatParticipant> lookupPlayerBySession(final Session senderSession) { throw new UnsupportedOperationException("TODO"); }

Target:
public Optional<ChatParticipant> lookupPlayerBySession(final Session senderSession) { return Optional.ofNullable(participants.get(senderSession.getId())) .map(chatterSession -> chatterSession.chatParticipant); }
Source:
public Map<String, String> getMetadata() { Map<String, String> map = new HashMap<>(); String applicationId = this.applicationId; String instanceId = this.instanceId; String serviceBaseUrl = this.serviceBaseUrl; if (StringUtils.hasText(applicationId) && StringUtils.hasText(instanceId) && StringUtils.hasText(serviceBaseUrl)) { map.put("applicationId", applicationId); map.put("instanceId", instanceId); } return map; }

Target:
public Map<String, String> getMetadata() { Map<String, String> map = new HashMap<>(); if (StringUtils.hasText(this.applicationId) && StringUtils.hasText(this.instanceId)) { map.put("applicationId", this.applicationId); map.put("instanceId", this.instanceId); } return map; }
Source:
public ConcurrentScheduler(int schedulerCount, int threadsPerScheduler, String threadBaseName) { this.schedulers = new ScheduledThreadPoolExecutor[schedulerCount]; this.threadsPerScheduler = threadsPerScheduler; this.threadBaseName = threadBaseName; }

Target:
public ConcurrentScheduler(int schedulerCount, int threadsPerScheduler, String threadBaseName) { checkArgument(schedulerCount > 0, "schedulerCount must be at least one"); this.schedulers = new ScheduledThreadPoolExecutor[schedulerCount]; checkArgument(threadsPerScheduler > 0, "threadsPerScheduler must be at least one"); this.threadsPerScheduler = threadsPerScheduler; this.threadBaseName = requireNonNull(threadBaseName, "threadBaseName is null"); }
Source:
private void onUserLoginFailure(Exception ex) { setLoginBtnEnabled(); email_et.setEnabled(true); password_et.setEnabled(true); forgotPassword_tv.setEnabled(true); eulaTv.setEnabled(true); if (ex != null && ex instanceof LoginException) { LoginErrorMessage error = (((LoginException) ex).getLoginErrorMessage()); showErrorMessage( error.getMessageLine1(), (error.getMessageLine2() != null) ? error.getMessageLine2() : getString(R.string.login_failed)); } else { logger.warn("Login Exception : "); logger.error(ex); } }

Target:
private void onUserLoginFailure(Exception ex) { setLoginBtnEnabled(); email_et.setEnabled(true); password_et.setEnabled(true); forgotPassword_tv.setEnabled(true); eulaTv.setEnabled(true); if (ex != null && ex instanceof LoginException) { LoginErrorMessage error = (((LoginException) ex).getLoginErrorMessage()); showErrorMessage( error.getMessageLine1(), (error.getMessageLine2() != null) ? error.getMessageLine2() : getString(R.string.login_failed)); } else { logger.error(ex); } }
Source:
private void removeFromWorkspaceAndUpdateURiMapping(Viewpoint viewpoint) { this.viewpointsFromWorkspace.remove(viewpoint); Resource res = viewpoint.eResource(); if (resourceSet.getResources().contains(res)) { res.unload(); resourceSet.getResources().remove(res); } URI viewpointUri = ViewpointProtocolParser.buildViewpointUri(EcoreUtil.getURI(viewpoint)); for (Viewpoint vp : this.viewpointsFromPlugin) { if (StringUtil.equals(vp.getName(), viewpoint.getName())) { URI vpURI = ViewpointProtocolParser.buildViewpointUri(EcoreUtil.getURI(vp)); if (vpURI != null && viewpointUri != null && StringUtil.equals(vpURI.toString(), viewpointUri.toString())) { mapToSiriusProtocol(vp); return; } } } URIMappingRegistryImpl.INSTANCE.removeKey(ViewpointProtocolParser.buildViewpointUri(viewpointUri)); }

Target:
private void removeFromWorkspaceAndUpdateURiMapping(Viewpoint viewpoint) { this.viewpointsFromWorkspace.remove(viewpoint); URI viewpointUri = ViewpointProtocolParser.buildViewpointUri(EcoreUtil.getURI(viewpoint)); for (Viewpoint vp : this.viewpointsFromPlugin) { if (StringUtil.equals(vp.getName(), viewpoint.getName())) { URI vpURI = ViewpointProtocolParser.buildViewpointUri(EcoreUtil.getURI(vp)); if (vpURI != null && viewpointUri != null && StringUtil.equals(vpURI.toString(), viewpointUri.toString())) { mapToSiriusProtocol(vp); return; } } } URIMappingRegistryImpl.INSTANCE.removeKey(ViewpointProtocolParser.buildViewpointUri(viewpointUri)); }
Source:
public DynamicTableSink createDynamicTableSink(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); ReadableConfig tableOptions = helper.getOptions(); EncodingFormat<SerializationSchema<RowData>> keyEncodingFormat = helper.discoverEncodingFormat( SerializationFormatFactory.class, FactoryUtil.KEY_FORMAT); EncodingFormat<SerializationSchema<RowData>> valueEncodingFormat = helper.discoverEncodingFormat( SerializationFormatFactory.class, FactoryUtil.VALUE_FORMAT); helper.validateExcept(KafkaOptions.PROPERTIES_PREFIX); TableSchema schema = context.getCatalogTable().getSchema(); TableSchema physicalSchema = TableSchemaUtils.getPhysicalSchema(schema); List<String> physicalColumns = Arrays.asList(physicalSchema.getFieldNames()); validateTableSinkOptions( tableOptions, keyEncodingFormat, valueEncodingFormat, schema); int[] keyProjection = schema.getPrimaryKey().get().getColumns().stream() .filter(name -> physicalSchema.getTableColumn(name).isPresent()) .mapToInt(physicalColumns::indexOf) .toArray(); int[] valueProjection = getValueProjection(tableOptions, keyProjection, physicalColumns.size()); final String keyPrefix = tableOptions.getOptional(FactoryUtil.KEY_FIELDS_PREFIX).orElse(null); final Optional<FlinkKafkaPartitioner<RowData>> partitioner = Optional.empty(); return new KafkaDynamicSink( schema.toPhysicalRowDataType(), SINK_CHANGELOG_MODE, keyEncodingFormat, valueEncodingFormat, keyProjection, valueProjection, keyPrefix, tableOptions.get(TOPIC).get(0), getBootstrapServers(tableOptions), partitioner, getSinkSemantic(KafkaOptions.SINK_SEMANTIC_VALUE_AT_LEAST_ONCE) ); }

Target:
public DynamicTableSink createDynamicTableSink(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); ReadableConfig tableOptions = helper.getOptions(); EncodingFormat<SerializationSchema<RowData>> keyEncodingFormat = helper.discoverEncodingFormat( SerializationFormatFactory.class, KEY_FORMAT); EncodingFormat<SerializationSchema<RowData>> valueEncodingFormat = helper.discoverEncodingFormat( SerializationFormatFactory.class, VALUE_FORMAT); helper.validateExcept(KafkaOptions.PROPERTIES_PREFIX); TableSchema schema = context.getCatalogTable().getSchema(); validateTableOptions(tableOptions, keyEncodingFormat, valueEncodingFormat, schema); Tuple2<int[], int[]> keyValueProjections = createKeyValueProjections(context.getCatalogTable()); final String keyPrefix = tableOptions.getOptional(KEY_FIELDS_PREFIX).orElse(null); final Properties properties = getKafkaProperties(context.getCatalogTable().getOptions()); Integer parallelism = tableOptions.get(FactoryUtil.SINK_PARALLELISM); return new KafkaDynamicSink( schema.toPhysicalRowDataType(), keyEncodingFormat, new EncodingFormatWrapper(valueEncodingFormat), keyValueProjections.f0, keyValueProjections.f1, keyPrefix, tableOptions.get(TOPIC).get(0), properties, null, KafkaSinkSemantic.AT_LEAST_ONCE, true, parallelism ); }
Source:
protected File createMovieFile(Format fileFormat) throws IOException { if(!this.movieFolder.exists()) { this.movieFolder.mkdirs(); } else if(!this.movieFolder.isDirectory()) { throw new IOException("\"" + this.movieFolder + "\" is not a directory."); } final File f = generateOutput(fileFormat); return f; }

Target:
protected File createMovieFile(Format fileFormat) throws IOException { if (!this.movieFolder.exists()) { if (!this.movieFolder.mkdirs()) { logger.warn("Directory could not be created. mkdirs operation returned false.", this.movieFolder); } } else { if (!this.movieFolder.isDirectory()) { logger.warn("{} is not a directory.", this.movieFolder); } } final File f = generateOutput(fileFormat); return f; }
Source:
protected void initAndRegisterHandlerForExpressionTextArea() { checkExpressionSyntax(); DOM.sinkBitlessEvent(expressionElement, ConstantHolder.INPUT); DOM.setEventListener(expressionElement, event -> { if (ConstantHolder.INPUT.contains(event.getType())) { checkExpressionSyntax();} }); }

Target:
protected void initAndRegisterHandlerForExpressionTextArea() { ensureExpressionSyntax(); DOM.sinkBitlessEvent(expressionElement, ConstantHolder.INPUT); DOM.setEventListener(expressionElement, event -> { if (ConstantHolder.INPUT.contains(event.getType())) { ensureExpressionSyntax();} }); }
Source:
private ISeries createSeries() { IBarSeries series = (IBarSeries) fChart.getSeriesSet().createSeries(SeriesType.BAR, Messages.AbstractSegmentStoreDensityViewer_SeriesLabel); series.setVisible(true); series.setBarPadding(0); Color color = COLOR_REGISTRY.get(BAR_COLOR.toString()); if (color == null) { COLOR_REGISTRY.put(BAR_COLOR.toString(), BAR_COLOR); color = COLOR_REGISTRY.get(BAR_COLOR.toString()); } series.setBarColor(color); return series; }

Target:
private ISeries createSeries() { IBarSeries series = (IBarSeries) fChart.getSeriesSet().createSeries(SeriesType.BAR, Messages.AbstractSegmentStoreDensityViewer_SeriesLabel); series.setVisible(true); series.setBarPadding(0); Color color = getColorForRGB(BAR_COLOR); series.setBarColor(color); return series; }
Source:
private Hardware getHardware() { System.out.format(" Hardware Profiles%n"); Set<? extends Hardware> profiles = computeService.listHardwareProfiles(); Hardware result = null; for (Hardware profile : profiles) { System.out.format(" %s%n", profile); if (profile.getId().equals(ZONE + "/f1-micro")) { result = profile; } } if (result == null) { System.err.println("f1-micro flavor not found. Using first flavor found:%n"); result = profiles.iterator().next(); System.err.format("-> %s%n", result); } return result; }

Target:
private Hardware getHardware() { System.out.format(" Hardware Profiles%n"); Set<? extends Hardware> profiles = computeService.listHardwareProfiles(); Hardware result = null; for (Hardware profile : profiles) { System.out.format(" %s%n", profile); if (profile.getId().equals(ZONE + "/f1-micro")) { result = profile; } } if (result == null) { System.err.println("f1-micro flavor not found. Using first flavor found:"); result = profiles.iterator().next(); System.err.format("-> %s%n", result); } return result; }
Source:
public void testCreateBucketedSortedTableAs() { String tableName = "test_create_bucketed_sorted_table_as"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "WITH (" + "bucketed_by = ARRAY[ 'custkey', 'custkey2' ], " + "bucket_count = 11, " + "sorted_by = ARRAY[ '+custKey' ]" + ") " + "AS " + "SELECT custkey, custkey AS custkey2, comment, orderstatus " + "FROM tpch.tiny.orders"; assertUpdate(createTable); }

Target:
public void testCreateBucketedSortedTableAs() { assertUpdate("" + "CREATE TABLE test_create_bucketed_sorted_table_as " + "WITH (" + "bucketed_by = ARRAY['custkey', 'custkey2'], " + "bucket_count = 11, " + "sorted_by = ARRAY['+custKey']" + ") " + "AS " + "SELECT custkey, custkey AS custkey2, comment, orderstatus " + "FROM tpch.tiny.orders"); }
Source:
private Map<String, Object> parseHeaderFileInfoStoreInMap(final URL headerURL) throws IOException { Scanner scanner = null; final Map<String, Object> headerMap = new CaseInsensitiveMap<>(); try (InputStream in = headerURL.openStream()) { scanner = new Scanner(in, "UTF-8"); while(scanner.hasNextLine()) { String currLine = scanner.nextLine(); if(currLine.startsWith("m-encrypt") || currLine.startsWith("content")) { String[] fields = currLine.split(":"); if (fields.length == 2) { headerMap.put(fields[0].trim(), fields[1].trim()); } else { LOG.error("Header Field Values parsed from the file are invalid!"); } } } } return headerMap; }

Target:
private Map<String, Object> parseHeaderFileInfoStoreInMap(final URL headerURL) throws IOException { final Map<String, Object> headerMap = new CaseInsensitiveMap<>(); try (InputStream in = headerURL.openStream(); final Scanner scanner = new Scanner(in, StandardCharsets.UTF_8.name())) { while (scanner.hasNextLine()) { String currLine = scanner.nextLine(); if (currLine.startsWith("m-encrypt") || currLine.startsWith("content")) { final String[] fields = currLine.split(":", 2); if (fields.length == 2) { headerMap.put(fields[0].trim(), fields[1].trim()); } else { LOG.error("Header Field Values parsed from the file are invalid!"); } } } } return headerMap; }