auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private <ReqT, RespT> RespT performBlockingRpc( <END> ReqT request, MethodDescriptor<ReqT, RespT> method, Predicate<ReqT> retryablePredicate) { CancellationToken token = new CancellationToken(); RetryableRpc<ReqT, RespT> mutateRowAsync = BigtableAsyncUtilities.createAsyncUnaryCall(channelPool, clientCallService, method, token); try { return BigtableAsyncUtilities.getUnchecked( performRetryableRpc(request, mutateRowAsync, retryablePredicate)); } catch (Throwable t) { token.cancel(); throw Throwables.propagate(t); } }</code><technical_language>this implemented performAsyncRpc(...).get() ? getUnchecked( performAsyncRpc(...))</technical_language>

Target:
private <ReqT, RespT> RespT performBlockingRpc( ReqT request, MethodDescriptor<ReqT, RespT> method, Predicate<ReqT> retryablePredicate) { CancellationToken token = new CancellationToken(); BigtableAsyncRpc<ReqT, RespT> rpc = BigtableAsyncUtilities.createAsyncUnaryRpc(channelPool, clientCallService, method, token); try { ListenableFuture<RespT> rpcFuture = performRetryingAsyncRpc(request, rpc, retryablePredicate); return BigtableAsyncUtilities.getUnchecked(rpcFuture); } catch (Throwable t) { token.cancel(); throw Throwables.propagate(t); } }
Source:
<code>public InputFlagLayout(String name, String comment, boolean optional, String defaultValue, String vipTypeRestriction, String prettyName) { super(name, comment,optional); <START> cbFlagInputItem = new CheckboxItem(prettyName); <END> cbFlagInputItem.setValue(false); cbFlagInputItem.setValueField(defaultValue); cbFlagInputItem.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { boolean selected = cbFlagInputItem.getValueAsBoolean(); cbFlagInputItem.setValue(!selected); } }); hLayout.addMember(FieldUtil.getForm(cbFlagInputItem)); }</code><technical_language>I more useful flag instead of prettyName</technical_language>

Target:
public InputFlagLayout(String name, String comment, boolean optional, String defaultValue, String vipTypeRestriction, String prettyName) { super(name, comment, optional, prettyName); cbFlagInputItem = new CheckboxItem(defaultValue); cbFlagInputItem.setValue(false); cbFlagInputItem.setValueField(defaultValue); cbFlagInputItem.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { boolean selected = cbFlagInputItem.getValueAsBoolean(); cbFlagInputItem.setValue(!selected); } }); hLayout.addMember(FieldUtil.getForm(cbFlagInputItem)); }
Source:
<code>public String showPage(Model model) { PublicSiteUser user = currentUserService.getCurrentUser(); Set<DiseaseGroup> diseaseInterests = new HashSet<>(); Map<String, Integer> reviewCountPerDiseaseGroup = new HashMap<>(); Map<String, Integer> occurrenceCountPerDiseaseGroup = new HashMap<>(); boolean userLoggedIn = (user != null); if (userLoggedIn) { diseaseInterests = expertService.getDiseaseInterests(user.getId()); reviewCountPerDiseaseGroup = expertService.getDiseaseOccurrenceReviewCountPerDiseaseGroup(user.getId(), diseaseInterests); occurrenceCountPerDiseaseGroup = expertService.getDiseaseOccurrenceCountPerDiseaseGroup(user.getId(), diseaseInterests); } else { DiseaseGroup defaultDiseaseGroup = diseaseService.getDiseaseGroupByName(DEFAULT_DISEASE_NAME); diseaseInterests.add(defaultDiseaseGroup); reviewCountPerDiseaseGroup.put(defaultDiseaseGroup.getDisplayName(), 0); occurrenceCountPerDiseaseGroup.put(defaultDiseaseGroup.getDisplayName(), DEFAULT_DISEASE_OCCURRENCE_COUNT); } <START> Integer diseaseOccurrenceReviewCount = sum(reviewCountPerDiseaseGroup.values()); <END> model.addAttribute("reviewCount", diseaseOccurrenceReviewCount); model.addAttribute("diseaseInterests", convertSetToAlphabeticalList(diseaseInterests)); model.addAttribute("userLoggedIn", userLoggedIn); model.addAttribute("reviewCountPerDiseaseGroup", reviewCountPerDiseaseGroup); model.addAttribute("occurrenceCountPerDiseaseGroup", occurrenceCountPerDiseaseGroup); return "datavalidation"; }</code><technical_language>lambdaJ "sum" method work instead of writing own</technical_language>

Target:
public String showPage(Model model) { PublicSiteUser user = currentUserService.getCurrentUser(); Set<DiseaseGroup> diseaseInterests = new HashSet<>(); Map<String, Integer> reviewCountPerDiseaseGroup = new HashMap<>(); Map<String, Integer> occurrenceCountPerDiseaseGroup = new HashMap<>(); boolean userLoggedIn = (user != null); if (userLoggedIn) { diseaseInterests = expertService.getDiseaseInterests(user.getId()); reviewCountPerDiseaseGroup = expertService.getDiseaseOccurrenceReviewCountPerDiseaseGroup(user.getId(), diseaseInterests); occurrenceCountPerDiseaseGroup = expertService.getDiseaseOccurrenceCountPerDiseaseGroup(user.getId(), diseaseInterests); } else { DiseaseGroup defaultDiseaseGroup = diseaseService.getDiseaseGroupByName(DEFAULT_DISEASE_NAME); diseaseInterests.add(defaultDiseaseGroup); reviewCountPerDiseaseGroup.put(defaultDiseaseGroup.getDisplayName(), 0); occurrenceCountPerDiseaseGroup.put(defaultDiseaseGroup.getDisplayName(), DEFAULT_DISEASE_OCCURRENCE_COUNT); } Integer diseaseOccurrenceReviewCount = sum(reviewCountPerDiseaseGroup.values()).intValue(); model.addAttribute("reviewCount", diseaseOccurrenceReviewCount); model.addAttribute("diseaseInterests", sortByDisplayName(diseaseInterests)); model.addAttribute("userLoggedIn", userLoggedIn); model.addAttribute("reviewCountPerDiseaseGroup", reviewCountPerDiseaseGroup); model.addAttribute("occurrenceCountPerDiseaseGroup", occurrenceCountPerDiseaseGroup); return "datavalidation"; }
Source:
<code>public void setUp() throws IOException { log.debug("Setting up OozieClient at {}", getOozieServiceLoc()); oozieClient = new OozieClient(getOozieServiceLoc()); String s = "<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?>" + "<configuration>" + "<property><name>fs.defaultFS</name><value>" + getNameNode() + "</value></property>" + "</configuration>"; Configuration hdfsConf = new Configuration(false); hdfsConf.addResource(new ReaderInputStream(new StringReader(s))); <START> <END> hadoopFilesystem = FileSystem.get(hdfsConf); tempDir = Files.createTempDir(); }</code><technical_language>hdfsConf.set("fs.defaultFS", getNameNode())</technical_language>

