auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ValueGetter makeValueGetter(final DimensionSelector selector) { if (selector.getValueCardinality() == 0) { return new ValueGetter() { @Override public String[] get() { return new String[]{ null }; } }; } else { return new ValueGetter() { @Override public String[] get() { final IndexedInts row = selector.getRow(); final int size = row.size(); if (size == 0) { return new String[]{ null }; } else { String[] values = new String[size]; for (int i = 0; i < size; ++i) { values[i] = Strings.emptyToNull(selector.lookupName(row.get(i))); } return values; } } }; } }

Target:
public ValueGetter makeValueGetter(final DimensionSelector selector) { if (selector.getValueCardinality() == 0) { return NULL_VALUE_GETTER; } else { return new ValueGetter() { @Override public String[] get() { final IndexedInts row = selector.getRow(); final int size = row.size(); if (size == 0) { return NULL_VALUE; } else { String[] values = new String[size]; for (int i = 0; i < size; ++i) { values[i] = Strings.emptyToNull(selector.lookupName(row.get(i))); } return values; } } }; } }
Source:
public void setCenter(Node nodeToShow) { this.content.setCenter(nodeToShow); }

Target:
public void setCenter(Node nodeToShow) { closeDetailsView(); this.content.setCenter(nodeToShow); }
Source:
public boolean isEnchantedCreature(MageObject input, Game game) { if (!input.getCardType().contains(CardType.CREATURE)) { return false; } for (UUID attachmentId : ((Permanent)input).getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.getCardType().contains(CardType.ENCHANTMENT)) { return true; } } return false; }

Target:
public boolean isEnchantedCreature(MageObject input, Game game) { if (input != null && !input.getCardType().contains(CardType.CREATURE)) { return false; } for (UUID attachmentId : ((Permanent)input).getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.getCardType().contains(CardType.ENCHANTMENT)) { return true; } } return false; }
Source:
protected Object deleteToken(Object obj, ApiRequest request) { String jwt = ""; Token token = null; if (SecurityConstants.INTERNAL_AUTH_PROVIDERS.contains(SecurityConstants.AUTH_PROVIDER.get())) { for (TokenCreator tokenCreator : tokenCreators) { if (tokenCreator.isConfigured() && tokenCreator.providerType().equalsIgnoreCase(SecurityConstants.AUTH_PROVIDER.get())) { if (!SecurityConstants.SECURITY.get()) { tokenCreator.reset(); } jwt = tokenCreator.getTokenJWTValue(); token = tokenCreator.getCurrentToken(); break; } } } else { if (externalAuthProvider.isConfigured()) { jwt = tokenUtil.getJWT(); token = externalAuthProvider.readCurrentToken(); } } if(StringUtils.isBlank(jwt)) { throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "JWTNotProvided", "Request does not contain JWT cookie", null); } AuthToken authToken= authTokenDao.getTokenByKey(jwt); String tokenId = (String)ApiContext.getContext().getIdFormatter().formatId(objectManager.getType(Account.class), authToken.getId()); if(!StringUtils.equals(tokenId, token.getId())) { throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "TokenIDMismatch", "JWT and Token ID do not match", null); } request.setResponseCode(ResponseCodes.NO_CONTENT); if(authTokenDao.deleteToken(jwt)) { return obj; } return null; }

Target:
protected Object deleteToken(Object obj, ApiRequest request) { Token token = new Token(); String jwt = ""; token = listToken(); jwt = token.getJwt(); if(StringUtils.isBlank(jwt)) { throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "JWTNotProvided", "Request does not contain JWT cookie", null); } request.setResponseCode(ResponseCodes.NO_CONTENT); HttpServletResponse response = request.getServletContext().getResponse(); String cookieString="token=;Path=/;Expires=Thu, 01 Jan 1970 00:00:00 GMT;"; response.addHeader("Set-Cookie", cookieString); request.getServletContext().setResponse(response); if(authTokenDao.deleteToken(jwt)) { return obj; } return null; }
Source:
private boolean runReadyJob(final ExecutableNode node) throws IOException { if (Status.isStatusFinished(node.getStatus()) || Status.isStatusRunning(node.getStatus())) { return false; } final Status nextNodeStatus = getImpliedStatus(node); if (nextNodeStatus == null) { return false; } if (nextNodeStatus == Status.CANCELLED) { if (node instanceof ExecutableFlow && node.getParentFlow() == null) { logger.info(String.format("Flow '%s' was cancelled before execution had started.", node.getId())); finalizeFlow((ExecutableFlow) node); } else { this.logger.info("Cancelling '" + node.getNestedId() + "' due to prior errors."); node.cancelNode(System.currentTimeMillis()); finishExecutableNode(node); } } else if (nextNodeStatus == Status.SKIPPED) { this.logger.info("Skipping disabled job '" + node.getId() + "'."); node.skipNode(System.currentTimeMillis()); finishExecutableNode(node); } else if (nextNodeStatus == Status.READY) { if (node instanceof ExecutableFlowBase) { final ExecutableFlowBase flow = ((ExecutableFlowBase) node); this.logger.info("Running flow '" + flow.getNestedId() + "'."); flow.setStatus(Status.RUNNING); if (flow.getStartTime() <= 0) { flow.setStartTime(System.currentTimeMillis()); } prepareJobProperties(flow); for (final String startNodeId : ((ExecutableFlowBase) node).getStartNodes()) { final ExecutableNode startNode = flow.getExecutableNode(startNodeId); runReadyJob(startNode); } } else { runExecutableNode(node); } } return true; }