Target:
public void setUp() throws IOException { log.debug("Setting up OozieClient at {}", getOozieServiceLoc()); oozieClient = new OozieClient(getOozieServiceLoc()); Configuration hdfsConf = new Configuration(false); hdfsConf.set("fs.defaultFS", getNameNode()); hadoopFilesystem = FileSystem.get(hdfsConf); oozieJobPropertiesFetcher = new OozieJobPropertiesFetcher(oozieClient); hdfsTestHelper = new HdfsTestHelper(hadoopFilesystem); tempDir = Files.createTempDir(); }
Source:
<code>private JsonResult getJoinStatusResult(boolean hasJoined) { Map<String, String> result = new HashMap<>(); <START> result.put("hasJoined", String.valueOf(hasJoined)); <END> if (!hasJoined) { result.put("userId", userInfo.id); } return new JsonResult(result); }</code><technical_language>Map<String, Object> put boolean here</technical_language>

Target:
private JsonResult getJoinStatusResult(boolean hasJoined) { Map<String, Object> result = new HashMap<>(); result.put("hasJoined", hasJoined); if (!hasJoined) { result.put("userId", userInfo.id); } return new JsonResult(result); }
Source:
<code>public NotificationPopupHandle show(NotificationEvent event, Command hideCommand) { if (container == null) { throw new IllegalStateException("The setContainer() method hasn't been called!"); } final NotificationPopupView view = new NotificationPopupView(); final PopupHandle popupHandle = new PopupHandle(view, event); activeNotifications.add(popupHandle); int size = activeNotifications.size(); int topMargin = (size == 1) ? initialSpacing : (size * SPACING) - (SPACING - initialSpacing); view.setPopupPosition(getLeftPosition(container.asWidget()) + getMargin(), getTopPosition(container.asWidget()) + topMargin); view.setNotification(event.getNotification()); view.setType(event.getType()); view.setNotificationWidth(getWidth() + "px"); if (event.hasNavigation()) { <START> ResourceRef resourceRef = new ResourceRef( <END> event.getNavigationPath(), ActivityResourceType.PERSPECTIVE); boolean authorized = authorizationManager.authorize( resourceRef, user); if (authorized) { view.addNavigation(event.getNavigationText(), () -> { hideCommand.execute(); placeManager.goTo(event.getNavigationPath()); }); } } view.show(hideCommand, event.autoHide()); return popupHandle; }</code><technical_language>I a approach this permission check more flexible is receive a Promise<Boolean> in setNavigation method, check here. a case navigation needs additional checks added not, a perspective</technical_language>

Target:
public NotificationPopupHandle show(NotificationEvent event, Command hideCommand) { if (container == null) { throw new IllegalStateException("The setContainer() method hasn't been called!"); } final NotificationPopupView view = new NotificationPopupView(); final PopupHandle popupHandle = new PopupHandle(view, event); activeNotifications.add(popupHandle); int size = activeNotifications.size(); int topMargin = (size == 1) ? initialSpacing : (size * SPACING) - (SPACING - initialSpacing); view.setPopupPosition(getLeftPosition(container.asWidget()) + getMargin(), getTopPosition(container.asWidget()) + topMargin); view.setNotification(event.getNotification()); view.setType(event.getType()); view.setNotificationWidth(getWidth() + "px"); if (event.hasNavigation()) { final String identifier = event.getNavigationPlace().getIdentifier(); final SyncBeanDef<Activity> syncBeanDefActivity = activityBeansCache.getActivity(identifier); final ResourceRef resourceRef = new ResourceRef(identifier, syncBeanDefActivity.getInstance().getResourceType()); final Boolean isAuthorized = authorizationManager.authorize(resourceRef, user); if (isAuthorized) { view.addNavigation( event.getNavigationText(), () -> { hideCommand.execute(); placeManager.goTo(event.getNavigationPlace()); }); } } view.show(hideCommand, event.autoHide()); return popupHandle; }
Source:
<code>List<BookieSocketAddress> replaceBookiesInEnsemble(LedgerMetadata metadata, List<BookieSocketAddress> oldEnsemble, Map<Integer, BookieSocketAddress> failedBookies) throws BKException.BKNotEnoughBookiesException { List<BookieSocketAddress> newEnsemble = new ArrayList<BookieSocketAddress>(oldEnsemble); int ensembleSize = metadata.getEnsembleSize(); int writeQ = metadata.getWriteQuorumSize(); int ackQ = metadata.getAckQuorumSize(); Map<String, byte[]> customMetadata = metadata.getCustomMetadata(); <START> Set<BookieSocketAddress> exclude = new HashSet<BookieSocketAddress>(failedBookies.values()); <END> int replaced = 0; for (Map.Entry<Integer, BookieSocketAddress> entry : failedBookies.entrySet()) { int idx = entry.getKey(); BookieSocketAddress addr = entry.getValue(); LOG.debug("[EnsembleChange-L{}] replacing bookie: index: {}", getId(), addr, idx); if (!newEnsemble.get(idx).equals(addr)) { LOG.debug("[EnsembleChange-L{}] Not changing failed bookie at index {}, already changed to {}", getId(), addr, idx, newEnsemble.get(idx)); continue; } try { BookieSocketAddress newBookie = clientCtx.getBookieWatcher().replaceBookie( ensembleSize, writeQ, ackQ, customMetadata, newEnsemble, idx, exclude); newEnsemble.set(idx, newBookie); replaced++; } catch (BKException.BKNotEnoughBookiesException e) { if (replaced <= 0) { throw e; } else { break; } } } return newEnsemble; }</code><technical_language>Nit: diamond operator</technical_language>