Target:
private boolean runReadyJob(final ExecutableNode node) throws IOException { if (Status.isStatusFinished(node.getStatus()) || Status.isStatusRunning(node.getStatus())) { return false; } final Status nextNodeStatus = getImpliedStatus(node); if (nextNodeStatus == null) { return false; } if (nextNodeStatus == Status.CANCELLED) { if (node instanceof ExecutableFlow && node.getParentFlow() == null) { this.logger.info(String.format("Flow '%s' was cancelled before execution had started.", node.getId())); finalizeFlow((ExecutableFlow) node); } else { this.logger.info(String.format("Cancelling '%s' due to prior errors.", node.getNestedId())); node.cancelNode(System.currentTimeMillis()); finishExecutableNode(node); } } else if (nextNodeStatus == Status.SKIPPED) { this.logger.info("Skipping disabled job '" + node.getId() + "'."); node.skipNode(System.currentTimeMillis()); finishExecutableNode(node); } else if (nextNodeStatus == Status.READY) { if (node instanceof ExecutableFlowBase) { final ExecutableFlowBase flow = ((ExecutableFlowBase) node); this.logger.info("Running flow '" + flow.getNestedId() + "'."); flow.setStatus(Status.RUNNING); if (flow.getStartTime() <= 0) { flow.setStartTime(System.currentTimeMillis()); } prepareJobProperties(flow); for (final String startNodeId : ((ExecutableFlowBase) node).getStartNodes()) { final ExecutableNode startNode = flow.getExecutableNode(startNodeId); runReadyJob(startNode); } } else { runExecutableNode(node); } } return true; }
Source:
public String toString() { return "custom toString"; }

Target:
public String toString() { return CUSTOM_TO_STRING; }
Source:
protected void localize() { generalTab.setLabel(constants.generalTabNetworkPopup()); clusterTab.setLabel(constants.clusterTabNetworkPopup()); profilesTab.setLabel(constants.profilesTabNetworkPopup()); subnetTab.setLabel(constants.subnetTabNetworkPopup()); dataCenterEditor.setLabel(constants.networkPopupDataCenterLabel()); assignLabel.setText(constants.networkPopupAssignLabel()); nameEditor.setLabel(constants.nameLabel()); descriptionEditor.setLabel(constants.descriptionLabel()); exportLabel.setText(constants.exportLabel()); exportEditor.setLabel(constants.exportCheckboxLabel()); externalProviderEditor.setLabel(constants.externalProviderLabel()); neutronPhysicalNetwork.setLabel(constants.neutronPhysicalNetwork()); networkLabel.setLabel(constants.networkLabel()); commentEditor.setLabel(constants.commentLabel()); isVmNetworkEditor.setLabel(constants.vmNetworkLabel()); vlanTagging.setLabel(constants.enableVlanTagLabel()); qosEditor.setLabel(constants.hostNetworkQos()); createSubnetEditor.setLabel(constants.createSubnetLabel()); profilesLabel.setText(constants.profilesLabel()); shouldSetDnsConfigurationEditor.setLabel(constants.shouldSetDnsConfigurationLabel()); }

Target:
protected void localize() { generalTab.setLabel(constants.generalTabNetworkPopup()); clusterTab.setLabel(constants.clusterTabNetworkPopup()); profilesTab.setLabel(constants.profilesTabNetworkPopup()); subnetTab.setLabel(constants.subnetTabNetworkPopup()); dataCenterEditor.setLabel(constants.networkPopupDataCenterLabel()); assignLabel.setText(constants.networkPopupAssignLabel()); nameEditor.setLabel(constants.nameLabel()); descriptionEditor.setLabel(constants.descriptionLabel()); exportLabel.setText(constants.exportLabel()); exportEditor.setLabel(constants.exportCheckboxLabel()); externalProviderEditor.setLabel(constants.externalProviderLabel()); neutronPhysicalNetwork.setLabel(constants.neutronPhysicalNetwork()); networkLabel.setLabel(constants.networkLabel()); commentEditor.setLabel(constants.commentLabel()); isVmNetworkEditor.setLabel(constants.vmNetworkLabel()); vlanTagging.setLabel(constants.enableVlanTagLabel()); qosEditor.setLabel(constants.hostNetworkQos()); createSubnetEditor.setLabel(constants.createSubnetLabel()); profilesLabel.setText(constants.profilesLabel()); }
Source:
Exception onConferenceCallStarted(Call jvbConferenceCall) { this.jvbCall = jvbConferenceCall; this.chatRoom = super.jvbConference.getJvbRoom(); if(!service.isConfiguredProperly()) { logger.warn("TranscriptionService is not properly configured"); sendMessageToRoom("Transcriber is not properly " + "configured. Contact the service administrators and let them " + "know! I will now leave."); jvbConference.stop(); return null; } jvbConferenceCall.setConference(new MediaAwareCallConference() { @Override public MediaDevice getDefaultDevice(MediaType mediaType, MediaUseCase useCase) { if(MediaType.AUDIO.equals(mediaType)) { return transcriber.getMediaDevice(); } return super.getDefaultDevice(mediaType, useCase); } }); for (TranscriptionResultPublisher pub : handler.getTranscriptResultPublishers()) { if (pub instanceof TranscriptionEventListener) transcriber.addTranscriptionEventListener( (TranscriptionEventListener)pub); } transcriber.addTranscriptionEventListener(this); transcriber.start(); addInitialMembers(); StringBuilder welcomeMessage = new StringBuilder("Started transcription!\n"); finalTranscriptPromises.addAll(handler.getTranscriptPublishPromises()); for(TranscriptPublisher.Promise promise : finalTranscriptPromises) { if(promise.hasDescription()) { welcomeMessage.append(promise.getDescription()); } if(promise.wantsAudioRecording()) { promise.giveAudioMixerMediaDevice(transcriber.getMediaDevice()); } } sendMessageToRoom(welcomeMessage.toString()); logger.debug("TranscriptionGatewaySession started transcribing"); return null; }

Target:
Exception onConferenceCallStarted(Call jvbConferenceCall) { this.jvbCall = jvbConferenceCall; this.chatRoom = super.jvbConference.getJvbRoom(); if(!service.isConfiguredProperly()) { logger.warn("TranscriptionService is not properly configured"); sendMessageToRoom("Transcriber is not properly " + "configured. Contact the service administrators and let them " + "know! I will now leave."); jvbConference.stop(); return null; } jvbConferenceCall.setConference(new MediaAwareCallConference() { @Override public MediaDevice getDefaultDevice(MediaType mediaType, MediaUseCase useCase) { if(MediaType.AUDIO.equals(mediaType)) { return transcriber.getMediaDevice(); } return super.getDefaultDevice(mediaType, useCase); } }); for (TranscriptionResultPublisher pub : handler.getTranscriptResultPublishers()) { if (pub instanceof TranscriptionEventListener) transcriber.addTranscriptionEventListener( (TranscriptionEventListener)pub); } transcriber.addTranscriptionEventListener(this); transcriber.start(); addInitialMembers(); StringBuilder welcomeMessage = new StringBuilder("Started transcription!\n"); finalTranscriptPromises.addAll(handler.getTranscriptPublishPromises()); for(TranscriptPublisher.Promise promise : finalTranscriptPromises) { if(promise.hasDescription()) { welcomeMessage.append(promise.getDescription()); } promise.maybeStartRecording(transcriber.getMediaDevice()); } sendMessageToRoom(welcomeMessage.toString()); logger.debug("TranscriptionGatewaySession started transcribing"); return null; }
Source:
public void handle(Willie bot, Channel channel, User sender, String[] args) { if (args.length < 1) { channel.sendMessage(Colors.RED + "Please supply a message " + sender.getNick() + "!"); return; } try {ChatterBotFactory factory = new ChatterBotFactory(); ChatterBot cbot = factory.create(ChatterBotType.CLEVERBOT); ChatterBotSession cBotSession = cbot.createSession(); StringBuilder question = new StringBuilder(); for (String arg : args) { question.append(arg + " "); } String cBotResponce = cBotSession.think(question.toString()); channel.sendMessage(Colors.CYAN + "Cleverbot's responce: " + Colors.DARK_GREEN + cBotResponce); } catch (Exception e) { e.printStackTrace(); channel.sendMessage(Colors.RED + "Error Occured! " + e.getMessage()); } }

Target:
public void handle(Willie bot, Channel channel, User sender, String[] args) { if (args.length < 1) { channel.sendMessage(Colors.RED + "Please supply a message " + sender.getNick() + "!"); return; } try {ChatterBotFactory factory = new ChatterBotFactory(); ChatterBot cbot = factory.create(ChatterBotType.CLEVERBOT); ChatterBotSession cBotSession = cbot.createSession(); StringBuilder question = new StringBuilder(); for (String arg : args) { question.append(arg + " "); } String cBotResponce = cBotSession.think(question.toString().trim()).trim(); channel.sendMessage(Colors.CYAN + "Cleverbot's responce: " + Colors.DARK_GREEN + cBotResponce); } catch (Exception e) { e.printStackTrace(); channel.sendMessage(Colors.RED + "Error Occured! " + e.getMessage()); } }
Source:
public void run() { while (!stopped) { synchronized (cleanEvent) { try { if (!stopped && deadWatchers.size() < watcherCleanThreshold) { int maxWaitMs = (watcherCleanIntervalInSeconds + r.nextInt(watcherCleanIntervalInSeconds / 2 + 1)) * 1000; cleanEvent.wait(maxWaitMs); } } catch (InterruptedException e) { LOG.info("Received InterruptedException while " + "waiting for cleanEvent"); break; } } if (deadWatchers.isEmpty()) { continue; } synchronized (this) { final Set<Integer> snapshot = new HashSet<Integer>(deadWatchers); deadWatchers.clear(); int total = snapshot.size(); LOG.info("Processing dead watchers", total); cleaners.schedule(new WorkRequest() { @Override public void doWork() throws Exception { long startTime = Time.currentElapsedTime(); listener.processDeadWatchers(snapshot); long latency = Time.currentElapsedTime() - startTime; LOG.info("Takes to process watchers", latency, total); totalDeadWatchers.addAndGet(-total); synchronized(processingCompletedEvent) { processingCompletedEvent.notifyAll(); } } }); } } LOG.info("WatcherCleaner thread exited"); }

Target:
public void run() { while (!stopped) { synchronized (cleanEvent) { try { if (!stopped && deadWatchers.size() < watcherCleanThreshold) { int maxWaitMs = (watcherCleanIntervalInSeconds + r.nextInt(watcherCleanIntervalInSeconds / 2 + 1)) * 1000; cleanEvent.wait(maxWaitMs); } } catch (InterruptedException e) { LOG.info("Received InterruptedException while " + "waiting for cleanEvent"); break; } } if (deadWatchers.isEmpty()) { continue; } synchronized (this) { final Set<Integer> snapshot = new HashSet<Integer>(deadWatchers); deadWatchers.clear(); int total = snapshot.size(); LOG.info("Processing dead watchers", total); cleaners.schedule(new WorkRequest() { @Override public void doWork() throws Exception { long startTime = Time.currentElapsedTime(); listener.processDeadWatchers(snapshot); long latency = Time.currentElapsedTime() - startTime; LOG.info("Takes to process watches", latency, total); totalDeadWatchers.addAndGet(-total); synchronized(processingCompletedEvent) { processingCompletedEvent.notifyAll(); } } }); } } LOG.info("WatcherCleaner thread exited"); }
Source:
public void testQueryConflictCase() { String randomColumn = "random"; Uri uri = Carriers.CONTENT_URI; ContentValues contentValues = new ContentValues(); contentValues.put(Carriers.NAME, NAME); contentValues.put(Carriers.APN, APN); contentValues.put(Carriers.PORT, PORT); contentValues.put(Carriers.PROTOCOL, PROTOCOL); contentValues.put(Carriers.NUMERIC, NUMERIC); try { Log.d(TAG, "testInsertCarriers Inserting contentValues: " + contentValues); mContentResolver.insert(uri, contentValues); final String[] testProjection = { Carriers.NAME, Carriers.APN, Carriers.PORT, Carriers.PROTOCOL, Carriers.NUMERIC, }; final String selection = randomColumn + "=?"; String[] selectionArgs = { randomColumn }; Log.d(TAG, "testInsertCarriers query projection: " + testProjection + "\ntestInsertCarriers selection: " + selection + "\ntestInsertCarriers selectionArgs: " + selectionArgs); Cursor cursor = mContentResolver.query(uri, testProjection, selection, selectionArgs, null); assertNull(cursor); final String selectionToDelete = Carriers.NAME + "=?"; String[] selectionArgsToDelete = { NAME }; Log.d(TAG, "testInsertCarriers deleting selection: " + selectionToDelete + "testInsertCarriers selectionArgs: " + selectionArgs); int numRowsDeleted = mContentResolver.delete(uri, selectionToDelete, selectionArgsToDelete); assertEquals(1, numRowsDeleted); cursor = mContentResolver.query( uri, testProjection, selectionToDelete, selectionArgsToDelete, null); assertEquals(0, cursor.getCount()); } catch (SecurityException e) { failMessage(); } }