Target:
List<BookieSocketAddress> replaceBookiesInEnsemble(LedgerMetadata metadata, List<BookieSocketAddress> oldEnsemble, Map<Integer, BookieSocketAddress> failedBookies) throws BKException.BKNotEnoughBookiesException { List<BookieSocketAddress> newEnsemble = new ArrayList<>(oldEnsemble); int ensembleSize = metadata.getEnsembleSize(); int writeQ = metadata.getWriteQuorumSize(); int ackQ = metadata.getAckQuorumSize(); Map<String, byte[]> customMetadata = metadata.getCustomMetadata(); Set<BookieSocketAddress> exclude = new HashSet<>(failedBookies.values()); int replaced = 0; for (Map.Entry<Integer, BookieSocketAddress> entry : failedBookies.entrySet()) { int idx = entry.getKey(); BookieSocketAddress addr = entry.getValue(); if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}] replacing bookie: index: {}", getId(), addr, idx); } if (!newEnsemble.get(idx).equals(addr)) { if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}] Not changing failed bookie at index {}, already changed to {}", getId(), addr, idx, newEnsemble.get(idx)); } continue; } try { BookieSocketAddress newBookie = clientCtx.getBookieWatcher().replaceBookie( ensembleSize, writeQ, ackQ, customMetadata, newEnsemble, idx, exclude); newEnsemble.set(idx, newBookie); replaced++; } catch (BKException.BKNotEnoughBookiesException e) { if (replaced <= 0) { throw e; } else { break; } } } return newEnsemble; }
Source:
<code>private static void writeBlocks(Cube cube, NBTTagCompound cubeNbt) { ExtendedBlockStorage ebs = cube.getStorage(); if(ebs == null){ return; } <START> byte[] abyte = new byte[4096]; <END> NibbleArray data = new NibbleArray(); NibbleArray add = ebs.getData().getDataForNBT(abyte, data); cubeNbt.setByteArray("Blocks", abyte); cubeNbt.setByteArray("Data", data.getData()); if (add != null) { cubeNbt.setByteArray("Add", add.getData()); } cubeNbt.setByteArray("BlockLight", ebs.getBlocklightArray().getData()); if (!cube.getCubicWorld().getProvider().getHasNoSky()) { cubeNbt.setByteArray("SkyLight", ebs.getSkylightArray().getData()); } }</code><technical_language>Replace 16*16*16 for clarity</technical_language>

Target:
private static void writeBlocks(Cube cube, NBTTagCompound cubeNbt) { ExtendedBlockStorage ebs = cube.getStorage(); if(ebs == null) { return; } byte[] abyte = new byte[Cube.SIZE*Cube.SIZE*Cube.SIZE]; NibbleArray data = new NibbleArray(); NibbleArray add = ebs.getData().getDataForNBT(abyte, data); cubeNbt.setByteArray("Blocks", abyte); cubeNbt.setByteArray("Data", data.getData()); if (add != null) { cubeNbt.setByteArray("Add", add.getData()); } cubeNbt.setByteArray("BlockLight", ebs.getBlocklightArray().getData()); if (!cube.getWorld().getProvider().getHasNoSky()) { cubeNbt.setByteArray("SkyLight", ebs.getSkylightArray().getData()); } }
Source:
<code>@Override public void toJson(JsonWriter writer, @Nullable Object value) throws IOException { <START> if (value == null) { <END> value = defaultIfNull; } delegate.toJson(writer, value); }</code><technical_language>expect . . . if default serialize nulls</technical_language>

Target:
@Override public void toJson(JsonWriter writer, @Nullable Object value) throws IOException { if (defaultIfNull().equals(value)) { delegate.toJson(writer, null); } else { delegate.toJson(writer, value); } }
Source:
<code>private void serverAboutToStart( FMLServerAboutToStartEvent evt ) { <START> WorldData.instance().onWorldStart(); <END> }</code><technical_language>onServerAboutToStart is name for it</technical_language>

Target:
private void serverAboutToStart( FMLServerAboutToStartEvent evt ) { WorldData.onServerAboutToStart(); }
Source:
<code>public void onPicturePathReceived(String picturePath) { if (getListener() != null) { getListener().onImageUploadStarted(); } <START> getViewModel().imageUploadStart(picturePath); <END> performUserAction(UPLOAD_IMAGE, picturePath); }</code><technical_language>listener</technical_language>

Target:
public void onPicturePathReceived(String picturePath) { Class activityUploadDetail = null; if (getListener() != null) { activityUploadDetail = getListener().provideImageUploadDetailActivity(); } startUploadDetailActivity(activityUploadDetail, picturePath); }
Source:
<code>public void verifyDoesNotRunOutOfMemory() { final List<Rule> rules = Lists.newArrayList(); for (int i=0; i<100; i++) { final Rule rule = new RuleBuilder().withName("rule1").withPosition(i+1).withProtocol("UDP").withDstAddress("192.168.0." + i).build(); rules.add(rule); } final DefaultClassificationEngine engine = new DefaultClassificationEngine(() -> rules, FilterService.NOOP); <START> System.gc(); <END> }</code><technical_language>purpose of this explicit gc call</technical_language>

Target:
public void verifyDoesNotRunOutOfMemory() { final List<Rule> rules = Lists.newArrayList(); for (int i=0; i<100; i++) { final Rule rule = new RuleBuilder().withName("rule1").withPosition(i+1).withProtocol("UDP").withDstAddress("192.168.0." + i).build(); rules.add(rule); } final DefaultClassificationEngine engine = new DefaultClassificationEngine(() -> rules, FilterService.NOOP); engine.classify(new ClassificationRequest("localhost", 1234, "127.0.0.1", 80, "192.168.0.1", Protocols.getProtocol("UDP"))); }
Source:
<code>public void testSessionlessConnectionsExpired() throws Exception { ServerCnxnFactory factory = new NIOServerCnxnFactory(); factory.configure(new InetSocketAddress(PortAssignment.unique()), 1000); factory.start(); int timeout = Integer.getInteger( ZOOKEEPER_NIO_SESSIONLESS_CNXN_TIMEOUT, 10000); ServerMetrics.resetAll(); ((NIOServerCnxnFactory) factory).touchCnxn(createMockNIOCnxn()); ((NIOServerCnxnFactory) factory).touchCnxn(createMockNIOCnxn()); <START> Thread.sleep(2*timeout); <END> Map<String, Object> values = ServerMetrics.getAllValues(); Assert.assertEquals(2L, values.get("sessionless_connections_expired")); factory.shutdown(); }</code><technical_language>a loop checks for expected value, a 100 ms sleep? This test faster flaky utility method, do in a separate work</technical_language>