Target:
public void testQueryConflictCase() { String invalidColumn = "random"; Uri uri = Carriers.CONTENT_URI; ContentValues contentValues = new ContentValues(); contentValues.put(Carriers.NAME, NAME); contentValues.put(Carriers.APN, APN); contentValues.put(Carriers.PORT, PORT); contentValues.put(Carriers.PROTOCOL, PROTOCOL); contentValues.put(Carriers.NUMERIC, NUMERIC); try { Log.d(TAG, "testInsertCarriers Inserting contentValues: " + contentValues); mContentResolver.insert(uri, contentValues); final String[] testProjection = { Carriers.NAME, Carriers.APN, Carriers.PORT, Carriers.PROTOCOL, Carriers.NUMERIC, }; final String selection = invalidColumn + "=?"; String[] selectionArgs = { invalidColumn }; Log.d(TAG, "testInsertCarriers query projection: " + testProjection + "\ntestInsertCarriers selection: " + selection + "\ntestInsertCarriers selectionArgs: " + selectionArgs); Cursor cursor = mContentResolver.query(uri, testProjection, selection, selectionArgs, null); assertNull(cursor); final String selectionToDelete = Carriers.NAME + "=?"; String[] selectionArgsToDelete = { NAME }; Log.d(TAG, "testInsertCarriers deleting selection: " + selectionToDelete + "testInsertCarriers selectionArgs: " + selectionArgs); int numRowsDeleted = mContentResolver.delete(uri, selectionToDelete, selectionArgsToDelete); assertEquals(1, numRowsDeleted); cursor = mContentResolver.query( uri, testProjection, selectionToDelete, selectionArgsToDelete, null); assertEquals(0, cursor.getCount()); } catch (SecurityException e) { failMessage(); } }
Source:
public void paintControl(PaintEvent e) { if (fIsUpdate && (fStartTime != fEndTime)) { IAxis xAxis = getChart().getAxisSet().getXAxis(0); int startX = xAxis.getPixelCoordinate(fStartTime); int endX = xAxis.getPixelCoordinate(fEndTime); if (fStartTime < fEndTime) { e.gc.setBackground(TmfXYChartViewer.getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND)); e.gc.fillRectangle(startX, 0, endX - startX, e.height); } else { e.gc.setBackground(TmfXYChartViewer.getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND)); e.gc.fillRectangle(endX, 0, startX - endX, e.height); } e.gc.drawLine(startX, 0, startX, e.height); e.gc.drawLine(endX, 0, endX, e.height); } }

Target:
public void paintControl(PaintEvent e) { if (fIsUpdate && (fStartTime != fEndTime)) { IAxis xAxis = getChart().getAxisSet().getXAxis(0); int startX = xAxis.getPixelCoordinate(fStartTime); int endX = xAxis.getPixelCoordinate(fEndTime); e.gc.setBackground(TmfXYChartViewer.getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND)); if (fStartTime < fEndTime) { e.gc.fillRectangle(startX, 0, endX - startX, e.height); } else { e.gc.fillRectangle(endX, 0, startX - endX, e.height); } e.gc.drawLine(startX, 0, startX, e.height); e.gc.drawLine(endX, 0, endX, e.height); } }
Source:
public String getAppointmentByAppointmentID(@PathVariable("id") int id) { System.out.println("PathVariable is" + id); return jsonUtil.toJson(appointmentDAOMock.getAppointmentByAppointmentID(id)); }

Target:
public Appointment getAppointmentByAppointmentID(@PathVariable("id") int id) { return appointmentDAO.getAppointmentByAppointmentID(id); }
Source:
private void activate() { ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); NamespaceContextSelector.pushCurrentSelector(this.getNamespaceContextSelector()); this.endpoint.activate(endpointFactory, activationSpec); NamespaceContextSelector.popCurrentSelector(); } catch (Exception e) { throw EjbLogger.ROOT_LOGGER.failedToActivateMdb(getComponentName(), e); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } }

Target:
private void activate() { ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); NamespaceContextSelector.pushCurrentSelector(this.getNamespaceContextSelector()); try { this.endpoint.activate(endpointFactory, activationSpec); } finally { NamespaceContextSelector.popCurrentSelector(); } } catch (Exception e) { throw EjbLogger.ROOT_LOGGER.failedToActivateMdb(getComponentName(), e); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } }
Source:
protected void executeQueryCommand() { Provider<?> provider = getProvider(); try { ProviderProxy proxy = ProviderProxyFactory.getInstance().create(provider); List<? extends Certificate> chain = proxy.getCertificateChain(); if (!chain.isEmpty()) { List<CertificateInfo> results = new ArrayList<CertificateInfo>(); for (Certificate cert : chain) { results.add(createCertificateInfo((X509Certificate) cert)); } getQueryReturnValue().setReturnValue(results); } } catch (Exception e) { log.error("Error in encoding certificate. Error is " + e.getMessage()); if (log.isDebugEnabled()) { log.debug("", e); } } }

Target:
protected void executeQueryCommand() { Provider<?> provider = getProvider(); try { ProviderProxy proxy = ProviderProxyFactory.getInstance().create(provider); List<? extends Certificate> chain = proxy.getCertificateChain(); if (!chain.isEmpty()) { List<CertificateInfo> results = new ArrayList<CertificateInfo>(); for (Certificate cert : chain) { results.add(createCertificateInfo((X509Certificate) cert)); } getQueryReturnValue().setReturnValue(results); } } catch (Exception e) { log.error("Error in encoding certificate. Error is " + e.getMessage()); log.debug("Exeption:", e); } }
Source:
private GeneratorSwapIborIborMaster() { _iborIndexMaster = IndexIborMaster.getInstance(); final Calendar baseCalendar = new CalendarNoHoliday("No Holidays"); _generatorSwap = new HashMap<>(); _generatorSwap.put(AUDBBSW3MBBSW6M, new GeneratorSwapIborIbor(AUDBBSW3MBBSW6M, _iborIndexMaster.getIndex("AUDBB3M"), _iborIndexMaster.getIndex("AUDBB6M"), baseCalendar, baseCalendar)); _generatorSwap.put(EUREURIBOR3MEURIBOR6M, new GeneratorSwapIborIbor(EUREURIBOR3MEURIBOR6M, _iborIndexMaster.getIndex("EURIBOR3M"), _iborIndexMaster.getIndex("EURIBOR6M"), baseCalendar, baseCalendar)); _generatorSwap.put(JPYLIBOR6MLIBOR3M, new GeneratorSwapIborIbor(JPYLIBOR6MLIBOR3M, _iborIndexMaster.getIndex("JPYLIBOR3M"), _iborIndexMaster.getIndex("JPYLIBOR6M"), baseCalendar, baseCalendar)); }

Target:
private GeneratorSwapIborIborMaster() { _iborIndexMaster = IndexIborMaster.getInstance(); final Calendar baseCalendar = new CalendarNoHoliday("No Holidays"); _generatorSwap = new HashMap<>(); _generatorSwap.put(AUDBBSW3MBBSW6M, new GeneratorSwapIborIbor(AUDBBSW3MBBSW6M, _iborIndexMaster.getIndex(IndexIborMaster.AUDBB3M), _iborIndexMaster.getIndex(IndexIborMaster.AUDBB6M), baseCalendar, baseCalendar)); _generatorSwap.put(EUREURIBOR3MEURIBOR6M, new GeneratorSwapIborIbor(EUREURIBOR3MEURIBOR6M, _iborIndexMaster.getIndex(IndexIborMaster.EURIBOR3M), _iborIndexMaster.getIndex(IndexIborMaster.EURIBOR6M), baseCalendar, baseCalendar)); _generatorSwap.put(JPYLIBOR6MLIBOR3M, new GeneratorSwapIborIbor(JPYLIBOR6MLIBOR3M, _iborIndexMaster.getIndex(IndexIborMaster.JPYLIBOR3M), _iborIndexMaster.getIndex(IndexIborMaster.JPYLIBOR6M), baseCalendar, baseCalendar)); }
Source:
private void updateGitIgnore(File gitIgnore, String entry) throws CoreException { try { if (!gitIgnore.exists()) { if (!gitIgnore.createNewFile()) { String error = NLS.bind( CoreText.IgnoreOperation_creatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, null)); } } else { entry = getEntry(gitIgnore, entry); } FileOutputStream os = new FileOutputStream(gitIgnore, true); try { os.write(entry.getBytes()); } finally { os.close(); } } catch (IOException e) { String error = NLS.bind(CoreText.IgnoreOperation_updatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, e)); } }

Target:
private void updateGitIgnore(File gitIgnore, String entry) throws CoreException { try { if (!gitIgnore.exists()) { if (!gitIgnore.createNewFile()) { String error = NLS.bind( CoreText.IgnoreOperation_creatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, null)); } } else entry = getEntry(gitIgnore, entry); FileOutputStream os = new FileOutputStream(gitIgnore, true); try { os.write(entry.getBytes()); } finally { os.close(); } } catch (IOException e) { String error = NLS.bind(CoreText.IgnoreOperation_updatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, e)); } }
Source:
public void addWhiteSpace() { Pattern pattern = Pattern.compile("((/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/)|( int seed = 0; for (NonTerminal nonTerminal : getAllNonTerminals()) { for (State s : nonTerminal.getReachableStates()) { if (s instanceof PrimitiveState) { PrimitiveState ps = ((PrimitiveState) s); PrimitiveState whitespace = new RegExState( new StateId("whitespace" + seed++), s.nt, pattern, KSorts.K); RuleState deleteToken = new RuleState( new StateId("whitespace-D-" + seed++), s.nt, new DeleteRule(1, true)); whitespace.next.add(deleteToken); deleteToken.next.addAll(ps.next); ps.next.clear(); ps.next.add(whitespace); } } } for (Entry<NonTerminalId, NonTerminal> entry : startNonTerminals.entrySet()) { NonTerminal nt = entry.getValue(); NonTerminal whiteStartNt = new NonTerminal(new NonTerminalId(nt.nonTerminalId.name)); PrimitiveState whitespace = new RegExState( new StateId("whitespace-" + seed++), whiteStartNt, pattern, KSorts.K); NonTerminalState nts = new NonTerminalState( new StateId("white-calls-" + nt.nonTerminalId.name), whiteStartNt, nt, false); RuleState deleteToken = new RuleState( new StateId("whitespace-D-" + seed++), whiteStartNt, new DeleteRule(1, true)); nt.nonTerminalId = new NonTerminalId(nt.nonTerminalId.name + "-afterWhite"); whiteStartNt.entryState.next.add(whitespace); whitespace.next.add(deleteToken); deleteToken.next.add(nts); nts.next.add(whiteStartNt.exitState); entry.setValue(whiteStartNt); } }

Target:
public void addWhiteSpace() { for (NonTerminal nonTerminal : getAllNonTerminals()) { for (State s : nonTerminal.getReachableStates()) { if (s instanceof PrimitiveState) { PrimitiveState ps = ((PrimitiveState) s); addWhitespace(ps); } } } for (NonTerminal nt : startNonTerminals.values()) { addWhitespace(nt.entryState); } }
Source:
public final List<E> getEntries() { if(isStreamable()) { return new ArrayList<>(0); } final List<SecondaryIndexQueryOperation.Response.Entry> coreEntries = coreResponse.getEntryList(); final List<E> convertedList = new ArrayList<>(coreEntries.size()); for (SecondaryIndexQueryOperation.Response.Entry e : coreEntries) { final E ce = createEntry(queryLocation, e, converter); convertedList.add(ce); } return convertedList; }

Target:
public final List<E> getEntries() { if(isStreaming()) { throw new IllegalStateException("Use the iterator() while using the streaming API"); } final List<SecondaryIndexQueryOperation.Response.Entry> coreEntries = coreResponse.getEntryList(); final List<E> convertedList = new ArrayList<>(coreEntries.size()); for (SecondaryIndexQueryOperation.Response.Entry e : coreEntries) { final E ce = createEntry(queryLocation, e, converter); convertedList.add(ce); } return convertedList; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } OAuthProvider that = (OAuthProvider) o; return Objects.equals(name, that.name) && Objects.equals(tokenEndpoint, that.tokenEndpoint) && Objects.equals(clientId, that.clientId) && Objects.equals(clientSecret, that.clientSecret) && Objects.equals(tokenRequestInitialDelay, that.tokenRequestInitialDelay) && Objects.equals(tokenRequestMaxDelay, that.tokenRequestMaxDelay) && Objects.equals(requestTimeout, that.requestTimeout); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } OAuthProvider that = (OAuthProvider) o; return Objects.equals(name, that.name); }
Source:
public InterpreterResultMessage(InterpreterResult.Type type, String data) { this.type = type; this.data = data; this.msgColumnTypes = new MessageColumnTypes(); }