Target:
public void testSessionlessConnectionsExpired() throws Exception { ServerCnxnFactory factory = new NIOServerCnxnFactory(); factory.configure(new InetSocketAddress(PortAssignment.unique()), 1000); factory.start(); int timeout = Integer.getInteger( ZOOKEEPER_NIO_SESSIONLESS_CNXN_TIMEOUT, 10000); ServerMetrics.getMetrics().resetAll(); ((NIOServerCnxnFactory) factory).touchCnxn(createMockNIOCnxn()); ((NIOServerCnxnFactory) factory).touchCnxn(createMockNIOCnxn()); Map<String, Object> values = MetricsUtils.currentServerMetrics(); int sleptTime = 0; while (values.get("sessionless_connections_expired") == null || sleptTime < 2*timeout){ Thread.sleep(100); sleptTime += 100; values = MetricsUtils.currentServerMetrics(); } Assert.assertEquals(2L, values.get("sessionless_connections_expired")); factory.shutdown(); }
Source:
<code>public void onDeselectAllItemsEvent(@Observes DeselectAllItemsEvent event) { if (getListView().getListGrid() != null) { getListView().getListGrid().deselectAllItems(); } <START> refreshGrid(); <END> }</code><technical_language>if want refresh grid deselectall is executed</technical_language>

Target:
public void onDeselectAllItemsEvent(@Observes DeselectAllItemsEvent event) { deselectAllItems(); }
Source:
<code>static void interactive(Parameters params, CoreInterface core) throws Exception { log.info("Setting up interactive shell..."); Exception e = null; try { runInteractiveShell(core); } catch (final Exception inner) { <START> log.error("Error when running shell", e); <END> e = inner; } log.info("Closing core bridge..."); try { core.shutdown(); } catch (final Exception inner) { log.error("Failed to close core bridge", e); if (e != null) { inner.addSuppressed(e); } e = inner; } if (e != null) { throw e; } }</code><technical_language>Logs wrong exception, also, if log in catch is need log here</technical_language>

Target:
static void interactive(Parameters params, CoreInterface core) throws Exception { log.info("Setting up interactive shell..."); Exception e = null; try { runInteractiveShell(core); } catch (final Exception inner) { e = inner; } log.info("Closing core bridge..."); try { core.shutdown(); } catch (final Exception inner) { if (e != null) { inner.addSuppressed(e); } e = inner; } if (e != null) { throw e; } }
Source:
<code>public CreateServiceUserMenu(@PluginName String pluginName, Provider<CurrentUser> userProvider) { this.pluginName = pluginName; this.userProvider = userProvider; menuEntries = Lists.newArrayList(); if (canCreateServiceUser()) { menuEntries.add(new MenuEntry("People", Collections .singletonList(new MenuItem("Create Service User", "#/x/" + pluginName + <START> "/create-service-user", "")))); <END> } }</code><technical_language>Consider "/create"</technical_language>

Target:
public CreateServiceUserMenu(@PluginName String pluginName, Provider<CurrentUser> userProvider) { this.pluginName = pluginName; this.userProvider = userProvider; menuEntries = Lists.newArrayList(); if (canCreateServiceUser()) { menuEntries.add(new MenuEntry("People", Collections .singletonList(new MenuItem("Create Service User", "#/x/" + pluginName + "/create", "")))); } }
Source:
<code>public void internalExtractResult(long startTs, ColumnSelection selection, byte[] row, byte[] col, byte[] val, long ts) { if (ts < startTs && selection.contains(col)) { Cell cell = Cell.create(row, col); if (!collector.containsKey(cell)) { collector.put(cell, Value.create(val, ts)); <START> } <END> } else { getPostFilteredCellsMeter(ValueExtractor.class).mark(); } }</code><technical_language>note needing another else block</technical_language>

Target:
public void internalExtractResult(long startTs, ColumnSelection selection, byte[] row, byte[] col, byte[] val, long ts) { if (ts < startTs && selection.contains(col)) { Cell cell = Cell.create(row, col); if (!collector.containsKey(cell)) { collector.put(cell, Value.create(val, ts)); } else { notLatestVisibleValueCellFilterMeter.mark(); } } else { notLatestVisibleValueCellFilterMeter.mark(); } }
Source:
<code>public final synchronized void setId(@CheckForNull String id) { if (this.id == null) { this.id = id; } else { <START> System.out.println("Go away"); <END> } }</code><technical_language>Uh, IllegalStateException</technical_language>

Target:
public final synchronized void setId(@CheckForNull String id) { if (this.id == null) { this.id = id; } else if (!this.id.equals(id)) { throw new IllegalStateException("The ID cannot be changed after it has been set."); } }
Source:
<code>public void removeDBPropertyToPreventRenameWhenBootstrapDumpOfTableFails() throws Exception { List<String> tableList = Arrays.asList("a1", "a2"); String dbRandomKey = "akeytoberandom"; mockStatic(Utils.class); when(Utils.matchesDb(same(hive), eq("default"))) .thenReturn(Collections.singletonList("default")); when(Utils.getAllTables(same(hive), eq("default"))).thenReturn(tableList); when(Utils.setDbBootstrapDumpState(same(hive), eq("default"))).thenReturn(dbRandomKey); when(Utils.matchesTbl(same(hive), eq("default"), anyString())).thenReturn(tableList); when(hive.getAllFunctions()).thenReturn(Collections.emptyList()); when(queryState.getConf()).thenReturn(conf); when(conf.getLong("hive.repl.last.repl.id", -1L)).thenReturn(1L); ReplDumpTask task = new StubReplDumpTask() { private int tableDumpCount = 0; @Override void dumpTable(String dbName, String tblName, String validTxnList, Path dbRoot, long lastReplId, Hive hiveDb) throws Exception { tableDumpCount++; if (tableDumpCount > 1) { throw new TestException(); } } }; task.initialize(queryState, null, null, null); task.setWork( new ReplDumpWork("default", "", Long.MAX_VALUE, Long.MAX_VALUE, "", Integer.MAX_VALUE, "") ); try { <START> task.bootStrapDump(mock(Path.class), null, mock(Path.class), Hive.get()); <END> } finally { verifyStatic(); Utils.resetDbBootstrapDumpState(same(hive), eq("default"), eq(dbRandomKey)); } }</code><technical_language>need pass hive class variable itself. else test fail</technical_language>