Target:
public InterpreterResultMessage(InterpreterResult.Type type, String data) { this(type, data, new ArrayList<>()); }
Source:
public void testexpandTreeRowToLevel() { SWTBotNatTable nattable = bot.nattable(); nattable.collaspeAll(POSITION); nattable.expandTreeRowToLevel(POSITION, 0, 1); int count = nattable.preferredRowCount(); assertEquals("After expandTreeRowToLevel 1", 16, count); assertEquals("Cell data of 3,1", "C", nattable.getCellDataValueByPosition(2, 1)); nattable.expandTreeRowToLevel(POSITION, 1, 2); assertEquals("Cell data of 3,1", "C.5", bot.nattable().getCellDataValueByPosition(3, 1)); count = nattable.preferredRowCount(); assertEquals("After expandTreeRowToLevel 2", 17, count); }

Target:
public void testexpandTreeRowToLevel() { SWTBotNatTable nattable = bot.nattable(); nattable.collapseAll(POSITION); nattable.expandTreeRowToLevel(POSITION, 0, 1); int count = nattable.preferredRowCount(); assertEquals("After expandTreeRowToLevel 1", 16, count); assertEquals("Cell data of 2,1", "C", nattable.getCellDataValueByPosition(2, 1)); nattable.expandTreeRowToLevel(POSITION, 1, 2); assertEquals("Cell data of 3,1", "C.5", bot.nattable().getCellDataValueByPosition(3, 1)); count = nattable.preferredRowCount(); assertEquals("After expandTreeRowToLevel 2", 17, count); }
Source:
public DefaultVaultTranscriber(final VaultProvider provider) { if (provider == null) { throw new IllegalArgumentException("Required VaultProvider not specified - check vault configuration"); } this.provider = provider; }

Target:
public DefaultVaultTranscriber(final VaultProvider provider) { if (provider == null) { this.provider = new VaultProvider() { @Override public VaultRawSecret obtainSecret(String vaultSecretId) { return DefaultVaultRawSecret.forBuffer(null); } @Override public void close() { } }; } else { this.provider = provider; } }
Source:
public void ifBlockComment(Consumer<BlockComment> action) { if (isBlockComment()) { action.accept(asBlockComment()); } }

Target:
public void ifBlockComment(Consumer<BlockComment> action) { }
Source:
public String pinLs() { String pinnedJsonString = null; HttpGet request = new HttpGet(baseUrl + "pin/ls?type=recursive&quiet=true"); try { CloseableHttpResponse response = client.execute(request); try { int statusCode = response.getStatusLine().getStatusCode(); HttpEntity resEntity = response.getEntity(); if (statusCode == HttpStatus.SC_OK && resEntity != null) { pinnedJsonString = EntityUtils.toString(resEntity, "UTF-8"); } else { LOG.error("Failed to get pinned objects with unexpected statuscode " + statusCode); } } finally { response.close(); } } catch (IOException e) { LOG.error("Http request failed to send to " + baseUrl, e); } return pinnedJsonString; }

Target:
public String pinLs() { String pinnedJsonString = null; HttpGet request = new HttpGet(baseUrl + "pin/ls?type=recursive&quiet=true"); CloseableHttpResponse response = null; try { response = client.execute(request); int statusCode = response.getStatusLine().getStatusCode(); HttpEntity resEntity = response.getEntity(); if (statusCode == HttpStatus.SC_OK && resEntity != null) { pinnedJsonString = EntityUtils.toString(resEntity, "UTF-8"); } else { LOG.error("Failed to get pinned objects with unexpected statuscode " + statusCode); } } catch (IOException e) { LOG.error("Http request failed to send to " + baseUrl, e); } finally { try { response.close(); } catch (IOException | NullPointerException e) { LOG.error("Failed to close response", e); } } return pinnedJsonString; }
Source:
protected void runTask() { try { ingestProcessor.process(programsFile, seasonsFile, scheduleFile, programDescriptionsFile, episodeSequenceFile); } catch (IOException e) { LOG.error("Error while processing programs", e); } }

Target:
protected void runTask() { try { ingestProcessor.process(programsFile, seasonsFile, scheduleFile, programDescriptionsFile, episodeSequenceFile); } catch (IOException e) { throw Throwables.propagate(e); } }
Source:
void notifyJar(File jar) { for (Listener listener : listeners) { listener.onJar(this, jar); } }

Target:
void notifyJar(File jar) { for (Listener listener : listeners) { try { listener.onJar(this, jar); } catch (Throwable x) { logger.log(Level.WARNING, null, x); } } }
Source:
public String localSiteName() { return findRelay2().site(); }

Target:
public String localSiteName() { RELAY2 relay2 = findRelay2(); return relay2 == null ? null : relay2.site(); }
Source:
@Override public @Nullable Object decode(GridNioSession ses, ByteBuffer buf) { ClientMessageDecoder decoder = ses.meta(SES_META_DECODER); if (decoder == null) { decoder = new ClientMessageDecoder(); ses.addMeta(SES_META_DECODER, decoder); } byte[] bytes = decoder.apply(buf); if (bytes == null) return null; return ByteBuffer.wrap(bytes).order(ByteOrder.nativeOrder()); }