Target:
public void removeDBPropertyToPreventRenameWhenBootstrapDumpOfTableFails() throws Exception { List<String> tableList = Arrays.asList("a1", "a2"); String dbRandomKey = "akeytoberandom"; mockStatic(Utils.class); when(Utils.matchesDb(same(hive), eq("default"))) .thenReturn(Collections.singletonList("default")); when(Utils.getAllTables(same(hive), eq("default"))).thenReturn(tableList); when(Utils.setDbBootstrapDumpState(same(hive), eq("default"))).thenReturn(dbRandomKey); when(Utils.matchesTbl(same(hive), eq("default"), anyString())).thenReturn(tableList); when(hive.getAllFunctions()).thenReturn(Collections.emptyList()); when(queryState.getConf()).thenReturn(conf); when(conf.getLong("hive.repl.last.repl.id", -1L)).thenReturn(1L); ReplDumpTask task = new StubReplDumpTask() { private int tableDumpCount = 0; @Override void dumpTable(String dbName, String tblName, String validTxnList, Path dbRoot, long lastReplId, Hive hiveDb) throws Exception { tableDumpCount++; if (tableDumpCount > 1) { throw new TestException(); } } }; task.initialize(queryState, null, null, null); task.setWork( new ReplDumpWork("default", "", Long.MAX_VALUE, Long.MAX_VALUE, "", Integer.MAX_VALUE, "") ); try { task.bootStrapDump(mock(Path.class), null, mock(Path.class), hive); } finally { verifyStatic(); Utils.resetDbBootstrapDumpState(same(hive), eq("default"), eq(dbRandomKey)); } }
Source:
<code>private Set<String> parseSet(String str) { if (str == null) { return null; } <START> String[] parts = str.split("" + RECORD_SEPERATOR); <END> Set<String> results = new HashSet<>(); Collections.addAll(results, parts); return results; }</code><technical_language>assuming JVM figure out a new string time..</technical_language>

Target:
private Set<String> parseSet(String str) { if (str == null) { return null; } String[] parts = RECORD_SEPARATOR_PATTERN.split(str); Set<String> results = new HashSet<>(); Collections.addAll(results, parts); return results; }
Source:
<code>public IAnalysisModule instantiateAnalysis() { ITmfProjectModelElement parent = getParent(); if (parent instanceof TmfTraceElement) { <START> ITmfTrace trace = ((TmfTraceElement) parent).openTrace(); <END> try { fModule.setTrace(trace); return fModule; } catch (TmfAnalysisException e) { e.printStackTrace(); } } return null; }</code><technical_language>openTrace() creates a new ITmfTrace object. If trace open 2 ITmfTrace objects for trace. For open trace object of ITmfTrace class. run problems coalescing of requests (coalescing of requests works trace). Also, I TmfTraceManager work properly if manage 2 trace objects of trace</technical_language>

Target:
public IAnalysisModule instantiateAnalysis() { ITmfProjectModelElement parent = getParent(); if (parent instanceof TmfTraceElement) { final ITmfTrace trace = ((TmfTraceElement) parent).getTrace(); try { fModule.setTrace(trace); return fModule; } catch (TmfAnalysisException e) { TraceUtils.displayErrorMsg(Messages.TmfAnalysisElement_InstantiateAnalysis, e.getMessage()); } } return null; }
Source:
<code>private boolean isDoubleClick() { if (mClearOnDoubleClick) { <START> if (mFirstClick != 0 && System.currentTimeMillis() - mFirstClick > 200) { <END> mCountClick = 0; } mCountClick++; if (mCountClick == 1) { mFirstClick = System.currentTimeMillis(); } else if (mCountClick == 2) { long lastClick = System.currentTimeMillis(); if (lastClick - mFirstClick < 200) { this.clear(); return true; } } } return false; }</code><technical_language>extract milliseconds 200, a private static final int DOUBLE_CLICK_DELAY_MS = 200;</technical_language>

Target:
private boolean isDoubleClick() { if (mClearOnDoubleClick) { if (mFirstClick != 0 && System.currentTimeMillis() - mFirstClick > DOUBLE_CLICK_DELAY_MS) { mCountClick = 0; } mCountClick++; if (mCountClick == 1) { mFirstClick = System.currentTimeMillis(); } else if (mCountClick == 2) { long lastClick = System.currentTimeMillis(); if (lastClick - mFirstClick < DOUBLE_CLICK_DELAY_MS) { this.clear(); return true; } } } return false; }
Source:
<code>public Optional<String> extractBranch(String uri) { <START> final Pattern pattern = Pattern.compile("^[A-Za-z]+://([^@]+)@.*"); <END> final Matcher matcher = pattern.matcher(uri); if (matcher.matches()) { return Optional.of(matcher.group(1)); } else { return Optional.empty(); } }</code><technical_language>Pattern compilation is expensive operation. this pattern private static final field of class</technical_language>

Target:
public Optional<String> extractBranch(String uri) { final Matcher matcher = branchNameExtractor.matcher(uri); if (matcher.matches()) { return Optional.of(matcher.group(1)); } else { return Optional.empty(); } }
Source:
<code>public void getContents() throws IOException, SignatureException, URISyntaxException, XmlProcessingException { final String bucketName = "test_get_contents"; try { client.putBucket(new PutBucketRequest(bucketName)); loadBookTestData(client, bucketName); final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final Ds3ClientHelpers.Job job = helpers.startReadAllJob(bucketName); final UUID jobId = job.getJobId(); job.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() { @Override public SeekableByteChannel buildChannel(final String key) throws IOException { final Path filePath = Files.createTempFile("ds3", key); return Files.newByteChannel(filePath, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.WRITE); } }); JobStatus getJobResponseStatus = JobStatus.IN_PROGRESS; for (int retry = 0; retry < 3; retry++) { final GetJobResponse jobResponse = client.getJob(new GetJobRequest(jobId)); getJobResponseStatus = jobResponse.getMasterObjectList().getStatus(); if (getJobResponseStatus == JobStatus.COMPLETED) break; try { TimeUnit.MILLISECONDS.sleep(500); <START> } catch (InterruptedException e) { <END> LOG.warn("Caught interrupt", e); } } assertThat(getJobResponseStatus, is(JobStatus.COMPLETED)); } finally { deleteAllContents(client, bucketName); } }</code><technical_language>missing final</technical_language>

Target:
public void getContents() throws IOException, SignatureException, URISyntaxException, XmlProcessingException { final String bucketName = "test_get_contents"; try { client.putBucket(new PutBucketRequest(bucketName)); loadBookTestData(client, bucketName); final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final Ds3ClientHelpers.Job job = helpers.startReadAllJob(bucketName); final UUID jobId = job.getJobId(); job.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() { @Override public SeekableByteChannel buildChannel(final String key) throws IOException { final Path filePath = Files.createTempFile("ds3", key); return Files.newByteChannel(filePath, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.WRITE); } }); JobStatus getJobResponseStatus = JobStatus.IN_PROGRESS; for (int retry = 0; retry < 3; retry++) { final GetJobResponse jobResponse = client.getJob(new GetJobRequest(jobId)); getJobResponseStatus = jobResponse.getMasterObjectList().getStatus(); if (getJobResponseStatus == JobStatus.COMPLETED) break; try { TimeUnit.MILLISECONDS.sleep(500); } catch (final InterruptedException e) { LOG.warn("Caught interrupt", e); } } assertThat(getJobResponseStatus, is(JobStatus.COMPLETED)); } finally { deleteAllContents(client, bucketName); } }
Source:
<code><START> public Future<byte[]> assignAsync(RegionInfo regionInfo, ServerName sn) throws IOException { <END> RegionStateNode regionNode = regionStates.getOrCreateRegionStateNode(regionInfo); TransitRegionStateProcedure proc; regionNode.lock(); try { preTransitCheck(regionNode, STATES_EXPECTED_ON_ASSIGN); proc = TransitRegionStateProcedure.assign(getProcedureEnvironment(), regionInfo, sn); regionNode.setProcedure(proc); } finally { regionNode.unlock(); } return ProcedureSyncWait.submitProcedure(master.getMasterProcedureExecutor(), proc); }</code><technical_language>of this method's code is a duplicate of assign() above, common part wrapped in a private method</technical_language>

Target:
public Future<byte[]> assignAsync(RegionInfo regionInfo, ServerName sn) throws IOException { TransitRegionStateProcedure proc = createAssignProcedure(regionInfo, sn); return ProcedureSyncWait.submitProcedure(master.getMasterProcedureExecutor(), proc); }
Source:
<code>public void test() { ClientMessage message = ClientMessage.createForEncode(); message.add(new ClientMessage.Frame(new byte[100], UNFRAGMENTED_MESSAGE | FINAL)); message.setMessageType((short) MapPutCodec.REQUEST_MESSAGE_TYPE); AtomicReference<ClientMessage> reference = new AtomicReference<>(message); ClientMessageEncoder encoder = new ClientMessageEncoder(); encoder.src(() -> reference.getAndSet(null)); ByteBuffer buffer = ByteBuffer.allocate(1000); buffer.flip(); encoder.dst(buffer); HandlerStatus result = encoder.onWrite(); assertEquals(CLEAN, result); AtomicReference<ClientMessage> resultingMessage = new AtomicReference<>(); ClientMessageDecoder decoder = new ClientMessageDecoder(null, resultingMessage::set); decoder.setNormalPacketsRead(SwCounter.newSwCounter()); buffer.position(buffer.limit()); decoder.src(buffer); decoder.onRead(); assertEquals(message.getMessageType(), resultingMessage.get().getMessageType()); <START> } <END></code><technical_language>verify other fields of message well? If type is field verify, change test name testMessageType</technical_language>

Target:
public void test() { ClientMessage message = ClientMessage.createForEncode(); message.add(new ClientMessage.Frame(new byte[100], UNFRAGMENTED_MESSAGE | IS_FINAL_FLAG)); message.setMessageType((short) MapPutCodec.REQUEST_MESSAGE_TYPE); AtomicReference<ClientMessage> reference = new AtomicReference<>(message); ClientMessageEncoder encoder = new ClientMessageEncoder(); encoder.src(() -> reference.getAndSet(null)); ByteBuffer buffer = ByteBuffer.allocate(1000); buffer.flip(); encoder.dst(buffer); HandlerStatus result = encoder.onWrite(); assertEquals(CLEAN, result); AtomicReference<ClientMessage> resultingMessage = new AtomicReference<>(); ClientMessageDecoder decoder = new ClientMessageDecoder(null, resultingMessage::set); decoder.setNormalPacketsRead(SwCounter.newSwCounter()); buffer.position(buffer.limit()); decoder.src(buffer); decoder.onRead(); assertEquals(message.getMessageType(), resultingMessage.get().getMessageType()); assertEquals(message.getFrameLength(), resultingMessage.get().getFrameLength()); assertEquals(message.getHeaderFlags(), resultingMessage.get().getHeaderFlags()); assertEquals(message.getPartitionId(), resultingMessage.get().getPartitionId()); }
Source:
<code><START> private Single<Optional<Optional<java.io.File>>> downloadFileForReceipt(@NonNull final PartialReceipt partialReceipt, @NonNull final java.io.File inDirectory) { <END> final java.io.File receiptFile = new java.io.File(new java.io.File(inDirectory, partialReceipt.parentTripName), partialReceipt.fileName); return mDriveStreamsManager.download(partialReceipt.driveId.getId(), receiptFile) .map(Optional::of) .doOnError(throwable -> Logger.error(DriveRestoreDataManager.this, "Failed to download in with id {}.", partialReceipt.fileName, partialReceipt.parentTripName, partialReceipt.driveId)); }</code><technical_language>I need optional wrapper here. real need for</technical_language>

Target:
private Single<Optional<java.io.File>> downloadFileForReceipt(@NonNull final PartialReceipt partialReceipt, @NonNull final java.io.File inDirectory) { final java.io.File receiptFile = new java.io.File(new java.io.File(inDirectory, partialReceipt.parentTripName), partialReceipt.fileName); return mDriveStreamsManager.download(partialReceipt.driveId.getId(), receiptFile) .doOnError(throwable -> Logger.error(DriveRestoreDataManager.this, "Failed to download in with id {}.", partialReceipt.fileName, partialReceipt.parentTripName, partialReceipt.driveId)); }
Source:
<code>public void setup() { settingsService = mock(SettingsService.class); commitService = mock(CommitService.class); jenkins = mock(Jenkins.class); settings = mock(Settings.class); refChange = mock(RefChange.class); minimalRef = mock(MinimalRef.class); repository = mock(Repository.class); project = mock(Project.class); user = mock(ApplicationUser.class); when(refChange.getRef()).thenReturn(minimalRef); when(refChange.getToHash()).thenReturn(COMMIT); when(settingsService.getSettings(any())).thenReturn(settings); when(repository.getProject()).thenReturn(project); when(project.getKey()).thenReturn(PROJECT_KEY); when(jenkins.getJenkinsServer(project.getKey())).thenReturn(projectServer); when(refChange.getType()).thenReturn(RefChangeType.UPDATE); when(minimalRef.getId()).thenReturn(BRANCH_REF); jobBuilder = new Job.JobBuilder(1).jobName("").buildParameters("").branchRegex("") <START> .pathRegex("").ignoreCommitMsg("").ignoreComitters(""); <END> jobs = new ArrayList<>(); when(settingsService.getJobs(any())).thenReturn(jobs); }</code><technical_language>for delay, out vacation. need add a lines setup method mock out commit. create mock Commit commit = mock(Commit.class);. This creates a dummy object returned commitService, add a line when(commitService.getCommit(any())).thenReturn(commit); setup too. Finally, do similar return a specific commit message: when(commit.getMessage()).thenReturn("my_commit_message");</technical_language>