Target:
@Override public @Nullable Object decode(GridNioSession ses, ByteBuffer buf) { ClientMessageDecoder decoder = ses.meta(SES_META_DECODER); if (decoder == null) { decoder = new ClientMessageDecoder(); ses.addMeta(SES_META_DECODER, decoder); } byte[] bytes = decoder.apply(buf); if (bytes == null) return null; return ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); }
Source:
public static Path createTempFiles( final String prefix, final int numFiles, final long length) throws IOException { LOG.info("Creating files of size {}...", numFiles, length); final Path tempDir = Files.createTempDirectory(prefix); for(int fileNum = 0; fileNum < numFiles; fileNum++) { final File tempFile = new File(tempDir.toString(), prefix + "_" + fileNum); final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw"); raf.seek(length); raf.writeBytes("end of RandomAccessFile."); raf.close(); } return tempDir; }

Target:
public static Path createTempFiles( final String prefix, final int numFiles, final long length) throws IOException { LOG.info("Creating files of size {}...", numFiles, length); final Path tempDir = Files.createTempDirectory(prefix); for(int fileNum = 0; fileNum < numFiles; fileNum++) { final File tempFile = new File(tempDir.toString(), prefix + "_" + fileNum); try (final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw")) { raf.seek(length); raf.writeBytes("end of RandomAccessFile."); } } return tempDir; }
Source:
static String readLine(BufferedReader in, File inputFile) { String line = null; try { line = in.readLine(); } catch (Exception e) { logger.error("Can't read from '" + inputFile + "': " + e); System.exit(1); } return line; }

Target:
static String readLine(BufferedReader in, File inputFile) { String line = null; try { line = in.readLine(); } catch (Exception e) { System.err.println("Can't read from '" + inputFile + "': " + e); System.exit(1); } return line; }
Source:
public void shouldSaveAndUpdateOrderSet() throws Exception { executeDataSet(ORDER_SET); OrderSet orderSet = orderSetBuilder(false, false); orderSet.setRetired(true); OrderSet orderSetObj = orderSetService.save(orderSet); assertEquals("OrderSet should contain orderSetmembers", 1, orderSetObj.getOrderSetMembers().size()); orderSetObj.setOperator(OrderSet.Operator.ONE); orderSetObj.setDescription("Test Order Set Description Updated"); orderSetObj.setOrderSetMembers(new HashSet<OrderSetMember>()); orderSetObj = orderSetService.save(orderSetObj); assertNotNull("OrderSet has a order_set_id", orderSetObj.getId().intValue()); assertEquals("OrderSet has updated description", "Test Order Set Description Updated", orderSetObj.getDescription()); assertEquals("OrderSet has updated operator", "ONE", orderSetObj.getOperator().toString()); assertEquals("OrderSet should not contain orderSetmembers", 0, orderSetObj.getOrderSetMembers().size()); }

Target:
public void shouldSaveAndUpdateOrderSet() throws Exception { executeDataSet(ORDER_SET); OrderSet orderSet = orderSetBuilder(false, false); OrderSet orderSetObj = orderSetService.saveOrderSet(orderSet); orderSetObj.setOperator(OrderSet.Operator.ONE); orderSetObj.setDescription("Test Order Set Description Updated"); assertNull("OrderSet is new and is not changed", orderSetObj.getChangedBy()); assertNull("OrderSet is new and has no change date", orderSetObj.getDateChanged()); orderSetService.saveOrderSet(orderSetObj); Context.flushSession(); assertNotNull("OrderSet has a order_set_id", orderSetObj.getId().intValue()); assertEquals("OrderSet has updated description", "Test Order Set Description Updated", orderSetObj.getDescription()); assertEquals("OrderSet has updated operator", "ONE", orderSetObj.getOperator().toString()); assertNotNull("OrderSet has been changed", orderSetObj.getChangedBy()); assertNotNull("OrderSet has been changed on some date", orderSetObj.getDateChanged()); }
Source:
private String[] getPathArray(String field) { if (field.equals(fPathAsString)) { return fPathAsArray; } StringBuilder sb = new StringBuilder(); List<String> list = new ArrayList<>(); for (int i = 1; i < field.length(); i++) { char charAt = field.charAt(i); if (charAt == SLASH) { list.add(sb.toString()); sb = new StringBuilder(); } else if (charAt == BACKSLASH) { if (i != field.length() - 1) { char nextChar = field.charAt(++i); if (nextChar == SLASH) { sb.append(SLASH); } else { sb.append(BACKSLASH); i--; } } else { sb.append(BACKSLASH); } } else { sb.append(charAt); } } if (sb.toString() != null && sb.toString() != EMPTY_STRING ) { list.add(sb.toString()); } String[] array = new String[list.size()]; list.toArray(array); fPathAsString = field; fPathAsArray = array; return array; }

Target:
private String[] getPathArray(String field) { if (field.equals(fPathAsString)) { return fPathAsArray; } StringBuilder sb = new StringBuilder(); List<String> list = new ArrayList<>(); for (int i = 1; i < field.length(); i++) { char charAt = field.charAt(i); if (charAt == SLASH) { list.add(sb.toString()); sb = new StringBuilder(); } else if (charAt == BACKSLASH) { if (i != field.length() - 1) { char nextChar = field.charAt(++i); if (nextChar == SLASH) { sb.append(SLASH); } else { sb.append(BACKSLASH); i--; } } else { sb.append(BACKSLASH); } } else { sb.append(charAt); } } list.add(sb.toString()); String[] array = new String[list.size()]; list.toArray(array); fPathAsString = field; fPathAsArray = array; return array; }
Source:
private void display() throws Failure { final PrintWriter stdout = toPrintWriter(out); TreeMap<String, TreeNode> treeMap = null; if (showTree) { treeMap = new TreeMap<String, TreeNode>(); } try { for (final Project p : db.projects().all()) { if (p.getNameKey().equals(wildProject)) { continue; } final ProjectState e = projectCache.get(p.getNameKey()); if (e == null) { continue; } final ProjectControl pctl = e.controlFor(currentUser); if (!showTree) { if (!pctl.isVisible()) { continue; } if (showBranch != null) { final Ref ref = getBranchRef(p.getNameKey()); if (ref == null || ref.getObjectId() == null || !pctl.controlForRef(ref.getLeaf().getName()).isVisible()) { continue; } stdout.print(ref.getObjectId().name()); stdout.print(' '); } stdout.print(p.getName()); stdout.println(); } else { TreeNode node = new TreeNode(p, pctl.isVisible()); treeMap.put(p.getName(), node); } } if (showTree && treeMap.size() > 0) { final List<TreeNode> sortedNodes = new ArrayList<TreeNode>(); for(final TreeNode key : treeMap.values()) { final String parentName = key.getParentName(); if (parentName != null) { final TreeNode node = (TreeNode)treeMap.get((String)parentName); node.addChild(key); } else { sortedNodes.add(key); } } final TreeNode fakeRoot = new TreeNode(null, sortedNodes, false); printElement(stdout, fakeRoot, -1, false, sortedNodes.get(sortedNodes.size() - 1)); } } catch (OrmException e) { throw new Failure(1, "fatal: database error", e); } finally { stdout.flush(); } }

Target:
private void display() throws Failure { if (showTree && (showBranch != null)) { throw new UnloggedFailure(1, "fatal: --tree and --show-branch options are not compatible."); } final PrintWriter stdout = toPrintWriter(out); TreeMap<String, TreeNode> treeMap = null; if (showTree) { treeMap = new TreeMap<String, TreeNode>(); } try { for (final Project p : db.projects().all()) { if (p.getNameKey().equals(wildProject)) { continue; } final ProjectState e = projectCache.get(p.getNameKey()); if (e == null) { continue; } final ProjectControl pctl = e.controlFor(currentUser); if (!showTree) { if (!pctl.isVisible()) { continue; } if (showBranch != null) { final Ref ref = getBranchRef(p.getNameKey()); if (ref == null || ref.getObjectId() == null || !pctl.controlForRef(ref.getLeaf().getName()).isVisible()) { continue; } stdout.print(ref.getObjectId().name()); stdout.print(' '); } stdout.print(p.getName() + "\n"); } else { treeMap.put(p.getName(), new TreeNode(p, pctl.isVisible())); } } if (showTree && treeMap.size() > 0) { final List<TreeNode> sortedNodes = new ArrayList<TreeNode>(); for (final TreeNode key : treeMap.values()) { final String parentName = key.getParentName(); if (parentName != null) { final TreeNode node = treeMap.get((String)parentName); if (node != null) { node.addChild(key); } else { sortedNodes.add(key); } } else { sortedNodes.add(key); } } final TreeNode fakeRoot = new TreeNode(null, sortedNodes, false); printElement(stdout, fakeRoot, -1, false, sortedNodes.get(sortedNodes.size() - 1)); stdout.flush(); } } catch (OrmException e) { throw new Failure(1, "fatal: database error", e); } finally { stdout.flush(); } }
Source:
private static int getNeededNumberOfUsbControllers(int numberOfSlots) { int numOfcontrollers = numberOfSlots / SLOTS_PER_CONTROLLER; if (numOfcontrollers == 0) { numOfcontrollers = 1; } return numOfcontrollers; }

Target:
private static int getNeededNumberOfUsbControllers(int numberOfSlots) { int numOfcontrollers = numberOfSlots / SLOTS_PER_CONTROLLER; if (numberOfSlots > 0 && numOfcontrollers == 0) { numOfcontrollers = 1; } return numOfcontrollers; }
Source:
private Optional<ProcessResult> run(String[] command, Path dir) { ProcessRunner runner = new ProcessRunner(command, dir); try { return Optional.of(runner.call()); } catch (Exception e) { return Optional.absent(); } }

Target:
private Optional<ProcessResult> run(String[] command, Path dir) { ProcessRunner runner = new ProcessRunner(command, dir); try { return Optional.of(runner.call()); } catch (Exception e) { log.error("Running command {0} failed {1}", Arrays.deepToString(command), e); return Optional.absent(); } }
Source:
protected ObjectField updateSort() { ObjectType selectedType = search.getSelectedType(); ToolUi ui = selectedType == null ? null : selectedType.as(ToolUi.class); if (search.getEffectiveSort() == null) { if (ui != null && ui.getDefaultSortField() != null) { search.setSorts(ui.getDefaultSortField()); } else if (!ObjectUtils.isBlank(search.getQueryString())) { search.setSorts(Search.RELEVANT_SORT_VALUE); } else { Map<String, String> f = search.getFieldFilters().get("cms.content.publishDate"); if (f != null && (f.get("") != null || f.get("x") != null)) { search.setSorts("cms.content.publishDate"); } else { search.setSorts("cms.content.updateDate"); } } } if (selectedType != null) { return selectedType.getFieldGlobally(search.getEffectiveSort()); } else { return Database.Static.getDefault().getEnvironment().getField(search.getEffectiveSort()); } }

Target:
protected ObjectField updateSort() { ObjectType selectedType = search.getSelectedType(); ToolUi ui = selectedType == null ? null : selectedType.as(ToolUi.class); if (search.getSort() == null) { if (ui != null && ui.getDefaultSortField() != null) { search.setSort(ui.getDefaultSortField()); } else if (!ObjectUtils.isBlank(search.getQueryString())) { search.setSort(Search.RELEVANT_SORT_VALUE); } else { Map<String, String> f = search.getFieldFilters().get("cms.content.publishDate"); if (f != null && (f.get("") != null || f.get("x") != null)) { search.setSort("cms.content.publishDate"); } else { search.setSort("cms.content.updateDate"); } } } if (selectedType != null) { return selectedType.getFieldGlobally(search.getSort()); } else { return Database.Static.getDefault().getEnvironment().getField(search.getSort()); } }
Source:
private void writeConfigToFile( Config config, File file ) { try { Writer fileWriter = new BufferedWriter( new FileWriter( file ) ); for ( Map.Entry<String,String> entry : config.getRaw().entrySet() ) { fileWriter.write( String.format( "%s=%s\n", entry.getKey(), entry.getValue() ) ); } fileWriter.close(); } catch ( IOException e ) { e.printStackTrace(); } }

Target:
private void writeConfigToFile( Config config, File file ) throws IOException { try ( Writer fileWriter = new BufferedWriter( new FileWriter( file ) ) ) { for ( Map.Entry<String,String> entry : config.getRaw().entrySet() ) { fileWriter.write( String.format( "%s=%s\n", entry.getKey(), entry.getValue() ) ); } } }
Source:
private static Map<Name, DataType> nameToDataType() { Map<Name, DataType> dataTypesByDataTypeName = new HashMap<Name, DataType>(16); for (DataType dataType : DataType.allPrimitiveTypes()) { dataTypesByDataTypeName.put(dataType.getName(), dataType); } return dataTypesByDataTypeName; }

Target:
private static Map<Name, DataType> nameToDataType() { Map<Name, DataType> nameToDataType = new HashMap<Name, DataType>(16); for (DataType dataType : DataType.allPrimitiveTypes()) { nameToDataType.put(dataType.getName(), dataType); } return nameToDataType; }