Target:
public void setup() { settingsService = mock(SettingsService.class); commitService = mock(CommitService.class); Commit commit = mock(Commit.class); jenkins = mock(Jenkins.class); Person person = mock(Person.class); settings = mock(Settings.class); refChange = mock(RefChange.class); minimalRef = mock(MinimalRef.class); repository = mock(Repository.class); project = mock(Project.class); user = mock(ApplicationUser.class); when(refChange.getRef()).thenReturn(minimalRef); when(refChange.getToHash()).thenReturn(COMMIT); when(settingsService.getSettings(any())).thenReturn(settings); when(repository.getProject()).thenReturn(project); when(project.getKey()).thenReturn(PROJECT_KEY); when(jenkins.getJenkinsServer(project.getKey())).thenReturn(projectServer); when(refChange.getType()).thenReturn(RefChangeType.UPDATE); when(minimalRef.getId()).thenReturn(BRANCH_REF); jobBuilder = new Job.JobBuilder(1).jobName("").buildParameters("").branchRegex("") .pathRegex("").ignoreCommitMsg("").ignoreComitters(""); jobs = new ArrayList<>(); when(settingsService.getJobs(any())).thenReturn(jobs); when(commitService.getCommit(any())).thenReturn(commit); when(commit.getMessage()).thenReturn(commitMsg); when(commit.getAuthor()).thenReturn(person); when(person.getName()).thenReturn(committer); }
Source:
<code>public AbstractListDataView<T> addItemsBefore(Collection<T> items, T before) { if (items == null || items.isEmpty()) { return this; } final ListDataProvider<T> dataProvider = getDataProvider(); final Collection<T> backendItems = dataProvider.getItems(); final int beforeItemIndex = getItemIndex(before); if (beforeItemIndex == -1) { throw new IllegalArgumentException( "Item to insert before is not available in the data"); } if (backendItems instanceof List) { final List<T> itemList = (List<T>) backendItems; <START> final List<T> itemsToAdd = items.stream() <END> .filter(item -> !contains(item, dataProvider)) .collect(Collectors.toList()); itemList.addAll(beforeItemIndex, itemsToAdd); dataProvider.refreshAll(); return this; } throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, backendItems.getClass().getSimpleName())); }</code><technical_language>collection added existing items "moved" new positions</technical_language>

Target:
public AbstractListDataView<T> addItemsBefore(Collection<T> items, T before) { addItemCollectionOnTarget(items, before, "Item to insert before is not available in the data", (index, containsTarget) -> index); return this; }
Source:
<code>private void checkPackagePermission(EntityType newEntityType, AbstractRowLevelSecurityRepositoryDecorator.Action action) { Package pack = newEntityType.getPackage(); if (pack != null) { boolean checkPackage = isPackageUpdated(action, newEntityType); if (checkPackage && !userPermissionEvaluator.hasPermission(new PackageIdentity(pack.getId()), PackagePermission.WRITEMETA)) { throw new MolgenisDataException( String.format("No [%s] permission on package '%s'", toMessagePermission(action), pack.getLabel())); } } else { if (!currentUserIsSuOrSystem() && isPackageUpdated(action, newEntityType)) { <START> throw new MolgenisDataException("Only superusers are allowed to create EntityTypes without a package."); <END> } } }</code><technical_language>expect a permission exception here</technical_language>

Target:
private void checkPackagePermission(EntityType newEntityType, AbstractRowLevelSecurityRepositoryDecorator.Action action) { Package pack = newEntityType.getPackage(); if (pack != null) { boolean checkPackage = isPackageUpdated(action, newEntityType); if (checkPackage && !userPermissionEvaluator.hasPermission(new PackageIdentity(pack.getId()), PackagePermission.WRITEMETA)) { throw new PackagePermissionException(PackagePermission.WRITEMETA, pack); } } else { if (!currentUserIsSuOrSystem() && isPackageUpdated(action, newEntityType)) { throw new NullPackageNotSuException(); } } }
Source:
<code><START> public Iterator<IColumn> columnsIterator() { <END> return (Iterator<IColumn>) (Object) id2ChunkMap.values().iterator(); }</code><technical_language>Why</technical_language>

Target:
Iterator<IColumn> columnsIterator() { return (Iterator<IColumn>) (Object) id2ChunkMap.values().iterator(); }
Source:
<code>protected int sizeOfSize() { <START> return 1; <END> }</code><technical_language>do want abstract</technical_language>

Target:
protected final int sizeOfSize() { return 1; }
Source:
<code>public GlusterVolumeSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.volume_snapshots); setHashName("volume_snapshots"); <START> setRestoreSnapshotCommand(new UICommand("Restore", this)); END> setDeleteSnapshotCommand(new UICommand("Delete", this)); setDeleteAllSnapshotsCommand(new UICommand("DeleteAll", this)); setActivateSnapshotCommand(new UICommand("Activate", this)); setDeactivateSnapshotCommand(new UICommand("Deactivate", this)); }</code><technical_language>Please letter small this is a convention</technical_language>

Target:
public GlusterVolumeSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.volume_snapshots); setHashName("volume_snapshots"); setRestoreSnapshotCommand(new UICommand("restore", this)); setDeleteSnapshotCommand(new UICommand("delete", this)); setDeleteAllSnapshotsCommand(new UICommand("deleteAll", this)); setActivateSnapshotCommand(new UICommand("activate", this)); setDeactivateSnapshotCommand(new UICommand("deactivate", this)); }
Source:
<code>private void setupNonStickDevices(Dictionary<String, ?> config) { Set<String> deviceNames = getDeviceNamesFromConfig(config); for (String deviceName : deviceNames) { if ("stick".equals(deviceName)) { continue; } if (stick.getDeviceByName(deviceName) != null) { continue; } String MAC = (String) config.get(deviceName + ".mac"); if (MAC == null || MAC.equals("")) { logger.error("Plugwise can not add device with name without a MAC address", deviceName); } else if (stick.getDeviceByMAC(MAC) != null) { logger.error( "Plugwise can not add device with name: and MAC address: {}, " + "the same MAC address is already used by device with name: {}", <START> deviceName, MAC, stick.getDeviceByMAC(MAC).name); <END> } else { String deviceType = (String) config.get(deviceName + ".type"); PlugwiseDevice device = createPlugwiseDevice(deviceType, MAC, deviceName); if (device != null) { stick.plugwiseDeviceCache.add(device); } } } }</code><technical_language>logger.error more appropriately logger.warn system stability is affected</technical_language>

Target:
private void setupNonStickDevices(Dictionary<String, ?> config) { Set<String> deviceNames = getDeviceNamesFromConfig(config); for (String deviceName : deviceNames) { if ("stick".equals(deviceName)) { continue; } if (stick.getDeviceByName(deviceName) != null) { continue; } String MAC = (String) config.get(deviceName + ".mac"); if (MAC == null || MAC.equals("")) { logger.warn("Plugwise can not add device with name without a MAC address", deviceName); } else if (stick.getDeviceByMAC(MAC) != null) { logger.warn( "Plugwise can not add device with name: and MAC address: {}, " + "the same MAC address is already used by device with name: {}", deviceName, MAC, stick.getDeviceByMAC(MAC).name); } else { String deviceType = (String) config.get(deviceName + ".type"); PlugwiseDevice device = createPlugwiseDevice(deviceType, MAC, deviceName); if (device != null) { stick.plugwiseDeviceCache.add(device); } } } }
Source:
<code>protected LoginPackage preLogin() throws BankException, IOException { urlopen = new Urllib(context, CertificateReader.getCertificates(context, R.raw.cert_ostgotatrafiken_login, R.raw.cert_ostgotatrafiken_overview)); List<NameValuePair> postData = new ArrayList<NameValuePair>(); <START> postData.add(new BasicNameValuePair("", "{\"authSource\":10,\"keepMeLimitedLoggedIn\":true," + <END> "\"userName\":\"" + getUsername() + "\"," + "\"password\":\"" + getPassword() + "\"," + "\"impersonateUserName\":\"\"}")); return new LoginPackage(urlopen, postData, response, "<LINK_0>"); }</code><technical_language>json in this small part I approve do handle a string. However, I suggest String.format instead is a cleaner</technical_language>

Target:
protected LoginPackage preLogin() throws BankException, IOException { urlopen = new Urllib(context, CertificateReader.getCertificates(context, R.raw.cert_ostgotatrafiken_login, R.raw.cert_ostgotatrafiken_overview)); List<NameValuePair> postData = new ArrayList<NameValuePair>(); postData.add(new BasicNameValuePair("", "{\"authSource\":10," + "\"keepMeLimitedLoggedIn\":true," + "\"userName\":\"" + getUsername() + "\"," + "\"password\":\"" + getPassword() + "\"," + "\"impersonateUserName\":\"\"}")); return new LoginPackage(urlopen, postData, response, "<LINK_0>"); }
Source:
<code>Object read(BinaryReaderExImpl reader) throws BinaryObjectException { try { assert reader != null; assert mode != BinaryWriteMode.OPTIMIZED : "OptimizedMarshaller should not be used here: " + cls.getName(); <START> assert !CompressionUtils.isCompressionType(mode); <END> Object res; switch (mode) { case BINARY: res = newInstance(); reader.setHandle(res); if (serializer != null) serializer.readBinary(res, reader); else ((Binarylizable)res).readBinary(reader); break; case OBJECT: res = newInstance(); reader.setHandle(res); for (BinaryFieldAccessor info : fields) info.read(res, reader); break; default: assert false : "Invalid mode: " + mode; return null; } if (readResolveMtd != null) { try { res = readResolveMtd.invoke(res); reader.setHandle(res); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof BinaryObjectException) throw (BinaryObjectException)e.getTargetException(); throw new BinaryObjectException("Failed to execute readResolve() method on " + res, e); } } return res; } catch (Exception e) { if (S.INCLUDE_SENSITIVE && !F.isEmpty(typeName)) throw new BinaryObjectException("Failed to deserialize object [typeName=" + typeName + ']', e); else throw new BinaryObjectException("Failed to deserialize object [typeId=" + typeId + ']', e); } }</code><technical_language>write assert message here.For instance, "Bad comp mode"</technical_language>

Target:
Object read(BinaryReaderExImpl reader) throws BinaryObjectException { try { assert reader != null; assert mode != BinaryWriteMode.OPTIMIZED : "OptimizedMarshaller should not be used here: " + cls.getName(); assert mode != BinaryWriteMode.COMPRESSED : "Compressed type isn't allowed here: " + mode; Object res; switch (mode) { case BINARY: res = newInstance(); reader.setHandle(res); if (serializer != null) serializer.readBinary(res, reader); else ((Binarylizable)res).readBinary(reader); break; case OBJECT: res = newInstance(); reader.setHandle(res); for (BinaryFieldAccessor info : fields) info.read(res, reader); break; default: assert false : "Invalid mode: " + mode; return null; } if (readResolveMtd != null) { try { res = readResolveMtd.invoke(res); reader.setHandle(res); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof BinaryObjectException) throw (BinaryObjectException)e.getTargetException(); throw new BinaryObjectException("Failed to execute readResolve() method on " + res, e); } } return res; } catch (Exception e) { if (S.INCLUDE_SENSITIVE && !F.isEmpty(typeName)) throw new BinaryObjectException("Failed to deserialize object [typeName=" + typeName + ']', e); else throw new BinaryObjectException("Failed to deserialize object [typeId=" + typeId + ']', e); } }
Source:
<code>public SSLContext get() { try { return SSLContext.getDefault(); } catch (NoSuchAlgorithmException e) { <START> return null; <END> } }</code><technical_language>nit: throw new RuntimeException(e); if this (unlikely), error more obvious in test</technical_language>

Target:
public SSLContext get() { try { return SSLContext.getDefault(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }